Skip to content

Instantly share code, notes, and snippets.

View Codesleuth's full-sized avatar

David Wood Codesleuth

View GitHub Profile
@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 / 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 / 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
@Codesleuth
Codesleuth / proxyquire.d.ts
Created September 25, 2016 16:28
Proxyquire definitions
interface Proxyquire {
(request: string, stubs: any): any;
<T>(request: string, stubs: any): T;
load(request: string, stubs: any): any;
load<T>(request: string, stubs: any): T;
noCallThru(): Proxyquire;
callThru(): Proxyquire;
@Codesleuth
Codesleuth / yayson.d.ts
Created September 10, 2016 23:13
Partial typings definitions for yayson. Ugly AF
declare module 'yayson' {
class Store {
sync(obj: Object): Object;
sync<T>(obj: Object): T;
}
interface Yayson {
Store: typeof Store;
}
declare module 'os-service' {
import { Writable } from 'stream';
interface ServiceOptions {
nodePath?: string;
username?: string;
password?: string;
programPath?: string;
displayName?: string;
nodeArgs?: string[];