Skip to content

Instantly share code, notes, and snippets.

View larryv's full-sized avatar

Lawrence Velázquez larryv

View GitHub Profile
@larryv
larryv / x86docssync
Last active January 16, 2023 03:52
A macOS shell script for syncing the kib.kiev.ua/x86docs documentation archive
#!/bin/sh
# x86docssync - Syncs documents from kib.kiev.ua/x86docs
#
# Written in 2020, 2022 by Lawrence Velázquez <vq@larryv.me>.
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty.
@larryv
larryv / benchmark-dir-emptying
Created April 25, 2019 03:27
A script I used once to attempt to benchmark different methods of emulating `rm -fR` with find(1).
#!/bin/sh
readonly DIR=/tmp/traversal-test-dir
readonly MAX_DIR_ENTRIES=32
# Given a positive integer N, print the whitespace-delimited sequence
# 0 1 2 ... N-2 N-1 to standard output. Each element is zero-padded to
# the same number of digits as N-1. If a second argument is provided, it
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
I am transitioning to a new OpenPGP key, which is available from
Facebook [1], Gist [2], Keybase [3], and the public keyservers. I will
revoke the old key sometime after 4 July 2018.
Old key fingerprint: 5BA2 C229 0B24 0858 2952 4942 AB30 D664 1F9A F0E3
New key fingerprint: 3FD9 0322 47DE 2D20 1E75 28C4 9AC9 40DF FD01 7443
@larryv
larryv / 3FD9032247DE2D201E7528C49AC940DFFD017443.pub.asc
Last active December 28, 2022 23:57
my current OpenPGP key (created 2018-04-01, expires 2024-01-01)
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQGNBFrAWkgBDADfVpDDWCTqTYl7hwdozP+TPw6fxNVuHXnjU58tXyDTmXVHG9vP
Vi3Sph7EQ2kREa5XjflI/k7qODZV1KlqOSSaOamptkcbRGtEbAoNSzHubARDfcUD
aos3o1D+tObpypT4RarGdQmPgIWOTBDQE5RYcPOfs0FV2ciVsGJ8lYXHa7zwDy+B
As8HfJLGcKQs52nKzmqw67pYkDynW4jkSeTymq/EslVOzHaSlWiVyVYNX7PSjSLV
qEWmElVgH/sB0Oda6Y/XOyUb5QImfAUQo2jRw98mcV1j6d6gVdvizlGC4jzrnWAK
GFENn+615pvySQzTg4gHIeu4CBHiXIc47DHZ6H/Wb6AfozkmDnptwEKQJSn3ICIX
HOn3t1e95YHxMxyM6et8od134hSOgQ3TzUDdMOgXNVr1zyxyeFktsms4h5U8b2uL
E5dw29Cevi2akebSzXVhIkfucYQ5JFtdfEok3EpoSAF7AIpzh6/yVd+mqxIGmVI2
@larryv
larryv / 5BA2C2290B24085829524942AB30D6641F9AF0E3.pub.asc
Created April 6, 2018 04:51
old OpenPGP key (created 2016-06-02, expires 2018-07-13)
-----BEGIN PGP PUBLIC KEY BLOCK-----
mJMEV0+CqxMFK4EEACMEIwQAPhnLUWIaQZlMynz9JvYmUrcC8EJ/r9TK7RuKvGB9
MZAKGdEFEk6rVWRHZ26G679kxkor5iRon7RUq4D3C9JnjagAdLGO/bZurLR5nD8Z
A8Pl7BkzHT3igyxE/U5CMD1T5LJCmvNYWp6n56wB7PK0rbtVSxsh3tmnpHyfTlQR
zv+lvmu0Ikxhd3JlbmNlIFZlbMOhenF1ZXogPHZxQGxhcnJ5di5tZT6I5QQTEwoA
SgIbAQwLCQ0KCAwHCwMEAgEHFQoJCAsDAgUWAAMCAQIeAQIXgAIZARYhBFuiwikL
JAhYKVJJQqsw1mQfmvDjBQJZcDuoBQkD+LH9AAoJEKsw1mQfmvDj6CgCCQFHJ9JV
GfDsafIjIL/lESBEDCyt5Us7yqfRJAYC+aPXPN/ySySmAs/lIB5OpXEguDzk5ZJ8
6mWcuoD03XL1KWX9lwIGJuNlC/eYx+2g2cmHBg5v5husWKHClhAPSLxqOYXu7jEU
@larryv
larryv / parseopt.bash
Last active August 23, 2016 20:03
A small function that uses enhanced getopt(1) to define parameters
parseopt() {
[[ -n $1 ]] || return 1
# Use "--options +" to prevent arguments from being rearranged.
local -r opts=$(getopt --name "$0" --options + --longoptions "$1" -- "${@:2}")
case $((10#$?)) in
1)
# getopt(1) will print an error first.
echo >&2 "Try \`$0 --help' for more information."
return 2
@larryv
larryv / perl5-convert-version.tcl
Last active August 10, 2016 23:32
Iterations on a subroutine for changing 0.000-style Perl module versions into 0.0.0-style versions
proc perl5_convert_version {vers} {
if {[string index $vers 0] eq "v"} {
set start 1
} else {
set start 0
}
set index [string first . $vers]
set other_dot [string first . [string range $vers [expr {$index + 1}] end]]
if {$index == -1 || $other_dot != -1} {
return [string range $vers $start end]
@larryv
larryv / keybase.md
Last active January 16, 2023 03:53
Keybase proof of identity

Keybase proof

I hereby claim:

  • I am larryv on github.
  • I am larryv (https://keybase.io/larryv) on keybase.
  • I have a public key ASA2PbEQSvMzBp7j89WM-YZemJrpkz0EfZj87XVnLNxNVQo

To claim this, I am signing this object:

@larryv
larryv / yubikey-colemak.sh
Created June 11, 2016 16:15
modifying a YubiKey scanmap to work when OS X is configured for Colemak
#!/bin/sh
ykpersonalize -S 06050a0e08170b0f1c11180d16090c1986858a8e88978b8f9c91988d96898c99271e1f202122232425262b9e28
@larryv
larryv / die.c
Last active May 2, 2016 00:16
log message and exit
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
void die(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
/* This buffer length is arbitrary. */