Skip to content

Instantly share code, notes, and snippets.

View spangenberg's full-sized avatar
🦄

Daniel Spangenberg spangenberg

🦄
View GitHub Profile
#!/bin/sh
sudo aptitude update
sudo aptitude upgrade -y
sudo aptitude -y install build-essential libssl-dev libreadline5-dev zlib1g-dev
sudo aptitude -y install mysql-server libmysqlclient15-dev mysql-client
sudo aptitude -y install ruby ruby1.8-dev irb ri rdoc libopenssl-ruby1.8
RUBYGEMS="rubygems-1.3.7"
wget http://rubyforge.org/frs/download.php/70696/$RUBYGEMS.tgz
calculateTimeDiff = (el) ->
el = $(el || document.body)
el.getElements("[calculate-time]").each (el) ->
date = el.get "calculate-time"
parsedDate = new Date.parse date
timeDiffInWords = parsedDate.timeDiffInWords()
el.set "text", timeDiffInWords
#!/bin/sh
git filter-branch --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "Florian Nitschmann@.(none)" ]
require "whois"
class Array
def shuffle
sort_by { rand }
end
def shuffle!
self.replace shuffle
end

Testing Rails with Hudson CI

Written for Ubuntu LTS 10.4

Update and upgrade

  $ sudo aptitude update
  $ sudo aptitude upgrade
@spangenberg
spangenberg / gist:733430
Created December 8, 2010 15:39
Hexadecimal to dual
String hexString = "12345";
StringBuffer binaryString = new StringBuffer();
Integer n = 0,
dualInt = 0,
currentNumber = 0;
// hex2dual
for ( int i = hexString.length() - 1; i >= 0; i-- ) {
int a,
b = (new Double(Math.pow(16, n))).intValue();
char character = hexString.charAt(i);
@spangenberg
spangenberg / matrix.rb
Created February 6, 2011 13:40
This script generates a matrix from a file with names
# To run:
#
# Put this script in a folder with a file named "names.txt"
# The File has the format:
# Daniel Spangenberg
# Toni Stark
# Iron Man
# ...
#
# Then run:
@spangenberg
spangenberg / gist:820682
Created February 10, 2011 15:17
J.A.R.V.I.S.
say "yes sir"
tell application "Dragon Dictate"
activate
set microphone to dictation
try
display dialog "Speech Text" default answer ""
on error
set microphone to command operation
return
end try
We couldn’t find that file to show.
We couldn’t find that file to show.