Skip to content

Instantly share code, notes, and snippets.

View ramitsurana's full-sized avatar

Ramit Surana ramitsurana

View GitHub Profile
@ramitsurana
ramitsurana / frontend-ws-connection.ts
Created April 23, 2023 16:44 — forked from jsdevtom/frontend-ws-connection.ts
kubernetes-ingress websockets with nodejs
export const ws = webSocket<WebsocketMessage>(`wss://${location.hostname}:${location.protocol === 'https:' ? 443 : 80}/ws/`);
export const wsObserver = ws
.pipe(
retryWhen(errors =>
errors.pipe(
delay(1000)
)
)
);
@ramitsurana
ramitsurana / tree.py
Last active March 25, 2018 13:49
Tree Description and Nodes Formation
from anytree import Node, RenderTree
import json
parent_node = Node('/')
print ("$ <Starting your application....>")
def get_input(input_cmd = input("$")):
#find length of input command. if length is 1 -> ls, pwd; if length = 2 cd </home/user>, makdir qwerty
length = len(input_cmd.split())
@ramitsurana
ramitsurana / default.toml
Last active January 16, 2018 08:59
Habitat sample files
# Default.toml
port = 8090
important_message = 'RUN NOW!!'
@ramitsurana
ramitsurana / jenkins-aws-docker.sh
Last active March 27, 2018 16:15
Setting up jenkins,docker and git pipeline
## Install Jenkins
$ sudo yum update
$ sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
$ sudo rpm --import http://pkg.jenkins-ci.org/redhat-stable/jenkins-ci.org.key
$ sudo yum install jenkins
$ sudo service jenkins start
$ sudo chkconfig jenkins on
## Install Docker (Amazon EC2 Container Service)
wget https://github.com/GoogleCloudPlatform/kubernetes/releases/download/v1.3.0/kubernetes.tar.gz
tar xvf kubernetes
cd kubernetes/cluster/ubuntu
./download-release.sh
# The above steps will install binaries under the ubuntu directory
# You can check it under binaries directory
vim config-default.sh
#Please change the following entries
@ramitsurana
ramitsurana / check.go
Created July 28, 2016 16:40 — forked from mattes/check.go
Check if file or directory exists in Golang
if _, err := os.Stat("/path/to/whatever"); os.IsNotExist(err) {
// path/to/whatever does not exist
}
if _, err := os.Stat("/path/to/whatever"); err == nil {
// path/to/whatever exists
}
@ramitsurana
ramitsurana / README.md
Created July 20, 2016 12:18 — forked from dnozay/_Jenkins+Script+Console.md
jenkins groovy scripts collection.
@ramitsurana
ramitsurana / k8s-setup-minikube
Last active August 2, 2016 14:27
Steps to download and configure minikube Kubernetes on ubuntu
# Ensure Installation of kubectl first
# Visit for http://kubernetes.io/docs/getting-started-guides/binary_release/
# For downloading any prerequisites
# Visit https://github.com/kubernetes/minikube/blob/master/DRIVERS.md
# Download & install Minikube
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.7.1/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
@ramitsurana
ramitsurana / aci-setup
Created July 8, 2016 17:10
Steps to setup aci
# Installation steps for using aci
# Download the tar file
wget https://github.com/appc/acbuild/releases/download/v0.3.1/acbuild-v0.3.1.tar.gz
# Untar the file
tar xvf acbuild-v0.3.1.tar.gz
alias acbuild="sudo '${PWD}/acbuild-v0.3.1/acbuild'"
@ramitsurana
ramitsurana / aci-build.sh
Last active July 8, 2016 18:51
Steps to build an aci image using acbuild utility
# Steps to build an apache aci image using acbuild utility
# Based on alpine
acbuild --debug dep add quay.io/coreos/alpine-sh
# Install apache
acbuild --debug run -- apk update
acbuild --debug run -- apk add apache2
acbuild --debug run -- /bin/sh -c "echo 'ServerName localhost' >> /etc/apache2/httpd.conf"