Skip to content

Instantly share code, notes, and snippets.

View ABB00717's full-sized avatar

abb00717 ABB00717

View GitHub Profile
@ABB00717
ABB00717 / and.c
Created January 22, 2026 14:27
An `and` bitwise operation using only integer arithmetics.
// Credit goes to https://haqr.eu/tinycompiler/afterword/
/*
* CONCEPT:
* 1. Sign Bit Handling (MSB):
* Since standard integers are signed (2's complement), negative numbers
* would break the 'while (a > 0)' loop condition. We treat the 32nd bit
* (the sign bit, value 2^31 or 2147483648) separately. We manually check
* it, strip it to make the numbers positive, and re-apply it to the result
* if necessary.
@ABB00717
ABB00717 / extract_headers.js
Last active January 22, 2026 07:21
A Javascript script prints headers in current HTML file with tabs representing their depth.
class Tag {
constructor(level, text) {
this.level = level;
this.text = text;
};
};
function extractHeaders() {
const headers = document.querySelectorAll('h1, h2, h3, h4, h5, h6');
console.log(headers);
@ABB00717
ABB00717 / gnome_terminal_to_kitty.py
Created January 17, 2026 13:42
A script that helps you seamlessly translate your config in Gnome Terminal into Kitty.
# gnome_to_kitty.py
import subprocess
import re
import ast
import sys
def get_profile_uuid():
try:
cmd = ["gsettings", "get", "org.gnome.Terminal.ProfilesList", "default"]
result = subprocess.check_output(cmd).decode("utf-8").strip()
@ABB00717
ABB00717 / bind_shell.py
Created January 17, 2026 13:40
A simple bind shell in python.
import socket
import subprocess
import click
from threading import Thread
def run_cmd(cmd):
output = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
return output.stdout
def handle_input(client_socket):
@ABB00717
ABB00717 / add_permalinks.py
Last active January 16, 2026 05:37
A Python script that automatically generates and adds unique, short permalinks (e.g., /p/1a2b3c) to the YAML frontmatter of Markdown files, ensuring no duplicates across the project.