Skip to content

Instantly share code, notes, and snippets.

Running Playscii on macOS

Date: Apr 15, 2023

This document describes how I got Playscii running on macOS using the following setup:

  • Playscii 9.17.1
  • Python 3.11.3
  • macOS Ventura 13.2.1
  • MacBook Air (M1)
@mjhanninen
mjhanninen / rust-vecdeque-binary_search_by.md
Created January 4, 2022 07:03
Examples on how Rust's VecDeque::binary_search_by behaves

Examples on how binary_search_by behaves

use std::collections::VecDeque;

fn main() {
    let ex = |q: &VecDeque<i32>, y: i32, desc: &str| {
        println!("search({}) -> {:?}\t# {}", y, q.binary_search_by(|&x| x.cmp(&y)), desc);
    };
    let q = VecDeque::from([1, 2, 3, 5, 6, 7]);
@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_,

PlantUML example for Malli

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

  hide empty members

  class "Burger" {
    :name string?
 :description string?
@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()
@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 / 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 / README.md
Created February 16, 2016 07:50
Delayed computation in C++
@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 / 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--