Skip to content

Instantly share code, notes, and snippets.

Avatar
🍣

Akshay Gupta kitallis

🍣
View GitHub Profile
@kitallis
kitallis / winclj.md
Last active Mar 12, 2021
clj on windows
View winclj.md

Setting up clojure on windows for beginners.

I tried 3 ways:

  • Install a windows linux sub-system - this was too hard to setup
  • Setting all deps from ground-up (git, java, curl etc.) - this was too hard to setup
  • Using scoop - this is the simplest way, described below

Note: this has only been tested on Windows 10

@kitallis
kitallis / static-file-server.go
Last active Jan 13, 2021
serve static files / directory with http basic auth in Go
View static-file-server.go
/*
Simple static file server with http basic auth in go
Usage:
-p="8100": port to serve on
-d=".": the directory of static files to host
Navigating to http://localhost:8100 will display the index.html or directory
listing file.
*/
@kitallis
kitallis / backup.sh
Last active Nov 26, 2020
backup pictures over rsync
View backup.sh
source="/Users/username/Pictures/"
destination="<u>@<ip>:/mnt/vol/backup/"
# this syncs safely, doesn't trash things on the server if you deleted locally, only accretes, only includes pictures
# for the rest of my mac I just rely on Time Machine backups
# includes a per-file progress bar (from rsync) and an overall progress bar using the pv utility
rsync -Phca --ignore-existing --bwlimit=1000 --stats --include="*" --include="Pictures/Photos Library.photoslibrary/" --include="Pictures/Photos Library.photoslibrary/***" -e "ssh" "$source" "$destination" | pv -lep -s $(rsync -av --dry-run "$source" "$destination" | awk 'NF' | wc -l)
# in bash_profile or equivalent,
alias backup='$HOME/bin/backup'
@kitallis
kitallis / setup-rpi.md
Last active Nov 26, 2020
Setup rpi without display (headless)
View setup-rpi.md

Pre-req

  • Raspberry Pi 3
  • LAN Cable (tested on CAT6 cable)
  • USB Cable (2.x)
  • SD Card (class 10, >8gb)
  • Mac OS X (tested on Sierra and above)

Download

@kitallis
kitallis / pakg.sh
Last active Nov 9, 2020
generic package mgmt commands
View pakg.sh
#!/bin/sh
if [ -z "$1" ]
then
echo "Usage: pakg <i(nstall)|r(emove)|s(earch)|u(pdate)|l(ist)>"
else
os=$([[ -f /etc/os-release ]] && grep ^ID= /etc/os-release | cut -d = -f 2 || uname)
echo --------------------- "$os" --------------------
command=$1
shift
case $os in
View keybase.md

Keybase proof

I hereby claim:

  • I am kitallis on github.
  • I am kitallis (https://keybase.io/kitallis) on keybase.
  • I have a public key ASCNbGUxnsIJxJ7vDZyJL98BtU-_g9CBeVrKIKHMSFCd6wo

To claim this, I am signing this object:

@kitallis
kitallis / capacity-reserve.clj
Created Nov 21, 2018
Figure out capacity reserve for any app ever
View capacity-reserve.clj
(defn degraded-boxes [degradation-time chef-time sleep-time concurrency]
(* concurrency (Math/ceil
(/ degradation-time
(+ chef-time sleep-time)))))
(defn number-of-boxes [chef-time
sleep-time
tolerable-boxes
degradation-time
concurrency]
@kitallis
kitallis / setup-do.bash
Last active Sep 29, 2018
quickly setup a Digital Ocean debian 9 box
View setup-do.bash
adduser kitallis
usermod -aG sudo kitallis
apt update
apt upgrade
apt install ufw
ufw app list
ufw allow OpenSSH
ufw enable
ufw status
cp -r ~/.ssh /home/kitallis
@kitallis
kitallis / prometheus-osx.sh
Created Oct 19, 2015
quickly setup prometheus monitoring on os x
View prometheus-osx.sh
brew install go
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
GO15VENDOREXPERIMENT=1 go get github.com/prometheus/prometheus/cmd/...
prometheus -config.file=prometheus.yml
@kitallis
kitallis / pg_repack.md
Last active Sep 5, 2017
some notes on using pg_repack
View pg_repack.md

so if table is 350g, free space should be = 700

given you current DB = 900gb, and your disk = 1.3gb, you should bump it up to at least 1.6tb

that will ensure 20% free space and space for an additional table

things to keep in mind before using repack:

1. response time during repack *will* increase – make sure you do it at night