This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import analogio | |
import simpleio | |
import board | |
import time | |
import neopixel | |
import touchio | |
from digitalio import DigitalInOut, Direction, Pull | |
# NeoPixels | |
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, auto_write=False) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import array | |
import math | |
import time | |
import neopixel | |
import audiobusio | |
import board | |
def avg(values): | |
return sum(values) / len(values) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pulseio | |
import board | |
import time | |
import neopixel | |
import touchio | |
import adafruit_irremote | |
from digitalio import DigitalInOut, Direction, Pull | |
power = True | |
color = (255, 255, 255) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep | |
from random import random | |
from board import SPEAKER, SLIDE_SWITCH, SPEAKER_ENABLE, NEOPIXEL | |
from neopixel import NeoPixel | |
from digitalio import DigitalInOut, Direction, Pull | |
from audioio import WaveFile | |
from audioio import AudioOut | |
from simpleio import map_range | |
# NeoPixels |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Circuit Playground NeoPixel | |
import time | |
import board | |
import neopixel | |
import busio | |
import analogio | |
import digitalio | |
import simpleio | |
import adafruit_thermistor | |
import adafruit_lis3dh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
netstat -aln | awk ' | |
$6 == "LISTEN" { | |
if ($4 ~ "[.:][0-9]+$") { | |
len=split($4, a, /[:.]/); | |
port = a[len]; | |
p[port] = 1 | |
} | |
} | |
END { | |
for (i = 1080; i < 65000 && p[i]; i++){}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const https = require('https'); | |
class Slack { | |
constructor(slackPath) { | |
this._options = { | |
hostname: "hooks.slack.com", | |
method: "POST", | |
path: slackPath, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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])); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let context = JSContext()! | |
let myNumber = 12 | |
context.setObject(myNumber, forKeyedSubscript: "myNumber" as NSString) | |
let result = context.evaluateScript("myNumber + 20;") | |
print("JavaScript eval: \(result!.toInt32())") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
node --version | |
npm install -g n | |
npm cache clean -f | |
sudo n stable | |
npm update -g |