Skip to content

Instantly share code, notes, and snippets.

View jhannah's full-sized avatar

Jay Hannah jhannah

View GitHub Profile
@jhannah
jhannah / silo_series.md
Last active September 28, 2019 02:28
Silo Series - Hugh Howey
# Book Pages % series complete Kindle Publish Date
1 Wool 37 2% (37) Wool Omnibus (1-5) July 30, 2011
2 Wool: Proper Gauge 80 8% (117) ^ November 30, 2011
3 Wool: Casting Off 89 14% (206) ^ December 4, 2011
4 Wool: The Unraveling 121 22% (327) ^ December 25, 2011
5 Wool: The Stranded 201 35% (528) ^ January 14, 2012
6 First Shift: Legacy 156 45% (684) Shift Omnibus (6-8) April 14, 2012
7 Second Shift: Order 151 55% (835) ^ November 20, 2012
8 Third Shift: Pact 213 70% (1048) ^ January 28, 2013
@jhannah
jhannah / gist:30e54bbf9963a9ca4bb0af8edfd4a04b
Last active March 15, 2018 20:00
PostgreSQL 10.3 coalesce vs. greatest
drop table t;
create table t(c1 int, c2 int);
insert into t values (1, null), (2, null), (null, 7), (null, 4), (3, 20);
# select * from t;
c1 | c2
----+----
1 |
2 |
| 7
✗ docker build --tag nemo-pytest --target nemo-pytest .
Sending build context to Docker daemon 49.77MB
Step 1/21 : FROM perl:latest AS nemo-cpan
---> 9af9f1088155
...
Step 18/21 : COPY testapi/requirements.txt testapi/requirements.txt
---> Using cache
---> e75b13cbcffa
Step 19/21 : RUN pip install -r testapi/requirements.txt
---> Using cache
@jhannah
jhannah / docker-wut.md
Last active March 9, 2018 18:50
Docker: du vs ls?

uhh... what? du -h thinks 8GB but ls -h thinks 64GB?

ANSWERED BELOW -- see gist Comments

➜  Jays-MBP:com.docker.driver.amd64-linux  ls -al
total 16430392
drwxr-xr-x@ 13 jhannah  staff          416 Mar  7 14:06 .
drwxr-xr-x  23 jhannah  staff          736 Mar  7 14:07 ..
-rw-r--r--@  1 jhannah  staff  68719476736 Mar  9 12:29 Docker.raw
@jhannah
jhannah / gist:1a235cfb6e013b548cf1605c9ac91ea9
Last active October 30, 2023 02:08
Jay's net worth distribution

As of 20231029. 48 years old. Employed (salary).

  • 47.4% House
  • 27.2% IRAs: Socially Responsible Investing (SRI) (0.89% expense ratio)
  • 26.9% 401K 100% S&P500 index fund (0.04% expense ratio + employer contract fees)
  • -19.3% Mortgage (15 year fixed, 2.18%)
  • 5.7% Vehicles
  • 5.7% Crypto (BTC, ADA, stETH, XTZ, DOGE)
  • 2.8% Checking / Savings / Empower Personal Cash (4.7% APY)
  • 2.3% Precious metals
From: https://gist.github.com/gnarf/5406589
✗ git pr 2528
* [new ref] refs/pull/2528/head -> pr/2528
Switched to branch 'pr/2528'
✗ git pr-clean 2528
git for-each-ref refs/heads/pr/* --format='%(refname)' | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done: -c: line 0: syntax error near unexpected token `"$@"'
git for-each-ref refs/heads/pr/* --format='%(refname)' | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done: -c: line 0: `git for-each-ref refs/heads/pr/* --format='%(refname)' | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done "$@"'
@jhannah
jhannah / gist:14f59e6d0c209da99e60afabd1704c3c
Last active March 22, 2017 17:52
PostgREST Resource embedding
UPDATE: THIS IS A KNOWN ISSUE:
https://github.com/begriffs/postgrest/issues/411
Remove the need for primary key column when embedding parents in &select
Remind me again: Is this a feature or a bug?
I HAVE TO add 'id' to my 'select=' even though I don't want it.
curl "$N/table1?select=field1,table2\{field2\}"
BEFORE
<?php
if (its_this() || its_that()) {
// do nothing
} else {
do_something();
}
?>
@jhannah
jhannah / gist:af570f2bee587835a28d086cd99cbc27
Last active January 30, 2017 17:57
how does this file get 6 times smaller, same # of lines?
$ ls -al out.txt
-rw-r--r-- 1 jhannah staff 14340349 Jan 30 12:33 out.txt
$ wc -l out.txt
554 out.txt
$ sort out.txt | uniq > out.unique.txt
$ ls -al out.unique.txt
-rw-r--r-- 1 jhannah staff 2857273 Jan 30 12:42 out.unique.txt
$ wc -l out.unique.txt
554 out.unique.txt
@jhannah
jhannah / gist:df45f3291f21fcc445e0e2256205ee25
Last active December 21, 2016 18:40
Use parens and ^ and \z in Perl regex's
$ cat j2.pl
use strict;
# use Regexp::Debugger;
my $orig = qr/css|js|htm|html|woff|woff2|ttf|otf/i;
my $modified = qr/^(css|js|htm|html|woff|woff2|ttf|otf)\z/i;
foreach my $in (
qw( css css2 c cssstmtmloffoff2tfltf ),
"\ncss\n", "\ncss", "css\n",