This file contains 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 codecs | |
import pyocr | |
import pyocr.builders | |
import sys | |
try: | |
src = sys.argv[1] | |
dest = sys.argv[2] | |
except IndexError: | |
raise SystemExit("Specify both files") |
This file contains 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 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)) |
This file contains 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 React from "react"; | |
import Sidebar from "./Layout/Sidebar"; | |
const items = [ | |
{ | |
link: "/", | |
icon: "columns", | |
name: "Dashboard", | |
}, | |
{ |
This file contains 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
csiDriver: | |
# should be globally unique for a given cluster | |
name: "org.democratic-csi.iscsi" | |
controller: | |
driver: | |
logLevel: debug | |
rbac: | |
openshift: | |
privileged: true |
This file contains 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 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): |
This file contains 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 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): |
This file contains 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 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: |
This file contains 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
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: |
This file contains 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
--- | |
- name: Create filesystem | |
hosts: all | |
become: yes | |
tasks: | |
- name: create! | |
community.general.filesystem: | |
dev: /dev/sdb | |
fstype: xfs | |
state: present |
This file contains 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
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) |
NewerOlder