Skip to content

Instantly share code, notes, and snippets.

View smithclay's full-sized avatar

Clay Smith smithclay

View GitHub Profile
<target name="js-compile-all" description="Compile JavaScript files with Closure" unless="skip-js-compile">
<echo>Compiling JS files in ${input.scripts.dir} in closure...</echo>
<apply executable="java" dest="${output.scripts.dir}">
<arg value="-jar"/>
<arg path="${jar.lib.dir}/closure-compiler.jar"/>
<arg line="--js"/>
<srcfile/>
<arg line="--js_output_file"/>
<targetfile/>
<fileset dir="${output.scripts.dir}" includes="**/*-main.debug.js" />
@smithclay
smithclay / jake-minify.js
Created October 24, 2012 00:50
Example of a Minify Task using Jake
desc('Minify javascript.');
task('minify', function (params) {
var task = this, startTime = +new Date(), minifiedCount = 0,
targetPath = process.env.JS_BUILD_DIR || './';
debugFiles = barkeep.fileListRecursive(path.join(BUILD_GLOBALS.output, targetPath), BUILD_GLOBALS.debugExpr),
uglifyBin = path.join(__dirname, 'node_modules', 'uglify-js', 'bin', 'uglifyjs');
console.log('Minifying javascript files...'.green);
barkeep.directory(BUILD_GLOBALS.output); // Create build directory (if it doesn't exist).
async.forEach(debugFiles, function (fileName, callback) {
var extension = path.extname(fileName);
@smithclay
smithclay / upgrade-grunt.sh
Last active December 10, 2015 20:08
This script will prepare an package that uses grunt-0.3.x to use grunt-0.4.x. You may need to use superuser privileges to execute this script if you have grunt installed globally. Run this script in your grunt-0.3.x project directory that has been updated to use grunt-0.4.x.
#!/usr/bin/env bash
# Run this script in your grunt-0.3.x project directory that has been updated to use grunt-0.4.x
set -e
# Make sure node-0.8.x is installed
if node -v | grep ^v0.8.\* ; then
echo "You have node 0.8.x installed..."
else
@smithclay
smithclay / fd.sh
Created February 7, 2013 01:07
Run a Jenkins Build Task from the command line.
#!/usr/bin/env bash
JENKINS_URL=http://jenkins.postapp.com/job
if [ $# -eq 0 ]
then
echo "usage: fd <jenkins build task> [<jenkins build task> ...]"
fi
for var in "$@"
0Wr9oCpqvWty6fGLXDUM
@smithclay
smithclay / keybase.md
Created July 15, 2015 20:45
keybase verification

Keybase proof

I hereby claim:

  • I am smithclay on github.
  • I am smithclay (https://keybase.io/smithclay) on keybase.
  • I have a public key whose fingerprint is B53D 2B26 60A5 DF27 33B3 A5D0 C707 37A6 5A56 EC97

To claim this, I am signing this object:

@smithclay
smithclay / osx.sh
Created September 15, 2015 17:08
Mac OS X Defaults, September 2015
#!/usr/bin/env bash
# ~/.osx — https://mths.be/osx
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
@smithclay
smithclay / build-ubuntu-rootfs.sh
Last active January 5, 2024 10:37
ubuntu bootstrap for user mode linux: minimal
#!/bin/sh
# This script creates a user-mode linux machine based on Ubuntu.
# Created by Clay Smith, May 2017
#
# based on: https://gist.github.com/aputs/6247216
# and https://gist.github.com/AVGP/5410903
set -x
@smithclay
smithclay / lambda-concurrent.sh
Created May 24, 2017 03:27
Concurrently execute a lambda function for warming purposes
#!/bin/bash
# This attempts to concurrently execute an AWS Lambda function. WIP.
# After execution, roughly NUM_EXECUTION containers will be ready
# to accept requests.
# More advanced strategies are out there. Check out @lambdacult on twitter, for example.
AWS_LAMBDA_FUNCTION_NAME=LambdaInfo
NUM_EXECUTIONS=3
@smithclay
smithclay / index.js
Created June 16, 2017 18:30
"Hello World" AWS Lambda + Terraform Example
// 'Hello World' nodejs6.10 runtime AWS Lambda function
exports.handler = (event, context, callback) => {
console.log('Hello, logs!');
callback(null, 'great success');
}