Skip to content

Instantly share code, notes, and snippets.

View uniibu's full-sized avatar
🏠
Don't comment bad code - rewrite it

Uni Sayo uniibu

🏠
Don't comment bad code - rewrite it
View GitHub Profile
@uniibu
uniibu / rubies-ubuntu.sh
Created May 22, 2016 17:49
Compilation of dependencies and full rubies coin installation on ubuntu 14.04
sudo apt-add-repository ppa:bitcoin/bitcoin -y && sudo apt-get update && sudo mkdir -v rubies && cd rubies && sudo wget https://github.com/uniibu/rubies-core-dev/archive/1.2.0.3-patch.tar.gz && sudo tar -xzvf 1.2.0.3.tar.gz && sudo apt-get install build-essential libdb4.8++-dev libtool libssl-dev libboost-all-dev libminiupnpc-dev -y && cd rubies-core-1.2.0.3/src && sudo make -f makefile.unix
@uniibu
uniibu / escapeHTML.js
Last active June 15, 2016 16:33
escapinghtml
function escapeHTML(str){
str = str + "";
var out = "";
for(var i=0; i<str.length; i++){
if(str[i] === '<') {
out += '&lt;';
} else if(str[i] === '>'){
out += '&gt;';
} else if(str[i] === "'"){
out += '&#39;';
<?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
@uniibu
uniibu / async-examples.js
Created May 25, 2017 11:25 — forked from developit/async-examples.js
Async Array utilities in async/await. Now available as an npm package: https://github.com/developit/asyncro
/** Async version of Array.prototype.reduce()
* await reduce(['/foo', '/bar', '/baz'], async (acc, v) => {
* acc[v] = await (await fetch(v)).json();
* return acc;
* }, {});
*/
export async function reduce(arr, fn, val, pure) {
for (let i=0; i<arr.length; i++) {
let v = await fn(val, arr[i], i, arr);
if (pure!==false) val = v;
@uniibu
uniibu / zeromq-install.sh
Created June 10, 2017 01:50
Install zeromq extenstion for plesk 12/onyx with php 7.0
#!/bin/bash
apt-get update
apt-get install libzmq3-dev plesk-php70-dev libtool pkg-config build-essential autoconf automake
cd /tmp
wget -O zeromq4.tar.gz https://github.com/zeromq/libzmq/releases/download/v4.2.1/zeromq-4.2.1.tar.gz
tar -xf zeromq4.tar.gz
cd zeromq4
./configure
make
sudo make install
test
@uniibu
uniibu / lebab.min.js
Created July 31, 2017 17:41
Umdfied build of lebab
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.lebab=e()}}(function(){var e;return function e(t,n,r){function i(o,a){if(!n[o]){if(!t[o]){var u="function"==typeof require&&require;if(!a&&u)return u(o,!0);if(s)return s(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return i(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var s="function"==typeof require&&require,o=0;o<r.length;o++)i(r[o]);return i}({1:[function(e,t,n){function r(e,t){return h.isUndefined(t)?""+t:h.isNumber(t)&&!isFinite(t)?t.toString():h.isFunction(t)||h.isRegExp(t)?t.toString():t}function i(e,t){return h.isString(e)?e.length<t?e:e.slice(0,t):e}function s(e){return i(JSON.stringify(e.actual,r),128)+" "+e.operator
@uniibu
uniibu / native_lodash.js
Created August 5, 2017 18:22
native counterpart of some lodash functions
const assert = require('assert');
/**
* Determines if two values are equal(performs deep comparison).
*
* @param {*} obj The first value to compare from
* @param {*} other The value to compare to
* @return {boolean} True if equal, False otherwise.
*/
const isEqual = (obj, other) => {
try {
@uniibu
uniibu / fastcopy_chaindata.py
Created November 30, 2017 12:51 — forked from laanwj/fastcopy_chaindata.py
Fast local copy of Bitcoin Core blockchain state
#!/usr/bin/python3
# Copyright (c) 2017 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Fast local copy of Bitcoin Core blockchain state.
This utility hardlinks all but the last block data file (rev and blk),
and hardlinks all .ldb files to the destination. The last data files as well
as the other leveldb data files (such as the log) are copied.

Usecase - Integrating Monacoin to Coinomi

A simple usecase of a Bitcoin compatible coin integration. Not all coins are created equal, so it is possible that extra work must be done to successfully integrate a new cryptocurrency.

  1. Start the Monacoin daemon and in the monacoin.conf file add the option "txindex=1"
rpcuser=monacoinrpc
rpcpassword=MFfySYp9o9qQi0mYbQmxOdE1pEHVS1DQuhhHssOzkO3
rpcport=8022