Skip to content

Instantly share code, notes, and snippets.

View Neanderthal's full-sized avatar
🏠
Working from home

Sergey Istomin Neanderthal

🏠
Working from home
View GitHub Profile
@Neanderthal
Neanderthal / timing.py
Created December 16, 2019 16:17
class decorator for timing
#https://www.codementor.io/@sheena/advanced-use-python-decorators-class-function-du107nxsv
def time_all_class_methods(Cls):
class NewCls(object):
def __init__(self,*args,**kwargs):
self.oInstance = Cls(*args,**kwargs)
def __getattribute__(self,s):
"""
this is called whenever any attribute of a NewCls object is accessed. This function first tries to
get the attribute off NewCls. If it fails then it tries to fetch the attribute from self.oInstance (an
instance of the decorated class). If it manages to fetch the attribute from self.oInstance, and
@Neanderthal
Neanderthal / timing.py
Created December 16, 2019 16:17
class decorator for timing
#https://www.codementor.io/@sheena/advanced-use-python-decorators-class-function-du107nxsv
def time_all_class_methods(Cls):
class NewCls(object):
def __init__(self,*args,**kwargs):
self.oInstance = Cls(*args,**kwargs)
def __getattribute__(self,s):
"""
this is called whenever any attribute of a NewCls object is accessed. This function first tries to
get the attribute off NewCls. If it fails then it tries to fetch the attribute from self.oInstance (an
instance of the decorated class). If it manages to fetch the attribute from self.oInstance, and
@Neanderthal
Neanderthal / novpn.sh
Created April 2, 2019 15:20 — forked from kriswebdev/novpn.sh
Bypass VPN for specific apps [Linux / OpenVPN]
#!/bin/bash
# === INFO ===
# NoVPN
# Description: Bypass VPN tunnel for applications run through this tool.
VERSION="1.0.2"
# Author: KrisWebDev
# Requirements: Linux with kernel > 2.6.4 (released in 2008).
# Only tested on Ubuntu 15 with bash.
# Main dependencies are automatically installed.
@Neanderthal
Neanderthal / forcevpn.sh
Created April 2, 2019 15:19 — forked from kriswebdev/forcevpn.sh
Force VPN for specific apps, in a better way than killswitch [Linux / OpenVPN]
#!/bin/bash
# === INFO ===
# ForceVPN
# Description: Force VPN tunnel for specific applications.
# If the VPN is down => block the app network traffic.
# Better than a killswitch. IPv4.
VERSION="2.1.0"
# Author: KrisWebDev
# Requirements: Linux with kernel > 2.6.4 (released in 2008).