Skip to content

Instantly share code, notes, and snippets.

View drbayer's full-sized avatar

David Bayer drbayer

View GitHub Profile
@drbayer
drbayer / Promote Postponed Mail Items.scpt
Last active August 29, 2015 13:56
Applescript to support InboxZero philosophy with Outlook for Mac
on moveMsgs(theFolder, theAccount)
tell application "Microsoft Outlook"
set theInbox to mail folder "INBOX" of theAccount
set theSource to folder theFolder of theInbox
set theMessages to messages of theSource
repeat with theMessage in theMessages
move theMessage to theInbox
end repeat
end tell
end moveMsgs
@drbayer
drbayer / 0_reuse_code.js
Created March 3, 2014 21:43
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
$myarray = @()
foreach ($item in $mylistofthings) {
$myarray += $item.PropertyValue
}
$myarray = (("item1","value1"),("item2","value2"),("item3","value3"))
$myarray = @()
foreach ($item in $mylistofthings) {
$myobj = New-Object -TypeName PSObject
Add-Member -InputObject $myobj -MemberType 'NoteProperty' -Name 'Property1' -Value $item.Property1
Add-Member -InputObject $myobj -MemberType 'NoteProperty' -Name 'Property2' -Value $item.Property2
$myarray += $myobj
}
usage() {
echo "Usage: ${0##*/} -b S3BUCKET [-d BACKUPDIR] [-c CLUSTER_NAME] [-h]"
echo
echo " -b S3 bucket to store backups in. Defaults to CLUSTER_NAME"
echo " -c Neo4j cluster name. Defaults to value in /tmp/environment"
echo " -d Local directory to create backups in. Defaults to /tmp"
echo " -h Show this help message"
echo " -v Verbose output"
echo
exit 5
$ ./neo4j-backup.sh -h
Usage: neo4j-backup.sh -b S3BUCKET [-d BACKUPDIR] [-c CLUSTER_NAME] [-h]
-b S3 bucket to store backups in. Defaults to CLUSTER_NAME
-c Neo4j cluster name. Defaults to value in /tmp/environment
-d Local directory to create backups in. Defaults to /tmp
-h Show this help message
-v Verbose output
#!/bin/bash
set -eE
date_format="%Y-%m-%d %T.%3N%z"
today=$(date +"%Y%m%d")
backup_dir=/tmp
cluster=$(cat /tmp/environment)
s3_bucket=$cluster
verbose="false"