Skip to content

Instantly share code, notes, and snippets.

-- add avoidStruts to your layoutHook like so
myLayout = avoidStruts $ Tall ||| Wide ||| Full ...
-- add manageDocks to your managehook like so
myManageHook = composeAll
[ className =? "Mplayer" --> doFloat
, className =? "Zenity" --> doFloat
] <+> manageDocks
[general]
# NOTE: cronjob calls the quiet UI with -u
ui = TTY.TTYUI
accounts = GMail
[Account GMail]
localrepository = Gmail-Local
remoterepository = Gmail-Remote
[Repository Gmail-Local]
# go to a directory or file's parent
goto() { [[ -d "$1" ]] && cd "$1" || cd "$(dirname "$1")"; }
# copy and follow
cpf() { cp "$@" && goto "$_"; }
# move and follow
mvf() { mv "$@" && goto "$_"; }
if echo "$LOCALE" | /bin/grep -qi utf ; then
stat_busy "Setting Consoles to UTF-8 mode"
# UTF-8 consoles are default since 2.6.24 kernel
# this code is needed not only for older kernels,
# but also when user has set vt.default_utf8=0 but LOCALE is *.UTF-8.
for i in /dev/tty[0-9]*; do
/usr/bin/kbd_mode -u < ${i}
printf "\033%%G" > ${i}
done
# the $CONSOLE check helps us avoid this when running scripts from cron
@pbrisbin
pbrisbin / errors
Created December 17, 2010 14:58
source.hs
[1 of 1] Compiling ScratchPadKeys ( ScratchPadKeys.hs, interpreted )
ScratchPadKeys.hs:139:0:
Couldn't match expected type `XConfig l'
against inferred type `XConf'
When using functional dependencies to combine
MonadReader XConf X,
arising from the dependency `m -> r'
in the instance declaration at <no location info>
MonadReader (XConfig l) X,
@pbrisbin
pbrisbin / gist:750100
Created December 21, 2010 15:55
main.c
#include <stdio.h>
#include <string.h>
#include <dirent.h>
#include <stdbool.h>
#include <stdlib.h>
#include <errno.h>
/* email parsing from
* http://bytes.com/topic/c/answers/215251-regular-expressions-c
*/
//blue/0/~/ ll /srv/http/
total 30M
drwxr-xr-x 2 patrick http 4.0K Oct 22 14:51 cassius
drwxr-xr-x 2 patrick http 4.0K Nov 16 17:01 hamlet
drwxr-xr-x 2 patrick http 4.0K Jan 9 14:20 pandoc
drwxr-xr-x 7 patrick http 4.0K Dec 13 14:10 static
drwxr-xr-x 3 patrick http 4.0K Oct 23 23:01 xmonad
-rwxr-xr-x 1 http http 29M Jan 9 14:32 app.cgi
-rw-r--r-- 1 http http 16 Oct 22 14:51 client_session_key.aes
-rw-r--r-- 1 patrick http 1.4K Oct 27 10:50 favicon.ico
module AWSTest where
import Network.HTTP.Base
import Network.AWS.AWSConnection
import Network.AWS.AWSResult
import Network.AWS.Authentication
import Data.List (intercalate)
import Data.ByteString.Lazy (empty)
#!/bin/bash
parse_pid() {
local IFS=$'\n'
s_regex="^ $1:.*"
w_regex="^ $2:.*"
p_regex="^ $3:.*"
n_regex='^ [^ ]' # we've gone too far!
// using the "Vehicle" API
// a vehicle can be created from an arbitrary position / heading if you like
position = {
coords: {
longitude: -71.00000
latitude: 42.00000
heading: 78
}
}