Skip to content

Instantly share code, notes, and snippets.

View ivanrvpereira's full-sized avatar

Ivan Pereira ivanrvpereira

  • Promptly Health Analytics
  • Portugal
View GitHub Profile

Writing better python code


Swapping variables

Bad code

#!/usr/bin/env python
"""
A pure Python "ping" implementation, based on a rewrite by Johannes Meyer,
of a script originally by Matthew Dixon Cowles. Which in turn was derived
from "ping.c", distributed in Linux's netkit. The version this was forked
out of can be found here: https://gist.github.com/pklaus/856268
The versions this script derived from are licensed under GPL v2, this makes
mandatory that this is licensed under the same terms as well. If it were up
from base64 import b64encode
from suds.wsse import UsernameToken
try:
from haslib import sha1
except:
from sha import new as sha1
1.CentOS 6.3
#yum install make gcc
#cd /opt
$wget http://redis.googlecode.com/files/redis-2.x.xx.tar.gz
$tar zxf redis-2.x.xx.tar.gz
$cd redis-2.x.xx
$make
$make install
//////
@ivanrvpereira
ivanrvpereira / my.cnf
Created June 8, 2013 17:45 — forked from hacfi/my.cnf
My my.cnf of percona server on a Macbook Pro 8GB RAM
[mysql]
port = 3306
socket = /usr/local/var/run/mysql.sock
[mysqld]
#user = mysql
default_storage_engine = InnoDB
socket = /usr/local/var/run/mysql.sock
pid_file = /usr/local/var/run/mysql.pid
echo $(date +"%d.%b %H:%M:%S") empty cache directory, so we have optimal importperformance.
rm -rf /path/to/magento/var/cache/
@ivanrvpereira
ivanrvpereira / gist:2626719
Created May 7, 2012 08:45 — forked from gf3/gist:328089
iTerm Colours
Black: 0, 0, 0
Red: 229, 34, 34
Green: 166, 227, 45
Yellow: 252, 149, 30
Blue: 196, 141, 255
Magenta: 250, 37, 115
Cyan: 103, 217, 240
White: 242, 242, 242