Skip to content

Instantly share code, notes, and snippets.

View krisk0's full-sized avatar

Денис Крыськов krisk0

  • Valenvaryon, Nirn
View GitHub Profile
@krisk0
krisk0 / filetypes.pdx.conf
Last active June 12, 2025 13:05
geany syntax definition for CK3 modding
[styling=Python]
[keywords]
primary=OR AND if else else_if limit trigger immediate option change_variable set_variable save_scope_as
identifiers=yes no scope root prev from this event_target any all none custom_tooltip type title desc name
[lexer_properties=Python]
[settings]
lexer_filetype=Python
@krisk0
krisk0 / UTF8-FIX
Created January 31, 2025 07:40
Fix file mostly encoded as UTF-8, remove poorly encoded strings
#!/usr/bin/python3
import sys
g_in = sys.argv[1]
g_out = g_in + '.conv'
def conv(i, o):
for j in i:
try:
@krisk0
krisk0 / gid_uid_list.py
Created October 9, 2024 11:43
List files and directories with GID/UID bit set
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os, pathlib, stat
g_both,g_uid,g_gid = [],[],[]
g_both_bits = stat.S_ISUID | stat.S_ISGID
def visit_file(f):
@krisk0
krisk0 / permission_check.py
Created October 9, 2024 09:22
Recursively check directories and file permissions. See comment inside file.
#!/usr/bin/python3
# -*- coding: utf-8 -*-
'''
Visit all directories.
Print names of files that have group or other write permission (mask 022)
Print names of directories that contain executables (mask 111) and are
@krisk0
krisk0 / qemu-9999.ebuild
Created September 13, 2024 12:59
QEMU live ebuild (modified gentoo ebuild)
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
# Generate using https://github.com/thesamesam/sam-gentoo-scripts/blob/main/niche/generate-qemu-docs
# Set to 1 if prebuilt, 0 if not
# (the construct below is to allow overriding from env for script)
QEMU_DOCS_PREBUILT=${QEMU_DOCS_PREBUILT:-0}
QEMU_DOCS_PREBUILT_DEV=sam
@krisk0
krisk0 / mr75202-voltage.diff
Last active September 2, 2024 12:57
mr75202.c patch that enables voltage output
--- a/drivers/hwmon/mr75202.c 2024-07-22 12:23:44.000000000 +0300
+++ b/drivers/hwmon/mr75202.c 2024-09-02 10:59:07.000000000 +0300
@@ -27,6 +27,9 @@
#define MR75202_VM_BASE 0x184
#define MR75202_PD_BASE 0xab0
+/* Offset of VM register set from TS register set */
+#define MR75202_VM_TS_OFFSET (MR75202_VM_BASE - MR75202_TS_BASE)
+
#define MR75202_TS_REG(a) (MR75202_TS_BASE + (a))
@krisk0
krisk0 / busybox_gost-yescrypt.patch
Last active July 19, 2024 05:53
Patch busybox version 1.36.0 to support password hashing with gost-yescrypt
diff -urN a/include/libbb.h b/include/libbb.h
--- a/include/libbb.h 2023-01-03 17:17:01.000000000 +0300
+++ b/include/libbb.h 2024-07-17 11:28:28.000000000 +0300
@@ -1777,8 +1777,14 @@
* (otherwise we risk having same salt generated)
*/
extern int crypt_make_salt(char *p, int cnt /*, int rnd*/) FAST_FUNC;
+
+#if ENABLE_GOST_YESCRYPT
+/* $gy$j9T$ + salt(16) + NUL */
@krisk0
krisk0 / dump_via_devmem.sh
Created May 30, 2024 05:36
dump device memory contents using devmem utility
#!/bin/bash
is_empty() {
local a="`echo $1`"
[ ."$a" == . ]
}
dump() {
printf "\n\n%s\n" "$1"
local n=$(($3 / 4))
@krisk0
krisk0 / thru_docker.txt
Created April 12, 2024 11:00
draw.io via docker
# docker run -it --rm --name=draw -p 8080:8080 -p 8443:8443 jgraph/drawio
# chromium "http://$DOCKER_HOST:8080/?offline=1&https=0"
file -> open from -> device, select my_file.drawio
@krisk0
krisk0 / DTS_COMPILE.u-boot
Created April 12, 2024 08:40
compile u-boot .dts found in dir arch/arm/dts
#!/bin/bash
src=`realpath $1`
uboot_base=`dirname $src`/../../..
uboot_base=`realpath $uboot_base`
echo $uboot_base
pre=/tmp/pre.dts
tgt=${src%.dts}.dtb