Skip to content

Instantly share code, notes, and snippets.

View abdrd's full-sized avatar
🟢
:•) Hey

Abidin Durdu abdrd

🟢
:•) Hey
View GitHub Profile
@abdrd
abdrd / valid_parentheses.go
Created August 27, 2025 11:12
Valid parentheses problem solved using bit-packing
func isValid(s string) bool {
const (
paren uint8 = 1
curly uint8 = 2
square uint8 = 3
)
stack := []uint8{0}
shift := 0
# Deterministic finite automaton that recognizes identifiers
from enum import Enum
import sys
class State(Enum):
S0 = 0
S1 = 1
SE = -1

It is possible to start Helix with a different theme without modifying the existing config.

  • Copy the original config.
    • cp ~/.config/helix/config.toml ~/.config/helix/config-copy.toml
  • Modify the new config.
    • theme = "another_theme"
  • Run Helix with the -c flag.
    • hx -c ~/.config/helix/config-copy.toml

Optional:

@abdrd
abdrd / acme2.toml
Last active August 26, 2025 07:27
helix editor config
# Extends acme theme
#
# Abidin Durdu
# github.com/abdrd
inherits = "acme"
keyword = { fg = "black", modifiers = ["bold"] }
type = { fg = "black" }
@abdrd
abdrd / 0_vscodium_vscode_config
Last active December 5, 2024 10:34
Distraction-free config for vscode/vscodium
Rename `keybindings.js` to `keybindings.json` and put it under `~/.config/VSCodium/User/` (or `~/.config/Code/User/`), or just edit `keybindings.json` from the editor.
Rename `vscodium-settings.js` to `settings.json` and put it under under `~/.config/VSCodium/User/` (or `~/.config/Code/User/`), or just edit `settings.json` from the editor.
# To edit `settings.json` and `keybindings.json` from the editor, press Ctrl+P and then type ">Open User Settings (JSON)" (or ">Open Keyboard Shortcuts (JSON)").
# Don't actually type ">Open bla bla", just type ">set" or ">keyb" or whatever. I don't know why I am explaining it in this much detail.
from typing import Tuple
# transistor lets current pass through it when the gate is 0
NegativeGateTransistor = 0
# transistor lets current pass through it when the gate is 1
PositiveGateTransistor = 1
"""
type NegativeGateTransistor or PositiveGateTransistor
@abdrd
abdrd / bf.io
Last active May 28, 2025 11:54
Brainf interpreter in Io
// There is no support for ',' which reads a byte from stdin
interpreter := Object clone
List last := method(self at((self size) - 1))
interpreter eval := method(prog,
ds := List clone preallocateToSize(30000) setSize(30000) map(0)
dp := 0
is := list()
@abdrd
abdrd / x86.py
Created April 29, 2024 19:38
Scripts to look up a particular x86 instruction in your browser (felixcloutier.com)
import sys
import webbrowser
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python3 x86.py <instruction>")
sys.exit(1)
instr = sys.argv[1]
url = f"https://www.felixcloutier.com/x86/{instr}"
@abdrd
abdrd / inspect_reg.c
Created March 26, 2024 15:49
A simple example of extended inline assembly syntax of GCC that outputs the integer representations of some of the 64-bit x86 general-purpose registers.
#include <stdio.h>
int main() {
long rax, rbx, rcx, rdx, rdi, rsi, rsp, rbp;
asm (
"movq %%rax, %0\n"
"movq %%rbx, %1\n"
"movq %%rcx, %2\n"
"movq %%rdx, %3\n"
@abdrd
abdrd / split.go
Last active August 29, 2023 16:56
Split a file into chunks.
// FILE=file.ext CHUNKS=4 go run split.go
// CHUNKS is optional (default is 4).
package main
import (
"fmt"
"os"
"strconv"
"sync"
)