Skip to content

Instantly share code, notes, and snippets.

chockenberry /
Last active March 16, 2023 02:01
QuickLook for macOS shell
# usage:
# ql /tmp/file.jpg
# cat /tmp/file.jpg | ql
# cal -h | ql
if [ -z "$*" ]; then
cat > /tmp/ql.stdin
mime_type=$(file --brief --mime-type /tmp/ql.stdin)
timvisee /
Last active September 23, 2023 13:07
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.


  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
lmakarov / lambda-basic-auth.js
Created August 30, 2017 19:15
Basic HTTP Authentication for CloudFront with Lambda@Edge
View lambda-basic-auth.js
'use strict';
exports.handler = (event, context, callback) => {
// Get request and request headers
const request = event.Records[0].cf.request;
const headers = request.headers;
// Configure authentication
const authUser = 'user';
const authPass = 'pass';
rwilcox / bb_toggle_distraction_free.applescript
Last active August 29, 2015 14:16
Turn BBEdit into a distraction free writing environment
View bb_toggle_distraction_free.applescript
tell application "BBEdit"
tell window 1
set show line numbers to (not show line numbers)
set show toolbar to (not show toolbar)
set show gutter to (not show gutter)
set show navigation bar to (not show navigation bar)
-- set show status bar to false
end tell
end tell
psilva261 / gist:dede25e29198d58c5728
Created January 16, 2015 11:12
Convert p7b file to pfx file (to use Godaddy SSL/TLS Certificate for Azure Websites)
View gist:dede25e29198d58c5728
# Required files:
# .crt and .p7b: provided by Godaddy when exporting
# .key: self-generated file that was needed to create CSR (Certificate signing request)
# Note: this password has nothing to do with the password entered to create the CSR.
# It will be checked once the pfx is uploaded to Azure.
$ openssl pkcs12 -export -in -inkey -certfile -out
Enter Export Password:
Verifying - Enter Export Password:
marcoarment / parallelize.c
Last active October 31, 2022 19:34
A simple shell command parallelizer.
View parallelize.c
/* parallelize: reads commands from stdin and executes them in parallel.
The sole argument is the number of simultaneous processes (optional) to
run. If omitted, the number of logical CPUs available will be used.
Build: gcc -pthread parallelize.c -o parallelize
Demo: (for i in {1..10}; do echo "echo $i ; sleep 5" ; done ) | ./parallelize
By Marco Arment, released into the public domain with no guarantees.
dergachev /
Last active September 21, 2023 12:58
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


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

ttscoff / searchlink.rb
Last active December 3, 2022 12:45
SearchLink creates Markdown links from automatic searches based on special syntax.
View searchlink.rb
agnoster /
Last active September 8, 2023 13:17
My ZSH Theme


A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark