Skip to content

Instantly share code, notes, and snippets.

🤘
clickity clack

Joshua Priddle itspriddle

🤘
clickity clack
Block or report user

Report or block itspriddle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View fuzzy_uptime.rb
#!/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)
View parse_sdp_packet.php
<?php
function parse_sdp($packet = '')
{
$out = array();
$lines = explode("\n", $packet);
foreach ($lines as $l)
{
$l = trim($l);
View twitter.rb
# 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)
View gist:88109
# 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
View gist:91536
# 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 <ian@caliban.org>
#
# 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)
View DefaultKeyBinding.dict
{
"\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
View gist:93422
#!/usr/bin/perl -w
#
# This script was developed by Robin Barker (Robin.Barker@npl.co.uk),
# 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
View setup_rails_git_ignores.sh
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
View gist:94287
#!/bin/bash
usage() {
cat <<-EOT
usage: $0 [home|work]
This script starts a Synergy server for home or work.
EOT
}
View gist:95462
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
You can’t perform that action at this time.