Skip to content

Instantly share code, notes, and snippets.

View abrkn's full-sized avatar

Andreas Brekken abrkn

View GitHub Profile
@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;
@matiu
matiu / gist:3305c42b341916fb7afc
Last active August 29, 2015 14:05
Copay: Remove transaction proposals

Remove TxProposals

#!/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)
@jbergstroem
jbergstroem / iojs-1.0.4.ebuild
Last active August 29, 2015 14:14
io.js ebuild
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=5
PYTHON_COMPAT=( python2_{6,7} )
MY_PV="v${PV}"
MY_P="${PN}-${MY_PV}"
@zelig
zelig / gist:adcbb8cd4e9c8259327c
Last active August 29, 2015 14:18
local ethereum cluster
# !/bin/bash
# bash cluster <cluster_root> <number_of_clusters> <network_id> <runid> <local_IP> [[params]...]
# sets up a local ethereum network cluster of nodes
# - <n> is the number of clusters
# - <root> is the root directory for the cluster, the nodes are set up
# with datadir `<root>/00`, `<root>/01`, ...
# - new accounts are created for each node
# - they launch on port 30300, 30301, ...
# - they star rpc on port 8100, 8101, ...
@simenbrekken
simenbrekken / CategoryStore.js
Last active August 29, 2015 14:19
Relay-style higher-order React components backed by Reflux
var Reflux = require('reflux')
var axios = require('axios')
var CategoryStore = Reflux.createStore({
init: function() {
this.items = null
},
list: function() {
var items = this.items
/**
* 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
*/
@weavenet
weavenet / delete_all_object_versions.sh
Created May 4, 2015 05:21
Delete all versions of all files in s3 versioned bucket using AWS CLI and jq.
#!/bin/bash
bucket=$1
set -e
echo "Removing all versions from $bucket"
versions=`aws s3api list-object-versions --bucket $bucket |jq '.Versions'`
markers=`aws s3api list-object-versions --bucket $bucket |jq '.DeleteMarkers'`
@tlrobinson
tlrobinson / redux-devtools-separate-window.js
Last active August 20, 2019 23:54
Put the awesome redux-devtools in it's own window so it doesn't obscure or be obscured by your application
// give it a name so it reuses the same window
var win = window.open(null, "redux-devtools", "menubar=no,location=no,resizable=yes,scrollbars=no,status=no");
// reload in case it's reusing the same window with the old content
win.location.reload();
// wait a little bit for it to reload, then render
setTimeout(function() {
React.render(
<DebugPanel top right bottom left >
@ostinelli
ostinelli / logentries_manual_setup.md
Last active August 11, 2022 21:37
How to use a single Logentries account on Heroku.

If you have multiple applications on Heroku and would like to use a single Logentries account for all of them, this is how you do it. Basically, do not use add-ons, and send all drains to your account.

  • In your Logentries account, click on Add Log
  • Select Manual
  • In the form that appears, input the following:
    • Log Name: access.log
    • Select Set: new set named myapp-{environment}, for instance myapp-staging (at least, this is how I like to name my entries)
    • Select the Plain TCP, UDP - logs are sent via syslog option
  • Click on Create Log Token