Skip to content

Instantly share code, notes, and snippets.

@mdeous
mdeous / gist:919262
Created April 14, 2011 10:56
strange google.com whois results
-> % whois google.com | grep "Server Name" | awk '{print $3}'
GOOGLE.COM.ZZZZZZZZZZZZZ.GET.ONE.MILLION.DOLLARS.AT.WWW.UNIMUNDI.COM
GOOGLE.COM.ZZZZZZ.THE.BEST.WEBHOSTING.AT.WWW.FATUCH.COM
GOOGLE.COM.ZZZZZ.GET.LAID.AT.WWW.SWINGINGCOMMUNITY.COM
GOOGLE.COM.ZOMBIED.AND.HACKED.BY.WWW.WEB-HACK.COM
GOOGLE.COM.ZNAET.PRODOMEN.COM
GOOGLE.COM.YUCEKIRBAC.COM
GOOGLE.COM.YUCEHOCA.COM
GOOGLE.COM.WORDT.DOOR.VEEL.WHTERS.GEBRUIKT.SERVERTJE.NET
GOOGLE.COM.VN
-> % whois microsoft.com | grep "Server Name" | awk '{print $3}'
MICROSOFT.COM.ZZZZZZZZZZZZZZZZZZ.THE.BEST.WEBHOSTING.AT.WWW.FATUCH.COM
MICROSOFT.COM.ZZZZZZZZZZZZZZZZZZ.IM.ELITE.WANNABE.TOO.WWW.PLUS613.NET
MICROSOFT.COM.ZZZZZZZZZZZZZZZZZZ.GET.ONE.MILLION.DOLLARS.AT.WWW.UNIMUNDI.COM
MICROSOFT.COM.ZZZZZZ.MORE.DETAILS.AT.WWW.BEYONDWHOIS.COM
MICROSOFT.COM.ZZZZZ.GET.LAID.AT.WWW.SWINGINGCOMMUNITY.COM
MICROSOFT.COM.ZZZOMBIED.AND.HACKED.BY.WWW.WEB-HACK.COM
MICROSOFT.COM.ZZZ.IS.0WNED.AND.HAX0RED.BY.SUB7.NET
MICROSOFT.COM.WILL.BE.SLAPPED.IN.THE.FACE.BY.MY.BLUE.VEINED.SPANNER.NET
MICROSOFT.COM.WILL.BE.BEATEN.WITH.MY.SPANNER.NET
@mdeous
mdeous / gist:930946
Created April 20, 2011 10:27
edit file in-place
import fileinput
import re
import sys
f = fileinput.input(['/foo/bar/vhost.conf'], inplace=True)
for line in f:
line = re.sub('DocumentRoot (.*)', 'DocumentRoot /root', line)
sys.stdout.write(line)
f.close()
public class TutoClass {
public static void main(String[] args) {
System.out.println();
}
}
@mdeous
mdeous / gist:1004527
Created June 2, 2011 14:15
scoopy usage sample
import os
import webbrowser
token_file = 'token.pickle' # optional
api = ScoopItAPI(
'consumer key',
'consumer secret'
)
@mdeous
mdeous / threaded_downloader.py
Created July 17, 2011 14:52
multithreaded file download
# -*- coding: utf-8 -*-
import os
from Queue import Queue
from threading import Thread
class FileDownloader(Thread):
"""Threaded file downloader."""
def __init__(self, infos_tuple):
@mdeous
mdeous / gist:1222548
Created September 16, 2011 17:00
mixin for auto populating columns in sqlalchemy models
class AutoInitModelMixin(object):
"""
Mixin for populating models' columns automatically (no need to
define an __init__ method) and set the default value if any.
Also sets the model's id and __tablename__ automatically.
"""
id = db.Column(db.Integer, primary_key=True)
# use the lowercased class name as the __tablename__
@declared_attr
@mdeous
mdeous / gist:1223737
Created September 17, 2011 07:53
My .vimrc
""""""""""""""""""""""""""""""
" VIM CONFIGURATION FILE "
""""""""""""""""""""""""""""""
" pathogen plugin
filetype off
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
" basic settings
@mdeous
mdeous / gist:1555294
Created January 3, 2012 15:14
colored logging formatter
class ColorFormatter(logging.Formatter):
_colors_map = {
'DEBUG': '\033[22;32m',
'INFO': '\033[01;34m',
'WARNING': '\033[22;35m',
'ERROR': '\033[22;31m',
'CRITICAL': '\033[01;31m'
}
def format(self, record):
@mdeous
mdeous / gist:1624238
Created January 17, 2012 02:45
kill all matching processes
killthem () {
for PID in `ps aux | grep -v grep | grep $1 | awk '{print $2}'`
do
(
kill -9 $PID &> /dev/null && echo "Killed $PID"
) || echo "Failed to kill $PID"
done
}