Skip to content

Instantly share code, notes, and snippets.

@ukdave
ukdave / dynamicVersion.gradle
Created October 3, 2013 21:29
Dynamic versions for gradle, git and Java development
/*
* This work is licensed under the Creative Commons Attribution 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/
* or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
*/
/* Define your version here. */
version = new Version(project: project, major: 1, minor: 0).toString()
@ukdave
ukdave / eclipseHideBuild.gradle
Created October 3, 2013 21:31
Hide gradle's 'build' folder from Eclipse
eclipse {
project {
file {
withXml { xmlProvider ->
Node project = xmlProvider.asNode()
Node filter = project.appendNode('filteredResources').appendNode('filter')
filter.appendNode('id', 1379968350622)
filter.appendNode('name', '')
filter.appendNode('type', 26)
Node matcher = filter.appendNode('matcher')
@ukdave
ukdave / .profile
Last active November 22, 2015 17:22
My .profile on Mavericks
#export CLICOLOR=1
#export LSCOLORS=ExFxCxDxBxegedabagacad
alias ls='ls -G'
alias ll='ls -l'
alias grep='grep --color=auto'
export PATH=$PATH:/Applications/gradle-2.9/bin
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
NPM_PACKAGES=/Users/david/.npm-packages
NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH"
@ukdave
ukdave / eclipseSourceAndJavadoc.gradle
Created February 28, 2014 17:44
Attaches sources and javadocs to 3rd party jars in Eclipse
eclipse {
classpath.downloadSources = true
classpath.downloadJavadoc = true
// Classpath entry for Eclipse which changes the order of classpathentries; otherwise no sources for 3rd party jars are shown (http://stackoverflow.com/a/12836295)
classpath.file {
withXml { xml ->
def node = xml.asNode()
node.remove( node.find { it.@path == 'org.eclipse.jst.j2ee.internal.web.container' } )
node.appendNode('classpathentry', [ kind: 'con', path: 'org.eclipse.jst.j2ee.internal.web.container', exported: 'true' ])
@ukdave
ukdave / exiftool-holga.sh
Last active February 8, 2016 07:14
ExifTool commands for Holga 120N
# Sunny = f20
# Cloudy = f13
exiftool -Make="Holga" -Model="120N" -FocalLength="60" -ISO="400" -FNumber="20" -ExposureTime="1/100" -ExposureCompensation="0" -Flash="No Flash" -MeteringMode="Average" -ExposureProgram="Manual" -AllDates="2015:02:27 15:40:00" 000001.JPG
exiftool -Make="Holga" -Model="120N" -FocalLength="60" -ISO="400" -FNumber="20" -ExposureTime="1/100" -ExposureCompensation="0" -Flash="No Flash" -MeteringMode="Average" -ExposureProgram="Manual" -AllDates="2015:02:27 15:35:00" 000002.JPG
exiftool -Make="Holga" -Model="120N" -FocalLength="60" -ISO="400" -FNumber="20" -ExposureTime="1/100" -ExposureCompensation="0" -Flash="No Flash" -MeteringMode="Average" -ExposureProgram="Manual" -AllDates="2015:02:27 15:18:00" 000003.JPG
exiftool -Make="Holga" -Model="120N" -FocalLength="60" -ISO="400" -FNumber="20" -ExposureTime="1/100" -ExposureCompensation="0" -Flash="No Flash" -MeteringMode="Average" -ExposureProgram="Manual" -AllDates="2015:02:27 15:13:00" 000004.JPG
exiftool -Make="Holga" -Model="120N" -
@ukdave
ukdave / watchdog.cron
Created April 20, 2015 07:31
Generic watchdog script
* * * * * root /usr/local/bin/foo-watchdog.sh
@ukdave
ukdave / gulpfile.js
Created November 24, 2015 22:05
Browsersync with proxy for Spring Boot REST API
var gulp = require('gulp');
var proxyMiddleware = require('http-proxy-middleware');
var browserSync = require('browser-sync').create();
var sass = require('gulp-sass');
// Static Server + watching scss/html files
gulp.task('serve', ['sass'], function() {
browserSync.init({
port: 9000,
server: "./app"
#!/bin/bash
NEXUS_STORAGE_DIR=/opt/sonatype-work/nexus/storage
DIFF_DIR=/home/console/nexus-diffs
TSTAMP=`date +"%Y-%m-%d_%H-%M"`
if [ ! -f ${DIFF_DIR}/filelist_latest.txt ]; then
touch ${DIFF_DIR}/filelist_0000-00-00_00-00.txt
ln -s ${DIFF_DIR}/filelist_0000-00-00_00-00.txt ${DIFF_DIR}/filelist_latest.txt
fi
@ukdave
ukdave / 01-gulpfile.js
Last active May 10, 2016 19:58
Gulp script to process stylesheets using sass, and Javascript using babel, concat, and uglify, and use browsersync for development with live-reloading
const gulp = require('gulp'),
gutil = require('gulp-util'),
eslint = require('gulp-eslint'),
sass = require('gulp-sass'),
postcss = require('gulp-postcss'),
autoprefixer = require('autoprefixer'),
stylelint = require('gulp-stylelint')
babel = require('gulp-babel'),
concat = require('gulp-concat'),
ngAnnotate = require('gulp-ng-annotate'),
@ukdave
ukdave / exiftool-geotag.sh
Last active February 8, 2016 22:22
Add geotags to photos from a set of GPX files
exiftool \
-api GeoMaxIntSecs=60 -api GeoMaxExtSecs=60 \
-geotag="track1.gpx" \
-geotag="track2.gpx" \
-P .
exiftool \
-api GeoMaxIntSecs=600 -api GeoMaxExtSecs=600 \
-geotag="track1.gpx" \
-geotag="track2.gpx" \