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
function removeItem(item, lista) { | |
lista = jQuery.grep(lista, function(value) { | |
return value != item; | |
}); | |
return lista; | |
} |
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
<?php | |
/* | |
* Original: https://gist.github.com/devmatheus/38cd250c3bb46f0ad2c8 | |
* | |
* Changes: | |
* - It is not necessary define page on __construct | |
* - Set layout for embed template | |
* | |
* Problem: |
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
# Added on http://www.rafaelhdr.com.br/blog/python/pegar-cep-do-site-dos-correios-em-python at 25/10/2014 | |
# | |
# This is a simple function to get data at brazilian correios | |
# It searches at http://www.buscacep.correios.com.br/ and return as a dict the | |
# information retrieved. | |
# | |
# Before use it, you need install the following libs: | |
# pip install beautifulsoup4 | |
# pip install requests |
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
var fs = require('fs'); | |
var outputArray = []; | |
var content = fs.readFileSync('map.txt').toString('utf8'); | |
var lines = content.split('\n'); | |
lines.forEach(function(line){ | |
var cells = line.split(' '); | |
var newArray = []; | |
cells.forEach(function(cell){ | |
newArray.push(parseInt(cell)); |
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 time import gmtime, strftime | |
import urllib2 | |
import hmac | |
import hashlib | |
import base64 | |
""" | |
Code to generate signed URL for Amazon Associate | |
I hope it is simple to understand |
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
# Install pip on Ubuntu | |
# Source: http://www.saltycrane.com/blog/2010/02/how-install-pip-ubuntu/ | |
sudo apt-get install python-pip python-dev build-essential | |
sudo pip install --upgrade pip | |
sudo pip install --upgrade virtualenv |
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
# Install Cassandra on Ubuntu | |
# Source: https://www.digitalocean.com/community/tutorials/how-to-install-cassandra-and-run-a-single-node-cluster-on-ubuntu-14-04 | |
sudo add-apt-repository ppa:webupd8team/java | |
sudo apt-get update | |
sudo apt-get install oracle-java8-set-default | |
echo "deb http://www.apache.org/dist/cassandra/debian 22x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list | |
echo "deb-src http://www.apache.org/dist/cassandra/debian 22x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list | |
gpg --keyserver pgp.mit.edu --recv-keys F758CE318D77295D |
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
import urllib2 | |
link = "http://example.com" | |
r = urllib2.Request(url=link) | |
# r.add_header('Cookie', 'sessionid=13cxrt4uytfc6ijvgeoflmb3u9jmjuhil; csrftoken=jdEKPN8iL62hdaq1hmMuID9DMALiiDIq') | |
r.add_header('Upgrade-Insecure-Requests', '1') | |
r.add_header('Accept-Encoding', 'gzip, deflate, sdch, br') | |
r.add_header('User-Agent', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36') | |
r.add_header('Connection', 'keep-alive') | |
r.add_header('Cache-Control', 'max-age=0') |
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
# Reason for choosing cherrypy | |
# https://blog.appdynamics.com/engineering/a-performance-analysis-of-python-wsgi-servers-part-2/ | |
# | |
# Flask application based on Quickstart | |
# http://flask.pocoo.org/docs/0.12/quickstart/ | |
# | |
# CherryPy documentation for this | |
# http://docs.cherrypy.org/en/latest/deploy.html#wsgi-servers | |
# http://docs.cherrypy.org/en/latest/advanced.html#host-a-foreign-wsgi-application-in-cherrypy | |
# Install: pip install cherrypy |
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/sh | |
# | |
# Command examples: | |
# time ./write.sh | |
# time ./write.sh 1000 | |
# | |
# This will print time taken (default test, max=100000) | |
# real 0m1.258s | |
# user 0m0.816s | |
# sys 0m0.438s |
OlderNewer