Skip to content

Instantly share code, notes, and snippets.

@townie
townie / aurora_cluster.tf
Created December 28, 2016 21:23 — forked from sandcastle/aurora_cluster.tf
Creates a AWS RDS Aurora Cluster with Terraform
########################
## Variables
########################
variable "environment_name" {
description = "The name of the environment"
}
variable "vpc_id" {
@townie
townie / emailtocontact.java
Last active September 28, 2016 19:32
Apex class.. using java syntax highligting
email = InboudEmail(from="keith@email", body="HIIII PANDA")
contact_form_email = EmailToContact(email)
contact_from_email.
class EmailToContact {
public static Contact findOrBuildContact(String email_address) {
Contact result = "Select * from contact where email = email_Address"
if result == Empty {} // Null,[],empty AKA no match found
String info = 'Starting Program';
// SOQL query to load data into object(s)
// Load ALL books into the list of books
List<Book__c> books = [SELECT Price__c, Name From Book__c];
// Load only 1 book into a single book object
Book__c book = [SELECT Price__c, Name From Book__c limit 1];
@townie
townie / face-boxer-usage.md
Created June 22, 2016 04:48 — forked from dannguyen/face-boxer-usage.md
A face-detection script in Python

This face-boxer.py script is more-or-less the same code that you'll find in the OpenCV tutorial: Face Detection using Haar Cascades. For another variation, with more explanation, check out RealPython's tutorial.

Usage

The face-boxer.py script is designed to be run from the command-line. It has two required arugments:

  1. The path to a XML file containing a Haar-cascade of visual features. In this example, it will be the features that make up a face.
  2. The path to an image file that you want to perform face-detection on. You can pass in more than one image file as space-separated arguments.
#!/usr/bin/python
# csv_parser.py - read csv check if shit is present
# Usage:
# python csv_parser.py <file.csv>
# CONFIGURE THESE 2 value
# postion_of_cig = 2
# value_of_cig_in_string = '1'
#
#
# This is designed to be a dummy email that will satisfy our SSO's requirement
# for an email, yet still be canonical to the Datto partner
def self.convert_username_to_email(username)
"#{username}@datto.zzz"
end
@townie
townie / python_file_dupe.py
Created November 18, 2015 06:26
python_file_dupe.py
import os
import hashlib
from sets import Set
hash_set = Set([])
for dirpath, dir, files in os.walk("."):
files
hasher = hashlib.md5()
for file in files:
@townie
townie / min-char-rnn.py
Created October 30, 2015 15:18 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@townie
townie / ds_bos_mysql_tutorial_Keith_and_Pam.sql
Last active October 29, 2015 01:16
ds_bos_mysql_tutorial_Keith_and_Pam
ds_bos_mysql_tutorial_Keith_and_Pam
What customers are from the UK
What is the name of the customer who has the most orders?
What supplier has the highest average product price?
What category has the most orders?
5. What employee made the most sales (by number of sales)?
** 6. What employee made the most sales (by value of sales)?
@townie
townie / Google drive hierarchy.rb
Last active August 29, 2015 14:14
Neo4j google drive items hierachy
class ChildOf
include Neo4j::ActiveRel
from_class GoogleDriveItem
to_class GoogleDriveItem
type 'child_of'
property :since, type: Integer
validates_presence_of :since