Skip to content

Instantly share code, notes, and snippets.

View oschrenk's full-sized avatar

Oliver Schrenk oschrenk

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / NextHighestLongSameDigits.java
Created February 4, 2013 03:08
Given a number, find the next higher number which has the exact same set of digits as the original number. For example: given 38276 return 38627
package com.acme.numbers;
import java.util.Arrays;
/**
*
* Given a number, find the next higher number which has the exact same set of
* digits as the original number. For example: given 38276 return 38627
*
*
@oschrenk
oschrenk / gist:5388170
Created April 15, 2013 13:47
Re: Getting notifications on forks for old commits I'm @ mentioned in
Delivered-To: [email protected]
Received: by 10.58.239.202 with SMTP id vu10csp168751vec;
Mon, 15 Apr 2013 06:40:23 -0700 (PDT)
X-Received: by 10.49.97.163 with SMTP id eb3mr15491731qeb.45.1366033222553;
Mon, 15 Apr 2013 06:40:22 -0700 (PDT)
Return-Path: <[email protected]>
Received: from smtp1-ext.rs.github.com (smtp1-ext.rs.github.com. [207.97.227.250])
by mx.google.com with ESMTP id ko8si12369721qeb.19.2013.04.15.06.40.22;
Mon, 15 Apr 2013 06:40:22 -0700 (PDT)
Received-SPF: pass (google.com: domain of [email protected] designates 207.97.227.250 as permitted sender) client-ip=207.97.227.250;
@oschrenk
oschrenk / configure-hadoop.sh
Last active December 30, 2015 09:39
Configuring Hadoop on OS X for the first time
#!/bin/sh
function error_handler() {
echo "Error occurred in script at line: ${1}."
echo "Line exited with status: ${2}"
}
trap 'error_handler ${LINENO} $?' ERR
set -o errexit #