Skip to content

Instantly share code, notes, and snippets.

@typeswitch-dev
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 {
View war_on_raze.md

WAR ON RAZE

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:

x^x*/:x:2_!100

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

@akihikodaki
akihikodaki / README.en.md
Last active Sep 24, 2022
Linux Desktop on Apple Silicon in Practice
View README.en.md

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
PARC6502 / OpenSourceBaas.md
Last active Sep 12, 2022
List of open source, self hosted BaaS - Backend as a service
View OpenSourceBaas.md

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)
View meltdown_redis.md

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
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
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
mowings / readme.md
Last active Sep 23, 2022
ffmpeg stream and save video from Dahua 4300s IP Camera
View readme.md

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@198.175.207.61:554/live" \

-c copy -map 0 foo.mp4

@ghl3
ghl3 / _ImmutableDatabase
Last active Dec 27, 2021
Implementation of an immutable database in postgres
We couldn’t find that file to show.
@geraldvillorente
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: http://edmondscommerce.github.io/php/crawl-an-xml-sitemap-quality-check-301-and-404.html
*
* 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.
*/