Skip to content

Instantly share code, notes, and snippets.

@valpackett
valpackett / index.js
Created July 25, 2019 12:21
oxipng wasm wrapper
(async function () {
await wasm_bindgen('oxipng_wasm_bg.wasm')
window.oxi = wasm_bindgen
oxi.init()
const resp = await fetch('y.png')
const arb = await resp.arrayBuffer()
const uarr = new Uint8Array(arb)
console.log(uarr)
const t0 = performance.now()
window.result = oxi.optimize_from_memory(uarr)
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* Copyright (c) 1999-2002 Vojtech Pavlik
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*/
#ifndef _UAPI_INPUT_H
#define _UAPI_INPUT_H
@valpackett
valpackett / dmesg
Created June 20, 2018 16:00
asus-duma postmarketOS first boot dmesg
[ 0.000000] Booting Linux on physical CPU 0
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 3.4.113-ElementalX-ME302KL-7.02 (pmos@varch) (gcc version 6.4.0 (Alpine 6.4.0) ) #1-postmarketOS SMP PREEMPT Wed Jun 20 11:36:41 UTC 2018
[ 0.000000] CPU: ARMv7 Processor [511f06f0] revision 0 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[ 0.000000] Machine: QCT APQ8064 DUMA
[ 0.000000] Truncating memory at 0x90000000 to fit in 32-bit physical address space
[ 0.000000] memory pool 3 (start fe9ff000 size 1600000) initialized
[ 0.000000] Hardboot page reserved at 0x88C00000
[ 0.000000] Initialized persistent memory from 88d00000-88dfffff
@valpackett
valpackett / left-pad.mlw
Last active April 26, 2018 05:29
Left-pad verified with Why3
module LeftPad
use import int.Int
use import int.MinMax
use import string.Char as C
use import map.Map as M
use import string.String as S
use import string.Buffer as B
(* string.Buffer.contents only does the length for some reason *)
val buf2str (b: B.t) : string
@valpackett
valpackett / Makefile
Created March 26, 2018 22:17
Linker removes struct :(
libstruct.o: libstruct.c libstruct.h
cc -c -o $@ libstruct.c
libinit.o: libinit.c libinit.h
cc -c -o $@ libinit.c
lib.a: libstruct.o libinit.o
ar rcs $@ libstruct.o libinit.o
app: app.c lib.a
@valpackett
valpackett / gist:261f9cfd6002f4cf024553a08ed9434d
Created February 26, 2018 19:29
dmesg amdgpu 4.11 polaris10 debug vulkaninfo
Copyright (c) 1992-2018 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 12.0-CURRENT #8 3b240d54fe8(master): Mon Feb 26 14:20:17 MSK 2018
[email protected]:/usr/obj/usr/src/amd64.amd64/sys/DESKTOP amd64
FreeBSD clang version 6.0.0 (branches/release_60 325330) (based on LLVM 6.0.0)
VT(vga): resolution 640x480
CPU: AMD Ryzen 7 1700 Eight-Core Processor (3000.09-MHz K8-class CPU)
Origin="AuthenticAMD" Id=0x800f11 Family=0x17 Model=0x1 Stepping=1
diff --git i/sys/arm/allwinner/aw_thermal.c w/sys/arm/allwinner/aw_thermal.c
index 5143cda95fb..f8db25a9443 100644
--- i/sys/arm/allwinner/aw_thermal.c
+++ w/sys/arm/allwinner/aw_thermal.c
@@ -248,9 +248,9 @@ static const struct aw_thermal_config h3_config = {
};
static struct ofw_compat_data compat_data[] = {
- { "allwinner,sun8i-a83t-ts", (uintptr_t)&a83t_config },
- { "allwinner,sun8i-h3-ts", (uintptr_t)&h3_config },
diff --git i/gfx/gl/GLContextProviderEGL.cpp w/gfx/gl/GLContextProviderEGL.cpp
index d3dffdc9e6ab..a86827206d04 100644
--- i/gfx/gl/GLContextProviderEGL.cpp
+++ w/gfx/gl/GLContextProviderEGL.cpp
@@ -5,9 +5,10 @@
#if defined(MOZ_WIDGET_GTK)
#include <gdk/gdkx.h>
+ #include <gdk/gdkwayland.h>
// we're using default display for now
@valpackett
valpackett / bench
Created January 29, 2018 10:55
rust faster
(R7 1700 @ 3.9GHz, FreeBSD 12-CURRENT, rustc 1.24.0-nightly)
$ RUSTFLAGS="-C target-cpu=znver1" cargo bench
[…]
test tests::bench_base100_enc_scalar ... bench: 1,733 ns/iter (+/- 18)
test tests::bench_base100_enc_simd ... bench: 328 ns/iter (+/- 1)
test tests::bench_determinant2_scalar ... bench: 303 ns/iter (+/- 2)
test tests::bench_determinant2_simd ... bench: 234 ns/iter (+/- 1)
test tests::bench_determinant3_scalar ... bench: 286 ns/iter (+/- 1)
@valpackett
valpackett / clinfo.stacktrace
Created January 19, 2018 20:17
amdgpu clinfo 17.3.1
* thread #1, name = 'clinfo'
* frame #0: 0x00000008012ca2ea libthr.so.3`_umtx_op_err at _umtx_op_err.S:37
frame #1: 0x00000008012be024 libthr.so.3`__thr_umutex_lock(mtx=0x00000008012d80b8, id=100800) at thr_umtx.c:82
frame #2: 0x00000008012c3b3c libthr.so.3`check_and_init_mutex [inlined] _thr_umutex_lock at thr_umtx.h:125
frame #3: 0x00000008012c3ad4 libthr.so.3`check_and_init_mutex [inlined] init_static(thread=0x00000008031e5000, mutex=<unavailable>) at thr_mutex.c:306
frame #4: 0x00000008012c3acc libthr.so.3`check_and_init_mutex(mutex=0x0000000800c62c70, m=0x00007fffffffb8a8) at thr_mutex.c:600
frame #5: 0x00000008012c308a libthr.so.3`__pthread_mutex_trylock(mutex=<unavailable>) at thr_mutex.c:616
frame #6: 0x000000080097be69 libc.so.7`__je_arena_tcache_fill_small [inlined] malloc_mutex_trylock_final(mutex=0x0000000800c62c30) at mutex.h:144
frame #7: 0x000000080097be59 libc.so.7`__je_arena_tcache_fill_small [inlined] malloc_mutex_lock(tsdn=0x0000000800637090, mutex=0x0000000800