Skip to content

Instantly share code, notes, and snippets.

View jrg94's full-sized avatar
🏒
Watching hockey

Jeremy Grifski jrg94

🏒
Watching hockey
View GitHub Profile
@jrg94
jrg94 / pixel_finder.py
Last active July 11, 2020 07:37
Finds the closest RGB value
from PIL import Image
import numpy
def color_diff(color1, color2):
return numpy.sum((color1 - color2) ** 2) ** 1/2
def hsv(rgb):
hue = numpy.array(rgb) / 255
value_index = numpy.argmax(hue)
value = hue[value_index]
@jrg94
jrg94 / speech_recognition.py
Last active July 9, 2020 19:29
A copy of a speech recognition script used to transcribe an interview
import speech_recognition as sr
from pydub import AudioSegment
import os
AudioSegment.converter = r"C:\Users\Jeremy Grifski\AppData\Roaming\JetBrains\PyCharmCE2020.1\scratches\ffmpeg.exe"
r = sr.Recognizer()
for i, filename in enumerate(os.listdir('audio')):
sound = AudioSegment.from_mp3(f'audio/{filename}')
sound.export(f"dump/{filename[:-4]}.wav", format="wav")
@jrg94
jrg94 / Bicycle.java
Last active June 26, 2021 09:20
Bicycle Simulator
/**
* A bicycle consists of a chain assembly, a handle assembly, and a frame.
* This class can be used to simulate a bicycle.
*/
public class Bicycle {
private BrakeAssembly brakeAssembly;
private ChainAssembly chainAssembly;
private HandleAssembly handleAssembly;
/**
@jrg94
jrg94 / referral-links.md
Created February 27, 2019 03:14
A collection of referral links
public static void tryToWin(int num) {
num++;
if (num >= 6) {
System.out.print("You're a winner");
}
System.out.print("You lose");
}
@jrg94
jrg94 / LightDistanceCalc.md
Last active December 19, 2016 18:11
An example of the difference between a 32-bit and 64-bit integer.

Light Distance Calculation: 32-bit vs. 64-bit

Some Facts

Maximum Positive Signed 32-bit Integer: (2^31) - 1 = 2,147,483,647

Maximum Positive Signed 64-bit Integer: (2^63) - 1 = 9,223,372,036,854,775,807

Speed of Light: 299,792,458 m/s