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
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" | |
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
ALTER TABLE reports ADD FOREIGN KEY (revertid) REFERENCES vandalism(id) on delete CASCADE |
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
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 |
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
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'); |
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 | |
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: |
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
Facter.add(:mysql_version) do | |
setcode do | |
Facter::Util::Resolution.exec('mysql --version').chomp.split(' ')[4].gsub(',', '') | |
end | |
end |
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 | |
# 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 = ( |
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
cd /usr/src/ | |
wget http://c758482.r82.cf2.rackcdn.com/sublime-text_build-3047_i386.deb | |
dpkg -i sublime-text_build-3047_i386.deb |
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 python | |
import os | |
import sys | |
import requests | |
from BeautifulSoup import BeautifulSoup | |
try: | |
file_path = sys.argv[1] | |
except: | |
print "Usage: %s <file path>" % sys.argv[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
%define with_gtk2 %{?_with_gtk2: 1} %{!?_with_gtk2: 0} | |
%bcond_with ocf | |
# it seems there is no usable tcmalloc rpm for x86_64; parts of | |
# google-perftools don't compile on x86_64, and apparently the | |
# decision was to not build the package at all, even if tcmalloc | |
# itself would have worked just fine. | |
%bcond_with tcmalloc | |
%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5) |