Skip to content

Instantly share code, notes, and snippets.

View mneumann's full-sized avatar

Michael Neumann mneumann

View GitHub Profile
@mneumann
mneumann / option.py
Created July 26, 2023 17:25
10-minute option.py hack
class Option:
def __init__(self, *args):
if len(args) == 0:
self._tag = "None"
self._value = None
elif len(args) == 1:
self._tag = "Some"
self._value = args[0]
else:
raise RuntimeError("Invalid arity")
@mneumann
mneumann / bcd.rb
Last active September 9, 2022 09:36
Convert number into decimal representation via packed BCD
# Convert number into decimal representation intermediate packed BCD.
# Uses two 64-bit integers
def assert_eq(a, b)
raise "#{a} != #{b}" unless a == b
end
def number_to_packed_bcd_int(n)
raise if n > (10**32) - 1
# Use two u64
@mneumann
mneumann / dfly-install.org
Last active April 25, 2020 23:07 — forked from liweitianux/dfly-install.org
DragonFly BSD Manual Installation with HAMMER2 and Encrypted Root

DragonFly BSD Installation

2018-01-30

Disk Partition

MBR Slice

root# dd if=/dev/zero of=/dev/vbd0 bs=32k count=16
root# fdisk -IB /dev/vbd0
diff --git a/src/gpu/gl/GrGLAssembleInterface.cpp b/src/gpu/gl/GrGLAssembleInterface.cpp
index 7305696..d40435f 100644
--- a/src/gpu/gl/GrGLAssembleInterface.cpp
+++ b/src/gpu/gl/GrGLAssembleInterface.cpp
@@ -78,6 +78,9 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
return nullptr;
}
+ // GET_PROC returns nullptr on Vivante GC880, so remove it.
+ extensions.remove("GL_EXT_draw_instanced");
@mneumann
mneumann / build-snap.sh
Created November 13, 2016 22:44
Build static linked cargo (rust's package manager) snapshot
#!/bin/sh
# Run from cargo git directory
CARGO_BIN=`pwd`/mycargo # an existing cargo binary
OPENSSL_VERSION=1.0.2j
export OPENSSL_ROOT_DIR=`pwd`/openssl
export OPENSSL_LIB_DIR=${OPENSSL_ROOT_DIR}/lib
export OPENSSL_INCLUDE_DIR=${OPENSSL_ROOT_DIR}/include
export OPENSSL_STATIC=1
@mneumann
mneumann / build.sh
Created November 13, 2016 12:14
Build static linked cargo (rust's package manager)
#!/bin/sh
# Run from cargo git directory
OPENSSL_VERSION=1.0.2j
export OPENSSL_ROOT_DIR=`pwd`/openssl
export OPENSSL_LIB_DIR=${OPENSSL_ROOT_DIR}/lib
export OPENSSL_INCLUDE_DIR=${OPENSSL_ROOT_DIR}/include
export OPENSSL_STATIC=1
@mneumann
mneumann / current_exe.c
Created August 5, 2016 20:02
current_exe
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <stdlib.h>
#include <errno.h>
int main() {
{
char buf[1024];
@mneumann
mneumann / decoder.rs
Created January 14, 2014 14:48
decoder.rs:176:5: 176:22 error: internal compiler error: Cannot relate bound region: ReInfer(7) <= ReLateBound(949, BrNamed(syntax::ast::DefId{crate: 0u32, node: 963u32}, a)) This message reflects a bug in the Rust compiler. We would appreciate a bug report: https://github.com/mozilla/rust/wiki/HOWTO-submit-a-Rust-bug-report decoder.rs:176 Decod…
extern mod extra;
use std::hashmap::HashMap;
use extra::serialize;
use extra::serialize::Decodable;
pub enum Value {
NoValue,
Boolean(bool),
Unsigned(u64),
Signed(u64),