Skip to content

Instantly share code, notes, and snippets.

@rbf
rbf / .parcelrc
Created February 21, 2022 16:32
Draft for @rbf/parcel-transformer-csv-to-json
{
"extends": "@parcel/config-default",
"transformers": {
"*.csv": [
"@rbf/parcel-transformer-csv-to-json"
]
}
}
@rbf
rbf / access_obfuscator.rb
Last active October 1, 2017 07:02
Rake middleware (for Rails) to simply obfuscate application access
# The MIT License (MIT)
#
# Copyright (c) 2017 https://gist.github.com/rbf
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@rbf
rbf / download-country-cards-es.sh
Created August 17, 2017 04:58
Batch download country information cards from the Spanish Government website.
#!/bin/bash
# SOURCE: http://www.exteriores.gob.es/Portal/es/SalaDePrensa/Paginas/FichasPais.aspx
# Fail fast
set -eox pipefail
# Download PDFs
curl -sSL 'http://www.exteriores.gob.es/Portal/es/SalaDePrensa/Paginas/FichasPais.aspx' | tr '"' \\n | egrep http | egrep .pdf | sort -u | xargs -n1 -P4 curl -sLO --compressed
# Only print urls and last update date
@rbf
rbf / Default (OSX).sublime-keymap
Last active July 16, 2017 13:08
SublimeText 3 User Settings
[
{ "keys": ["ctrl+shift+j"], "command": "prettify_json" },
{ "keys": ["super+shift+c"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["super+alt+shift+c"], "command": "toggle_comment", "args": { "block": true } },
{ "keys": ["super+alt+p"], "command": "goto_open_file", "args": {"active_group": false}},
{ "keys": ["super+k", "super+p"], "command": "prompt_select_project" },
{ "keys": ["super+k", "super+o"], "command": "goto_open_file", "args": {"active_group": false}},
{ "keys": ["super+k", "super+m"], "command": "toggle_minimap" },
{ "keys": ["super+k", "super+t"], "command": "toggle_tabs" },
{ "keys": ["super+k", "super+l"], "command": "toggle_setting", "args": {"setting": "line_numbers"}},
@rbf
rbf / download-oreilly-free-ebooks.sh
Last active August 17, 2017 05:00
Script to batch download Free Programming Ebooks form O'Reilly Media (see https://pinboard.in/u:rbf/b:5ef50c7b00de)
#!/bin/bash
# Download O'Reilly free programming ebooks
# SOURCE: https://pinboard.in/u:rbf/b:5ef50c7b00de
# SOURCE: https://www.reddit.com/r/programming/comments/6do7ih/free_programming_ebooks/di4ml1r/
# Fail fast
set -eox pipefail
section=("data" "security" "business" "web-platform" "webops" "programming" "iot" "design")
@rbf
rbf / countries.csv
Last active May 20, 2017 01:58
Country names and codes (ISO 3166-1)
name iso2 iso3 iso_numeric
Afghanistan AF AFG 004
Åland Islands AX ALA 248
Albania AL ALB 008
Algeria DZ DZA 012
American Samoa AS ASM 016
Andorra AD AND 020
Angola AO AGO 024
Anguilla AI AIA 660
Antarctica AQ ATA 010
@rbf
rbf / tmux-install.sh
Last active January 18, 2017 07:22
Upgrade tmux on an ubuntu machine like in c9.io.
# SOURCE: https://github.com/kaosf/ubuntu-setup/blob/9ddaed8033a182db85a0c0fcec3cbe37ba5047b2/tmux-setup.sh (via c9.io support)
# install: curl -LO https://gist.githubusercontent.com/rbf/5d4eface55197f21607f34b61f172a05/raw/tmux-install.sh
# NOTE: When installing a c9.io machine from scratch refer to http://rbf.li/c9config instead.
VERSION=2.3
if [[ $1 = local ]]; then
echo 'Build "libevent-dev" and "libncurses-dev".' >&2
else
sudo apt-get -y update

Keybase proof

I hereby claim:

  • I am rbf on github.
  • I am rbf (https://keybase.io/rbf) on keybase.
  • I have a public key whose fingerprint is CE23 AAAE 64C3 7DB5 8174 5552 5A91 257F 04E1 DF63

To claim this, I am signing this object:

@rbf
rbf / automatic_heroku_maintenance_mode_from_travisci.md
Created March 21, 2016 19:10
For reference, this is the way I managed to setup TravisCI.org to automatically set the Heroku app on maintenance mode and capturing a backup before deploying to master (my production branch).

For reference, this is the way I managed to do it as of March 2016 starting with the link mentioned in this comment:

  1. Added HEROKU_API_LOGIN (from heroku auth:whoami) and HEROKU_API_KEY (from heroku auth:token) as protected ENV variables in the travis.org build settings. Alternatively, they can be added in the .travis.yml with:

    travis encrypt HEROKU_API_LOGIN ="$(heroku auth:whoami)" --add
    travis encrypt HEROKU_API_KEY="$(heroku auth:token)" --add
  2. Added following lines to the .travis.yml: