Skip to content

Instantly share code, notes, and snippets.

View letenkov's full-sized avatar
😀
Focusing

Eugene Letenkov letenkov

😀
Focusing
View GitHub Profile
mysqldump --user=root --default-character-set=latin1 -c --insert-ignore --skip-set-charset <dbname> <table-name> > <filename>.sql &&
iconv -f ISO-8859-1 -t UTF-8 <filename>.sql > <filename>.utf8.sql &&
perl -pi -w -e 's/CHARSET=latin1/CHARSET=utf8/g;' <filename>.sql.utf8.sql &&
mysql --user=root --max_allowed_packet=16M --default-character-set=utf8 <dbname> < <filename>.utf8.sql
#!/bin/bash
perl -ne 'm/^([^#][^\s=]+)\s*(=.*|)/ && printf("%-35s%s\n", $1, $2)' /etc/mysql/my.cnf
settings = {'debug': True}
handlers = [(r"/", MainHandler)]
tornado.web.Application.__init__(self, handlers, **settings)
@rcmachado
rcmachado / send_sms_action.py
Created November 26, 2010 16:56
Custom action
from pyccuracy.actions import ActionBase
class SendSMSAction(ActionBase):
regex = r'^(And )?I send a SMS to [\"](?P<short_number>\d+)[\"] with [\"](?P<message>.+)[\"] as [\"](?P<msisdn>\d+)[\"]$'
def execute(self, context, short_number, message, msisdn):
url = "http://myserver/dispatcher.php?MESSAGE=" + message + "&SENDERID=" + msisdn + "&PHONEID=" + short_number
self.execute_action(u"I go to \"{0}\"".format(url), context)
@lxneng
lxneng / gist:741932
Created December 15, 2010 13:21
install PostgreSQL 9 in Mac OSX via Homebrew
install PostgreSQL 9 in Mac OSX via Homebrew
Mac OS X Snow Leopard
System Version: Mac OS X 10.6.5
Kernel Version: Darwin 10.5.0
Install notes for PostgreSQL 9.0.1 install using Homebrew:
sh-3.2# brew install postgresql
@didip
didip / supervisord-example.conf
Created January 30, 2011 05:10
Example configuration file for supervisord.conf
[unix_http_server]
file=/tmp/supervisor.sock ; path to your socket file
[supervisord]
logfile=/var/log/supervisord/supervisord.log ; supervisord log file
logfile_maxbytes=50MB ; maximum size of logfile before rotation
logfile_backups=10 ; number of backed up logfiles
loglevel=error ; info, debug, warn, trace
pidfile=/var/run/supervisord.pid ; pidfile location
nodaemon=false ; run supervisord as a daemon
@didip
didip / tornado-nginx-example.conf
Created January 30, 2011 05:19
Nginx config example for Tornado
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
@didip
didip / tornado_cookie_secret_generator.py
Created February 12, 2011 17:20
Generates secure cookie secret for Tornado Web Framework
@valotas
valotas / tomcat.sh
Created May 31, 2011 07:11
Tomcat init.d script
#!/bin/bash
#
# tomcat7 This shell script takes care of starting and stopping Tomcat
#
# chkconfig: - 80 20
#
### BEGIN INIT INFO
# Provides: tomcat7
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
@diogobaeder
diogobaeder / tornado-zmq.py
Created July 11, 2011 06:24
Little dumb experiment with Tornado and 0MQ
# This was a little experiment I've put together in some minutes while in TDC2011 (The Developers Conference), at São Paulo
# It's just a silly almost-Hello-World, just to show the assynchronous communication working with non-blocking I/O through event loops, mixed with a simple HTTP server
# First, put this on a file called 'server.py', and run:
#$ ./server.py 8001 &
#$ ./server.py 8002 &
#$ ./server.py 8003 &
#!/usr/bin/env python