Skip to content

Instantly share code, notes, and snippets.

@AndrewJDR
AndrewJDR / meow_hash_c.h
Created July 11, 2021 07:25 — forked from mmozeiko/meow_hash_c.h
Meow v0.5 in C
#pragma once
#define MEOW_HASH_VERSION 5
#define MEOW_HASH_VERSION_NAME "0.5/calico"
// Meow hash v0.5 in C without dependency on special CPU instructions
// Ported from https://github.com/cmuratori/meow_hash
// Performance on Ryzen 9 3950X
// AESNI code = ~16 bytes/cycle
@AndrewJDR
AndrewJDR / meow_hash_armv8.h
Created July 11, 2021 07:25 — forked from mmozeiko/meow_hash_armv8.h
Meow v0.5 in C and ARMv8
#pragma once
#define MEOW_HASH_VERSION 5
#define MEOW_HASH_VERSION_NAME "0.5/calico"
// Meow hash v0.5 with ARMv8 Crypto Extension instructions
// Ported from https://github.com/cmuratori/meow_hash
// Performance on Pine A64 (Cortex-A53, 1.2GHz)
// (compiled with clang v10.0 with -O3 -mcpu=cortex-a53)
// Reference: https://github.com/immersive-web/webxr/issues/849
// Author: Andrew Johnon
// ajohnson@draster.com
//
// PROPOSAL:
// For handheld AR, allow for camera framebuffer caching and later
// retrieval+render.
//
// This facilitates handheld AR usecases where a pose's transform data is sent to
// a server, it gets processed in some way, then after a small period of time
@AndrewJDR
AndrewJDR / meow_hash_bench.c
Created October 28, 2018 07:15
Meow hash in generic C (v0.2)
#ifdef _MSC_VER
#define MEOW_API static __declspec(noinline)
#include <intrin.h>
#else
// assume clang
#define MEOW_API static __attribute__((noinline))
#define __rdtsc __builtin_readcyclecounter
#endif
#include "meow_hash_c.h"
@AndrewJDR
AndrewJDR / 0001-Add-DigitalOcean-root-on-zfs-guide-Ubuntu-18.04.patch
Last active May 19, 2018 05:21
patch against zfs wiki repo - DigitalOcean root on zfs guide (Ubuntu 18.04)
From 7cfaf9dcc917ae3d48b4929ff9bdfe4ce3dcb86c Mon Sep 17 00:00:00 2001
From: Andrew Johnson <ajohnson@draster.com>
Date: Fri, 18 May 2018 22:07:14 -0700
Subject: [PATCH] Add DigitalOcean root on zfs guide (Ubuntu 18.04).
---
DigitalOcean-Ubuntu-18.04-Root-on-ZFS.md | 183 +++++++++++++++++++++++++++++++
1 file changed, 183 insertions(+)
create mode 100644 DigitalOcean-Ubuntu-18.04-Root-on-ZFS.md

Create an Ubuntu 18.04 droplet, and use the smallest SSD/HDD size. This way you can make a snapshot of the droplet and have the ability to later deploy that snapshot into a droplet of any size.

In this example, I use the "Optimized Droplet" that is 20GB, since that's the smallest one currently available.

After creating the droplet, power it down and open a ticket with DigitalOcean support, and ask to enable the Ubuntu 18.04 recovery ISO. It can take an hour or two before they do this. By the time you read this guide, hopefully they will have an automated way of doing it.

Once they get back to you, power your droplet back up and choose the recovery ISO's terminal/console option to get a shell. Now shrink the ext4 root to make room for the zfs root:

e2fsck -f /dev/vda1
# To build the flatbuffer binary
flatc -c -b member.fbs m.room.member_example.json
# see member_generated.h for the code that gets generated that's capable of reading the binary message
# The .h is for C. To generate other language bindings:
flatc --js -c -b member.fbs m.room.member_example.json
flatc --go -c -b member.fbs m.room.member_example.json
flatc --python -c -b member.fbs m.room.member_example.json
flatc --csharp -c -b member.fbs m.room.member_example.json
# etc...
const fs = require('fs');
const {
Puppet
} = require("matrix-puppet-bridge");
const puppet = new Puppet('/Users/ajohnson/matrixwork/rls/matrix-appservice-imessage/config.json');
puppet.startClient().then(()=>{
const client = puppet.getClient();
var obj = JSON.parse(fs.readFileSync(process.argv[2]))
<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@AndrewJDR
AndrewJDR / gist:c90aef5694c4fa538ddf
Created November 19, 2015 13:58
replace-paste-yanked-text-in-vim-without-yanking-the-deleted-lines
" https://web.archive.org/web/20151015122526/http://superuser.com/questions/321547/how-do-i-replace-paste-yanked-text-in-vim-without-yanking-the-deleted-lines
vnoremap p "0p
vnoremap P "0P
"vnoremap y "0y
vnoremap d "0d
vnoremap x "0x