Skip to content

Instantly share code, notes, and snippets.

View Yona-Appletree's full-sized avatar

Yona Appletree Yona-Appletree

View GitHub Profile
@Yona-Appletree
Yona-Appletree / HSLColor.java
Last active August 3, 2023 04:41
HSL Color Class for Java
import java.awt.Color;
//
// Sourced from http://www.camick.com/java/source/HSLColor.java
//
//
// LICENSE (from https://tips4java.wordpress.com/about/)
//
// We assume no responsibility for the code. You are free to use and/or
{
"@context": "https://w3id.org/openbadges/v2",
"badge": "https://gist.githubusercontent.com/Yona-Appletree/7123d59a869866cf97411025a33bcf56/raw/badge.json?x=3",
"id": "https://gist.githubusercontent.com/Yona-Appletree/7123d59a869866cf97411025a33bcf56/raw/assertion.json?x=3",
"image": "https://api.staging.badgr.dev/public/assertions/1fPp3ghSQ3OFZG9JZLfP9A/image",
"issuedOn": "2020-07-01T00:00:00-07:00",
"recipient": {
"hashed": true,
"identity": "sha256$8cace3031e09d0d1f8d0d1cfcc193cde41b1c970b2e37ac7bdf11a61076dc0d1",
"type": "email"
#!/usr/bin/env node
const fs = require("fs");
const child_process = require("child_process");
const project = detectProject(process.argv[2] || ".");
if (! project) {
process.exit(1);
}
showDialog();
function showDialog() {
const form = document.createElement("form");
const textarea = document.createElement("textarea");
textarea.style.width = "100%";
textarea.style.height = "25em";
const button = document.createElement("button");
button.innerText = "Submit";
textarea.style.display = "block";
/**
* Helper for building strings using mongo update operators. By declaring all the operators as variables in this object,
* they can be used without special escape. e.g. MongoUpdateString { """{$set:{"name":"Luke Skywalker"}}""" }
*/
object MongoUpdateString {
inline operator fun invoke(callback: MongoUpdateString.() -> String) = callback()
val currentDate = "\$currentDate"
val inc = "\$inc"
@Yona-Appletree
Yona-Appletree / README.md
Last active August 8, 2017 19:52
LEDscape Image Instructions

LEDscape Arch Image

Download and flash the image

  1. Download the image: https://www.dropbox.com/s/aypd417ffrkul26/ledscape-arch-linux.img.xz

  2. Flash it to an sd card, where /dev/rdiskN is the device node of your SD card

    xz -dc ledscape-arch-linux.img.xz | sudo dd of=/dev/rdiskN bs=4m

Boot the Beaglebone from the SD Card:

  1. Power off the beaglebone,
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Yona-Appletree
Yona-Appletree / geodesic.scad
Last active March 16, 2021 02:35
Geodesic slicing using geodesic library from thing:10725
include <platonic.scad>
//////////////////////////////////////////////////////////////////////////////////////////////////
// Matrix Math Helpers
function remove(list, removeI, i=0) = (i >= len(list))
? []
: concat(i==removeI?[]:[list[i]], remove(list, removeI, i+1));
function det(m) = let(r=[for(i=[0:1:len(m)-1]) i]) det_help(m, 0, r);
function det_help(m, i, r) = len(r) == 0 ? 1 :
@Yona-Appletree
Yona-Appletree / gist:ecf74d65f7cc09eaad46
Created May 25, 2015 20:14
Turtle shape function for openSCAD
function sum(parts, i=0) = (i < len(parts)-1) ? (parts[i] + sum(parts, i+1)) : parts[i];
function turtlePoints(
commands,
i = 0,
prev = [0,0]
) = let(
s = sum(commands[i]),
current = i == 0 ? s : (prev + s)
) concat(
@Yona-Appletree
Yona-Appletree / ws2811_bridge.ino
Created September 9, 2013 02:56
A simple Arduino program which uses Adafruit's NeoPixel library to relay serial-level RGB data to a series of WS2811-compatible LED modules attached to an output pin. The use of Adafurit's library requires double buffering in the serial-receive code, reducing the number of LEDs that can be driven with a single Arduino. It's possible that code co…
// include the neo pixel library
#include <Adafruit_NeoPixel.h>
// The number of LEDs being driven. This dictates how much data is expected in each frame read from the serial port.
static const int NUM_LEDS = 256;
// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_RGB Pixels are wired for RGB bitstream