Skip to content

Instantly share code, notes, and snippets.

View denismakogon's full-sized avatar

Denys Makogon denismakogon

View GitHub Profile
name: myfubc
version: 0.0.1
format: json
path: /index
type: sync
timeout: 60
idle_timeout: 200
memory: 256
def start(handle_func, uds, loop=None):
log.log("in http_stream.start")
app = setup_unix_server(handle_func, loop=loop)
socket_path = str(uds).lstrip("unix:")
if asyncio.iscoroutine(app):
app = loop.run_until_complete(app)
log.log("socket file exist? - {0}"
{
"kind": "Namespace",
"apiVersion": "v1",
"metadata": {
"name": "minio",
"labels": {
"name": "minio"
}
}
}
@denismakogon
denismakogon / gist:e84585c3cb372adb22d2920f8dcb0efa
Last active September 4, 2018 18:03
Python FDK function's unit tests output with coverage
$ pytest -v -s --tb=long func.py
======================================================================================= func session starts ========================================================================================
platform darwin -- Python 3.6.2, pytest-3.7.1, py-1.5.4, pluggy-0.7.1 -- /usr/bin/python3.6
cachedir: .pytest_cache
rootdir: /func, inifile:
plugins: cov-2.4.0
collected 1 item
func.py::TestFuncWithData::test_in_time PASSED
func.py::TestFuncWithData::test_response_with_data PASSED
@denismakogon
denismakogon / gist:e99c858072776aa4ebf4fb8b99691684
Created September 4, 2018 18:02
Python FDK function's unit test output
$ pytest -v -s --tb=long func.py
======================================================================================= func session starts ========================================================================================
platform darwin -- Python 3.6.2, pytest-3.7.1, py-1.5.4, pluggy-0.7.1 -- /usr/bin/python3.6
cachedir: .pytest_cache
rootdir: /func, inifile:
plugins: cov-2.4.0
collected 1 item
func.py::TestFuncWithData::test_in_time PASSED
func.py::TestFuncWithData::test_response_with_data PASSED
@denismakogon
denismakogon / func.py
Created September 4, 2018 17:49
Fn Project: Python FDK unit test feature
import fdk
import ujson
from fdk import fixtures
def handler(ctx, data=None, loop=None):
name = "World"
if data and len(data) > 0:
body = ujson.loads(data)
name = body.get("name")
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 4 columns, instead of 3. in line 6.
Title,Price,Image quality,Depth of field
Sigma Art 35/f1.4,799 USD,outstanding,moderate focus ring travel distance that gives the literally insane depth of field
Nikkor 35/f1.4G,1696 USD,excellent quality,moderate bokeh but lower your expectation short focus ring travel distance
Sigma Art 85/f1.4,1099 USD,outstanding, f1.4 is what you can work with; rare filter screw diameter; smooth focus ring; almost silent HSM AF; focus ring has pretty long travel distance that give literally insane depth of field
Nikkor 85/f1.4G,1596 USD,good as expected but not that good for its price, low sharpness at f1.4; sharp at f2.0 with moderate bokeh; made with plastic; loves dust; bad weather sealing; moderate focus ring travel distance
Sigma Art 105/f1.4,1599 USD,outstanding; f1.4 is what you can work with; rare filter screw diameter; heavy,focus ring has pretty long travel distance that give literally insane depth of field
Nikkor 105/f1.4G,2196 USD,good but lower than with Nikkor 85/f1.4; very expensive; vignetting; low sharpn
func main() {
fdk.Handle(fdk.HandlerFunc(withError))
}
func withError(ctx context.Context, in io.Reader, out io.Writer) {
err := myHandler(ctx, in, out)
if err != nil {
fdk.WriteStatus(out, 500)
out.Write([]byte(err.Error()))
#!/bin/bash
export GOFILE="go1.10.linux-amd64.tar.gz"
cd ~
wget "https://storage.googleapis.com/golang/$GOFILE"
tar -C /usr/local -xzf "$GOFILE"
rm "$GOFILE"
echo '#go configuration' >> ~/.bashrc
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
echo 'export GOPATH=$HOME/go' >> ~/.bashrc
class Test(object):
external_func = None
@classmethod
with_external_func(cls, f):
cls.external_func = f
return cls
def dummy():