Skip to content

Instantly share code, notes, and snippets.

View whymarrh's full-sized avatar

Whymarrh Whitby whymarrh

View GitHub Profile
@whymarrh
whymarrh / duplicates.sql
Created March 21, 2021 02:05
Select duplicate clues from the J! Archive
-- Using the db from https://github.com/whymarrh/jeopardy-parser
WITH duplicates(clue, occurrences) AS (
SELECT d.clue, COUNT(d.clue) AS occurrences
FROM documents AS d
WHERE d.clue NOT IN (
'=', '...',
'(missing clue)',
'(audio clue)', '[audio clue]', '[audio]',
'[Instrumental theme plays]', '[instrumental]',
'[Music plays]', '[theme music]',
@whymarrh
whymarrh / keybase.md
Created November 9, 2019 19:43
Keybase proof

Keybase proof

I hereby claim:

  • I am whymarrh on github.
  • I am whymarrh (https://keybase.io/whymarrh) on keybase.
  • I have a public key ASDvATuKuBF_Q8uauOaRThLUYqAwKVvHZ9d23lE_GdX57go

To claim this, I am signing this object:

@whymarrh
whymarrh / BaseTestCase.php
Last active February 8, 2018 17:58
Assert HTML validity with PHPUnit.
<?php
use PHPUnit_Framework_Exception;
use PHPUnit_Framework_TestCase;
use SimpleXMLElement;
class BaseTestCase extends PHPUnit_Framework_TestCase
{
/**
* Show as much error information as possible
@whymarrh
whymarrh / Dockerfile
Last active October 26, 2017 21:47
UDP broadcast quick playground
FROM alpine:3.6
RUN apk --update add python3
CMD ["python3"]
@whymarrh
whymarrh / rx.patch
Created April 2, 2017 19:01
Fix the RxJS v4 type definitions
node_modules/rx/{package.json.bak => package.json} | 1 +
1 file changed, 1 insertion(+)
diff --git a/node_modules/rx/package.json.bak b/node_modules/rx/package.json
index b4ce765..c7871af 100644
--- a/node_modules/rx/package.json.bak
+++ b/node_modules/rx/package.json
@@ -113,5 +113,6 @@
"test": "grunt"
},
@whymarrh
whymarrh / RangeMap.kt
Created March 12, 2017 23:08
Map a value from one range to another
fun rangeMap(value: Double, from: ClosedRange<Double>, to: ClosedRange<Double>): Double {
require(value in from, { "value $value must be in source range $from" })
return to.start + (to.endInclusive - to.start) * (value - from.start) / (from.endInclusive - from.start)
}
@whymarrh
whymarrh / manifest.json
Last active July 24, 2016 16:44
Minimal 'New Tab' page - a Chrome extension. See adamschwartz/chrome-new-tab.
{
"name": "Minimal New Tab",
"version": "0.0.0",
"manifest_version": 2,
"description": "A minimalist New Tab page.",
"chrome_url_overrides" : {
"newtab": "newtab.html"
}
}
@whymarrh
whymarrh / status.bash
Created November 25, 2013 01:28
Display unsigned exit status as signed value.
perl -e 'exit -1'
perl -e "print unpack('c', pack('C', $?)), \$/"
@whymarrh
whymarrh / build.xml
Created November 16, 2013 03:36
Simple Ant build file.
<!--
Directory structure:
.
├── build.xml
├── libs
└── src
   └── foo
   └── bar
@whymarrh
whymarrh / last.bash
Last active December 26, 2015 20:08
Print unique days on which I have used a machine.
#!/usr/bin/env bash
last | grep $(whoami) | tr -s ' ' | cut -d ' ' -f3 -f4 -f5 | uniq