Skip to content

Instantly share code, notes, and snippets.

View KiaraGrouwstra's full-sized avatar
💁‍♀️

Kiara Grouwstra KiaraGrouwstra

💁‍♀️
  • BIJ1
  • Utrecht, the Netherlands
  • 05:26 (UTC +02:00)
View GitHub Profile
@KiaraGrouwstra
KiaraGrouwstra / arch.sh
Last active September 26, 2022 18:36
Arch install notes
# follow https://www.addictivetips.com/ubuntu-linux-tips/how-to-install-arch-linux/, except:
# - use `/dev/sdb`
# - let ext4 get 100%, not swap
# - ditch grub for systemd-boot, see https://www.addictivetips.com/ubuntu-linux-tips/set-up-systemd-boot-on-arch-linux/
# - in install step swap `xorg-server-utils` for `xorg-apps` -- just in case also install `dialog`, `dhcpcd`, `linux-firmware` and `wpa_supplicant`
# also see: https://wiki.archlinux.org/index.php/Installation_guide
# bluetooth
sudo pacman -S bluez bluez-utils
systemctl enable bluetooth
@KiaraGrouwstra
KiaraGrouwstra / pull-forks.js
Last active May 12, 2019 18:13
pull github forks
// https://github.com/uvadlc/uvadlc_practicals_2019/network/members
// paste in JS console to get `git remote add` commands
[...document.getElementsByClassName('repo')].splice(1).map(x => {
repo = x.children[3].getAttribute('href').substr(1);
user = repo.split('/')[0];
return `git remote add ${user} git@github.com:${repo}.git`;
}).join('\n')
// run that at your repo, then `git pull --all`
@KiaraGrouwstra
KiaraGrouwstra / hardware-configuration.nix
Created March 9, 2019 23:03
NixOS hardware configuration backup
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:
{
imports =
[ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
@KiaraGrouwstra
KiaraGrouwstra / quantum.m
Last active February 17, 2019 14:48
octave snippets for UvA course quantum computing
# unitaries/gates: input |row>, output |col>
half = 1/sqrt(2);
X = [0 1; 1 0];
Z = [1 0; 0 -1];
H = half * [1 1; 1 -1];
R = @(phi) [1 0; 0 e^(phi*i)];
T = R(pi/4);
function ret = controlled(U)
@KiaraGrouwstra
KiaraGrouwstra / studentenwoningweb.js
Last active February 21, 2019 22:47
ramda.js snippet to filter json results from studentenwoningweb
// https://ramdajs.com/docs/dist/ramda.js
// convert degrees to radians
var deg2rad = (deg) => deg * (Math.PI/180);
// calculate distance to my university for a lat-long point using the Haversine formula
var dist = R.curry((lat1,lon1,lat2,lon2) => {
var R = 6371; // Radius of the earth in km
var dLat = deg2rad(lat2-lat1); // deg2rad below
var dLon = deg2rad(lon2-lon1);
@KiaraGrouwstra
KiaraGrouwstra / 1000-sudokus.txt
Last active February 22, 2019 11:42
UvA 2019 Knowledge Representation sudoku data
.94...13..............76..2.8..1.....32.........2...6.....5.4.......8..7..63.4..8
............942.8.16.....29........89.6.....14..25......4.......2...8.9..5....7..
.....7....9...1.......45..6....2.....36...41.5.....8.9........4....18....815...32
.5247.....6............8.1.4.......97..95.....2..4..3....8...9......37.6....91...
.9.........1..6....6..8..7.3......1.....39.......5...217.4...28.....3....86....57
.....5....2...4.1..3..8..2......84..8..6......9..1.7.5..6......95...3.6...3.....1
5...68..........6..42.5.......8..9....1....4.9.3...62.7....1..9..42....3.8.......
.7..21..4....3....6.1.....2.......6...86..7.319.....4..1....2.842.9..............
........1..7.5.3.9..48...2...........3...57....942.........3.....1...4.7.6.278...
.....8..3.16.2.9.7.3...46...........9.5...2...2.13...9..3....2..7...5.........4..
@KiaraGrouwstra
KiaraGrouwstra / BentCigarFunction.java
Last active September 27, 2018 15:13
vu-2018-ec-eval
import java.util.Properties;
import javabbob.JNIfgeneric;
import javabbob.JNIfgeneric.Params;
import org.vu.contest.ContestEvaluation;
public class BentCigarFunction implements ContestEvaluation {
private static final int EVALS_LIMIT_ = 10000;
private static final int bbobid_ = 12;
private static final double BASE_ = 9273454.0 D;
private JNIfgeneric function_ = null;
// let R = import 'ramdajs';
// either install ramda library first or run at https://ramdajs.com/docs/ or https://npm.runkit.com/ramda
let prisonersDilemma = (a_coop = true, b_coop = true) =>
(a_coop && b_coop) ? [-1, -1] :
(!a_coop && !b_coop) ? [-2, -2] :
(a_coop) ? [-3, 0] : [0, -3];
let niceAgent = () => true;
@KiaraGrouwstra
KiaraGrouwstra / run.sh
Created September 14, 2018 20:47
retro gym http
cd retro-contest
docker run --rm -v compo-tmp-vol:/root/compo/tmp agent retro-contest-agent
cd my-retro
http python main.py -e -a greedy -g "CartPole-v0"
tensorboard --logdir /tmp/log
cd gym-http-api
python gym_http_server.py -p 5000
@KiaraGrouwstra
KiaraGrouwstra / bisect-local.sh
Created September 14, 2018 19:11
nix scripts
# usage:
# cd nix-config
# git checkout minimal-local
# sudo cp -r ./* /etc/nixos/
# cd ../nixpkgs
# git bisect start
# git bisect bad master
# git bisect good 18.03
# git bisect run bash ../bisect-local.sh
# git bisect reset