Skip to content

Instantly share code, notes, and snippets.

View jfro's full-sized avatar
🎉
Being rusty

Jeremy Knope jfro

🎉
Being rusty
View GitHub Profile
@jfro
jfro / zshrc
Created December 4, 2009 00:20
A copy of my zshrc
export LC_ALL="en_US.UTF-8" # Use British English...
export LC_ALL="en_US.UTF-8" # Use British English...
export LANG="en_US.UTF-8" # ...as default language.
export TZ="America/New_York" # Force our time zone this location.
# this happened to work on iMac just because I had X11 installed
if [[ "x$DISPLAY" == "x" ]]; then
export EDITOR="vim"
else
export EDITOR="mate -w"
#!/usr/bin/ruby
begin
require 'rubygems'
rescue LoadError
error_string = "\n\nYou must install rubygems in order to use this script"
raise error_string
end
begin
var sys = require('sys'),
fs = require('fs'),
spawn = require('child_process').spawn,
tail = spawn('tail', ['-f', 'server.log']);
// var used for \n scanner
tail.current_line = "";
// holds user state
var status = {
@jfro
jfro / sshput-function.sh
Created January 1, 2011 16:55
modified someone's sshput command for uploading ssh public keys
sshput () {
RSAKEY="${HOME}/.ssh/id_rsa.pub"
DSAKEY="${HOME}/.ssh/id_dsa.pub"
if [ $# -eq 2 ]; then
KEY=$1
if [ ! -r $KEY ]
then
echo "'$KEY' does not exist or is not readable"
return 1
@jfro
jfro / re-sign-frameworks.rb
Created October 20, 2011 22:39
Re-sign frameworks in a bundle
#!/usr/bin/ruby
require 'find'
require 'fileutils'
require 'getoptlong'
if ARGV.length < 2
puts "Usage: ruby re-sign-frameworks.rb bundle signer"
exit
end
@jfro
jfro / update-dns.sh
Created January 11, 2012 17:31
Linode dynamic DNS updating script
#!/bin/sh
# modified by jfro from http://www.cnysupport.com/index.php/linode-dynamic-dns-ddns-update-script
# Uses curl to be compatible with machines that don't have wget by default
LINODE_API_KEY=licensekey
DOMAIN_ID=domainid
RESOURCE_ID=resourceid
WAN_IP=`curl -s http://example.com/whatsmyip.php`
if [ -f $HOME/.wan_ip.txt ]; then
diff --git a/Classes/IRC/IRCUser.m b/Classes/IRC/IRCUser.m
index 6ee00c8..59c2f45 100755
--- a/Classes/IRC/IRCUser.m
+++ b/Classes/IRC/IRCUser.m
@@ -4,6 +4,69 @@
#define COLOR_NUMBER_MAX 30
+#define hashsize(n) ( 1U << (n) )
+#define hashmask(n) ( hashsize ( n ) - 1 )
# ZSH Theme - Preview: http://dl.dropbox.com/u/1552408/Screenshots/2010-04-08-oh-my-zsh.png
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
crop_pwd() {
((MAXMID=$COLUMNS / 2)) # truncate to this value
mypath="%~"
echo -n "%$MAXMID<...<$mypath"
}
@jfro
jfro / screw-utf-16.sh
Last active December 13, 2015 23:28
Converts all argument files to UTF-8 if they aren't already. Could be more flexible in future
#!/bin/sh
for sourceFile in $@
do
fromEncoding=`file --mime-encoding $sourceFile | awk '{print $2}'`
encodingCheck=${fromEncoding:0:6}
if [ $encodingCheck == "utf-16" ]; then
echo "Converting from $fromEncoding to utf-8"
tempFile="$sourceFile-temp"
@jfro
jfro / update-redmine.sh
Last active December 14, 2015 06:09
Untested upgrade script for Redmine, hopefully can streamline upgrading an install.
#!/bin/sh
VERSION=2.2.3
URL=http://files.rubyforge.vm.bytemark.co.uk/redmine/redmine-$VERSION.tar.gz
SITES_DIR=/home/sites
SITE=example.com
cd $SITE_DIR
curl -O $URL