Skip to content

Instantly share code, notes, and snippets.

@warewolf
warewolf / dedupe.pl
Created November 29, 2012 20:08
dedupe with a haSh in perl
#!/usr/bin/perl
use strict;
use warnings;
my @values = qw( a b c d a b c d a b c d);
my %dedupe_hash;
foreach my $value (@values) {
@warewolf
warewolf / session_request.pl
Created January 30, 2013 02:19
@warewolf's apache mod_perl 1.x session handler that sends a static page in case of errors
package HTML::Mason::Exception;
use strict;
use warnings;
sub as_wrapped
{
my ($self) = @_;
my $r = Apache->request();
v1.9.1 - 4d 0a 03 08
v1.9.0 - 1d 0a 03 08
v1.8.1 - c1 f4 02 08
v1.7.1 - fd ea 02 08
@warewolf
warewolf / gist:5476989
Created April 28, 2013 14:10
Cleaning up a mess of system-wide ruby gems I installed. Apparently gem doesn't understand the difference between "permission denied" and "file/directory does not exist".
[root@xasf /usr/share/gems]# gem uninstall -i /usr/share/gems rake
Remove executables:
rake
in addition to the gem? [Yn] y
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /usr/share/gems/bin directory.
[root@xasf /usr/share/gems]# ls
cache doc gems specifications
[root@xasf /usr/share/gems]# mkdir bin
@warewolf
warewolf / gist:5478055
Created April 28, 2013 19:17
y u no run jekyll?
# warewolf@xasf:~/git/octopress$ rake generate
## Generating Site with Jekyll
About to run: compass compile --css-dir source/stylesheets
identical source/stylesheets/screen.css
About to run: jekyll
Configuration from /home/warewolf/git/octopress/_config.yml
/home/warewolf/git/octopress/plugins/config_tag.rb:1:in `require': cannot load such file -- json (LoadError)
from /home/warewolf/git/octopress/plugins/config_tag.rb:1:in `<top (required)>'
from /usr/local/share/gems/gems/jekyll-0.12.1/lib/jekyll/site.rb:78:in `require'
from /usr/local/share/gems/gems/jekyll-0.12.1/lib/jekyll/site.rb:78:in `block (2 levels) in setup'
@warewolf
warewolf / catl.pl
Created June 19, 2013 02:51
Stupid hacks: catl (cat loop) - repeatedly print something to STDOUT
#!/usr/bin/perl
$ARGV[0]="-"if($ARGV[0]eq"");open(F,$ARGV[0])||die$!;binmode(F);if($ARGV[0]=~
/^-$|^$/||$ARGV[0]){while(!eof(F)){read(F,$d,1024);$s.=$d}}select(STDOUT);$|=
1;while(1){if($ARGV[0]ne"-"){seek(F,0,0);while(!eof(F)){read(F,$s,1024);print
STDOUT$s;}}else{print STDOUT$s;}}close F;# catl v1.0, (C) warewolf@xabean.net
Drives are in this: www.newegg.com/Product/Product.aspx?Item=N82E16816133047
for foo in sdq sdf sdd sde sdc; do hdparm -I /dev/$foo | grep odel; done
Model Number: WDC WD20EARX-00PASB0
Model Number: WDC WD20EARX-00PASB0
Model Number: WDC WD20EARX-00PASB0
Model Number: WDC WD20EARX-00PASB0
Model Number: WDC WD30EZRX-00DC0B0
# mdadm --examine /dev/sdq1
@warewolf
warewolf / shell.txt
Created December 6, 2013 20:45
why is cd // special?
# user@host:~$ cd
# user@host:~$ cd //
# user@host://$ cd /
# user@host:/$ cd ///
# user@host:/$ cd ////
# user@host:/$ # why is cd // special?
@warewolf
warewolf / gist:8166951
Created December 29, 2013 02:57
updateme ipxe gist
next-server 192.168.2.1;
# Make sure the iPXE we're loading supports what we need,
# if not load a full-featured version
if exists ipxe.http and exists ipxe.iscsi
and exists ipxe.bzimage and exists ipxe.pxe
and exists ipxe.elf and exists ipxe.menu {
filename "bootstrap.ipxe";
# Still waiting for NFS boot support to be merged
}
@warewolf
warewolf / ps2251-61.txt
Last active January 2, 2016 04:18
Phision PS2251-XX series identification dumps
Received 528 bytes of data:
00 12 01 00 02 00 00 00 40 fe 13 00 3e 00 01 01 02 .......@...>....
10 03 01 04 03 09 04 00 00 00 00 00 00 00 00 00 00 ................
20 00 00 00 00 00 00 00 00 00 00 00 00 12 03 20 20 ..............
30 20 20 20 20 20 20 00 00 00 00 00 00 00 00 00 00 ..........
40 00 00 00 00 00 00 1a 03 55 53 42 20 44 49 53 4b ........USB DISK
50 20 32 2e 30 00 00 00 00 00 00 00 00 00 00 00 00 2.0............
60 22 03 30 31 37 42 30 31 32 39 34 30 31 30 34 30 ".017B0129401040
70 36 30 37 30 37 30 45 30 34 30 30 30 30 30 30 30 607070E040000000
80 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0000000000000000