Skip to content

Instantly share code, notes, and snippets.

View syahrul12345's full-sized avatar

Muhammad Syahrul Nizam syahrul12345

  • Crypto.com
  • Singapore
View GitHub Profile
@syahrul12345
syahrul12345 / rpc-http-proxy
Last active September 22, 2023 06:36
rpc-http-proxy
server {
listen 69;
location / {
proxy_pass http://localhost:8545; # The address of the app you are proxying to
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
# Basic Authentication
auth_basic "Restricted Content";
@syahrul12345
syahrul12345 / rpc-ws-proxy
Last active September 22, 2023 06:38
rpc-ws-proxy
server {
listen 96;
location / {
proxy_pass http://localhost:8545; # The address of the app you are proxying to
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
# Basic Authentication
auth_basic "Restricted Content";
@syahrul12345
syahrul12345 / setup.sh
Created November 29, 2019 14:45
Quickly set up ubuntu server
sudo apt-get update
sudo apt-get install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
mkdir ./.config
git clone https://github.com/syahrul12345/neovim ${HOME}/.config/nvim
mv ${HOME}/.config/neovim ${HOME}/.config/nvim
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
@syahrul12345
syahrul12345 / main.go
Created November 3, 2019 02:13
Daemonize a go process
package main
import (
"fmt"
"log"
"net/http"
"os"
"path/filepath"
"github.com/gorilla/mux"
@syahrul12345
syahrul12345 / utils.go
Created November 2, 2019 14:10
Lightweight utils module to send back response to client
package utils
import (
"encoding/json"
"net/http"
)
//Message outputs the message to be sent to the client
func Message(status bool, message string) map[string]interface{} {
return map[string]interface{}{
@syahrul12345
syahrul12345 / nginx.sh
Last active November 27, 2019 10:13
Script to quickly configure a subdomain in nginx along with ssl certificate
#name of the domain by the user
echo Please enter the domain name, without 'www'
read domain
echo The Doamin is $domain
echo Please enter the port where the website will be served:
read port
echo The website will be served at $domain:$port
# Next lets create the appropraite file
sudo touch /etc/nginx/sites-available/$domain
@syahrul12345
syahrul12345 / app.go
Created October 7, 2019 06:33
JWT token authentication
package app
import (
"backend/models"
"backend/utils"
"context"
"fmt"
"net/http"
"os"
"strings"
@syahrul12345
syahrul12345 / main.go
Created October 7, 2019 06:33
Golang mux server multple page app support
router.PathPrefix("/").Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
const staticPath = "../dist"
const indexPath = "index.html"
fileServer := http.FileServer(http.Dir(staticPath))
path, err := filepath.Abs(r.URL.Path)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
path = filepath.Join(staticPath, path)
### Keybase proof
I hereby claim:
* I am syahrul12345 on github.
* I am syahrulnizam (https://keybase.io/syahrulnizam) on keybase.
* I have a public key ASC3i7NEcX-WjBZUVooDRm99iq8AIl7m6WQ1mQdCzjf88wo
To claim this, I am signing this object:
0x998823c4d9676E33c0DD3599DbceF2d8B31B1c86