Skip to content

Instantly share code, notes, and snippets.

View markhibberd's full-sized avatar

markhibberd markhibberd

View GitHub Profile
We couldn’t find that file to show.
[chef:xml] 2036$ ls * | xargs wc | sort -n | sed -e 's/ [a-z_]*.xml/ some.xml/g'
15 23 493 some.xml
206 383 10706 some.xml
450 793 20807 some.xml
1102 2894 63847 some.xml
1102 2912 63847 some.xml
1102 2912 63888 some.xml
1102 2912 65888 some.xml
1173 3214 68417 some.xml
1173 3217 68340 some.xml
atom_WM_TAKE_FOCUS ::
X Atom
atom_WM_TAKE_FOCUS =
getAtom "WM_TAKE_FOCUS"
takeFocusX ::
Window
-> X ()
takeFocusX w =
withWindowSet . const $ do
atom_WM_TAKE_FOCUS ::
X Atom
atom_WM_TAKE_FOCUS =
getAtom "WM_TAKE_FOCUS"
takeFocusX ::
Window
-> X ()
takeFocusX w =
withWindowSet . const $ do
main = xmonad defaultConfig {
-- Modify the log hook of your configuration to include a call to
-- takeTopFocus before setWMNAme
logHook = takeTopFocus >> setWMName "LG3D"
}
@markhibberd
markhibberd / dirwatch
Created February 9, 2011 06:41
dirwatch
#!/bin/sh
#
# NAME
# dirwatch - run command on file modification
#
# SYNOPSIS
# dirwatch [-m marker] command dir ...
#
# DESCRIPTION
# dirwatch uses a touch file to track whether files
Given common usage of map, then sequence, with the
following signatures.
> sequence :: (Monad m) => [m a] -> m [a]
> map :: (a -> b) -> [a] -> [b]
e.g.
> x :: (Monad m) => [m a]
> x = map readFile ["file1.txt", "file2.txt"]
findbase() {
search="$1"
current="$2"
base=`basename $current`
case "$base" in
"."|""|"/")
return 1
;;
"$search")
echo $current
@markhibberd
markhibberd / gist:1009060
Created June 5, 2011 15:37
Int Enumerator
import scalaz._, Scalaz._
import IterV._
// something to generate a stream that will be enough to blow the stack....
def ints[A]: (Int, Int) => IterV[Int, A] => IterV[Int, A] = (start, end) => iter => {
def loop(s: Int, i: IterV[Int, A]): IterV[Int, A] = i match {
case Done(_, _) => i
case Cont(k) =>
if (s > end)
i
@markhibberd
markhibberd / gist:1009072
Created June 5, 2011 15:45
Alt D List Example
package scalaz.example
import scalaz.AltDList._
object ExampleAltDList {
def main(args: Array[String]) = run
import scalaz._, Scalaz._
import IterV._