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
def elementwise(fn): | |
def newfn(arg): | |
if hasattr(arg,'__getitem__'): # is a Sequence | |
return type(arg)(map(fn, arg)) | |
else: | |
return fn(arg) | |
return newfn | |
@elementwise | |
def compute(x): |
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
# install custom sqlite 3.14 | |
wget https://github.com/ghaering/pysqlite/archive/2.8.3.tar.gz | |
wget https://www.sqlite.org/2016/sqlite-autoconf-3140100.tar.gz | |
tar -xzvf sqlite-autoconf-3140100.tar.gz | |
tar -xzvf 2.8.3.tar.gz | |
cp -av sqlite-autoconf-3140100/. pysqlite-2.8.3/ | |
cd ./pysqlite-2.8.3 && python setup.py build_static install |
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
def get_open_port(): | |
import socket | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.bind(("",0)) | |
s.listen(1) | |
port = s.getsockname()[1] | |
s.close() | |
return port |
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/env python | |
# -*- coding: utf-8 -*- | |
import curses, traceback, string | |
#-- Define the appearance of some interface elements | |
hotkey_attr = curses.A_BOLD | curses.A_UNDERLINE | |
menu_attr = curses.A_NORMAL | |
#-- Define additional constants |
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
# copied from https://github.com/django-guardian/django-guardian/blob/devel/benchmarks/run_benchmarks.py | |
#!/usr/bin/env python | |
""" | |
This benchmark package should be treated as work-in-progress, not a production | |
ready benchmarking solution for django-guardian. | |
""" | |
import datetime | |
import os | |
import random |
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
scriptencoding utf-8 | |
" ============================================================================ | |
" Author: TaoBeier | |
" Blog: http://moelove.info | |
" Version: v1.1.0 | |
" Update Time: 2016-09-25 | |
" ============================================================================ | |
" Vundle initialization | |
" Avoid modify this section, unless you are very sure of what you are doing |
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
doo | |
add code.cloudist.cc to hosts to speedup download. | |
set deploy key. | |
clone seed-ERP | |
export USER=root | |
python setup_dev setup_deps | |
sudo -i -u postgres |
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
snippet xml | |
<?xml version="1.0" encoding="UTF-8"?> | |
# tag | |
snippet t | |
<${1:}${2}> | |
</$1> | |
# inline tag | |
snippet ti |
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 | |
#this script used monitor mysql network traffic.echo sql | |
tcpdump -i eth1 -s 0 -l -w - dst port 3306 | strings | perl -e ' | |
while(<>) { chomp; next if /^[^ ]+[ ]*$/; | |
if(/^(SELECT|UPDATE|DELETE|INSERT|SET|COMMIT|ROLLBACK|CREATE|DROP|ALTER|CALL)/i) | |
{ | |
if (defined $q) { print "$q\n"; } | |
$q=$_; | |
} else { | |
$_ =~ s/^[ \t]+//; $q.=" $_"; |
OlderNewer