Skip to content

Instantly share code, notes, and snippets.

typeswitch-dev / daiyon.c
Last active Jul 3, 2022
第四 (Daiyon) — a Japanese & Forth inspired postfix language
View daiyon.c
#include <stdio.h>
#include <string.h>
#include <assert.h>
FILE *in; long M[1<<24]={0}, *D, *R, H=0x130000, IP=0, T;
long getu() { long t, h = getc(in); if (h < 0xC0) return h;
t = ((h&0x1F) << 6) | (getc(in) & 0x3F); if (h < 0xE0) return t;
t = ( t << 6) | (getc(in) & 0x3F); if (h < 0xF0) return t;
t = ( t << 6) | (getc(in) & 0x3F); return t & 0x1FFFFF; }
void putu(long c) { if (c < 0x80) { putchar(c); return; }
if (c < 0x7FF) { putchar(0xC0|(c>>6)); } else {


This is the story of what happened when I went down a rabbit hole.

It starts with k7. If you press Ctrl-] in the k7 WASM console, this appears:


That's a prime number filter. There are faster ones -'s x,1_&&/80#'!:'x is beautiful - but this one is really short.

akihikodaki /
Last active Sep 24, 2022
Linux Desktop on Apple Silicon in Practice

Linux Desktop on Apple Silicon in Practice

I bought M1 MacBook Air. It is the fastest computer I have, and I have been a GNOME/GNU/Linux user for long time. It is obvious conclusion that I need practical Linux desktop environment on Apple Silicon.

Fortunately, Linux already works on Apple Silicon/M1. But how practical is it?

  • Two native ports exist.
PARC6502 /
Last active Sep 12, 2022
List of open source, self hosted BaaS - Backend as a service

Parse Server - ~19K stars

  • JavaScript based
  • MongoDB or PostgreSQL
  • Has dockerfile

Appwrite - ~16K stars

  • Written in JavaScript and PHP
  • Docker based
  • Realtime support across all services
  • Advanced security features (virus-scanning, data encryption, auto SSL, rate-limiting)

Meltdown fix impact on Redis performances in virtualized environments

UPDATE: apparently kernel difference may have a serious impact, so I'll redo the test from scratch.

Test performed with AOF enabled, fsync policy 1 second, allowing the rewrites to be triggered.

Command lines used:

BusFactor1Inc / scheme-coin.lisp
Created Dec 16, 2017
A Common Lisp Blockchain - Scheme Coin
View scheme-coin.lisp
;; scheme coin - a common lisp blockchain
;; Burton Samograd
;; 2017
(load "~/quicklisp/setup.lisp")
(defconstant *coin-name* "Scheme Coin")
chrisdone / Printf.idr
Last active Jan 22, 2022
Type-safe dependently-typed printf in Idris
View Printf.idr
module Printf
%default total
-- Formatting AST.
data Format
= FInt Format
| FString Format
| FOther Char Format
| FEnd
mowings /
Last active Sep 23, 2022
ffmpeg stream and save video from Dahua 4300s IP Camera

Use ffmpeg to stream video from a dahua 4300s to a file or files

You can use ffmpeg to directly pull frames off of a dahua 4300s at full resolution. May be a good alternative to pricey dvrs which likely cannot record at full resolution, may not work with the camera, or are prohibitevly expensive

Simple Stream to file

Simple stream to file. Full resolution

ffmpeg -loglevel debug -rtsp_transport tcp -i "rtsp://admin:admin@" \

-c copy -map 0 foo.mp4

ghl3 / _ImmutableDatabase
Last active Dec 27, 2021
Implementation of an immutable database in postgres
We couldn’t find that file to show.
geraldvillorente / sitemap-crawler.php
Last active Jul 5, 2022
Sitemap crawler to test 301 and 404.
View sitemap-crawler.php
* Crawl the sitemap.xml for 301 redirections and 404 errors.
* Source:
* To use this script you need to allocate a huge amount of time to maximum_execution_time to
* avoid Fatal error: Maximum execution time...I suggest to run this script on terminal.
* Ex: $ php test-xml.php > ~/Desktop/sitemap-curl-result.txt
* For 3000 links the average time the script consumed is around 45 minutes to 1 hour.