Skip to content

Instantly share code, notes, and snippets.

View gregorynicholas's full-sized avatar
💀
alter.

gregory nicholas gregorynicholas

💀
alter.
View GitHub Profile
@gregorynicholas
gregorynicholas / geotagging.md
Created June 7, 2018 04:15 — forked from jareware/geotagging.md
Media Geotagging and Massaging on macOS

Media Geotagging and Massaging on macOS

Synchronizing image timestamps

The one and only ExifTool will adjust the various timestamps in Exif data. Take a look at the current values:

$ exiftool DSC02833.JPG | grep Date

If this camera is behind the reference camera (that you want to sync with) by, say, 6 hours, 58 minutes and 10 seconds, add that much to each image in the dir:

@gregorynicholas
gregorynicholas / README.md
Created June 7, 2018 04:15 — forked from jareware/README.md
Conversion script between the TTML & SRT subtitle formats

premiere-subtitle-convert

Conversion script between the TTML & SRT subtitle formats. This is particularly useful with Adobe Premiere, as it doesn't understand the SRT format (which is joyously simple and interoperable). TTML-XML is probably the most straightforward subtitle format it does understand, hence this tool.

Note that due to the simplicity of the SRT format, this conversion is extremely lossy for all the bells and whistles supported by TTML. Not like you'd want fixed-pixel font sizes etc in your subtitles anyway, but you've been warned.

@gregorynicholas
gregorynicholas / s3-curl-backups.md
Created June 7, 2018 04:14 — forked from jareware/s3-curl-backups.md
Simple, semi-anonymous backups with S3 and curl

⇐ back to the gist-blog at jrw.fi

Simple, semi-anonymous backups with S3 and curl

Backing stuff up is a bit of a hassle, to set up and to maintain. While full-blown backup suites such as duplicity or CrashPlan will do all kinds of clever things for you (and I'd recommend either for more complex setups), sometimes you just want to put that daily database dump somewhere off-site and be done with it. This is what I've done, with an Amazon S3 bucket and curl. Hold onto your hats, there's some Bucket Policy acrobatics ahead.

There's also a tl;dr at the very end if you just want the delicious copy-pasta.

Bucket setup

@gregorynicholas
gregorynicholas / pre-push.sh
Created June 7, 2018 04:13 — forked from pixelhandler/pre-push.sh
Git pre-push hook to prevent force pushing master branch
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
@gregorynicholas
gregorynicholas / transparent-boot2docker-on-os-x.md
Created June 7, 2018 04:12 — forked from jareware/transparent-boot2docker-on-os-x.md
Transparent boot2docker on OS X for a native-Linux-like Docker experience

Transparent boot2docker on OS X

This is how you can autorun boot2docker on boot, so that you can use docker as you would on Linux, without ever* knowing that the daemon's not running locally.

  1. Install VirtualBox & boot2docker (obviously)
  2. Create a startup script with Automator
  3. Put in /usr/local/bin/boot2docker up && /usr/local/bin/boot2docker shellinit > ~/.boot2docker-shellinit.sh
  4. Add echo "export DOCKER_IP=$(boot2docker ip 2>/dev/null)" >> ~/.boot2docker-shellinit.sh if you want the non-standard but very-convenient DOCKER_IP env-var as well (thanks for the suggestion @city41!)
  5. Update your .profile or equivalent file with source ~/.boot2docker-shellinit.sh
  6. Reboot your machine
@gregorynicholas
gregorynicholas / README.md
Created June 7, 2018 04:12 — forked from jareware/README.md
Quick PSA on icon fonts and ligatures

Long Live Icon Fonts!

or, a Quick PSA on icon fonts and ligatures.

tl;dr: keep using icon fonts, they are nice, just enable ligatures

These are my talking notes at the http://wwweeklies.com/ on 2015-12-04:

@gregorynicholas
gregorynicholas / README.md
Created June 7, 2018 04:12 — forked from jareware/README.md
Raspberry Pi -based sensor station

Raspberry Pi -based sensor station

This is mostly documentation for myself. Feel free to use any of it if it helps, though.

Hardware

@gregorynicholas
gregorynicholas / SCSS.md
Created June 7, 2018 04:06 — forked from jareware/SCSS.md
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@gregorynicholas
gregorynicholas / zip-arrays.js
Created June 7, 2018 04:05 — forked from Daniel-Hug/zip-arrays.js
Zip arrays into one | Example with two arrays: value 0 from a, value 0 from b, value 1 from a, etc.
// Zip arrays into one
// Example with two arrays: value 0 from a, value 0 from b, value 1 from a, etc.
function zipArrays() {
var zipped = [];
var arrays = [].slice.call(arguments);
for (var valueI = 0; arrays.length > 0; valueI++) {
for (var arrayI = 0; arrayI < arrays.length; arrayI++) {
if (arrays[arrayI].length - 1 < valueI) {
arrays.splice(arrayI, 1);
continue;
@gregorynicholas
gregorynicholas / to-csv.js
Created June 7, 2018 04:04 — forked from Daniel-Hug/to-csv.js
JS function: convert objects in an array or object to rows in a CSV file
/*
usage:
var csvString = toCSV({
key1: { col1: 5, col2: 'hi' },
key2: { col1: 7, col2: 'hello' }
}, {
// default config:
includeKeys: true,
delimiter: ',',