Skip to content

Instantly share code, notes, and snippets.

View bczsalba's full-sized avatar
💭
cosmic gekko

Balázs Cene bczsalba

💭
cosmic gekko
View GitHub Profile
@bczsalba
bczsalba / get_caller.py
Created May 10, 2025 22:01
python function to get information about caller frames at any given level
def get_caller(depth: int = 1):
"""Returns the caller frame at the given depth."""
import inspect
from collections import namedtuple
frame = inspect.currentframe()
assert frame is not None
if frame.f_back is None:
@seanh
seanh / vimgrep.md
Last active April 27, 2025 13:31
vimgrep cheatsheet

vimgrep

  • Vimcasts on vimgrep

  • Uses native vim regexes (which are slightly different from the regexes used by grep, ack, ag, etc) so the patterns are the same as with vim's within-file search patterns.

You can do a normal within-file search first, then re-use the same pattern to

@fnky
fnky / ANSI.md
Last active May 30, 2025 23:33
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@liuw
liuw / ctype_async_raise.py
Created April 17, 2012 16:02
Nasty hack to raise exception for other threads
#!/usr/bin/env python
# liuw
# Nasty hack to raise exception for other threads
import ctypes # Calm down, this has become standard library since 2.5
import threading
import time
NULL = 0