Skip to content

Instantly share code, notes, and snippets.

View colinbendell's full-sized avatar
🦑

Colin Bendell colinbendell

🦑
View GitHub Profile
@colinbendell
colinbendell / flags.json
Last active December 23, 2022 20:23
bmw-flags-2022-12
GET /eadrax-fts/v1/flags @false
{
"flags": [
{"flagId": "account-deletion-bySms-toggle", "isActive": false},
{"flagId": "account-deletion-toggle", "isActive": false},
{"flagId": "accumulated-view-toggle", "isActive": true},
{"flagId": "alexa-in-car-toggle", "isActive": true},
{"flagId": "alexa-skill-toggle", "isActive": true},
{"flagId": "alternative_route_origin-toggle", "isActive": false},
{"flagId": "api-overload-flag-toggle", "isActive": false},
@colinbendell
colinbendell / 55-bytes-of-css.md
Created October 10, 2022 18:36 — forked from JoeyBurzynski/55-bytes-of-css.md
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@colinbendell
colinbendell / js-get-last-array-entry.js
Last active December 16, 2021 20:29
Compare Javascript v8 .slice.pop() vs. .slice(-1) memory and timing performance
const { PerformanceObserver, performance, constants } = require('perf_hooks');
const MAX_TEST_SIZE = Math.pow(2,16); //65536
// pre-allocate an array filled with objects (primatives like Number and Boolean have internal cpp optimizations)
const a = new Array(MAX_TEST_SIZE).map(v => ({}));
// pre-allocate an array for the results. this way we don't count the heap overhead from assigning the target variables
const b = new Array(MAX_TEST_SIZE);
let totalHeapUsed = 0;
let heapUsed = 0;
cd ~/Downloads/
sudo hdiutil create -o InstallMedia -size 20G -layout SPUD -fs HFS+J -type SPARSE
sudo hdiutil attach InstallMedia.sparseimage -noverify -mountpoint /Volumes/install_build
sudo /Applications/Install\ macOS\ Beta.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build
sudo hdiutil detach -force /Volumes/Install\ macOS\ */
# ^^ Might fail; manually eject using finder.
sudo hdiutil convert InstallMedia.sparseimage -format UDZO -o InstallMedia.dmg
@colinbendell
colinbendell / snowflake-r
Last active February 24, 2021 13:48
simple query in R backing against snowflake
library(dbplyr)
library(dplyr.snowflakedb)
options(dplyr.jdbc.classpath = "~/Downloads/snowflake-jdbc-3.5.3.jar")
# Update with credentials
snowflake_db <- src_snowflakedb(user = ""password = "", account = "ab123456", region = "us-east-1", opts = list(warehouse = "import", db = "cloudinary", schema = "public"))
benchmarks <- tbl(snowflake_db, in_schema("cto","lossy_benchmark_fast_v1_1"))
@colinbendell
colinbendell / convert_giphy_gifs.sh
Created December 4, 2017 02:48
Simple mass conversion of GIF to MP4 (h264/h265), WebM (vp8/vp9) and WebP
#!/bin/sh
curl 'https://giphy.com/page/2?next=2017-12-01%2004%3A15%3A01&amp%3Bis=1&is=1&json=true' -o gipyurls.json
jq .[].gifs[].images.original.url gipyurls.json |cut -d / -f 5 | parallel -j 20 --gnu curl https://media2.giphy.com/media/{}/giphy.gif -o {}.gif
parallel -j 20 --gnu "ffmpeg -f gif -i {} {}.h264.mp4" ::: *.gif
parallel -j 20 --gnu "ffmpeg -f gif -i {} -c:v libx265 {}.h265.mp4" ::: *.gif
parallel -j 20 --gnu "ffmpeg -f gif -i {} -c:v libvpx {}.vp8.webm" ::: *.gif
parallel -j 20 --gnu "ffmpeg -f gif -i {} -c:v libvpx-vp9 {}.vp9.webm" ::: *.gif
@colinbendell
colinbendell / imagedata.js
Last active December 5, 2017 09:36
Extract a set of image information from a webpage
let imgData = Array.from(document.getElementsByTagName("img"))
.map(v => {
var rect = v.getBoundingClientRect();
var vHeight = (window.innerHeight || doc.documentElement.clientHeight);
var vWidth = (window.innerWidth || doc.documentElement.clientWidth);
var vDPR = window.devicePixelRatio;
return {
src: v.currentSrc,
cssWidth: v.clientWidth,
naturalWidth: v.naturalWidth,