Skip to content

Instantly share code, notes, and snippets.

View udhos's full-sized avatar
👾
Wondering

udhos

👾
Wondering
  • São Paulo, Brazil
View GitHub Profile
@udhos
udhos / sshd.go
Created October 26, 2016 12:32 — forked from jpillora/sshd.go
Go SSH server complete example - Read more here https://blog.gopheracademy.com/go-and-ssh/
// A small SSH daemon providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client:
@udhos
udhos / gowebhello.go
Created March 3, 2017 17:17
gowebhello sample web app
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
"runtime"
"time"

Keybase proof

I hereby claim:

  • I am udhos on github.
  • I am udhos (https://keybase.io/udhos) on keybase.
  • I have a public key ASCZ-_guQCK6aODCpx8m5xKJzqrRZK8jFtlebkHc4wpScQo

To claim this, I am signing this object:

@udhos
udhos / gob.go
Created July 6, 2017 21:52 — forked from whyrusleeping/gob.go
golang gob interface example
package main
import (
"bytes"
"encoding/gob"
"fmt"
)
type MyFace interface {
A()
package main
import (
"errors"
"runtime"
"unsafe"
"golang.org/x/mobile/app"
"golang.org/x/mobile/event/lifecycle"
"golang.org/x/mobile/event/paint"
@udhos
udhos / nil-interface.go
Created November 3, 2017 13:26
Understanding Go nil interface
package main
import (
"fmt"
)
type T struct {
}
func main() {

Here's the canonical TOML example from the TOML README, and a YAML version of the same. Which looks nicer?

title = "TOML Example"

[owner]

@udhos
udhos / nextip.go
Created March 1, 2018 19:41
nextIP(): find next IP address in Go
package main
import (
"bytes"
"fmt"
"net"
)
func main() {
testNext("foo", "bar")
@udhos
udhos / ipcalc.go
Created March 2, 2018 04:11 — forked from kotakanbe/ipcalc.go
get all IP address from CIDR in golang
package main
import (
"net"
"os/exec"
"github.com/k0kubun/pp"
)
func Hosts(cidr string) ([]string, error) {
@udhos
udhos / example.json
Created March 28, 2018 20:16 — forked from filewalkwithme/example.json
Read JSON from a file, update the content and then write it to the same file again
{"hola":"mundo","number":1}