Skip to content

Instantly share code, notes, and snippets.

@durandj
durandj / wait-for-postgres.sh
Last active February 9, 2020 18:12
Docker Wait Scripts
#!/usr/bin/env bash
# Waits for a Postgres database to be ready before calling the passed
# command. After each failed attempt to reach the database, the script
# sleeps for a fixed period of time (versus an exponential backoff).
#
# The database connection arguments are to be passed to psql via
# the standard Postgres environment variables.
#
# Unfortunately the way this script works, the Postgres client must
@durandj
durandj / keybase.md
Created September 13, 2019 20:14
keybase.md

Keybase proof

I hereby claim:

  • I am durandj on github.
  • I am durandj (https://keybase.io/durandj) on keybase.
  • I have a public key ASCiSOhkL5GG4SZ58W-GdXi3GcpdGfJseZdItEWGHz9MlAo

To claim this, I am signing this object:

@durandj
durandj / gravatar.html
Created September 9, 2016 19:23
Gravatar Custom Element
<template id="my-gravatar-template">
<style>
</style>
<img src="" />
</template>
<script type="text/javascript" src="/third_party/js/md5/js/md5.min.js"></script>
<script type="text/javascript">
(function (window, document) {
@durandj
durandj / MS Paint.pas
Created May 17, 2016 21:05
MS Paint in Pascal
Program Paint; {James Durand NOT MITCH TRICYCLE!!!}
{Credits:
Mitch Tricycle: Planning and idea.
}
Uses Crt,
Drivers,
Graph,
Math;
@durandj
durandj / Dev Server Setup.md
Last active March 7, 2016 16:24
Development Server Setup

Dev Server Setup

Tested on Ubuntu 15.10 server edition. We are also assuming a clean slate in terms of installation, with nothing preinstalled.

Basic Setup

Start with installing all the basic packages:

sudo apt-get install ssh openssh-server python-dev exuberant-ctags vim zsh build-essential git-core htop cmake tmux software-properties-common python-software-properties libbz2-dev libreadline-dev libssl-dev libsqlite3-dev python-pip python3.5 python3.5-dev python3-pip

Base Workspace

Bazel is a build tool made by Google that provides a way to quickly get started with a project and setting up a build environment. It provides incremental and hermetic builds and supports a wide variety of languages. It comes with a basic workspace with every installation that includes some of the common libraries and tools that you'll need to get started with your project. If you want more than what is provided you either need to add the required rules to your project or create a new workspace which can be time consuming and, even worse, provides a potential place where you duplicate work. If you have a library (such as GFlags that does not currently have support for Bazel and you use it in multiple projects you'll find that you have to copy all the rules from one project to the other and if those rules ever change you'll have to keep them all in sync. This will be true for all the common libraries that might be used

@durandj
durandj / Hackathon Rules.md
Last active December 6, 2015 21:47
General rules for the Hackathon

Hackathon Rules

These are the general rules for the hackathons. Rules can be added, modified, or removed based on the specific hackathon.

Planned work/projects must be decided upon prior to Hackathon

Participants can work on any project including a brand new one if they wish but regardless of if the project is new or old participants must decide on what they will be creating or adding prior to the start of the hackathon. Once their desired task or project has been decided they must provide some kind of document that states their intent. The document should state the desired end goal and potential functionality of the task. Not all tasks need to be completed. The goal of this is to provide judge(s) with an idea of what the participant(s) were trying to accomplish and how far they got. It also gives the participants a specific goal of what they want to do going in. Tasks can be as complex or simple as the participants want but general the more work that is completed gets a more favorable chance of winni

#!/bin/bash
# note has some flaws...
branch=`git rev-parse --abbrev-ref HEAD`
branchRegex='(<jira-project>)(-[0-9]+)' # TODO: Edit this for project
if [[ $branch =~ $branchRegex ]]
then
line=`head -n 1 "$1"`
@durandj
durandj / Instructions.md
Last active August 29, 2015 14:00
Ubuntu - Postfix - Courier - MySQL

Required Packages

sudo apt-get install courier-authdaemon courier-authlib-mysql courier-base courier-imap courier-imap-ssl courier-pop courier-pop-ssl \
 mysql-client mysql-server postfix

Note: Accept the defaults when configuring Postfix

Postfix

Reconfigure Postfix with

@durandj
durandj / git-chown
Last active August 29, 2015 13:57
Git-Chown - Change author of commits
#!/bin/sh
if [ $# -lt 6 ]
then
echo "usage: git chown <new_committer_name> <new_committer_email> <new_author_name> <new_author_email> <old_committer_email> <old_author_email>"
exit
fi
new_committer_name="$1"
new_committer_email="$2"