Skip to content

Instantly share code, notes, and snippets.

View Fingel's full-sized avatar
🏠

Austin Riba Fingel

🏠
View GitHub Profile
@Fingel
Fingel / gist:5227736f6a9679c21387
Created November 21, 2014 18:24
CacheFactory for Angular
.factory('CacheFactory', ['$injector', function($injector){
var cache = {};
var cacheFactory;
cacheFactory = {
get: function(type, callback){
if(!cache[type] || cache[type].length < 1){
console.log("no cache");
var factory = $injector.get(type);
factory.query({}, function(data, headers){
cache[type] = data.results;
@Fingel
Fingel / img2txt.sh
Created November 22, 2013 05:43
Script for converting images to text (ocr) for the Noisebridge Archivists group. Requires tesseract. Ubuntu packages: tesseract-ocr and tesseract-ocr-eng
#!/bin/bash
#Converts images to text using tesseract (package tesseract-ocr & tesseract-ocr-eng)
function usage
{
echo "img2txt -i <input directory> -o <output directory> --concat"
}
function concat
{
@Fingel
Fingel / httpscheck.py
Created November 13, 2013 02:41
Check Alexa top sites to see who uses https
import urllib, urllib2, subprocess, re, csv, pickle
from collections import OrderedDict
urls = []
usessl = 0
sites = OrderedDict()
CHECK = 1000
with open('top-1m.csv', 'rb') as csvfile:
i = 0
reader = csv.reader(csvfile)
@Fingel
Fingel / pyswear.py
Created November 11, 2013 02:33
Python script to determine if a song has dirty language
#!/usr/bin/python
import urllib2
import urllib
import re
import getopt, sys, argparse
def getSongLyrics(artist, song):
songUrl = 'http://api.chartlyrics.com/apiv1.asmx/SearchLyricDirect?artist=%s&song=%s' % (urllib.quote_plus(artist), urllib.quote_plus(song))
data = urllib2.urlopen(songUrl).read();
p = re.compile('<Lyric>[a-zA-z].*?<\/Lyric>', re.DOTALL)
@Fingel
Fingel / TocComparator.java
Created September 19, 2013 23:56
A comparator for String representing numbers, where 1.10 is greater than 1.1 and 1.2, like a table of contents.
private static class TocComparator implements Comparator<String>{
public int compare(String s1, String s2){
Integer s1front = Integer.parseInt(s1.substring(0, s1.indexOf('.')));
Integer s2front = Integer.parseInt(s2.substring(0, s2.indexOf('.')));
if(s1front.equals(s2front)){
Integer f1ass = Integer.parseInt(s1.substring(s1.indexOf('.')+1));
Integer f2ass = Integer.parseInt(s2.substring(s2.indexOf('.')+1));
return f1ass.compareTo(f2ass);
}
else{
@Fingel
Fingel / Dripping-WD-42.markdown
Created September 19, 2013 08:25
A Pen by Austin Riba.

Dripping WD-42

My first pen. Just playing around with canvas and TweenMax. This is my first real foray into animation like stuff but I came up with what might be a pretty cool loading screen for a website.

A Pen by Austin Riba on CodePen.

License.