Skip to content

Instantly share code, notes, and snippets.

View install-and-run-srt-server.sh
#!/usr/bin/env bash
sudo apt update
sudo apt install -y tclsh pkg-config cmake libssl-dev build-essential git tmux
git clone --depth 1 --branch v1.4.2 https://github.com/Haivision/srt.git
cd srt
./configure --prefix=/usr
make
sudo make install
cd ..
@skhalymon
skhalymon / enum_deprecation.py
Last active Apr 24, 2020
Old value `EDGE` would be marked as deprecated by IDE and deprecation message would be printed each `BrowserType.EDGE` call
View enum_deprecation.py
class DynamicEnumGetter(object):
def __init__(self, fget=None):
self.fget = fget
def __get__(self, instance, ownerclass=None):
return self.fget(ownerclass)
class BrowserType(Enum):
EDGE_LEGACY = "edgelegacy"
EDGE_CHROMIUM = "edgechromium"
EDGE_CHROMIUM_ONE_VERSION_BACK = "edgechromium-1"
View frame2.html
<!DOCTYPE html>
<html>
<head lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Cross SDK test</title>
<style>
div {
font-family: "Arial", sans-serif;
@skhalymon
skhalymon / proxy_obj.py
Created Mar 5, 2020
Adds to decorated class __getter__ and __setter__ methods that allow to access attributes from proxy_object in the parent class
View proxy_obj.py
import inspect
def proxy_to(proxy_obj_name, fields):
# type: (Text, List[Text]) -> Callable
"""
Adds to decorated class __getter__ and __setter__ methods that allow to access
attributes from proxy_object in the parent class
:param proxy_obj_name: The name of the proxy object that has decorated class.
View docker-compose.override.yml
version: '2.2'
services:
web:
volumes:
- /mnt/HC_Volume_4511185:/var/azuracast/stations
stations:
volumes:
View css_selector_from_by_value.py
def css_selector_from_(by, value):
if by == By.ID:
value = "#%s" % value
elif by == By.CLASS_NAME:
value = ".%s" % value
elif by == By.NAME:
value = '[name="%s"]' % value
elif by in [By.XPATH, By.CSS_SELECTOR, By.TAG_NAME]:
value = value
else:
View get_ip.py
import requests
def get_public_ip():
try:
r = requests.get('http://ip.o11.net', timeout=(2.0, 2.0))
if r.status_code == 200:
return r.text.rstrip()
except requests.RequestException:
warnings.warn(f'Cannot fetch public ip')
return None
View gist:ec77b819b11a670b7173f92167cad792
MENHIR lang/lang_parser.mly
OCAMLDEP
OCAMLOPT -c tools/log.mli
OCAMLOPT -c tools/log.ml
OCAMLOPT -c tools/extralib.ml
OCAMLOPT -c tools/JSON.mli
OCAMLOPT -c tools/JSON.ml
OCAMLOPT -c tools/utils.ml
OCAMLOPT -c tools/doc.ml
OCAMLOPT -c tools/plug.ml
View keybase.md

Keybase proof

I hereby claim:

  • I am infernion on github.
  • I am infernion (https://keybase.io/infernion) on keybase.
  • I have a public key ASAcms7iPQcbnC8O3K2zDOCBt6alcofbiY_5Y9ue8rw1fAo

To claim this, I am signing this object: