Skip to content

Instantly share code, notes, and snippets.

View KristianLyng's full-sized avatar

Kristian Lyngstøl KristianLyng

  • Amedia
  • Oslo
View GitHub Profile
kristian@luke:~/Source/compiz$ ~/commentator.sh '.*/.*\.(cpp|c|h)'
Looking for opening comments (/* ...)...
Comments started: 901
Comments started by Kevin : 1 (0%)
Comments started by Travis : 6 (0%)
Comments started by David : 47 (5%)
Comments started by Christopher: 1 (0%)
Comments started by Erkin : 12 (1%)
Comments started by Joel : 2 (0%)
Comments started by Dan : 1 (0%)
kristian@luke:~/Source/compiz$ ~/commentator.sh '.*/.*\.(cpp|c|h)'
Looking for opening comments (/* ...)...
Comments started: 681
Comments started by Kevin : 1 (0%)
Comments started by Travis : 6 (0%)
Comments started by David : 47 (6%)
Comments started by Christopher: 1 (0%)
Comments started by Erkin : 12 (1%)
Comments started by Joel : 2 (0%)
Comments started by Dan : 1 (0%)
kristian@luke:~/Source/beryl$ ~/commentator.sh '.*/.*\.(cpp|c|h)'
Looking for opening comments (/* ...)...
Comments started: 400
tl: total lines. cs: lines starting a comment.
cp: percentage of lines starting a comment by this user compared to all users.
ratio: Comment starts/lines by user per mill
cyberorg: tl: 2233 cs: 17 cp: 4% ratio: 7.61‰
racarr: tl: 44203 cs: 13 cp: 3% ratio: 0.29‰
kristian: tl: 13579 cs: 82 cp: 20% ratio: 6.04‰
nigel: tl: 150 cs: 2 cp: 0% ratio: 13.33‰
@KristianLyng
KristianLyng / commentcommentator
Created November 17, 2010 06:19
Varnish, Compiz and Beryl(last trunk/master) comment commentated
kristian@luke:~/Source/commentcommentator$ ./commentcommentator.sh '../varnish-git/.*\.(cpp|c|h)'
Looking for opening comments (/* ...)...
Comments started: 1365
tl: total lines. cs: lines starting a comment.
cp: percentage of lines starting a comment by this user compared to all users.
ratio: Comment starts/lines by user per mill
kristian: tl: 1254 cs: 21 cp: 1% ratio: 16.75‰
cecilihf: tl: 465 cs: 10 cp: 0% ratio: 21.51‰
petter: tl: 322 cs: 6 cp: 0% ratio: 18.63‰
des: tl: 7499 cs: 67 cp: 4% ratio: 8.93‰
root@kit:/etc/nagios3/conf.d# cat services.cfg
# check that web services are running
define service {
hostgroup_name http-servers
service_description HTTP
check_command check_http
use generic-service
notification_interval 0 ; set > 0 if you want to be renotified
}
kristian@luke:~$ df -lhT --total -x tmpfs -x devtmpfs --portability | gawk -f ~/awkdf
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda1 ext4 29G 11G 16G 41% /
/dev/sdd1 btrfs 1.9T 279G 1.6T 15% /mnt/k
/dev/md0 ext4 3.6T 3.0T 636G 83% /mnt/r
total - 5.5T 3.3T 2.2T 60%
@KristianLyng
KristianLyng / gist:750690
Created December 21, 2010 21:58
awk and population
kristian@luke:~$ cat stats
Østfold 202751 221386 233301 238345 251032 268584 271662 3922 69
Akershus 234323 324390 369193 418114 471988 527625 536499 4620 116
Oslo 475663 481548 452023 461644 508726 575475 586860 427 1375
Hedmark 177324 179204 187223 187314 187999 190071 190709 26244 7
Oppland 166303 172479 180765 182593 183419 184288 185216 23878 8
Buskerud 168351 198852 214571 225261 238833 254634 257673 13870 19
Vestfold 174382 175402 186691 198354 215030 229134 231286 2157 107
Telemark 149943 156778 162050 162869 165595 167548 168231 13894 12
@KristianLyng
KristianLyng / gist:761798
Created January 1, 2011 14:59
Munin-node tester
# Connect to a munin node, list all plugins, ask for config+fetch from all of them.
gawk 'function rtodot() { while (1) { S |& getline foo; print "R:",foo; if (foo == ".") { break; } } }; BEGIN { S="/inet/tcp/0/localhost/4949/"; S |& getline; print "list" |& S; S |& getline; for (i=1; i<NF; i++) { print "C:",$i; print "config "$i |& S; rtodot(); print "fetch "$i |& S; rtodot(); }}'
Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "DENON, Ltd. DENON-AVAMP"
HorizSync 26.0 - 81.0
VertRefresh 50.0 - 75.0
Option "DPMS"
EndSection
Section "Device"
@KristianLyng
KristianLyng / #hotellet
Created January 4, 2011 20:18
Fire år med #hotellet-logger
kristian@luke:~/.../irclogs/Undernet$ head -qn1 \#hotellet.log*
--- Log opened Wed Oct 25 15:45:41 2006
--- Log opened Mon Sep 22 12:51:02 2008
--- Log opened Sat Aug 30 11:52:50 2008
--- Log opened Thu Sep 11 16:49:28 2008
--- Log opened Fri Sep 26 20:59:03 2008
--- Log opened Fri Sep 10 12:51:30 2010
--- Log opened Mon Dec 06 09:57:40 2010
kristian@luke:~/.../irclogs/Undernet$ awk '{ gsub("@",""); gsub("KristianL","Kristian"); } $2 == "<" { $2="<"$3; $3=""; } $2 ~ "<.[a-zA-Z0-9|]*>" { foo[$2]++} END { for (a in foo) printf("%-20s wrote %5d lines\n",a,foo[a])}' \#hotellet.log*
<idril> wrote 134 lines