Skip to content

Instantly share code, notes, and snippets.

View rngtng's full-sized avatar
🕺
oh yeah...

Tobias Bielohlawek rngtng

🕺
oh yeah...
View GitHub Profile
@rngtng
rngtng / O2 web SMS send tool
Created December 29, 2009 20:17
send o2 SMS via shell
#!/usr/bin/perl
################################################################
#
# o2-sms.pl, v2.1 *** EARLY-BETA ***
#
# Copyright (c) 2002-06, Leonhard Fellermayr <leo@slacky.de>
# All rights reserved.
#
################################################################
@rngtng
rngtng / send_report_queries.scpt
Created April 27, 2010 13:59
skype hotdeploy apple script
#display dialog (do shell script "cd /Users/tobiasb/Sites/qype_admin && pwd")
my hotdeploy()
on adding folder items to this_folder after receiving these_items
my hotdeploy()
end adding folder items to
on hotdeploy()
set usr_home to "/Users/tobiasb/"
set prj_folder to usr_home & "Sites/qype_admin/"
@rngtng
rngtng / switchITunes.scpt
Created September 4, 2010 09:58
shell/apple script to sich iTunes library easily
tell application "System Events"
set runs to count (every process whose name is "iTunes")
end tell
set lib to do shell script "ls -l ~/Music | grep -i '\\->.*Music/iTunes' | sed 's/^.*iTunes-//g'"
set question to display dialog "iTunes is using '" & lib & "'. Switch to:" buttons {"external", "internal", "swing"} default button lib with icon 2 with title "Choose witch Library to use"
set new_lib to button returned of question
@rngtng
rngtng / TODO: Apple Script - Arrange Window
Created September 14, 2010 17:08
example Apple script to autoarrange windows
#http://superuser.com/questions/23769/how-to-arrange-application-windows-on-mac-os-x
tell application "Tweetie"
activate
set i to 1
set the bounds of first window to {(109 + (20 * i)), (10 + (10 * i)), (1164 + (20 * i)), (786 + (10 * i))}
end tell
/**
set _theWindows to
#repeat with i from 1 to number of items in _theWindows
@rngtng
rngtng / import.php
Created September 29, 2010 13:59
daviCal import file
<?php
require_once("./always.php");
require_once("DAViCalSession.php");
$feeds = array(
'events' => array(
'Bausteln' => 'http://www.google.com/calendar/ical/49lc466l5phf9hvnk3f2rc7lt0%40group.calendar.google.com/public/basic.ics',
'Last.fm' => 'http://ws.audioscrobbler.com/1.0/user/TobiTobes/events.ics',
'IntSwing' => 'http://www.google.com/calendar/ical/0r5fifa7ir3k4hmh2iae8rgtuc%40group.calendar.google.com/public/basic.ics',
@rngtng
rngtng / create_shortcuts.scpt
Created October 28, 2010 18:44
AppleScript to create KeyboardShortcuts easily
----------------------------------------------------------------------------------------------------
--
-- Script to automate creation of Keyborad shortcuts
--
----------------------------------------------------------------------------------------------------
GUIScripting_status()
tell application "System Preferences"
activate
reveal anchor "shortcutsTab" of pane id "com.apple.preference.keyboard"
@rngtng
rngtng / rainbow_cube_mapping.rb
Created December 12, 2010 21:50
Mapping the Rainbowduino Matrix to the Cube
def xy2xyz( x, y )
x2 = 2 + x/4 - 2 * (y/4).floor #3 + x/4 - y/4
y2 = (x - 3.5).abs.ceil - 1
z2 = y % 4
[x2, y2, z2]
end
def xyz2xy( x, y, z )
@rngtng
rngtng / parse_itunes.rb
Created December 12, 2010 22:22
simple script to parse the iTunes XML file
require 'rubygems'
require 'xml'
class Inode
attr_reader :at
def initialize(node)
@at = {}
key = nil
@rngtng
rngtng / switchITunes.sh
Created December 12, 2010 23:31
script to switch between multiple iTunes Libraries
#!/bin/sh
TEST=$(ps -x |grep "/iTunes " |grep -v grep |wc -l)
if [[ $TEST -ne 0 ]]
then
echo "iTunes is running. Please quit iTunes first"
exit
fi
LIB="`ls -l ~/Music | grep -i '\->.*Music/iTunes' | sed 's/^.*iTunes-//g'`"
if [ "$LIB" == "internal" ]
then
@rngtng
rngtng / fix_irregular_html.rb
Created January 26, 2011 11:14
fix irregular HTML by replacing not closed '<' with '&lt;'
module SanitizeHelper
def fix_irregular_html(html)
regexp = /<([^<>]*)(<|$)/
#we need to do this multiple time as regex are overlapping
while (fixed_html = html.gsub(regexp, "&lt;\\1\\2")) && fixed_html != html
html = fixed_html
end
fixed_html
end