Skip to content

Instantly share code, notes, and snippets.

@isao
isao / git-branches-by-commit-date.sh
Created October 9, 2015 17:51 — forked from jasonrudolph/git-branches-by-commit-date.sh
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
@isao
isao / get-my-ip.sh
Last active September 29, 2015 01:43
Display the *local* IP address of the active network interface.
#!/bin/sh -eu
get_interface()
{
route get 0.0.0.0 2>/dev/null | awk '/interface: /{print $2}'
}
get_ip()
{
ifconfig -r $1 | awk '/inet /{print $2}'
@isao
isao / echo.pac
Last active December 10, 2015 21:57
nginx setup
// This is a proxy config file that echos the requested server ip and port, by
// using nginx SSIs. Generated on: <!--# echo var="date_local" -->
function FindProxyForURL(url, host) {
// These values are derived from the current request's server/port.
var prefix = 'http://' + '<!--# echo var="arg_prefix" default="reachclient" -->';
var proxyhost = '<!--# echo var="server_addr" default="dev.pondr.in" -->';
var proxyport = '<!--# echo var="server_port" default="8000" -->'
if (url.substring(0, prefix.length) === prefix) {
@isao
isao / git-brownbag.md
Last active August 29, 2015 14:22
git intro brown bag reveal.js slide deck
@isao
isao / .ctags
Last active January 29, 2018 21:38 — forked from jb55/.ctags
TypeScript ctags config. Based on https://github.com/jb55/typescript-ctags with 1. `variables` removed, 2. members changed to only match methods, 3. added protected for TypeScript v1.4+
--langdef=TypeScript
--langmap=typescript:.ts
--regex-typescript=/^[ \t]*(export)?[ \t]*class[ \t]+([a-zA-Z0-9_]+)/\2/c,classes/
--regex-typescript=/^[ \t]*(export)?[ \t]*module[ \t]+([a-zA-Z0-9_]+)/\2/n,modules/
--regex-typescript=/^[ \t]*(export)?[ \t]*function[ \t]+([a-zA-Z0-9_]+)/\2/f,functions/
--regex-typescript=/^[ \t]*var[ \t]+([a-zA-Z0-9_]+)[ \t]*=[ \t]*function[ \t]*\(\)/\1/v,varlambdas/
--regex-typescript=/^[ \t]*(public|protected|private)?[ \t]*(static)?[ \t]*([a-zA-Z0-9_]+)\(.*\).+{$/\3/f,members/
--regex-typescript=/^[ \t]*(export)?[ \t]*interface[ \t]+([a-zA-Z0-9_]+)/\2/i,interfaces/
--regex-typescript=/^[ \t]*(export)?[ \t]*enum[ \t]+([a-zA-Z0-9_]+)/\2/e,enums/
@isao
isao / ctags.sh
Last active May 25, 2021 20:33
ctags
#!/bin/bash -e
# Wrapper script to do BBEdit compatible ctags when invoked by any of the these:
# 1. from the command line
# 2. from a BBEdit Script Menu
# 3. from a .git/hooks file like post-checkout or post-merge
maketags()
{
cd "$dir"
@isao
isao / adb-logcat-mediaroom.sh
Last active February 2, 2016 03:13
adb logcat by process name
#!/bin/sh -eu
# https://gist.github.com/isao/c742a5e8d76ad653ad89
pid=$(adb shell 'ps' 2>&1 | grep com.ericsson.mediaroom.tv3client | awk '{print $2}')
if [[ -z $pid ]]
then
echo 'No process matching "com.ericsson.mediaroom.tv3client"'
exit 1
fi
git checkout \
$(git show -s --pretty='%T' \
$(git show-ref -d \
$(git describe --abbrev=0) |\ # grab the most recent tag
tail -n1 |\
awk '{print $1}'\ # dereference the commit hash it refers to
)\ # ... show the tree-hash it points at
) -- test # check that version's "test/" directory out into cwd
make test # if this fails, you should bump major,
# otherwise bump minor or patch.
@isao
isao / set-my-ip.sh
Last active August 29, 2015 14:14
update subdomain IP address on cloudflare
#!/bin/sh -eu
# config
#
email=REDACTED
token=$(security find-generic-password -ws 'Cloudflare API key' -a $email)
domain=REDACTED
subdomain=REDACTED
@isao
isao / msbuild-here.sh
Last active January 24, 2019 14:48
From a Mac, tell VMWare to run MSBuild in the Mac's current working directory. Any arguments will be passed through to MSBuild. Usage: `cd path/to/web.sln && msbuild-here.sh [args]`
#!/bin/sh -eu
#
# This script runs MSBuild in a VMWare image from a Mac. It translates the Mac's
# current working directory to the corresponding Windows VM path to a shared
# directory. Any arguments to this script will be passed through to MSBuild.
#
# Usage: cd path/to/web.sln && msbuild-here.sh [args]
#
# https://gist.github.com/isao/d871a5b90e3505cc4151