Skip to content

Instantly share code, notes, and snippets.

View asbjornenge's full-sized avatar
Swinging madly across the sun.

Asbjorn Enge asbjornenge

Swinging madly across the sun.
View GitHub Profile
@asbjornenge
asbjornenge / update-stack.js
Created November 21, 2017 20:51
Update the images for a docker stack file from swarm
#!/usr/bin/env node
const fs = require('fs')
const { execSync } = require('child_process');
const args = process.argv.slice(2)
const stack = args[0]
const stackfile = stack+'.yml'
const SWARM_SERVICES_RAW = execSync(`docker service ls | grep ${stack} | awk '{print $5}'`)
const STACKFILE_SERVICES_RAW = execSync(`cat ${stackfile} | grep image | awk '{print $2}'`)
let swarm_services = SWARM_SERVICES_RAW.toString().split('\n')
@asbjornenge
asbjornenge / bcoin-neutrino-docker.md
Last active February 7, 2018 21:49
bcoin playing nice with neutrino via docker

A short demo of neutrino support in bcoin ⚡ 🎉

Prerequisites

In order to test our neutrino node, we need to mine a few test-coins we can send. For that we need the primary wallet address of our fullnode.

By default bcoin stores it's configuration in ~/.bcoin (/root/.bcoin inside the container). We want this configuration to stay consisten between container restarts, so we mount it to a temporary path on our local filesystem (/tmp/bcoin).

docker run --rm -v /tmp/bcoin:/root/.bcoin --name bcoin -d asbjornenge/bcoin:neutrino ./bin/bcoin --network=simnet
@asbjornenge
asbjornenge / mining-i-norge.md
Last active February 9, 2018 13:03
Mining av kryptovaluta i Norge

Mining av kryptovaluta i Norge

Til alle som måtte finne det interessant.

Dette dokumentet er et forsøk på å beskrive hvorfor Norge bør omfavne kryptovaluta, og spesielt prosessen kalt mining. Og hvorfor den nåværende bankblokkaden hindrer innovasjon, store økonomisk muligheter og fremveksten av mange nye arbeidsplasser.

Mining

@asbjornenge
asbjornenge / gitploy.fish
Created March 7, 2018 09:57
Small fish script to facilitate deployment using git tags
function gitploy
if count $argv > /dev/null
set -x VERSION $argv[1]
echo "Deploying version $VERSION"
git tag -a "$VERSION" -m "Version $VERSION"; and git push; and git push --tags
else
echo "Missing version"
end
end
@asbjornenge
asbjornenge / linuxkit-logger.js
Created August 21, 2020 13:26
Node script to capture memlogd logs from linuxkit
import net from 'net'
var client = net.createConnection("/var/run/memlogdq.sock")
client.on('connect', function() {
console.log('connected')
})
client.on('data', function(data) {
// Stream logs to somewhere fun...
@asbjornenge
asbjornenge / header.js
Created May 19, 2021 11:14
Tezos Wallet Header
import { useState } from 'react'
import { useStore } from 'react-hookstore'
import { nav } from 'tiny-react-router'
import formatNumber from 'format-number'
import { BiLinkExternal } from 'react-icons/bi'
import { TezosWallet, TezosWalletMenuDisconnect } from 'tezos-wallet-component'
import { getAccount } from '../utils'
import { connectWallet, disconnectWallet } from '../wallet'
import 'tezos-wallet-component/dist/index.css'
import './header.css'
@asbjornenge
asbjornenge / tezid_v1_integration.py
Created June 3, 2021 08:38
TezID v1 Integration
## Types
#
TGetProofsRequestPayload = sp.TRecord(
address=sp.TAddress,
callback_address=sp.TAddress,
callback_entrypoint=sp.TString
)
TGetProofsResponsePayload = sp.TRecord(
address = sp.TAddress,
@asbjornenge
asbjornenge / tezid_v1_integration_test.py
Created June 3, 2021 08:40
TezID v1 Integration Test
@sp.add_test(name = "Call TezID from other contract")
def test():
admin = sp.test_account("admin")
user = sp.test_account("User")
user2 = sp.test_account("User2")
user3 = sp.test_account("User3")
cost = sp.tez(5)
proof1 = sp.record(
type = 'email'
)
@asbjornenge
asbjornenge / xtznews_devseries.md
Last active July 27, 2021 14:20
XTZ News Dev Series

Whoami

My name is Asbjørn Enge and I'm a systems architect and developer located in Norway 🥶🇳🇴

I've been interested in computers my entire life, and being a bit philosofically inclined, linux and free software became an interest and a passion early on. This also lead me to bitcoin and the blockchain space.

I hold a bachelors degree in electrical engineering. But have been working on all sorts of projects from embedded linux libraries to large airport software deployments. I've also managed a PoW farm 😅⚡ These days I do architecture and devops for a SaaS company in addition to building dapps; TezID and YayNay 🙌

Tezos

@asbjornenge
asbjornenge / idz_breakdown.md
Last active August 24, 2021 13:30
IDZ breakdown
Parameter Value
Capped Supply 10.000.000 $IDZ
Decimals 8