Skip to content

Instantly share code, notes, and snippets.

View kionay's full-sized avatar

kionay

  • Indianapolis, IN
View GitHub Profile
setInterval(function(){
document.getElementsByClassName("robin-chat--vote robin-chat--vote-increase robin--vote-class--increase robin--active")[0].click();
}, 600000);
var c = "robin--vote-class--";
setInterval(function(){
if(document.getElementsByClassName("robin--flair-class--no-flair")[1].children[1].innerHTML == "Voting will end soon"){
document.getElementsByName("message")[0].value = "Voting will end soon.";
} else {
var timeLeft = (document.getElementsByClassName("robin--flair-class--no-flair")[1].children[1].innerHTML.substring(33,35)*60) - (Math.abs(new Date(document.getElementsByClassName("robin--flair-class--no-flair")[1].children[0].getAttribute("datetime")) - new Date())/1000);
var minutesLeft = Math.floor(timeLeft/60);
var secondsLeft = Math.round(timeLeft - minutesLeft * 60);
document.getElementsByName("message")[0].value = (minutesLeft < 0)?("Voting will end soon."):(minutesLeft + " minutes and " + secondsLeft + " seconds left. ");
}
@kionay
kionay / systems_test.py
Last active March 6, 2017 18:48
Import the elite dangerous database csv file, and look for the system (as x,y,z coordinates) that has the largest distance to its nearest neighbor.
import csv
from csv import *
import os.path
from math import sqrt
systems_file_location = "C:\\Users\\kionay\\Downloads\\systems.csv"
print("File exists?: " + str(os.path.isfile(systems_file_location)))
glob_row_count = 7556648
@kionay
kionay / nodetreetest.py
Last active September 29, 2018 04:29
experimenting with making a binary tree from scratch
"""Only import required is to be able to initialize our NodeTree with random values"""
import random
class Node(): # pylint: disable=too-few-public-methods
"""Represents an arbitrary node in a binary tree"""
def __init__(self, value):
if value is None:
self.value = 0
@kionay
kionay / isanagram.py
Created August 10, 2018 14:56
time testing for two anagram finding functions
import timeit
def is_anagram(first_word, second_word):
second_word = list(second_word)
for char in first_word:
if char in second_word:
second_word.remove(char)
else:
return False
return not second_word
@kionay
kionay / massrename.py
Last active September 29, 2018 04:35
A script to rename all media files in a given directory to one more suitable for Plex Media Server
"""os, for file IO"""
import os
import re
import argparse
def files(path):
""" Returns a list of filenames from the given directory.
https://stackoverflow.com/questions/14176166/list-only-files-in-a-directory
"""
@kionay
kionay / match_creation_to_name.py
Created October 14, 2018 02:56
Changes the Creation Date attribute of files at the top of a given Drive in windows so that Create Date orders the same as Alphabetically
# pylint: disable=I1101,E1101
"""
os for generic filesystem operations
argparse to accept a drive letter
time as a basis for creation time
pywintypes and win32file for windows file manipulation
"""
import os
import argparse
import time
@kionay
kionay / test_fuzzy_distances.py
Created February 25, 2019 01:54
string similarities
from math import *
from decimal import Decimal
import difflib
from difflib import SequenceMatcher
def strings_to_vectors(string1,string2):
uniqueset = set(string1+string2)
string1_vector = []
string2_vector = []
for x in uniqueset:
@kionay
kionay / Exchange COM org mapper.py
Last active November 29, 2022 02:24
A simple python 3 script to use microsoft outlook's COM api via pythoncom (pypiwin32 package) to map, depth first, the organizational structure as tracked in exchange.
import pythoncom
import win32com.client
class Contact():
"""Class serves as little more than an enhanced node tree."""
def __init__(self, exchange_user):
"""
Establish a core COM object to work off of for subsequent properties.
Manager and workers are cached, in that they are only gotten once.
This reduces external calls if we need to access the name or job title multiple times.
@kionay
kionay / guess_squared_magic_squares.py
Last active September 6, 2019 19:40
Watched Numberphile recently, thought i'd make a program that tries to guess magic squares of squared numbers. Using Lox for multiprocessing. 3.4 Million/s
import random
import time
import lox
@lox.process(10)
def compute_squared_set(squared_set, square_sets_per_thread_proc):
import random
def compute_square(numbers):
"For each row, column, and diagonal check that they all sum to the same number"
magic = sum(numbers[:3])