Skip to content

Instantly share code, notes, and snippets.

@w4tson
w4tson / export-notes.scpt
Created July 27, 2023 20:06
Apple script to export all notes in html/rtf format. Requires you make a folder called "notes" on your desktop. They will be dumped in there prefixed with an Id in the order they appear in the application
tell application "Notes"
set i to 1
repeat with theNote in notes
set noteName to name of theNote
set noteName to my replace(" ", "_", noteName)
set noteName to my replace("&", "and", noteName)
set noteName to my replace("(", "[", noteName)
set noteName to my replace(")", "]", noteName)
set theDir to (path to desktop as text)
set theFile to ((path to desktop as text) & "notes:" & i & "_" & noteName & ".html")
@w4tson
w4tson / file-processing.sh
Created October 4, 2022 19:52
A little test of bash hashmaps, dynamic arrays etc
dir_mappings() {
case $1 in
'ABC_DET') echo 'ABC_DET';;
'DDD_DET') echo 'DDD_DET';;
'ZZZ_DET') echo 'ZZZ_DET';;
'ZZZ_1') echo 'ZZZ_DET';;
'ZZZ_2') echo 'ZZZ_DET';;
'ZZZ_3') echo 'ZZZ_DET';;
*) echo 'nope';;
esac
du -ahxd 1 . | sort -h
@w4tson
w4tson / Play! Offline instructions
Created August 2, 2017 16:28
Some notes on proxying the stuff needed the Play! Framework
Importing jars etc for:
_ _
_ __ | | __ _ _ _| |
| '_ \| |/ _' | || |_|
| __/|_|\____|\__ (_)
|_ | |__/
0. ensure this env var : export SBT_OPTS="-Dsbt.override.build.repos=true"
1. rm -rf ~/.ivy2
2. Setup repositories file in .sbt/repositories as follows
@w4tson
w4tson / tar fu
Last active October 25, 2017 10:55
#
# Find all files in the last 45 mins, print them null separated and from that create an new tgz using standard-in as a file
#
find . -cmin -45 -type f -print0 | tar -cvzf ../../foo.tgz --null -T -
#
# Same as above however first searches for .nexus|.meta dir and prunes.
#
find . -not \( -name \.nexus -prune \) -not \( -name \.meta -prune \) -not \( -name central-m1 -prune \) -cmin -45 -type f -print0 | tar -cvzf ../../foo.tgz --null -T -
#setup target VM, DONT use docker, the fakesystemd throws things off
vagrant init bento/centos-7.1
vagrant ssh
#Add in your repo e.g:
sudo tee /etc/yum.repos.d/docker.repo <<-'EOF'
[dockerrepo]
name=Docker Repository
@w4tson
w4tson / build.gradle
Created October 18, 2013 09:44
creates and uploads to maven server a zip archive of config with different classifiers in gradle.
apply plugin: 'maven'
//this is essential! even though not really needed
//there is a bug in gradle whereby if you don't have this it
//just doesn't work
apply plugin: 'java'
@w4tson
w4tson / build.gradle
Created October 18, 2013 09:35
Using the redline stuff to create an RPM of a jar for Redhat
import static org.freecompany.redline.payload.Directive.NONE;
apply plugin: 'java'
apply plugin: 'rpm'
buildscript {
repositories {
mavenLocal()
maven { url = mavenServer+mavenRepo }