Skip to content

Instantly share code, notes, and snippets.

View MilosSimic's full-sized avatar

Milos MilosSimic

  • Faculty of technical sciences Novi Sad
  • Novi Sad
View GitHub Profile
@MilosSimic
MilosSimic / golang_contextWithTimeout.go
Created September 11, 2018 11:59 — forked from wiredprairie/golang_contextWithTimeout.go
Golang context.WithTimeout Demo
package main
import (
"context"
"fmt"
"time"
)
func main() {
wait := make(chan bool)
@MilosSimic
MilosSimic / ftp_uploader.py
Created September 24, 2018 09:41 — forked from opnchaudhary/ftp_uploader.py
A sample example for uploading files using ftp in python
#!/usr/bin/python
import ftplib
session = ftplib.FTP('example.com','username','password')
file = open('cup.mp4','rb') # file to send
session.storbinary('STOR '+'cup.mp4', file) # send the file
file.close() # close file and FTP
session.quit()
@MilosSimic
MilosSimic / setup-kubernetes-ubuntu-16.md
Created September 26, 2018 18:39 — forked from ruanbekker/setup-kubernetes-ubuntu-16.md
Install a 3 Node Kubernetes Cluster on Ubuntu 16

Master: Dependencies

apt update && apt upgrade -y
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

cat <<EOF > /etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
@MilosSimic
MilosSimic / client.go
Created October 2, 2018 17:04 — forked from jzelinskie/client.go
grpc bidirectional streams in golang
package main
import (
"log"
"time"
"golang.org/x/net/context"
"google.golang.org/grpc"
pb "github.com/jzelinskie/grpc/simple"
@MilosSimic
MilosSimic / nginxproxy.md
Created October 10, 2018 13:53 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@MilosSimic
MilosSimic / golang-tls.md
Created November 5, 2018 23:01 — forked from 6174/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048
    
# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
openssl ecparam -genkey -name secp384r1 -out server.key
@MilosSimic
MilosSimic / open_mmap_adv.go
Created December 17, 2018 13:33 — forked from ryochack/open_mmap_adv.go
open/read vs open/mmap vs open/bufio.read on golang. syscall.Madvise() is unsupported darwin.
package main
import (
"fmt"
"log"
"os"
"syscall"
)
func main() {
@MilosSimic
MilosSimic / README.md
Created December 17, 2018 13:35 — forked from suyash/README.md
mmap examples

identical mmap programs in C and go

@MilosSimic
MilosSimic / fnv_example.go
Created January 21, 2019 16:06 — forked from lenage/fnv_example.go
golang fnv example
package main
import (
"bufio"
"fmt"
"hash/fnv"
"io"
"os"
)
package main
import (
"net"
"strings"
"fmt"
)
func handleConnection(conn net.Conn) {
// try to read data from the connection