Skip to content

Instantly share code, notes, and snippets.

View danielribeiro's full-sized avatar

Daniel Ribeiro danielribeiro

View GitHub Profile
#!/bin/sh
#
# Adam Sharp
# Aug 21, 2013
#
# Usage: Add it to your PATH and `git remove-submodule path/to/submodule`.
#
# Does the inverse of `git submodule add`:
# 1) `deinit` the submodule
# 2) Remove the submodule from the index and working directory
@danielribeiro
danielribeiro / gist:f4dcaf4b56a5621450ac
Created March 21, 2016 22:43 — forked from sonsongithub/gist:2868639
Parse Xcode project file, project.pbxproj, in Ruby.
json = JSON.parse(`plutil -convert json -o - "#{filename}"`)
@danielribeiro
danielribeiro / timeout.rb
Created April 4, 2016 23:23 — forked from lpar/timeout.rb
Run a shell command in a separate thread, terminate it after a time limit, return its output
# Runs a specified shell command in a separate thread.
# If it exceeds the given timeout in seconds, kills it.
# Returns any output produced by the command (stdout or stderr) as a String.
# Uses Kernel.select to wait up to the tick length (in seconds) between
# checks on the command's status
#
# If you've got a cleaner way of doing this, I'd be interested to see it.
# If you think you can do it with Ruby's Timeout module, think again.
def run_with_timeout(command, timeout, tick)
output = ''
@danielribeiro
danielribeiro / gist:70da0d180d4b44230cde09972623ef70
Created October 27, 2016 23:01 — forked from jedi4ever/gist:7677d62f1414c28a1a8c
Some notes on travisci remote debugging via ssh or screenshot or remote desktop of Mac VM builds
Some notes on remote debugging mac builds on Travisci. It's hard to tell when something hangs what the cause it. Trial and error via commits is tedious. And on Mac , sometimes it's the gui asking for input. So I worked my around to get the access I needed for faster debugging a build.
#################################################
# Enable remote ssh access to travisci build for debugging
#################################################
# Add a key so we can login to travisci vm
- cat ssh/travisci.pub >> ~/.ssh/authorized_keys
- chmod 600 ssh/travisci
# Install netcat
@danielribeiro
danielribeiro / signal.go
Created November 8, 2016 01:04 — forked from reiki4040/signal.go
signal handling example for golang
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
)
func main() {
@danielribeiro
danielribeiro / distccd-rpi.plist
Created February 3, 2017 07:26 — forked from jvcleave/distccd-rpi.plist
mac distcc install instructions
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>distccd-rpi</string>
<key>Program</key>
<string>/Users/YOUR_USER_NAME/Scripts/launchd-distccd.sh</string>
<key>RunAtLoad</key>
<true/>
@danielribeiro
danielribeiro / simulator_populator_xcode7
Last active September 21, 2017 09:45 — forked from cabeca/simulator_populator_xcode7
This script removes and recreates all simulators in Xcode 7.
#!/usr/bin/env ruby
require 'JSON'
device_types = JSON.parse `xcrun simctl list -j devicetypes`
runtimes = JSON.parse `xcrun simctl list -j runtimes`
devices = JSON.parse `xcrun simctl list -j devices`
devices['devices'].each do |runtime, runtime_devices|
runtime_devices.each do |device|
@danielribeiro
danielribeiro / regtest.md
Last active October 26, 2017 21:24 — forked from t4sk/regtest.md
How to get bitcoins for development using Regtest

How to get bitcoins for development using Regtest

Start bitcoind

> bitcoind -regtest -datadir=./ -printtoconsole

Generate block chain

> bitcoin-cli -regtest -datadir=./ generate 101