Skip to content

Instantly share code, notes, and snippets.

@taveras
taveras / convert-redirects.sh
Last active November 3, 2016 23:05
Convert Apache redirect map to NGINX format
#!/bin/bash
# copy file 1 to file 2, and overwrite file 2 if necessary
yes | cp $1 ${2}-tmp
# %g/^#/normal dd # Deletes all comments
# %normal Elcw # Collapses whitespace between segments
# %normal A; # Adds semicolon to the end of each line
# %g/\S\/\;/normal f;hx # Removes trailling slash for second segment
# %g/\/ /normal Ex # Removes trailing slash for first segment

Keybase proof

I hereby claim:

  • I am taveras on github.
  • I am taveras (https://keybase.io/taveras) on keybase.
  • I have a public key ASA2q6kCCof31X58OiwOiorlSit5mvExHOH4UygKFz5KFwo

To claim this, I am signing this object:

@taveras
taveras / fetch-and-render.js
Last active October 11, 2016 03:22
mimics Google Search Console's fetch and render, using Nightmare.js
var argv = process.argv.slice(2);
var urlToTest = argv[0];
var screenshotFilename = argv[1];
if (!screenshotFilename) {
throw new Error('Invalid screenshot path.')
}
if (!urlToTest) {