Skip to content

Instantly share code, notes, and snippets.

import random
import ssl
import websockets
import asyncio
import os
import sys
import json
import argparse
import gi
FROM ubuntu:bionic
ARG GST_VERSION=master
ARG PREFIX=/usr
ENV TZ=Europe/Vienna
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN export TERM=linux DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true
#COPY apt-preferences /etc/apt/preferences
#RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local
#RUN echo 'deb http://ftp.de.debian.org/debian testing main' >> /etc/apt/sources.list
const fs = require('fs');
const inputs = {
test1:
`
1,-1,-1,-2
-2,-2,0,1
0,2,1,3
-2,3,-2,1
0,2,3,-2
const c1 = 15466939;
const c2 = 65899;
//const s = 5285447;15615244;
const nums = [];
const dupes = [];
let [r1, r2, r3, r4, r5] = [0, 0, 0, 0, 0];
let hits = 0;
L6: while(true) {
const fs = require('fs');
const dirs = {
E: { x: 1, y: 0 },
W: { x: -1, y: 0 },
S: { x: 0, y: 1 },
N: { x: 0, y: -1 }
};
const inputs = {
test1: "^ESSWWN(E|NNENN(EESS(WNSE|)SSS|WWWSSSSE(SW|NNNE)))$",
// C ← op(A, B)
let beforeIp;
let ip = 0;
let ipReg;
const regs = [1, 0, 0, 0, 0, 0];
const instructions = {
setIp: (value, regs) => { beforeIp = regs[value]; ipReg = value; regs[value] = ip; },
seti: ([a,b,c], r) => r[c] = a,
#include <fstream>
#include <iostream>
#include <map>
#include <string>
int main() {
int twos = 0;
int threes = 0;
std::string line;
const fs = require('fs');
const [DEATH, LIFE, VOID] = [1, 2, 3];
const board = fs.readFileSync('aoc-input-18', 'utf-8')
.trim()
.split('\n')
.map(line => line.split('')
.map(c =>
c === '|' ? LIFE
#include <fstream>
#include <iostream>
#include <vector>
bool isIn(const int& x, const std::vector<int>& xs)
{
int size = (int)xs.size();
for(int i = 0; i < size; ++i) {
if(x == xs[i]) {
#include <fstream>
#include <iostream>
#include <vector>
bool isIn(int x, std::vector<int> xs)
{
int size = (int)xs.size();
for(int i = 0; i < size; ++i) {
if(x == xs[i]) {