Skip to content

Instantly share code, notes, and snippets.

export XAUTHORITY=/home/tom/.Xauthority
export DISPLAY=:0.0
@tomjnixon
tomjnixon / config
Created November 27, 2011 17:17
My i3 config file
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout somewhen, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
@tomjnixon
tomjnixon / paswitch.sh
Last active November 28, 2020 13:39
PulseAudio output switcher script
#!/bin/bash
# Script to switch all programs to a specific sink. Why this isn't easy, i
# don't know.
# This script takes a single argument, the sink name, index, or alias (defined
# below).
# To make this work, you will need to:
# - In /etc/pulse/default.pa:
import Control.Monad
import Data.Monoid
import Data.Ratio
import Graphics.X11.ExtraTypes.XF86
import qualified Data.Map as M
import qualified XMonad.Layout.IM as IM
import qualified XMonad.StackSet as W
import System.IO
import XMonad.Actions.CycleWS
import XMonad.Actions.UpdatePointer
Config { font = "xft:Monaco:pixelsize=10"
, bgColor = "#73642"
, fgColor = "#93a1a1"
, position = TopW L 97
, commands = [ Run Cpu ["-L","3","-H","50","--normal","#859900","--high","#d30102", "-t", "<fc=#d33682>C</fc> <total>%", "-m", "2"] 10
, Run Memory ["-t","<fc=#d33682>M</fc> <usedratio>%"] 10
, Run Swap ["-t","<fc=#d33682>S</fc> <usedratio>%"] 10
, Run Date "<fc=#d33682>D</fc> %a %b %_d %l:%M" "date" 10
, Run StdinReader
, Run Battery
set mouse=a
colorscheme jellybeans+
" colorscheme vividchalk
set listchars=tab:⌞\ ,trail:⋅
set list
set noexpandtab
set copyindent
set preserveindent
#! /usr/bin/env python2
import sys
import shelve
import subprocess
import os
import pickle
def no_spaces(line):
return len(line) - len(line.lstrip())
import Control.Monad.State
-- Append a string to the state.
string :: String -> State [String] ()
string s = State $ \ss -> ((), ss ++ [s])
-- Get the string out of the state.
to_str (State ss) = concat $ b
where (a, b) = ss []
@tomjnixon
tomjnixon / my_client.py
Created December 20, 2010 18:12
A SHET client template.
from shet.client import ShetClient
# Subclass ShetClient.
class MyClient(ShetClient):
# All nodes created by this client will be relative to this directory,
# unless they begin with a '/'.
self.root = "/test/"
def __init__(self, dir):