Skip to content

Instantly share code, notes, and snippets.

View makevoid's full-sized avatar

Francesco 'makevoid' Canessa makevoid

View GitHub Profile
@makevoid
makevoid / sinatrize_mini.rb
Last active August 29, 2015 14:17
Generate a Sinatra app in seconds - fork and customize at will
# Sinatrize mini
#
# usage:
#
# - download makevoid/sinatrize_mini.rb from gist.github.com ( wget https://gist.githubusercontent.com/makevoid/e5a7fd4c8c29e9b8051e/raw/a46c95d218be17136a53a8efd631411febd8815e/sinatrize_mini.rb )
# - run: `ruby sinatrize.rb` in your terminal
# - there's no step three! :D
#
# (actually you can `bundle` and `rackup` and you will be gtg!
@makevoid
makevoid / transproc_example.rb
Created April 5, 2015 04:19
Transproc example - Why are you still using activesupport?
T_FOO = Transproc(:hash_recursion, Transproc(:symbolize_keys)) + Transproc(:hash_recursion, Transproc(:map_hash, foo: :bar))
T_FOO.( foo: "baz", child: { "foo" => "asd" } )
# =>
# {:child=>{:bar=>"asd"}, :bar=>"baz"}
# quiz: try to refactor the example using function composition :D
@makevoid
makevoid / appsGet.rb
Created April 7, 2015 23:44
Get all the apps you are developing on sorted by time
# Readme.md
#
# # apps_get
#
# ### Get all the apps you are developing on atm, sorted by time
#
# ### Set your configs (APP_PATH) and then:
#
# ruby appsGet.rb
#
@makevoid
makevoid / Dockerfile
Created April 20, 2015 22:03
ubuntu_openvpn_docker_container.docker
FROM ubuntu:14.04
RUN apt-get update && apt-get upgrade -y && apt-get install -y openvpn easy-rsa
RUN gunzip -c /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz > /etc/openvpn/server.conf
RUN sed -i -re"s/dh dh1024.pem/dh dh2048.pem/g" /etc/openvpn/server.confs
@makevoid
makevoid / custom_events.js
Created April 25, 2015 12:22
custom_events.js - example usage (comments in ita)
// var event = new CustomEvent('nome',{
// 'detail': {
// 'flange': 2,
// 'foo': 1
// }
//})
setInterval(function() { // loop
var rand = parseInt(Math.random() * 1000)
var event = new CustomEvent('flanged', {
@makevoid
makevoid / gist:e23cb266745ece0b1b2c
Created April 26, 2015 20:29
script_openvpn_darioinstall.sh
apt-get update && apt-get upgrade -y && apt-get install -y openvpn easy-rsa && mkdir /etc/openvpn/easy-rsa/ && cp /usr/share/easy-rsa/* /etc/openvpn/easy-rsa/ && cd /etc/openvpn/easy-rsa/ && source vars && ./clean-all && ./build-dh && ./pkitool --initca && ./pkitool --server server && cd keys && openvpn --genkey --secret ta.key && sudo cp server.crt server.key ca.crt dh2048.pem ta.key /etc/openvpn/
@makevoid
makevoid / bitswitch_intel_edison_counterparty.js
Last active August 29, 2015 14:20
BitSwitch Countertparty version
/*jslint node:true, vars:true, bitwise:true, unparam:true */
/*jshint unused:false */
/*global */
var mraa = require('mraa'); //require mraa
var request = require('request');
var _ = require('underscore')
var addr2watch = '1LJ4rddYGzT8GqwQioMNw3cYQJdwjM3Drs' // bitcoin address to watch
var assetName = 'PROG'
@makevoid
makevoid / vanitygen_hh_mm_bitcoin_wallets.md
Last active August 29, 2015 14:22
Vanitygen HH:MM Bitcoin Wallets (vanitygen + regexp) - shell api

core script

vanitygen -r '1[1-9]h[1-5][1-9]m'

example result: 14h55m - bitcoin time!

full script

@makevoid
makevoid / balance_gpio.php
Last active August 29, 2015 14:22
BitSwitch for Raspbery PI - PHP version - Check bitcoin balance example in php and js for the raspberry pi - for @BitcoinKinetics
<?php
include 'config.php';
include 'check_balance.php';
// this file is called by the ajax request
$balance = check_balance($address);
$current_balance = floatval($_GET['currentBalance']);
@makevoid
makevoid / Rakefile
Created June 16, 2015 03:05
A good default Rakefile to start with - use rake to setup and run your ruby app
# task :default => [:hello]
task :default => [:setup_and_run]
# task :hello do
# puts "hello world"
# end
class Bundle