Skip to content

Instantly share code, notes, and snippets.

@aladine
aladine / main.go
Created August 25, 2018 08:17
Hystrix Circuit Breaker example
package main
import (
"errors"
"fmt"
"log"
"net/http"
"os"
"github.com/afex/hystrix-go/hystrix"
@aladine
aladine / main.go
Created April 8, 2018 15:13
Golang program where time.After didn'trigger
package main
import (
"fmt"
"time"
)
func main() {
ticker := time.NewTicker(5 * time.Second)
for {
@aladine
aladine / gist:7fc263a44975112ac4a05441117f6104
Created May 25, 2016 16:39 — forked from momer/grpc_with_reconnect.go
A pattern I created to maintain connections to an RPC server in Go. Since net/rpc does not provide any methods for automatically reconnecting to an RPC server, I needed a work-around. Additionally, rpc.Client does not export any state variables (rpc.Client.shutdown and rpc.Client.closing) nor does it export the Client's Mutex. So, we wrap the rp…
package main
import (
"myapp/webserver/app/common"
"github.com/golang/glog"
"github.com/gorilla/mux"
"encoding/json"
"strconv"
"flag"
"fmt"
@aladine
aladine / git_update.bat
Created September 29, 2015 10:13
git_update
@echo off
TITLE Git Update
D:
cd D:\trunk\test
git pull origin master
pause
@aladine
aladine / cat.bat
Created September 28, 2015 01:55
Run a program with parameter
ECHO OFF
::CMD will no longer show us what command it’s executing(cleaner)
"C:\Users\Desktop\cat" developerparams
@aladine
aladine / ifconfig.bat
Created September 28, 2015 01:54
Get IP config and then ping to google.com to check internet
ECHO OFF
TITLE Ifconfig
::CMD will no longer show us what command it’s executing(cleaner)
ECHO As a network admin, I m getting tired of having to type these commands in! Hopefully, this saves me some time in the long run.
:: Print some text
IPCONFIG /ALL
:: Outputs tons of network information into the command prompt
PAUSE
:: Lets the user read the important network information
PING www.google.com
@aladine
aladine / server_start.bat
Created September 28, 2015 01:51
Start to run localhost from any folder
@echo off
TITLE Open a folder and start localhost
D:
cd "D:\Source codes"
python -m SimpleHTTPServer
::python -m SimpleHTTPServer -p 8000
@aladine
aladine / copy_to_svn.bat
Created September 28, 2015 01:49
Copy files to SVN folder
ECHO OFF
::CMD will no longer show us what command it’s executing(cleaner)
COPY /Y D:\FX\trunk\subfolder D:\trunk\subfolder
:: /Y means overwrite if there is any file exist
PAUSE
COPY /Y D:\FX\trunk\ D:\trunk\
PAUSE
@aladine
aladine / node_start.bat
Created September 28, 2015 01:45
Start a node JS process
@echo off
TITLE NodeJS Starting
D:
cd D:\trunk\test
node app.js
pause
@aladine
aladine / svn_status.bat
Last active September 28, 2015 01:45
Check SVN status of a repo
@echo off
TITLE SVN Status
D:
cd D:\trunk\test
svn st
pause