Skip to content

Instantly share code, notes, and snippets.

View rbanffy's full-sized avatar
🎯
Focusing

Ricardo Bánffy rbanffy

🎯
Focusing
View GitHub Profile
# Simple exercise for testing terminal support for some text styles
python -c "print '\x1b[4munderline\x1b[0m \x1b[3mitalic\x1b[0m \x1b[1mbold\x1b[0m \x1b[53moverline\x1b[0m normal'"
set-option -g mouse on
set-option -g mode-style "fg=black,bg=cyan"
# This works only on terminals that support overline. iTerm, sadly, isn't one.
set-option -as terminal-overrides "*:Smol=\e[53m"
set-option -gq status-style "fg=brightcyan,overline"
@rbanffy
rbanffy / pre-commit hook
Last active January 4, 2021 23:45
A suggested pre-commit hook for projects with lots of legacy Python code
#!/bin/bash
set -euo pipefail
function lint_added_file () {
# This is called for every file added in the current branch. This
# is the place we should feel more free to validate files more
# rigorously so that nothing we don't like can enter the codebase.
# Get the type of the file and choose what to do.
@rbanffy
rbanffy / gist:fccfcf8f5566d4d1e6c214efb15839a5
Created October 4, 2021 09:13
A better pre-commit hook
#!/bin/bash
# This script is meant to be symlinked into your project's .git/hooks
# or global ~/.githooks directory within projects you are working
# with.
# Note: linters should be configured by project-local config files, so
# we can avoid changing this script. It's fine to change it, but,
# remember if you do that, you're on your own. Python and JavaScript linters
# will ideally run from project-specific folders so they are aware of the
@rbanffy
rbanffy / keybase.md
Created January 8, 2022 00:36
keybase.md

Keybase proof

I hereby claim:

  • I am rbanffy on github.
  • I am rbanffy (https://keybase.io/rbanffy) on keybase.
  • I have a public key whose fingerprint is 2A31 A20A D5CB 40B8 9A21 CE7B 4248 44B9 4187 7EEC

To claim this, I am signing this object:

javascript:window.open("https://twitter.com/intent/tweet?url="+encodeURIComponent(document.location)+"&text="+encodeURIComponent(document.title),%20"_new")
javascript:window.open("https://news.ycombinator.com/submitlink?u="+encodeURIComponent(document.location)+"&t="+encodeURIComponent(document.title))
python -c "import random, string; print(''.join(random.sample(string.digits + string.ascii_letters + '$&-_!', 20)))"