Skip to content

Instantly share code, notes, and snippets.

View thulio's full-sized avatar

Thúlio Costa thulio

View GitHub Profile
@thulio
thulio / pip_update_all.sh
Created August 11, 2011 16:51
Update all python packages installed with pip
pip freeze -l | cut -d'=' -f 1 | xargs pip install -U
@thulio
thulio / gcccpuopt.sh
Created July 24, 2012 12:21
Get GCC optimal compile flags
#!/bin/sh
# Print the gcc cpu specific options tailored for the current CPU
# Author:
# http://www.pixelbeat.org/
# Notes:
# This script currently supports Linux,FreeBSD,Cygwin
# This script is x86 (32 bit) specific
# It should work on any gcc >= 2.95 at least
@thulio
thulio / mocktrue.py
Created August 7, 2012 03:05 — forked from daltonmatos/mocktrue.py
Hack to mock the python True object
class True(object):
def __init__(self, iterations=1):
self.iterations = iterations
self.current_iteration = 0
def __nonzero__(self):
if self.current_iteration < self.iterations:
self.current_iteration += 1
return 1
@thulio
thulio / splinter_reject.py
Created June 24, 2013 20:04
Splinter user-agent getting rejected
import requests
url = "http://guitarshop.com.br/prod,idloja,5372,idproduto,3575917,cordas-amp-guitarra-g5--15w-c--drive"
headers = {"User-Agent": "python/urllib"}
r = requests.get(url, headers=headers)
print(r.status_code)
headers = {"User-Agent": "python/splinter"}
r = requests.get(url, headers=headers)
print(r.status_code)
headers = {"User-Agent": "splinter"}
r = requests.get(url, headers=headers)
@thulio
thulio / zombiefox.py
Last active December 20, 2015 09:29
Processo zumbi do Firefox/PhantomJS
#!/usr/bin/env ipython
import splinter
import subprocess
b = splinter.browser.Browser()
subprocess.Popen(["pkill", "-f", "ipython"])
@thulio
thulio / i3-exit
Last active December 20, 2015 23:59 — forked from jcyamo/i3-exit
#!/usr/bin/env python
# based on cb-exit used in CrunchBang Linux <http://crunchbanglinux.org/>
import pygtk
pygtk.require('2.0')
import gtk
import os
import getpass
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
// @KarlHillesland, @rexguo, @tom_forsyth, @bkaradzic, @MikeNicolella
// and myself.
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'

Keybase proof

I hereby claim:

  • I am thulio on github.
  • I am thulio (https://keybase.io/thulio) on keybase.
  • I have a public key ASDYU5eDNu7isT4Ei_3Pv-Elpmfa1veXhkmCrLXAyo_vIQo

To claim this, I am signing this object:

@thulio
thulio / README-Template.md
Created March 29, 2017 01:25 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites