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 time | |
class singleprocess: | |
def __init__(self, pidfile): | |
self.pidfile = pidfile | |
def __enter__(self): | |
pid = str(os.getpid()) | |
if os.path.isfile(self.pidfile+'.0'): | |
self.realpidfile = self.pidfile+'.1' | |
if os.path.isfile(self.pidfile+'.1'): | |
raise Exception("%s already exists, exiting" % self.realpidfile) |
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
insert into pivot | |
select distinct NULL, `@from`.`@tagname`, '@from-@contents', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL from `@from` | |
left join pivot on `pivot`.`tagname` = `@from`.`@tagname` and '@from-@contents' = `pivot`.`category` | |
where `pivot`.`tagname` is null; | |
update `pivot` | |
inner join `@from` on `pivot`.`tagname` = `@from`.`@tagname` and '@from-@contents' = `pivot`.`category` | |
set `pivot`.`@site` = `@contents`; |
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
#!/usr/bin/python | |
import fileinput | |
import sys | |
import re | |
pattern = sys.argv.pop(1) | |
for line in fileinput.input(): | |
m = re.search(pattern, line) | |
if m: | |
for g in m.groups(): print g |
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 threading | |
from StringIO import StringIO | |
runcmdLock = threading.Lock() | |
def runcmd(keyf, username, send): | |
runcmdLock.acquire(True) | |
while 1: | |
if not (keyf, username) in default_app().chan: | |
key = RSAKey.from_private_key(file_obj=StringIO(keyf)) | |
client = SSHClient() |
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 tailer | |
import time | |
import datetime | |
import re | |
dt = datetime.timedelta(0, 1) | |
with file('/var/log/httpd/error_log') as error_log: | |
with file('/var/log/httpd/access_log') as access_log: | |
tailer_error_log = tailer.follow(error_log, 0) | |
tailer_access_log = tailer.follow(access_log, 0) | |
error_log_queue = [] |
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
mysql --skip-column-names -Be "SELECT TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA = '$DATABASE' AND engine = 'MyISAM';"|while read TABLE ; do echo "alter table $TABLE ENGINE=InnoDB; " ; done |
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 hashlib | |
import sys | |
import os | |
import pexpect | |
import re | |
class SMBClient(): | |
def __init__(self, host, share, username, password): | |
self.p = pexpect.spawn('smbclient //%s/%s -U "%s%%%s"' % (host, share, username, password)) | |
self.cmd() |
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 re | |
import fileinput | |
i = 0 | |
output = {} | |
def repl(m): | |
global i | |
global output | |
i += 1 | |
output[i] = m.group(2) |
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
$conn = $entityManager->getConnection(); | |
$conn->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); |
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
<html> | |
<head> | |
<link href="http://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.3/css/base/jquery.ui.all.css" rel="stylesheet"> | |
<link href="http://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.2/css/lightness/jquery-ui-1.10.2.custom.min.css" rel="stylesheet"> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.2/jquery.ui.touch-punch.min.js"></script> | |
<script src="http://localhost:8080/mplayer"></script> | |
<script> | |
$(function () { |