This file contains hidden or 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
#!/usr/bin/perl | |
use strict; | |
use Net::CIDR::Lite; | |
# pull the IPs from the following | |
my @lines = `wget -O- http://public.yahoo.com/~vineet/ip.txt 2>/dev/null`; | |
# Remove the newline from each row | |
chomp for @lines; |
This file contains hidden or 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
#!/usr/bin/perl | |
use strict; | |
use Attribute::Handlers; | |
my $cachettl = 30; | |
sub write_to_cache { | |
my ($v) = @_; | |
open CACHE, '>/tmp/cache'; | |
use Data::Dumper; |
This file contains hidden or 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
#!/usr/bin/perl | |
$pid = shift || die "You must specify a pid\n"; | |
die "Pid $pid does not exist\n" unless -e "/proc/${pid}/"; | |
my $s = `cat /proc/${pid}/stat`; | |
my @a = split( /\s+/, $s ); | |
my $jiffies = int( $a[22] / 1000 ); |
This file contains hidden or 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
#!/usr/bin/python | |
''' Not my script, found on the Internet, and rediscovered on my hard drive | |
''' | |
import sys | |
def cidr_to_regex(cidr): | |
ip, prefix = cidr.split('/') | |
base = 0 | |
for val in map(int, ip.split('.')): |
This file contains hidden or 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
package Profiler::Decorator; | |
use IO::Socket::INET; | |
use Time::HiRes qw( usleep ualarm gettimeofday tv_interval nanosleep clock_gettime clock_getres clock_nanosleep clock stat ); | |
use Data::Dumper; | |
# flush after every write | |
# We call IO::Socket::INET->new() to create the UDP Socket | |
# and bind with the PeerAddr. |
This file contains hidden or 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
" Strip down to just the IP address in the highlighted region | |
function! ExtractIP() | |
'<,'>perldo $_ = $1 if /((?:\d+\.){3}\d+)/; | |
endfun | |
vmap <silent> <C-i> <Esc>:call ExtractIP()<CR> | |
function! SortUniq() | |
'<,'>sort | |
'<,'>g/^\(.*\)$\n\1$/d | |
endfun |
This file contains hidden or 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
#!/usr/bin/perl | |
#use strict; | |
use Net::DNS::Async; | |
use NetAddr::IP; | |
my %map; | |
my %resultmap; | |
my $c = new Net::DNS::Async( ); | |
my $debug = 0; |
This file contains hidden or 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
#include <string.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
char * stripper_dup( const char * str ){ | |
char * ptr = strdup( str ); | |
char * inptr = (char * )str; | |
int intag = 0; | |
char buffer; | |
char *p = ptr; |
This file contains hidden or 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
#!/usr/bin/perl | |
while( <> ){ | |
if( /^(.*?),(.*)/ ){ | |
for( my $count = 0; $count < 1000; $count++ ){ | |
printf "%s%.3d,%s\n", $1, $count, $2; | |
} | |
} | |
} |
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'json' | |
class AuthenticationException < StandardError ; end | |
module RequireAuth | |
def requireauth ( *args ) | |
args.each do |field| | |
old_method = instance_method(field) |