This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Put this in your ~/.bash_aliases script file | |
# This function/alias behaves how I wished 'emacsclient -a '' -r -n' would have behaved: | |
# * Starts an emacs server/window if there is none. Any supplied file(s) are opened in the new window. | |
# * Otherwise, the supplied file(s) are opened in the already existing emacs window. | |
function e() { | |
emacsclient -q -a "sh -c \"emacs -e server-start $@ &\"" --no-wait $@ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prettyDate(date) { | |
const dateStr = [`${date.getFullYear()}`, `${date.getMonth() + 1}`, `${date.getDate()}`] | |
.map((part) => part.padStart(2, '0')) | |
.join('-'); | |
const timeStr = [`${date.getHours()}`, `${date.getMinutes()}`, `${date.getSeconds()}`] | |
.map((part) => part.padStart(2, '0')) | |
.join(':'); | |
const fractionStr = `${date.getMilliseconds()}`.padStart(3, '0'); | |
return `${dateStr} ${timeStr}.${fractionStr}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I had problems getting mouse movement events working in ncurses, but after | |
// some research, it seems as if this is how you can do it. The magic is in the | |
// printf("\033[?1003h\n") which was the missing piece in the puzzle for me | |
// (see console_codes(4) for more information). 1003 means here that all events | |
// (even position updates) will be reported. | |
// | |
// This seems to work in at least three X-based terminals that I've tested: | |
// xterm, urxvt and gnome-terminal. It doesn't work when testing in a "normal" | |
// terminal, with GPM enabled. Perhaps something for the next gist version? :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Program to generate joystick configuration for Visual Boy Advance | |
// 1.8.0 on Linux. I know there existed another program before to do | |
// this, but I could not find it so I wrote this. | |
// | |
// It has worked for me, but it might not work for you. Compile with: | |
// gcc -o vba-joy vba-joy.c -Wall -Wextra $(pkg-config --libs sdl) -std=c99 | |
// | |
// Usage: ./vba-joy [joystickIndex] | |
#include <ctype.h> |