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/ruby | |
# Tested on OS X Leopard only but should work | |
# for BSDs | |
start = /\{ sec = ([0-9]+),/.match(`sysctl -n kern.boottime`).captures[0] | |
uptime_secs = (Time.now.to_f - start.to_f).round | |
def seconds_to_time(seconds) |
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
<?php | |
function parse_sdp($packet = '') | |
{ | |
$out = array(); | |
$lines = explode("\n", $packet); | |
foreach ($lines as $l) | |
{ | |
$l = trim($l); |
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
# Create a ~/.twitter/credentials.yml file. | |
# Example: | |
# name: twittername | |
# password: password | |
require 'rubygems' | |
require 'rest_client' | |
path = File.join(File.join(ENV['HOME'], ".twitter"), "credentials.yml") | |
user = YAML::load_file(path) |
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
# allow the use of the Home/End keys | |
"\e[1~": beginning-of-line | |
"\e[4~": end-of-line | |
# allow the use of the Delete/Insert keys | |
"\e[3~": delete-char | |
"\e[2~": quoted-insert | |
# allow ctrl/alt + arrow keys to work | |
"\e[5C": forward-word |
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
# bash_completion - programmable completion functions for bash 3.x | |
# (backwards compatible with bash 2.05b) | |
# | |
# $Id: bash_completion,v 1.872 2006/03/01 16:20:18 ianmacd Exp $ | |
# | |
# Copyright (C) Ian Macdonald <[email protected]> | |
# | |
# This program is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation; either version 2, or (at your option) |
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
{ | |
"\UF729" = "moveToBeginningOfLine:"; /* Home */ | |
"\UF72B" = "moveToEndOfLine:"; /* End */ | |
"$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */ | |
"$\UF72B" = "moveToEndOfLineAndModifySelection:"; /* Shift + End */ | |
} | |
/* | |
Add to ~/Library/KeyBindings/DefaultKeyBinding.dict | |
Create the directory if it does not exist |
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/perl -w | |
# | |
# This script was developed by Robin Barker ([email protected]), | |
# from Larry Wall's original script eg/rename from the perl source. | |
# | |
# This script is free software; you can redistribute it and/or modify it | |
# under the same terms as Perl itself. | |
# | |
# Larry(?)'s RCS header: | |
# RCSfile: rename,v Revision: 4.1 Date: 92/08/07 17:20:30 |
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
echo '.DS_Store' >> ./.gitignore | |
echo '*.swp' >> ./.gitignore | |
echo 'config/database.yml' >> ./.gitignore | |
echo 'config/mailer.yml' >> ./.gitignore | |
echo '*.sql' >> ./.gitignore | |
echo 'index/' >> ./.gitignore | |
echo 'public/system' >> ./.gitignore | |
echo 'public/tmp/' >> ./.gitignore | |
echo '[^.]*' > ./log/.gitignore |
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 | |
usage() { | |
cat <<-EOT | |
usage: $0 [home|work] | |
This script starts a Synergy server for home or work. | |
EOT | |
} |
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 valid_card?(num) | |
odd = true | |
num.to_s.gsub(/\D/,'').reverse.split('').map(&:to_i).collect { |d| | |
d *= 2 if odd = !odd | |
d > 9 ? d - 9 : d | |
}.sum % 10 == 0 | |
end |
OlderNewer