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
// 5x5 image | |
const image = [ | |
[1, 2, 3, 4, 5], | |
[5, 4, 3, 2, 1], | |
[0, 2, 4, 6, 8], | |
[8, 6, 4, 2, 0], | |
[3, 4, 5, 2, 1], | |
]; | |
// seeded for horizontal edge-detection |
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
// NOT: given | |
// OR: given | |
// NOR: derived | |
// AND: derived | |
// NAND: derived | |
// XOR: derived | |
// XNOR: derived | |
function nor(x: boolean, y: boolean): boolean { | |
return !(x || y); |
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 collections import OrderedDict # this is awesome | |
class LRU(object): | |
def __init__(self, capacity: int): | |
self.capacity = capacity | |
self.xs = OrderedDict() | |
def __repr__(self): | |
return f"; ".join(f"{k}: {v[0]} ({v[1]})" for k, v in self.xs.items()) |
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 job_shop(): | |
machines = [ | |
Machine(cmm_id="1"), | |
Machine(cmm_id="2"), | |
] | |
jobs = [ | |
Job(job_id="431", instances=3, duration_min=20), | |
Job(job_id="459", instances=1, duration_min=100), # ??? | |
Job(job_id="449", instances=10, duration_min=40), |
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 { useForm } from "react-hook-form"; | |
import { z } from "zod"; | |
import { zodResolver } from "@hookform/resolvers/zod"; | |
import DimensionID from "lib/quality/DimensionID"; | |
//////////////////////////////////////////////////////////////////////////////// | |
// Main | |
//////////////////////////////////////////////////////////////////////////////// |
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
input: | |
sql_raw: | |
driver: mssql | |
dsn: sqlserver://${USER}:${PASS}@some.place.com | |
query: | | |
select * from blah | |
output: | |
file: | |
path: '/tmp/stuff/${! json("filename") }' |
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
{ | |
"series": [ | |
{ | |
"metric": "corp.service.heartbeat", | |
"type": 3, | |
"points": [ | |
{ | |
"timestamp": timestamp_unix(), | |
"value": 1, | |
} |
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
input: | |
file: | |
paths: | |
- /tmp/versions.json | |
codec: all-bytes | |
processors: | |
- jq: | |
query: '.[] | select( .Name | contains("Needle") ) | {"name": .Name, "key": .Key}' | |
- unarchive: | |
format: json_array |
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
- cmd: man passwd | |
when: 1653257918 | |
- cmd: sudo passwd | |
when: 1653257918 | |
- cmd: passwd | |
when: 1653257918 | |
- cmd: sudo vim /etc/nixos/configuration.nix | |
when: 1653257918 |
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
http: | |
enabled: false | |
input: | |
file: | |
paths: | |
- /tmp/errors.json | |
codec: all-bytes | |
processors: | |
- unarchive: |
NewerOlder