This file contains hidden or 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
let numberConstat: Double = 5 | |
var count = 1 | |
count += 2 |
This file contains hidden or 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
#include <string> | |
#include "base64.h" | |
std::string | |
http_make_proxy_basic_auth_header(const std::string& username, | |
const std::string& password) | |
{ | |
return "Proxy-Authorization: Basic " + base64_encode(username, password); | |
} |
This file contains hidden or 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
"""Tree data structure. | |
NOTE: this module is "a good enough": it's far from complete implementation, | |
but has all the functionality needed at the moment. | |
More info: http://github.com/povilasb/pytree | |
""" | |
class Tree(object): | |
"""Tree data structure. |
This file contains hidden or 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 signal | |
def handler(signum, frame): | |
print("SIGHUP") | |
signal.signal(signal.SIGHUP, handler) | |
print("Press enter to finish") | |
input() |
This file contains hidden or 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 signal | |
import asyncio | |
def handler(): | |
print("SIGHUP") | |
ev_loop = asyncio.get_event_loop() | |
ev_loop.add_signal_handler(signal.SIGHUP, handler) | |
ev_loop.run_forever() |
This file contains hidden or 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 | |
@asyncio.coroutine | |
def queue_loader(packet_queue): | |
for i in range(1, 4): | |
yield from packet_queue.put('item%s' % i) | |
yield from asyncio.sleep(1) | |
yield from packet_queue.put('DONE') |
This file contains hidden or 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 | |
@asyncio.coroutine | |
def queue_loader(packet_queue): | |
for i in range(1, 10): | |
yield from packet_queue.put('item%' % i) | |
yield from asyncio.sleep(1) | |
@asyncio.coroutine |
This file contains hidden or 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 functools import reduce | |
from typing import Iterable | |
from itertools import filterfalse | |
CONSONANTS_DIGITS = { | |
'b': '1', | |
'f': '1', | |
'p': '1', | |
'v': '1', | |
'c': '2', |
This file contains hidden or 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
all: config-1 config-2 | |
.PHONY: all | |
config-%: % | |
@echo "building conf $^" | |
.PHONY: config-% | |
1: | |
.PHONY: 1 |
This file contains hidden or 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
use std::net::TcpStream; | |
use std::io::{Write, Read}; | |
fn main() { | |
let target_addr = "54.243.92.110:80"; // httpbin.org | |
let mut stream = TcpStream::connect(target_addr).unwrap(); | |
stream.write(b"GET /ip HTTP/1.1\r\nHost: httpbin.org\r\nConnection: close\r\n\r\n"); | |
let mut buff = [0; 65536]; | |
stream.read(&mut buff); |
OlderNewer