View fix-inkscape-gcode.py
import re | |
f = open('dna_pattern.gcode', 'r') | |
output = open('dna_output.gcode', 'w') | |
output.write('; Home\nG28\n') | |
for line in f: | |
line = line.strip() | |
if line[0:1] == '(': | |
output.write('; ' + re.sub(r'^\s*\(|\)\s*$', '', line) + '\n') | |
if line[0:2] == 'G0': |
View bed-mesh-test.py
from configfile import PrinterConfig | |
from extras.bed_mesh import BedMesh | |
class GCode: | |
def register_command(self, *args, **kwargs): | |
print('register_command', args, kwargs) | |
def set_move_transform(self, *args, **kwargs): | |
print('set_move_transform', args, kwargs) |
View bigquery-extract-typescript-functions.sql
-- Finds and extracts all JS functions in the bigtsquery dataset | |
CREATE TEMPORARY FUNCTION getResults(src STRING, query STRING) | |
RETURNS ARRAY<STRING> | |
LANGUAGE js AS """ | |
const { tsquery } = this.tsquery; | |
function processResult(node) { | |
const sourceFile = node.getSourceFile(); | |
const sourceCode = sourceFile.getFullText(); | |
const { line, character } = ts.getLineAndCharacterOfPosition( |
View circuitpython-mouse-hid-hello.py
import time | |
import board | |
import digitalio | |
from adafruit_hid.mouse import Mouse | |
print("Hello!") | |
led = digitalio.DigitalInOut(board.LED1) | |
led.direction = digitalio.Direction.OUTPUT | |
led.value = False |
View vr-talk-start-slide.html
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Hello, VR Friends!</title> | |
</head> | |
<body> | |
<div style=" |
View trumpet-keyboard.js
(async function() { | |
const midi = await navigator.requestMIDIAccess(); | |
const midiOutput = Array.from(midi.outputs.values()) | |
.find(o => o.name.includes('Teensy')); | |
const midiInput = Array.from(midi.inputs.values()) | |
.find(o => o.name.includes('Keystation')); | |
// Forward all MIDI events from Keyboard to trumpet | |
midiInput.onmidimessage = ({data}) => | |
midiOutput.send([data[0], data[1], data[2] ? 127 : 0]); |
View Configuration.h
/** | |
* Marlin 3D Printer Firmware | |
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] | |
* | |
* Based on Sprinter and grbl. | |
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm | |
* | |
* This program is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, either version 3 of the License, or |
View neopixel-switches.ino
#include <Adafruit_NeoPixel.h> | |
#define NUM_LEDS 6 | |
#define LEDS_PIN 9 | |
/* define pins for the switches */ | |
#define SWITCH1 4 | |
#define SWITCH2 5 | |
Adafruit_NeoPixel leds = Adafruit_NeoPixel(NUM_LEDS, LEDS_PIN, NEO_GRB | NEO_KHZ800); |
View xenon-vs1053.ino
/* | |
0.20 -> D11 [MISO] | |
0.22 -> D13 [SCK] | |
0.24 -> D10 [CS] | |
1.00 -> D12 [MOSI] | |
0.02 -> A4 [xCS] | |
1.16 -> A3 [xDCS] | |
1.13 -> A2 [dReq] | |
1.10 -> A1 [xReset] |
View web-midi-do-re-mi.js
const NOTE_ON = 0x90; | |
const NOTE_OFF = 0x80; | |
const delay = (ms) => | |
new Promise(resolve => setTimeout(resolve, ms)); | |
async function playDoReMi(midi) { | |
const midiOutput = Array.from(midi.outputs.values())[0]; | |
const notes = [60, 62, 64]; // Do-Re-Mi |