Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Ricardo Bánffy rbanffy

🎯
Focusing
View GitHub Profile
View .tmux.conf
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"
View gist:b68f586fcd1e90de4c425eb56c601481
# 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'"
View gist:2e67ef5e5c4593a793769f05a27704d6
### 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:
View gist:5e3b04ca4555d37d744a1f0b5756e9a2
echo vm-$(ifconfig | fgrep ether | head -n 1 | awk '{ print $2 }' | sed -r s/[:]/-/g) > /etc/hostname
@rbanffy
rbanffy / terraform_up.sh
Last active Sep 25, 2017
Quick and very dirty Terraform updater
View terraform_up.sh
#! /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)
@rbanffy
rbanffy / identifier_ranges.py
Created Jun 15, 2017
Show unicode identifier ranges for Python 3
View identifier_ranges.py
"Show unicode identifier ranges."
in_identifier_range = False
for codepoint in range(int('10ffff', 16)): # Last mapped codepoint is U+10FFFF
if chr(codepoint).isidentifier() and not in_identifier_range:
# We are transitioning into a range.
in_identifier_range = True
start = codepoint
elif not chr(codepoint).isidentifier() and in_identifier_range:
# We are transitioning out of a range.
@rbanffy
rbanffy / redshift.el
Created May 12, 2017
Redshift for Emacs
View redshift.el
(defun sunset (color)
"Redshifts the #RRGGBB COLOR."
(let ((rgb
(mapcar
(lambda (x) (string-to-number x 16))
(list
(substring color 1 3)
(substring color 3 5)
(substring color 5 7)))))
(concat
@rbanffy
rbanffy / nsaname.yaml
Created Apr 12, 2017
Ansible playbook to rename your servers using nsaname (https://www.npmjs.com/package/nsaname)
View nsaname.yaml
---
- name: properly name servers
hosts: servers
become_method: sudo
vars:
source: 192.168.57.1
tasks:
- name: create hostname
local_action: command nsaname -h
View mp3reduce.sh
#!/bin/sh
function bitrate {
file $1 | sed 's/.*, \(.*\)kbps.*/\1/'
}
mp3file=$1
if [ $(bitrate $mp3file) -gt 192 ]; then
echo 'I should compress this'
You can’t perform that action at this time.