Skip to content

Instantly share code, notes, and snippets.

@jasonaowen
jasonaowen / README.md
Last active June 30, 2021 18:16
StarCraft 2 Static Data API

Sometime between January 11, 2021 and May 24, 2021, the static data endpoint (/sc2/static/profile/:regionId) of the StarCraft II Community APIs started returning incorrect data. The older data (static-data.en_US.2021-01-11.json) appears to be correct; the newer data (static-data.en_US.2021-05-24.json) has different IDs for achievements, and appears to have some non-achievements mixed in.

Some achievements are unchanged, such as 91475035554341 "Bonus Objectives: Kaldir" ("Complete all Bonus Objectives in each of the Kaldir Missions."), but others have the wrong ID, such as

@jasonaowen
jasonaowen / psql-sequences.log
Created March 4, 2021 09:04
Skipping sequence values in PostgreSQL
[local] owenja@owenja=> create temporary table demo (id integer primary key generated always as identity, value text);
CREATE TABLE
[local] owenja@owenja=> insert into demo (value) values ('a');
INSERT 0 1
[local] owenja@owenja=> select * from demo;
id | value
----+-------
1 | a
(1 row)
@jasonaowen
jasonaowen / README.markdown
Last active February 25, 2019 17:15
Removing trailing whitespace

Remove trailing whitespace from text files in a git repo.

From git help grep:

-l, --files-with-matches, --name-only, -L, --files-without-match
    Instead of showing every matched line, show only the names of files that contain
    (or do not contain) matches. For better compatibility with git diff, --name-only
    is a synonym for --files-with-matches.
-I
@jasonaowen
jasonaowen / create-plog-alias.sh
Last active June 14, 2017 16:10
git plog - pretty, graphical log
git config \
--global \
alias.plog \
"log --oneline --graph --all --decorate --pretty='format:%C(yellow)%h%C(auto)%d %Creset%s %C(cyan)[%an] %C(blue)%ar'"
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDy6q90iprr4ofdpO/+kTEnfnmfUBr/xeFmP0MjXYP2n6lwzmewbvdVWhkQoV0SOJZKe6v99gJF+OCLBKO/N4lvrODTIrJKaWb2MxG0vR1AX0ntaz/FUSVLX/SHuyw3uOUpzqIoYevZhmEYOZlxRC7zDBxmGv56KeLhtADujISSU1v2ZnV47jKZCpLtKqqEVn7XgiBiOBQiXxzFHDH4x0bxKjo9mGfQzKvK7upUDqhMYr9/2GE5V1l7rO8t1gnTis/ZbkCeJmLFFQ0bPCkxz6gq1wzxcgpU2W1fClgJ7lYlUksoqDuzyShMerS+co9s3hry8o1Rja7W9JD+e5iwmeu9qLapjb5CN6pJWEDTi2u6yXNwu76a8KPxw8ncWAXMnPQwqNFmqU11SNlCyF0Ztr/XU+y8M2Z0RGMXTCrciBSfdB0p+BY8sN90dnkXgQoX36iP3IyOyIInxakq2nn7zAOc8A2ZuEECLT0o/rx/HI3KtoxOy5bObY18/dENZe6pABPhQc5aWOfHca5xZXktvekWt69FNxwWApLUckmm2ZQMbKtXT/DoqQnPxL9InbaBihlBZnfwu/s+n57R0TLQs77wswmS0jXcohIeIYvEXnka+zfwKxjPRbdHT0/w46H2szUN5UE2bOVTEuDAGRpyfGITXOCktZQ5mvNTSTdpE1tv5w== owenja@kale
@jasonaowen
jasonaowen / output.txt
Created February 8, 2017 20:29
How do you use variable names that shadow column names?
> select foo()
column reference "bar" is ambiguous
LINE 1: SELECT bar FROM foobar LIMIT 1
^
DETAIL: It could refer to either a PL/pgSQL variable or a table column.
QUERY: SELECT bar FROM foobar LIMIT 1
CONTEXT: PL/pgSQL function foo() line 1 at SQL statement
@jasonaowen
jasonaowen / hamming-numbers.hs
Created January 10, 2017 23:11
A (failed) attempt at generating Hamming numbers (aka regular numbers) for Code Dojo
hamming :: (Int, Int, Int) -> Int
hamming (two, three, five) = 2^two * 3^three * 5^five
nextHammingCoefficient (x, y, z)
| minimum [nextX, nextY, nextZ] == nextX = (x + 1, y, z)
| minimum [nextX, nextY, nextZ] == nextY = (x, y + 1, z)
| minimum [nextX, nextY, nextZ] == nextZ = (x, y, z + 1)
where nextX = hamming (x + 1, y, z)
nextY = hamming (x, y + 1, z)
nextZ = hamming (x, y, z + 1)
@jasonaowen
jasonaowen / keybase.md
Created November 1, 2016 03:27
keybase.md

Keybase proof

I hereby claim:

  • I am jasonaowen on github.
  • I am jasonaowen (https://keybase.io/jasonaowen) on keybase.
  • I have a public key whose fingerprint is 2B38 BD95 5557 647E 7C26 B53C 19E2 7469 767C FC68

To claim this, I am signing this object:

# df -h /home
Filesystem Size Used Avail Use% Mounted on
- 0 0 0 - /home
case $TERM in
xterm*|cygwin*|screen)
termstr='\[\033]0;\h:\w\007\]'
;;
*)
;;
esac
function promptreturn { ret=$?; if test "$ret" = "0"; then echo -e "\e[1;32m$ret"; else echo -e "\e[1;31m$ret"; fi; unset ret; }