Skip to content

Instantly share code, notes, and snippets.

View e3krisztian's full-sized avatar

Krisztián Fekete e3krisztian

  • Budapest, Hungary
View GitHub Profile
@e3krisztian
e3krisztian / latn-abc+de+hu.xml
Last active November 22, 2025 01:14
Unexpected Keyboard - ABC (+DE+HU)
<?xml version="1.0" encoding="utf-8"?>
<!--
A layout is made of keys arranged into rows. Keys can be made bigger with the
'width' attribute and blank space can be added on the left of a key with the
'shift' attribute.
'key0' assigns the symbol on the middle of the key. 'key1', 'key2', etc..
assign symbols to the corners of a key, they are arranged like this:
@e3krisztian
e3krisztian / arg-parse-complete-optional-argument-chain.md
Created November 3, 2025 17:30
argparse/argcomplete `cmd [arg1] [arg2]` -> `cmd [arg1 [arg2]]`

Excellent — yes, that’s exactly the right approach for taming argcomplete’s ambiguity: wrap your completer in a small factory that inspects the parse state (parsed_args) and only delegates to the inner completer if it’s actually “safe” to do so.

Let’s go step-by-step and build that.


🧩 The core idea

You can absolutely write something like:

@e3krisztian
e3krisztian / claude-sandbox.sh
Last active September 30, 2025 09:18
Claude Code sandbox using docker for python development
#!/bin/bash
set -euo pipefail
if [ "$(git rev-parse --is-inside-work-tree)" = false ]; then
echo "ERROR: Not a git managed directory: $PWD"
exit 1
fi
BIND_MOUNTS=()
@e3krisztian
e3krisztian / fzf-git-hash.sh
Created December 8, 2020 07:49
fzf-git-hash
#!/bin/bash
KEEP_ONLY_GIT_HASH='sed "s/^[*|\\\\/ ]*\\([^ ]*\\) .*/\\1/"'
GIT_LOG=(
git log
--color=always
--graph
--pretty=format:'%Creset%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
--abbrev-commit
--date=relative
@e3krisztian
e3krisztian / converter.py
Last active August 14, 2018 07:21
Python @converter decorator
import functools
def converter(convert):
"""Decorator for making decorators converting function return values.
Take a single argument function and make it into a decorator
converting return values of other functions.
"""
@functools.wraps(convert)
@e3krisztian
e3krisztian / flake8junit.py
Created March 21, 2018 08:27
experimental Junit wrapper for flake8
import sys
from xml.etree.ElementTree import ElementTree, XML, tostring as xml_tostring
JUNIT_SINGLE_SUCCESS = '''\
<?xml version="1.0" encoding="UTF-8"?>
<testsuite tests="1">
<testcase name="Clean code!"/>
</testsuite>
'''
JUNIT_SINGLE_FAILURE = '''\
@e3krisztian
e3krisztian / template.py
Created November 17, 2017 06:48 — forked from jamescasbon/template.py
Pure python templates using with statement
"""
A really stupid python template language inspired by coffeekup, markaby.
Do not use this code, it will ruin your day. A byproduct of insomnia.
TL;DR
-----
This module defines a template language that allows us to do:
d = Doc()
@e3krisztian
e3krisztian / nb-conda-kernels.sh
Last active March 18, 2017 20:49
setup jupyter notebook to get kernels from conda envs
conda install -c defaults -c conda-forge nb_conda_kernels
#!/usr/bin/env python2
import Tkinter as tk
f = tk.Frame()
f.pack()
w1 = tk.Label(f, text='widget1')
w1.grid(column=0, row=0)
w2 = tk.Label(f, text='widget2')
w2.grid(column=120, row=12)