Skip to content

Instantly share code, notes, and snippets.

Avatar
🐈‍⬛
Codes with cats

Paul Armstrong paularmstrong

🐈‍⬛
Codes with cats
View GitHub Profile
View OSX-junos_pulse_listenToMe.sh
#################################################################################
# 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"
View pre-commit
#!/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 Aug 29, 2015
RetroPie Setup Instructions
View README.md
  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
Preloader class for jQuery
View Preloader.js
$.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) {
View gist:468228
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 Jul 24, 2010
JavaScript GMT offsets by TZ code
View Timezone.js
TZ = {
getTimezoneOffset: function(timezone)
{
var dst = (TZ.isDSTObserved()) ? 'dst' : 'std';
return TZ.zones[timezone][dst];
},
isDSTObserved: function()
{
// 2nd sunday of march
View gist:576589
#!/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 Sep 19, 2010
simple nodejs script to work with nodeunit to find all *.test.js files and execute them
View runtests.js
#!/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 Mar 11, 2011
Installs Clang Static Analyzer
View installClang.sh
#!/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;;
View brainbuster.js
// 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;