Skip to content

Instantly share code, notes, and snippets.

@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
greg@ruunvald.lan:/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
def pad_or_trim(mat, required_len):
if mat.shape[0] < required_len:
return np.pad(mat, ((0, required_len - mat.shape[0]), (0, 0)), 'constant')
if mat.shape[0] > required_len:
return mat[:required_len]
return mat
@valpackett
valpackett / global-input-unstable-v1.xml
Last active November 20, 2022 18:40
global-input wayland protocol DRAFT PREVIEW
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="global_input_v1">
<copyright>
Copyright (C) 2017 Val Packett (val@packett.cool)
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
@valpackett
valpackett / README.md
Created September 6, 2017 21:49
FreeBSD Vulkan info log