Skip to content

Instantly share code, notes, and snippets.

View res0nat0r's full-sized avatar
🤗

Stefhen Hovland res0nat0r

🤗
  • Austin, TX
View GitHub Profile
@res0nat0r
res0nat0r / daemon.rb
Created October 5, 2009 18:56
Simple daemonization
# taken from http://snippets.dzone.com/posts/show/2265
require 'fileutils'
module Daemon
WorkingDirectory = File.expand_path(File.dirname(__FILE__))
class Base
def self.pid_fn
File.join(WorkingDirectory, "#{name}.pid")
end
@res0nat0r
res0nat0r / README.md
Last active March 21, 2017 23:33
Grab the first imdb result from google and save it to an .nfo file

Dependencies:

Mechanize

Example:

$ ./imdb.rb "pee wee's big adventure" /tmp
@res0nat0r
res0nat0r / ass2srt.pl
Created October 17, 2009 03:56
Convert ASS subs to SRT
#!/usr/bin/perl
use strict qw(subs vars);
my $counter;
while(<>) {
if(/^Dialogue: /) {
my ($start, $end, $text) = unpack("x12A10xA10x22A*", $_);
my ($hr, $min, $sec) = split(/:/, $start);
@res0nat0r
res0nat0r / screen_ssh.sh
Created October 29, 2009 19:50
Set screen window title to remote host.
#!/bin/bash
# screen_ssh.sh by Chris Jones <cmsj@tenshu.net>
# Released under the GPL v2 licence.
# Set the title of the current screen to the hostname being ssh'd to
#
# usage: screen_ssh.sh $PPID hostname
#
# This is intended to be called by ssh(1) as a LocalCommand.
# For example, put this in ~/.ssh/config:
#
@res0nat0r
res0nat0r / tree.rb
Created November 10, 2009 18:51
Breadcrumbs
#!/usr/bin/ruby
require 'rubygems'
require 'nokogiri'
text="<html><body><div class='body'><p class='main'>some text here</p></div></body></html>"
doc = Nokogiri::HTML(text)
root = doc.root
node = doc.xpath('//p[@class="main"]').first
path = [node]
@res0nat0r
res0nat0r / gist:359259
Created April 7, 2010 18:33
Perl wordlist generator
#!/usr/bin/perl
=head1 NAME
wg.pl
=head1 AUTHOR
Matteo Redaelli
@res0nat0r
res0nat0r / gist:483034
Created July 20, 2010 14:35
fileopentest.c
#include <stdio.h>
#include <stdlib.h>
#define NoOfFILES 16384
int main()
{
char filename[10];
FILE *fds[NoOfFILES];
int i;
#!/usr/bin/perl -w
#
# nicstat - print network traffic, Kbyte/s read and written.
# Solaris 8+, Perl (Sun::Solaris::Kstat).
#
# "netstat -i" only gives a packet count, this program gives Kbytes.
#
# 30-Sep-2006, ver 1.00 (check for new versions, http://www.brendangregg.com)
#
# USAGE: nicstat [-hsz] [-i int[,int...]] | [interval [count]]
#!/usr/bin/perl
$INQ = "/net/ironchef/var/tmp/pkgs/linux/inq.linux";
#$INQ = "/net/goober/scratch/inq/inq";
$HEAD = 1;
while (@ARGV)
{
$arg = shift @ARGV;
if ($arg eq "-emc") { $EMC = 1; }
@res0nat0r
res0nat0r / add_disks.pl
Created May 1, 2011 15:15
Add SAN disks to VxVM
#!/usr/bin/perl -w
use Getopt::Std;
getopt('dig', \%opts);
die("\nUsage: $0 -d <file with disks to add> -i <file with inq output> -g <diskgroup name>\n\n")
unless (defined $opts{d} && $opts{i} && $opts{g});