Skip to content

Instantly share code, notes, and snippets.

View dmajda's full-sized avatar

David Majda dmajda

View GitHub Profile
@dmajda
dmajda / indentation-based.pegjs
Created November 27, 2015 15:00
Simple intentation-based language PEG.js grammar
/*
* Simple Intentation-Based Language PEG.js Grammar
* ================================================
*
* Describes a simple indentation-based language. A program in this language is
* a possibly empty list of the following statements:
*
* * S (simple)
*
* Consists of the letter "S".
#!/bin/sh
# Script to reproduce https://github.com/pegjs/pegjs/issues/434.
#
# Copy into an empty directory and run:
#
# $ sh 434.sh
mkdir src
mkdir lib
@dmajda
dmajda / sanity-check.sh
Created August 5, 2016 11:03
sanity-check.sh
#!/bin/sh
# A script I used as a sanity check that PEG.js works with a particular version
# of Node.js.
#
# Example usage:
#
# nvm use 6.3.1 && PEGJS_DIR=../pegjs ./sanity-check.sh
#
@dmajda
dmajda / sqlite-history-https.txt
Created January 10, 2017 14:13
Determining percentage of HTTPS URLs in my browser history
$ sqlite3 History 1 ↵
SQLite version 3.8.10.2 2015-05-20 18:17:19
Enter ".help" for usage hints.
sqlite> SELECT COUNT(*) FROM urls WHERE url LIKE 'https://%';
20231
sqlite> SELECT COUNT(*) FROM urls;
29485
sqlite> SELECT 20231 / 29485.0; -- `.0` forces float division
0.6861454977107
@dmajda
dmajda / README.txt
Created September 2, 2020 14:19
Files reproducing a bug in `pytest-asyncio`
This Gist contains files reproducing a bug in `pytest-asyncio` that appears
when testing an aiohttp application. The bug is a regression. The last good
version is 0.12.0, the first bad version is 0.14.0 (it looks like there is no
0.13.0).
Without the bug:
```console
$ pip3 install -r requirements-0.12.0.txt
$ pytest > pytest-output-0.12.0.txt