Skip to content

Instantly share code, notes, and snippets.

@m13253
m13253 / build.bat
Created May 2, 2024 20:37
Minimal hello world
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
set PATH=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\Llvm\bin
llvm-rc.exe helloworld.rc
clang.exe -Oz -Wall -Wextra -falign-functions=1 -falign-loops=1 -flto -fno-asynchronous-unwind-tables -fno-ident -fno-stack-protector -fno-unwind-tables -fuse-ld=lld -mwindows helloworld.c helloworld.res -o helloworld.exe -nostdlib -Wl,/SUBSYSTEM:WINDOWS,/ALIGN:16,/FILEALIGN:16 -lcomctl32 -lkernel32 -luser32
@m13253
m13253 / init.sh
Last active February 19, 2024 11:31
Minimal working initramfs for BusyBox, with login
#!/bin/busybox sh
# 1) Download a prebuilt BusyBox binary here:
# https://busybox.net/downloads/binaries/
#
# 2) Prepare your kernel
# cp /boot/vmlinuz vmlinuz
#
# 3) Copy the files
# install -Dm0755 busybox-x86_64 initramfs/bin/busybox
/* [wxMaxima batch file version 1] [ DO NOT EDIT BY HAND! ]*/
/* [ Created with wxMaxima version 13.04.2 ] */
/* [wxMaxima: input start ] */
FlashRot:matrix(
[ cos(rotY)*cos(rotZ), cos(rotY)*sin(rotZ), sin(rotY), 0],
[-sin(rotZ), cos(rotZ), 0, 0],
[-sin(rotY)*cos(rotZ), -sin(rotY)*sin(rotZ), cos(rotY), 0 ],
[trX, trY, 0, 1]);
/* [wxMaxima: input end ] */
@m13253
m13253 / spotread_to_sRGB.py
Last active October 17, 2023 02:23
Convert XYZ color values from ArgyllCMS spotread to sRGB color values
#!/usr/bin/env python3
import colour
import numpy
import readline
def convert(XYZ100):
XYZ100 = numpy.asarray(XYZ100)
XYZ1 = XYZ100 * 0.01
D50 = colour.CCS_ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['ICC D50']
@m13253
m13253 / csgo_address_list.py
Last active September 29, 2023 19:39
Generate MikroTik address list with IP addresses of CS:GO official matchmaking servers
#!/usr/bin/env python3
import json
import netaddr
def main():
# Download from https://api.steampowered.com/ISteamApps/GetSDRConfig/v1?appid=730
with open('network_config.json', 'r', encoding='utf-8') as f:
network_config = json.load(f)
@m13253
m13253 / pixart2svg.py
Last active July 18, 2023 01:41
Convert a pixel art into an SVG file
#!/usr/bin/env python3
# Convert a pixel art to SVG file
# Copyright (C) 2021 Star Brilliant
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@m13253
m13253 / android-captive-portal-china-fix.sh
Created January 22, 2020 16:01
Change Android captive portal detection to Xiaomi's server
adb shell settings put global captive_portal_https_url https://connect.rom.miui.com/generate_204
adb shell settings put global captive_portal_http_url http://connect.rom.miui.com/generate_204
@m13253
m13253 / dnsmasq.conf
Created May 12, 2014 14:46
My dnsmasq configuration
# Configuration file for dnsmasq.
#
# Format is one option per line, legal options are the same
# as the long options legal on the command line. See
# "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details.
# Listen on this specific port instead of the standard DNS port
# (53). Setting this to zero completely disables DNS function,
# leaving only DHCP and/or TFTP.
#port=5353
@m13253
m13253 / gradescope-organizer.py
Last active December 22, 2022 11:33
Organize submission archive downloaded from Gradescope using student’s names
#!/usr/bin/env python3
import itertools
import os
import unicodedata
# pip3 install -U PyYAML
import yaml
# Windows disallows the following characters in filenames: "*/:<>?\|
@m13253
m13253 / bird-dn42-util.conf
Last active November 5, 2022 05:32
BIRD 2.0 utility for DN42 related operations
# BIRD 2.0 utility for DN42 related operations
# To be used with:
# include "bird-dn42-util.conf";
# in bird.conf main configuration file.
function reset_origin (int transit; int origin)
{
bgp_path.empty;
bgp_path.prepend(origin);
bgp_path.prepend(transit);