Skip to content

Instantly share code, notes, and snippets.

@spelufo
spelufo / git-log-to-json.sh
Created November 7, 2024 17:33
Convert git log output to JSON
# Similar to https://til.simonwillison.net/jq/git-log-json
git log --pretty=format:'%H%x00%an <%ae>%x00%ad%x00%s%x00' | python -c 'import sys, json
for line in sys.stdin:
commit, author, date, *message = line.split("\x00")
print(json.dumps({"commit": commit, "author": author, "date": date, "message": message[0]}))
'
@spelufo
spelufo / open3d_poisson_recon_helpers.py
Created May 27, 2024 14:15
open3d_poisson_recon_helpers.py
def mesh_cleanup(mesh_o3d):
mesh_o3d.remove_non_manifold_edges()
mesh_o3d.merge_close_vertices(0.001)
mesh_o3d.remove_duplicated_vertices()
mesh_o3d.remove_duplicated_triangles()
mesh_o3d.remove_unreferenced_vertices()
mesh_o3d.remove_degenerate_triangles()
# This seems to keep the majority normal direction, but without knowing
# how it works there's the risk that it flips all the faces.
@spelufo
spelufo / 1600x900.S
Created April 17, 2017 16:22
Custom EDID for 1600x900 Samsung S20B300 monitor
/*
1600x900.S: EDID data set for standard 1600x900 60 Hz monitor
Copyright (C) 2011 Carsten Emde <[email protected]>
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 2
of the License, or (at your option) any later version.
@spelufo
spelufo / exdisplay.rkt
Created December 28, 2015 10:37
Minimal changes to scmutils exdisplay.scm to get it working under racket for testing purposes.
#lang racket/base
#| -*-Scheme-*-
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Massachusetts
Institute of Technology
This file is part of MIT/GNU Scheme.
@spelufo
spelufo / horarios.scm
Last active August 29, 2015 14:22
Minikanren schedule maker. Gives all posible schedules given events that you must go to.
(load "mk.scm")
(define (repeat x n)
(cond
((< n 1) '())
(else (cons x (repeat x (- n 1))))))
(define (split n l)
(cond
((or (null? l) (< n 1)) `(() ,l))
@spelufo
spelufo / denodeify.js
Created May 19, 2015 12:11
node12 --harmony denodeify
var denodeify = function (fn) {
return function () {
var that = this;
var args = [].slice.call(arguments);
return new Promise(function (resolve, reject) {
args.push((err, res) => err ? reject(err) : resolve(res));
fn.apply(that, args);
})
}
}
#!/bin/bash
SOURCE="${1/.*/}"
# Clean
rm "$SOURCE" "$SOURCE".o
# Build
z80-unknown-coff-as -z80 -g -as -gstabs+ -o "$SOURCE".o "$SOURCE".s
z80-unknown-coff-ld --oformat coff-z80 -e 0xB000 -Ttext 0xB000 -o "$SOURCE" "$SOURCE".o
@spelufo
spelufo / cinnamon-alt-tab-app-switcher.md
Created February 20, 2015 11:21
Cinnamon, switch faster!
OS: Linux Mint 17.1 Rebecca

I recently updated from Mint 17 to 17.1, and lost some of my configs/tweaks. I'm putting this here for reference, and just in case anybody wants it.

I like changing tabs with the General > Windows > Alt-Tab > Window Preview (no icons) behavior of cinnamon. However, the slow fade out slows me down. The "fix" is to change /usr/share/cinnamon/js/ui/appSwitcher/classicSwitcher.js. Near the top you'll see:

const PREVIEW_DELAY_TIMEOUT = 180; // milliseconds
var PREVIEW_SWITCHER_FADEOUT_TIME = 0.5; // seconds
@spelufo
spelufo / swaprl.js
Created December 7, 2014 02:09
Swap the left and right sides of an image
#!/usr/bin/env node
var lwip = require('lwip');
var path = require('path');
var file = path.resolve(process.argv[2]);
var newfile = path.join(path.dirname(file),
path.basename(file, path.extname(file))+'_SWAPPED'+path.extname(file) )
lwip.open(file, swaplr)
@spelufo
spelufo / wacom-intuos-dual-monitor.md
Last active January 31, 2022 14:54
Wacom Intuos Pen and Touch dual monitor setup

Wacom Intuos Pen and Touch dual monitor setup

I've had this tablet for a while, and setting it up in linux mint was even easier than on windows 7: plug and play. There's even a GUI for configuring it. Some great apps I use are Gimp, Xournal and Pencil.

But eventually I got tired of opening the configuration dialog to switch monitors, and mapping the tablet to the whole area is no good, because you loose too much presision beacuse of the extra sensitivity (smaller movements cause greater effects on screen).

So what I wanted was an easy way to switch between monitors. Here's what I did.

Made a simple script called wacom-map-to-output to change to a monitor: