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 | |
# | |
# Simple script to update OSX Chromium to the latest nightly build. | |
# Will not download if you already have the latest (call with --force | |
# to override this check) | |
# | |
# Copyleft 2010 Ian Gallagher <crash@neg9.org> | |
# | |
LATEST=$(curl -s "http://build.chromium.org/f/chromium/snapshots/Mac/LATEST") |
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
using terms from application "Address Book" | |
on action property | |
return "phone" | |
end action property | |
on action title for p with e | |
if label of e is equal to "Skype" then | |
return "Call Skype Name" | |
else |
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 | |
# You must init a git repo in $backup_root for this to work | |
# You must also have a remote repo added per $git_remote | |
# It's assumed that you have your remote git host configured | |
# via ~/.ssh/config or something for automatic login with a key | |
# Local stuff | |
wwwroot="/var/www/your-blog/" # Trailing slash is important (for rsync) | |
db_name="blog_db" | |
db_user="blog_user" |
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 | |
# | |
# Simple script that will set the ownership of a file to that | |
# of the directory in which it resides. Useful for example, | |
# after copying a file from /home/user_alpha/ to /home/user_bravo/ | |
# and you want it to have user_bravo's uid/gid so they can | |
# access it. | |
# | |
# This script is pretty naive, it would most certainly fail | |
# if a filename had a forward slash in it somehow. |
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
#!/usr/bin/env python | |
# | |
# (C) Ian Gallagher <crash@neg9.org> | |
# | |
def savedata(basedir, data, hashalgo="sha1"): | |
""" | |
Given a base directory and chunk of data, store that data in a path composed of it's | |
SHA1 (default) hexdigest as split in to single-byte hex directories, with the file being the last byte of the digest. |
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 cdp() { | |
# cd to the nearest matching parent directory | |
# e.g. if PWD is /foo/bar/baz/alice/bob/eve, 'cdp baz' will cd to /foo/bar/baz/ | |
shopt -q nocaseglob | |
nocaseglob=$? | |
shopt -s nocaseglob | |
pat="^(.+)$1[^/]*" | |
if [[ "$PWD" =~ $pat ]] ; then | |
newdir=${BASH_REMATCH[0]} |
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
if [ "$PS1" ]; then | |
if [ "$BASH" ]; then | |
shortname=${HOSTNAME%%.*} | |
shortname=${shortname//[aeiou]/} | |
hostname_crc=$(echo $HOSTNAME | tr 'A-Z' 'a-z' | cksum) | |
hostname_crc=${hostname_crc%% *} | |
hostcolor_a=$(( (0x${hostname_crc} + 1) % 2 )) | |
hostcolor_b=$(( 0x${hostname_crc} % 8 + 30 )) | |
PS1="\[\e[33;1m\]\u@\[\e[${hostcolor_a};${hostcolor_b}m\]${shortname}:\[\e[0m\]\w"'\$ ' | |
PS2='\[\e[31;1m\]>\[\e[0m\]' |
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
import struct | |
def get_file_paths(pf_file): | |
""" | |
Given a path to a Windows Prefetch file, extract and return a list of all file | |
paths that it contains (which will be prefetched) | |
References: | |
- http://en.wikipedia.org/wiki/Prefetcher | |
- http://msdn.microsoft.com/en-us/magazine/cc302206.aspx |
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 | |
# Write out all possible encodings that strings can deal with for a given file. | |
input=$1 | |
# 7 bit ascii | |
mode="s" | |
strings $@ -e $mode $input > strings_$input.$mode | |
# 8 bit characters |
OlderNewer