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
package main | |
import ( | |
"fmt" | |
"reflect" | |
) | |
type sA struct { | |
foo int | |
bar string |
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
# -*- coding: utf-8 -*- | |
import time | |
import concurrent.futures | |
import tornado.web | |
import tornado.gen | |
import tornado.httpserver | |
import tornado.ioloop | |
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
package main | |
import ( | |
"fmt" | |
"net/http" | |
) | |
type RedirectHandler struct { | |
Counter chan string | |
} |
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 concurrent.futures import ProcessPoolExecutor, as_completed | |
import sys | |
TO_CALCULATE = range(1000, 15000, 1000) | |
def primes_until(num): | |
result = [] | |
for p in range(2, num+1): |
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 concurrent.futures | |
import muffin | |
app = muffin.Application( | |
'process_executor' | |
) | |
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
# -*- coding: utf-8 -*- | |
import urllib.request | |
import re | |
resp = urllib.request.urlopen('http://dolarhoje.com/').read() | |
resp = resp.decode('utf-8') | |
dolar = re.search( | |
r'<input type="text" id="nacional" value="(?P<dolar>[^"]+)"/>', resp | |
) |
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
# game loop | |
while 1: | |
enemy1, dist1 = input(), int(input()) | |
enemy2, dist2 = input(), int(input()) | |
print(enemy1) if dist1 < dist2 else print(enemy2) |
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
# Stop all docker containers | |
sudo docker stop $(sudo docker ps -a -q) | |
# Delete all docker containers | |
sudo docker rm -f $(sudo docker ps -a -q) | |
# Delete all docker images | |
sudo docker rmi -f $(sudo docker images -q) |
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 Git script for PS1 | |
source /etc/bash_completion.d/git-prompt | |
# Color definition for PS1 | |
txtred='\e[0;31m' | |
txtwhite='\e[0;37m' | |
txtyellow='\e[0;33m' | |
# Defnite PS1 in this format: | |
# user:dir (git branch)$: |
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 logging | |
import json | |
import urllib3 | |
import sys | |
class Liker(): | |
__URL_API = 'https://graph.facebook.com/v2.2' | |
__URL_ME = '/me?fields=id' | |
__URL_HOME = '/me/home?fields=from,likes' |