Skip to content

Instantly share code, notes, and snippets.

View RobinBoers's full-sized avatar
curious

Robin RobinBoers

curious
View GitHub Profile
@RobinBoers
RobinBoers / spotlight.rule.json
Created August 12, 2024 08:23
Karabinder rule to make option launch Spotlight, ala Windows.
{
"description": "Option launches Spotlight",
"manipulators": [
{
"from": {
"key_code": "left_option",
"modifiers": { "optional": ["any"] }
},
"to": [{ "key_code": "left_option" }],
"to_if_alone": [
@RobinBoers
RobinBoers / sql.php
Created August 11, 2024 11:35
PHP SQL builder primitives
<?php
function in($query, $column, $list) {
[$sql, $params] = $query;
$placeholders = implode(',', array_fill(0, count($list), '?'));
return ["SELECT * FROM ($sql) WHERE `$column` IN $placeholders", array_merge($params, $list)];
}
function where($query, $column, $value) {
[$sql, $params] = $query;
@RobinBoers
RobinBoers / iterm.rule.json
Created August 9, 2024 19:06
Karabinder Elements rule for launching iTerm on MacOS on Option+Enter
{
"description": "option+t launches alacritty",
"manipulators": [
{
"from": {
"key_code": "return_or_enter",
"modifiers": { "mandatory": ["left_option"] }
},
"to": [{ "shell_command": "osascript -e 'tell app \"iTerm2\"' -e 'create window with default profile' -e activate -e end" }],
"type": "basic"
@RobinBoers
RobinBoers / som-auth.ts
Created July 24, 2024 20:42
Script for obtaining Somtoday access token.
#!/usr/bin/env -S bun
import crypto from "node:crypto";
import puppeteer from "puppeteer";
const RANDOM_BYTES = 32;
const CLIENT_ID = "D50E0C06-32D1-4B41-A137-A9A850C892C2";
const SCOPE = "openid";
const APP = "somtodayleerling"
const ENDPOINT = "https://inloggen.somtoday.nl/oauth2";
@RobinBoers
RobinBoers / connection.php
Created July 24, 2024 20:14
Function for establishing a MySQL database connection in PHP using PDO.
function establish_connection() {
$host = DB_HOST;
$user = DB_USER;
$pass = DB_PASS;
$name = DB_NAME;
$options = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
@RobinBoers
RobinBoers / spacehey.css
Created July 15, 2024 20:08
Pink spacehey theme
body {background: antiquewhite !important}
.top {background: #d53e65 !important;}
nav .links {background: #eda7ab !important;}
nav .links a {text-shadow: 0 0 7px #e77b97 !important}
nav .links a:hover {color: #d53e65 !important;}
main {background: #fff5eb !important;}
.blog-preview {display:none}
.profile-pic img {border: 5px solid #d53e65; border-radius: 4px;}
footer {background: #f3e3ce !important;}
.profile .heading {background: #a32848 !important;color:white !important;}
@RobinBoers
RobinBoers / cgit.css
Created June 9, 2024 09:45
Custom stylesheet for git.dupunkto.org
@import url("cgit.css");
@import url("https://roblog.nl/base.css");
/* Better fonts */
:root {
line-height: 1.6;
tab-size: 4;
}
div#cgit { font-family: monospace; }
@RobinBoers
RobinBoers / cryptobros.md
Last active May 11, 2024 20:36
Dit is een aangepaste versie van een verslag dat ik in samenwerking met mijn beste vriend voor een praktische opdracht van maatschappijleer geschreven heb.

Cryptobros

Geschreven door Robin Boers en Sean Ham

Inleiding

Dit is een verslag dat wij (Sean en Robin) hebben geschreven voor de vierde en (hopelijk) laatste PO van maatschappijleer. We gaan hierin een kijkje nemen in de wereld van cryptobros: mensen die cryptocurrencies zoals Bitcoin of Ethereum fantastisch vinden, denken dat de blockchain helemaal de toekomst is--ze zijn namelijk het bankenstelsel aan het revolutioneren!--en dit vaak op een vrij,

@RobinBoers
RobinBoers / sub.php
Last active March 31, 2024 20:45
Sub—a simple email subscription service for my blog.
<?php
#
# Sub—a simple email subscription service for my blog.
#
$API_HOST = "https://api.geheimesite.nl";
$API_ROOT = "/sub";
$TOKEN = "../token.txt";
$LIST = "../subscribers.csv";
@RobinBoers
RobinBoers / rplace.php
Last active September 8, 2024 20:43
r/place in ~200 lines of PHP.
<?php
#
# r/place clone written in a single PHP file.
# Written by Axcelott--Unlicensed.
#
define('DIMENSIONS', 20);
define('CANVAS_COLOR', "#ffffff");
define('PENCIL_COLOR', "#000000");