Skip to content

Instantly share code, notes, and snippets.

View paulocheque's full-sized avatar

Paulo Cheque paulocheque

View GitHub Profile
@paulocheque
paulocheque / .bash_profile
Last active September 30, 2023 17:26
.bash_profile example
# EDITOR=nano sudo visudo
# Change the following line: (:i to insert + esc to go back + :w to save + :q to quit)
# Defaults env_reset
# to:
# Defaults env_reset,timestamp_timeout=960 # in minutes
export PATH=$PATH:.
# export PATH=$PATH:/usr/bin
@paulocheque
paulocheque / Default (OSX).sublime-keymap
Last active December 14, 2015 08:49
Sublime config files
[
{ "keys": ["super+alt+q"], "command": "wrap_lines" },
{ "keys": ["super+x"], "command": "cut" },
{ "keys": ["super+d"], "command": "cut" },
{ "keys": ["super+shift+d"], "command": "duplicate_line" },
{ "keys": ["alt+up"], "command": "swap_line_up" },
{ "keys": ["alt+down"], "command": "swap_line_down" },
@paulocheque
paulocheque / BaseRakefile.rake
Last active December 14, 2015 16:09
Rake scripts
# You may put this on the rakelib directory or renamed it to .rb and add a 'require' command
MAIN_PATH = File.dirname(__FILE__)
module OS
def OS.windows?
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
end
def OS.mac?
@paulocheque
paulocheque / benchmarks.sh
Last active December 15, 2015 14:18
Benchmarks
# ab -n 2000 -c 200 https://url/
install_dependencies() {
brew install freetype
brew install libpng
brew install libevent
virtualenv venv --no-site-packages
source venv/bin/activate
pip install numpy
pip install matplotlib
@paulocheque
paulocheque / _localhost.json
Last active December 19, 2015 05:49
Fabric script
{
"python": "pypy",
"url": "http://localhost:8000",
"host": "localhost",
"port": 8000,
"heroku_app": null,
"heroku_app_addons": [],
"heroku_worker": null,
"heroku_worker_addons": [],
"heroku_cedar": null,
@paulocheque
paulocheque / file_manager.py
Last active December 21, 2015 02:09
Python dealing with files
# -*- coding: utf-8 -*-
import os
import tempfile
from shutil import rmtree, copy2
TEMP_PATH = tempfile.gettempdir() or os.environ.get('TEMP')
@paulocheque
paulocheque / ryanair.py
Last active August 29, 2015 13:57
Ryanair
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
img = Image.open("/Users/paulocheque/Desktop/flag-brazil.jpg")
draw = ImageDraw.Draw(img)
#font = ImageFont.truetype("sans-serif.ttf", 16)
#font = ImageFont.load("arial.pil")
font = ImageFont.truetype("arial.ttf", 15)
draw.text((0, 0),"Sample Text",(255,255,255),font=font)
img.save('flag-brazil-2.jpg')
@paulocheque
paulocheque / redis.md
Last active August 29, 2015 14:04
Redis
@paulocheque
paulocheque / ssh
Last active August 29, 2015 14:04
Amazon
mv file.pem ~/.ssh/
chmod 400 ~/.ssh/file.pem
ssh -v -i ~/.ssh/file.pem ubuntu@ip
scp -i ~/.ssh/file.pem file ubuntu@ip:~
scp -i ~/.ssh/file.pem ubuntu@ip:~/file .
http --follow POST url attr=value attr2=value2 --print=h
http GET url --print=h
@paulocheque
paulocheque / benchmark.py
Last active August 29, 2015 14:05
benchmarks
import json
import re
import timeit
import ujson
import simplejson
# from memory_profiler import profile
# @profile(precision=4)