Skip to content

Instantly share code, notes, and snippets.

View rhalff's full-sized avatar

Robbert Halff rhalff

  • Robbert Halff
  • Netherlands
View GitHub Profile
@rhalff
rhalff / arch_gpu_passthrough.MD
Created July 25, 2016 19:39 — forked from heppu/arch_gpu_passthrough.MD
Arch GPU passthrough

Install rpmextract

sudo pacman -Suy rpmextract

Get lates edk2.git-ovmf-x64

wget https://www.kraxel.org/repos/jenkins/edk2/edk2.git-ovmf-x64-XXXXXX.noarch.rpm
@rhalff
rhalff / ramda.js
Last active July 12, 2016 01:08
Simple FP
const requestContainer = {
request: {
headers: {
'Content-type': 'text/html'
}
},
context: {
host: 'example.com'
}
}
@rhalff
rhalff / install_latest_docker_compose.sh
Last active June 23, 2016 19:02 — forked from luislobo/install_latest_docker_compose.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
// middleware with same function signature
const middleware = [
(req, res) => {
return {
...res,
test: req.ref1
}
},
(req, res) => {
return {
@rhalff
rhalff / fp-lingo.md
Created June 1, 2016 02:07 — forked from ericelliott/fp-lingo.md
A Guide to Functional Programming Lingo for JavaScripters

A Guide to Functional Programming Lingo for JavaScripters

Functional programming gets a bad wrap about being too hard for mere mortals to comprehend. This is nonsense. The concepts are actually quite simple to grasp.

The jargon is the hardest part. A lot of that vocabulary comes from a specialized field of mathematical study called category theory (with a liberal sprinkling of type theory and abstract algebra). This sounds a lot scarier than it is. You can do this!

All examples using ES6 syntax. wrap (foo) => bar means:

function wrap (foo) {
@rhalff
rhalff / v8.md
Created March 15, 2016 23:09 — forked from kevincennis/v8.md
V8 Installation and d8 shell usage

Installing V8 on a Mac

Prerequisites

  • Install Xcode (Avaliable on the Mac App Store)
  • Install Xcode Command Line Tools (Preferences > Downloads)

Build V8

  • git clone git@github.com:v8/v8.git
@rhalff
rhalff / client.js
Created February 9, 2016 11:04 — forked from Siedrix/client.js
Tutum websocket examples
var WebSocket = require('ws');
var userPublicToken = 'apikey';
var username = 'username';
var ws = new WebSocket('wss://stream.tutum.co/v1/events?token='+ userPublicToken +'&user=' +username);
ws.on('open', function() {
console.log('Connected');
});
@rhalff
rhalff / API-Auth-With-KeystoneJS.md
Created January 24, 2016 11:15 — forked from JedWatson/API-Auth-With-KeystoneJS.md
API Auth with KeystoneJS

To implement API authentication in KeystoneJS, you need the following:

For key based authentication

  • Middleware that validates the key in the request body or a header

For session based authentication

  • An endpoint that handles signin
  • An endpoint that handles signout
@rhalff
rhalff / KeystoneApiExample.md
Created January 24, 2016 11:12 — forked from JedWatson/KeystoneApiExample.md
Example of how to scaffold API endpoints for Posts in a Keystone project (based on the yo keystone example).

This is an example of how to scaffold API endpoints to list / get / create / update / delete Posts in a Keystone website.

It's a modification of the default project created with the yo keystone generator (see https://github.com/JedWatson/generator-keystone)

Gists don't let you specify full paths, so in the project structure the files would be:

routes-index.js        -->    /routes/index.js         // modified to add the api endpoints
routes-api-posts.js    -->    /routes/api/posts.js     // new file containing the Post API route controllers
@rhalff
rhalff / gist:0283914d1231e2b7ca61
Last active December 2, 2015 23:11
Mixin & constructors
function mixin(...mixins) {
class Mixed {
constructor() {
for (let mixin of mixins) {
const props = Object.getOwnPropertyNames(mixin.prototype)
for (let prop of props) {
if (prop === 'constructor') {
// call constructor of mixin
mixin.apply(this) // fails
} else {