Skip to content

Instantly share code, notes, and snippets.

View sivsivsree's full-sized avatar
👨‍💻
Focusing on Team building

Siv S sivsivsree

👨‍💻
Focusing on Team building
View GitHub Profile
@sivsivsree
sivsivsree / sse.go
Created December 30, 2019 10:41 — forked from ismasan/sse.go
Example SSE server in Golang
// Copyright (c) 2017 Ismael Celis
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
#!/bin/bash
if [ -z $SUDO_USER ]
then
echo "===== Script need to be executed with sudo ===="
exit 0
fi
echo "=======Set up go======"
sudo apt-get update
sudo apt-get -y install golang-1.10-go
#!/bin/bash
#https://github.com/chaifeng/bento-ubuntu-docker/blob/master/Vagrantfile-bento
if [ -z $SUDO_USER ]
then
echo "===== Script need to be executed with sudo ===="
echo "Change directory to 'setup'"
echo "Usage: sudo ./docker.sh"
exit 0
fi
FROM golang:1.12
ENV GO111MODULE=on
LABEL maintainer="Siv S <[email protected]>"
RUN apt-get -qq update \
&& apt-get install -y \
some-library \
external-lib
@sivsivsree
sivsivsree / default
Created June 18, 2019 15:34
Nginx Upstream and Routing
upstream s {
server 127.0.0.1:3000;
}
upstream backend {
server 127.0.0.1:5051;
}
server {
listen 80;
listen [::]:80 ipv6only=on default_server;
@sivsivsree
sivsivsree / go-executable-build.sh
Created May 19, 2019 14:42 — forked from DimaKoz/go-executable-build.sh
The Script to Automate Cross-Compilation for Golang(OSX)
#Before we can use the script, we have to make it executable with the chmod command:
#chmod +x ./go-executable-build.sh
#then we can use it ./go-executable-build.sh yourpackage
#!/usr/bin/env bash
package=$1
if [[ -z "$package" ]]; then
echo "usage: $0 <package-name>"
exit 1
fi
@sivsivsree
sivsivsree / predict_linear.py
Created May 13, 2019 08:45
Predict y = 5 ( x +1 )
import tensorflow as tf
import numpy as np
from tensorflow import keras
model = keras.Sequential([keras.layers.Dense(units=1, input_shape=[1])])
model.compile(optimizer='sgd', loss='mean_squared_error')
xs = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0], dtype=float)
ys = np.array([5.0,10.0,15.0,20.0,25.0,30.0, 35.0, 40.0, 45.0,50.0], dtype=float)
@sivsivsree
sivsivsree / ssl-certs.md
Created April 18, 2019 17:23 — forked from Eng-Fouad/ssl-certs.md
Generate self-signed PKCS#12 SSL certificate and export its keys using Java keytool and openssl.

Steps to generate self-signed PKCS#12 SSL certificate and export its keys:

1- Create PKCS#12 keystore (.p12 or .pfx file)

keytool -genkeypair -keystore myKeystore.p12 -storetype PKCS12 -storepass MY_PASSWORD -alias KEYSTORE_ENTRY -keyalg RSA -keysize 2048 -validity 99999 -dname "CN=My SSL Certificate, OU=My Team, O=My Company, L=My City, ST=My State, C=SA" -ext san=dns:mydomain.com,dns:localhost,ip:127.0.0.1
  • myKeystore.p12 = keystore filename. It can with .pfx extension as well.
  • MY_PASSWORD = password used for the keystore and the private key as well.
  • CN = commonName, it will be shown as certiciate name in certificates list.
  • OU = organizationUnit, department name for example.
@sivsivsree
sivsivsree / contribute.txt
Last active March 9, 2019 08:58
Github Projects with readable readme will be listed in here.
https://github.com/sivsivsree/api-template
Nodejs backend template. Improvements needed in abstracting the boiler template.
$ sudo apt-get update
$ sudo apt-get install nginx
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;