Skip to content

Instantly share code, notes, and snippets.

View abrkn's full-sized avatar

Andreas Brekken abrkn

View GitHub Profile
@mrfelton
mrfelton / unlock.sh
Last active July 30, 2019 07:29
Shell script to unlock lnd on system startup
#!/bin/bash
# Do nothing if the WALLET_PASSWORD var is not set.
if [ -z "$PASSWORD" ]; then
echo "[lnd_unlock] Please set PASSWORD in order to unlock wallet automatically."
s6-pause
fi
# output script content for easier debugging.
# set -x
# exit from script if error was raised.
set -e
@xmlking
xmlking / Enum.es6.js
Last active June 25, 2019 18:09
JavaScript Enums with ES6, Type Checking and Immutability
export class EnumSymbol {
sym = Symbol.for(name);
value: number;
description: string;
constructor(name: string, {value, description}) {
if(!Object.is(value, undefined)) this.value = value;
if(description) this.description = description;
@eiriklv
eiriklv / create-reconnecting-websocket.js
Last active March 9, 2019 14:14
Channels and websockets
/**
* Import dependencies
*/
const { EventEmitter } = require('events');
const ReconnectingWebSocket = require('reconnecting-websocket');
/**
* Export a function that creates a websocket connection interface
*/
export default function createReconnectingWebsocket(uri) {
#!/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)
@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
@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
@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

@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)
@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
@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;