Skip to content

Instantly share code, notes, and snippets.

View igorcoding's full-sized avatar
🍹
Having fun

Igor Latkin igorcoding

🍹
Having fun
View GitHub Profile
{"paths":{"/api/questions/create":{"post":{"description":null,"tags":["questions"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiOk->app.admin.views.questions.QuestionSchema"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app.admin.views.questions.QuestionNoIdSchema"}}}},"security":[]}},"/api/questions/delete":{"post":{"description":null,"tags":["questions"],"responses":{},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app.admin.views.questions.DeleteQuestionSchema"}}}},"security":[]}},"/api/questions/list":{"get":{"description":null,"tags":["questions"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiOk->app.admin.views.questions.ListResponseSchema"}}}}},"parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","default":100,"minimum":0}},{"in":"query","name":"offset","required":false,"schema":{"type":"integer
@igorcoding
igorcoding / rps.py
Last active October 11, 2017 13:10
import asyncio
import collections
import time
import uvloop; asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
def chunkify(lst, n):
s = len(lst) // n
o = 0
import multiprocessing
def map_parallel(func, iterable, chunksize=1, *,
pool=None,
n_processes=None,
progress_bar_func=None,
pool_kwargs=None,
progress_bar_func_kwargs=None,
total=None
):
apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -c -s`-pgdg main 9.6" > /etc/apt/sources.list.d/pgdg.list
local function alter_package_path(paths, base)local isroot=function(s)return string.sub(s,1,1)=='/'end;local slashends=function(s)return string.sub(s,-1,-1)=='/'end;local fio=require('fio');local bf=debug.getinfo(2,"S").source:sub(2);local lb=fio.readlink(bf);if lb~=nil then bf=lb end;local b=bf:match("(.*/)");if not isroot(b) then b=fio.abspath(b);if not slashends(b)then b=b..'/'end;end;if base~=nil and base~="" then if isroot(base) then b=base;else b=b..base..'/';end;end;local pkg='';for _,p in ipairs(paths)do if isroot(p) then pkg=pkg..";"..p;else pkg = pkg..";"..b..p;end;end;package.path=package.path..pkg;return b;end
local base = alter_package_path({
'?.lua',
'?/init.lua',
'libs/tnt-luas16/?.lua',
})
-- Full function here:
local function alter_package_path(paths, base)
local isroot=function(s)return string.sub(s,1,1)=='/'end;
class CustomJsonEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, JsonSerializable):
return obj.__to_json__()
if isinstance(obj, datetime.datetime) or isinstance(obj, datetime.date):
return int(time.mktime(obj.timetuple()))
return super(CustomJsonEncoder, self).default(obj)
class JsonSerializable:
class ObjectId(JsonSerializable, str):
def __init__(self, object_id):
super().__init__()
self.object_id = int(object_id)
def __str__(self):
return str(self.object_id)
def __int__(self):
return self.object_id
import tensorflow as tf
import tensorflow.examples.tutorials.mnist.input_data
import numpy as np
mnist = tensorflow.examples.tutorials.mnist.input_data.read_data_sets("MNIST_data/", one_hot=True)
image_size = 28
n_labels = 10
def create_w_b(n_prev_layer, n_next_layer):
import tensorflow as tf
import tensorflow.examples.tutorials.mnist.input_data
import numpy as np
mnist = tensorflow.examples.tutorials.mnist.input_data.read_data_sets("MNIST_data/", one_hot=True)
image_size = 28
n_labels = 10
def create_w_b(n_prev_layer, n_next_layer):
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="d:\home\site\wwwroot\go\bin\go.exe"
arguments="run d:\home\site\repository\app.go"
startupTimeLimit="60">
<environmentVariables>