Skip to content

Instantly share code, notes, and snippets.

Avatar
🐇
eating 🍪🍪🍪

Evan Kohilas ekohilas

🐇
eating 🍪🍪🍪
  • Sydney
View GitHub Profile
@ekohilas
ekohilas / insertTime.gs
Last active Jul 17, 2020
Inserts an RFC2822 Timestamp at the cursor location of a Google Document
View insertTime.gs
// 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 Oct 2, 2019
Base Array Iteration
View base_iter.py
#!/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 Sep 2, 2018
image installation scripts for bluetooth and ssh on a raspberry pi
View burn.sh
#!/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 Dec 22, 2017
obfuscated code golf
View numbers.py
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 Sep 4, 2017
A program to check if a number is odd or even
View parity.py
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 Nov 15, 2016
COMP1927 15s2 Theory Answers
View q4.txt
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 Nov 5, 2016
Tutorial week 12 question 5
View distance_from_unsw.py
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))
You can’t perform that action at this time.