This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Partial calculator. | |
* | |
* I have some enclosures, and I want to make a puzzle. | |
* | |
* I'll turn the enclosures into a calculator, with no | |
* display but nine LEDs at the top. Some digits will | |
* be missing. | |
* | |
* The calculator will have 4 operations: +, -, x, ÷. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d1 $ sound "bd bd bd bd" | |
d2 $ sound "hh hh hh hh hh" | |
d2 $ silence | |
d3 $ sound "arpy" | |
d4 $ sound "bd sd hh cp mt arpy drum odx bd arpy bass2 feel future" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Overall voting accuracy | |
SELECT client_id, | |
IF(total, Round (100 * valid / validated, 2), NULL) AS rate | |
FROM (SELECT user_clients.*, | |
COUNT(vote_id) AS total, | |
Coalesce(Sum(agree_count > disagree_count), 0) AS valid, | |
Coalesce(Sum(( agree_count >= 1 | |
OR disagree_count >= 2 ) | |
AND agree_count <> disagree_count), 0) AS validated | |
FROM (SELECT user_clients.*, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- To connect to the prod database with write access, | |
-- $ ssh voice-mysql-prod | |
-- $ sudo su | |
-- $ mysql | |
-- > use voice; | |
-- > ... | |
/* | |
Example team award: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let p=location.search?.slice(1).split(/&|=/).reduce((o,k,i,a)=>++i%2?(o[k]=a[i],o):o,{}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a Photoshop script, not React. | |
// | |
var white = new SolidColor(); | |
white.rgb.hexValue = "ffffff"; | |
app.backgroundColor = white; | |
var doc = app.activeDocument; | |
doc.changeMode(ChangeMode.RGB); | |
// Crop and resize. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const normalize = a => a.reduce((arr, val, i) => {arr[i + 1] = arr[i] + val; return arr;}, [0]).map((v, i, arr) => v / arr[arr.length - 1]); | |
const getWeighted = (a, r) => a.findIndex(v => v > r); | |
const letters = 'abcdefghijklmnopqrstuvwxyz'.split(''); | |
const letterWeights = normalize([9, 2, 2, 4, 12, 2, 3, 2, 9, 1, 1, 4, 2, 6, 8, 2, 1, 6, 4, 6, 4, 2, 2, 1, 2, 1]); | |
const wordLengthWeights = normalize([0, 1, 7, 4, 4, 4, 5, 3, 4, 2, 1, 1, 1, 1, 1, 1, 1]); // 1, 2, 3... | |
console.log(Array.from({length: 50}, (_, i) => | |
Array.from({length: getWeighted(wordLengthWeights, Math.random())}, () => letters[getWeighted(letterWeights, Math.random())]).join('') | |
).sort((a, b) => a.length - b.length).join('\n')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Dwitter backup scripts. | |
Is the API up? | |
Yes: 1. Paste Script A into a Node console. | |
2. Copy and save the output. | |
No: 1. Go to https://www.dwitter.net/u/rileyjshaw. | |
2. Scroll to the bottom so that all dweets are loaded. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for f in *.mov; do | |
ffmpeg -an -i ./"$f" -vcodec libwebp -vsync 0 -s 128x128 -sws_dither none -sws_flags neighbor -q:v 10 ./"${f%.mov}.webp"; | |
ffmpeg -an -i ./"$f" -vcodec libx264 -pix_fmt yuv420p -profile:v baseline -level 3 -s 512x512 -sws_dither none -sws_flags neighbor -crf 35 ./"${f%.mov}.mp4"; | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew cask install xquartz | |
brew install amiaopensource/amiaos/decklinksdk | |
brew tap homebrew-ffmpeg/ffmpeg | |
brew install homebrew-ffmpeg/ffmpeg/ffmpeg $(brew options homebrew-ffmpeg/ffmpeg/ffmpeg --compact) |