Skip to content

Instantly share code, notes, and snippets.

View acdvorak's full-sized avatar

Andrew C. Dvorak acdvorak

View GitHub Profile
@acdvorak
acdvorak / unicode.f90
Last active July 2, 2021 09:10
Fortran 95 Unicode string test
! unicode.f90
!
! From https://cyber.dabamos.de/programming/modernfortran/unicode.html
!
! Modern Fortran language standards have no intrinsic support for Unicode I/O.
! To bypass this limitation, the Universal Coded Character Set defined in ISO 10646
! can be used instead, which is mostly identical to UTF-32.
! All code points of the Basic Multilingual Plane can be accessed,
! while the Supplementary Multilingual Plane is not supported.
!
@acdvorak
acdvorak / git-aliases.sh
Created March 15, 2019 16:55
Git aliases: tickle (create dummy commit) and undo (revert last commit)
git config --global alias.undo '!git rev-parse HEAD | xargs git revert --no-edit'
git config --global alias.tickle '!echo foo >> temp.txt && git add temp.txt && git commit --no-verify -m "WIP: Dummy commit" && git undo'
@acdvorak
acdvorak / htoprc
Created January 24, 2019 21:04
htop config: collapse multiple CPU cores into one graph, display per-process memory usage, highlight binary names
# ~/.config/htop/htoprc
# Beware! This file is rewritten by htop when settings are changed in the interface.
# The parser is also very primitive, and not human-friendly.
fields=0 48 46 47 38 49 2 1
sort_key=46
sort_direction=1
hide_threads=1
hide_kernel_threads=1
hide_userland_threads=1
shadow_other_users=0
@acdvorak
acdvorak / git-gpg-signing.sh
Last active January 8, 2019 21:49
GPG signing for Git commits and tags
#!/bin/bash
# Set this value to `1` to test the script in a temporary directory
# without making any permanent global changes.
DRY_RUN=1
GLOBAL_GIT_FLAGS=()
if [[ "$DRY_RUN" == 1 ]]; then
export GNUPGHOME="$(mktemp -d)"
@acdvorak
acdvorak / mov-to-gif.sh
Created November 13, 2018 17:08
Convert video files to animated GIF with FFmpeg
# Usage: mov-to-gif path/to/input.mov [path/to/output.gif]
#
# This script generates high-quality GIFs at reasonable file sizes from practically *any* type of video file.
# By default, it reduces the framerate to 10 fps and scales the resolution to 800px wide (maintaining aspect ratio), but
# those parameters can be changed below.
#
# If no output path is specified (second argument), the script will use the input file's path with the extension changed
# to ".gif".
#
# EXISTING GIF FILES WILL BE OVERWRITTEN AUTOMATICALLY!
@acdvorak
acdvorak / npm-module-size.sh
Created October 25, 2018 20:08
NPM module disk space calculator
#!/bin/bash
cd "$TMPDIR"
mkdir npm-dep-size
cd npm-dep-size
npm install @material/top-app-bar
du -h -d 0 node_modules
# OUTPUT: 736K node_modules
@acdvorak
acdvorak / screenshot-datastore-stats.js
Last active October 4, 2018 21:14
MDC Web Screenshot Datastore stat counter
const CloudDatastore = require('../infra/lib/cloud-datastore');
const cloudDatastore = new CloudDatastore();
async function runAsync() {
const ds = cloudDatastore.datastore_;
const query = ds.createQuery('ScreenshotStatus');
// runQuery returns an array: [resultArray, cursorInfoObject]
const queryResult = await ds.runQuery(query);
@acdvorak
acdvorak / update-golden-html-urls.js
Created August 28, 2018 22:11
Update all HTML file URLs in golden.json to the latest test pages
/**
* @fileoverview https://github.com/material-components/material-components-web/pull/3458
*/
const stableStringify = require('json-stable-stringify');
const LocalStorage = require('../infra/lib/local-storage');
const localStorage = new LocalStorage();
async function runAsync() {
@acdvorak
acdvorak / gist:947148ef405818c0a17e0185f193815c
Last active August 8, 2018 00:34 — forked from dalethedeveloper/gist:1846552
Techniques for Anti-Aliasing @font-face on Windows

Techniques for Anti-Aliasing @font-face on Windows

It all started with an email from a client: Do these fonts look funky to you? The title is prickly.

The font in question was Port Lligat Sans from Google Web Fonts.

The "prickly" is aliasing caused by lack of hinting

@acdvorak
acdvorak / pr-3060-stdout.log
Created July 12, 2018 18:47
PR #3060 stdout log
$ npm run screenshot:test
> @ screenshot:test /Users/advorak/dev/mdc-web
> node "$PWD/test/screenshot/run.js" test
Build is already running (pid 23718)
Fetching remote git commits...
Prefetching golden images...
Skipping 0 screenshots: