Skip to content

Instantly share code, notes, and snippets.

View kitallis's full-sized avatar
🍣

Akshay Gupta kitallis

🍣
View GitHub Profile
@kitallis
kitallis / winclj.md
Last active March 12, 2021 10:47
clj on windows

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 / backup.sh
Last active November 26, 2020 20:17
backup pictures over rsync
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 / pakg.sh
Last active November 9, 2020 15:12
generic package mgmt commands
#!/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

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 November 21, 2018 06:15
Figure out capacity reserve for any app ever
(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 / static-file-server.go
Last active April 16, 2023 03:18
serve static files / directory with http basic auth in 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 / setup-do.bash
Last active September 29, 2018 22:02
quickly setup a Digital Ocean debian 9 box
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 / setup-rpi.md
Last active November 26, 2020 11:34
Setup rpi without display (headless)

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 / pg_repack.md
Last active September 5, 2017 10:36
some notes on using pg_repack

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
@kitallis
kitallis / about-batti.md
Last active April 4, 2017 08:29
About Batti and E-waste

The following are the messages we send out usually to create awareness and and also asking ppl to donate e-waste. You can probably circulate them amongst your group, to attain clarity about what we do.

About Batti

Greetings from everyone at Batti! North East India—beautiful and serene, but many homes are yet to get electrical lighting.

Batti is a an initiative of Further & Beyond Foundation. Batti strives to provide basic lighting for North East India’s most remote inhabitants. We have been installing a solar powered systems that give access to artificial light in tribal homes. So far, Batti has reached more than 1000 people in 282 homes. ​ A part of our funds are generated by upcycling and recycling e-waste.