Skip to content

Instantly share code, notes, and snippets.

View troyharvey's full-sized avatar
:octocat:

Troy Harvey troyharvey

:octocat:
View GitHub Profile
@troyharvey
troyharvey / DateAdapter.java
Created August 30, 2011 16:25
Marshalling ISO 8601 dates with a custom JAXB DateAdapter
package com.acme.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
import java.util.logging.Logger;
import javax.xml.bind.annotation.adapters.XmlAdapter;
@troyharvey
troyharvey / gist:2956277
Created June 19, 2012 20:15
Links for CIS 150 guest lecture
@troyharvey
troyharvey / gist:4f4e6fa41635e350c9fe
Created July 10, 2013 19:20
AngularJS Speaker Notes

Overview

  • Troy Harvey, IT Consultant at ZyQuest

  • Woodport Doors project

  • Demonstrate door.bifold ng-model binding.

    scope = angular.element($0).scope()
    scope.DoorService.door.bifold = false
    

Keybase proof

I hereby claim:

  • I am troyharvey on github.
  • I am troyharvey (https://keybase.io/troyharvey) on keybase.
  • I have a public key ASCz9PmMG0ER6PZQM3ew7Fxb78b7UPnZEAMjYgXod4BJKgo

To claim this, I am signing this object:

@troyharvey
troyharvey / deployment.yml
Last active February 27, 2024 04:47
Using Kubernetes envFrom for environment variables
# Use envFrom to load Secrets and ConfigMaps into environment variables
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: mans-not-hot
labels:
app: mans-not-hot
spec:
replicas: 1
@troyharvey
troyharvey / backpacking-checklist-cool.md
Last active May 25, 2022 11:34
3 Night Cool Weather Backpacking Trip Checklist
@troyharvey
troyharvey / .gitlab-ci.yml
Last active January 8, 2024 00:38
Deploy Google Cloud Functions: GitLab CI/CD Pipeline Config File
# Update Jan 2024
# Deploying Cloud Functions is much simpler than it was 6 years ago.
# I'm leaving the gist in it's original 2018 state for now,
# but skip the the recent comments below for a simpler solution.
variables:
GCP_ZONE: us-central1-a
stages:
- npm-install
@troyharvey
troyharvey / fromStorageUrl.js
Created July 21, 2018 21:32
Extract bucket and path from Google Cloud Storage URL
/**
* Convert Google Cloud Storage object url into an object with bucket and file path.
*/
function fromStorageUrl(url) {
var tokens = RegExp('https://storage.googleapis.com/(.+?)/(.+)','g').exec(url);
if (tokens === null) throw "Invalid Google Cloud Storage url.";
return {
'bucket': tokens[1],
'file': tokens[2]
@troyharvey
troyharvey / gephi-graph-streaming-cayley.md
Last active August 1, 2018 13:36
Using the Gephi Graph Streaming Plugin with Cayley

Cayley is an open-source graph inspired by the graph database behind Freebase and Google's Knowledge Graph. Gephi is an open-source graph visualization tool. The Graph Streaming plugin for Gephi allows you to visualize a Cayley graph or a stream of real-time changes to a Cayley graph.

  1. Install Cayley

     brew install cayley
    
  2. Start Cayley with the Movie Data sample

@troyharvey
troyharvey / airflow_redshift.py
Created September 21, 2018 19:43
An Airflow operator that translates a Postgres table definition into a Redshift CREATE TABLE statement.
class CreateRedshiftTableFromSchemaOperator(BaseOperator):
"""
Create Redshift Table from schema file.
:param redshift_conn_id Airflow Redshift Connection ID
:type redshift_conn_id string
:param schema Redshift schema
:type schema string
:param table Redshift table
:type table string