Skip to content

Instantly share code, notes, and snippets.

View oschrenk's full-sized avatar

Oliver Schrenk oschrenk

View GitHub Profile
@oschrenk
oschrenk / JsonEqivalenceTest
Created October 11, 2012 08:03
Testing with JUnit/Maven
import static org.junit.Assert.*;
import java.io.File;
import java.io.IOException;
import org.junit.Before;
import org.junit.Test;
import com.google.common.base.CharMatcher;
import com.google.common.base.Charsets;
@oschrenk
oschrenk / stracktrace
Created September 16, 2012 11:59
lingwah 0.91 calulator example problems
doMatch(expr,0)
/doMatch
doMatch(decimal,0)
/doMatch
doMatch(operator,0)
/doMatch
doMatch(group,0)
/doMatch
doMatch(optional(string('-')),0)
/doMatch
@oschrenk
oschrenk / stracktrace
Created September 16, 2012 11:59
lingwah 0.91 calulator example problems
doMatch(expr,0)
/doMatch
doMatch(decimal,0)
/doMatch
doMatch(operator,0)
/doMatch
doMatch(group,0)
/doMatch
doMatch(optional(string('-')),0)
/doMatch
@oschrenk
oschrenk / Main.java
Created September 14, 2012 02:10
Could someone tell me why my quiz scores are not displaying?
public class Main {
public static void main(String[] args) {
Student jimmy = new Student(null, null, 0);
jimmy.setQuizScore(95, 0);
jimmy.setQuizScore(73, 1);
jimmy.setQuizScore(100, 2);
jimmy.setQuizScore(55, 3);
@oschrenk
oschrenk / Toggle Bluetooth.applescript
Created August 24, 2012 13:24
Toggle Bluetooth with Growl Notification
property blueutilPath : "/usr/local/bin/blueutil power"
if execBlueutil("") ends with "0" then
-- Toggle BT on
execBlueutil("1")
set btStatus to true
else
-- Toggle BT off
execBlueutil("0")
set btStatus to false
@oschrenk
oschrenk / Toggle Bluetooth.applescript
Created August 24, 2012 13:24
Toggle Bluetooth with Growl Notification
property blueutilPath : "/usr/local/bin/blueutil power"
if execBlueutil("") ends with "0" then
-- Toggle BT on
execBlueutil("1")
set btStatus to true
else
-- Toggle BT off
execBlueutil("0")
set btStatus to false
@oschrenk
oschrenk / CreatePreyRecovery.sh
Created August 15, 2012 23:27
Secure MacBook w/ FileVault 2 and Prey
#!/bin/bash
#
# source: https://groups.google.com/d/msg/prey-security/vBv3BGI8Qeg/5xIy0LZjzXAJ
#
# Mount the recovery partition
/usr/bin/sudo /usr/sbin/diskutil mount Recovery\ HD
#
# Backup the recovery boot image
/usr/bin/sudo /bin/cp /Volumes/Recovery\ HD/com.apple.recovery.boot/BaseSystem.dmg ~/Desktop/
#
@oschrenk
oschrenk / Dijkstra.java
Created August 15, 2012 21:12
Problems with JOCL version of Dijkstra
program = clCreateProgramWithSource(context, 1,
new String[] { SOURCE }, null, null);
clBuildProgram(program, 0, null, null, null, null);
final int vertexCount = graph.getVertexCount();
final int edgeCount = graph.getEdgeCount();
final int[] vertexArray = graph.getVertexArray();
final int[] edgeArray = graph.getEdgeArray();
@oschrenk
oschrenk / Switch to User.scpt
Created June 26, 2012 13:18
Keyboard Shortcut for Fast User Switching
--This script MUST be named "Switch to <User>.scpt", where <User> is the name of the user to switch to.
--You must first make a password item (a.k.a. a key) for the other user's password using Keychain Access,
--and call it "<user>", where "<user>" is the other user's name.the field "Kind" must be "User Login" (without quotes).
--The script assumes that you make this key in your login.keychain, which is the default one.
--The first time you run this script, you will be prompted to allow Keychain Scripting to access the password of the key.
--This script requires "Enable access for assistive devices" to be enabled in the Universal Access system preference pane.
set username to word -1 of my findReplace(".scpt", "", (path to me as text))
-- Invoke Fast User Switching. The `id -ur username` part gets the uid number that corresponds to the username and substitutes it at the end of the CGSession command
/*
* Adapted from <a
* href="http://www.movable-type.co.uk/scripts/latlong.html">JavaScript
* version</a> created by <a href="http://www.movable-type.co.uk/">Chris
* Veness<a/> under the <a
* href="http://creativecommons.org/licenses/by/3.0/">Create Commons Attribution
* 3.0</a> licencse.
*/
package com.oschrenk.humangeo.calc;