Skip to content

Instantly share code, notes, and snippets.

@scumola
scumola / flickr_ripper.pl
Created March 20, 2011 05:03
Pulls the Original image url, title and description from a flickr description page. Doesn't download the page, but will take the html from the page on stdin.
#!/usr/bin/perl
$re1='.*?'; # Non-greedy match on filler
$re2='(?:\\/[\\w\\.\\-]+)+'; # Uninteresting: unixpath
$re3='.*?'; # Non-greedy match on filler
$re4='((?:\\/[\\w\\.\\-]+)+_o.jpg)'; # Unix Path 1
$re=$re1.$re2.$re3.$re4;
while (<STDIN>) {
@scumola
scumola / archive_a_site.pl
Created April 4, 2011 14:48
wget lines for mirroring sites
#!/usr/bin/perl
#Simple Perl script to save me from having to memorise the parameters.
#Archives a whole website.
die("Usage: archive.pl \"URL(s)\" [wait]\n") unless ($ARGV[0]);
my $waitTime = 1;
$waitTime = $ARGV[1] if ($ARGV[1]);
system("wget --mirror --page-requisites --continue --convert-links --user-agent=\"\" -e robots=off --wait $waitTime $ARGV[0]");
@scumola
scumola / crawlme.php
Created April 4, 2011 16:31
php code that will emulate a fake site to test a web crawler with. Can increase the size of the fake site using the depth=x variable
<?php
$depth=$_GET['depth'];
$numurls=$_GET['numurls'];
$code =$_GET['code'];
if (!isset($numurls)) {
$numurls=100;
}
if (!isset($depth)) {
$depth=2;
@scumola
scumola / rc.iptables
Created April 5, 2011 02:56
My home iptables rules
#!/bin/sh
LOCALNET="10.0.0.0/255.255.255.0"
iptables -F
iptables -X
iptables -F -t nat
iptables -X -t nat
# setting default policy
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
@scumola
scumola / gist:1650258
Created January 20, 2012 23:38
aws php sdk list all instances in all regions
<?php
error_reporting(0);
header("Content-type: text/html; charset=utf-8");
require_once '../sdk.class.php';
$ec2 = new AmazonEC2();
$response = $ec2->describe_regions();
foreach ($response->body->regionInfo->item as $item) {
$region_endpoint = (string) $item->regionEndpoint;
$region_name = (string) $item->regionName;
$ec2->set_hostname($region_endpoint);
@scumola
scumola / launchec2.php
Created January 30, 2012 19:40
aws php sdk launch instance
#!/usr/bin/php
<?php
if (empty($argv[1])) {
print ("usage: $argv[0] <arg1> <arg2> ...\n");
print (" Args: machine_name AMI availability_zone instance_size key_pair machine_type_tag deployment_tag security_group\n");
print (" EXAMPLE: test-99 ami-a9559ec0 us-east-1a m1.small private-key webserver temp webserver\n");
print (" EXAMPLE: test-99 ami-bba4fbfe us-west-1a m1.small private-key worker temp internal\n");
print ("\n");
print (" NOTE: WORKS IN EAST AND WEST ONLY!!\n");
exit();
@scumola
scumola / goodbye letter
Created February 28, 2012 21:56
goodbye letter
Yes, it's true. I'm moving on. Thanks for all of the kind words, everyone! I feel that working at Gnip has
been the best place that I've ever worked and I'm sad to leave. I made a bunch of good friends during my stay
here and I'd love it if people keep in touch.
As for my new gig, I'm sure that everyone has heard me talk about my love for the sea. I've been accepted into
this season's episode of Whale Wars on Animal Planet. I'll be living and working on the "Bob Barker" in the
Arctic Circle and fighting the Japanese whaling fleet for a full summer. My plane leaves on midnight on March
9th. I hope that you all tune-in and keep your fingers crossed for me and those poor whales out there!
http://animal.discovery.com/tv/whale-wars/
@scumola
scumola / asdf
Created April 17, 2012 19:04
asdf
+-------------------------------+--------+---------+------------+---------+----------------+-------------+-------------------+--------------+-----------+----------------+---------------------+---------------------+---------------------+-------------------+----------+----------------+---------+
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
+-------------------------------+--------+---------+------------+---------+----------------+-------------+-------------------+--------------+-----------+----------------+---------------------+---------------------+---------------------+-------------------+----------+----------------+---------+
| admin_users | MyISAM | 10 | Dynamic | 17 | 44 | 764 | 281474976710655 | 2048
@scumola
scumola / irclog.txt
Created July 2, 2012 17:42
irc chatlog on June 30, 2012 regarding getting the logins and RDS instances back up and running with Steve W, Alex C and Brendan K.
<stevewebb> Hey.
<beekermememe> Hey
<beekermememe> curl -v https://secure.dishonline.com:4444/secure_network_authentication/A21FF00E85C8666CE044001A4B0AA2BC
<beekermememe> * About to connect() to secure.dishonline.com port 4444
<beekermememe> * Trying 23.21.52.20... connected
<beekermememe> * Connected to secure.dishonline.com (23.21.52.20) port 4444
<beekermememe> * successfully set certificate verify locations:
<beekermememe> * CAfile: /etc/pki/tls/certs/ca-bundle.crt
<beekermememe> CApath: none
<beekermememe> * SSLv2, Client hello (1):
@scumola
scumola / alex20120629.txt
Created July 2, 2012 17:50
Alex C IM chat log from June 29, 2012 re: AWS/DOL outage
9:13:42 PM Alex Cook: We are back up
9:13:49 PM Alex Cook: I think it was WRA2 controller
9:13:51 PM steveholly051802: Ahh.
9:13:53 PM steveholly051802: ok
9:13:56 PM Alex Cook: https://rpm.newrelic.com/accounts/47839/applications/177265/transactions#id=52084693
9:15:35 PM steveholly051802: So we were ok. The WRA2 service was hanging or something?
9:15:55 PM Alex Cook: it looks like it not 100% sure yet
9:16:29 PM Alex Cook: is mapi going down now??
9:16:34 PM steveholly051802: I'm seeing mapi errors now too.
9:16:39 PM steveholly051802: It could be amazon.