Skip to content

Instantly share code, notes, and snippets.

View GeertJohan's full-sized avatar

Geert-Johan Riemer GeertJohan

View GitHub Profile
test 2
@GeertJohan
GeertJohan / variables.go
Created November 26, 2012 18:30
var declaration examples
package main
import (
"log"
)
var outside = "outside"
func main() {
inside := "inside"
import XMonad
import XMonad.Hooks.InitialStartupHook
import XMonad.Layout.LayoutScreens
import XMonad.Layout.TwoPane
import XMonad.Hooks.InsertPosition
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeysP)
import System.IO
@GeertJohan
GeertJohan / xmonad.hs
Created January 20, 2013 10:28
xmonad lapromitux
import XMonad
import XMonad.Hooks.InsertPosition
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.FadeInactive
import XMonad.Util.Run
import XMonad.Util.EZConfig
import System.IO
export PS1="\u\[$(tput setaf 3)\]@\[$(tput setaf 4)\]\H\[$(tput setaf 3)\]:\[$(tput setaf 6)\]\w\[$(tput setaf 3)\]\\$\[$(tput setaf 7)\]\[$(tput sgr0)\] "
#For servers:
#PROMPT_HOSTNAME=`hostname --long`
#export PS1="\u\[$(tput setaf 3)\]@\[$(tput setaf 1)\]\[$(tput smso)\]${PROMPT_HOSTNAME}\[$(tput rmso)\]\[$(tput setaf 3)\]:\[$(tput setaf 6)\]\w\[$(tput setaf 3)\]\\$\[$(tput setaf 7)\]\[$(tput sgr0)\] "
/home/geertjohan/Applications/go/src/pkg/net/http/server.go:576 (0x80e1e2e)
/home/geertjohan/Applications/go/src/pkg/runtime/proc.c:1443 (0x80635f0)
/home/geertjohan/Applications/go/src/pkg/runtime/runtime.c:128 (0x8064108)
/home/geertjohan/Applications/go/src/pkg/runtime/thread_linux.c:209 (0x8066d3f)
/home/geertjohan/Workspaces/WorkspaceGo/gopath/src/github.com/ziutek/mymysql/thrsafe/thrsafe.go:30 (0x808ce4a)
/home/geertjohan/Workspaces/WorkspaceGo/gopath/src/github.com/ziutek/mymysql/thrsafe/thrsafe.go:243 (0x808dfa0)
/home/geertjohan/Workspaces/WorkspaceGo/gopath/src/github.com/ziutek/mymysql/thrsafe/thrsafe.go:261 (0x808e0ae)
/home/geertjohanr/Workspaces/WorkspaceGo/devpath/src/rmapi-bu/s_newPrepaidVoipSubscription.go:22 (0x8052290)
_func_005: log.Println(err)
/home/geertjohanr/Workspaces/WorkspaceGo/devpath/src/rmapi-bu/service.go:211 (0x804ca7d)
@GeertJohan
GeertJohan / .xmobarrc.Extermintux
Created January 30, 2013 21:43
xmobarrc configuration from Extermintux
Config { font = "-misc-fixed-*-*-*-*-13-*-*-*-*-*-*-*"
, bgColor = "black"
, fgColor = "grey"
, position = TopW L 85
, commands = [ Run Network "eth1" ["-L","0","-H","32","--normal","green","--high","red"] 10
, Run Cpu ["-L","15","-H","50","--normal","green","--high","red"] 10
, Run Memory ["-t","Mem: <usedratio>%"] 10
, Run Swap [] 10
, Run Date "%A %Y-%m-%d %H:%M:%S" "date" 10
, Run StdinReader
@GeertJohan
GeertJohan / must.go
Last active December 12, 2015 05:28
Idea for a Go `must()` builtin or `must` keyword.
// Some functions to demonstrate the idea of must()
func zero() error {
return nil
}
func one() int, error {
return 1, nil
}
func two() string, int, error {
@GeertJohan
GeertJohan / tc.go
Created February 7, 2013 08:57
terminal colors
package main
import (
"fmt"
"tc" //terminal color
)
// First syntax idea
// Please skip this and take a look at the second idea.
@GeertJohan
GeertJohan / sgrBlockquotesRegexp.go
Created February 11, 2013 08:21
block-quotes code regexp for SGR (github.com/foize/go.sgr)
Regexp: `(?:(?:^\[?\[([a-zA-Z0-9\- ]+)\])|([.\n\r]+))*`
Input: "[red] blabla [[ escaped? [bla-fd] ]] escaped?"
Output(fmt %#v): []string{"[red]", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""}
Expected: []string{"[red]", " blabla [[ escaped? ", "[bla-fd]", " ]] escaped?"}
Regexp: \[([^\]]+)\]
Input: "[red] blabla [[ escaped? [bla-fd] ]] escaped?"
Output(fmt %#v): [][]int{[]int{0, 5}, []int{13, 33}}