Skip to content

Instantly share code, notes, and snippets.

View diogotito's full-sized avatar

diogotito diogotito

View GitHub Profile
@diogotito
diogotito / decorated_task.rb
Last active August 21, 2025 16:28
Crake - Cursed Ruby make. Demonstrates why class variables aren't recommended, I guess
#--------------------------------------------------
# fake Rake
#--------------------------------------------------
module TaskRunner
Task = Data.define *%i| name reqs recipes | do
@@tasks = {}
def run
reqs.each { @@tasks[it]&.run }
recipes.each { |recipe| recipe.call(self) }
@@tasks.delete(name) # Don't repeat this Task
@diogotito
diogotito / _rgb555_slider.lua
Last active July 29, 2025 23:35
Aseprite RGB555 color picker script
---Update red, green or blue color gradient in in RGB555 space
---@param t table The table with the 32 shades of the gradient
---@param base_color Color The color to base the gradient on
---@param channel "red"|"green"|"blue" The name of one of `Color`'s channels
local function make_channel_gradient555(t, base_color, channel)
for i555 = 0, 31 do
local color = Color(base_color)
color[channel] = (i555 << 3) + (i555 >> 2)
t[i555] = color
end
@diogotito
diogotito / sidebar.css
Created June 3, 2025 14:38
Sideberry custom CSS
#root.root {--tabs-border-radius: 8px;}
#root.root[data-toolbar-color-scheme="light"] {
--btw-the-inactive-bg-is: rgb(235, 235, 239);
--btw-ff-light: rgb(240, 240, 244);
--frame-bg: var(--btw-ff-light);
--toolbar-bg: var(--btw-ff-light);
}
#root.root[data-toolbar-color-scheme="dark"] {
--frame-bg: rgb(28, 27, 34);
--toolbar-bg: rgb(28, 27, 34);
@diogotito
diogotito / My Disks.ini
Last active March 12, 2025 02:40
Rainmeter skin that shows drive usage
; Lines starting ; (semicolons) are commented out.
; That is, they do not affect the code and are here for demonstration purposes only.
; ----------------------------------
; HOWTO: Adding more disks
; ----------------------------------
; Adding more disks is a pretty straightforward process. Follow the following steps to turn
; this 2 disks skin into a 3 disks skin. You can then extend it even further as you wish.
;
; 1) Create a new variable called disk3=X: directly below disk2=D: in the [Variables] section
@diogotito
diogotito / Layer Section (Japan) (6M).ss.cfg
Last active March 7, 2025 04:56
Mednafen per-game override configuration for Layer Section AKA Rayforce AKA Galactic Attack AKA Gunlock for the SEGA Saturn, with custom DualShock 4 mappings for ergonomic in-game controls and save scumming
;;;;;;;;;;;;;;;;;;;
;; == Visuals == ;;
;;;;;;;;;;;;;;;;;;;
; Stretch to fill screen.
; Default: aspect_mult2 - Aspect Preserve + Integer Multiple-of-2 Scale
; aspect_int - Aspect Preserve + Integer Scale: Full-screen stretch, same as "aspect" except that the equivalent xscalefs and yscalefs are rounded down to the nearest integer.
ss.stretch aspect_int
;Enable scanlines with specified opacity. (0 makes them invisible)
@diogotito
diogotito / azul.css
Last active February 5, 2025 17:37
Obsidian CSS snippet to make some CSS color variables from the default theme match the color scheme of my i3 setup
.theme-dark.mod-linux {
--azul-i3-1: #262a32;
--azul-i3-2: #32343d;
--azul-i3-3: #3d4150;
--azul-i3-4: #4d586e;
--color-base-00: #1e1e1e; /* #1e1e1e; */
--color-base-10: #242424; /* #242424; */
--color-base-20: var(--azul-i3-1); /* #262626; */
--color-base-25: #2a2a2a; /* #2a2a2a; */
[core]
autocrlf = input
eol = lf
editor = vim
pager = delta
[push]
autoSetupRemote = true
[pull]
rebase = true
[merge]
@diogotito
diogotito / init.lua
Last active February 5, 2025 17:40
Minimal Neovim init.lua
--[[
I'm actually interested in moving to Lazyvim if I ever adopt Neovim as my main development editor.
This is just for some light editing sesions in the terminal
--]]
-- Don't load Vim plugins installed with pacman
vim.opt.rtp:remove('/usr/share/vim/vimfiles')
-- Gosh I can't unlearn this habit!
local cursed_esc = 'jk'
@diogotito
diogotito / Code.gs
Created July 10, 2024 18:40
Adds the label "newsletters" to any Gmail thread that has any label under it (like "newsletters/blogs")
function fixNewsletterLabels() {
const LABEL_NAME = PropertiesService.getScriptProperties().getProperty('root label') ?? "newsletters"
let rootLabel = GmailApp.getUserLabelByName(LABEL_NAME)
// Get the "newsletters" label and all labels under it
let newsLabelsNames = GmailApp.getUserLabels()
.map(label => label.getName())
.filter(labelName => labelName.startsWith(LABEL_NAME + "/"));
let query = "-label:newsletters ";
@diogotito
diogotito / Microsoft.PowerShell_profile.ps1
Created June 27, 2024 18:14
PowerShell core (pwsh) $profile with some manual profiling of modules and initialisation steps
# Write-Host -ForegroundColor Green 'Measuring...'
$stopWatch = [System.Diagnostics.Stopwatch]::new()
$stopWatch.Start()
[System.Collections.ArrayList] $stops = @()
[double] $last = 0.0
function stop($descr) {
$t = $stopWatch.Elapsed.TotalMilliseconds
$d = $t - $last
[void] $stops.Add([PSCustomObject]@{
Accumulated = "`e[36m$t`e[0m"