Skip to content

Instantly share code, notes, and snippets.

View paularmstrong's full-sized avatar
🐈‍⬛
Codes with cats

Paul Armstrong paularmstrong

🐈‍⬛
Codes with cats
View GitHub Profile
#################################################################################
# start and stop the vpn from the command line from now on with these two commands
# or rename the aliases as you see fit.
#################################################################################
alias startvpn="sudo launchctl load -w /Library/LaunchDaemons/net.juniper.AccessService.plist; open -a '/Applications/Junos Pulse.app/Contents/Plugins/JamUI/PulseTray.app/Contents/MacOS/PulseTray'"
alias quitvpn="osascript -e 'tell application \"PulseTray.app\" to quit';sudo launchctl unload -w /Library/LaunchDaemons/net.juniper.AccessService.plist"
#!/bin/bash
# Optimize PNGs
for file in `git diff --cached --name-only | grep ".png\$"`; do
echo "Crushing $file"
pngcrush -rem allb -brute -reduce $file ${file%.png}.new 2>&1 | grep "filesize"
mv -f ${file%.png}.new $file
git add $file
done
@paularmstrong
paularmstrong / README.md
Last active August 29, 2015 14:20
RetroPie Setup Instructions
  1. Use Apple Pie Baker to place the RPI v1* image to the SD Card
  • Note: even though it's a v2 RaspberryPi, for some reason v2 doesn't work.
  1. Start up the machine
  2. Exit emulationstation and set up the network
$ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
network={
  ssid="network name"
  psk="password"
}
@paularmstrong
paularmstrong / Preloader.js
Created May 13, 2009 16:31
Preloader class for jQuery
$.extend(Function.prototype, {
use: function() {
var method = this, args = Array.prototype.slice.call(arguments), object = args.shift();
return function() {
return method.apply(object, args.concat(Array.prototype.slice.call(arguments)));
}
},
useEL: function() {
var method = this, args = Array.prototype.slice.call(arguments), object = args.shift();
return function(event) {
function password_strength(password, username) {
var p = password
, u = username
;
if(
/^[a-z]*$/.test(p)
|| /^[A-Z]*$/.test(p)
|| /^[0-9]*$/.test(p)
) {
@paularmstrong
paularmstrong / Timezone.js
Created July 24, 2010 15:31
JavaScript GMT offsets by TZ code
TZ = {
getTimezoneOffset: function(timezone)
{
var dst = (TZ.isDSTObserved()) ? 'dst' : 'std';
return TZ.zones[timezone][dst];
},
isDSTObserved: function()
{
// 2nd sunday of march
#!/bin/bash
DIR=$1
ACTION='backup'
if [ $# -eq 2 ]; then
ACTION=$2
fi
if [ $ACTION = 'delete' ]; then
rsync -rv --delete --size-only backup@files::$DIR/ /mnt/group1/media/$DIR/
else
@paularmstrong
paularmstrong / runtests.js
Created September 19, 2010 17:14
simple nodejs script to work with nodeunit to find all *.test.js files and execute them
#!/usr/bin/env node
/*
Run nodeunit tests
Simple node.js script to find all *.test.js files and execute them through nodeunit.
Without arguments, will search recursively through the current directory for tests.
Supply arguments of directories or specific tests to run.
Sample Usage:
$ ./runtests.js
@paularmstrong
paularmstrong / installClang.sh
Created March 11, 2011 18:09
Installs Clang Static Analyzer
#!/bin/bash
installonly=no
while [ $# -gt 0 ]
do
case "$1" in
(-i) installonly=yes;;
(-*) echo "$0: error - urecognized option $1" 1>&2; exit 1;;
(*) break;;
// What does this return?
(function() {
function f() { return 1; }
return f();
function f() { return 2; }
})();
// What is x?
var y = 1, x = y = typeof x;