Skip to content

Instantly share code, notes, and snippets.

View steventhanna's full-sized avatar

Steven Hanna steventhanna

View GitHub Profile
@steventhanna
steventhanna / aws-transcribe-transcript.go
Last active June 28, 2018 03:48
Transcribes an output file from AWS Transcribe into something humans can read
// Steven Hanna
package main
import (
"fmt"
"flag"
"encoding/json"
"io/ioutil"
"log"
@steventhanna
steventhanna / prepend_file.py
Created March 6, 2017 19:54
Prepend a string to the beginning of all files in a directory
# Steven Hanna
# Usage: python prepend_file.py location name
# location must not have a / at the end
import os
import sys
args = sys.argv
del args[0]
location = args[0]
def product(xs):
# print("TESTING:")
# print(xs)
xs = filter(lambda x: x != 0, xs)
if len(xs) == 0:
return 0
sum = xs.pop(0)
while len(xs) > 0:
sum *= xs.pop(0)
# print("SUM: " + str(sum))
@steventhanna
steventhanna / movie.py
Last active June 11, 2021 23:28
Concat videos together in a given directory
from moviepy.editor import *
from moviepy.video.fx import *
import sys
import glob
import requests
# Must install [MoviePy](http://zulko.github.io/moviepy/install.html)
# pip install moviepy
# Additionally pip install pip install pillow==2.9.0
@steventhanna
steventhanna / replace.js
Created November 28, 2016 03:32
Convert the HTML encoding tags back to regular
function replaceAll(str, find, replace) {
return str.replace(new RegExp(find, 'g'), replace);
}
var content = document.getElementById('content');
var string = content.innerHTML;
string = replaceAll(string, '&lt;', '<');
string = replaceAll(string, '&rt;', '>');
string = replaceAll(string, '&gt;', '>');
content.innerHTML = string;
@steventhanna
steventhanna / simpleServer.bash
Created September 19, 2016 04:01
Simple Python Server
python -m SimpleHTTPServer 8000
@steventhanna
steventhanna / overview.md
Created September 16, 2016 02:19
A Crash Course in Sails.js - Just the important stuff

A Crash Course in Sails.js - Just the important stuff

Sails follows the MVC (model, view, controller) method in order to develop API's and applications.

  • Model: a representation of how the data should look like
  • Controller: handles "server-side logic". Performs any calculations or mutations on data before the client can view it
  • View: What the user actualy interacts with. ie browser, app, etc.

Creating a new project

@steventhanna
steventhanna / test.py
Created September 16, 2015 00:20
3.1
hours = input("Enter hours: ")
rate = input("Enter Rate:")
newRate = rate * 1.5
newHours = hours - 40
if newHours > 0:
total = 40 * rate
total = total + (newRate * newHours)
else:
total = hours * rate
print total
@steventhanna
steventhanna / installSteven.sh
Created August 3, 2015 23:43
Personal Install for MacOSX
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
brew install ant
brew install imagemagick
brew install libvo-aacenc
brew install postgresql
brew install x264
brew install enscript
brew install jpeg
@steventhanna
steventhanna / FizzBuzz.java
Created February 22, 2015 17:42
The FizzBuzz Test in java
/**
* @author Steven T Hanna
* @class FizzBuzz
* @date 2/22/15
* @description Complete the FizzBuzz test in Java
*/
public class FizzBuzz {
public static void main(String[] args) {