Skip to content

Instantly share code, notes, and snippets.

@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 <C.Emde@osadl.org>
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:

ST3 hot_exit but keep old sessions

Sublimes hot_exit feature is awesome: Don't prompt me, remember the state of my open and unsaved files.... whatever. However, if most of the time you launch sublime with subl directory/i/want/to/open I get two windows: one for your previous session and one for the directory you want to work on. It's a pain to have to close what you were previously working on every time, so some people prefer to disable hot_exit and have sublime ask them if they want to save changes every time they close it.

I wanted to save the previous sessions in case I want to access them, but prevent them from opening when I just want to move on to something new. The last session is saved when you exit sublime to $SUBLIME_CONFIG_DIR/Local/Session.sublime_session. To get this effect I modifies the script that launches sublime /usr/bin/subl and /usr/bin/X11/subl (I'm on linux Mint, and have sublime installed to /opt/sublime_text, should be similar on Ubuntu, etc.) to look like the followi

@spelufo
spelufo / ipn
Last active August 29, 2015 13:56
IPython/IJulia Notebook Launcher with tmux

IPython/IJulia Notebook Launcher with tmux

sudo apt-get install tmux

then create this shell scripts somewhere in your $PATH and chmod +x them.

#!/bin/bash