Skip to content

Instantly share code, notes, and snippets.

@rbf
rbf / Default (OSX).sublime-keymap
Last active March 4, 2024 19:14 — forked from jasonlong/Default (OSX).sublime-keymap
A simple way to toggle between dark and light themes in Sublime Text 2 and 3.
// Copy this to your keybindings (Preferences > Key Bindings - User)
// Change the keybinding, color schemes, and themes to your preferences
{
"keys": ["ctrl+shift+s"], "command": "toggle_color_scheme",
"args": {
"light_color_scheme": "Packages/Solarized Color Scheme/Solarized (light).sublime-color-scheme",
"dark_color_scheme": "Packages/Solarized Color Scheme/Solarized (dark).sublime-color-scheme",
"light_theme": "Adaptive.sublime-theme",
"dark_theme": "Adaptive.sublime-theme"
@rbf
rbf / curl_release_asset_binary.sh
Created September 14, 2015 10:09
Small script to download the binary of a release using curl.
# You can inspect the release by `tag` before to get the URL of the first asset.
# API_DOC: https://developer.github.com/v3/repos/releases/#get-a-release-by-tag-name
# The you can download the release asset file (not the API object) by including the header 'Accept: application/octet-stream'
# NOTE: When downloading the binary file, don't forget to specify the name of the downloaded file (with -o <filename>).
# Otherwise the binary will be streamed into the terminal, doing weird unexpected things.
# API_DOC: https://developer.github.com/v3/repos/releases/#get-a-single-release-asset
#
# Everything put together gives that script:
GITHUB_OWNER=twbs
GITHUB_REPO=bootstrap
@rbf
rbf / install_mongodb_on_ubuntu.sh
Last active October 11, 2015 16:12
Executable version of the guide posted on the official MongoDB page (http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/) to install it on Ubuntu 14.04.
#!/bin/bash
# Install MongoDB on Ubuntu 14.04
# Executable version of the guide posted on the official MongoDB page:
# SOURCE: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
# On a c9.io ubuntu machine, refer instead to the support document "Setting Up MongoDB · Cloud9"
# SOURCE: https://docs.c9.io/docs/setting-up-mongodb
@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:

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 / 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
@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 / 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 / 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"}},