Skip to content

Instantly share code, notes, and snippets.

View rberenguel's full-sized avatar

Ruben Berenguel rberenguel

View GitHub Profile
@rberenguel
rberenguel / rule.sh
Created June 1, 2024 17:46
Hazel rule to analyse exports from DailyGammon magically
echo "" > commands
ID=$(echo "$1" | sed 's/.*dg_\([0-9]*\).*/\1/g')
echo "set sound enable off" >> commands
echo "set analysis chequerplay evaluation plies 3" >> commands
echo "import mat \"$1\"" >> commands
echo "analyse match" >> commands
echo "export match pdf \"reviews/$ID.pdf\"" >> commands
echo "quit" >> commands
/Users/ruben/fromsource/bg/gnubg-1.07.001/gnubg -c commands
rm commands
@rberenguel
rberenguel / gist:d5440983c8f49bf1a9822c925176bee7
Last active February 6, 2024 18:57
Flickering candle blink(1) mk2
blink1-tool --hsb 13,80,92 --setpattline 1 -m 754
blink1-tool --hsb 27,90,96 --setpattline 2 -m 802
blink1-tool --hsb 12,95,98 --setpattline 3 -m 982
blink1-tool --hsb 20,100,101 --setpattline 4 -m 959
blink1-tool --hsb 15,85,81 --setpattline 5 -m 782
blink1-tool --hsb 12,93,101 --setpattline 6 -m 758
blink1-tool --hsb 14,81,83 --setpattline 7 -m 992
blink1-tool --hsb 18,100,104 --setpattline 8 -m 627
blink1-tool --hsb 23,95,120 --setpattline 9 -m 992
blink1-tool --hsb 20,90,102 --setpattline 10 -m 897
@rberenguel
rberenguel / obsidianTodayWidget.js
Last active August 20, 2023 20:41
Quick-and-dirty Scriptable (https://scriptable.app/) script to show a medium widget with today's tasks from Obsidian, for my set up (today is in journal/YYYYMMDD.md, tasks are under the `### Plan` heading). Optionally pass "tomorrow" as widget arg to render tomorrow (if it doesn't exist it will fail of course)
let when = args.widgetParameter || 'today'
let now = new Date()
if (when == 'tomorrow') {
now.setDate(now.getDate() + 1);
}
let formatter = new DateFormatter()
formatter.dateFormat = 'yyyyMMdd'
let today = formatter.string(now)
@rberenguel
rberenguel / plugins.md
Created June 25, 2021 14:46
Plugins I'm using in Obsidian as of 20210625
  • Adjacency Matrix: a different way of looking at the graph. Installed for curiosity
  • Admonition: allows having "special" boxes very easily. Very recommended
  • Advanced tables: makes editing tables easier. Not very used, but worth having
  • Calendar: I keep a daily log, so this is very useful to navigate it
  • Dataview: in a way converts your notes into a database. Very helpful to organise projects by adding metadata to notes.
  • Editor syntax highlight: show code syntax in the editor too, not only in the rendered view
  • Excalidraw: awesome SVG plugin that even works on mobile
  • Hotkeys for templates: rarely used, pretty much what it says in the bottle
  • Juggl: alternative graphs
  • Kanban: A kanban based on plan markdown (there's a similar Haskell project). Works well, but not use it much
@rberenguel
rberenguel / pushToTalk.js
Last active February 27, 2020 08:56
Push to talk (space bar when Safari's Meet is under focus) bookmarklet for Google Meet, working under Mac OS in Safari. Code modified from https://gist.github.com/caseywatts/561bc498b6feec3d419b29a65d916663
javascript: (() => {const toggles = tip => ({ key }) => key === '' && document.querySelectorAll('[data-tooltip]').forEach(el => el.dataset.tooltip === tip && el.click());document.body.onkeyup = toggles('Turn off microphone (⌘ + D)');document.body.onkeydown = toggles('Turn on microphone (⌘ + D)');})();
@rberenguel
rberenguel / pushToTalk.js
Created February 27, 2020 08:54
Push to talk bookmarklet for Mac OS in Safari
javascript: (() => {const toggles = tip => ({ key }) => key === '' && document.querySelectorAll('[data-tooltip]').forEach(el => el.dataset.tooltip === tip && el.click());document.body.onkeyup = toggles('Turn off microphone (⌘ + D)');document.body.onkeydown = toggles('Turn on microphone (⌘ + D)');})();
@rberenguel
rberenguel / pyspark-workshop-requirements.md
Last active November 14, 2019 09:22
Quick writeup of the requirements for my PySpark workshop at PyDay 2019, Barcelona (https://pybcn.org/pyday-bcn-2019/)

To take full advantage of the workshop you'll need

  • PySpark installed (anything more recent than 2.3 should be fine)
  • Jupyter installed
  • Pandas and Arrow installed
  • All able to talk to each other
  • One or more datasets

You can clone this repository to have the notebook and slides (some things may still change until Saturday, like uploading and upgating the compiled slides, but the notebook is essentially finished).

@rberenguel
rberenguel / Lavaurs.lsp
Created August 24, 2019 19:30
Code I wrote around 2009 for rendering Lavaurs chords (an abstract Mandelbrot set). Blame my old self for my poor Lisp
;; Copyright 2009 Rubén Berenguel
;; ruben /at/ maia /dot/ ub /dot/ es
;; This program is free software: you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation, either version 3 of the
;; License, or (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
@rberenguel
rberenguel / Koch.ps
Created August 24, 2019 18:14
Koch snowflake in PostScript
%!PS-Adobe-2.0
%%% Start of L-system definition
/STARTK { FK +K +K FK +K +K FK} def
/FK {
dup 0 eq
{ DK } % if the recursion order ends, draw forward
{
1 sub % recurse
@rberenguel
rberenguel / postcard2008.ps
Created May 31, 2019 14:25
Christmas Postcard 2008 in PostScript
%!PS-Adobe-3.0
%%BeginFeature: *PageSize A4
<< /PageSize [595 842] >> setpagedevice
%%EndFeature
%/PageSize A4
/CoordX 595 def
/CoordY 842 def
/RadiMax 95 def