Skip to content

Instantly share code, notes, and snippets.

View Tolsi's full-sized avatar
⌨️
I am jumping on the keyboard

Sergey Tolmachev Tolsi

⌨️
I am jumping on the keyboard
View GitHub Profile
@Tolsi
Tolsi / extract_prompts.py
Created January 8, 2026 08:49
Extract user prompts and commands history from Claude Code project files (tested with Claude Code 2.1.1)
#!/usr/bin/env python3
"""
Extract user prompts from Claude Code project files.
This script walks through ~/.claude/projects/ directory, parses all JSONL files,
extracts user messages with timestamps, and saves them to text files in the
current working directory. Each output file is named after its project directory.
"""
import json
@Tolsi
Tolsi / command.sh
Created July 23, 2025 08:34
asus ac2400 marlin ssh temp wath
watch cat /proc/dmu/temperature
@Tolsi
Tolsi / hex_rgb_floats.py
Created June 28, 2023 20:00
HEX to RGB floats for TouchDesigner
h = input('Enter hex: ').lstrip('#')
print('RGB =', tuple(int(h[i:i+2], 16)/255 for i in (0, 2, 4)))
@Tolsi
Tolsi / two_mono_wav_to_stereo.py
Last active June 14, 2023 16:08
Converts two mono wav files to one stereo
import wave, array
# changed from https://stackoverflow.com/a/43163543/699934
def make_stereo(file1, file2, output):
ifile1 = wave.open(file1)
ifile2 = wave.open(file2)
print(ifile1.getparams())
# (1, 2, 44100, 2013900, 'NONE', 'not compressed')
(nchannels, sampwidth, framerate, nframes, comptype, compname) = ifile1.getparams()
assert ifile1.getparams() == ifile2.getparams()
@Tolsi
Tolsi / ring.sh
Created May 11, 2021 03:54
Ring a bell in the command line
echo -e \\a
@Tolsi
Tolsi / ctypes.py
Created February 21, 2020 16:49
handy ctypes examples
from ctypes import c_uint, c_int
print(c_uint(c_int(-49).value).value)
print(hex(c_uint(c_int(-49).value).value))
print(c_int(c_uint(0x7fffffcf).value).value)
print(hex(c_int(c_uint(0x7fffffcf).value).value))
# 4294967247
# 0xffffffcfL

Ledger Nano X : Bluetooth Low Energy Communication

1.0

  • Public release

About

@Tolsi
Tolsi / twos_complement.py
Created January 21, 2020 12:05
Python twos_complement useful functions without ctypes
def twos_complement(val, bits):
"""compute the 2's complement of int value val"""
if (val & (1 << (bits - 1))) != 0: # if sign bit is set e.g., 8bit: 128-255
val = val - (1 << bits) # compute negative value
return val
def twos_complement_string(val, bits, f):
if val >= 0:
return f(twos_complement(val, bits))
else:
@Tolsi
Tolsi / permutations.kt
Created December 17, 2019 16:11
Kotlin List permutations
fun <T> List<T>.permutations(): Sequence<List<T>> {
if (this.size == 1) return sequenceOf(this)
val list = this
return sequence {
val sub = list.get(0)
for (perm in list.drop(1).permutations())
for (i in 0..perm.size) {
val newPerm = perm.toMutableList()
newPerm.add(i, sub)
yield(newPerm)
@Tolsi
Tolsi / keybase.md
Created May 12, 2019 08:36
keybase.md

Keybase proof

I hereby claim:

  • I am tolsi on github.
  • I am tolsi (https://keybase.io/tolsi) on keybase.
  • I have a public key ASA0CeTgUKQhTLd-uw2sGJ9r8dBNvuXpKyS5jm2bQESQ5Ao

To claim this, I am signing this object: