Skip to content

Instantly share code, notes, and snippets.

View remcoder's full-sized avatar
👓
software engineer -- obsessed with 3d printing

Remco Veldkamp remcoder

👓
software engineer -- obsessed with 3d printing
View GitHub Profile
let prevGCmd = null;
const previewCode = gcode
.split('\n')
.map((i) => {
const line = i.trim();
let result = line;
if (line.charAt(0) == 'G') {
const gCmd = new RegExp(/G\d+/g);
let prevGCmd = null;
const previewCode = gcode
.split('\n')
.map((i) => {
const line = i.trim();
let result = line;
if (line.startsWith('G20')) { // keep as is
return result;
}
### Keybase proof
I hereby claim:
* I am remcoder on github.
* I am remcoder (https://keybase.io/remcoder) on keybase.
* I have a public key ASBDlmmbx10FUv-0UQt1gbgecJ-rPFYJbTQdNGCm_KpH5wo
To claim this, I am signing this object:
@remcoder
remcoder / toy-attiny-leds.ino
Created June 12, 2016 22:35
My son's 'roadblock with lights' toy broke. So decided to fix it and while at it I though to myself, why not spice it up a little bit by adding a micro to it?
#include <avr/sleep.h>
// Utility macros
#define adc_disable() (ADCSRA &= ~(1<<ADEN)) // disable ADC (before power-off)
#define adc_enable() (ADCSRA |= (1<<ADEN)) // re-enable ADC
const int ledPin1 = 1;
const int ledPin2 = 2;
@remcoder
remcoder / toy-attiny-leds.ino
Created June 12, 2016 22:35
My son's 'roadblock with lights' toy broke. So decided to fix it and while at it I though to myself, why not spice it up a little bit by adding a micro to it?
#include <avr/sleep.h>
// Utility macros
#define adc_disable() (ADCSRA &= ~(1<<ADEN)) // disable ADC (before power-off)
#define adc_enable() (ADCSRA |= (1<<ADEN)) // re-enable ADC
const int ledPin1 = 1;
const int ledPin2 = 2;
@remcoder
remcoder / nodemcu build script
Last active June 20, 2016 14:15
Fast, incremental Lua uploads for nodemcu
Fast, incremental Lua uploads for NodeMCU
INSTALLATION
1. This script requires nodemcu-uploader and gulp to be installed globally:
$ npm install -g gulp
$ npm install -g nodemcu-tool
$ pip install nodemcu-uploader
@remcoder
remcoder / welcome
Last active August 29, 2015 14:14
DemocratieLAB Welcome Screen Updates reactively
Classes = new Mongo.Collection(‘classes’);
Classes.insert({
location: "Aa en Hunze",
schoolType: "Basisonderwijs",
route: "42",
active: true
});
<button data-action=continue
@remcoder
remcoder / registerUnderscoreHelpers
Last active August 29, 2015 14:05
Meteor / Blaze: register all of Underscore's methods as template helpers
function registerUnderscoreHelpers() {
for (key in _) {
var prop = _[key];
if (typeof(prop) == 'function' ) {
createUnderscoreHelper(key, prop);
}
}
}
// Spacebars always passes an extra argument to the helper, an
@remcoder
remcoder / kitt_scanner.ino
Last active May 23, 2019 01:23
ATTiny85 KITT scanner with 12 LEDs
// A KITT scanner made out of 12 deep red LEDs hooked up to nothing but an ATTiny85.
// It leverages the magic of charlieplexing to enable the ATTiny to drive those 12 LED's with just 4 pins.
//
// video: http://www.youtube.com/watch?v=MYvrKLcG-Vg
const int blue = 0;
const int green = 1;
const int red = 2;
const int white = 3;
@remcoder
remcoder / game of life with 8x8 bicolor led matrix
Last active September 23, 2016 12:02
I recently got one of those 8x8 LED matrices and I was playing with some Game of Life patterns when I found this pretty repeating pattern. I found it by starting with some random patterns. If you look closely you can see the pattern becoming a mirrored version of itself halfway through. Apparently the pattern doesn't repeat like this on an infin…
/*
I recently got one of those 8x8 LED matrices and I was playing with some Game of Life patterns when I found this pretty repeating pattern. I found it by starting with some random patterns. If you look closely you can see the pattern becoming a mirrored version of itself halfway through. Apparently the pattern doesn't repeat like this on an infinite grid but on this wrapping 8x8 grid it does ;-)
FYI, the LED matrix is a bicolor one (green/red) and has an I2C interface (http://www.adafruit.com/products/902). I'm using the colors as follows:
- newly created cells are green
- cells that are at least 10 generations old are red
- other living cells are yellow (simultaneously green+red)
It's hookup up to my Arduino Uno r3.