Skip to content

Instantly share code, notes, and snippets.

View Boltovnya's full-sized avatar

Erin Murphy Boltovnya

View GitHub Profile
import codecs
import pyocr
import pyocr.builders
import sys
try:
src = sys.argv[1]
dest = sys.argv[2]
except IndexError:
raise SystemExit("Specify both files")
from machine import Pin, I2C
import ssd1306
from collections import deque
import time
key_0 = Pin(14, Pin.IN, Pin.PULL_UP)
key_1 = Pin(15, Pin.IN, Pin.PULL_UP)
key_en = Pin(21, Pin.IN, Pin.PULL_UP)
i2c = I2C(0, sda=Pin(16), scl=Pin(17))
@Boltovnya
Boltovnya / Dashboard.js
Created June 20, 2022 22:45
Funky react issue
import React from "react";
import Sidebar from "./Layout/Sidebar";
const items = [
{
link: "/",
icon: "columns",
name: "Dashboard",
},
{
csiDriver:
# should be globally unique for a given cluster
name: "org.democratic-csi.iscsi"
controller:
driver:
logLevel: debug
rbac:
openshift:
privileged: true
@Boltovnya
Boltovnya / day1.py
Created December 3, 2021 18:32
Advent of Code 2021
import numpy as np
import numpy.lib.stride_tricks as strides
def gen_slides(arr, size):
return strides.sliding_window_view(arr, size)
def load_file(name):
return np.fromfile(name, sep="\n")
def part1(arr):
import numpy as np
import numpy.lib.stride_tricks as strides
def gen_slides(arr, size):
return strides.sliding_window_view(arr, size)
def load_file(name):
return np.fromfile(name, sep="\n")
def part1(arr):
import numpy as np
import numpy.lib.stride_tricks as strides # adds sliding window iteration
def load_data(infile: str) -> np.ndarray:
"""Loads data from file, and returns a numpy array"""
return np.fromfile(infile, sep="\n")
def gen_matrix(arr: np.ndarray) -> np.ndarray:
kind: ImageStream
apiVersion: image.openshift.io/v1
metadata:
annotations:
openshift.io/display-name: golang-1-14-12
name: golang-1-14-12
spec:
tags:
- name: latest
annotations:
---
- name: Create filesystem
hosts: all
become: yes
tasks:
- name: create!
community.general.filesystem:
dev: /dev/sdb
fstype: xfs
state: present
def part1(joltages: IndexedSeq[Int]): Int = {
def findJolts(it: Int = 0, jo: IndexedSeq[Int] = joltages, on: IndexedSeq[Int] = IndexedSeq(), tr: IndexedSeq[Int] = IndexedSeq()): (IndexedSeq[Int], IndexedSeq[Int]) =
@tailrec
def iter(i: Int, j: IndexedSeq[Int], o: IndexedSeq[Int], t: IndexedSeq[Int]): (IndexedSeq[Int], IndexedSeq[Int]) =
val tup = (j.sorted filter((x: Int) => (x - i == 1) | (x - i == 3))).head match {
case x if i + 1 == x => (x, o :+ x, t)
case x if i + 3 == x => (x, o, t:+ x)
if (tup._2.size + tup._3.size == j.length) return (tup._2, tup._3)
iter(tup._1, j.filter(_ != tup._1), tup._2, tup._3)
iter(it, jo, on, tr)