Skip to content

Instantly share code, notes, and snippets.

View hamilyon's full-sized avatar

Alexander A Shaposhnikov hamilyon

View GitHub Profile
alert('you have been hacked');
алёна0+
natashaplS 1 #
<E1e1
1sAsh_xy
1sAsh_xyx
пылесоС1_
pleaseLetmein0+
from retry import retry
class Repeat:
def __init__(self, x, y, fn):
def repeated():
try:
fn(y)
except:
raise
/**
* Возвращает стрим если файл в архиве один
*
* @param file архив с файлом для записи в справочник
* @return InputStream
*/
private static InputStream getFileStream(ZipFile file) throws IOException {
Enumeration<? extends ZipEntry> entries = file.entries();
if (!entries.hasMoreElements()) {
return null;
## cd /cygdrive/c/Users/SBT-Shaposhnikov-AA/
## /cygdrive/c/programdata/chocolatey/lib/python3/tools/scripts/waitress-serve.exe --port=8998 reserv:hello_world_app
import sys
import re
import urllib
from urllib import parse
from wsgiref.simple_server import make_server
# from waitress import serve
@hamilyon
hamilyon / client.py
Created September 25, 2015 19:13 — forked from gdamjan/client.py
Python 3.5 async/await with aiohttp, parallel or sequential
import aiohttp
import asyncio
async def get_body(url):
response = await aiohttp.request('GET', url)
raw_html = await response.read()
return raw_html
async def main():
# run them sequentially (but the loop can do other stuff in the meanwhile)
@hamilyon
hamilyon / gist:6646fd04a7d0e37278ce
Created July 29, 2015 11:49
etcd upstart config
#!/bin/sh
### BEGIN INIT INFO
# Provides: etcd
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 1
# Short-Description: Start etcd daemon
### END INIT INFO
package org.littleshoot.proxy;
import org.littleshoot.proxy.impl.DefaultHttpProxyServer;
public class Main {
public static void main(final String[] args) throws Exception {
int port = 9090;
HttpProxyServer proxyServer = DefaultHttpProxyServer.bootstrap()
.withPort(port)
.start();
@hamilyon
hamilyon / mlp.py
Last active August 29, 2015 14:06 — forked from amueller/mlp.py
import numpy as np
import warnings
from itertools import cycle, izip
from sklearn.utils import gen_even_slices
from sklearn.utils import shuffle
from sklearn.base import BaseEstimator
from sklearn.base import ClassifierMixin
from sklearn.preprocessing import LabelBinarizer