Skip to content

Instantly share code, notes, and snippets.

View eirikb's full-sized avatar

Eirik Brandtzæg eirikb

  • Softeria AS
  • Ålesund, Norway
View GitHub Profile

Problem

In Arch Linux mkinitcpio -p linux

shows

Possibly missing firmware for module: aic94xx
 Possibly missing firmware for module: wd719x
@eirikb
eirikb / mdl-vue.js
Last active May 24, 2017 19:48
Add MDL to all elements with "mdl-js"-class in Vue
import 'material-design-lite'
Vue.mixin({
mounted() {
if (!this.$el || !this.$el.querySelectorAll) return;
componentHandler.upgradeElement(this.$el);
for (const el of this.$el.querySelectorAll('[class*=mdl-js-]')) {
if (!el.dataset.upgraded) {
componentHandler.upgradeElement(el);
@eirikb
eirikb / load-vue-components-from-folder.js
Created May 24, 2017 19:24
Load all Vue components from a given folder, no need for an "index.js"-file
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
eirikb / Dockerfile
Created August 3, 2017 13:25
Arch Linux AUR in Docker
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
eirikb / .sassrc.js
Created March 15, 2018 09:24
Demo of parcel + scss
const path = require('path');
const cwd = process.cwd();
module.exports = {
"includePaths": [
path.resolve(cwd, 'node_modules'),
path.resolve(cwd, 'src')
]
};
@eirikb
eirikb / 0-PXE-VDI-LTSP.md
Last active May 18, 2018 07:11
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.  

Client

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

sudo apt-get -y install ltsp-client-core

@Francesco149
Francesco149 / docker-cross-device-link.md
Last active October 27, 2023 08:51
docker error creating new backup file '/var/lib/dpkg/status-old': Invalid cross-device link
@eirikb
eirikb / 2019-2020-kommuenummer-postnummer.md
Last active January 3, 2020 19:34
2019 2020 kommuenummer postnummer
@eirikb
eirikb / 2019-2020-knr-gnr.js
Last active January 7, 2020 13:51
Matrikkel: Oppslag nye kommunenummer (knr) og gårdsnummer (gnr) fra 2019 mot nye i 2020
const data = require('./2019-2020-knr-gnr.json');
/**
* @typedef {Object} Matrikkel
* @property {string} knr - Kommunenummer
* @property {number} gnr - Gårdsnummer
*/
function sanitizeKnr(knr) {
return String(knr || '').padStart(4, '0');
@eirikb
eirikb / normalize-table.js
Last active January 10, 2020 20:16
DOM normailzation of table rows - creates a matrix with duplicate cells based on rowspan colspan
module.exports = table => {
const res = [];
table.querySelectorAll('tbody tr').forEach((row, y) =>
row.querySelectorAll('td').forEach((cell, x) => {
const rowspan = Number(cell.getAttribute('rowspan') || 1);
const colspan = Number(cell.getAttribute('colspan') || 1);
while (res[y] && res[y][x]) x++;
for (let yy = y; yy < y + rowspan; yy++) {
const resRow = res[yy] = res[yy] || [];