Skip to content

Instantly share code, notes, and snippets.

@WarpEngineer
WarpEngineer / bigOSets
Last active August 29, 2015 14:07
Table of Important Big-Oh Sets
Arranged from smallest to largest, happiest to saddest, in order of increasing domination:
function common name
-------- -----------
O( 1 ) :: constant
is a subset of O( log n ) :: logarithmic
is a subset of O( log^2 n ) :: log-squared [that's (log n)^2 ]
is a subset of O( root(n) ) :: root-n [that's the square root]
is a subset of O( n ) :: linear
is a subset of O( n log n ) :: n log n
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
@WarpEngineer
WarpEngineer / osx-for-hackers.sh
Created November 20, 2014 16:06 — forked from brandonb927/osx-for-hackers.sh
Yosemite Edition
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
List all installed Linux kernel images:
dpkg --list | egrep -i --color 'linux-image|linux-headers'
Remove a single image:
apt-get --purge remove linux-image-...
Remove all:
apt-get purge $(dpkg --list |egrep 'linux-image-[0-9]' |awk '{print $3,$2}' |sort -nr |tail -n +3 |grep -v $(uname -r) |awk '{ print $2}')
Supported escape sequences:
~. - terminate session
~B - send a BREAK to the remote system
~R - Request rekey (SSH protocol 2 only)
~# - list forwarded connections
~? - this message
~~ - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)
sudo apt-mark hold packagename
sudo apt-mark unhold packagename
dpkg --get-selections | grep "hold"
@WarpEngineer
WarpEngineer / ssh-menu
Last active November 14, 2015 01:12
Easily list the hosts in ssh's config file.
function ssh-menu() {
cat ~/.ssh/config | grep "^Host " | awk '{$1="";print NR,$0}' | more
}
@WarpEngineer
WarpEngineer / gist:f0253ba778e47b91c214c5d3c38194b6
Created August 17, 2016 12:05
Script to fix git commit author and email.
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="[email protected]"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
This is a tweak of https://github.com/mislav/dotfiles/blob/master/bin/tmux-vim-select-pane
which is linked from https://github.com/christoomey/vim-tmux-navigator as a possible fix for the vim integration.
I couldn't get the original one to work right on tmux 1.8 so I fixed it up.
These go into tmux config file:
bind-key -n C-h run-shell "~/tmux-vim-select-pane -L"
bind-key -n C-j run-shell "~/tmux-vim-select-pane -D"
bind-key -n C-k run-shell "~/tmux-vim-select-pane -U"
@WarpEngineer
WarpEngineer / web-servers.md
Created July 6, 2017 12:58 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000