Skip to content

Instantly share code, notes, and snippets.

@wndhydrnt
wndhydrnt / list
Last active May 22, 2024 15:59
Run several commands in parallel, prefix the stdout of each stdout with its source and fail the script if one of the commands exits with a code != 0
foo
bar
baz
@kizbitz
kizbitz / dockerhub-v2-api-organization.sh
Last active April 3, 2024 08:47
Get the list of images and tags for a Docker Hub organization account
#!/bin/bash
# Example for the Docker Hub V2 API
# Returns all images and tags associated with a Docker Hub organization account.
# Requires 'jq': https://stedolan.github.io/jq/
# set username, password, and organization
UNAME=""
UPASS=""
ORG=""
@SlexAxton
SlexAxton / .zshrc
Last active April 25, 2023 03:57
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 17, 2024 02:53
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

# Tips for jQuery Bug Patching
# There are some assumptions made here, one being that you're
# set up with some form of "localhost" http server and that it's running.
# - http://www.mamp.info/en/mamp/
# - sudo apt-get install apache2
# Get it running:
# On Mac:
@xavi-
xavi- / gist:633341
Created October 19, 2010 00:15
Interview gist -- Can candidate write code?

Instructions

  • Solve all problems using JavaScript

Problems

  1. Write a function that returns an array with the first n powers of 2. Call it twoPow.

  2. Use twoPow and Array.prototype.reduce to the sum of the first 10 powers of 2.

  3. Describe this call signature:

@xavi-
xavi- / gist:633087
Created October 18, 2010 21:21 — forked from jimbojw/gist:583389
Interview gist -- Can candidate read, debug, and fix code?
// For each of the following code fragments:
// a. what does the code do?
// b. what did the author intend for it to do?
// c. how would you fix it?
// NOTE: all code samples work exactly the same in all browsers
// 1. object literals
var data = [ { high: 100, low: 81 }, { high: 93, low: 73 }, { high: 60, low: 32 } ];
function getAverages(data) {
var avgs = [];