Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
# v12.2 -> v11.11, USE AT YOUR OWN RISK
# You have been warned.
import sys
import json
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def is_customUnits_customSubstances(customUnitsObj: dict) -> bool:
#!/bin/bash
set -o noglob -o errexit -o nounset -o noclobber
IFS=$'\n'
# get all docker-managed networks which driver is bridge
nets=$(\docker network ls --filter driver=bridge --no-trunc --format json | \jq --raw-output '.ID')
# get their interface names
ifaces=$(for net in ${nets}; do
\docker network inspect "${net}" | \jq --raw-output '.[] | .Options."com.docker.network.bridge.name"'
#!/usr/bin/env python3
# vim:set ts=2 sw=2 et:
# Usage: ./dlsite_info.py <PRODUCT_ID> [--no-cache]
# --no-cache: ignore existing cache file, fetch and rewrite it
import os, sys
import requests
from bs4 import BeautifulSoup
# --- Configuration ---
URL = r"https://www.dlsite.com/maniax/work/=/product_id/{product_id}.html"
\set old_url '<old url>'
\set new_url '<new url>'
UPDATE "drive_file" SET "url" = replace("url", :'old_url', :'new_url');
UPDATE "drive_file" SET "thumbnailUrl" = replace("thumbnailUrl", :'old_url', :'new_url');
UPDATE "drive_file" SET "webpublicUrl" = replace("webpublicUrl", :'old_url', :'new_url');
UPDATE "user" SET "avatarUrl" = replace("avatarUrl", :'old_url', :'new_url');
UPDATE "user" SET "bannerUrl" = replace("bannerUrl", :'old_url', :'new_url');
@sanxus
sanxus / i915-backlight-atom-hack.patch
Last active August 10, 2023 20:55
Patch for i915 backlight for those Intel Atom CPUs mostly found on tablets, so it can achieve a low brightness.
diff --git a/drivers/gpu/drm/i915/display/intel_backlight.c b/drivers/gpu/drm/i915/display/intel_backlight.c
index 2e8f17c04522..9b4997f21d24 100644
--- a/drivers/gpu/drm/i915/display/intel_backlight.c
+++ b/drivers/gpu/drm/i915/display/intel_backlight.c
@@ -198,7 +198,7 @@ static u32 ext_pwm_get_backlight(struct intel_connector *connector, enum pipe un
struct pwm_state state;
pwm_get_state(panel->backlight.pwm, &state);
- return pwm_get_relative_duty_cycle(&state, 100);
+ return pwm_get_relative_duty_cycle(&state, 50000);