Skip to content

Instantly share code, notes, and snippets.

Swinging madly across the sun.

Asbjorn Enge asbjornenge

Swinging madly across the sun.
Block or report user

Report or block asbjornenge

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@asbjornenge
asbjornenge / gitploy.fish
Created Mar 7, 2018
Small fish script to facilitate deployment using git tags
View gitploy.fish
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 / mining-i-norge.md
Last active Feb 9, 2018
Mining av kryptovaluta i Norge
View mining-i-norge.md

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 / bcoin-neutrino-docker.md
Last active Feb 7, 2018
bcoin playing nice with neutrino via docker
View bcoin-neutrino-docker.md

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 / update-stack.js
Created Nov 21, 2017
Update the images for a docker stack file from swarm
View update-stack.js
#!/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')
View linuxkit.yml
kernel:
image: "linuxkit/kernel:4.9.x"
cmdline: "console=ttyS0 console=tty0 page_poison=1"
init:
- linuxkit/init:63eed9ca7a09d2ce4c0c5e7238ac005fa44f564b
- linuxkit/runc:b0fb122e10dbb7e4e45115177a61a3f8d68c19a9
- linuxkit/containerd:18eaf72f3f4f9a9f29ca1951f66df701f873060b
- linuxkit/ca-certificates:5fc6ba7f91534ddbfef975404c33e44581e6ed7a
onboot:
- name: sysctl
@asbjornenge
asbjornenge / app.js
Created Aug 4, 2015
🔥 fireflux 🚀
View app.js
import React from 'react'
import { FireStarter } from './fireflux'
import Component from './component'
@FireStarter('https://fireflux.firebaseio.com/')
class App extends React.Component {
render() {
return <Component />
}
}
@asbjornenge
asbjornenge / app.js
Created Apr 1, 2015
React ScopeSyle InjectStyle
View app.js
import React from 'react'
import { InjectStyle } from 'react-scopestyle'
import Component from './component'
React.render(
<div className="app">
<InjectStyle />
<Component />
</div>
, document.body)
@asbjornenge
asbjornenge / component.js
Last active Aug 29, 2015
React ScopeStyle
View component.js
import React from 'react'
import ScopeStyle from 'react-scopestyle'
let css = "div { color:pink; }"
export default class MyScopeStyleComponent extends React.Component {
render() {
return (
<ScopeStyle style={css}>
<div>yolo</div>
@asbjornenge
asbjornenge / stylusify.js
Last active Aug 29, 2015
Stylus browserify transform 🚀
View stylusify.js
var transformTools = require('browserify-transform-tools')
var stylus = require('stylus')
module.exports = transformTools.makeStringTransform(
"stylusify",
{
includeExtensions: [".styl"]
},
function (content, opts, done) {
stylus(content).render(function(err, css) {
@asbjornenge
asbjornenge / imgify.js
Created Mar 6, 2015
Browserify img -> base64 data uri transform
View imgify.js
var through = require('through2');
var i = -1
var head = function(type) { i++; return i == 0 ? 'module.exports = "data:image/'+type+';base64,' : '' }
var tail = function() { return '"' }
var isImg = function(file) {
return (/\.((lit)?gif|png|jpg|jpeg)$/).exec(file);
}
module.exports = function (file) {
if (!isImg(file)) return through()
You can’t perform that action at this time.