Skip to content

Instantly share code, notes, and snippets.

View JoshM1994's full-sized avatar

Josh Mustill JoshM1994

  • Span.IO
  • San Francisco
View GitHub Profile
@JoshM1994
JoshM1994 / removeDark.sh
Last active January 14, 2018 14:49
Use ImageMagick to filter out overly dark photos
#!/bin/bash
# Simple script used for filtering out photos taken on a timelapse camera
# Used in conjuction with [removeBlurry.sh](https://gist.github.com/JoshM1994/8ab288466500c26e7fcc62a388249abe)
mkdir -p tooDark
for f in `ls | sort -Vr`; do
AVG=$(convert $f -colorspace HCL -format '%M avg=%[fx:mean.g*1000] peak=%[fx:maxima.g]\n' info: | awk 'END {print $2}')
AVG=${AVG:4:5}
@JoshM1994
JoshM1994 / removeBlurry.sh
Created January 14, 2018 14:48
Use ImageMagick to filter out overly blurry photos
#!/bin/bash
# Simple script used for filtering out photos taken on a timelapse camera
# Used in conjuction with [removeDark.sh](https://gist.github.com/JoshM1994/0481b41d4bc83e15af3dc49b8424943d)
mkdir -p tooBlurry
for f in `ls | sort -Vr`; do
SD=$(identify -verbose $f | grep "standard deviation" | head -1)
ISOK=$(echo "${SD:25:5} > 50" | bc)
function promiseWait(timeToWait, startTime) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(new Date().getTime() - startTime);
}, timeToWait);
});
}
async function waitPromiseAll() {
const startTime = new Date().getTime();
function promiseWait(timeToWait, startTime) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(new Date().getTime() - startTime);
}, timeToWait);
});
}
async function waitChainPromiseAll() {
const startTime = new Date().getTime();
@JoshM1994
JoshM1994 / pager_comms.proto
Created October 30, 2019 04:19
Protobuf used by Burning Man pager app, relay board and network server
syntax = "proto3";
package loranetwork.v1;
import "loranetwork.v1/common.proto";
// The ping sent from the Android/iPhone Device to the BM Pager over BLE.
// To be forwarded to the cloud over LoRa
message PagerCommsTextMessage {
// There is no ID field here because this will be wrapped in a standard LoraPacket
@JoshM1994
JoshM1994 / pseudo-gateway-app.js
Created October 30, 2019 04:54
Pseudo Gateway App code
// If senderId does not exist in the members object mapping, add it with an empty array of messages
const addIfNotInNetwork = (members, senderId) => members[senderId] ? members : {
...members,
[senderId]: []
}
const loraMagicSend = () => {
// Send the message off over LoRa...
}
@JoshM1994
JoshM1994 / .eslintrc.js
Created November 2, 2019 00:00
An eslint configuration for any project (React, TypeScript, Node.js, React Native)
/**
#
# JS .eslintrc.js
# ____ ___ _ _ ___ _____ _____ ____ ___ _____
# | _ \ / _ \ | \ | |/ _ \_ _| | ____| _ \_ _|_ _|
# | | | | | | | | \| | | | || | | _| | | | | | | |
# | |_| | |_| | | |\ | |_| || | | |___| |_| | | | |
# |____/ \___/ |_| \_|\___/ |_| |_____|____/___| |_|
#
#
@JoshM1994
JoshM1994 / .prettierignore|.eslintignore
Created November 2, 2019 00:01
Prettier and eslint ignore configuration
# Standard
/.git
/.vscode
/.idea
node_modules
**/*_pb.js
built # or whatever name you use for your TypeScript compiled output
# Custom
@JoshM1994
JoshM1994 / .editorconfig
Created November 2, 2019 00:02
Editor Configuration for JavaScript projects
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@JoshM1994
JoshM1994 / prettier.config.js
Created November 2, 2019 00:03
Prettier configuration for most JS projects
/**
#
# JS prettier.config.js
# ____ ___ _ _ ___ _____ _____ ____ ___ _____
# | _ \ / _ \ | \ | |/ _ \_ _| | ____| _ \_ _|_ _|
# | | | | | | | | \| | | | || | | _| | | | | | | |
# | |_| | |_| | | |\ | |_| || | | |___| |_| | | | |
# |____/ \___/ |_| \_|\___/ |_| |_____|____/___| |_|
#
#