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:

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 / 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}
@udhos
udhos / go_scp.go
Created May 8, 2018 01:00 — forked from jedy/go_scp.go
an example of scp in golang
// https://blogs.oracle.com/janp/entry/how_the_scp_protocol_works
package main
import (
"fmt"
"golang.org/x/crypto/ssh"
)
const privateKey = `content of id_rsa`
@udhos
udhos / syncOnce.go
Created May 11, 2018 00:39
sync.Once
// https://golang.org/pkg/sync/#Once
package main
import (
"fmt"
"sync"
)
func main() {