This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Modified from http://lemonnier.se/erwan/blog/item/45/ | |
# | |
# connTest is our decorator subroutine. | |
# | |
sub connTest { | |
my $f = @_; | |
return sub { | |
&$f(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Listener(object): | |
""" | |
This accepts a list of `commands` and associated `responses` and opens a | |
socket on `port`. It then listens for any of the commands and dumps | |
the associated response. | |
Example: | |
Listener.listen(port=57359, | |
commands = [ "give_me_your_name", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// asm_release.c | |
// | |
// Releases disks from ASM after removing them from a disk group by utilizing the | |
// oracleasm ABI. | |
// | |
// Usage: ./asm_release ASMXXXXXX | |
// - where ASMXXXXXX is the ASM disk name. | |
// | |
// Constructed with help from the following article: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dd if=/dev/sda \ | |
of=/dev/stdout \ | |
bs=512 \ | |
skip=$( \ | |
dc -e " 16i $( \ | |
dd if=/dev/sda \ | |
of=/dev/stdout \ | |
bs=512 \ | |
count=1 2> /dev/null \ | |
| hexdump -C \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There's no "right" way to do this, so... | |
When you lazily umount a filesystem in Linux, procfs changes /proc/pid/fd/* from absolute to relative paths. E.g. if you have a tail open on the FS: | |
[uid] 31624 0.0 0.0 100924 616 pts/86 Ss+ 10:12 0:00 tail -f /mnt/test | |
$ readlink /proc/31624/fd/3 | |
/mnt/test | |
Then lazily umount the FS: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use vars qw($VERSION %IRSSI); | |
use Irssi qw(command_bind); | |
my $VERSION = '1.00'; | |
my %IRSSI = | |
( | |
authors => 'Zach Walton', | |
contact => '[email protected]', | |
name => 'birdsummoner', | |
description => 'Summon jonEbird back to #linux', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pprint | |
import string | |
import sys | |
HAS_LEFT_CHILD = 1 << 7 | |
HAS_RIGHT_CHILD = 3 << 6 | |
HAS_BOTH_CHILDREN = 1 << 6 | |
HAS_NO_CHILDREN = ~(3 << 6) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use vars qw($VERSION %IRSSI); | |
$VERSION = '0.0.1'; | |
%IRSSI = ( | |
authors => '', | |
contact => '', | |
name => 'fix_dropbox', | |
description => 'unfuck dropbox urls', | |
license => '', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zach (python): | |
import inspect | |
def g(v=None): | |
f=str(inspect.currentframe().f_back) | |
if not v: | |
g.__dict__[f] = g.__dict__[f] + 'O' if g.__dict__.get(f) else 'GO' | |
return g | |
print g.__dict__.pop(f, 'G') + 'AL' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bash/zsh git prompt support | |
# | |
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]> | |
# Distributed under the GNU General Public License, version 2.0. | |
# | |
# This script allows you to see repository status in your prompt. | |
# | |
# To enable: | |
# | |
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh). |
OlderNewer