Skip to content

Instantly share code, notes, and snippets.

Kevin Locke kevinoid

Block or report user

Report or block kevinoid

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kevinoid
kevinoid / .bashrc
Created Jul 31, 2019
GnuPG pinentry script for terminal or graphical interface based on $PINENTRY_USER_DATA.
View .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# If file exists (likely) copy fragment below into existing script:
# If stdin is a terminal
if [ -t 0 ]; then
# Set GPG_TTY so gpg-agent knows where to prompt. See gpg-agent(1)
export GPG_TTY="$(tty)"
# Set PINENTRY_USER_DATA so pinentry-auto knows to present a text UI.
export PINENTRY_USER_DATA=USE_TTY=1
@kevinoid
kevinoid / error-reporting.js
Last active Oct 28, 2019
More Robust Client-Side JavaScript Error Reporting
View error-reporting.js
// JavaScript error reporting functions, including automatic window.onerror
// and unhandledrejection reporting.
//
// Based on:
// https://kevinlocke.name/bits/2019/07/30/more-robust-javascript-error-reporting/
//
// API:
// reportError(message, error):
// Report an exception with optional message and exception value.
// reportRejection(message, cause):
@kevinoid
kevinoid / keybase.md
Created Jul 13, 2019
Keybase verification
View keybase.md

Keybase proof

I hereby claim:

  • I am kevinoid on github.
  • I am kevinoid (https://keybase.io/kevinoid) on keybase.
  • I have a public key whose fingerprint is E98C 0D0D 7CD6 8D7D DDCF 7034 498A 12A1 584E A6F9

To claim this, I am signing this object:

@kevinoid
kevinoid / JsonCollectionDeserializer.cs
Created Aug 12, 2018
.NET JSON deserializer for collection types which supports preserving order
View JsonCollectionDeserializer.cs
// <copyright file="JsonCollectionDeserializer.cs" company="Kevin Locke">
// Copyright 2018 Kevin Locke
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
@kevinoid
kevinoid / glxgears-noroot-child.strace
Last active May 20, 2019
firejail --noprofile strace glxgears (with ASLR disabled and trace trimmed)
View glxgears-noroot-child.strace
set_robust_list(0x7ffff6660fe0, 24) = 0
execve("/usr/bin/nvidia-modprobe", ["/usr/bin/nvidia-modprobe", "-c=255"], 0x7fffffffcc80 /* 0 vars */) = 0
brk(NULL) = 0x55555575d000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.preload", R_OK) = 0
openat(AT_FDCWD, "/etc/ld.so.preload", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
close(3) = 0
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=188467, ...}) = 0
@kevinoid
kevinoid / example-unbound.conf
Last active Aug 25, 2018
Setup Unbound with Dnsmasq on OpenWrt
View example-unbound.conf
server:
do-not-query-localhost: no
domain-insecure: "0.168.192.in-addr.arpa"
domain-insecure: "example.local"
local-zone: "168.192.in-addr.arpa." nodefault
private-address: 10.0.0.0/8
private-address: 169.254.0.0/16
private-address: 172.16.0.0/12
private-address: 192.168.0.0/16
private-address: fd00::/8
@kevinoid
kevinoid / README.md
Last active Feb 15, 2017
Example of Yargs issue locating config under Mocha
View README.md

To demonstrate the issue, notice the difference between the following:

$ node index.js
string

and

$ npm run test
number
[...]
@kevinoid
kevinoid / session-manager-to-bookmarks.py
Created Dec 23, 2016
Script to convert Firefox Session Manager sessions to bookmarks.html
View session-manager-to-bookmarks.py
#!/usr/bin/env python3
"""Convert Firefox Session Manager sessions to bookmarks.html."""
import argparse
import json
import logging
import os
import sys
__version__ = '0.1.0'
@kevinoid
kevinoid / benchmark-defer-timeout-error.js
Created Mar 3, 2016
An example of how to add timeouts and recover from errors in deferred benchmarks with Benchmark.js.
View benchmark-defer-timeout-error.js
/**
* An example of how to add timeouts and recover from errors in deferred
* benchmarks with Benchmark.js.
*
* @see https://github.com/bestiejs/benchmark.js/issues/123
* @copyright Copyright 2016 Kevin Locke <kevin@kevinlocke.name>
* @license MIT
*/
'use strict';
@kevinoid
kevinoid / google-font-dl.py
Last active Jan 8, 2019
Downloader for Google Web Fonts
View google-font-dl.py
#!/usr/bin/env python3
#
# Downloader for Google Web Fonts
#
# For usage information run with "--help"
#
# Works on Python 2.6 and later, 3 and later
# Requires tinycss (and argparse for Python 2.6) from pip
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
You can’t perform that action at this time.