Skip to content

Instantly share code, notes, and snippets.

View ultrafunkamsterdam's full-sized avatar

Leon ultrafunkamsterdam

View GitHub Profile
@ultrafunkamsterdam
ultrafunkamsterdam / byteunits.py
Last active August 26, 2022 21:19
bytes / kb / mb / gb / tb / etc unit converter
# BY ULTRAFUNKAMSTERDAM
# https://github.com/ultrafunkamsterdam
"""
███████ ██ ███ ███ ██████ ██ ███████ ███████ ████████ ██ ██ ███████ ███████
██ ██ ████ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███████ ██ ██ ████ ██ ██████ ██ █████ ███████ ██ ██ ██ █████ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
@ultrafunkamsterdam
ultrafunkamsterdam / hibryd.py
Last active April 23, 2022 15:21
HIBRYD - mix sync, async, functions and coroutines without crashing
'''
_ _ ___ ___ ___ __ __ ___
| || | |_ _| | _ ) | _ \ \ \ / / | \
| __ | | | | _ \ | / \ V / | |) |
|_||_| |___| |___/ |_|_\ _|_|_ |___/
_|"""""|_|"""""|_|"""""|_|"""""|_| """ |_|"""""|
`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'
yes, that is intentionally wrong
@ultrafunkamsterdam
ultrafunkamsterdam / opencv_cuda_windows_python.cmd
Last active April 23, 2022 10:26
opencv / cv2 with CUDA and Python (3.10 tested) bindings on windows
::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: this script is adapted do personal preferences / installation paths / folders
:: if you want to use it, make sure to modify all variables to reflect your own installation paths
::
:: required:
:: - Cuda Toolkit
:: - Cuda CUDNN (place folders in Cuda Toolkit installation directory by hand, overwrite/merge directories with same name)
:: - cmake
:: - visual studio (with c++ enabled)
@ultrafunkamsterdam
ultrafunkamsterdam / defer.sh
Created October 4, 2021 14:48
android shell defer app start in background
#!/bin/sh
APPNAME=$1
# nohup needs a writable folder
cd /sdcard
# start $APPNAME after 5 seconds
# redirect ouputs to not block
@ultrafunkamsterdam
ultrafunkamsterdam / regex_url_pattern.py
Created June 21, 2021 13:50
python regex url pattern that actually works
import re
REGEX_URL = re.compile(r"(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'\".,<>?«»“”‘’]))")
@ultrafunkamsterdam
ultrafunkamsterdam / bot_and_vm_detection.js
Last active June 2, 2021 20:18
Modern bot detection mechanism (simplified) which is being used by all modern js challenges to check if running in a vm or automated way.
/* This work is part of research and development of the undetected-chromedriver
// https://github.com/UltrafunkAmsterdam/undetected-chromedriver
// in automation controlled browsers, doing the below evaluates c always to 0
// while the same on a regular browser causes c to always be non 0, albeight small ( ~ 0.0000497656 ) values, but not 0
//
// var a = performance.now() / 1000,
// b = performance.now() / 1000 ,
// c = b - a;
// console.log(c);
# accessible by dot ( instance.item ) notation or instance['item'] notation
# recursive dict object
# json serializable
# "pretty print" as stack
# i wouln't really recommend using this in production
class rdict(dict):
@ultrafunkamsterdam
ultrafunkamsterdam / regex_html_qd.py
Created September 18, 2020 23:40
quick and dirty regex to match start/end tag and content in between.
import re
re_html = re.compile('(?smi)(\<(?P<starttag>.*?)\>(?P<content>.*?)\<\/(?P<endtag>.*?)\>)')
@ultrafunkamsterdam
ultrafunkamsterdam / MigIBMNotes.xml
Created June 19, 2020 10:15
USMT Migration XML IBM Notes ( v9 +)
<migration urlid="http://www.microsoft.com/migration/1.0/migxmlext/mig_ibm_notes">
<_locDefinition>
<_locDefault _loc="locNone"/>
<_locTag _loc="locData">displayName</_locTag>
</_locDefinition>
<component type="System" context="User">
<displayName _locID="miguser.Notes">IBM Notes</displayName>
<paths>
@ultrafunkamsterdam
ultrafunkamsterdam / livetransactions.js
Created April 19, 2020 08:19
Blockchain Live Transactions
function BlockchainRealtime(callback){
/**
* Opens a stream which subscribes to receive new unconfirmed transactions
* on the blockchain
* @param {function} callback which accepts a object of the form {input: array: output: array}
* @returns {function} return value of this function is a function, which will stop the stream if called.
*/