Skip to content

Instantly share code, notes, and snippets.

View jakobrs's full-sized avatar

Jakob Rødal Skaar jakobrs

View GitHub Profile
#set page(width: auto, height: auto, margin: 2cm)
#{
let width = 10
let height = 10
let grid = ((false,) * width,) * height
let render_box(color) = box(
outset: -0.1cm,
radius: 4pt,
@jakobrs
jakobrs / tabell.txt
Last active March 15, 2023 14:52
Russedress.no badges tilbudstabell
Tapstabell:
Antall Kroner som kunne vært spart ved å bestille flere
0 0
1 0
2 0
3 0
4 1
5 0
6 0
7 0
#!/usr/bin/env wpexec
om = ObjectManager {
Interest {
type = "node",
Constraint { "media.class", "=", "Video/Source" },
},
Interest {
type = "node",
Constraint { "media.class", "=", "Audio/Source" },
#include <iostream>
#include <vector>
struct Count {
int at, ca, tc;
int qw;
Count() : at(0), ca(0), tc(0), qw(0) {}
inline Count operator-(Count rhs) const {
use std::path::PathBuf;
use anyhow::Result;
use clap::Parser;
use gix::date::Time;
use image::{GrayImage, Luma};
#[derive(Parser)]
struct Opts {
image: PathBuf,
import math
def fht(vector):
n = len(vector)
if n <= 1:
return vector[:]
elif n == 2:
return [vector[0] + vector[1], vector[0] - vector[1]]
@jakobrs
jakobrs / main.rs
Last active January 24, 2023 07:09
mod with_executor {
use std::{future::Future, sync::Arc, thread::JoinHandle, time::Duration};
use smol::{future, Executor, Task};
struct Handle {
executor: Arc<Executor<'static>>,
}
struct BackgroundExecutor {
use std::ops::{Deref, DerefMut, Index, IndexMut};
/// A container that can be indexed by `D`-dimensional indices.
///
/// Generic arguments:
/// - `T`: element type
/// - `C`: type of the underlying container
/// - `D`: number of dimensions
///
/// `C` must impl `Deref<Target = [T]>`, and `DerefMut` for mutable operations.
use std::io::BufRead;
trait LendingIterator {
type Item<'a>
where
Self: 'a;
fn next(&mut self) -> Option<Self::Item<'_>>;
}
@jakobrs
jakobrs / main.rs
Last active November 29, 2022 07:18
Interval partitioning problem in Rust
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
struct Interval {
start: i64,
end: i64,
}
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Debug)]
struct Endpoint {
time: i64,
end: End,