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
SELECT concat( table_schema, '.', table_name ) table_name, | |
concat( round( data_length / ( 1024 *1024 ) , 2 ) , 'M' ) data_length, | |
concat( round( index_length / ( 1024 *1024 ) , 2 ) , 'M' ) index_length, | |
concat( round( round( data_length + index_length ) / ( 1024 *1024 ) , 2 ) , 'M' ) total_size, | |
table_rows, | |
engine | |
FROM information_schema.TABLES | |
WHERE TABLE_SCHEMA = 'coolshit_dev' | |
ORDER BY data_length DESC; |
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
# Requirements: | |
# - python-lxml | |
# - pyquery | |
# | |
# As implemented in http://mybucket.co | |
# html_util.py | |
from pyquery import PyQuery as pq | |
def extract_delicious_data_from_html(html): | |
results = [] |
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
settings = {'debug': True} | |
handlers = [(r"/", MainHandler)] | |
tornado.web.Application.__init__(self, handlers, **settings) |
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
==> Build Environment | |
CC: /usr/bin/cc => /usr/bin/gcc-4.2 | |
CXX: /usr/bin/c++ => /usr/bin/c++-4.2 | |
LD: /usr/bin/cc => /usr/bin/gcc-4.2 | |
CFLAGS: -O3 -w -pipe | |
CXXFLAGS: -O3 -w -pipe | |
CPPFLAGS: -I/usr/local/Cellar/readline/6.1/include | |
LDFLAGS: -L/usr/local/Cellar/readline/6.1/lib | |
MAKEFLAGS: -j4 | |
PKG_CONFIG_PATH: /usr/local/Cellar/readline/6.1/lib/pkgconfig |
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
c = pycurl.Curl() | |
c.setopt(pycurl.URL, "http://example.com/post") | |
c.setopt(pycurl.POST, 1) | |
c.setopt(pycurl.POSTFIELDS, | |
urllib.urlencode({ | |
'some_data': 'the data', | |
'some_more_data': 'more data', | |
}) | |
) | |
c.perform() |
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
# -------------------------------------------------- | |
# app.py - nothing special here | |
# -------------------------------------------------- | |
import tornado.httpserver | |
import tornado.ioloop | |
import tornado.web | |
class Application(tornado.web.Application): | |
def __init__(self): | |
pass |
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 is recipe for OS X only | |
# A wise man once said; When shit fails, use strace(Linux) or dtruss(OS X) | |
# Installing MySQL gem | |
export ARCHFLAGS="-arch i386 -arch x86_64" ; gem install --no-rdoc --no-ri mysql -- --with-mysql-dir=/usr/local/mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config | |
# Create symlink | |
# If that symlink does not work, use strace to figure out where MySQL gem is looking for it. |
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 paste.deploy import appconfig | |
from tornado.wsgi import WSGIContainer | |
from tornado.httpserver import HTTPServer | |
from tornado.ioloop import IOLoop | |
from your_app.config.middleware import make_app | |
port = 5000 | |
config = appconfig("config:%s" % "/your/app/development.ini") | |
app = make_app(config.global_conf, **config.local_conf) |
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
httperf --hog --server 10.1.10.118 --port 8080 --num-conn 10000 --ra 100 --num-calls=100 --timeout .01 |
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 | |
DUMPFILE=/tmp/dump.`date +%Y.%m.%d`.sql | |
echo Dumping > $DUMPFILE | |
mysqldump dump > $DUMPFILE | |
echo Finished dumping >> $DUMPFILE |