Skip to content

Instantly share code, notes, and snippets.

@typeswitch-dev
typeswitch-dev / daiyon.c
Last active October 12, 2023 23:25
第四 (Daiyon) — a Japanese & Forth inspired postfix language
#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 {
@geraldvillorente
geraldvillorente / sitemap-crawler.php
Last active September 11, 2023 10:51
Sitemap crawler to test 301 and 404.
/**
* 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.
*/
@back2dos
back2dos / ClassList.hx
Last active September 3, 2023 12:18
Store all class names for runtime use.
package ;
#if macro
import haxe.macro.Context.*;
using haxe.macro.Tools;
#end
class ClassList {
static var NAME = 'ClassList';//must be the fully qualified name of this class
macro static function build() {
@AndrasKovacs
AndrasKovacs / WellTyped.hs
Last active August 24, 2023 10:48
Well-typed interpreter from the Idris tutorial (http://eb.host.cs.st-andrews.ac.uk/writings/idris-tutorial.pdf) in Haskell.
{-# LANGUAGE
LambdaCase, GADTs, TypeOperators, TypeFamilies, DataKinds #-}
data Type = TInt | TBool | Type :=> Type
-- Needs GHC >= 7.8
type family Interp (t :: Type) where
Interp TInt = Int
Interp TBool = Bool
Interp (a :=> b) = Interp a -> Interp b
@ghl3
ghl3 / _ImmutableDatabase
Last active March 21, 2023 14:07
Implementation of an immutable database in postgres
We couldn’t find that file to show.
@tpogden
tpogden / run_notebooks.py
Last active February 7, 2023 14:02
Run a Set of Jupyter Notebooks from the Command Line
# ! python
# coding: utf-8
import os
import argparse
import glob
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor
from nbconvert.preprocessors.execute import CellExecutionError

History

For a long time I've been really impacted by the ease of use Cassandra and CockroachDB bring to operating a data store at scale. While these systems have very different tradeoffs what they have in common is how easy it is to deploy and operate a cluster. I have experience with them with cluster sizes in the dozens, hundreds, or even thousands of nodes and in comparison to some other clustered technologies they get you far pretty fast. They have sane defaults that provide scale and high availability to people that wouldn't always understand how to achieve it with more complex systems. People can get pretty far before they have to become experts. When you start needing more extreme usage you will need to become an expert of the system just like any other piece of infrastructure. But what I really love about these systems is it makes geo-aware data placement, GDPR concerns potentially simplified and data replication and movement a breeze most of the time.

Several years ago the great [Andy Gross](ht

@palewire
palewire / run.py
Last active January 19, 2023 21:48
A command-line interface for running Jupyter Notebooks.
# -*- coding: utf-8 -*-
"""
A command-line interface for running Jupyter Notebooks.
Usage: run.py [OPTIONS] [NOTEBOOK_PATHS]...
Executes Jupyter Notebooks from the command line.
Expects one or more file paths input as arguments.

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:

@AndrasKovacs
AndrasKovacs / Perm.agda
Last active April 5, 2020 09:56
Permutation relation in Agda. In the indiuctive definition we have insertions on both sides, as opposed to one side. This makes the transitivity proof *horrible* (or at least I couldn't do better).
open import Data.List
open import Data.Nat
open import Relation.Binary.PropositionalEquality
open import Function
open import Data.Product
open import Data.Sum
data _▶_≡_ {A : Set}(x : A) : List A → List A → Set where
here : ∀ {xs} → x ▶ xs ≡ (x ∷ xs)