Skip to content

Instantly share code, notes, and snippets.

View jaylandro's full-sized avatar
.

Jay jaylandro

.
  • msp
View GitHub Profile
@jaylandro
jaylandro / Adafruit_SH1107.ino
Created February 21, 2022 15:35
Adafruit_SH1107 for Arduino IDE and Qt PY
/*********************************************************************
This is an example for our Monochrome OLEDs based on SH1107 drivers
This example is for a 128x128 size display using I2C to communicate
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
@jaylandro
jaylandro / code.py
Created February 20, 2022 00:21
Qtpy simple blink example circuit python
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
Blink example for boards with ONLY a NeoPixel LED (e.g. without a built-in red LED).
Includes QT Py and various Trinkeys.
Requires two libraries from the Adafruit CircuitPython Library Bundle.
Download the bundle from circuitpython.org/libraries and copy the
@jaylandro
jaylandro / QtPy Circuit Python M0 External LED Blink
Created February 9, 2022 06:42
QtPy Circuit Python M0 External LED Blink
# -------------------------------------------------------------------- #
# CircuitPython Analog In detection set RGB to random color example
# -------------------------------------------------------------------- #
import time, board, neopixel, random
from analogio import AnalogIn
analog_in = AnalogIn(board.A1)
led = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=1)
@jaylandro
jaylandro / json-schema-validator.js
Created March 14, 2021 00:26
JSON Schema Validatior
const rootSchema = {
$schema: "http://json-schema.org/draft-04/schema#",
title: "Person",
description: "A person",
type: "object",
properties: {
name: {
description: "A person's name",
type: "string",
},
@jaylandro
jaylandro / sym-array-diff.js
Last active March 13, 2021 22:04
Symmetrical Array diff in JavaScript
function arrayDiffSym(arr1, arr2) {
return [
...arr1.filter(item => !arr2.includes(item)),
...arr2.filter(item => !arr1.includes(item)),
];
}
@jaylandro
jaylandro / todo.js
Created March 10, 2021 06:42
Super minimal state w/ proxy
window.subscribers = [];
const defaultState = {
todos: []
};
const state = new Proxy(defaultState, {
set(state, key, value) {
const oldState = { ...state };
function sum(arr) {
return arr.reduce((a,b) => a + b);
}
function throttle(fn, ms) {
let pending = false;
return () => {
if (!pending) {
fn();
@jaylandro
jaylandro / geoip.sh
Created September 25, 2020 03:38
Get GeoIp details w/ CURL
curl ifconfig.co/json | jq
curl ifconfig.co/json | json_pp