Skip to content

Instantly share code, notes, and snippets.

AFA0> controller details
Executing: controller details
Controller Information
----------------------
Remote Computer: .
Device Name: AFA0
Controller Type: No Info
Access Mode: READ-WRITE
Controller Serial Number: Last Six Digits = 4D50F9
Number of Buses: 3
@stesh
stesh / gist:3308971
Created August 9, 2012 23:23
Hello world, in Eiffel
#ifdef __cplusplus
extern "C" {
#endif
/*
ANSI C code generated by SmartEiffel The GNU Eiffel Compiler, Eiffel tools and libraries
Release 2.3 (Thursday July 11th 2007) [Antoine-Auguste Parmentier]
Copyright (C), 1994-2002 - INRIA - LORIA - ESIAL UHP Nancy 1 - FRANCE
Copyright (C), 2003-2005 - INRIA - LORIA - IUT Charlemagne Nancy 2 - FRANCE
D.COLNET, P.RIBET, C.ADRIAN, V.CROIZIER F.MERIZEN - SmartEiffel@loria.fr
http://SmartEiffel.loria.fr
@stesh
stesh / gist:3261474
Created August 5, 2012 03:46
Horse_ebooks
while :; do wget -qO- http://horseebooksipsum.com/api/v1 | say; done
def foo(*args, **kwargs):
def f(myargs=args, mykwargs=kwargs):
def g(*myargs, **mykwargs):
# do stuff with myargs and mykwargs
return g()
# do stuff with f
@stesh
stesh / gist:3094315
Created July 11, 2012 22:56
Cobbled-together backup routine
#!/usr/bin/perl
use strict;
use warnings;
$< and die "This won't work unless run by root";
my @errors;
sub log_error {
push(@errors, pop);
#!/bin/sh
grep oomguarpages /proc/user_beancounters | head -n 4 | tail -n 1 | awk '{print $6}'
@stesh
stesh / gist:3012428
Created June 28, 2012 16:44
hacky decorator for class-level properties in python using @classmethods
class classproperty(property):
def __get__(self, cls, inst):
return self.fget.__get__(None, inst)()
class MyClass(object):
numbers = [1,2,3,4,5]
#!/bin/sh
for user in $(cut -d ':' -f 1 /etc/passwd); do
if [ $(id -u $user) -ge 1000 ]; then
if [ -z $(getent group $user) ]; do
addgroup "$user"
fi
@stesh
stesh / gist:2980317
Created June 23, 2012 22:19
LaunchDaemon script for monitoring S.M.A.R.T. on OS X
#!/bin/sh
set -e
vardir='/var/local/check-smart'
[ -d "$vardir" ]
[ -x smartctl -a -x sendmail ]
cd "$vardir"
@stesh
stesh / gist:2953505
Created June 19, 2012 10:49
source .zshrc in every pane of every window of every session on the tmux server
update_all_shells () {
for session in $(tmux list-sessions|cut -d ':' -f 1); do
for window in $(tmux list-windows -t $session | cut -d ':' -f 1); do
tmux set-window-option -t $session:$window synchronize-panes on
tmux send-keys -t $session:$window 'source ~/.zshrc'
tmux send-keys -t $session:$window 'ENTER'
tmux set-window-option -t $session:$window synchronize-panes off
done
done
}