Skip to content

Instantly share code, notes, and snippets.

@salrashid123
salrashid123 / squid.conf
Last active May 21, 2021 10:10
Minimal squid.conf to deny destination host
1) create a file squid.conf
```
acl denydomain dstdomain .bbc.com
http_access deny denydomain
acl allowdomain dstdomain .yahoo.com
http_access allow allowdomain
http_access deny all
@salrashid123
salrashid123 / Dockerfile
Created January 28, 2018 08:00
Dockerfile
FROM node:8.9.1 AS build-env-node
ADD . /user_code
WORKDIR /user_code
RUN npm install --save local_modules/execer
FROM microsoft/dotnet:2.0.0-sdk AS build-env-dotnet
ADD . /user_code
WORKDIR /user_code
RUN mkdir -p /user_code/lib && \
for i in `dpkg -L libc6 libcurl3 libgcc1 libgssapi-krb5-2 libicu57 liblttng-ust0 libssl1.0.2 libstdc++6 libunwind8 libuuid1 zlib1g | egrep "^/usr/lib/x86_64-linux-gnu/.*\.so\."`; do cp $i /user_code/lib; done
FROM gcr.io/distroless/dotnet
@salrashid123
salrashid123 / Program.cs
Last active January 28, 2018 08:17
Program.cs
.UseKestrel(options =>
{
try
{
for (int i = 0; i < args.Length; i++)
{
string value = args[i];
if (value == "--fds")
{
var fds = args[i+1].Split(",")[0];
@salrashid123
salrashid123 / exercc.cc
Last active January 28, 2018 08:18
exercc.cc
const char bin[] = "./bin/mainapp";
char *envp[] =
{
"LD_LIBRARY_PATH=/user_code/lib:$LD_LIBRARY_PATH",
NULL
};
execve(bin, const_cast<char* const*>(&args[0]), envp);
@salrashid123
salrashid123 / istio_doc_cluster.so
Created February 6, 2018 15:08
istio_doc_cluster
gcloud container clusters create cluster-1 \
--zone us-central1-a --enable-kubernetes-alpha \
--num-nodes 3 --scopes \
"https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring","https://www.googleapis.com/auth/trace.append","https://www.googleapis.com/auth/userinfo.email" \
--enable-cloud-logging --enable-cloud-monitoring
@salrashid123
salrashid123 / istio_install_03
Created February 6, 2018 15:09
istio_install_03
wget https://github.com/istio/istio/releases/download/0.3.0/istio-0.3.0-linux.tar.gz
cd istio-0.3.0/
kubectl create -f install/kubernetes/istio.yaml
kubectl create -f install/kubernetes/istio-initializer.yaml
kubectl create -f install/kubernetes/addons/prometheus.yaml
kubectl create -f install/kubernetes/addons/grafana.yaml
kubectl create -f install/kubernetes/addons/servicegraph.yaml
kubectl create -f install/kubernetes/addons/zipkin.yaml
@salrashid123
salrashid123 / istio.install.bas
Last active February 6, 2018 15:11
istio_install_doc
$ kubectl get no,po,deployments,svc -n istio-system
NAME STATUS ROLES AGE VERSION
no/gke-cluster-1-default-pool-94718a04-6w2f Ready <none> 1h v1.7.11-gke.1
no/gke-cluster-1-default-pool-94718a04-cphx Ready <none> 1h v1.7.11-gke.1
no/gke-cluster-1-default-pool-94718a04-lrb5 Ready <none> 1h v1.7.11-gke.1
NAME READY STATUS RESTARTS AGE
po/grafana-2369932619-dkwbc 1/1 Running 0 2m
po/istio-ca-191975193-dstl3 1/1 Running 0 2m
po/istio-ingress-3924138486-hfkx4 1/1 Running 0 2m
po/istio-initializer-2169589188-zj6mx 1/1 Running 0 2m
@salrashid123
salrashid123 / istio-forward.bas
Last active February 6, 2018 15:12
istio_forward_doc
kubectl -n istio-system port-forward $(kubectl -n istio-system get pod -l app=grafana -o jsonpath='{.items[0].metadata.name}') 3000:3000
kubectl -n istio-system port-forward $(kubectl -n istio-system get pod -l app=servicegraph -o jsonpath='{.items[0].metadata.name}') 8088:8088
kubectl port-forward -n istio-system $(kubectl get pod -n istio-system -l app=zipkin -o jsonpath='{.items[0].metadata.name}') 9411:9411
@salrashid123
salrashid123 / istio_deployment_doc.bas
Created February 6, 2018 15:13
istio_deployment_doc
$ kubectl create -f all-istio.yaml
$ kubectl get po,deployments,svc,ing
NAME READY STATUS RESTARTS AGE
po/be-v1-16151855-56kcg 2/2 Running 0 1m
po/myapp-v1-2518991625-g66kn 2/2 Running 0 1m
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
deploy/be-v1 1 1 1 1 1m
deploy/be-v2 0 0 0 0 1m
deploy/myapp-v1 1 1 1 1 1m
@salrashid123
salrashid123 / istio_docliveness.yaml
Created February 6, 2018 15:15
istio_docliveness.yaml
- containerPort: 8080
livenessProbe:
httpGet:
path: /_ah/health
port: 8080
initialDelaySeconds: 30
timeoutSeconds: 1