Skip to content

Instantly share code, notes, and snippets.


Eirik Brandtzæg eirikb

View GitHub Profile
View DI.kt
import no.eirikb.gutsu.Gutsu
class DataDesk {
fun sendMessage(text: String) {
println("${hashCode()}: Sending message: $text")
class PumpView(private val pumpService: PumpService) {
init {
use async_std::io;
use async_std::net::{TcpListener, TcpStream};
use async_std::prelude::*;
use async_std::task;
use futures::{AsyncReadExt, future};
async fn in_to_out(incoming: TcpStream, outgoing: TcpStream) {
let (incoming_reader, incoming_writer) = &mut (&incoming, &incoming);
let (outgoing_reader, outgoing_writer) = &mut (&outgoing, &outgoing);
View msal-demo.js
<!DOCTYPE html>
<script src=""></script>
const azureAdAppClientId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
const sharePointUrl = '';
const config = {
auth: {clientId: azureAdAppClientId},
cache: {cacheLocation: 'localStorage'}
View msal-domdom.html
<!DOCTYPE html>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<script type="text/babel">
const azureAdAppClientId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
const sharePointUrl = '';
eirikb / store.js
Created Jan 6, 2019
Auto Vuex mutations
View store.js
import Vue from 'vue';
import Vuex from 'vuex';
function teenageAutoMutateTurtles(...props) {
return props.reduce((o, p) => (o[`set${p[0].toUpperCase()}${p.slice(1)}`] = (s, v) => s[p] = v) && o, {});
export default new Vuex.Store({
eirikb /
Last active May 18, 2018
Host VDI / VMDK (VirtualBox images) directly over PXE (Network boot).

PXE Boot VDI/VMDK over network

This is an example script of how to host VDI / VMDK (VirtualBox images) directly over PXE (Network boot).  
Example relies on LTSP.  


Can be any distro, but requires ltsp-client-core, example with Debian:

sudo apt-get -y install ltsp-client-core
eirikb / .sassrc.js
Created Mar 15, 2018
Demo of parcel + scss
View .sassrc.js
const path = require('path');
const cwd = process.cwd();
module.exports = {
"includePaths": [
path.resolve(cwd, 'node_modules'),
path.resolve(cwd, 'src')
eirikb / Dockerfile
Created Aug 3, 2017
Arch Linux AUR in Docker
View Dockerfile
FROM base/archlinux
RUN pacman -Syu
RUN pacman -S --noconfirm git base-devel
WORKDIR /build
RUN useradd -d /build build-user
RUN echo "build-user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
RUN chown -R build-user /build
eirikb / load-vue-components-from-folder.js
Created May 24, 2017
Load all Vue components from a given folder, no need for an "index.js"-file
View load-vue-components-from-folder.js
const req = require.context('./components/', true, /\.(js|vue)$/i);
req.keys().map(key => {
const name = key.match(/\w+/)[0];
return Vue.component(name, req(key))
eirikb / mdl-vue.js
Last active May 24, 2017
Add MDL to all elements with "mdl-js"-class in Vue
View mdl-vue.js
import 'material-design-lite'
mounted() {
if (!this.$el || !this.$el.querySelectorAll) return;
for (const el of this.$el.querySelectorAll('[class*=mdl-js-]')) {
if (!el.dataset.upgraded) {
You can’t perform that action at this time.