Skip to content

Instantly share code, notes, and snippets.

@mjhanninen
mjhanninen / building-terminal-emacs-on-osx.md
Created June 24, 2012 06:26
Building Terminal Emacs on OS X

Building Terminal Emacs on OS X

Building a terminal version of Emacs on OS X is easy. However it took me quite a bit of time to land on the correct incantation:

$ ./autogen.sh
$ ./configure --without-x --without-sound --prefix=/usr/local
$ make bootstrap
$ sudo make install
@mjhanninen
mjhanninen / dump.txt
Created November 9, 2012 12:14
Dump for brew ticket "Ocaml-findlib fails on OS 10.8.2"
Output of `brew install ocaml-findlib`
--------------------------------------
==> Downloading http://download.camlcity.org/download/findlib-1.2.7.tar.gz
Already downloaded: /Library/Caches/Homebrew/ocaml-findlib-1.2.7.tar.gz
/usr/bin/tar xf /Library/Caches/Homebrew/ocaml-findlib-1.2.7.tar.gz
==> ./configure -config /usr/local/Cellar/ocaml-findlib/1.2.7/etc
./configure -config /usr/local/Cellar/ocaml-findlib/1.2.7/etc
Welcome to findlib version 1.2.7
Configuring core...
@mjhanninen
mjhanninen / private.xml
Created January 15, 2013 19:23
Mac OS X captures C-M-d before it gets to Emacs. With the following KeyRemap4MacBook you can reclaim that keybinding and get your paredit-mode working.
<?xml version="1.0"?>
<root>
<item>
<name>My Emacs tweaks</name>
<item>
<name>Enable Control_L+Command_L+D on Emacs</name>
<identifier>private.emacs.enable_control_meta_d</identifier>
<only>EMACS</only>
<autogen>
--KeyToKey--
@mjhanninen
mjhanninen / defaultref.cpp
Created August 7, 2015 16:56
Default value for non-const reference argument
// $ clang++ --std=c++11 defaultref.cpp
// $ ./a.out
// Calling without the default argument:
//
// foo in main pre-increment = xyzzy
// foo in main post-incement = yzxxz
// foo in withFoo pre-increment = yzxxz
// foo in withFoo post-increment = zxyyx
// foo in main post-withFoo = zxyyx
//
@mjhanninen
mjhanninen / README.md
Created February 16, 2016 07:50
Delayed computation in C++
@mjhanninen
mjhanninen / fixes-to-sanjeevs-vuejs-tutorial.md
Created December 30, 2016 08:58
Fixes to A. Sanjeevs' Vue.js tutorial

Fixes to A. Sanjeevs' Vue.js tutorial

If you work through [Anirudh Sanjeevs'][sanjeev] excellent tutorial on setting up a [Vue.js][vuejs] project with [Webpack][webpack] and some other goodies, you'll probably hit a handful of minor problems. The tutorial was written a year ago and things have changed a lot since then which naturally explains the issues. So let's tackle them one by one.

The first problem is that Vue.js fails to mount the app component and raises the following error:

@mjhanninen
mjhanninen / my-prompt.sh
Last active April 24, 2018 10:59
Soija's prompt
#!/usr/bin/perl
use strict;
my %fg = ();
my %bg = ();
for my $i (0 .. 255) {
$fg{$i} = "[38;5;${i}m";
$bg{$i} = "[48;5;${i}m";
}
@mjhanninen
mjhanninen / wasm_server.py
Last active January 12, 2019 21:17
Minimal Python based server for serving application/wasm
#!/usr/bin/env python3
from http.server import SimpleHTTPRequestHandler
import socketserver
SimpleHTTPRequestHandler.extensions_map[".wasm"] = "application/wasm"
print("Serving at port 8000")
socketserver.TCPServer(("", 8000), SimpleHTTPRequestHandler).serve_forever()

PlantUML example for Malli

@startuml fig-malli-order-for-burgers.svg

  hide empty members

  class "Burger" {
    :name string?
 :description string?
@mjhanninen
mjhanninen / day-13.sql
Created December 31, 2020 23:02
Advent of Code 2020, Day 13 in Postgresql
CREATE TEMP TABLE input (lineno SERIAL, line TEXT);
--\copy input (line) FROM '13-test-input.txt';
\copy input (line) FROM '13-input.txt';
CREATE TEMP TABLE arrivals(arrival_time) AS
SELECT line::int FROM input WHERE lineno = 1;
CREATE TEMP TABLE bus_lines AS
SELECT column_,