Skip to content

Instantly share code, notes, and snippets.

View gnidan's full-sized avatar

g. nicholas d'andrea gnidan

View GitHub Profile
@gnidan
gnidan / xmonad.hs
Created May 23, 2014 23:42
xmonad.hs
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.UrgencyHook
import XMonad.Hooks.FadeInactive
import qualified XMonad.StackSet as W
import XMonad.Util.Run (spawnPipe, hPutStrLn)
import XMonad.Util.EZConfig
import XMonad.Util.WorkspaceCompare
@gnidan
gnidan / gist:9576956
Last active August 29, 2015 13:57
generating random tree zippers with quickcheck
"-64431"
|
-------------------------
/ \
"13169" "-50918"
| |
--------------------- --
/ \ / \
"60088" "50455" ∅ ∅
| |
@gnidan
gnidan / stepper.pde
Created December 15, 2013 00:21
stepper motor code with switch controlled direction
#include <Stepper.h>
// change this to the number of steps on your motor
#define STEPS 64
#define SWITCH_PIN A0
// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepper(STEPS, 8, 10, 9, 11);
@gnidan
gnidan / quine.coffee
Created September 20, 2013 03:54
coffeescript quine
escape = (str) ->
return '' if str is ''
first = str[0]
rest = str[1..-1]
first = if first is "'" or first is "\\"
"\\#{first}"
else
first
return first + escape(rest)
str = [
#!/bin/bash
echoerr() { echo "$@" 1>&2; }
upper() { echo "$@" | tr [a-z] [A-Z]; }
if [ $# -lt 5 ]; then
echoerr "Exports data from mysql database in tables matching a like pattern e.g. 'table_%'"
echoerr "Usage: $0 host dbname dbuser dbpass pattern"
exit 1
@gnidan
gnidan / rule113
Last active December 20, 2015 07:58
wolfram rule 113
*
********************************************** ***********************************************
**
******************************************** *************************************************
**
****************************************** ***************************************************
**
**************************************** *****************************************************
**
************************************** *******************************************************
@gnidan
gnidan / rule110
Created July 27, 2013 23:35
wolfram rule 110 generated by a haskell implementation using comonads
*
**
***
** *
*****
** *
*** **
** * ***
******* *
** ***
@gnidan
gnidan / status
Created May 16, 2013 14:28
count remote httpd process in i3 status bar
#!/bin/sh
# prepend i3status with wb01
# metrics
i3status | while :
do
apache1=`ssh apache1 'ps -ef | grep httpd | wc -l'`
apache2=`ssh apache2 'ps -ef | grep httpd | wc -l'`
read line
@gnidan
gnidan / gist:3025439
Created June 30, 2012 20:44
parse tree!
Header
=======
This is a paragraph. Hello!
Another paragraph. This time
with more than one line.
|
V
2) Login should warn on authentication errors:
TypeError: Object #<XMLHttpRequest> has no method 'open'
at Object.send (/home/gnidan/src/ui/selling/node_modules/jqueryify/index.js:8068:11)
at Function.ajax (/home/gnidan/src/ui/selling/node_modules/jqueryify/index.js:7580:15)
at Function.authenticate (/home/gnidan/src/ui/selling/app/models/session.coffee:29:16)
at Login.onSubmit (/home/gnidan/src/ui/selling/app/controllers/login.coffee:37:22)
at Object.<anonymous> (/home/gnidan/src/ui/selling/node_modules/spine/lib/spine.js:114:21)
at Object.<anonymous> (/home/gnidan/src/ui/selling/node_modules/jqueryify/index.js:3256:9)
at Object.<anonymous> (/home/gnidan/src/ui/selling/node_modules/jqueryify/index.js:2875:28)
at Object.trigger (/home/gnidan/src/ui/selling/node_modules/jqueryify/index.js:3144:12)