Skip to content

Instantly share code, notes, and snippets.

View sandipb's full-sized avatar

Sandip Bhattacharya sandipb

View GitHub Profile
@vans163
vans163 / virtualbox.sh
Last active November 6, 2021 22:15
Virtualbox Commandline stuff
#Create storage
VBoxManage createhd --filename VMName.vdi --size 40000 --format VDI
VBoxManage modifyhd GoDial.vdi --resize 30500
VBoxManage list hdds
VBoxManage closemedium disk $(UUID) --delete
#Create VM
VBoxManage createvm --name "VMName" --ostype Windows7_64 --register
@sdague
sdague / imaway
Last active March 8, 2022 06:23
dbus xchat integration
#!/usr/bin/python
import dbus
import dbus.glib
import gobject
import subprocess
def lock():
print "Screen saver turned on"
// homerunner is Brad's shitty Docker wrapper after he got tired of running
// HA nine-VM Kubernetes clusters. Earlier versions of this tried to use podman
// and fancy cloud-init and CNI stuff but then I decided to go to the other
// extreme and write something super specific to what I need and super dumb:
// run my containers from gcr.io, and use my home Ceph cluster for mounts/state.
//
// This primarily runs Home Assistant, HomeSeer, an MQTT server, and some cameras.
// And some omitted misc stuff.
package main
@hlindberg
hlindberg / sorthash.pp
Last active July 20, 2022 12:36
This is an example of how to recursively sort a Hash in the puppet language using the tree_each() function. Note that in versions before Puppet 6.0 the `convert_to` function does not accept the extra 'hash_tree' arg.ument.
# When you need to process a hash with keys in sorted order
# you may have found the `sort()` function - but it only
# operates on an Array.
#
# Most of the time what is wanted is simply achieved
# by taking the keys of a hash and sorting those and
# then iterating over the keys.
#
# When, however the wanted result is a new Hash
# with all keys sorted recursively then this becomes
@ubermuda
ubermuda / nginx.conf
Created November 5, 2013 22:13
Proxy a unix socket HTTP server to a tcp port using nginx.
server {
listen 127.0.0.1:9000;
location / {
proxy_pass http://unix:/var/run/docker.sock:/;
}
}
@romainl
romainl / .ctags
Last active June 14, 2023 09:19
My ctags config
--langdef=less
--langmap=less:.less
--regex-less=/^[ \t&]*#([A-Za-z0-9_-]+)/\1/i,id,ids/
--regex-less=/^[ \t&]*\.([A-Za-z0-9_-]+)/\1/c,class,classes/
--regex-less=/^[ \t]*(([A-Za-z0-9_-]+[ \t\n,]+)+)\{/\1/t,tag,tags/
--regex-less=/^[ \t]*@media\s+([A-Za-z0-9_-]+)/\1/m,media,medias/
--regex-less=/^[ \t]*(@[A-Za-z0-9_-]+):/\1/v,variable,variables/
--regex-less=/\/\/[ \t]*(FIXME|TODO)[ \t]*\:*(.*)/\1/T,Tag,Tags/
--langdef=scss
@aileftech
aileftech / hex-colors.txt
Created October 1, 2022 18:10
A Bash one-liner to produce a list of HEX color codes that read like (supposedly) valid English words
$ grep -P "^[ABCDEFabcdefOoIi]{6,6}$" /usr/share/dict/words | tr 'OoIi' '0011' | tr '[:lower:]' '[:upper:]' | awk '{print "#" $0}'
#ACAD1A
#B0BB1E
#DEBB1E
#AB1DED
#ACAC1A
#ACCEDE
#AC1D1C
#BAB1ED
#BA0BAB
@jace
jace / denoise.sh
Last active October 11, 2023 10:17
Remove noise from video using sox and ffmpeg
# 1. extract audio from all videos (assuming .mp4 videos).
for FILE in *.mp4; do ffmpeg -i $FILE ${FILE%%.mp4}.wav; done
# 2. use the first second of the first audio file as the noise sample.
sox `ls *.wav | head -1` -n trim 0 1 noiseprof noise.prof
# Replace with a specific noise sample file if the first second doesn't work for you:
# sox noise.wav -n noiseprof noise.prof
# 3. clean the audio with noise reduction and normalise filters.
@CJEnright
CJEnright / gzip.go
Last active December 19, 2023 19:40
Idiomatic golang net/http gzip transparent compression, an updated version of https://gist.github.com/bryfry/09a650eb8aac0fb76c24
package main
import (
"net/http"
"compress/gzip"
"io/ioutil"
"strings"
"sync"
"io"
)
@fanf
fanf / .imapfilterSLASHconfig.lua
Created August 28, 2014 14:44
imapfilter config for server with IDLE support
if_dir = os.getenv('HOME') .. '/.imapfilter/'
---------------
-- Options --
---------------
-- time in second before deciding the server timeouted
options.timeout = 120
-- auto-subscribe to new directories
options.subscribe = true