Skip to content

Instantly share code, notes, and snippets.

View webknjaz's full-sized avatar
🇺🇦
#StandWithUkraine: https://github.com/vshymanskyy/StandWithUkraine

Sviatoslav Sydorenko (Святослав Сидоренко) webknjaz

🇺🇦
#StandWithUkraine: https://github.com/vshymanskyy/StandWithUkraine
View GitHub Profile
@webknjaz
webknjaz / result_taskgroup.py
Created February 9, 2020 16:24 — forked from smurfix/result_taskgroup.py
anyio ResultGatheringTaskgroup
import anyio
from contextlib import asynccontextmanager
class NotYet(RuntimeError):
pass
class ResultGatheringTaskgroup:
def __init__(self):
self.result = []
@webknjaz
webknjaz / runs-on: ubuntu-latest.txt
Created January 31, 2020 15:43 — forked from sonots/runs-on: ubuntu-latest.txt
Environment Variables on Github Actions
GOROOT_1_11_X64=/usr/local/go1.11
ANDROID_HOME=/usr/local/lib/android/sdk
JAVA_HOME_11_X64=/usr/lib/jvm/zulu-11-azure-amd64
ImageVersion=20190930.2
LANG=C.UTF-8
INVOCATION_ID=029524e610de4329ac57a8f3e8b21281
JAVA_HOME_12_X64=/usr/lib/jvm/zulu-12-azure-amd64
ANDROID_SDK_ROOT=/usr/local/lib/android/sdk
RUNNER_TOOL_CACHE=/opt/hostedtoolcache
JAVA_HOME=/usr/lib/jvm/zulu-11-azure-amd64
@webknjaz
webknjaz / gist:9b7fe6dca3e04b942bf439fcaf2faf2f
Created August 30, 2019 15:50 — forked from abadger/gist:bab2c5c5ed7f169c433e62389803af01
When are native literal strings safe?
Why do we have unadorned string literals (native strings) in our codebase?
Doesn't that put us in danger of UnicodeError exceptions?
(1) Your codebase should be using text by default. At the borders, you convert
strings from other APIs into text and then use text throughout, only
converting to bytes (or native strings) when those types are needed for
another, outside API.
(2) On Python2, text can be safely combined with (or compared to) text[1]_. Bytes
can be combined with bytes. And ascii-only bytes can be combined with text.
@webknjaz
webknjaz / coordinator.py
Last active August 25, 2019 20:35 — forked from zacknawrocki/coordinator.py
CherryPy CORS issue
import cherrypy
import cherrypy_cors
class Coordinator:
@cherrypy.expose
def index(self):
return """<html>
<script type="text/javascript">
@webknjaz
webknjaz / Demo.py
Last active August 18, 2019 20:13 — forked from bmxp/Demo.py
Doctype Bug
from pathlib import Path
import cherrypy
class Demo:
@cherrypy.expose
def index(self):
return Path('static/index.html').open(encoding='utf-8')
@webknjaz
webknjaz / README-Template.md
Created April 20, 2019 13:44 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@webknjaz
webknjaz / 51-android.rules
Last active January 29, 2019 14:32 — forked from jdamcd/51-android.rules
Full set of Android USB vendor ID rules for Linux
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666", GROUP="plugdev", SYMLINK+="android%n" # Acer
SUBSYSTEM=="usb", ATTR{idVendor}=="1949", MODE="0664", GROUP="plugdev", SYMLINK+="android%n" # Amazon
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666", GROUP="plugdev", SYMLINK+="android%n" # ASUS
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666", GROUP="plugdev", SYMLINK+="android%n" # Dell
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666", GROUP="plugdev", SYMLINK+="android%n" # Foxconn
SUBSYSTEM=="usb", ATTR{idVendor}=="04c5", MODE="0666", GROUP="plugdev", SYMLINK+="android%n" # Fujitsu
SUBSYSTEM=="usb", ATTR{idVendor}=="04c5", MODE="0666", GROUP="plugdev", SYMLINK+="android%n" # Fujitsu Toshiba
SUBSYSTEM=="usb", ATTR{idVendor}=="091e", MODE="0666", GROUP="plugdev", SYMLINK+="android%n" # Garmin-Asus
SUBSYSTEM=="usb", ATTR{idVendor}=="0414", MODE="0666", GROUP="plugdev", SYMLINK+="android%n" # Gigabyte
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev", SYMLINK+="and
@webknjaz
webknjaz / smtest.py
Last active November 15, 2018 12:30 — forked from Giancarlos/smtest.py
import functools
import collections
import cherrypy
__metaclass__ = type # enable new-style classes by default
class SelectedMethod:
@webknjaz
webknjaz / gist-reveal.it-slides.html
Created September 12, 2018 19:15 — forked from ryanj/gist-reveal.it-slides.html
Gist-powered Revealjs slideshow presentations http://gist-reveal.it
<section data-background-transition='zoom' data-transition='concave' data-background='http://ryanjarvinen.com/presentations/shared/img/broadcast_reveal_dark.png' data-state='blackout'>
<h2>Gist-Powered</h2>
<h1>Reveal.js</h1>
<h2>Slideshow Presentations</h2>
<br/>
<h1 class='fragment grow'><a style='color:deepskyblue;' href='http://gist-reveal.it'>gist-reveal.it</a></h1>
</section>
<section data-background-transition='zoom' data-transition='linear' id='try-it'>
<h2>Try it out!</h2>
<p>Create your own deck by forking a copy of <a href='https://gist.github.com/ryanj/af84d40e58c5c2a908dd'>this github gist</a>: <br /><a href='https://gist.github.com/ryanj/af84d40e58c5c2a908dd'>https://gist.github.com/ryanj/af84d40e58c5c2a908dd</a></p>
@webknjaz
webknjaz / test_client_fake_server.py
Created May 20, 2018 17:35 — forked from ambivalentno/test_client_fake_server.py
pytest-asyncio aiohttp client testing with fake server
import asyncio
import pathlib
import socket
import ssl
import pytest
import aiohttp
from aiohttp import web
from aiohttp.resolver import DefaultResolver