Skip to content

Instantly share code, notes, and snippets.

@DamianZaremba
DamianZaremba / install_sublime_text.sh
Last active May 25, 2021 21:01
Install sublime text on linux
cd /usr/src/
wget http://c758482.r82.cf2.rackcdn.com/sublime-text_build-3047_i386.deb
dpkg -i sublime-text_build-3047_i386.deb
@DamianZaremba
DamianZaremba / static_backend.pl
Created July 18, 2012 00:03
Static perl based backend for PDNS
#!/usr/bin/perl
# Restrict unsafe constructs
use strict;
# Config bits
my $hostmaster = 'hostmaster.uk-noc.com';
my $auth_server = 'dns.uk-noc.com';
my $serial = '2012071800';
my @target_ips = (
@DamianZaremba
DamianZaremba / mysql.rb
Created July 26, 2012 13:06
Facter MySQL version module
Facter.add(:mysql_version) do
setcode do
Facter::Util::Resolution.exec('mysql --version').chomp.split(' ')[4].gsub(',', '')
end
end
@DamianZaremba
DamianZaremba / cloudflare_ranges.py
Created August 12, 2012 21:21
Get the current cloudflare ip ranges
#!/usr/bin/python
import urllib2
from BeautifulSoup import BeautifulSoup
if __name__ == "__main__":
try:
response = urllib2.urlopen("https://www.cloudflare.com/wiki/index.php"\
"?title=What_are_the_CloudFlare_IP_address"\
"_ranges&action=render")
except urllib2.HTTPError, e:
remove_action('rss_head', 'the_generator');
remove_action('rss2_head', 'the_generator');
remove_action('commentsrss2_head', 'the_generator');
remove_action('rdf_header', 'the_generator');
remove_action('atom_head', 'the_generator');
remove_action('comments_atom_head', 'the_generator');
remove_action('opml_head', 'the_generator');
remove_action('app_head', 'the_generator');
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wp_generator');
import re
def valid_nick(nick):
# We have to start with A-}
if not re.match('^[\101-\173]', nick):
return False
# We can only contain A-}, 0-9 and -
if not re.match('^[\101-\1730-9\-]+$', nick):
return False
ALTER TABLE reports ADD FOREIGN KEY (revertid) REFERENCES vandalism(id) on delete CASCADE
from django.db import models
class DeviceA(object):
def do_something(self, string='Hello'):
print "Device A something '%s'" % string
def do_something_else(self):
print "Device A something else"
@DamianZaremba
DamianZaremba / switches2graphite.py
Created February 3, 2013 17:43
Badly written POC for snmpish switches -> graphite graphing
#!/usr/bin/env python
import time
import re
import socket
from pysnmp.entity.rfc3413.oneliner import cmdgen
cmdGen = cmdgen.CommandGenerator()
CARBON_IP = '10.44.206.51'
CARBON_PORT = 2030
@DamianZaremba
DamianZaremba / gist:4745805
Created February 9, 2013 15:55
Epic traceroute
traceroute to 216.81.59.173 (216.81.59.173), 64 hops max, 52 byte packets
1 10.44.200.254 (10.44.200.254) 5.057 ms 3.215 ms 4.460 ms
2 host-2-97-96-1.as13285.net (2.97.96.1) 95.907 ms 31.328 ms 30.944 ms
3 host-78-151-225-101.static.as13285.net (78.151.225.101) 32.417 ms 32.150 ms 32.657 ms
4 host-78-151-225-26.static.as13285.net (78.151.225.26) 33.414 ms
host-78-151-225-108.static.as13285.net (78.151.225.108) 32.723 ms
host-78-151-225-26.static.as13285.net (78.151.225.26) 33.472 ms
5 xe-11-1-0-rt001.the.as13285.net (62.24.240.6) 38.430 ms 39.111 ms
xe-11-1-0-rt001.sov.as13285.net (62.24.240.14) 39.522 ms
6 host-78-144-1-61.as13285.net (78.144.1.61) 38.020 ms