Skip to content

Instantly share code, notes, and snippets.

View emdeeeks's full-sized avatar

Gareth Griffiths emdeeeks

View GitHub Profile
@emdeeeks
emdeeeks / autoxm.py
Created April 22, 2018 11:34 — forked from DanielOaks/autoxm.py
autotracker.py, for generating XM chiptunes!
#!/usr/bin/env python3
# AutoXM
# written by Daniel Oaks <[email protected]>
# released into the public domain
# inspired by the public domain autotracker by Ben "GreaseMonkey" Russell
import struct, random
# XM Module Handling
#
@emdeeeks
emdeeeks / simple_rdoc.rb
Created May 28, 2018 18:49 — forked from thehenster/simple_rdoc.rb
A very simple custom RDoc generator
# RDoc can use a custom generator but it isn't that well documentated. Here is a
# sample custom generator to get you going.
#
# Ruby comes with an `rdoc` executable but most of us generate our docs via Rake. To
# use your custom generator with Rake do something like the following in your Rakefile..
#
# require 'rdoc/task'
# require 'simple_rdoc'
#
# RDoc::Task.new('simple_doc') do |i|
<?php
/* This file is hereby released to public domain */
require_once(__DIR__ . '/../lib/jsonRPCClient_bitcoin.php');
global $CONFIG;
$CONFIG = array(
'bitcoind_user' => 'change_this',
'bitcoind_pass' => 'change_this',
'bitcoind_port' => 'change_this',
'bitcoind_fee' => 0.0002, // Shoudl be enough for anybody
@emdeeeks
emdeeeks / api_blueprint.rb
Created July 20, 2018 19:07 — forked from nikone/api_blueprint.rb
Api Blueprint test docs
# lib/api_blueprint.rb
require 'rspec/core/formatters/base_formatter'
require 'pry'
class ApiBlueprintPrinter
def initialize(output)
@output = output
end
def print_meta_info
@emdeeeks
emdeeeks / post-receive
Created August 7, 2018 13:37 — forked from carlosantoniodasilva/post-receive
Basic git post-receive hook file to deploy a Rails app.
#!/bin/bash
APP_NAME="your-app-name-goes-here"
APP_PATH=/home/deploy/${APP_NAME}
# Production environment
export RAILS_ENV="production"
# This loads RVM into a shell session. Uncomment if you're using RVM system wide.
# [[ -s "/usr/local/lib/rvm" ]] && . "/usr/local/lib/rvm"
@emdeeeks
emdeeeks / block_chain.rb
Created September 30, 2018 15:39 — forked from altamic/block_chain.rb
Blockchain consisting of proof of work as from lian
#
# Ruby Example of the 'proof of work' explanation
# from https://en.bitcoin.it/wiki/Proof_of_work
#
# note: block data passed to do_work is simplified.
# bitcoin blockchain is more complex too.
#
require 'digest/sha2'
@emdeeeks
emdeeeks / PoW.py
Created October 1, 2018 14:49 — forked from daedalus/PoW.py
bitcoin PoW
#!/usr/bin/env python
# example of proof-of-work algorithm
import hashlib
import time
max_nonce = 2 ** 32 # 4 billion
def proof_of_work(header, difficulty_bits):
@emdeeeks
emdeeeks / merkle.rb
Created October 12, 2018 13:55 — forked from earlonrails/merkle.rb
Merkle tree in ruby
#!/usr/bin/env ruby
class Merkle
attr_accessor :key, :parent, :left, :right
def initialize(array, parent = nil)
@parent = parent
@key = array.join
load(array)
end
@emdeeeks
emdeeeks / code_review.rake
Created October 12, 2018 16:46 — forked from earlonrails/code_review.rake
rake code review task. Parse git diff and git show to generate some html pages which have code changes side by side from left and right branches. Don't pay for code review tools! Don't use crazy tools with databases! Too much overhead!
require 'cgi'
require 'fileutils'
desc 'Generate a code review.'
# Uses rake code_review[master,qa] by default
task :code_review, :left_branch, :right_branch do |cmd, args|
left_branch = ( args[:left_branch] || "master" )
right_branch = ( args[:right_branch] || "qa" )
gp = GitParser.new(left_branch, right_branch)
gp.fancy_full_diff
@emdeeeks
emdeeeks / MerkleTree.js
Created October 12, 2018 16:50 — forked from amaranter/MerkleTree.js
Merkle Tree Implementation with Javascript and CryptoJS (SHA-256)
/**
* MerkleTree Implementation
* @version 1.0.0
* @author Ronny Amarante <[email protected]>
*/
var SHA256 = require("crypto-js/sha256");
function MerkleTree(transactions) {
this.transactions = transactions;