View gist:8721943
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" There is no way to set the cwd per tab by default. | |
" :cd changes the cwd for all of vim | |
" :lcd changes the cwd for the active window | |
" These two lines remedy this: | |
au TabEnter * if exists("t:wd") | exe "cd" . '"' t:wd . '"' | endif | |
au TabLeave * let t:wd=getcwd() |
View gist:d38b455df8bf83a78d3d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original: | |
# http://stackoverflow.com/a/6078528 | |
# | |
# Call `zipit` with the path to either a directory or a file. | |
# All paths packed into the zip are relative to the directory | |
# or the directory of the file. | |
def zipit(path, archname): | |
archive = zipfile.ZipFile(archname, "w", zipfile.ZIP_DEFLATED) | |
if os.path.isdir(path): |
View gist:8955008908385033e369
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Promise = require('bluebird') | |
, _ = require('lodash') | |
; | |
var xs = [ 1, 2, 3, 4 ]; | |
var mapLimit = function(xs, limit, f) { | |
return Promise.all(_.foldl( | |
_.chunk(xs, limit) |
View git-du.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: git du [max-size] | |
function git-du { | |
local -r max_size="${1:-0}" | |
du | while read -r line; do | |
read -r s n <<< "$line" | |
if ((s > max_size)) && git ls-files "$n" --error-unmatch &> /dev/null; then | |
echo "$line" | |
fi | |
done | |
} |
View run.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Task wrapper. Runs various chores in a cross platform manner. | |
# | |
# Usage: run [-h] <command> | |
# | |
# Available commands are: | |
# build: Build the project | |
# <other>: Run any other command available in the NPM path | |
# |
View .bashrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Place this into your .bashrc after installing FZF, | |
# Then update your .tmux.conf and create key-bindings. Example: | |
# | |
# unbind s | |
# bind s run "tmux new-window -n 'Switch Session' 'bash -ci tmux_select_session'" | |
# unbind K | |
# bind K run "tmux new-window -n 'Kill Session' 'bash -ci tmux_kill_session'" | |
# unbind C |
View install-vim-from-sources-ubuntu.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This build vim from sources with lua, python and ruby enabled as well as support for | |
# the system clipboard. | |
# | |
# Preparation | |
# | |
# 1. Download vim tarball from vim.org, extract and cd | |
# 2. Enable "Source Code" in Software Center under "Software & Updates". | |
# This is required for `sudo apt-get build-dep` to work. | |
sudo apt-get build-dep vim && |
View genesis_public_key
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
044c089823ed2816cf0902a5840e237dcb046b602e58f7e2029784d504777a3f1e8cd8d071351195dd19822ad290f7c60e655c233b75d0089effb069ffb81e4fe3;stwiname |
View gist:ce6143c06d3a6ff360d6397c8f71349a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
function run_handler { | |
: # whatever | |
} | |
while :; do | |
rm -f pipe | |
mkfifo pipe |
View docker-ufw-cf.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Disable public access to all exported ports on docker containers. | |
# Restrict access only to well-known cloudflare servers. | |
set -eo pipefail | |
function update_rules { | |
local target_file=$1 | |
awk -v "rules=$2" ' |
OlderNewer