start new:
tmux
start new with session name:
tmux new -s myname
| import static org.junit.Assert.*; | |
| import static org.hamcrest.CoreMatchers.is; | |
| import static org.mockito.Mockito.*; | |
| import static org.mockito.BDDMockito.*; | |
| import org.hamcrest.BaseMatcher; | |
| import org.hamcrest.Description; | |
| import org.hamcrest.Matcher; |
| # add to ~/.bash_profile, and close/reopen a shell. Will autocomplete any hosts found in known_hosts. | |
| complete -W "$(echo `cat ~/.ssh/known_hosts | cut -f 1 -d ' ' | sed -e s/,.*//g | uniq | grep -v "\["`;)" ssh |
| #!/bin/sh | |
| # Get MacOSX idletime. Shamelessly stolen from http://bit.ly/yVhc5H | |
| /usr/sbin/ioreg -c IOHIDSystem | /usr/bin/awk '/HIDIdleTime/ {print int($NF/1000000000); exit}' |
| #!/bin/sh | |
| ### | |
| # SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer) | |
| # For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos | |
| ### | |
| # Alot of these configs have been taken from the various places | |
| # on the web, most from here | |
| # https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx |
| #!/usr/bin/env python | |
| """Simple HTTP Server With Upload. | |
| This module builds on BaseHTTPServer by implementing the standard GET | |
| and HEAD requests in a fairly straightforward manner. | |
| """ |
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
| @Grab('org.quartz-scheduler:quartz:2.1.6') | |
| @Grab('org.slf4j:slf4j-simple:1.7.1') | |
| import org.quartz.* | |
| import org.quartz.impl.* | |
| import org.quartz.jobs.* | |
| import static org.quartz.DateBuilder.* | |
| import static org.quartz.JobBuilder.* | |
| import static org.quartz.TriggerBuilder.* | |
| import static org.quartz.CalendarIntervalScheduleBuilder.* |
| #!/bin/bash | |
| # Install: | |
| # curl -O https://gist.githubusercontent.com/2called-chaos/4285767/raw/setup-autossh-tunnel.sh | |
| # chmod u+x setup-autossh-tunnel.sh | |
| # ./setup-autossh-tunnel.sh | |
| SSH_USER="mysql_tunnel" | |
| SSH_SERVER="db.example.net" | |
| SSH_PORT="22" |