Skip to content

Instantly share code, notes, and snippets.

@michaelhenry
michaelhenry / 0_reuse_code.js
Created October 25, 2013 03:31
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@michaelhenry
michaelhenry / s3cmd.sh
Last active August 29, 2015 14:17 — forked from cheannecruz/s3cmd.sh
// How to add Header on existing bucket
s3cmd modify --recursive --add-header=Cache-Control:max-age=86400 s3://BUCKET/FOLDER
@michaelhenry
michaelhenry / executionTimeInterval.swift
Created January 11, 2017 08:14 — forked from kristopherjohnson/executionTimeInterval.swift
Calculate execution time for a block of Swift code
import QuartzCore
func executionTimeInterval(block: () -> ()) -> CFTimeInterval {
let start = CACurrentMediaTime()
block();
let end = CACurrentMediaTime()
return end - start
}

It often be helpful to be able to debug memory usage in Swift on Linux, for example to debug memory leaks.

This is a quick overview of how to generate a report of memory usage for your Swift app. This guide will only show you how to generate the report, not how to analyze it, it might be written up in a blog post later.

Install Valgrind

First we need to install a tool called Valgrind, which is used to trace memory usage.

@michaelhenry
michaelhenry / diff.mdown
Created April 20, 2020 23:44 — forked from ndarville/diff.mdown
Paul Heckel's Diff Algorithm

[Isolating Differences Between Files][paper]

Advantage over Other Algorithms

The diff output is more specific:

[I]f a whole block of text is moved, then all of it, rather than just the beginning and end, is detected as changed.

>The algorithm described here avoids these difficulties. It detects differences that correspond very closely to our intuitive notion of difference.

Execute these lines:

sudo sh -c 'cat > /etc/apt/sources.list.d/focal-dell.list << EOF
deb http://dell.archive.canonical.com/updates/ focal-dell public
deb http://dell.archive.canonical.com/updates/ focal-oem public
deb http://dell.archive.canonical.com/updates/ focal-somerville public
deb http://dell.archive.canonical.com/updates/ focal-somerville-melisa public
EOF'
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F9FDA6BED73CDC22