Skip to content

Instantly share code, notes, and snippets.

@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 ([email protected])
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
#!/usr/bin/env run-cargo-script
//! ```cargo
//! [dependencies]
//! unixbar = "0"
//! systemstat = "0"
//! ```
#[macro_use] extern crate unixbar;
extern crate systemstat;
use unixbar::*;
@valpackett
valpackett / nvim-bloaty
Created April 28, 2017 18:00
bloaty report for neovim 0.1.7 from freebsd official pkgs
$ bloaty $(which nvim)
VM SIZE FILE SIZE
-------------- --------------
75.8% 1.84Mi .text 1.84Mi 77.1%
10.2% 253Ki .rodata 253Ki 10.4%
5.3% 130Ki .eh_frame 130Ki 5.3%
4.6% 113Ki .data 113Ki 4.6%
1.9% 47.4Ki .bss 0 0.0%
1.2% 30.0Ki .eh_frame_hdr 30.0Ki 1.2%
0.3% 6.61Ki .dynsym 6.61Ki 0.3%
@valpackett
valpackett / dump.json
Created April 28, 2017 17:44
my geekedin profile
{
"_id": "d08a4d8d-5c30-42a7-a6fe-42af3d3243da1448627578734",
"_class": "com.geekedin.domain.entities.mongo.EDeveloper",
"scores": [
{
"technology": "CSS",
"score": 1141,
"lastCompute": {
"sec": 1470051310,
"usec": 552000
$itDir = "D:\iTunes Media\Music\"
$dstDir = "D:\Music\"
$ffmpeg = "C:\Users\greg\Downloads\ffmpeg-20170321-db7a05d-win64-shared\bin\ffmpeg.exe"
$itLib = Get-ChildItem -Include @("*.m4a", "*.aac", "*.mp3", "*.flac") -LiteralPath $itDir -Recurse
foreach ($path in $itLib) {
if ((Get-Item -LiteralPath $path.FullName).Attributes -band [IO.FileAttributes]::Directory) {
Write-Output "Directory $($path.FullName)"
} else {
$destPath = ([io.path]::ChangeExtension($path.FullName, "opus")).Replace($itDir, $dstDir)
@valpackett
valpackett / psmdemuxd.c
Created January 30, 2017 07:12
experiments with demultiplexing PS/2 devices (touchpad + trackpoint) on FreeBSD
#include <cuse.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdbool.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <sys/mouse.h>