Skip to content

Instantly share code, notes, and snippets.

View dillonchr's full-sized avatar

Dillon Christensen dillonchr

  • Bixby, OK
View GitHub Profile
@dillonchr
dillonchr / calculate-weight.js
Created December 1, 2021 05:32
water weight
(function(weight) {
// how much water weighs per gallon
const WATER_WEIGHT_IN_POUNDS_PER_GALLON = 8.34;
// how much of the body is made of water
const WATER_PERCENTAGE_IN_BODY = 0.6;
function getGallonsOfWater(weight) {
return weight * WATER_PERCENTAGE_IN_BODY / WATER_WEIGHT_IN_POUNDS_PER_GALLON;
}
@dillonchr
dillonchr / refresh-css.js
Created August 16, 2021 17:39
refresh css
for (const link of document.querySelectorAll('link[href^="/css/"]')) { link.setAttribute("href", link.getAttribute("href").replace(/\?.*$/, "") + `?cc=${Date.now()}`)}
@dillonchr
dillonchr / scenes.sh
Created August 5, 2021 04:53
scene thumbnailer
#!/bin/bash
SOURCE="$1"
TS_FILE=raw_timestamps
ffmpeg -i "$SOURCE" -filter:v "select='gt(scene,0.4)',showinfo" -f null - 2> $TS_FILE
TIMES=$(grep showinfo $TS_FILE | grep 'pts_time:[0-9.]*' -o | grep '[0-9]*\.[0-9]*' -o)
for ts in $TIMES
do
ffmpeg -ss "$ts" -i "$SOURCE" -vframes 1 -q:v 5 "t_${ts}.jpg"
@dillonchr
dillonchr / botconfigs.py
Created December 30, 2020 15:51 — forked from oliveratgithub/botconfigs.py
Bot script for Telegram Messenger to publish stock market price updates - Python 3.x compatible and can run as a nohup service
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ~~~~~
# Telegram Bot API configs for stock_notifications.py
# ~~~~~
token=''
chat=''
@dillonchr
dillonchr / reload-interval.js
Last active May 8, 2020 19:58
randomly reload your window
setInterval(() => {
const here = Math.random() * 100;
if (85 < here && here < 90) {
return window.location.reload();
}
const rando = () => ~~(Math.random() * 255);
const [r, g, b] = Array(3).fill('').map(rando);
const yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;
const color = [r, g, b].reduce((s, n) => s + n.toString(16), '#');
const textColor = 128 < yiq ? 'black' : 'white';
@dillonchr
dillonchr / console.js
Created April 29, 2020 17:22
noun project copier
copy(atob($0.style.backgroundImage.split(',')[1].replace(/"\)/, '')))
@dillonchr
dillonchr / README.md
Created April 24, 2020 18:29
set up thinkpad
@dillonchr
dillonchr / helper.md
Last active April 22, 2021 16:20
macbook webcam snapper

copied from: https://gist.github.com/docPhil99/d8667de1e8c5e96e2203f2bc0f28f89d

Capture and stream a webcam

To capture using the iSight camera on a Mac, or infact any other webcam connected to the Mac, we can use FFmpeg. First get a list of the devices installed.

ffmpeg -f avfoundation -list_devices true -i "" 

This will list the aviable video and audio devices.

The below will capture at 30fps and the set video size to a file.

@dillonchr
dillonchr / mkvjoin.sh
Created April 10, 2020 21:44
OBS records MKVs right? Well this zips them into one MKV for easy YouTubin'
#!/bin/bash
# usage: ./mkvjoin.sh "2020-04-03"
# then all recordings in the current dir with that file prefix (PREFIX*.mkv)
# will be ffmpeg'd into a single mkv stream without conversion so it's fast
#
# usage: ./mkvjoin.sh
# no arg will cause it to use today's date
# tested on macOS 10.15.3 (Catalina) heh
if [ -z "$1 " ]
@dillonchr
dillonchr / resume.json
Created April 7, 2020 00:32
json resume!
{
"basics": {
"name": "Dillon Christensen",
"label": "Fullstack Javascript Developer",
"email": "j.dillon.christensen@gmail.com",
"phone": "(918) 896-7033",
"summary": "Product developer with experience across browsers, operating systems, devices, and architectural layers. Specializing in javascript development with React and RESTful APIs. Recognized for being a clear and effective communicator and mediating software disciplines and stakeholder concerns. Motivated by a love of learning which leads to new opportunities and challenges to learn from different projects and teams.",
"location": {
"postalCode": "OK 74008",
"city": "Bixby",