Skip to content

Instantly share code, notes, and snippets.

@d4z3x
d4z3x / sshclient.go
Created February 24, 2024 19:30 — forked from Mebus/sshclient.go
Golang SSH Client
package main
import (
"bufio"
"io/ioutil"
"os/signal"
//"syscall"
"fmt"
"log"
"os"
@d4z3x
d4z3x / auto-cert-reload.go
Created November 21, 2023 06:49 — forked from KaiserWerk/auto-cert-reload.go
Golang: Automatic TLS Certificate Reload
package main
import (
"crypto/tls"
"fmt"
"io"
"net/http"
)
func main() {
@pmarreck
pmarreck / split_file.bash
Last active December 5, 2023 02:00
Split a text file into a directory of files each of which contains 1 line from the original file
#!/usr/bin/env bash
# Ensure a file name is provided
if [ -z "$1" ]
then
echo "No file name provided. Usage: ./split_file.bash <filename>"
exit 1
fi
# Extract the directory and base name from the file
@FZambia
FZambia / main.go
Last active August 15, 2023 04:36
Experimenting with QUIC and WebTransport in Go, see original post: https://centrifugal.github.io/centrifugo/blog/quic_web_transport/
package main
import (
"context"
"crypto/tls"
"encoding/binary"
"errors"
"io"
"log"
"net/url"
@miguelmota
miguelmota / rsa_util.go
Last active September 27, 2024 02:42
Golang RSA encrypt and decrypt example
package ciphers
import (
"crypto/rand"
"crypto/rsa"
"crypto/sha512"
"crypto/x509"
"encoding/pem"
"log"
)
@simoncos
simoncos / golang_on_rpi.md
Last active March 30, 2024 17:56 — forked from konradko/golang_on_rpi.md
Install Golang 1.9 on Raspberry Pi

Install Golang 1.9:

wget https://storage.googleapis.com/golang/go1.9.linux-armv6l.tar.gz
sudo tar -C /usr/local -xzf go1.9.linux-armv6l.tar.gz
export PATH=$PATH:/usr/local/go/bin # put into ~/.profile

If already installed old golang with apt-get:

@flaviocopes
flaviocopes / go-sort-map.go
Last active December 25, 2023 21:03
Go: sort a Map by key #golang
import "sort"
ages := map[string]int{
"a": 1,
"c": 3,
"d": 4,
"b": 2,
}
names := make([]string, 0, len(ages))
@Mebus
Mebus / sshclient.go
Created May 11, 2017 17:07 — forked from josephspurrier/sshclient.go
Golang SSH Client
package main
import (
"bufio"
"io/ioutil"
"os/signal"
//"syscall"
"fmt"
"log"
"os"
@lenage
lenage / fnv_example.go
Created March 31, 2017 01:55
golang fnv example
package main
import (
"bufio"
"fmt"
"hash/fnv"
"io"
"os"
)
@alex-ant
alex-ant / gzip.go
Created January 16, 2017 13:50
golang: gzip and gunzip
package main
import (
"bytes"
"compress/gzip"
"fmt"
"io"
"log"
)