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 http.server import BaseHTTPRequestHandler, HTTPServer | |
class Handler(BaseHTTPRequestHandler): | |
def do_GET(self): | |
self.send_response(200, 'OK') | |
self.send_header('Content-type', 'application/json') | |
self.end_headers() | |
self.wfile.write(b'{"message": "hello world"}') |
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
KEY: b | |
-KEY: o | |
--KEY: b | |
KEY: c | |
-KEY: a | |
--KEY: r | |
-KEY: u | |
--KEY: t | |
---KEY: e | |
KEY: t |
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 logger | |
import ( | |
"bytes" | |
"io" | |
"log" | |
) | |
type FilteredWriter struct { | |
io.Writer |
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
// By Type | |
// Go playground https://play.golang.org/p/lJOCJAq8WL | |
package main | |
import "fmt" | |
type ErrorX struct{} | |
func (e *ErrorX) Error() string { | |
return "It's error X" |
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
from concurrent.futures import as_completed, ThreadPoolExecutor | |
from urllib.request import urlopen | |
import re | |
import sys | |
DEFAULT_REGEX = r'<input type="text" id="nacional" value="([^"]+)"/>' | |
CURRENCY = { | |
'dolar': 'http://dolarhoje.com/', | |
'euro': 'http://eurohoje.com/', |
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 | |
import time | |
import muffin | |
app = muffin.Application('hello_world') | |
def get_msg(): |
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 aiohttp | |
URL_LIST = [ | |
'http://google.com', | |
'http://abc.xyz', | |
'http://github.com', | |
'https://www.python.org/' |
NewerOlder