Skip to content

Instantly share code, notes, and snippets.

View ekohilas's full-sized avatar
🐇
eating 🍪🍪🍪

Evan Kohilas ekohilas

🐇
eating 🍪🍪🍪
View GitHub Profile
@ekohilas
ekohilas / insertTime.gs
Last active July 17, 2020 15:11
Inserts an RFC2822 Timestamp at the cursor location of a Google Document
// https://developers.google.com/apps-script/reference/document
function insertTimeStampAtCursor() {
const doc = DocumentApp.getActiveDocument();
const selection = doc.getSelection();
const cursor = doc.getCursor();
const dateTimeString = rfc2822Datetime();
if (selection) {
const selectedElements = selection.getRangeElements();
@ekohilas
ekohilas / base_iter.py
Created October 2, 2019 14:20
Base Array Iteration
#!/usr/bin/python3
# Author: ekohilas
# Creates a list of lists containing the all the numbers of a certain base to
# the given length.
# i.e.
# base, length = 32, 4
# [1,1,1,1] ... [32,32,32,32]
def dec2base(n, b):
"""
@ekohilas
ekohilas / burn.sh
Created September 2, 2018 15:24
image installation scripts for bluetooth and ssh on a raspberry pi
#!/bin/sh
if test $# -ne 2
then
echo "Usage: ./burn.sh image_name disk_name"
exit 1
fi
img=$1
sd=$2
echo "Are you sure you want to run: (Y)"
echo "'sudo dd bs=4M if=$img of=/dev/$sd status=progress conv=fsync'"
@ekohilas
ekohilas / numbers.py
Created December 22, 2017 06:14
obfuscated code golf
word={0:"zero",1:"one",2:"two",3:"three",4:"four",5:"five",6:"six",7:"seven",8:"eight",9:"nine"}[int(input()[-1])];print(any(True if ord(i)==101 else False for i in word if i==word[-2]or i in word[-1:]))
@ekohilas
ekohilas / parity.py
Created September 4, 2017 04:17
A program to check if a number is odd or even
NUMBERS = {
0: "zero",
1: "one",
2: "two",
3: "three",
4: "four",
5: "five",
6: "six",
7: "seven",
8: "eight",
@ekohilas
ekohilas / q4.txt
Last active November 15, 2016 22:30
COMP1927 15s2 Theory Answers
COMP1927 15s2 Exam Question 4 (Fury of Dracula)
A.
Dracula's Castle
B.
City move (Unknown City)
C.
They lose all their lifepoints
@ekohilas
ekohilas / distance_from_unsw.py
Created November 5, 2016 08:57
Tutorial week 12 question 5
from os import scandir
from sys import argv
from math import radians, cos, sin, asin, sqrt
def iterate_users(dataset_path):
l = []
for user in scandir(dataset_path):
for f in scandir(user.path):
if f.name == "user.txt":
l.append(parse_file(f.path))