Skip to content

Instantly share code, notes, and snippets.

View rbanffy's full-sized avatar
🎯
Focusing

Ricardo Bánffy rbanffy

🎯
Focusing
View GitHub Profile
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)))"
@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:

@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 / 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.
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"
# 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'"
@rbanffy
rbanffy / README.md
Created January 26, 2019 13:28
SCRIPT-8
### Keybase proof
I hereby claim:
* I am rbanffy on github.
* I am rbanffy (https://keybase.io/rbanffy) on keybase.
* I have a public key ASAewHcvJxwUP9dNnxVJFWO8vSP6wEg7QK0oPd9vDDXzdQo
To claim this, I am signing this object:
@rbanffy
rbanffy / gist:5e3b04ca4555d37d744a1f0b5756e9a2
Created October 18, 2018 10:48
Make a sane hostname for my VMs
echo vm-$(ifconfig | fgrep ether | head -n 1 | awk '{ print $2 }' | sed -r s/[:]/-/g) > /etc/hostname
@rbanffy
rbanffy / terraform_up.sh
Last active September 25, 2017 11:47
Quick and very dirty Terraform updater
#! /bin/sh
curl -s -o /tmp/tf.zip $(curl -s https://www.terraform.io/downloads.html | grep darwin_amd64.zip | sed -e s/.*\=\"//g | sed s/\"\>.*//g)
unzip /tmp/tf.zip
sudo mv terraform $(which terraform)