Skip to content

Instantly share code, notes, and snippets.

@eegrok
eegrok / iptables-forward.info
Created May 6, 2011 00:18
forward traffic with iptables
# from http://www.debuntu.org/how-to-redirecting-network-traffic-a-new-ip-using-iptables
# enable ip forwarding until reboot
echo 1 > /proc/sys/net/ipv4/ip_forward
# enable ip forwarding after reboot
# edit /etc/sysctl.conf
# uncomment line: #net.ipv4.ip_forward=1
$.fn.spin = function() {
var opts = {lines: 12, length: 5, width: 3, radius: 10, color: '#333', speed: 1, trail: 52, shadow: false};
this.each(function() {
var spinner = $(this).data('spinner');
if (spinner) spinner.stop();
if (opts !== false) {
$(this).data('spinner', new Spinner(opts).spin(this));
}
});
return this;
@jmoiron
jmoiron / 01-curl.go
Last active October 19, 2024 11:28
io.Reader & io.Writer fun
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func init() {
@apokalyptik
apokalyptik / decrypt.go
Created September 1, 2014 22:36
Go RSA private key decryption example. Compatible with data encrypted via http://us3.php.net/openssl_public_encrypt
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"flag"
"fmt"
"io/ioutil"
@avelino
avelino / GzipStream.go
Last active April 6, 2023 11:13
golang gzip stream
func GetGzip(path string) string {
println(path)
client := &http.Client{
Transport: &transport.Transport{
ReadTimeout: 10 * time.Second,
RequestTimeout: 15 * time.Second,
},
}
@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"
)
@lenage
lenage / fnv_example.go
Created March 31, 2017 01:55
golang fnv example
package main
import (
"bufio"
"fmt"
"hash/fnv"
"io"
"os"
)
@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"
@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))
@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: