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 / claude-sandbox.sh
Last active July 10, 2025 17:50
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)
#!/bin/bash
# This worked kind of, now brother suggests using another driver - HL-1118
# https://www.reddit.com/r/linuxquestions/comments/2pupp3/linux_print_driver_for_brother_hl1110/
# http://support.brother.com/g/s/id/linux/en/download_prn.html#HL-1110
# exit on error
set -e
wget http://www.brother.com/pub/bsc/linux/dlf/hl1110cupswrapper-3.0.1-1.i386.rpm
def tohex1(n):
assert 0 <= n <= 15
return '0123456789ABCDEF'[n]
def tohex2(n):
assert 0 <= n <= 255
return tohex1(n // 16) + tohex1(n % 16)