Skip to content

Instantly share code, notes, and snippets.

@malisetti
malisetti / upspin-drive-guide.md
Created February 15, 2018 12:15 — forked from fstanis/upspin-drive-guide.md
Upspin server backed by Google Drive on a Raspberry Pi

Set up an Upspin server backed by Google Drive

Overview

The purpose of this document is to explain how to deploy an Upspin server on a Debian or Ubuntu based machine - which can be a Raspberry Pi - and, optionally, use Google Drive to back the data.

Effectively, this will give you all the nifty advantages Upspin gives you in terms of file sharing without requiring a costly server.

Requirements

@malisetti
malisetti / main.go
Created January 18, 2018 12:48
music hunter
// realmain runs the Subscribe example with a real RSS fetcher.
package main
import (
"fmt"
"math/rand"
"time"
"github.com/mmcdole/gofeed"
@malisetti
malisetti / main.go
Created January 8, 2018 03:58 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@malisetti
malisetti / food.txt
Created August 8, 2017 06:51
eyes, teeth, gut
carrots
vegetables (crunchy like celery)
leafy greens
eggs boiled
milk
yogurt
citrus and berries (limited)
dry fruits (limited)
almonds
fish (fatty like salmon)

channel's zero value is nil, you have to make a chan like

a := make(chan int) # this gives an unbuffered channel

// read from channel a

@malisetti
malisetti / go-notes.md
Last active July 24, 2017 08:50
notes to self
  1. empty select blocks
select {}
  1. if you can't block but have to wait on something, block in another routine
go func() {
  wg.Wait()
}()
---
swagger: '2.0'
info:
description: "The Rest Api provides programmatic access to command and control a
NiFi instance in real time. Start and \n stop
processors, monitor queues, query provenance data, and more. Each endpoint below
includes a description,\n definitions
of the expected input and output, potential response codes, and the authorizations
required\n to invoke each service."
version: 1.3.0
@malisetti
malisetti / swagger.json
Created July 14, 2017 10:32
Apache NiFi Swagger json
{
"swagger" : "2.0",
"info" : {
"description" : "The Rest Api provides programmatic access to command and control a NiFi instance in real time. Start and \n stop processors, monitor queues, query provenance data, and more. Each endpoint below includes a description,\n definitions of the expected input and output, potential response codes, and the authorizations required\n to invoke each service.",
"version" : "1.3.0",
"title" : "NiFi Rest Api",
"contact" : {
"url" : "https://nifi.apache.org",
"email" : "dev@nifi.apache.org"
},
@malisetti
malisetti / hartman.go
Last active July 4, 2017 18:34
Supervises n number of go routines
// Package hartman supervises and keeps n workers at all times by restarting finished workers. https://en.wikipedia.org/wiki/Full_Metal_Jacket
package hartman
import (
"context"
"errors"
"log"
"sync"
)
@malisetti
malisetti / collatz.go
Created June 5, 2017 08:17
Longest Collatz sequence under one million
package main
func main() {
onem := 1000000
visited := map[int]int{}
maxstep := 1
var maxn int
for i := 1; i <= onem; i++ {
n := i