Skip to content

Instantly share code, notes, and snippets.

Blaise Kal blaise-io

Block or report user

Report or block blaise-io

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
blaise-io /
Last active Jan 25, 2016
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/
# Spoiler alert: Usually, the solution is to define the shell in the script,
# by prepending #!/bin/bash.
blaise-io / prepend-use-strict.js
Last active Feb 20, 2019
Prepend all JavaScript files with "use strict"; that don't have it yet
View prepend-use-strict.js
// 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();
You can’t perform that action at this time.