Skip to content

Instantly share code, notes, and snippets.

View pkqk's full-sized avatar
📯
💨 🎶 🎵 🎶

Adam Sven Johnson pkqk

📯
💨 🎶 🎵 🎶
View GitHub Profile
@pkqk
pkqk / create.sh
Last active January 28, 2022 01:49
Whale Tales 2022
url=https://www.whaletales2022.org/wp-json/wpgmza/v1/features/base64eJyrVkrLzClJLVKyUqqOUcpNLIjPTIlRsopRMo5R0gEJFGeUFni6FAPFomOBAsmlxSX5uW6ZqTkpELFapVoABaMWvA
curl -k "${url}" | jq '{type: "FeatureCollection", features:[.markers[]|select(.lat != "NA")|{type: "Feature",geometry: {type: "Point", coordinates: [(.lng|tonumber),(.lat|tonumber)]}, properties:{title:.title, link: "https://whaletales2022.org\(.link)"}}]}' > whaletales.geojson
@pkqk
pkqk / Dockerfile
Created April 11, 2018 09:19
timestamp/protobuf question
FROM golang:alpine
RUN apk add --no-cache git make protobuf
RUN go get github.com/golang/protobuf/protoc-gen-go
046986c34608f3fe1ef99a92471ddcf577674136d733e753cb88bdc02dbd2b9ab89fe90c08563c359b67c2e5d119d2072b07799b6d3bcc73a29d823c941c78c249
@pkqk
pkqk / check.sh
Last active October 28, 2015 14:53
urls=$(curl -s "http://manifoldgarden.tumblr.com/rss" | grep -o 'http://imgur.com/[^"&]\+' | uniq | sed -e 's/imgur/i.imgur/' -e 's/$/.png/')
for url in ${urls}
do
filename=$(basename $url)
if [ ! -e "${filename}" ]
then
curl -s -O "${url}"
fi
done
@pkqk
pkqk / .env
Last active October 26, 2015 15:44
dynamic rails config files
ODC_REDIS_SERVER_URL="redis://$(docker-service odc-redis 6379)"␍
@pkqk
pkqk / howto.md
Created October 1, 2015 16:21
how to search catalog.data.gov by facet

The ckan search interface exposes it's SOLR backend so most of those docs are useful.

I haven't managed to find a way to list facets but once you've guessed the name of one:

http://catalog.data.gov/api/3/action/package_search?facet.field=license_id&fq=license_id:other-license-specified

or if the value has spaces in it you can quote the search license_title:"Creative Commons Attribution":

http://catalog.data.gov/api/3/action/package_search?facet.field=license_title&fq=license_title:%22Creative%20Commons%20Attribution%22
@pkqk
pkqk / nodes-map.sh
Last active September 15, 2015 14:27
turn content api results into geojson
curl "http://contentapi.theodi.org/with_tag.json?type=node" |
jq '{
type: "FeatureCollection",
features: [
.results[] | {
type: "Feature",
geometry: {type: "Point", coordinates: [.details.location[1], .details.location[0]]},
properties: {name: .title}
}
]
@pkqk
pkqk / labs.bash
Created July 31, 2015 12:46
ODI labs
#!/bin/bash
image="$1"
output=${2:-test.png}
gravity=${3:-Center}
convert "${image}" -resize 500x200^ -gravity "${gravity}" -crop 500x200+0+0 "${output}"
composite odi-mask.png "${output}" "${output}"
@pkqk
pkqk / tug-o-war.sh
Last active August 29, 2015 14:17
pull all the repos
# for each match that is a directory with a git repo in it
for dir in */.git
do
# change into directory
# dirname gets rid of the .git
# quotes around $dir in case a name with spaces comes along
pushd `dirname "$dir"`
# fetch new updates
# but only pull them into your branch if you haven't changed anything
git fetch && git pull --ff-only

Keybase proof

I hereby claim:

  • I am pkqk on github.
  • I am pkqk (https://keybase.io/pkqk) on keybase.
  • I have a public key whose fingerprint is 3B93 48C9 29A5 3871 B646 3902 1261 8403 E5AF 379E

To claim this, I am signing this object: