Skip to content

Instantly share code, notes, and snippets.

View RobinBoers's full-sized avatar
curious

Robin RobinBoers

curious
View GitHub Profile
@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");
@RobinBoers
RobinBoers / v2.css
Last active August 24, 2024 20:31
Custom CSS to make Miniflux v1.x look like v2 :)
@import url("/assets/css/app.min.css");
:root {
--font-family:system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
--body-color:#333;
--body-background:#fff;
--hr-border-color:#ccc;
--title-color:#333;
--link-color:#3366CC;
--link-focus-color:red;
--link-hover-color:#333;
@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 / command-q.karabinder-thing
Created July 4, 2024 18:34
Option+Q to Command+Q
{
"description": "Option+Q to Command+Q",
"manipulators": [
{
"from": {
"key_code": "q",
"modifiers": {
"mandatory": [
"left_option"
],
@RobinBoers
RobinBoers / alacritty.karabinder-thing
Created July 4, 2024 18:34
Option+Return launches Alacritty
{
"description": "Option+Return launches Alacritty",
"manipulators": [
{
"from": {
"key_code": "return_or_enter",
"modifiers": {
"mandatory": [
"left_option"
],