Skip to content

Instantly share code, notes, and snippets.

View mceachen's full-sized avatar

Matthew McEachen mceachen

View GitHub Profile
@mceachen
mceachen / gist:dcabad5476fea0e0c92dafe4869a0057
Created February 21, 2019 21:01
mocha 6 debug log for 29afc8f0
mrm@hack:~/src/exiftool-vendored.js (master *)$ DEBUG="mocha:*" yarn mocha --opts .mocha.opts
yarn run v1.13.0
$ /home/mrm/src/exiftool-vendored.js/node_modules/.bin/mocha --opts .mocha.opts
mocha:cli:options no config found in /home/mrm/src/exiftool-vendored.js/package.json +0ms
mocha:cli:options read .mocha.opts +2ms
mocha:cli:options .mocha.opts parsed succesfully +1ms
mocha:cli:mocha loaded opts { _: [],
opts: false,
config: false,
package: false,
### Keybase proof
I hereby claim:
* I am mceachen on github.
* I am mrmceachen (https://keybase.io/mrmceachen) on keybase.
* I have a public key ASCBWP-ugfBxlKdzBnWZgKVkGVm0WZ3mt7x8Y2OCB-hJfwo
To claim this, I am signing this object:
@mceachen
mceachen / etc > network > if-post-down.d > shutdown
Last active June 28, 2019 23:34
Gracefully shut down when the network shuts down.
#!/bin/sh
# This should be placed in /etc/network/if-post-down.d/shutdown, and set as executable.
/sbin/shutdown -h now
@mceachen
mceachen / LICENSE.md
Created October 28, 2019 05:53
TypeScript implementation of Optional/Some/None

MIT License

Copyright (c) 2016-2019 Matthew McEachen

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@mceachen
mceachen / fe.ts
Created December 12, 2019 23:38
Add title with URL for browsers that hide the URL on hover
export function $$<T extends HTMLElement = HTMLElement>(selector: string) {
return document.querySelectorAll<T>(selector)
}
export function blank(o: any): o is undefined {
if (o == null) return true
const s = String(o)
return s.length === 0 || s.trim().length === 0
}
@mceachen
mceachen / clone.sh
Created December 13, 2019 23:59
PhotoStructure for Node installation instructions
sudo -u photostructure bash
cd ~photostructure
git clone https://github.com/photostructure/photostructure-for-servers.git
@mceachen
mceachen / library-settings.toml
Created January 8, 2020 18:00
PhotoStructure settings snapshots
#
# Hello!
#
# These are settings for PhotoStructure, and are formatted using TOML. See
# <https://github.com/toml-lang/toml>.
#
# NOTE: Please shut down PhotoStructure before editing this file.
#
# Most settings have reasonable defaults, which are provided after the
@mceachen
mceachen / Example.ts
Last active July 4, 2020 22:14
TypeScript enumerations
export const Directions = strEnum("North", "South", "East", "West")
export type Direction = StrEnumKeys<typeof Directions>
@mceachen
mceachen / thenCollect.ts
Created July 11, 2020 21:14
Serial collection of a SyncOrAsync array applied against a function
export type SyncOrAsync<T> = T | Promise<T>
export type Maybe<T> = T | undefined
export type MaybeSyncOrAsync<T> = Maybe<SyncOrAsync<Maybe<T>>>
/**
* Serialized promise gathering and compaction
*/
export async function thenCollect<T1, T2>(
arr: MaybeSyncOrAsync<MaybeSyncOrAsync<T1>[]>,
f: (t: T1) => MaybeSyncOrAsync<T2>
@mceachen
mceachen / git-restage
Last active November 29, 2023 04:09
git-restage: Ensure all diffs in currently staged files are staged.
#!/bin/sh
# Stage all diffs found in currently staged files
# This is useful if you've got a set of files ready to commit, but edited one
# or more of them (via prettier, delinting, deleting debug statements, adding
# more tests, ...), and want to make sure those changes are included.
# Usage: `git restage`