Skip to content

Instantly share code, notes, and snippets.

Avatar

Josh Padnick josh-padnick

View GitHub Profile
@josh-padnick
josh-padnick / rsync.sh
Created Mar 4, 2015
Using Rsync to Sync a Directory to a Remote Instance
View rsync.sh
rsync -ra --out-format='[%t]--%n' --delete /path/to/local/folder/ <SSH-USER>@<SERVER-IP-ADDRESS>:/path/to/remote/folder
@josh-padnick
josh-padnick / Dockerfile
Created Feb 17, 2015
Dockerfile Example
View Dockerfile
# MINIMAL DOCKER IMAGE FOR RUNNING A MICROSERVICE
FROM ohmygoshjosh/busybox
MAINTAINER Josh Padnick <josh@tinysteps.co>
# MICROSERVICE ENV VARS
# ------------------------------------------------------------------------------
ENV MICROSERVICE_NAME lemon
@josh-padnick
josh-padnick / minion
Created Jan 21, 2015
Masterless Salt Minion
View minion
file_client: local
file_roots:
base:
- /srv/salt/base
@josh-padnick
josh-padnick / MyController.java
Created Jul 18, 2014
Ugly Sample of JDBC Promises in Play (probably with anti-patterns)
View MyController.java
public void sendTextMessage() throws SQLException {
// Open a connection
CustomConnectionMgr.openConnection();
// Tell the connection object to start a transaction
CustomConnectionMgr.startTransaction();
F.Promise<Integer> notifyBatchIdPromise;
F.Promise<Integer> notifyConversationIdPromise;
@josh-padnick
josh-padnick / crontab file
Last active Sep 23, 2020
Create EC2 AMI from Bash Script; Good for cron jobs
View crontab file
PATH=/bin:/usr/local/bin
# Put this in your crontab file to run the script every day at 01:30 (1:30am). Note the PATH variable above; required for this script.
# m h dom mon dow command
30 01 * * * /bin/bash /home/ubuntu/scripts/ec2-create-image.sh i-8a915682 >> /home/ubuntu/logs/crontab.log 2>&1
@josh-padnick
josh-padnick / computeEGA
Created Mar 25, 2014
Compute Estimated Gestational Age from Due Date (Javascript)
View computeEGA
// Usage: computeEGA(2014, 4, 14);
// Computes the Estimated Gestational Age of a patient based on today's date and her Expected Due Date (EDD)
// Sample data
var iDueDateYear = 2014;
var iDueDateMonth = 4;
var iDueDateDay = 14;
function computeEGA( iDueDateYear, iDueDateMonth, iDueDateDay ) {
var dToday = new Date();
You can’t perform that action at this time.