This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this makes debugging such a breeze with autocomplete available and such. | |
# requires ipython to be installed of course : pip install IPython | |
def breakpoint(): | |
"""breakpoint() replacement, which uses IPython instead of plain pdb""" | |
import sys | |
from IPython.terminal.debugger import set_trace | |
set_trace(sys._getframe(1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mimetypes | |
from pathlib import Path | |
import fastapi | |
import aiofiles | |
router = fastapi.APIRouter() | |
@router.get('{path:path}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add option to retrieve | |
// the browser devtools page for a headless tab of nodriver | |
def get_inspector_page(tab: uc.Tab): | |
s = 'http://{config.host}:{config.port}/devtools/inspector.html?ws={wsurl}' | |
return s.format(config=tab.browser.config, wsurl=tab.websocket_url[5:]) | |
// proxy the following information, which is nulled whenever you override the user agent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
headless: | |
vendorSub, productSub, vendor, maxTouchPoints, scheduling, userActivation, doNotTrack, geolocation, connection, plugins, mimeTypes, pdfViewerEnabled, webkitTemporaryStorage, webkitPersistentStorage, hardwareConcurrency, cookieEnabled, appCodeName, appName, appVersion, platform, product, userAgent, language, languages, onLine, webdriver, getGamepads, javaEnabled, sendBeacon, vibrate, bluetooth, clipboard, credentials, keyboard, managed, mediaDevices, storage, serviceWorker, virtualKeyboard, wakeLock, deviceMemory, login, ink, mediaCapabilities, hid, locks, gpu, mediaSession, permissions, presentation, usb, xr, serial, windowControlsOverlay, userAgentData, canShare, share, clearAppBadge, getBattery, getUserMedia, requestMIDIAccess, requestMediaKeySystemAccess, setAppBadge, webkitGetUserMedia, getInstalledRelatedApps, registerProtocolHandler, unregisterProtocolHandler | |
headfull: | |
vendorSub, productSub, vendor, maxTouchPoints, scheduling, userActivation, doNotTrack, geolocation, connection, plugins, mime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import '../node_modules/bootstrap/scss/functions'; | |
@import '../node_modules/bootstrap/scss/mixins'; | |
@import '../node_modules/bootstrap/scss/variables'; | |
@import '../node_modules/bootstrap/scss/variables-dark'; | |
@import '../node_modules/bootstrap/scss/maps'; | |
/* make sure you have installed bootstrap 5.3 or later! | |
in earlier versions this won't work | |
--- | |
at the time of writing: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
███████╗ █████╗ ███████╗████████╗ █████╗ ██████╗ ██╗ | |
██╔════╝██╔══██╗██╔════╝╚══██╔══╝██╔══██╗██╔══██╗██║ | |
█████╗ ███████║███████╗ ██║ ███████║██████╔╝██║ | |
██╔══╝ ██╔══██║╚════██║ ██║ ██╔══██║██╔═══╝ ██║ | |
██║ ██║ ██║███████║ ██║ ██║ ██║██║ ██║ | |
╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ | |
██████╗ ███████╗ █████╗ ██████╗████████╗ | |
██╔══██╗ ██╔════╝ ██╔══██╗ ██╔════╝╚══██╔══╝ | |
██████╔╝ █████╗ ███████║ ██║ ██║ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _construct(Parent, args, Class) { | |
if (isNativeReflectConstruct()) { | |
_construct = Reflect.construct.bind(); | |
} else { | |
_construct = function _construct(Parent, args, Class) { | |
var a = [null]; | |
a.push.apply(a, args); | |
var Constructor = Function.bind.apply(Parent, a); | |
var instance = new Constructor(); | |
if (Class) setPrototypeOf(instance, Class.prototype); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bit_replace(byte:int, pos:int, new_val:int): | |
""" | |
Takes a integer <byte> and changes the bit on <pos> with <new_val> (0 or 1). | |
pos is counted from right to left, so pos 0 = LSB | |
:param byte (int): unsigned int | |
:param pos (int) the binary position to replace. pos is counted from "right" to "left", so pos 0 is LSB | |
:param new_val (int): the new value. either 0 (off) or 1 (on) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
LD_PRELOAD library to make bind and connect to use a virtual | |
IP address as localaddress. Specified via the enviroment | |
variable BIND_ADDR. | |
Compile on Linux with: | |
gcc -nostartfiles -fpic -shared bind.c -o bind.so -ldl -D_GNU_SOURCE | |
Example in bash to make inetd only listen to the localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ctypes import wintypes as w | |
import ctypes as c | |
def handler( *args ): | |
print( 'Native console ctrl handler call:' , args ) | |
return 0 | |
NewerOlder