Skip to content

Instantly share code, notes, and snippets.

View gnprice's full-sized avatar

Greg Price gnprice

View GitHub Profile
@gnprice
gnprice / .gitconfig
Last active December 22, 2023 20:53
gitconfig
# This is a snapshot of my ~/.gitconfig file, minus a few bits
# that are obsolete or non-reusable.
#
# For explanation of each setting, see `git help config`
# or https://git-scm.com/docs/git-config .
#
[user]
name = Greg Price
email = gnprice@gmail.com
[alias]
@gnprice
gnprice / main.dart
Last active February 4, 2023 06:39
Exhaustiveness failure on Dart map patterns
import 'dart:collection';
void main() {
print(test({})); // -> unknown
print(test(BadMap2(false, 5))); // -> double
print(test(BadMap())); // -> oops! this map must be a sneaky one
}
String test(Map<bool, int> map) => switch (map) {
{} => 'unknown',
#!/bin/bash
set -eu
usage() {
cat >&2 <<'EOF'
usage: ./difflog $out1 $out2
Compare two Nix build logs, normalizing out boring differences.
This can be useful to test the effect of a change to build scripts,
@gnprice
gnprice / 00-def.js
Last active June 21, 2021 22:06
Generated notifs code
/* eslint-disable */
!(function(r) {
(r.__r = o),
(r.__d = function(r, i, n) {
if (e[i] != null) {
return;
}
const o = {
dependencyMap: n,
factory: r,
{ attr
}:
# Scaffold to build just one package with modified stdenv scripts.
#
# Dependencies come unmodified from <nixpkgs>, including the stdenv's
# toolchain. This is useful for (a) iterating quickly on changes to
# stdenv scripts (like setup.sh), and (b) more easily comparing the
# build log against a baseline, by keeping inputs' paths the same so
# that any changes caused by changes in the scripts' behavior stand out.
@gnprice
gnprice / # Python nixpkgs benchmarks
Last active April 2, 2020 04:55
Python benchmarks for nixpkgs
These are benchmark results from the "pyperformance" benchmark suite:
https://pyperformance.readthedocs.io/
on CPython built with various options for optimization.
For context, including the specific optimizations involved, see:
https://github.com/NixOS/nixpkgs/pull/84072
{
"\UF729" = moveToBeginningOfParagraph:; // home
"\UF72B" = moveToEndOfParagraph:; // end
"$\UF729" = moveToBeginningOfParagraphAndModifySelection:; // shift-home
"$\UF72B" = moveToEndOfParagraphAndModifySelection:; // shift-end
"^\UF729" = moveToBeginningOfDocument:; // ctrl-home
"^\UF72B" = moveToEndOfDocument:; // ctrl-end
"^$\UF729" = moveToBeginningOfDocumentAndModifySelection:; // ctrl-shift-home
"^$\UF72B" = moveToEndOfDocumentAndModifySelection:; // ctrl-shift-end
pragma solidity ^0.5.0;
contract LowestUnique {
uint256 ante = 0.01 ether;
enum Stage { INIT, IN_PROGRESS, END }
Stage private stage;
uint private commitDeadline;
uint private revealDeadline;
@gnprice
gnprice / fonts.conf
Created August 7, 2017 21:25
Noto CJK font fix
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!--
Problem: After installing the Noto fonts (on my Debian `stretch`
system, with `apt install fonts-noto`), Japanese text in my
browser ends up displayed in the "Medium" style of the font
rather than the "Regular" style. The "Medium" style is too
heavy for normal text.
@gnprice
gnprice / notes
Last active July 28, 2016 02:03
mypy on mypy, with --strict-optional
... actually, see https://paper.dropbox.com/doc/Mypy-strict-optional-UQPcKDn5VDdSXQme37o1G for much more easily-editable notes.