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
# vi: set ft=ruby : | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "ubuntu/trusty64" | |
config.vm.network "forwarded_port", guest: 8000, host: 8000 | |
config.vm.provision :ansible do |ansible| |
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 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
# -*- coding: utf-8 -*- | |
import asyncio | |
import re | |
import asyncio_redis | |
import tornado.concurrent | |
import tornado.httpclient | |
import tornado.web | |
import tornado.platform.asyncio |
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
import asyncio | |
import json | |
import aiohttp | |
SCHOOL_URL_FMT = 'http://educacao.dadosabertosbr.com/api/escola/{}' | |
SEARCH_SCHOOL_URL = ( | |
'http://educacao.dadosabertosbr.com/api/escolas/buscaavancada?' | |
'situacaoFuncionamento=1&energiaInexistente=on&aguaInexistente=on&' |
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
# -*- coding: utf-8 -*- | |
from bottle import route, run | |
@route('/') | |
def index(): | |
return '<h1>Hello World/h1>' | |
run(host='localhost', port=8000) |
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)$: |