Skip to content

Instantly share code, notes, and snippets.

@qwerty12
qwerty12 / README.md
Last active April 16, 2024 16:12
pk.q12.defvidspeed - quick and dirty Kodi addon to set a default video speed
@adtac
adtac / Dockerfile
Last active December 26, 2025 00:20
#!/usr/bin/env docker run
#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"
# syntax = docker/dockerfile:1.4.0
FROM node:20
WORKDIR /root
RUN npm install sqlite3
@bitmvr
bitmvr / parseable-curl-response-example.sh
Last active January 7, 2024 15:12
Create Parseable cURL Response with Bash and jq
#!/usr/bin/env bash
__http_request_example(){
curl \
--silent \
--location http://ip.jsontest.com \
--write-out "\n%{http_code}"
}
__response_formatter(){
@markhamersma
markhamersma / DnD-Useful-Links.md
Last active March 4, 2025 03:43
Useful links for Dungeons and Dragons
@qwertz19281
qwertz19281 / 99-udev.rules
Last active September 22, 2025 21:07
udev rules
# RTL9210 M.2 adapter TRIM/discard via unmap command
ACTION=="add|change", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="9210", SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"
# Qudelix 5k control via Chromium extension (HID permissions)
KERNEL=="hidraw*", ATTRS{idVendor}=="0a12", ATTRS{idProduct}=="4005", MODE="0666"
KERNEL=="hidraw*", ATTRS{idVendor}=="0a12", ATTRS{idProduct}=="4010", MODE="0666"
# WD USB HDD proper shutdown on system shutdown (customize the idProduct and idVendor)
ACTION=="add|change", ATTRS{idVendor}=="1058", ATTRS{idProduct}=="2626", SUBSYSTEM=="scsi_disk", ATTR{manage_system_start_stop}="1"
@DavidBuchanan314
DavidBuchanan314 / json_no_dupes.py
Last active August 18, 2024 03:00
How to ensure JSON has no duplicate map keys in Python 3.1+
from typing import List, Tuple, Any
import json
def ensure_no_duplicate_keys(object_pairs: List[Tuple[str, Any]]) -> dict:
value = dict(object_pairs)
if len(value) != len(object_pairs):
raise ValueError("Duplicate JSON map keys")
return value
if __name__ == "__main__":
@aclarknexient
aclarknexient / checkout.py
Created November 23, 2023 18:34
python git checkout using pygit2
import pygit2
def checkout_branch(path, branch_name):
repo = pygit2.Repository(path)
# If the branch isn't already in the local list,
# you have to create a ref for it to point at
# in order to avoid detached head state
if branch_name not in repo.branches.local:
"""
This script converts a properly formatted CSV file to a JSON list.
The CSV must have the `Project ID` in the first column and `OP Amount` in the second column.
The `Project ID` can be found at the end of the voting URL, eg:
https://vote.optimism.io/retropgf/3/application/0xd730a803f5714c7f1b5e518edd57121d1b64c8c91cf611ae5f226cf9bb4b963f
https://round3.optimism.io/projects/0xd730a803f5714c7f1b5e518edd57121d1b64c8c91cf611ae5f226cf9bb4b963f
`Project ID` = 0xd730a803f5714c7f1b5e518edd57121d1b64c8c91cf611ae5f226cf9bb4b963f
@r0x0d
r0x0d / check.py
Last active December 20, 2023 19:41
CLEANUP_MODULES_ON_EXIT_REGEX = re.compile(r"(?i)CleanupModulesOnExit\s*=\s*(yes|true)")
def _is_modules_cleanup_enabled():
"""Verify firewalld modules cleanup config is enabled.
:returns: Whether or not the CleanupModulesOnExit is set to true in
firewalld config.
:rtype: bool
"""
# Return false if the config file does not exist. Either it means that
@evinjaff
evinjaff / addon.xml
Created October 27, 2023 09:23
Random Startup Movie Hack for Arctic Zephyr Kodi Skin
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="service.autoexec" name="Autoexec Service" version="1.0.0" provider-name="evinjaff">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
</requires>
<extension point="xbmc.service" library="autoexec.py">
</extension>
<extension point="xbmc.addon.metadata">
<summary lang="en_GB">Automatically run python code when Kodi starts.</summary>
<description lang="en_GB">The Autoexec Service will automatically be run on Kodi startup.</description>