Skip to content

Instantly share code, notes, and snippets.

View mtrovilho's full-sized avatar

Marcos Trovilho mtrovilho

View GitHub Profile
@mtrovilho
mtrovilho / UIColor+hex.swift
Created July 2, 2014 17:58
UIColor with Hex
extension UIColor {
convenience init(hex: UInt32) {
var r: CGFloat = (CGFloat((hex & 0xFF0000) >> 16) / 255.0)
var g: CGFloat = (CGFloat((hex & 0x00FF00) >> 8) / 255.0)
var b: CGFloat = (CGFloat (hex & 0x0000FF) / 255.0)
self.init(red: r, green: g, blue: b, alpha: 1.0)
}
}
let green = UIColor(hex: 0x00A859)
//
// FlagView.swift
// Bandeira Brasil
//
// Created by Danilo Altheman on 01/07/14.
// Copyright (c) 2014 Quaddro. All rights reserved.
//
import UIKit
@mtrovilho
mtrovilho / GitBundleVersion.sh
Last active August 29, 2015 14:02
Xcode build phase to set Bundle Version from git commit
# Run Script Build Phase
BuildPlist=${INFOPLIST_FILE}
CFBundleVersion=$(git rev-parse --short HEAD)
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $CFBundleVersion" "${BuildPlist}"
@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]
#!/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 / 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>
@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' |\
# 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 / 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