Skip to content

Instantly share code, notes, and snippets.

View mollerse's full-sized avatar
🧙‍♂️
space wizard

Stian Veum Møllersen mollerse

🧙‍♂️
space wizard
View GitHub Profile

Gratulerer med dagen, Marco!

Her er kildekoden til kortet ditt. For å kjøre den:

git clone https://gist.github.com/a64218593a12809adb9d3814adf63e58.git
cd a64218593a12809adb9d3814adf63e58
npm i get-pixels ndarray ndarray-fill ndarray-scratch zeros
npx budo marco.js
@mollerse
mollerse / example.js
Last active December 6, 2019 12:32
Simple interface for controlling various parameters with MIDI and/or dat.gui
import midiControl from "./midiControl.js";
const controls = midiControl("Launch Control MIDI 1");
function setProp(name, unit, v) {
document.documentElement.style.setProperty(name, `${v}${unit}`);
}
let setMarginXXS = setProp.bind(null, "--tv-margins-xxs", "px");
let setMarginXS = setProp.bind(null, "--tv-margins-xs", "px");
@mollerse
mollerse / README.md
Last active December 12, 2018 08:13
Intro to perlin-noise

Install

npm install -S canvas-sketch canvas-sketch-util simplex-noise

Save the code from sketch.js to a local file.

Run

@mollerse
mollerse / puzzle.pl
Last active October 31, 2018 10:27
Prolog solution(ish) to 6th grade logic puzzle
diff_known(X, Diff, Y):- Y is X + Diff.
abs_diff(X, Diff, Y):- Y is X + Diff ; Y is X - Diff.
older(X, Y):- X > Y.
drop_lie(Facts, Index, Truths):- nth0(Index, Facts, _, Truths).
% Prints program dropping a configuration of lies
print_program(L1, L2, L3):-
% Valid program:
@mollerse
mollerse / package.json
Last active February 22, 2018 14:09
Repro of stuff in node_modules/.bin disappearing with npm-ci
{
"name": "npm-ci-repro",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "rm -rf node_modules package-lock.json && npm i && ls node_modules/.bin && npm ci && ls node_modules/.bin"
},
"keywords": [],
"license": "ISC",
@mollerse
mollerse / console-log.sublime-snippet
Created March 3, 2014 08:55
ST snippet for console.log('heia')
<snippet>
<content><![CDATA[
console.log(${1:'heia'});
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>cl</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>
@mollerse
mollerse / gulpfile-express.js
Last active March 28, 2021 20:07
Gulpfile for livereload + static server
var gulp = require('gulp'),
sass = require('gulp-sass'),
browserify = require('gulp-browserify'),
concat = require('gulp-concat'),
embedlr = require('gulp-embedlr'),
refresh = require('gulp-livereload'),
lrserver = require('tiny-lr')(),
express = require('express'),
livereload = require('connect-livereload')
livereloadport = 35729,
@mollerse
mollerse / spotify_notification.py
Created August 15, 2013 10:46
Pythonscript for track-change notifications in KDE
#!/usr/bin/env python
import dbus
import gobject
from dbus.mainloop.glib import DBusGMainLoop
import time
class SpotifyNotifier(object):
def __init__(self):