Skip to content

Instantly share code, notes, and snippets.

@rjeli
rjeli / app.tsx
Created October 23, 2024 19:11
fun fun fun
import { Grid, Instance, InstancedAttribute, Instances, OrbitControls, PerformanceMonitor, shaderMaterial, Stats, StatsGl } from "@react-three/drei";
import { Canvas, createRoot, events, extend, ThreeElements, useFrame } from "@react-three/fiber";
import { useControls } from "leva";
import GUI from "lil-gui";
import React, { useEffect, useRef, useState } from 'react';
import * as THREE from 'three';
extend(THREE);
console.log('hi');
@rjeli
rjeli / towers.rs
Last active April 27, 2024 10:43
towers lol
use std::{
marker::PhantomData,
ops::{Add, Mul},
};
trait Field: Copy + Default + Add<Output = Self> + Mul<Output = Self> {}
/*
We want a TowerField struct, such that it can be multiplied by itself or any subfield.
@rjeli
rjeli / solve.py
Last active March 29, 2024 19:40
DominoFit z3 solver
#!/usr/bin/env python3
import z3
import itertools
SIZE = 7
top = [2, 7, 4, 3, 6, 4, 5]
side = [6, 5, 2, 5, 6, 1, 6]
blacks = [
(0, 6), (1, 6), (2, 6),
#!/usr/bin/env python3
import time
import evdev
from evdev import ecodes
SCROLL_FRAC = 0.1
if __name__ == '__main__':
devs = [evdev.InputDevice(path) for path in evdev.list_devices()]
dev = None
@rjeli
rjeli / main.cpp
Created August 24, 2019 00:43
freeing worker resources
// g++ -std=c++11 main.cpp -lpthread -o main && ./main
#include <iostream>
#include <thread>
#include <atomic>
#include <chrono>
class BackgroundTask {
public:
BackgroundTask() : done_(false),
worker_(&BackgroundTask::worker_main, this) {}

Keybase proof

I hereby claim:

  • I am rjeli on github.
  • I am rjeli (https://keybase.io/rjeli) on keybase.
  • I have a public key ASAcHZq4pvBCkWtaLl7lzqxAF1Uz7Hgr3flGCQswvhDefAo

To claim this, I am signing this object:

inputs = [
'1 + 1',
'2 * 2',
'1 + 2 * 3',
'( 1 + 2 ) * 3'
]
def pemdas(s):
ops = { op: p for p, l in enumerate(['+-', '*/']) for op in l }
ostk = []
private class CountingLogger<T> implements Function<T, T> {
private int every;
private int count;
private Function<Integer,String> message;
public CountingLogger(int every, Function<Integer,String> message) {
this.every = every;
this.message = message;
this.count = 0;
package com.eli.testproject;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class Test {
public static void main(String[] args) {
List<Integer> nums = new ArrayList<>();