This file contains hidden or 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
#!/usr/bin/env sh | |
# Google search from command line on a Mac | |
open "http://www.google.com/search?q=$(echo "$@" | sed -Ee 's/\s+/%20/g')" |
This file contains hidden or 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
#!/usr/bin/env bash | |
# Pause the following Cloud Storage Services | |
services=('Google Drive' Copy Dropbox) | |
# Based on ideas and code on https://github.com/tjluoma/dropbox-pause-unpause | |
if [[ $0 =~ pause || $1 =~ pause ]] ; then | |
command=STOP |
This file contains hidden or 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
#!/usr/bin/env sh | |
# Remove spurious CUPS files created in /tmp | |
find /private/tmp -maxdepth 1 -type l -name 55\*|sudo xargs rm |
This file contains hidden or 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
GOPATH=/tmp/$$.installgobin GOBIN=$(go env GOROOT)/bin vim -u ~/.vimrc -c ":GoInstallBinaries" -c ":q" /tmp/src/$$.go |
This file contains hidden or 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
// Niave implementation of the Ackermann function | |
// https://en.wikipedia.org/wiki/Ackermann_function | |
package main | |
import "fmt" | |
func Ackermann(m, n uint) uint { | |
//fmt.Printf("Called Ackermann(%d,%d) ", m, n) | |
if m == 0 { | |
return n + 1 |
This file contains hidden or 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/dash | |
ssid=$1 ;shift | |
psk=$1; shift | |
# Is this network already defined? | |
network_id=$(wpa_cli list_networks | tail -n +3 | grep $ssid |cut -f 1) | |
if [ -z $network_id ] ; then | |
maxNetworkId=$(wpa_cli list_networks | tail -n +3 | tail -n 1 | cut -f 1)] |
This file contains hidden or 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/sh | |
ssid=$1; shift | |
psk=$1; shift | |
network_id=$(wpa_cli list_networks | tail -n +3 | grep $ssid |cut -f 1) | |
if [ -z $network_id ] ; then | |
maxNetworkId=$(wpa_cli list_networks | tail -n +3 | tail -n 1| cut -f 1)] | |
if [ -z $maxNetworkId ] ; then |
This file contains hidden or 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
#! /usr/bin/env sh | |
# Set up some shit dependeing on primary mac address | |
if=en0 # Change this is you don't want to use primary | |
updateHost() { | |
# $1 = ip address | |
# $2 = hostname | |
# $3 = interface name |
This file contains hidden or 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 | |
# manage Tmux | |
if [ -n "$TMUX" ]; then # in tmux | |
if [ -n "$COLORTERM" ]; then # in rich VT | |
export TERM=xterm-256color-italic | |
fi | |
elif tmux list-sessions > /dev/null 2>&1 ; then | |
tmux attach # try to attach |
This file contains hidden or 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
# Install all the Go tools and godep tool | |
# Location of gobin is based on installation by OS X Homebrew | |
sudo -u admin GOPATH=/tmp GOBIN=/usr/local/opt/go/bin go get -u golang.org/x/tools/cmd/... | |
sudo -u admin GOPATH=/tmp GOBIN=/usr/local/opt/go/bin go get -u github.com/tools/godep |