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
//http://gdata.youtube.com/feeds/mobile/videos/?category=Music&alt=json-in-script&callback=?&orderby=relevance&start-index=" + inicio + "&max-results=" + num_resultados + "&q= | |
//Gdata para mobile | |
for (var i = 0; i < entries.length; i++) { | |
var entry = entries[i]; | |
var embed = true; | |
for (a in entry.yt$accessControl) { | |
if (entry.yt$accessControl[a].action == 'embed' && entry.yt$accessControl[a].permission == 'denied') | |
embed = false; | |
} |
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
Fonte: http://gohorseprocess.wordpress.com | |
1- Pensou, não é XGH. | |
XGH não pensa, faz a primeira coisa que vem à mente. Não existe | |
segunda opção, a única opção é a mais rápida. | |
2- Existem 3 formas de se resolver um problema, a correta, a errada e | |
a XGH, que é igual à errada, só que mais rápida. |
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
>>> x = ((1,),(2,),(3,)) | |
>>> list(zip(*x)[0]) | |
[1, 2, 3] | |
>>> 1 in list(zip(*x)[0]) | |
True | |
>>> | |
by @cicerocomp | |
>>> s = ((1,), (2,), (3,)) |
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
list = list(lista1) + list(lista2) | |
list.sort(key=lambda x: x.atributo) #funcao anonima |
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
alfabeto = "zyxwvutsrqpomnlkjihgfedcba" | |
s = ['asdf', 'werwer', 'asgfd','wesasd','yasdfas','zsadf'] | |
print sorted(s, key=lambda w: [alfabeto.index(i) for i in w]) |
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
#Se o erro for algo parecido com isto: | |
#building 'lxml.etree' extension | |
#gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w | |
#In file included from src/lxml/lxml.etree.c:239:0: | |
#src/lxml/etree_defs.h:9:31: erro fatal: libxml/xmlversion.h: Arquivo ou diretório não encontrado | |
#compilação terminada. | |
#error: command 'gcc' failed with exit status 1 | |
#basta instalar libxml2-dev e libxslt-dev |
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
# Lint JSON with python (the exit 255 stops xargs after the first failed command) | |
find . -name "*.json" -print | xargs -Ixx bash -c "echo JSON linting xx 1>&2; cat xx | python -mjson.tool > /dev/null || exit 255" |
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
awk '{ if (/Tcp:.[0-9]/ == 1) {print "actives: " $10 } }' /proc/net/snmp |
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/bash | |
for elm in $@; do | |
database=$(echo $elm | cut -f1 -d '.') | |
tables=$(echo $elm | cut -f2 -d '.') | |
if [ $tables == "{*}" ]; then | |
tables=$(mysql -uroot -e "SHOW TABLES FROM $database") | |
tables=$(echo $tables | sed s",^Tables_in_$database,,") | |
fi |
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 -e | |
echo "1024" > /proc/sys/net/core/somaxconn | |
echo "1" > /proc/sys/net/ipv4/tcp_syncookies | |
echo "4096 87380 16777216" > /proc/sys/net/ipv4/tcp_rmem | |
echo "4096 65536 16777216" > /proc/sys/net/ipv4/tcp_wmem | |
echo "0" > /proc/sys/net/ipv4/tcp_timestamps | |
echo "30" > /proc/sys/net/ipv4/tcp_fin_timeout | |
echo "5" > /proc/sys/net/ipv4/tcp_keepalive_probes | |
echo "15" > /proc/sys/net/ipv4/tcp_keepalive_intvl | |
echo "16777216" > /proc/sys/net/core/wmem_max |
OlderNewer