Skip to content

Instantly share code, notes, and snippets.

View kylecorry31's full-sized avatar

Kyle Corry kylecorry31

View GitHub Profile
@kylecorry31
kylecorry31 / loc.py
Created December 24, 2023 19:02
Displays the lines of code per user of a given repo
import os
import subprocess
from collections import defaultdict
from tqdm import tqdm
repo_path = "./"
valid_extensions = ['.kt', '.java', '.xml', '.py', '.js', '.html', '.css', '.kts', '.bat', '.sh', '.md', '.yml']
translation_files = ['strings.xml', 'fastlane', '/raw/', 'README.md']
ignored_files = ['.idea']
@kylecorry31
kylecorry31 / decode.sh
Last active August 19, 2023 11:40
Encode a file to base64 for use in github secrets
echo ${ENCODED_FILE_AS_ENVIRONMENT_VARIABLE} | base64 -d > decoded.txt
@kylecorry31
kylecorry31 / blood_kelp.ino
Created October 10, 2020 16:25
An Arduino powered Subnautica blood kelp
#define FADE 3
int max_brightness = 255 - FADE;
int min_brightness = FADE;
int brightness[4] = {240, 230, 225, 200};
int pins[4] = {5, 10, 6, 3};
int fade[4] = {FADE, FADE, FADE, FADE};
@kylecorry31
kylecorry31 / blur.py
Created January 8, 2019 12:51
A python script to blur images
import cv2
import sys
import numpy as np
BLUR_LOW = 20
BLUR_MED = 50
BLUR_HIGH = 100
def adjust_gamma(image, gamma=1.0):
# from: https://www.pyimagesearch.com/2015/10/05/opencv-gamma-correction/
@kylecorry31
kylecorry31 / wemo.py
Created January 1, 2019 12:44
A script for interacting with wemo devices.
import gi
import time
gi.require_version('Notify', '0.7')
from gi.repository import Notify
from ouimeaux.environment import Environment
def print_name(light):
print light.name
env = Environment()
var Time = function(hour, minute, second){
var getNextOccurrence = function(){
var date = new Date();
date.setHours(hour, minute, second);
var currentTime = new Date();
// If the alarm time is in the past, move it to the next day
if(date.getTime() < currentTime.getTime()){
@kylecorry31
kylecorry31 / chi.py
Created January 10, 2017 00:41
Chi Squared Test
# chi_square_test : [(number, number)] -> number
# consumes a list of tuples containing the observed data and expected data
# produces the chi squared term of the dataset
def chi_square_test(data_points):
s = 0
for point in data_points:
o, e = point
s += (o - e)**2/float(e)
return s
@kylecorry31
kylecorry31 / Robot.java
Last active December 24, 2016 00:03
Library of Gongolierium Test
package org.usfirst.frc.team5112.robot;
import org.opencv.core.Range;
import com.thegongoliers.geometry.Point;
import com.thegongoliers.geometry.Pose;
import com.thegongoliers.geometry.Quaternion;
import com.thegongoliers.input.EnhancedXboxController;
import com.thegongoliers.input.camera.Camera;
@kylecorry31
kylecorry31 / sheets-api.js
Last active October 11, 2016 00:41
Simple Google Sheets API for JS
function Sheet(key){
this.key = key;
this.baseurl = "https://spreadsheets.google.com/pub?key="+this.key+"&hl=en&output=tsv";
}
Sheet.prototype.fetchAsync = function(pageId, callback){
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
callback(_getSheetData(xmlHttp.responseText));
@kylecorry31
kylecorry31 / stock_analysis.py
Created September 9, 2016 16:32
Stock Analysis using moving averages
import matplotlib.pyplot as plt
"""
moving_average : list[float] int -> list[float]
Consumes a list of floats and computes the moving average with a window
size of window_size
"""