Skip to content

Instantly share code, notes, and snippets.

View blaise-io's full-sized avatar
👨‍💻

Blaise Kal blaise-io

👨‍💻
View GitHub Profile
# Overwrite GIT_AUTHOR_EMAIL so the commits are attributed to you
GIT_AUTHOR_EMAIL="[email protected]"
# -i /path/to/other/id_rsa: use a non-default identity file
# -o IdentitiesOnly=yes: ignore identities in the ssh agent
# -F /dev/null: ignore .ssh/config
GIT_SSH_COMMAND="ssh -i /path/to/other/id_rsa -o IdentitiesOnly=yes -F /dev/null"
@blaise-io
blaise-io / script.sh
Last active January 25, 2016 20:59
Debug cron job in minimal environment
# Sometimes cron jobs don't execute properly. It's hard to debug because
# the job may execute just fine if you run it manually in your shell.
# That's because cron jobs run in a minimal shell by default.
# This will run the script in a minimal environment:
env - /path/to/script.sh
# Spoiler alert: Usually, the solution is to define the shell in the script,
# by prepending #!/bin/bash.
@blaise-io
blaise-io / prepend-use-strict.js
Last active October 18, 2020 13:15
Prepend all JavaScript files with "use strict"; that don't have it yet
// To run:
// npm install globby
// node prepend-use-strict.js
var globby = require('globby');
var fs = require('fs');
globby('**/*.js', function(err, files) {
for (var i = 0, m = files.length; i < m; i++) {
var fileContent = fs.readFileSync(files[i]).toString();