Custom JSON Marshalling in Go
Go’s encoding/json package makes it really easy to marshal structs to JSON data.
package main
import (
"encoding/json"
"os"
package main | |
import ( | |
"fmt" | |
"net/http" | |
"sort" | |
"time" | |
) | |
// a struct to hold the result from each request including an index |
Custom JSON Marshalling in Go
Go’s encoding/json package makes it really easy to marshal structs to JSON data.
package main
import (
"encoding/json"
"os"
#!/bin/bash | |
export version=v4.2.8 | |
export os=linux | |
export arch=amd64 | |
##################################### | |
curl -O https://get.gravitational.com/teleport-$version-$os-$arch-bin.tar.gz | |
tar -xzf teleport-$version-$os-$arch-bin.tar.gz |
I've spent the day trying to get this setup working with GitHub and given the number of gotcha's I encountered, it seemed like a good idea to document how I finally got this working with as few hacks as possible. There's a lot of documentation out there (some of it old and misleading) and committing here for posterity will help me remember this when I inevitably need to do this again.
Passwords are simply not enough these days. Regardless of the company, breaches (and the associated Personally Identifiable Information harvested) are a matter of not if, but when. There are a number of things you can do to protect yourself, but being on the tin-foil-hat side of paranoia, means there are a few Commandents that I adhere to (and recommend for other folks)[Insert link to Fight Club Rules for the Secure Internet].
That being said, if you use 2-factor authentication and have committed to using a hardware token such as the Yubikey, then you're already ahead of the curve. The problem is that wh
/** | |
* Copyright 2012 Akseli Palén. | |
* Created 2012-07-15. | |
* Licensed under the MIT license. | |
* | |
* <license> | |
* Permission is hereby granted, free of charge, to any person obtaining | |
* a copy of this software and associated documentation files | |
* (the "Software"), to deal in the Software without restriction, | |
* including without limitation the rights to use, copy, modify, merge, |
{ | |
"openapi": "3.0.0", | |
"info": { | |
"title": "mavenapi", | |
"version": "1.0", | |
"contact": { | |
"name": "Wrecing Ball", | |
"url": "https://www.getwrecked.com", | |
"email": "developers@getwrecked.com" | |
} |
// It is mainly used for implementing distributed event handling systems, in "event driven" software. | |
// Channels could have been used. | |
package main | |
////// | |
// Starts here. | |
////// | |
func main() { |
package main | |
import ( | |
"flag" | |
"io" | |
"log" | |
"net" | |
"net/http" | |
"strings" | |
) |
package main | |
import ( | |
"fmt" | |
"log" | |
"os/exec" | |
"runtime" | |
) | |
type Worker struct { |