Skip to content

Instantly share code, notes, and snippets.

Avatar
💥
Boom!

Ian Langworth ☠ statico

💥
Boom!
View GitHub Profile
@statico
statico / purple-air-aqi.15m.sh
Last active Aug 26, 2020
Purple Air Sensor Plugin for BitBar
View purple-air-aqi.15m.sh
#!/usr/bin/env bash
#
# <bitbar.title>Purple Air PM2.5 AQI</bitbar.title>
# <bitbar.dependencies>bash,jq,node</bitbar.dependencies>
#
# Derived from https://github.com/matryer/bitbar-plugins/blob/master/Weather/aqi.15m.sh by Chongyu Yuan
COLORS=("#0ed812" "#ffde33" "#ff9933" "#cc0033" "#660099" "#7e0023" "#404040")
PURPLE_AIR_SENSOR_ID=5220
@statico
statico / Dockerfile
Created Mar 9, 2020
Single server prototyping with docker-compose + nginx
View Dockerfile
# Remember that additional env vars can be in a .env, which docker-compose
# uses when building the image.
FROM node:12.9.0-alpine AS base
VOLUME /usr/local/share/.cache/yarn
COPY ./ /app/
WORKDIR /app/
RUN npm install --silent --global yarn
RUN yarn install --pure-lockfile --non-interactive
@statico
statico / .dockerignore
Created Mar 4, 2020
TypeScript + Apollo monorepo config
View .dockerignore
.DS_Store
.env
.vscode
Dockerfile
docker-compose.yml
frontend/.next
frontned/out/
node_modules
npm-debug.log*
yarn-debug.log*
@statico
statico / google-hire-to-csv.js
Last active Sep 14, 2020
Google Hire data export to useful CSV
View google-hire-to-csv.js
// This is free and unencumbered software released into the public domain.
const csv = require('fast-csv')
const dir = process.argv[2]
if (!dir) {
throw new Error('usage: export.js <export-dir>')
}
// Raw data from Google Hire export
@statico
statico / 00_statico.link_README.md
Last active Nov 20, 2020
Ian's Personal Short Link Bookmark Service
View 00_statico.link_README.md
@statico
statico / readme.md
Last active Apr 17, 2019
Zelda BotW icon export for Slack emoji
View readme.md
  1. Go to https://zelda.gamepedia.com/Items_in_Breath_of_the_Wild and "Save as Web Page" with Chrome
  2. In a new folder, cp ../*/*BotW_*png .
  3. Use rename to rename all the files, hopefully keeping the larger version of all files: rename -f '$_=lc $_; s/botw\W//g; s/\d+px.//i; s/_Icon//i; s/_/-/g; s/^(botw-)?/botw-/; s/[^\w.-]+//g; s/-+\.png/.png/' *
  4. Resize to 128x128px max with ImageMagick: mogrify -resize '128x128>' *.png
  5. Upload with the neutral-face-emoji-tools Chrome extension, possibly merging in https://github.com/Fauntleroy/neutral-face-emoji-tools/pull/15 to rate limit uploads
@statico
statico / streaming-csv-writer.ts
Created Mar 8, 2019
Streaming CSV Writer / TypeScript
View streaming-csv-writer.ts
import * as stringify from 'csv-stringify/lib/sync'
import * as fs from 'fs-extra'
import { Writable } from 'stream'
import * as tempy from 'tempy'
// Stringifies and writes a row at a time to disk. Call close() when finished to
// get the path to a temporary file where the CSV was written. You are
// responsible for deleting that file when finished.
export class StreamingCSVWriter {
private count: number
@statico
statico / data.ts
Created Mar 8, 2019
Get a Google Sheet using NodeJS async and TypeScript and Service Account credentials
View data.ts
import * as fs from 'fs-extra'
import { google } from 'googleapis'
import * as pathlib from 'path'
const getSheet = async (
keyFile: string,
spreadsheetId: string,
range: string
): Promise<string[][]> => {
const auth = await google.auth.getClient({
You can’t perform that action at this time.