Skip to content

Instantly share code, notes, and snippets.

View Codesleuth's full-sized avatar

David Wood Codesleuth

View GitHub Profile
@Codesleuth
Codesleuth / refresh-pi.sh
Created February 22, 2016 08:28
Refresh a Chromium window on Raspberry Pi via SSH with F5
ssh $1 -Y -t 'export DISPLAY=:0.0
xdotool key --window "$(xdotool search --onlyvisible --class chromium | head -n 1)" F5'
@Codesleuth
Codesleuth / terraform-docs_with_docker.md
Last active September 7, 2021 10:21
Create terraform-docs using docker command

Given a structure like:

/
  /terraform
    /environment
    /infra
  /other
@Codesleuth
Codesleuth / terraform_fmt_docker.md
Last active September 7, 2021 10:20
Terraform format using docker image

Given a structure like:

/
  /terraform
    /environment
    /infra
  /other
@Codesleuth
Codesleuth / MOV2GIF.md
Created June 16, 2020 13:03
Convert Quicktime screen recording MOV to animated GIF

From: https://superuser.com/a/556031

ffmpeg -t 6 -i tooltip_gif.mov -vf "fps=10,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 tooltip.gif
@Codesleuth
Codesleuth / with-wait.js
Last active May 10, 2018 11:21
Promise execution
async function main () {
const actions = [...Array(5)].map((_, i) => new Promise((resolve) => {
console.log(`Promise ${i} has started already...`)
console.time(`Promise ${i}`)
setTimeout(() => {
console.log(`Promise ${i} has finished!`)
console.timeEnd(`Promise ${i}`)
resolve()
})
}))
@Codesleuth
Codesleuth / hasher.js
Last active February 28, 2018 09:48
Trello Challenge
module.exports = {
hash: function (s) {
var h = 7;
var letters = "acdegilmnoprstuw";
for (var i = 0; i < s.length; i++) {
h = h * 37 + letters.indexOf(s[i]);
}
return h;
},
@Codesleuth
Codesleuth / password.js
Last active February 7, 2018 07:25
Node.js random password
const crypto = require('crypto')
function createRandomPassword() {
return new Promise((resolve, reject) => {
crypto.randomBytes(32, (err, buf) => {
if (err) return reject(err)
resolve(buf.toString('hex'))
})
})
}
@Codesleuth
Codesleuth / Semantic UI Template for Paginate (Almost) Anything.md
Last active July 11, 2017 15:33
Semantic UI Template for Paginate (Almost) Anything
@Codesleuth
Codesleuth / handbrake.settings
Created November 14, 2016 23:30
YouTube High Quality H.264 Encoder Settings for Overwatch
bframes=2:keyint=15:level=4.1:ref=7:b-adapt=2:direct=auto:deblock=-1,-1:analyse=all:me=umh:merange=24:subme=10:trellis=2:psy-rd=1.00,0.15:vbv-bufsize=78125:vbv-maxrate=62500:rc-lookahead=60