Skip to content

Instantly share code, notes, and snippets.

@user202729
user202729 / aur-shallow-clone.md
Last active January 1, 2026 10:45
Thought on archlinux aur shallow clone

In arch linux - How to modify a PKGBUILD which uses git sources to pull only a shallow clone? - Unix & Linux Stack Exchange, the questioner asks how to make makepkg clone only the relevant commit needed to build the package, instead of the whole git history.

Starting from git 2.49.0, it is technically possible to git clone a single commit. However, there is an additional difficulty.

In summary, some package's PKGBUILD contains git describe command. For this to work, you need to fetch until the nearest tag.


Originally, /usr/share/makepkg/source/git.sh contains download_git and extract_git shell functions.

@user202729
user202729 / oklch-to-srgb-converter.html
Created March 8, 2025 16:59
Tailwind color palette in RGB…
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="https://colorjs.io/dist/color.global.js"></script>
<style>
body {
margin: 0;
padding: 0;
height: 100vh;
// ==UserScript==
// @name Auto-Click Popover Comment Button (Suppress Original Click)
// @namespace http://tampermonkey.net/
// @version 1.1
// @description When a comment-add button is clicked, prevent its default behavior and instead click the corresponding popover comment button.
// @author user202729
// @match https://*.stackoverflow.com/*
// @match https://*.stackexchange.com/*
// @match https://*.superuser.com/*
// @match https://stackapps.com/*
@user202729
user202729 / z3_pysat_bridge.py
Created February 7, 2025 09:51
Solve z3 problems with pysat
#!/usr/bin/env python3
"""
This script shows the solution of a bit–vector constraint problem using
two different methods.
• solve_with_z3(constraints, variables) uses Z3 directly.
• solve_with_pysat(constraints, variables) first applies bit-blasting and Tseitin CNF
transformation in Z3, then uses PySAT to solve the CNF and reconstructs the model.
A demonstration is provided in main().
@user202729
user202729 / A-README.md
Last active February 6, 2025 05:12
automatically add r to docstrings containing \ (supplementary for https://stackoverflow.com/a/79416828/5267751 )

This shows how to automatically add r to docstrings containing \.

Just run python code-slightly-modified.py [path to your Python file]. It will modify the code in-place.

Note: keep a backup copy of your code before running the script!


How the code was written

@user202729
user202729 / .gitignore
Last active December 7, 2024 10:39
Make process allow gdb to attach to it
A
B
@user202729
user202729 / cysignals_sig_on_with_exceptions.md
Last active August 9, 2025 03:12
on sig_on() and sig_on_no_except() in cysignals

Summary

When sig_on() … sig_off() is used, to clean up resources when something is interrupted, don't use sig_on_no_except(). Instead use nested try … finally:

cpdef void matrix_multiply_interruptable_3(np.ndarray[np.int_t, ndim=2] c, np.ndarray[np.int_t, ndim=2] a, np.ndarray[np.int_t, ndim=2] b):
    debug_print("allocate")
    try:
 sig_on()
@user202729
user202729 / A Kuratowski theorem for the projective plane_new.pdf
Last active October 7, 2024 15:17
"A Kuratowski theorem for the projective plane" — Dan Archdeacon thesis — bookmarked
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@user202729
user202729 / .gitignore
Last active August 2, 2024 02:37
rama's nonbug?
/a.o
/b.o
/c.o
/program

How do I build libmupdf.so?

git clone https://github.com/ArtifexSoftware/mupdf
cd mupdf
make shared build=debug
# or:
make shared-debug