Skip to content

Instantly share code, notes, and snippets.

John Ellis deckerego

Block or report user

Report or block deckerego

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
deckerego /
Created Nov 5, 2019
Audio level meter with Circuit Playground Express
import array
import math
import time
import neopixel
import audiobusio
import board
def avg(values):
return sum(values) / len(values)
deckerego /
Created Nov 4, 2019
Use a remote control to change the lights on a Circuit Playground Express
import pulseio
import board
import time
import neopixel
import adafruit_irremote
power = True
color = (255, 255, 255)
brightness = 0.1
deckerego /
Created Nov 4, 2019
Create a campfire effect with a Circuit Playground Express. Copy a crackle.wav audio file for the sound effect, and toggle the switch to mute/unmute.
from time import sleep
from random import random
from neopixel import NeoPixel
from digitalio import DigitalInOut, Direction, Pull
from audioio import WaveFile
from audioio import AudioOut
from simpleio import map_range
# NeoPixels
deckerego /
Created Nov 2, 2019
Multi-sensor Feedback with Circuit Playground Express
# Circuit Playground NeoPixel
import time
import board
import neopixel
import busio
import analogio
import digitalio
import simpleio
import adafruit_thermistor
import adafruit_lis3dh
deckerego /
Created Feb 21, 2019
Finding an unused port, starting at 1080
netstat -aln | awk '
$6 == "LISTEN" {
if ($4 ~ "[.:][0-9]+$") {
len=split($4, a, /[:.]/);
port = a[len];
p[port] = 1
for (i = 1080; i < 65000 && p[i]; i++){};
deckerego / slack.js
Created Sep 14, 2018
Send a Message to Slack
View slack.js
'use strict';
const https = require('https');
class Slack {
constructor(slackPath) {
this._options = {
hostname: "",
method: "POST",
path: slackPath,
deckerego / tokenCount.js
Created Sep 3, 2018
Count token frequency (word count) for a string in JavaScript
View tokenCount.js
var testString = "cat you cat are a cat who is a cat nope not a cat";
var tokenized = testString.split(" ");
var tokenFreq = tokenized.reduce((acc, val) => { acc[val] ? acc[val]++ : acc[val] = 1; return acc; }, {});
Object.entries(tokenFreq).forEach(entry => console.log(entry[0], ": ", entry[1]));
deckerego / JSTest.swift
Created Jun 14, 2018
Example of executing JavaScript in iOS using Swift
View JSTest.swift
let context = JSContext()!
let myNumber = 12
context.setObject(myNumber, forKeyedSubscript: "myNumber" as NSString)
let result = context.evaluateScript("myNumber + 20;")
print("JavaScript eval: \(result!.toInt32())")
deckerego /
Created May 29, 2018
Upgrade Node.JS on MacOS
node --version
npm install -g n
npm cache clean -f
sudo n stable
npm update -g
deckerego /
Created Mar 29, 2018
Update & package a Helm chart
helm dependency update
helm package -d "$HELM_CHART_DIR" .
helm repo index "$HELM_CHART_DIR"
You can’t perform that action at this time.