Skip to content

Instantly share code, notes, and snippets.

Avatar
dd if=coffee of=mouth bs=venti

Rob Herley robherley

dd if=coffee of=mouth bs=venti
View GitHub Profile
View helios_puzzle.go
package main
import (
"fmt"
"image"
"image/color"
"image/png"
"os"
"github.com/nfnt/resize"
View mongo_socks.go
package main
import (
"context"
"fmt"
"net/http"
"time"
"github.com/gorilla/websocket"
_ "github.com/joho/godotenv/autoload"
@robherley
robherley / DiamondThing.java
Last active Nov 14, 2019
Java program to print an ASCII '*' diamond
View DiamondThing.java
public class DiamondThing {
static int MAX_ROW_LEN = 5; // should always be an odd num to work properly
public static void main(String[] args) {
// from i -> the max, add 2 everytime
for (int currRowLen = 1; currRowLen <= MAX_ROW_LEN; currRowLen += 2) {
// we need to do a little arithmetic to figure out how many spaces
int numPrefixSpaces = MAX_ROW_LEN - currRowLen / 2;
for (int space = 0; space < numPrefixSpaces; space++) {
View queries.js
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
View app.js
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
k8s traefik config
View traefik
logLevel = "DEBUG"
defaultEntryPoints = ["http", "https"]
[api]
[kubernetes]
[entryPoints]
[entryPoints.http]
address = ":80"
@robherley
robherley / InterfaceController.swift
Created Apr 29, 2019
Health Kit Example - Updated for watchOS 5
View InterfaceController.swift
//
// 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
View testing env
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 Mar 29, 2019
CS 554 - Lab 4 Grading Script
View script.js
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 Mar 29, 2019
Crappy URL Shortener
View main.go
package main
import (
"encoding/hex"
"fmt"
"math/rand"
"net/http"
"time"
valid "github.com/asaskevich/govalidator"
You can’t perform that action at this time.