This file contains 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 cloudfiles | |
import sys | |
conn = cloudfiles.get_connection( | |
'username', | |
'apikey', | |
authurl=cloudfiles.uk_authurl | |
) | |
container = conn.get_container(sys.argv[1]) | |
marker = None | |
limit = 5000 |
This file contains 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 cloudfiles | |
import sys | |
conn = cloudfiles.get_connection( | |
'username', | |
'apikey', | |
authurl=cloudfiles.uk_authurl | |
) | |
container = conn.create_container(sys.argv[1]) | |
for obj in sys.argv[2:]: | |
print 'delete_object', obj |
This file contains 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 sys | |
haystack = open(sys.argv[1]) | |
needles = open(sys.argv[2]) | |
needle = needles.readline()[:-1] | |
counter = 0 | |
while 1: | |
hay = haystack.readline()[:-1] | |
if not hay: break | |
if hay == needle: | |
needle = needles.readline()[:-1] |
This file contains 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 dbus | |
bus = dbus.SystemBus() | |
wpas_obj = bus.get_object("fi.w1.wpa_supplicant1", | |
"/fi/w1/wpa_supplicant1") | |
wpas = dbus.Interface(wpas_obj, "fi.w1.wpa_supplicant1") | |
path = wpas.CreateInterface({'Ifname':"wlan0"}) | |
if_obj = bus.get_object("fi.w1.wpa_supplicant1", path) | |
path = if_obj.AddNetwork({ |
This file contains 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
<?php | |
// create table error_log(lastseen varchar(50), message text, count integer, unique (message), unique (lastseen,message)); | |
$month_translation = array("Jan" => 1, "Feb" => 2, "Mar" => 3, "Apr" => 4, "May" => 5, "Jun" => 6, "Jul" => 7, "Aug" => 8, "Sep" => 9, "Oct" => 10, "Nov" => 11, "Dec" => 12); | |
$error_log_format = "/\[(?<weekday>Mon|Tue|Wed|Thu|Fri|Sat|Sun) ". | |
"(?<month>Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ". | |
"(?<monthday>\d\d) ". | |
"(?<hour>\d\d):". | |
"(?<minutes>\d\d):". | |
"(?<seconds>\d\d).". | |
"(?<milliseconds>\d+) ". |
This file contains 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
rpm -qa --queryformat '%{NAME} [--whatprovides %{REQUIRES} ]\n'|while read NAME REQUIRES ; do rpm -q --queryformat '%{NAME}\n' $REQUIRES|grep -v 'no package provides'|sed "s/\(.*\)/\"$NAME\" -> \"\1\"/" ; done|sort -u > /tmp/deps.dot |
This file contains 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 icalendar import Calendar | |
from icalendar.cal import Event | |
import datetime | |
import urllib2 | |
import csv | |
import sys | |
for url, label in ( | |
( | |
urllib2.urlopen('https://www.google.com/calendar/ical/11111111111111111111111111%40group.calendar.google.com/private-11111111111111111111111111111111/basic.ics'), |
This file contains 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
#!/bin/bash | |
echo export DISPLAY=$DISPLAY | |
echo export XAUTHORITY=$(grep ^$1: /etc/passwd|cut -d: -f6|head -n1)/.Xauthority | |
echo xauth add $(xauth list|grep ^$(uname -n)) | |
sudo -i -u ${1} |
This file contains 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
#!/bin/bash | |
function inet_aton () { | |
local count=3 | |
local int=0 | |
for num in $(echo $1 | sed -e 's/\./ /g'); do | |
let "int+=$num*256**$count" | |
let "count-=1" | |
done | |
echo $int | |
} |
This file contains 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
#!/bin/bash | |
PACKAGES="" | |
LEAVES="$(package-cleanup --leaves --all --qf='%{NAME}')" | |
ERASE=$(grep -vxf <(echo "$PACKAGES") <(echo "$LEAVES")) | |
if [ "$ERASE" ]; then | |
yum erase $ERASE | |
else | |
diff -udr <(echo "$LEAVES") <(echo "$PACKAGES") | |
fi |
OlderNewer