Skip to content

Instantly share code, notes, and snippets.

View plmrry's full-sized avatar
🦆
converting JSON to other JSON

Paul Murray plmrry

🦆
converting JSON to other JSON
View GitHub Profile
@plmrry
plmrry / README.md
Created February 17, 2022 21:39
Apache Arrow Test

This is a test

@plmrry
plmrry / run-ffmpeg.js
Created July 15, 2021 20:48
Create videos with ffmpeg
// Various ways that I have called ffmpeg in the past
exec(
`ffmpeg -y \
-framerate 60 \
-pattern_type glob \
-i "${framesDirectory}/*.png" \
-crf 27 \
-pix_fmt yuv420p \
-filter:v scale=1000:-1 \
@plmrry
plmrry / search.sh
Created July 14, 2021 23:10
Search through hidden files
grep --no-messages --exclude=".zsh_history" "bloomberg" .*
@plmrry
plmrry / proj4toD3.js
Last active June 4, 2021 17:30
proj4 to D3 projection
function radiansToDegrees(radians) {
return (radians * 180) / Math.PI;
}
function degreesToRadians(degrees) {
return degrees * (Math.PI / 180);
}
function proj4toD3(proj4String) {
const proj4 = require("proj4");
@plmrry
plmrry / fetchGeoJSON.js
Created June 4, 2021 17:05
Fetch shapefile, create GeoJSON
const fetch = require("node-fetch");
const jszip = require("jszip");
const shapefile = require("shapefile");
async function fetchGeoJSON(endpoint) {
console.log(`🐞 Endpoint: ${endpoint}`);
console.log(`🐞 Fetching..`);
const res = await fetch(endpoint);
const buffer = await res.buffer();
console.log(`🐞 Un-zipping...`);
@plmrry
plmrry / README.md
Last active October 18, 2018 01:25
Line Hovering With Point Sampling

Voronoi diagrams are often used to highlight nearby points based on mouse position.

However, the Voronoi will not always work as intended when working with paths.

Try hovering over the middle of the red path — although the mouse is closer to the red path, the blue line is highlighted.

We can fix this problem by sampling points along the path (similar to the technique used here), and adding these sampled points to the Voronoi mesh.

@plmrry
plmrry / iap_node.js
Last active July 28, 2020 09:53
Node.js GCP IAP Service Account Authentication
const request = require('request');
const jws = require('jws');
const OAUTH_TOKEN_URI = 'https://www.googleapis.com/oauth2/v4/token';
const APP_HOST = process.env.APP_HOST;
const APP_URI = `https://${APP_HOST}`;
const creds = require('./service_account');
var iat = Math.floor(new Date().getTime() / 1000);
@plmrry
plmrry / .block
Last active May 17, 2017 14:16
Tracking 3D Coordinates
license: mit
@plmrry
plmrry / stupid.ts
Created January 10, 2017 22:59
Stupid stream
class Stream<T> {
constructor(private start: Start<T>) {}
listen(next: Listener<T>) { this.start(next) }
}
class Stream<T> {
constructor(private start: Start<T>) {}
compose<U>(fn: (stream: Stream<T>) => Stream<U>): Stream<U> {
return fn(this);
}
@plmrry
plmrry / docker-compose.yml
Created January 10, 2017 20:15
Basic node/mongo Docker compose file
version: '2.1'
services:
node:
build: .
env_file: .env
working_dir: /usr/src/app
volumes:
- ./:/usr/src/app
depends_on:
- mongo