Skip to content

Instantly share code, notes, and snippets.

View zmpeg's full-sized avatar

Matt Zandstra zmpeg

View GitHub Profile
Cloud-init v. 0.7.6 running 'init-local' at Wed, 01 Feb 2017 20:15:19 +0000. Up 8.51 seconds.
Cloud-init v. 0.7.6 running 'init' at Wed, 01 Feb 2017 20:15:19 +0000. Up 8.88 seconds.
ci-info: ++++++++++++++++++++++Net device info+++++++++++++++++++++++
ci-info: Device Up Address Mask Hw-Address
ci-info: lo True 127.0.0.1 255.0.0.0 .
ci-info: eth0 True 10.0.2.108 255.255.255.0 0a:01:fe:b0:17:92
ci-info: +++++++++++++++++++++++++++++Route info++++++++++++++++++++++++++++++
ci-info: Route Destination Gateway Genmask Interface Flags
ci-info: 0 0.0.0.0 10.0.2.1 0.0.0.0 eth0 UG
ci-info: 1 10.0.2.0 0.0.0.0 255.255.255.0 eth0 U
@zmpeg
zmpeg / .zshrc
Created November 22, 2016 16:34
# Git prompt
source ~/.zsh/git-prompt/zshrc.sh
PROMPT='%B%m%~%b$(git_super_status) %# '
# Jump by word with control
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
# Fix History
SAVEHIST=999999999
#!/usr/bin/env python
import argparse
import math
def deg2num(lat_deg, lon_deg, zoom):
lat_rad = math.radians(lat_deg)
n = 2.0 ** zoom
xtile = int((lon_deg + 180.0) / 360.0 * n)
ytile = int((1.0 - math.log(math.tan(lat_rad) + (1 / math.cos(lat_rad))) / math.pi) / 2.0 * n)
return (xtile, ytile)
@zmpeg
zmpeg / post-receive.sh
Created March 3, 2015 04:05
Git post-receive deploy hook for simple node apps using screen. Place this in a file in a bare repo under hooks/post-receive.
#!/bin/bash
DEPLOY_DIR="$HOME/apps/my-app/"
SCREEN_NAME="my-app"
echo "Deploying"
GIT_WORK_TREE="${DEPLOY_DIR}" git checkout -f master
echo "Loading nvm, node, npm"
export NVM_DIR="/home/deploy/.nvm"
@zmpeg
zmpeg / shoot-osx.sh
Last active November 29, 2016 16:54
shoot
#!/bin/bash
#
# Takes a screenshot, puts the URL in your clipboard,
# Then syncronizes the screenshot to your configured host
LOCALDIR="$HOME/Pictures/screenshots/"
REMOTEHOST="mjz.me"
REMOTEDIR="/home/matt/public/mjz.me/public/s/"
TIMESTAMP=`date +%s`
WEBHOST="http://tesera.screenshots.s3-website-us-east-1.amazonaws.com/"
@zmpeg
zmpeg / README.md
Last active August 12, 2019 20:15
go.sh

go.sh

A simple script to open a dynamic ssh tunnel to your server and connect a fresh chrome browser to it via the socks5 proxy.

Installation

Clone the repo and maybe symlink/shortcut the version you need to somewhere convenient.

git clone https://gist.github.com/8911e3b78a8873612e17.git $HOME/opt/go.sh

@zmpeg
zmpeg / markup_indenter.rb
Last active December 15, 2015 20:29
Indent markup, removing cruft and matching indent lines.
#!/usr/bin/env ruby
IGNORE = ['BR', 'META', '!DOCTYPE', '!--']
def tab_change(tag)
tagname = tag.upcase.split(/[\s|>]/).first[1..-1]
is_open = tag[1] != '/'
return 0 if IGNORE.include? tagname
return 0 if is_open && tag.include?("/#{tagname}")
is_open ? 1 : -1
@zmpeg
zmpeg / extend.sh
Last active December 15, 2015 19:48
extend desktop with xrandr. Usage: ./extend.sh [dir] where [dir] is 'left' or 'right' or 'clone'
#!/bin/bash
if [ -z "$1" ]; then
xrandr --output HDMI1 --mode 0x0
else
RES=`xrandr | grep -A1 HDMI1 | tail -n1 | awk '{ print $1 }'`
echo "Detected HDMI1 with resolution ${RES}"
if [ "$1" == "right" ] || [ "$1" == "left" ]; then
echo "Extending HDMI1 to the {$1} of eDP1"
@zmpeg
zmpeg / zsh.zprofile
Last active December 11, 2015 03:39
my zsh config
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
@zmpeg
zmpeg / wofind.sh
Created December 3, 2012 15:48
Script to recursively grep for files in WebObjects and print their locations nicely.
#!/bin/sh
for A in `grep -r "$1" | awk '{print $1}' | grep html`; do basename $A; done | sort | uniq