Skip to content

Instantly share code, notes, and snippets.

Avatar
😸
Pondering language design...

serialhex

😸
Pondering language design...
View GitHub Profile
@serialhex
serialhex / containers.md
Last active Dec 2, 2021
My Views on Containers
View containers.md

My Thoughts on Containers, Containerization and Virtual Machines in general

I am writing this to express my thoughts on containers in general. I have briefly stated my surface-thoughts on them to a few people, and because it is difficult to articulate all of my thoughts at once to someone, I thought I would write a blog-post / article thing. First of all, all the opinions expressed here are mine and mine alone. There is a good chance nobody else in the world has these same thoughts, so I am alone. I'm fine with that though, as it makes me unique.

Containers are Virtual Machines

Yes. Full stop. They are. I don't care if you say they are "small" virtual machines. They are none the less, a virtual machine. From [Wikipedia, Virtual Machine]:

> In computing, a virtual machine (VM) is the virtualization/emulation of a computer system. Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized hardware, softwar

@serialhex
serialhex / dprism.html
Created Jan 3, 2020
A Damage per Round calculator for use in comparing the relative strengths of different Pathfinder 2e characters.
View dprism.html
<!DOCTYPE html>
<html lang="en-US">
<!--
Copyright 2020 serialhex <serialhex@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
@serialhex
serialhex / derpyhash.c
Last active Aug 18, 2021
some fibonacci hash functions. 64 and 32 bit.
View derpyhash.c
// this runs nicely on SMHasher
// fails a few tests, but overall is fast and passes most tests
size_t derpy_hash(const char *key, int len, uint32_t seed) {
const uint64_t *data = (const uint64_t *)key;
const uint64_t fib = 11400714819323198485llu;
// 8 bytes in a 64-bit value, so take the last 7 bits
uint8_t m = len & 7;
// initialize
View upconvert.ps1
param (
[string]$src = ".",
[string]$dst = ".\reencode"
)
# Add-Type -AssemblyName System.Windows.Forms
function time($block) {
$sw = [Diagnostics.Stopwatch]::StartNew()
View repo.ex
defmodule Foobot.Repo do
# use JSON and some awesomesauce to make a database of sorts.
# in-memory it will be just a map...
# on disk JSON
# reads simply read all the data, writes do the write & also write
# a copy to disk
require Logger
@repo :repo_registry
@serialhex
serialhex / cond-<>.lisp
Last active May 18, 2017
A Common Lisp macro that threads a value through a handful of forms, updating that value if the predicate returns true.
View cond-<>.lisp
;; from On Lisp
(defun single (lst)
(and (consp lst) (not (cdr lst))))
(defmacro cond-<> (data &body body)
"A combination of this: https://clojuredocs.org/clojure.core/cond-%3E
and this: https://github.com/rplevy/swiss-arrows#a-generalization-of-the-arrow
returns last value of <>"
(let ((<> (intern "<>")))
`(let ((<> ,data))
View diff.patch
diff --git a/include/export.h b/include/export.h
index ca9bf47..714264b 100644
--- a/include/export.h
+++ b/include/export.h
@@ -279,6 +279,7 @@ int savePLY(ExportPoints points,
fb.open(filename, std::ios::out | std::ios::binary);
std::ostream outputStream(&fb);
std::cout << "Writing to disk...\n";
+ PLY_SCOPED_TIMER("Write");
ply.write(outputStream, true);
View arrayfire-memleak.txt
Working on fringe: 64
Sin address: 000000000015F6B8 Cos address: 000000000015F6B0 WPhi address: 000000000015F668 Ampl address: 000000000015F6A8 DcLevel address: 000000000015F6A0 Mod address: 000000000015F6C8
Sin address: 000000000015F6B8 Cos address: 000000000015F6B0 WPhi address: 000000000015F670 Ampl address: 000000000015F6A8 DcLevel address: 000000000015F6A0 Mod address: 000000000015F6C0
Alloc Bytes: 1536000000 Alloc Buffers: 11 Lock Bytes: 1474560000 Lock Buffers: 10
---------------------------------------------------------
| POINTER | SIZE | AF LOCK | USER LOCK |
---------------------------------------------------------
| 000000004BD90040 | 58.59 MB | Yes | No |
| 0000000022A30040 | 58.59 MB | Yes | No |
View dot-and-cross.h
#include <arrayfire.h>
// Computes the element-wise dot product of 2 arrays
// The default of dim = -1 computes the dot for the first non-empty dimension
// otherwise, it is the dimension that the vectors are located in
array elem_dot(const array& a, const array& b, const int dim = -1) {
return sum(a * b, dim);
}
// computes the cross product of an array of vectors
View file 2
this is file 2, it's sooooo much better than file 1!