Skip to content

Instantly share code, notes, and snippets.

@jblaine
jblaine / jblaine-monobook.css
Last active September 27, 2015 03:28
MediaWiki Monobook.css overrides
/* Make MediaWiki Monobook skin not look like ass */
/* Version 0.4alpha-gamma-beta-omega */
/* jblaine AT SIGN kickflop.net */
#globalWrapper {
/* Default of 127% is a bit small for my tastes */
font-size: 160%;
}
#content {
font-family: Georgia, "Palatino Linotype", serif;
@jblaine
jblaine / gist:1323448
Created October 28, 2011 20:26
Emulating ypcat passwd with ldapsearch + awk
ldapsearch \
-h ldap1.our.org \
-x \
-LLL \
-b ou=People,dc=rcf,dc=our,dc=org \
'objectClass=posixAccount' | \
awk -F': ' 'BEGIN {gecos=""; uid=""; uidnum=""; gidnum=""; home=""; shell=""
;} /^uid: / {uid=$2} /^gecos: / {gecos=$2} /^uidNumber: / {uidnum=$2} /^gidNumbe
r: / {gidnum=$2} /^loginShell: / {shell=$2} /^homeDirectory: / {home=$2} {if (ui
d != "" && uidnum != "" && gidnum != "") {print uid "::" uidnum ":" gidnum ":" g
@jblaine
jblaine / gist:1525788
Created December 28, 2011 01:55
The last attempt: A failed day of thrashing
database-dumps:rcf-temp1# # convert any non-ASCII character to a space
database-dumps:rcf-temp1# perl -i.bk -pe 's/[^[:ascii:]]/ /g;' mysql5-dump.sql
database-dumps:rcf-temp1# sum mysql5-dump.sql mysql5-dump.sql.bk
41053 2545611 mysql5-dump.sql
50145 2545611 mysql5-dump.sql.bk
database-dumps:rcf-temp1# cmp mysql5-dump.sql mysql5-dump.sql.bk
mysql5-dump.sql mysql5-dump.sql.bk differ: byte 1304850, line 30
database-dumps:rcf-temp1# psql -U postgres -f mysql5-dump.sql --variable=client_encoding=utf-8 rt3
...
INSERT 0 416
@jblaine
jblaine / gist:1731804
Created February 3, 2012 19:07
YEAH!
# strace perldoc RT_Config.pm
...
write(2, "Can't open RT_Config.pm: Permiss"..., 89Can't open RT_Config.pm: Permission denied at /usr/share/perl5/Pod/Perldoc.pm line 1446.
) = 89
exit_group(13) = ?
etc:rt-tickets> ls -ld RT_Config.pm
-r--r----- 1 root rt 67858 Dec 30 16:03 RT_Config.pm
# id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),1107124587
#
@jblaine
jblaine / gist:2285994
Created April 2, 2012 18:17
nfsstat output is PURELY for humans to read :|
Server rpc:
Connection oriented:
calls badcalls nullrecv badlen xdrcall dupchecks dupreqs
3 0 0 0 0 0 0
Connectionless:
calls badcalls nullrecv badlen xdrcall dupchecks dupreqs
0 0 0 0 0 0 0
Server nfs:
calls badcalls
@jblaine
jblaine / gist:2343796
Created April 9, 2012 14:24
Bourne shell function implementing https://github.com/oscardelben/sheet
# Bourne shell function implementing https://github.com/oscardelben/sheet
# with the exception of the 'embedded uri in sheets' feature (simply because
# I'm lazy and this is a proof of point exercise.
#
# Works anywhere with sh or bash
sheet () {
if [ "$1"x = "x" ]; then
ls -1 $HOME/.sheets 2> /dev/null || (mkdir $HOME/.sheets && echo "Created $HOME/.sheets")
return 0
@jblaine
jblaine / gist:2400835
Created April 16, 2012 19:09
10KLOC sh script
# From support.netapp.com/NOW/download/tools
tmp:rcf-monitor> head -1 ~jblaine/perfstat7_20110411.sh
#!/bin/sh
tmp:rcf-monitor> wc -l ~jblaine/perfstat7_20110411.sh
10205 /afs/rcf/user/jblaine/perfstat7_20110411.sh
tmp:rcf-monitor>
@jblaine
jblaine / gist:2770749
Created May 22, 2012 18:22
Mickey Mouse Watch
#!/usr/bin/env perl
#
# Author: Jeff Blaine
# Date: 09/16/96
# Version: 1.0
#
# Figures out the current time and outputs the information as if you were
# reading a Mickey Mouse watch.
#
# Originally based on sh/expr/awk code written by the same author around
@jblaine
jblaine / gist:2836738
Created May 30, 2012 14:43
The hell?
~:lider2> cd /nas/project/ff/work/html
html:lider2> tail home.html | wc -l
10
html:lider2> tail /nas/project/ff/work/html/home.html
tail: cannot open
`/nas/project/ff/work/html/home.html' for reading:
Not a directory
html:lider2>
@jblaine
jblaine / safe-yum.sh
Created June 4, 2012 21:33
Safer yum
#!/bin/sh
#
# If yum experiences a corrupt database it very frequently
# just hangs. This most commonly seen as a hung 'rpmq'
# command (a child of yum). When performing automated yum
# commands, this is bad news, as they can just start piling up.
#
# Try to determine if there are any corrupt RPM database files, try
# to rebuild them if so, THEN run yum.
#