Skip to content

Instantly share code, notes, and snippets.

Tom Trahan ttrahan

Block or report user

Report or block ttrahan

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
@ttrahan
ttrahan / block_personal_appts
Last active Jun 27, 2019
Google Apps Script to automatically create, edit and delete events on work calendar for personal calendar events. Instructions on how to set up can be found at https://medium.com/@willroman/auto-block-time-on-your-work-google-calendar-for-your-personal-events-2a752ae91dab
View block_personal_appts
function sync() {
var id="XXXXXXXXXX"; // CHANGE - id of the secondary calendar to pull events from
var today=new Date();
var enddate=new Date();
enddate.setDate(today.getDate()+7); // how many days in advance to monitor and block off time
var secondaryCal=CalendarApp.getCalendarById(id);
var secondaryEvents=secondaryCal.getEvents(today,enddate);
View save-state-runSh.sh
#! /bin/bash
# Save state
# used to save state information of Shippable pipeline job for use on next job run or in downstream job
echo -e "\n*** saving state ***"
createOutState() {
STATEFILES_TO_SAVE=( file1 file2 file3 )
STATEFILE_SAVE_LOCATION=/build/state/
for f in "${STATEFILES_TO_SAVE[@]}"; do
cp $f $STATEFILE_SAVE_LOCATION
View extract-image-information.sh
# Extract image tag
# when sourcing this file, pass in the name of the image resource as the only parameter
echo -e "\n*** extracting image information ***"
get_image() {
local IMAGE_FILE="./IN/$1/version.json"
if [ -f "$IMAGE_FILE" ]; then
export IMAGE_TAG=$(jq -r '.version.versionName' $IMAGE_FILE)
fi
}
get_image $1
View load-integration-pipeline.sh
# Extract integration data
# when sourcing this file, pass in the name of the integration resource as the only parameter
echo -e "\n*** extracting AWS integration information ***"
# Load integration values into env variables for aws_access_key_id, aws_secret_access_key
get_integration() {
local INTEGRATION_FILE="./IN/$1/integration.env"
if [ -f "$INTEGRATION_FILE" ]; then
. $INTEGRATION_FILE
echo "loaded integration file"
else
View load-params-runSh.sh
# Extract params data
# replace "params-tfScripts" in line 5 with the name of your params resource
echo -e "\n*** extracting params information ***"
get_params() {
local PARAMS_FILE="./IN/$1/version.json"
if [ -f "$PARAMS_FILE" ]; then
PARAMS_VALUES=$(jq -r '.version.propertyBag.params' $PARAMS_FILE)
PARAMS_LENGTH=$(echo $PARAMS_VALUES | jq '. | length')
PARAMS_KEYS=$(echo $PARAMS_VALUES | jq '. | keys')
for (( i=0; i<$PARAMS_LENGTH; i++ )) do
You can’t perform that action at this time.