Skip to content

Instantly share code, notes, and snippets.

View evizitei's full-sized avatar

Ethan Vizitei evizitei

  • Instructure
  • Columbia, MO
View GitHub Profile
@evizitei
evizitei / AddressBook.java
Last active March 6, 2020 22:17
Example java program with deadlocks and memory leak
import java.util.Scanner;
import java.util.HashMap;
import java.util.Map;
import java.util.ArrayList;
public class AddressBook {
private class User {
private final String firstName;
private final String lastName;
@evizitei
evizitei / video_preprocess_toolkit.py
Last active November 1, 2018 16:31
Cut a video file into silent and noisy clips (2 output files), or into segments with one face and other (non-one-face) segments
# requires https://github.com/Zulko/moviepy
# requires https://github.com/jiaaro/pydub
# requires https://github.com/ageitgey/face_recognition
from pydub import AudioSegment
from moviepy.editor import *
import face_recognition
import itertools
import numpy as np
@evizitei
evizitei / keybase.md
Created November 14, 2017 18:49
keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@evizitei
evizitei / salesflare_fixup.rb
Last active January 17, 2017 23:47
Fixup for salesflare
FRD = false
client = Salesflare::Api.new(ENV["SALESFLARE_KEY"])
output = {
too_many_accounts: [],
no_match: [],
too_many_projects: [],
sf_projects_not_1_to_1: [],
matched: []
}
@evizitei
evizitei / correct_receipts.sh
Last active August 29, 2015 14:13
Process Photobooth'd receipts
#!/bin/bash
# when processing receipts, I need to have them rotated 90-deg and
# flipped horizontally because of how photobooth stores them.
# Iterate through all the files in the directory, rotate, and flip
for file in *.*
do
sips -r 90 "$file"
sips -f horizontal "$file"
done
@evizitei
evizitei / nth_prime.rb
Created January 6, 2015 14:48
NthPrime
class Prime
PRIMES = [2, 3]
def self.nth(index)
raise ArgumentError if index < 1
return PRIMES[index - 1] if PRIMES.length >= index
generate_primes_up_to(index)
end
def self.generate_primes_up_to(index)
@evizitei
evizitei / gist:2f6576ee23ab9dfe3ca5
Created December 19, 2014 14:55
Bug Thresholds Across the Industry
Joel (on Software): http://www.joelonsoftware.com/articles/fog0000000043.html
Agile Advocates: http://www.ministryoftesting.com/2013/06/ten-reasons-why-you-fix-bugs-as-soon-as-you-find-them/
Gregg Boer, an employee of the most corporate-y company on the planet (sorry, David…): http://visualstudiomagazine.com/articles/2012/10/12/agile-bug-management.aspx
Independent game developers: http://www.gamedev.net/page/resources/_/technical/general-programming/zero-defect-software-development-r1050
Paul Graham: http://www.paulgraham.com/road.html
@evizitei
evizitei / test_check.rb
Created December 17, 2014 04:07
quick&dirty script for finding commits where tests weren't done
require 'rubygems'
dir = '/Users/evizitei/Code/instructure/canvas-lms'
Dir.chdir dir
shas =`git log --oneline --since='4 weeks ago' | cut -f 1 -d ' '`
def is_a_problem?(sha)
files = (`git diff --name-only #{sha} #{sha}~1`)
((files =~ /^(app|public).*\.(coffee|js)$/ &&
!(files =~ /^spec.*\.(coffee|js)$/)) ||
ERROR ArgumentError: wrong number of arguments(1 for 0)
/Users/evizitei/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/bundler/gems/railslts-6e830c6c9784/actionpack/lib/action_controller/middleware_stack.rb:72:in `initialize'
/Users/evizitei/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/bundler/gems/railslts-6e830c6c9784/actionpack/lib/action_controller/middleware_stack.rb:72:in `new'
/Users/evizitei/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/bundler/gems/railslts-6e830c6c9784/actionpack/lib/action_controller/middleware_stack.rb:72:in `build'
/Users/evizitei/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/bundler/gems/railslts-6e830c6c9784/actionpack/lib/action_controller/middleware_stack.rb:116:in `block in build'
/Users/evizitei/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/bundler/gems/railslts-6e830c6c9784/actionpack/lib/action_controller/middleware_stack.rb:116:in `each'
/Users/evizitei/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/bundler/gems/railslts-6e830c6c9784/actionpack/lib/action_con
@evizitei
evizitei / Person.cs
Created October 14, 2013 19:16
C# to Ruby
public class Person
{
// Field
public string name;
// Constructor that takes no arguments.
public Person()
{
name = "unknown";
}