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
# Try it out by opening https://ide.kaitai.io/ and copying this file there | |
# Based on an article by @angelcarve about ESP8266 binary image parsing with Kaitai Struct: | |
# https://carvesystems.com/news/parsing-binaries-with-kaitai-struct/ | |
meta: | |
id: esp8266 | |
file-extension: bin | |
endian: le | |
seq: |
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 calculate_monthly_payment( | |
*, | |
loan: float | int | str | Decimal, | |
annual_interest_rate: float | str | Decimal, | |
years: int | None = None, | |
months: int | None = None, | |
): | |
""" | |
Calculates the annuity monthly mortgage payment |
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 rate_limit_per_second(rate: int): | |
last_request = time.time() | |
lock = asyncio.Lock() | |
@contextlib.asynccontextmanager | |
async def rate_limiter(): | |
nonlocal last_request, lock | |
async with lock: | |
now = time.time() | |
elapsed = now - last_request |
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
#!/usr/bin/env python | |
"""xml2json.py Convert XML to JSON | |
Relies on ElementTree for the XML parsing. This is based on | |
pesterfish.py but uses a different XML->JSON mapping. | |
The XML->JSON mapping is described at | |
http://www.xml.com/pub/a/2006/05/31/converting-between-xml-and-json.html | |
Rewritten to a command line utility by Hay Kranen < github.com/hay > |
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
avahi-browse -rt _ipp._tcp | |
avahi-browse -rt _uscan._tcp | |
driverless | |
lpadmin -p PRINTER_NAME -v "result_of_driverless" -E -m everywhere |
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
image: docker:latest | |
services: | |
- docker:dind | |
stages: | |
- build | |
- integration | |
- dev-release | |
- prod-release |
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
-- https://gitlab.com/-/snippets/1890428 | |
-- The query shows "the forest of trees" of blocked and blocking sessions with the corresponding queries. It helps to understand, which session is being blocked by which one, and what is "the depth" of the lock chain. | |
-- Use it to find the "roots" of trees, then use pg_cancel_backend(pid) or pg_terminate_backend(pid) to get rid of blockers and release the locks. | |
-- Derived from DataEgret's locktree.sql (https://github.com/dataegret/pg-utils/blob/master/sql/locktree.sql) | |
\timing on | |
set statement_timeout to '2s'; | |
with recursive l as ( | |
select |
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 itertools | |
NEXT = object() | |
class new_pipeline: | |
def __init__(self): | |
self._coroutines = [] |
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
""" | |
Script for sorting classes by type in annotation. It may be usefull for code refactoring after code generation. | |
For example: | |
``` | |
class C: | |
a: Optional[A] = None | |
b: Optional[B] = None |
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
#get apks from server? wget -np -e robots=off -m site.com/apk/folder/ | |
#Place all apks in the same dir as py file or change os.listdir parameter | |
#you can get del.js from my repo https://github.com/eybisi/fridaScripts/blob/master/del.js | |
import os | |
from androguard.core.bytecodes import apk | |
import frida | |
import time | |
device = frida.get_usb_device() | |
files = [f for f in os.listdir("./")] | |
for f in files: |
NewerOlder