Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am thebengeu on github.
  • I am thebengeu (https://keybase.io/thebengeu) on keybase.
  • I have a public key whose fingerprint is DF7A 0482 B996 8A01 A288 A17B FF68 92FF DB37 F48A

To claim this, I am signing this object:

(function () {
var calculateNUSMatricNumber = function (id) {
var matches = id.toUpperCase().match(/^A\d{7}|U\d{6,7}/);
if (matches) {
var match = matches[0];
// Discard 3rd digit from U-prefixed NUSNET ID
if (match[0] === 'U' && match.length === 8) {
match = match.slice(0, 3) + match.slice(4);
}
@thebengeu
thebengeu / change_crashplan_backup_service_port.sh
Last active February 2, 2016 21:58
Change CrashPlan Backup Service Port (Default 4243 Conflicts with Docker / boot2docker)
#!/bin/sh
PORT=4200
sudo launchctl unload /Library/LaunchDaemons/com.crashplan.engine.plist
sudo sed -i '' "s/\(<servicePort>\)[^<]*/\1$PORT/" /Library/Application\ Support/CrashPlan/conf/my.service.xml
sed -i '' "s/#*\(servicePort=\).*/\1$PORT/" /Applications/CrashPlan.app/Contents/Resources/Java/conf/ui.properties
defaults write /Applications/CrashPlan.app/Contents/Resources/CrashPlan\ menu\ bar.app/Contents/Info CPPort $PORT
sudo launchctl load /Library/LaunchDaemons/com.crashplan.engine.plist
@thebengeu
thebengeu / matric.js
Created January 19, 2014 11:05
Calculates correct NUS matriculation number with check digit, given matriculation number with missing / wrong check digit, NUSNET ID or NUS email address, with either U or A prefix.
var calculateNUSMatricNumber = function (id) {
var matches = id.toUpperCase().match(/^A\d{7}|U\d{6,7}/);
if (matches) {
var match = matches[0];
// Discard 3rd digit from U-prefixed NUSNET ID
if (match[0] === 'U' && match.length === 8) {
match = match.slice(0, 3) + match.slice(4);
}