Skip to content

Instantly share code, notes, and snippets.

View thetooth's full-sized avatar

Jeff Jenner thetooth

View GitHub Profile
@thetooth
thetooth / stream.go
Created November 22, 2015 13:18
GridFS HLS
file, err := ms.DB(database).GridFS("media").Open(r.URL.Path[1:])
if err == nil {
w.Header().Add("Accept-Ranges", "bytes")
w.Header().Add("Content-Type", file.ContentType())
bytes := r.Header.Get("Range")
if bytes != "" {
rs := bytes[strings.LastIndex(bytes, "=")+1 : strings.Index(bytes, "-")]
re := bytes[strings.LastIndex(bytes, "-")+1:]
package api
import (
"io"
"os"
"os/exec"
"strconv"
"sync"
"time"

▄▄▄▄▄▄▄
▄▄▄▄▄▄▄
▄▄▄▄▄▄▀
▀▀▀▀▀▀ 

package api
import (
"net/http"
"git.ameoto.com/Ameoto/auth/server/auth"
"git.ameoto.com/Ameoto/platform"
"git.ameoto.com/Ameoto/platform/conf"
"git.ameoto.com/webcogs/accounting/model"
log "github.com/Sirupsen/logrus"
{
"_id" : ObjectId("5725acd12305804fe593944c"),
"name" : "Jeffrey Jenner",
"email" : "thetooth@ameoto.com",
"password" : "$2a$10$trW0YEsrY3Pr/JHfgQ0mbOJoZVv0cyvYdri8Qfdsza3IiLnXmvbDK",
"address" : "317 Musgrave Rd Coopers Plains",
"isadmin" : true,
"isapproved" : true,
"containers" : [
{
chip@chip:~$ sudo hwtest
[sudo] password for chip:
############################################################
# [ CHIP HW TEST ] #
############################################################
# Turn on wlan0...OK
// Handle a subject
// Warning: Uses parametric function wizardy and WILL crash
func (a *Server) Handle(subj string, f interface{}) error {
_, err := a.sc.Subscribe(a.toSubj(subj), func(m *nats.Msg) {
// Get function and paramater values
vf := reflect.ValueOf(f)
req := reflect.New(vf.Type().In(0))
// Decode payload
if err := msgpack.Unmarshal(m.Data, req.Interface()); err != nil {
The local commuter railroad services a number of towns in Kiwiland. Because of monetary concerns, all of the tracks are 'one-way’. That is, a route from Kaitaia to Invercargill does not imply the existence of a route from Invercargill to Kaitaia. In fact, even if both of these routes do happen to exist, they are distinct and are not necessarily the same distance!
The purpose of this problem is to help the railroad provide its customers with information about the routes. In particular, you will compute the distance along a certain route, the number of different routes between two towns, and the shortest route between two towns.
Input: A directed graph where a node represents a town and an edge represents a route between two towns. The weighting of the edge represents the distance between the two towns. A given route will never appear more than once, and for a given route, the starting and ending town will not be the same town.
Output: For test input 1 through 5, if no such route exists, output 'NO SUCH ROU
// NUCLEO-F401RE DMA Driven PWM - Not good for school or work assignments.
// Copyright (C) 2015 sourcer32@gmail.com, All Rights Reserved
#include "stm32f4xx.h"
#define PWM_ELEMENTS 100
const u32 PWM_Buffer[PWM_ELEMENTS] = { // Sine Table
0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 50, 53, 56,
58, 61, 63, 66, 68, 70, 72, 75, 77, 79, 80, 82, 84, 86, 87, 89, 90, 91, 92, 94,
---
- hosts: localhost
connection: local
gather_facts: False
tasks:
- name: Build client
shell: "GOARM=7 GOARCH=arm GOOS=linux go build -v -i -o client cmd/client/main.go"
register: build
- debug: var=build.stderr