Skip to content

Instantly share code, notes, and snippets.

View makevoid's full-sized avatar

Francesco 'makevoid' Canessa makevoid

View GitHub Profile
@makevoid
makevoid / bitswitch_relay_intel_edison_nodejs.js
Last active January 5, 2016 00:39
#bitswitch #bitcoin's #blockchain controlled #servo motor / vending machine releasing an object / turn light on/off - Intel Edison #iot
/*jslint node:true, vars:true, bitwise:true, unparam:true */
/*jshint unused:false */
/*global */
/*forked from: https://gist.github.com/makevoid/edcb65b679ddbd8c69fd */
var mraa = require('mraa');
var request = require('request') // https://github.com/request/request
var _ = require('underscore') // docs: http://underscorejs.org/
var addr2watch = '19e2eU15xKbM9pyDwjFsBJFaSeKoDxp8YT' // bitcoin address to watch
@makevoid
makevoid / TODO.md
Last active October 1, 2015 01:31
TODO
  • 3d printing
  • 3d demo, 3d fitters
  • bitnfc
  • print 3d bitcoin tags
  • raudo deployment tool
  • clef password example
  • roda opal react.rb integration
  • roda
  • opal - react.rb - redis api - remote store (remote storage)
  • api to wolfram alpha
@makevoid
makevoid / repo_create.sh
Last active August 29, 2015 14:27
repo_create.sh.alias - Aliases **repo_create** combo (gcom, gaa and especially gpc are my favourite git aliases"
# prepreq: gem i hub - or - brew install hub
# alias gcom="git commit -m"
# alias gaa="git add ."
# function gpc {
# cur_branch=$(git rev-parse --abbrev-ref HEAD)
# git push origin $cur_branch
# }
alias repo_create="git init . ; hub create ; touch Readme.md; gaa; gcom 'repo init'; gpc;"
@makevoid
makevoid / insurance.sol.c
Last active September 21, 2015 08:25
peer-to-peer Insurance smart-contract - written by Thomas Bertani - @bertani on github - Used in http://github.com/bertani/InsurETH
contract OraclizeI {
function query(uint timestamp, byte[] formula_1, byte[] formula_2, byte[] formula_3, byte[] formula_4){}
function query(uint timestamp, address param, byte[] formula_1, byte[] formula_2, byte[] formula_3, byte[] formula_4){}
}
contract Insurance {
// logging helper
event Log(uint k);
@makevoid
makevoid / math_challenge.rb
Last active September 22, 2015 14:44
Fun math operators challenge solved with programming
# problem: figure out the operations
#
# expression:
#
# "7 # 7 # 77 # 7 # 7 = 497"
# I'm not good at math so I made this program to solve the problem
operators = %w(+ - * /)
values = [7, 7, 77, 7, 7]
@makevoid
makevoid / solether.js
Last active June 11, 2016 19:46
Solether - solar powered autonomous entity that lets you charge your phone for ethers
/*jslint node:true, vars:true, bitwise:true, unparam:true */
/*jshint unused:false */
/*global */
// Solether - solar powered autonomous entity
var mraa = require('mraa');
var _ = require('underscore') // docs: http://underscorejs.org/
var Web3 = require('web3');
@makevoid
makevoid / geth_mine.coffee
Last active July 19, 2016 08:55
Geth mining script, run as last argument of geth via `js geth_mine.js`
# geth_mine.coffee - activate mining to mine pending transactions - forked by embark-framework
#
# library (from underscore)
now = Date.now or ->
(new Date).getTime()
debounce = (func, wait) ->
timeout = undefined
@makevoid
makevoid / geth_mine.js
Last active October 16, 2016 12:43
Geth mining script, run as last argument of geth via `js geth_mine.js` - source: https://gist.github.com/makevoid/5a618d73c4eff110a21c
// fork of mine.js script on embark-framework, this script mines only if there are new transactions in the pool
var eth, config, main, pendingTransactions, startTransactionMining;
eth = web3.eth;
console.log('geth_mine.js: start');
console.log("node infos: " + (JSON.stringify(admin.nodeInfo)));
config = {
threads: 2 // set this to the number of threads you machine can handle, remember to set a low difficulty in your genesis block to mine faster
@makevoid
makevoid / antani.js
Last active January 21, 2016 12:26
Just a test npm module to use with package.json repository gist rule - just use "repository": "gist:d6b9796cdd5ee631fe8a" to load this gist into your app
// usage:
//
// var antani = require("./antani.js")
//
// console.log(antani())
//
module.exports = function(){
return "antani";
}
@makevoid
makevoid / build_solidity.sh
Created April 9, 2016 21:46
Build solidity to have solc available for geth - you still need to pass "--solc $HOME/eth/solidity/build/solc/solc" as a flag when you run geth
mkdir -p ~/eth
cd ~/eth && git clone https://github.com/ethereum/webthree-helpers
cd ~/eth/webthree-helpers && git checkout release
cd ~/eth && webthree-helpers/scripts/ethupdate.sh --no-push --simple-pull --project solidity
cd ~/eth && webthree-helpers/scripts/ethbuild.sh --no-git --cores $(nproc) --project solidity
~/eth/solidity/build/solc/solc --version