Skip to content

Instantly share code, notes, and snippets.

View kitallis's full-sized avatar
🍣

Akshay Gupta kitallis

🍣
View GitHub Profile
{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"basics": {
"name": "Akshay Gupta",
"label": "Engineer",
"image": "",
"email": "[email protected]",
"phone": "(+91) 8553427344",
"url": "http://kitallis.me",
"summary": "Systems & product-focused engineer who likes smaller teams and shipping human-focused software.",
(ns trillain.handler
(:require [clojure.string :as string]
[compojure.core :refer [defroutes GET]]
[compojure.route :as route]
[ring.middleware.defaults :refer [site-defaults wrap-defaults]]))
(defonce store (atom {}))
(defonce job-eta-in-sec 10000)
(defn- job []
(ns byteoffset
(:require [clojure.java.io :as io]
[opencsv-clj.core :as csv]
[com.climate.claypoole :as cp]
[criterium.core :as crit])
(:import (java.io RandomAccessFile
FileInputStream
BufferedInputStream
InputStreamReader
BufferedReader)))
@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