Skip to content

Instantly share code, notes, and snippets.

View abrkn's full-sized avatar

Andreas Brekken abrkn

View GitHub Profile
@simenbrekken
simenbrekken / bank-accounts.css
Last active December 18, 2015 09:48
State driven Stylus
.visible-empty {
display: block;
}
.is-empty .visible-empty,
.has-empty .visible-empty {
display: none;
}
.is-empty .hidden-empty,
.has-empty .hidden-empty {
display: none;
@simenbrekken
simenbrekken / plugins.js
Created June 25, 2013 07:34
Various jQuery convenience plugins
$.fn.template = function(selector) {
return $(this).find(selector + '[data-template]').removeAttr('data-template').remove()
}
$.fn.rows = function(columns) {
var children = $(this).children().get()
while (children.length) {
var chunk = children.splice(0, columns)
$(chunk).wrapAll('<div class="row' + (chunk.length % 2 ? ' uneven' : '') + '">')
/**
* FOR COPAY WALLET
* Converts multisig xpubs into addresses
*
* Dependencies:
* npm install bitcore
*
* NOTE: You can retrieve xpubs from copay using JSON backup
* Decrypt json backup using sjcl @ https://github.com/bitwiseshiftleft/sjcl
*/
@gavinandresen
gavinandresen / ReplayProtection.patch
Created June 15, 2017 15:15
OP_RETURN replay protection patch
diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp
index ec398f662..6724399c0 100644
--- a/src/policy/policy.cpp
+++ b/src/policy/policy.cpp
@@ -117,6 +117,10 @@ bool IsStandardTx(const CTransaction& tx, std::string& reason, const bool witnes
return false;
}
+ if (tx.ReplayProtected()) {
+ return false;
@hedgehog
hedgehog / gist:386057
Created May 1, 2010 04:43
EC2 AMI with chef-server installed
# install_chef_server.sh
#
# From list post by John Merrells <john@merrells.com>
# Modified by Mike Bailey <mike@bailey.net.au>
logfile="/root/log.txt"
echo "-----" >> $logfile
# New sources.list
cat > /etc/apt/sources.list << EOF
@abrkn
abrkn / drivechain-install-linux.sh
Last active October 31, 2018 04:10
Automatic installation of Drivechain TestDrive
#!/usr/bin/env bash
# AutoTestDrive v7
# Automation Drivechain TestDrive installation for Ubuntu
# Uses Drivenet-9, UTXO-7, Sidechain-8, Payment-1
#
# Changelog
#
# Revision 8
# - Do not restore wallet unless revision 8
# - Fix typo in wallet restore code (payment restored sidechain wallet)
@abrkn
abrkn / drivechain.ai.md
Created October 22, 2018 10:42
Drivechain.ai

Drivechain.ai

The following toolkit makes getting started with Drivechain TestDrive easier and more fun!

Services

@eiriklv
eiriklv / avoiding-exceptions.js
Last active February 2, 2019 12:13
Exception free JavaScript?
/**
* WHY? - BECAUSE EXCEPTIONS/TRY/CATCH IS A GLOBAL HORRIBLE MESS :-(
* Check out error handling in golang: https://blog.golang.org/error-handling-and-go
*/
/**
* Wrap an "unsafe" promise
*/
function safePromise(promise) {
return promise
@rn0
rn0 / README.markdown
Created February 20, 2012 00:22 — forked from gudbergur/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is an extension to Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
#!/bin/sh
BOOT2DOCKER_CERTS_DIR=/var/lib/boot2docker/certs
CERTS_DIR=/etc/ssl/certs
CAFILE=${CERTS_DIR}/ca-certificates.crt
for cert in $(/bin/ls -1 ${BOOT2DOCKER_CERTS_DIR}); do
SRC_CERT_FILE=${BOOT2DOCKER_CERTS_DIR}/${cert}
CERT_FILE=${CERTS_DIR}/${cert}
HASH_FILE=${CERTS_DIR}/$(/usr/local/bin/openssl x509 -noout -hash -in ${SRC_CERT_FILE} 2>/dev/null)