Skip to content

Instantly share code, notes, and snippets.

View filiperocha's full-sized avatar

Filipe Rocha filiperocha

View GitHub Profile
@filiperocha
filiperocha / iterm2.md
Last active September 30, 2023 07:25 — forked from squarism/iterm2.md
An iTerm2 Cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@filiperocha
filiperocha / AuthyToOtherAuthenticator.md
Created March 18, 2020 06:47 — forked from gboudreau/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Generating Authy passwords on other authenticators


There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes (beware, through Google) for you to use on your favorite authenticator.

His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My gues

@filiperocha
filiperocha / docker-cleanup-resources.md
Created October 2, 2018 11:04 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@filiperocha
filiperocha / lock.css
Created June 8, 2017 09:47 — forked from visnup/lock.css
"lock" orientation of a website for mobile (iPad, iPhone)
/* if portrait mode is detected, rotate the entire site -90 degrees to hint rotating to landscape */
@media (orientation: portrait) {
body {
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
transform: rotate(-90deg);
}
}
@filiperocha
filiperocha / couchdb-undelete.rb
Created February 20, 2016 07:46 — forked from vjt/couchdb-undelete.rb
Undeletes a document from a CouchDB database.
#!/usr/bin/env ruby
#
# Undelete a document from a CouchDB database.
#
# Recovers a previously deleted document by looking at the _changes
# feed, putting a new empty document preserving the revisions chain,
# retrieves the revs_info for the document, asks the user which one
# to recover, and puts back the old revision into place.
#
# For this to work, GETting the document must return error: "not_found",
@filiperocha
filiperocha / yoump3.sh
Created December 12, 2013 11:46 — forked from include/yoump3.sh
#!/bin/bash
URL_LIST=$*
YOUTUBE_DL="/usr/local/bin/youtube-dl"
YOUTUBE_DL_OPTS="--title --restrict-filenames --write-thumbnail --extract-audio --audio-format mp3 --audio-quality 0 --continue --no-overwrites"
${YOUTUBE_DL} ${YOUTUBE_DL_OPTS} ${URL_LIST}
#!/bin/bash
# A Shell Script To Convert All .flac Files To .MP3 Format
# Note: I found this script somewhere on usenet and I've modified it for my needs
METAFLAC=/usr/local/bin/metaflac
FLAC=/usr/local/bin/flac
#ID3=/usr/bin/id3
LAME=/usr/local/bin/lame
FIND=/usr/bin/find
t=$(${FIND} . -type f -iname "*.flac")
@filiperocha
filiperocha / my_template.rb
Created May 17, 2012 14:09 — forked from xavierRiley/my_template.rb
Kyan Custom Admin Template for Padrino
project :test => :rspec, :orm => :activerecord, :adapter => :postgres, :mock => :none, :script => :jquery, :renderer => :erb, :stylesheet => :none, :admin_renderer => :erb
# include additional generators
inject_into_file destination_root('config/boot.rb'), "\# include additional generators\nPadrino::Generators.load_paths << Padrino.root('generators', 'kyan_admin_page_generator.rb')\nPadrino::Generators.load_paths << Padrino.root('generators', 'kyan_admin_generator.rb')\n\n", :before => "Padrino.load!"
say "Cloning custom generators from [email protected]:xavierRiley/Kyan-Padrino-Admin-Generators.git", :red
remove_dir destination_root('generators')
run "git clone [email protected]:xavierRiley/Kyan-Padrino-Admin-Generators.git " + destination_root('generators')
#generate :model, "account username:string password:string"
if params[:_search] == "true" && params[:filters].present?
filters = Hash.new
j = JSON.parse(params[:filters])
i=0
until j.fetch("rules").size == i
k = j.fetch("rules").to_a[i].values_at("field", "op", "data", "groupOp")
if k[1] == "cn"
k[1] = "matches"
#Selector de idioma
#dependencias:
# 1 - Rack locale del paquete Rack-contrib [1]
# USO: Se usa para detectar el idioma definido por el usuario en su browser ['HTTP_ACCEPT_LANGUAGE']
# Esplicado aquí http://guides.rubyonrails.org/i18n.html#using-accept-language
# [1] http://github.com/rack/rack-contrib
# 2 - Routing-filter [1]
# USO: Establecer el locale en las URLs ej.: www.mysite.com/es/foo/bar
# NOTA: Si tambien quieres traducir las URL's usa la gema de Raul Murciano Translate_routes [2] (De momento sin cobertura para Rails3)