Skip to content

Instantly share code, notes, and snippets.

View evanhalley's full-sized avatar

Evan Halley evanhalley

View GitHub Profile
@evanhalley
evanhalley / scratch.java
Created December 12, 2022 17:50
Naive Leaky Bucket Algorithm Implementation
import java.util.LinkedList;
import java.util.stream.Stream;
class Scratch {
public static void main(String[] args) throws InterruptedException {
int rate = Integer.parseInt(args[0]);
int maxBucketSize = Integer.parseInt(args[1]);
LinkedList<Integer> requestStream = new LinkedList<>(Stream.of(args[2].split(","))
.map(Integer::parseInt)
.toList());
@evanhalley
evanhalley / gulpfile.js
Created March 24, 2020 18:20
Small example of using the very basics of gulp.
const { series, src, dest } = require('gulp');
const tap = require('gulp-tap');
function helloWorld(cb) {
console.log('hello world');
cb();
}
function helloWorldPromise() {
return new Promise((resolve, reject) => {
@evanhalley
evanhalley / gulpfile.js
Created March 24, 2020 18:20
Small example of using the very basics of gulp.
const { series, src, dest } = require('gulp');
const tap = require('gulp-tap');
function helloWorld(cb) {
console.log('hello world');
cb();
}
function helloWorldPromise() {
return new Promise((resolve, reject) => {
@evanhalley
evanhalley / build_deploy.yml
Created January 26, 2020 02:38
Building and deploying a Hugo generated static HTML site to Firebase hosting.
name: Build & deploy
on:
push:
branches:
- master
jobs:
build:

hello world

@evanhalley
evanhalley / TodoistCompletedTasksReport.gs
Created August 9, 2019 15:01
Google Script that uses the Todoist API to retrieve completed tasks, then builds and emails a report.
var COMPLETED_TASKS_ENDPOINT = 'https://api.todoist.com/sync/v8/completed/get_all?since=[SINCE]&until=[UNTIL]';
var EMAIL_SUBJECT = 'Todoist Completed Tasks Report for [DATE]';
var MILLIS_PER_DAY = 1000 * 60 * 60 * 24;
function main() {
var yesterday = getYesterday();
var tasks = getCompletedTasks(yesterday);
if (tasks) {
processCompletedTasks(tasks, yesterday);
package com.emuneee.tensorandflow
import android.graphics.*
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import kotlinx.android.synthetic.main.activity_main.*
import android.graphics.Bitmap
import com.emuneee.tensorandflow.classifier.Classifier
import com.emuneee.tensorandflow.classifier.TFMobileClassifier
import com.emuneee.tensorandflow.view.CanvasView
[{
"filename": "1495332407.63.jpg",
"is_congested": -1
}, {
"filename": "1495332973.66.jpg",
"is_congested": -1
}, {
"filename": "1495333131.12.jpg",
"is_congested": -1
}, {
@evanhalley
evanhalley / generate_list.py
Created June 7, 2017 13:10
Reads a list of images in a directory then builds a JSON object representation with some additional metadata
from os import listdir
import json
files = listdir('./traffic_images')
data = []
# loop over the list of files and write it to an array
for image_file in files:
row = {}
row['filename'] = image_file
@evanhalley
evanhalley / save_image.py
Last active May 21, 2017 02:40
Saves an image (jpg) given a url
import sys
import urllib
import time
url = sys.argv[1]
directory = sys.argv[2]
destination = directory + "/" + str(time.time()) + ".jpg"
print 'Saving image from url ', url, ' to ', destination
urllib.urlretrieve(url, destination)