Skip to content

Instantly share code, notes, and snippets.

@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
@townie
townie / doug.rb
Created May 20, 2014 20:20
doug gist
string = ['12 oz pepper' , 'One can of tomatoes' ]
class LineItem
attr_accessor :a,:u,:i
def initialize(a, u, i)
@a= a
@u = u
@i = i
end
end
# select the movie Troll 2
SELECT title FROM movies WHERE title LIKE '%Troll 2%';
#select the year that Troll 2 was made in
SELECT year FROM movies WHERE title LIKE '%Troll 2%';
#select all the movies with a rating above 90
SELECT title FROM movies WHERE rating > 90;
#select all the movies that came out in 1996
createdb recipes
CREATE TABLE recipes (
id SERIAL NOT NULL ,
name VARCHAR(125) NOT NULL ,
yields VARCHAR(50),
total_time VARCHAR(150),
directions TEXT NOT NULL
);