Skip to content

Instantly share code, notes, and snippets.

View robherley's full-sized avatar
curl tiny.coffee

Rob Herley robherley

curl tiny.coffee
View GitHub Profile
const SQL = require('sql-template-strings');
module.exports = {
slice: (start, end) => SQL`
SELECT
eventid,
CAST(latitude AS REAL) AS latitude,
CAST(longitude AS REAL) AS longitude,
CAST(nkill AS INT) AS nkill,
CAST(iyear AS INT) AS year
const Koa = require('koa');
const logger = require('koa-logger');
const Router = require('koa-router');
const cors = require('@koa/cors');
const sqlite = require('sqlite');
const qs = require('./db/queries');
const DB_LOC = './db/terror.sqlite'
const app = new Koa();
@robherley
robherley / traefik
Created May 1, 2019 07:59
k8s traefik config
logLevel = "DEBUG"
defaultEntryPoints = ["http", "https"]
[api]
[kubernetes]
[entryPoints]
[entryPoints.http]
address = ":80"
@robherley
robherley / InterfaceController.swift
Created April 29, 2019 05:33
Health Kit Example - Updated for watchOS 5
//
// InterfaceController.swift
// AppleWatchExample WatchKit Extension
//
// Created by Robert Herley on 4/28/19.
// Copyright © 2019 Robert Herley. All rights reserved.
//
// Adapted From: https://developer.apple.com/documentation/healthkit/workouts_and_activity_rings/speedysloth_creating_a_workout
API_URI="http://host.docker.internal:5000/api/v1/plague_doctor" # plague doctor endpoint
TEST_DATA="{\"submissionID\":\"1337\",\"assignmentID\":\"5cbfe2f3fe0eecea1cfcaef1\",\"testBuildCMD\":\"echo build stuff here\",\"tests\":[{\"name\":\"Test 1\",\"expectedOutput\":\"foobar\",\"studentFacing\":true,\"testCMD\":\"echo -n foobar\"},{\"name\":\"Test 2\",\"expectedOutput\":\"foo\\nbaz\",\"studentFacing\":true,\"testCMD\":\"echo -n foobar\"},{\"name\":\"Test 3\",\"expectedOutput\":\"foobaz\",\"studentFacing\":true,\"testCMD\":\"echo -n foobar\"},{\"name\":\"Test 4\",\"expectedOutput\":\"f00bar\",\"studentFacing\":true,\"testCMD\":\"echo -n foobar\"},{\"name\":\"Test 5\",\"expectedOutput\":\"oobar\",\"studentFacing\":true,\"testCMD\":\"echo -n foobar\"},{\"name\":\"Test 6\",\"expectedOutput\":\"foobar\",\"studentFacing\":true,\"testCMD\":\"echo -n foobar\"},{\"name\":\"Test 7\",\"expectedOutput\":\"foobar\",\"studentFacing\":true,\"testCMD\":\"echo -n foobar\"},{\"name\":\"Test 8\",\"expectedOutput\":\"foobar\",\"
@robherley
robherley / script.js
Last active March 29, 2019 19:55
CS 554 - Lab 4 Grading Script
const { promisify } = require('util');
const axios = require('axios');
const consola = require('consola');
const client = require('redis').createClient();
const flushall = promisify(client.flushall).bind(client);
axios.interceptors.request.use(
config => {
config.meta = { startTime: new Date() };
return config;
@robherley
robherley / main.go
Created March 29, 2019 05:47
Crappy URL Shortener
package main
import (
"encoding/hex"
"fmt"
"math/rand"
"net/http"
"time"
valid "github.com/asaskevich/govalidator"
@robherley
robherley / read_serial.ino
Created March 15, 2019 03:06
Reading Ints over Serial Monitor
int MOTORPIN = 9;
int analog_input = 82;
String input;
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.print("Current Analog Value:");
@robherley
robherley / index.html
Last active March 12, 2019 23:13
slu.gg
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>slu.gg</title>
<style>
:root {
--bg: #434c5e;
--white: #e5e9f0;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Compulsory Sterilizations</title>
</head>
<body>
<style>