Skip to content

Instantly share code, notes, and snippets.

View PratikDeoghare's full-sized avatar

Pratik Deoghare PratikDeoghare

View GitHub Profile
@PratikDeoghare
PratikDeoghare / pulumify.ts
Created April 20, 2026 10:12
Pulumify -- makes your types play nice with pulumi
import * as pulumi from "@pulumi/pulumi";
import * as random from '@pulumi/random';
type Pulumify<T> = {
[K in keyof T]: T[K] extends object
? Pulumify<T[K]> | pulumi.Input<Pulumify<T[K]>>
: T[K] | pulumi.Input<T[K]>;
};
const lambdaArn = new random.RandomString("mine", {
@PratikDeoghare
PratikDeoghare / style.css
Last active March 30, 2026 09:28
Style CSS with color
body {
background-color: #eeb480;
}
p {
padding-bottom: 1em;
}
article {
@PratikDeoghare
PratikDeoghare / style.css
Created March 20, 2026 12:21
Minimal Good Looking CSS
body {
padding: 2em;
max-width: 50em;
margin-left:auto;
margin-right:auto;
margin-bottom: 32em;
line-height: 1.55;
}
p {
@PratikDeoghare
PratikDeoghare / dict.go
Created July 20, 2025 11:33
a naughty golang program ;-)
// https://go.dev/play/p/pCVgS47-yNt
package main
import (
"encoding/json"
"fmt"
)
type dict map[string]any
import code, os, sys
prompt = '> '
def read_fork():
global prompt
while True:
s = input(prompt)
s = s.strip()
if s == 'fork' or s == 'whatif':
@PratikDeoghare
PratikDeoghare / product1.go
Created September 13, 2024 21:45
itertools.product in golang
package main
import (
"fmt"
"testing"
)
func product(xss [][]int) [][]int {
if len(xss) == 0 {
return nil
@PratikDeoghare
PratikDeoghare / pwc.go
Last active June 18, 2023 07:36
Approximate Word Counter
package main
import (
"flag"
"fmt"
"io"
"math/rand"
"os"
"regexp"
"sort"
/**
* Naive goroutines lookalike in Scala.
*
*/
import scala.concurrent._
import scala.concurrent.duration.Duration
@PratikDeoghare
PratikDeoghare / zbell.sh
Created March 24, 2023 16:13 — forked from jpouellet/zbell.sh
Makes Zsh print a bell when long-running commands finish. I use this in combination with i3 and throw big compile jobs (or whatever it may be) into another workspace to get a nice visual notification (workspace indicator turns red) when it's done so I don't need to waste time regularly checking on it.
#!/usr/bin/env zsh
# This script prints a bell character when a command finishes
# if it has been running for longer than $zbell_duration seconds.
# If there are programs that you know run long that you don't
# want to bell after, then add them to $zbell_ignore.
#
# This script uses only zsh builtins so its fast, there's no needless
# forking, and its only dependency is zsh and its standard modules
#
@PratikDeoghare
PratikDeoghare / slice
Created July 21, 2022 07:22
get range of chars from file
#! /usr/bin/env python3
import sys
f = sys.stdin
if len(sys.argv) == 4:
f = open(sys.argv[3])
a = int(sys.argv[1])
b = int(sys.argv[2])