This file contains 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 | |
SOCK_DIR=${HOME}/.ssh | |
SOCK_NAME=auth.sock | |
if [ -n "$SSH_AUTH_SOCK" ]; then | |
[ -d "$SOCK_DIR" ] || mkdir -m 0700 "$SOCK_DIR" | |
ln -nfs "$SSH_AUTH_SOCK" "$SOCK_DIR/$SOCK_NAME" | |
export SSH_AUTH_SOCK="$SOCK_DIR/$SOCK_NAME" | |
fi | |
#screen_command='screen -xRR' | |
screen_command="tmux attach" |
This file contains 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 | |
# Control an xterm window | |
name=`basename $0` | |
bq='`' | |
eq="'" | |
usage () | |
{ |
This file contains 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
def all | |
return ld.get_features.map do |feature| | |
new_feature = {} | |
[:key, :name, :on].each do |k| | |
new_feature[k] = feature[k] | |
end | |
new_feature[:id] = new_feature[:key] | |
new_feature | |
end | |
end |
This file contains 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
function cdgem { | |
bundle="$(bundle show $1)" | |
gem="$(gem which $1 2>/dev/null | grep '^/')" | |
for gem_dir in "${bundle}" "${gem:h}"; do | |
if [[ -d "${gem_dir}" ]]; then | |
cd "${gem_dir}" | |
return | |
fi | |
done | |
print 'not found' |
This file contains 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
# Initialize to use Indexer object idx. Also precomputes some | |
# things that can be computed with a single traversal of the | |
# document directory. | |
def initialize(idx) | |
@idx = idx | |
@m = 0.0 | |
@c = Hash.new(0.0) | |
@idx.each_document do |doc| | |
@m += 1 | |
@c[cat(doc.name)] += 1 |
This file contains 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
local app = require "mjolnir.application" | |
local hotkey = require "mjolnir.hotkey" | |
local window = require "mjolnir.window" | |
local fnutils = require "mjolnir.fnutils" | |
local geom = require "mjolnir.geometry" | |
local screen = require "mjolnir.screen" | |
local alert = require "mjolnir.alert" | |
local MOD = {"cmd", "ctrl"} |
This file contains 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 | |
# Ask for the administrator password upfront | |
sudo -v | |
# Keep-alive: update existing `sudo` time stamp until script has finished | |
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & | |
# Set the colours you can use | |
black='\033[0;30m' |
This file contains 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 | |
# super-simplified version of flushDNSCache from Tunnelblick | |
osx_version=$(/usr/bin/sw_vers | awk '/ProductVersion:/ {print $2}') | |
echo "OSX: ${osx_version}" | |
case "${osx_version}" in | |
10.9.*|10.11.*) | |
sudo /usr/bin/dscacheutil -flushcache | |
sudo /usr/bin/pkill -HUP mDNSResponder |
This file contains 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
User.create(username: 'jdoe', name: 'John Doe') | |
User.find_by_name('John Doe') |
This file contains 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
public static string[] Columns(this IDataReader reader) | |
{ | |
return Enumberable.Range(0, reader.FieldCount).Select(reader.GetName).ToArray(); | |
} | |
//... | |
var columns = reader.Columns(); |