Skip to content

Instantly share code, notes, and snippets.

View AndreSteenveld's full-sized avatar

Andre Steenveld AndreSteenveld

View GitHub Profile
@AndreSteenveld
AndreSteenveld / c3mro.nut
Last active August 29, 2015 14:01
An implementation of C3mro for squirrel
function C3( ... ){
function c3Merge( supers ){
function head( candidate, sequences ){
foreach( sequence in sequences )
if( sequence.slice( 1 ).find( candidate ) != null )
return false;
@AndreSteenveld
AndreSteenveld / jasmine.usp
Created June 19, 2016 16:31
Clone of jasmine json parser for crestron SIMP+
//
// Author: Andre Steenveld (andre.steenveld-at-gmail.com)
//
// Summary:
// This is an adopted copy of the jasmine JSON parser for SIMPL+ so that it works on crestron machines.
// Jasmine was orginally written in C and can be found at: https://github.com/zserge/jsmn
//
// Full license text:
// MIT License
//
@AndreSteenveld
AndreSteenveld / check-for-key-in-object.js
Created August 1, 2016 18:05
Checking for a key in a javascript object
// To quickly check the result of this file run it in the babel-repl which can be found at: https://babeljs.io/repl/
// This script can be found the with the following link: https://babeljs.io/repl/#?evaluate=true&lineWrap=false&presets=es2015%2Creact%2Cstage-0%2Cstage-1%2Cstage-2%2Cstage-3&experimental=true&loose=false&spec=false&code=%0Aconst%0A%20%20%20%20object_with_value%20%3D%20%7B%20value%20%3A%20false%20%7D%2C%0A%20%20%20%20object_with_getter%20%3D%20%7B%20%0A%0A%20%20%20%20%20%20%20%20get%20value(%20)%7B%20%0A%20%20%20%20%20%20%20%20%20%20%20%20console.log(%20%22Tripped%20the%20getter%22%20)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20false%3B%0A%20%20%20%20%20%20%20%20%7D%20%0A%0A%20%20%20%20%7D%2C%0A%0A%20%20%20%20instance_with_value%20%3D%20Object.create(%20object_with_value%20)%2C%0A%20%20%20%20instance_with_getter%20%3D%20Object.create(%20object_with_getter%20)%3B%0A%0A%2F%2F%0A%2F%2F%20What%20we%20are%20looking%20for%20is%20a%20way%20to%20check%20the%20presence%20of%20a%20property%20and%2
@AndreSteenveld
AndreSteenveld / OAuth2-server.js
Created August 7, 2016 12:38
Stubbed out the OAuth2-server model
/**
* @typedef Client
* @type Object
* @property {String} id
* @property {String[]} grants
* @property {String[]} redirectUris
*/
/**
* @typedef User
@AndreSteenveld
AndreSteenveld / .babelrc
Last active April 5, 2017 11:44
Decorating properties with computed names
{
"presets": [ "es2015", "stage-1" ],
"plugins": [ "transform-decorators-legacy" ]
}
@AndreSteenveld
AndreSteenveld / README.md
Created November 6, 2017 10:23
Getting started with TKL LAMP and the VBox additions
  1. Download the LAMP image from https://www.turnkeylinux.org/lampstack
  2. After importing the machine make sure to add a optical device (DVD/CDROM) and add the directory you would like to share in the shared directories section of the machine.
  3. After running through the TKL setup open a root shell (using web admin, ssh, or the vbox virtual screen) and run the following
  • # apt-get update && apt-get upgrade
  • # apt-get install dkms build-essential module-assistant bzip2
  • # m-a prepare Will prepare the kernal for building modules
  1. After installing the packages mount the guest addition (create a mount point and mount it)
  • # mkdir /media/cdrom, Make sure to create the mountpoint first
  • # mount /dev/sr0 /media/cdrom
  1. Run the installer for the guest addtions
@AndreSteenveld
AndreSteenveld / poor-cow.sh
Created November 30, 2017 12:01
Poor man's COW
#!/bin/bash
# Exit if something totally fails
set -e
source_directroy="$( readlink -e $1 )"
target_directory="$( readlink -e $2 )"
overlay_directory="$( readlink -e $3 )"
df --output=target | grep "$target_directory" | xargs -L1 umount -f
@AndreSteenveld
AndreSteenveld / update-hosts.sh
Last active January 19, 2020 09:07 — forked from mpneuried/update-hosts.sh
A small shell script that will add and remove lines from the hosts file. Originally created by Claus Witt, http://clauswitt.com/319.html.
#! /bin/sh
# @author: Claus Witt
# http://clauswitt.com/319.html
# Adding or Removing Items to hosts file
# Use -h flag for help
DEFAULT_IP=127.0.0.1
IP=${3:-$DEFAULT_IP}
@AndreSteenveld
AndreSteenveld / sr
Last active October 28, 2021 08:05
Flatten multiple tar files in to a single tar file
#!/usr/bin/env bash
set -e
declare entrypoint="" ; entrypoint=$( readlink -f "${BASH_SOURCE[0]}" 2>/dev/null || echo "$0" )
sr_steam_roller() {
@AndreSteenveld
AndreSteenveld / input.yml
Last active August 26, 2020 13:56
The YTT experiments
version: '3.7'
---
#@ load( "@ytt:overlay", "overlay" )
#@overlay/match by=overlay.all
#@overlay/match-child-defaults missing_ok=True
---
#@overlay/assert
version: '3.7'