Skip to content

Instantly share code, notes, and snippets.

View jaylandro's full-sized avatar
.

jay landro jaylandro

.
View GitHub Profile
graph
subgraph Cluster[Target Kubernetes Cluster<br><br>]
    Verification(Pod: Node Drain Verification )
    ctpl(Control Plane)
    n0(Node0<br>Pods: a,b,c,d,g,h)
    n1(Node1<br>Pods: e,f,g,h)
    n1final(Node1)
    n2(Node2<br>Pods: i,j,k,l,e,f)
graph LR
subgraph Verification[Kafka Verification: Client Latency<br><br><br><br>]
    subgraph Customer Kafka
        brokers(Topic: VERICA-CLIENT-LATENCY)
    end
    subgraph Client Latency Producer Pod        
        P{Producer} --> L1(TC Latency) -.-> | Configured Latency | brokers
    end
 subgraph Client Latency Consumer Pod 
@jaylandro
jaylandro / markdown-parser.js
Created May 24, 2022 11:15
Markdown parser JavaScript
function parseMarkdown(markdownText) {
const htmlText = markdownText
.replace(/^### (.*$)/gim, '<h3>$1</h3>')
.replace(/^## (.*$)/gim, '<h2>$1</h2>')
.replace(/^# (.*$)/gim, '<h1>$1</h1>')
.replace(/^\> (.*$)/gim, '<blockquote>$1</blockquote>')
.replace(/\*\*(.*)\*\*/gim, '<b>$1</b>')
.replace(/\*(.*)\*/gim, '<i>$1</i>')
.replace(/!\[(.*?)\]\((.*?)\)/gim, "<img alt='$1' src='$2' />")
.replace(/\[(.*?)\]\((.*?)\)/gim, "<a href='$2'>$1</a>")
@jaylandro
jaylandro / geolocation-weather-cloudflare.js
Created May 24, 2022 02:20
Geolocation based weather rendered on-demand at the edge with Cloudflare workers
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request));
});
async function handleRequest(request) {
// https://api.weather.gov/points/38.8894,-77.0352
const { latitude, longitude } = request.cf;
const headers = {
'content-type': 'application/json',
'User-Agent': ('landro.dev', '[email protected]')
@jaylandro
jaylandro / emoji-weather-map.js
Created April 9, 2022 23:12
Javascript object map of weather conditions and emoji
const emojiMap = {
'cloudy': '☁️',
'fog': '🌫',
'lightrain': '🌦',
'partlyCloudy': '🌤',
'rain': '🌧',
'snow': '🌨',
'sunny': '☀️',
'thunderstorms': '⛈',
'wind': '💨'
@jaylandro
jaylandro / install-nodejs-on-raspberrypi-armv6.md
Last active March 8, 2022 17:57 — forked from davps/install-nodejs-on-raspberrypi-armv6.md
Steps to install nodejs on Raspberry Pi B+ (armv6)

Steps to install nodejs v6.2 on Raspberry Pi B+ (armv6)

cd ~
wget http://nodejs.org/dist/v6.2.1/node-v6.2.1-linux-armv6l.tar.gz
tar -xzf node-v6.2.1-linux-armv6l.tar.gz
node-v6.2.1-linux-armv6l/bin/node -v

The last command should print v6.2.1.

Now you can copy it to /usr/local

@jaylandro
jaylandro / 16x8-LED-backpack-draw-matrix-array.py
Created March 4, 2022 20:24
Use a 2 dimensional array to display images on a 16x8 led matrix display (Adafruit, QtPy, LED backpack) CircuitPython
# Import all board pins.
import time
import board
import busio
from adafruit_ht16k33 import matrix
i2c = busio.I2C(board.SCL, board.SDA)
matrix = matrix.MatrixBackpack16x8(i2c)
@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