Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@chockenberry
chockenberry / ql.sh
Last active March 4, 2024 23:40
QuickLook for macOS shell
#!/bin/sh
# 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
timvisee / falsehoods-programming-time-list.md
Last active April 22, 2024 16:30
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.

Falsehoods

  • 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
lmakarov / lambda-basic-auth.js
Created August 30, 2017 19:15
Basic HTTP Authentication for CloudFront with Lambda@Edge
'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
rwilcox / bb_toggle_distraction_free.applescript
Last active August 29, 2015 14:16
Turn BBEdit into a distraction free writing environment
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
psilva261 / gist:dede25e29198d58c5728
Created January 16, 2015 11:12
Convert p7b file to pfx file (to use Godaddy SSL/TLS Certificate for Azure Websites)
# 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 www.mydomain.com.crt -inkey www.mydomain.com.key -certfile www.mydomain.com.p7b -out www.mydomain.com.pfx
Enter Export Password:
Verifying - Enter Export Password:
@marcoarment
marcoarment / parallelize.c
Last active October 31, 2022 19:34
A simple shell command parallelizer.
/* 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
dergachev / GIF-Screencast-OSX.md
Last active April 19, 2024 11:00
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:

@ttscoff
ttscoff / searchlink.rb
Last active February 26, 2024 07:05
SearchLink creates Markdown links from automatic searches based on special syntax.
@agnoster
agnoster / README.md
Last active April 6, 2024 22:35
My ZSH Theme

agnoster.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