Skip to content

Instantly share code, notes, and snippets.

View pimeys's full-sized avatar

Julius de Bruijn pimeys

View GitHub Profile
@pimeys
pimeys / wireless.sh
Created September 23, 2012 16:22
Wireless plugin for xmobar
#!/bin/sh
iwconfig eth2 2>&1 | grep -q no\ wireless\ extensions\. && {
echo wired
exit 0
}
essid=`nmcli -t -f active,ssid dev wifi | egrep '^yes' | cut -d\' -f2`
stngth=`nmcli -t -f active,ssid,signal dev wifi|grep yes|cut -d':' -f3`
bars=`expr $stngth / 10`
@pimeys
pimeys / xmonad.hs
Created September 23, 2012 16:24
Xmonad config
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import System.IO
main = do
xmproc <- spawnPipe "/usr/bin/xmobar /home/pimeys/.xmobarrc"
xmonad $ defaultConfig
@pimeys
pimeys / weather.rb
Created September 23, 2012 16:25
Weather for xmobar
# encoding: utf-8
require 'json'
require 'net/http'
def styled_temp(temp)
if temp < 15.0
"<fc=#AAC0FF>#{temp}</fc>"
elsif temp < 20.0
"<fc=#FFFF00>#{temp}</fc>"
@pimeys
pimeys / xmonad.hs
Created October 21, 2012 08:50
Xmonad configuration, my try
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import System.IO
main = do
xmproc <- spawnPipe "/usr/bin/xmobar /home/pimeys/.xmobarrc"
xmonad $ defaultConfig
@pimeys
pimeys / .xmobarrc
Created October 21, 2012 08:51
Xmobar configuration
Config { font = "xft:Inconsolata:size=10:antialias=true"
, bgColor = "#002B36"
, fgColor = "grey"
, position = Top
, lowerOnStart = True
, commands = [ Run Com "/home/pimeys/.rvm/rubies/ruby-1.9.3-p194/bin/ruby /home/pimeys/.bin/weather.rb" [] "weather" 1000
, Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10
, Run Memory ["-t","Mem: <usedratio>%"] 10
, Run Network "eth1" ["-L","0","-H","32","--normal","green","--high","red"] 10
, Run Com "sh /home/pimeys/.bin/wireless.sh" [] "wifi" 10
@pimeys
pimeys / wireless.sh
Created October 21, 2012 08:52
Wireless indicator for xmobar
#!/bin/sh
iwconfig eth2 2>&1 | grep -q no\ wireless\ extensions\. && {
echo wired
exit 0
}
essid=`nmcli -t -f active,ssid dev wifi | egrep '^yes' | cut -d\' -f2`
stngth=`nmcli -t -f active,ssid,signal dev wifi|grep yes|cut -d':' -f3`
bars=`expr $stngth / 10`
@pimeys
pimeys / bat.rb
Created October 21, 2012 08:53
Battery indicator for Xmobar
# encoding: utf-8
# B: 96% ↑ (0:14)
# B: 20% ↓ (0:30)
# B: 100% ↔
acpi_output = %x[/usr/bin/acpi].split(' ').map{|i| i.gsub(',', '')}
status_symbols = {
'Unknown' => '↔',
@pimeys
pimeys / weather.rb
Created October 21, 2012 08:55
Weather information for Xmobar
# encoding: utf-8
require 'json'
require 'net/http'
def styled_temp(temp)
if temp < 15.0
"<fc=#AAC0FF>#{temp}</fc>"
elsif temp < 20.0
"<fc=#FFFF00>#{temp}</fc>"
@pimeys
pimeys / .xsession
Created October 21, 2012 08:59
My .xsession
gnome-settings-daemon &
xrdb $HOME/.Xresources &
xsetroot -solid "#002B36" &
setxkbmap -layout fi &
xkbset m &
xkbset exp "-m" &
xmodmap -e "keycode 35 = Pointer_Button2" &
$HOME/.dropbox-dist/dropboxd &
exec xmonad
@pimeys
pimeys / test.rb
Created November 28, 2012 11:14
Failing invoice test
it "should output a valid csv with collected invoices included", :js => true do
select 'new', :from => 'search_status_eq'
click_button 'Apply filter'
page.click_link 'Export Invoices'
page.text.should eql(<<-CSV)
Advertiser;Month;Invoice #;Amount;Difference;Status;Date sent;Collected
Name 0;September 2012;INVOICE0;-;-;new;;false
CSV
end