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-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 / 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 / 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 / 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 / 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 / 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 / raft.go
Created July 10, 2018 17:15 — forked from F21/raft.go
Sample hashicorp/raft + hashicorp/serf app
package main
import (
"crypto/md5"
"flag"
"fmt"
"io"
"log"
"os"
"path/filepath"
@MilosSimic
MilosSimic / Dockerfile
Created June 12, 2018 10:40 — forked from michaelneu/Dockerfile
docker-compose configuration for PHP with NGINX and MySQL, including sendmail, MailDev and phpmyadmin
# see https://github.com/cmaessen/docker-php-sendmail for more information
FROM php:fpm
RUN apt-get update && apt-get install -q -y ssmtp mailutils && rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-install mysql mysqli
RUN echo "hostname=localhost.localdomain" > /etc/ssmtp/ssmtp.conf
RUN echo "[email protected]" >> /etc/ssmtp/ssmtp.conf
@MilosSimic
MilosSimic / dockerhubk8s.md
Created May 21, 2018 11:19 — forked from toddlers/dockerhubk8s.md
docker hub with kubernetes in GKE
  • Step by step how to pull a private DockerHub hosted image in a Kubernetes YML.
export DOCKER_REGISTRY_SERVER=https://index.docker.io/v1/
export DOCKER_USER=Type your dockerhub username, same as when you `docker login`
export DOCKER_EMAIL=Type your dockerhub email, same as when you `docker login`
export DOCKER_PASSWORD=Type your dockerhub pw, same as when you `docker login`
export SECRETNAME=acmeorg
@MilosSimic
MilosSimic / settings.py
Created May 10, 2018 14:44 — forked from annacruz/settings.py
Default configuration to use ELK stack with django project
LOGGING = {
'handlers': {
'logstash': {
'level': 'DEBUG',
'class': 'logstash.LogstashHandler',
'host': 'localhost',
'port': 5000, # Default port of logstash
'version': 1, # Version of logstash event schema. Default value: 0 (for backward compatibility of the library)
'message_type': 'logstash', # 'type' field in logstash message. Default value: 'logstash'.
'fqdn': False, # Fully qualified domain name. Default value: false.