Skip to content

Instantly share code, notes, and snippets.

View rcalsaverini's full-sized avatar

Rafael Calsaverini rcalsaverini

View GitHub Profile
@rcalsaverini
rcalsaverini / xmonad.hs
Created September 3, 2012 12:35
my xmonad.hs
-- basic imports
import XMonad
-- needed for layouts
import XMonad.Layout.Grid
-- needed for hot keys
import XMonad.Util.EZConfig(additionalKeys)
import XMonad.Actions.CycleWS (nextWS, prevWS, shiftToNext, shiftToPrev)
@rcalsaverini
rcalsaverini / greptime
Created June 15, 2012 14:33
Get running time of a process given a pid
#!/bin/bash
pidlist=`ps ax | grep -i -E $1 | grep -v grep | awk '{print $1}' | grep -v PID | xargs echo`
for pid in $pidlist; do
sincetime $pid
done
@rcalsaverini
rcalsaverini / contsince.py
Created June 12, 2012 20:14
Get running time of a process given a pid
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from subprocess import check_output
from sys import argv
from time import time
cmd = lambda pid: "stat -t /proc/%s | awk '{print $14}'" % (pid,)