Skip to content

Instantly share code, notes, and snippets.

@cesarkawakami
cesarkawakami / minirange.cpp
Last active January 1, 2022 20:58
Bad attempt at a mini range library
#include "minirange.h"
#include <algorithm>
#include <gtest/gtest.h>
TEST(MiniRange, SimpleIotaForRange) {
std::vector<int> v;
for (auto i : mr::iota(10)) {
v.push_back(i);
}
const std::vector expected{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
@cesarkawakami
cesarkawakami / SICK_APPLICATION.txt
Last active November 13, 2018 00:38
SICK_APPLICATION
Unfortunately, I won't be of much help... :(

= How to invoke =

# Pass to verifier the input concatenated with your program's output
$ (cat in-hard1; python3 solve.py < in-hard1) | python3 verifier.py
Case #1: PASS. target=1.0, you=1.0, delta=0.0
Case #2: PASS. target=1.000001, you=1.0000009999999997, delta=2.220446049250313e-16
Case #3: PASS. target=1.000002, you=1.0000019999999998, delta=2.220446049250313e-16
Case #4: PASS. target=1.000003, you=1.0000029999999998, delta=2.220446049250313e-16
Case #5: PASS. target=1.000005, you=1.0000049999999998, delta=2.220446049250313e-16
#!/usr/bin/env python3
import subprocess
def get_monitor_name():
monitors = subprocess.run(
['xrandr', '--listmonitors'],
stdout=subprocess.PIPE,
check=True,
#!/usr/bin/env python3
from collections import deque
from math import sqrt
from sys import stdin
from typing import Optional, Tuple, Set
class RootSet:
$ git init .
Initialized empty Git repository in /home/kawakami/temp/test/.git/
$ git commit -m 'initial empty commit' --allow-empty
[master (root-commit) 6d50178] initial empty commit
$ git commit -m 'another empty commit' --allow-empty
[master 9f80fea] another empty commit
$ git commit -m 'yet another empty commit' --allow-empty
$ git init .
Initialized empty Git repository in /home/kawakami/temp/test/.git/
$ touch init
$ git add init
$ git commit -m 'initial commit'
[master (root-commit) 4c0c59e] initial commit
1 file changed, 0 insertions(+), 0 deletions(-)
def isolate_zeros(arr):
j = 0
for i in range(len(arr)):
if arr[i]:
arr[j] = arr[i]
j += 1
for i in range(j, len(arr)):
arr[i] = 0
qs
qs.dSYM
#/usr/bin/env bash
cmd="go test -bench=."
(echo '$' $cmd; $cmd) | tee results.txt