Skip to content

Instantly share code, notes, and snippets.

View mtrovilho's full-sized avatar

Marcos Trovilho mtrovilho

View GitHub Profile

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
# for revert instructions please see http://digitaldj.net/2011/07/21/trim-enabler-for-lion/
# \x51 is changed to \x4d in the script
sudo cp /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage.original
sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x4d)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
sudo touch /System/Library/Extensions/
@mtrovilho
mtrovilho / PerformSelectorLeak
Created March 11, 2013 19:07
Suppress "perform selector may cause a leak" warning
// http://stackoverflow.com/questions/7017281/performselector-may-cause-a-leak-because-its-selector-is-unknown#answer-7933931
#define SuppressPerformSelectorLeakWarning(Method) \
do { \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \
Method; \
_Pragma("clang diagnostic pop") \
} while (0)
@mtrovilho
mtrovilho / pyenv-3.3.2.txt
Last active December 19, 2015 13:18
pyenv install --verbose 3.3.2
/var/folders/8y/96ppfnkd4hn1f6ly23vnlvgw0000gn/T/python-build.20130709165422.27117 ~
x readline-6.2/
x readline-6.2/doc/
x readline-6.2/doc/Makefile.in
x readline-6.2/doc/texinfo.tex
x readline-6.2/doc/version.texi
x readline-6.2/doc/fdl.texi
x readline-6.2/doc/rlman.texi
x readline-6.2/doc/rltech.texi
x readline-6.2/doc/rluser.texi
# Raw transaction API example work-through
# Send coins to a 2-of-3 multisig, then spend them.
#
# For this example, I'm using these three keypairs (public/private)
# 0491bba2510912a5bd37da1fb5b1673010e43d2c6d812c514e91bfa9f2eb129e1c183329db55bd868e209aac2fbc02cb33d98fe74bf23f0c235d6126b1d8334f86 / 5JaTXbAUmfPYZFRwrYaALK48fN6sFJp4rHqq2QSXs8ucfpE4yQU
# 04865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac09ef122b1a986818a7cb624532f062c1d1f8722084861c5c3291ccffef4ec6874 / 5Jb7fCeh1Wtm4yBBg3q3XbT6B525i17kVhy3vMC9AqfR6FH2qGk
# 048d2455d2403e08708fc1f556002f1b6cd83f992d085097f9974ab08a28838f07896fbab08f39495e15fa6fad6edbfb1e754e35fa1c7844c41f322a1863d46213 / 5JFjmGo5Fww9p8gvx48qBYDJNAzR9pmH5S389axMtDyPT8ddqmw
# First: combine the three keys into a multisig address:
./bitcoind createmultisig 2 '["0491bba2510912a5bd37da1fb5b1673010e43d2c6d812c514e91bfa9f2eb129e1c183329db55bd868e209aac2fbc02cb33d98fe74bf23f0c235d6126b1d8334f86","04865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac09ef122b1a9
@mtrovilho
mtrovilho / to_phone_pad.sh
Created September 1, 2013 15:58
simple script to convert letters into numbers from telephone pad
#!/bin/sh
INPUT="${1}"
echo $INPUT |\
tr -cd '[:alnum:]' |\
tr 'aAbBcC' '2' |\
tr 'dDeEfF' '3' |\
tr 'gGhHiI' '4' |\
tr 'jJkKlL' '5' |\
tr 'mMnNoO' '6' |\
tr 'pPqQrRsS' '7' |\
@mtrovilho
mtrovilho / the-mag.rb
Last active August 29, 2015 13:55
Create a list with links for all issues of The-Magazine.org
require 'erb'
HTML_FILENAME = 'the-mag.html'
LATEST_ISSUE = 58
template = %{
<html>
<body>
<% LATEST_ISSUE.downto( 1 ) do |i| %>
<p>
#!/usr/bin/env perl
#
# http://daringfireball.net/2007/03/javascript_bookmarklet_builder
use strict;
use warnings;
use URI::Escape qw(uri_escape_utf8);
use open IO => ":utf8", # UTF8 by default
":std"; # Apply to STDIN/STDOUT/STDERR
@mtrovilho
mtrovilho / app.rb
Last active August 29, 2015 14:01
Helper to monitor network stats (speedtest_cli) via TheDash.com
#!/usr/bin/env ruby
DESTINATION = "#{Dir.home}/Dropbox/Public/TheDash"
SPEEDTEST_CLI_EXEC = 'speedtest_cli'
SPEEDTEST_CLI_FLAGS = '--simple'
# You can add --server ID to use always the same server (for full list see speedtest_cli --help)
# Ex:
# 2487) TVA - Comercial Cabo TV São Paulo (Sao Paulo, Brazil) [19.00 km]
# 3068) TIM Brasil (Sao Paulo, Brazil) [19.00 km]
# 3971) America Net (Barueri, Brazil) [36.96 km]
# 4003) T-Systems Brasil (Barueri, Brazil) [36.96 km]