Skip to content

Instantly share code, notes, and snippets.

View thapakazi's full-sized avatar
💭
🐧 🗡️ 💻

Milan Thapa thapakazi

💭
🐧 🗡️ 💻
View GitHub Profile
#!/bin/bash
# storetime: 1:30m 2:1h 3:3h 4:6h 5:12h 6:1d 7:3d 8:7d 9:forever
# addprivacy: no:no 1:basic 2:strong 3:shorten
picpaste () {
opts=( -F storetime=1 -F addprivacy=1 -F rules=yes )
link=http://www.picpaste.com/upload.php
curl -sA firefox "${opts[@]}" -F upload=@"$1" "$link" \
| sed -n '/Picture URL/{n;s/.*">//;s/<.*//p}'
# Bash function gen_random_filename
# Description: Generates random two-word names with date appended
# Requires a dictionary file, easily generated with `aspell dump master > dictionary.txt`
# or grab it from https://gist.githubusercontent.com/ttscoff/55493fe89c35ec1588ba/raw/
# Requires shuf and aspell
#
# Example results:
# reissue_degraded-2015-03-12@0254
# Cascades_derivatives-2015-03-12@0255
# oxygens_soaked-2015-03-12@0256
@thapakazi
thapakazi / react-native-talk.md
Last active August 29, 2015 14:25 — forked from peterjmag/react-native-talk.md
Let's build a React Native app in 20 minutes - React Berlin #1
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true
@thapakazi
thapakazi / tmux.md
Created January 11, 2016 10:49 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@thapakazi
thapakazi / Makefile.golang
Created February 22, 2016 15:23 — forked from dnishimura/Makefile.golang
Makefile for Golang projects
# Makefile for a go project
#
# Author: Jon Eisen
# site: joneisen.me
#
# Targets:
# all: Builds the code
# build: Builds the code
# fmt: Formats the source files
# clean: cleans the code
@thapakazi
thapakazi / presentation-tips.md
Created March 6, 2016 18:38 — forked from macintux/presentation-tips.md
Public speaking tips
@thapakazi
thapakazi / formatted
Created April 25, 2016 11:29 — forked from marcellodesales/formatted.sh
One-liner REST server using netcat - nc
rm -f out
mkfifo out
trap "rm -f out" EXIT
while true
do
cat out | nc -l 1500 > >( # parse the netcat output, to build the answer redirected to the pipe "out".
export REQUEST=
while read line
do
line=$(echo "$line" | tr -d '[\r\n]')
@thapakazi
thapakazi / app.go
Created April 25, 2016 15:42 — forked from sanatgersappa/app.go
Web app written in Go to demonstrate handling multiple file uploads.
package main
import (
"html/template"
"io"
"net/http"
"os"
)
//Compile templates on start