Skip to content

Instantly share code, notes, and snippets.

View arshamalh's full-sized avatar
:octocat:
This Octacat is my pet!

Mohammad Reza Karimi arshamalh

:octocat:
This Octacat is my pet!
View GitHub Profile
@arshamalh
arshamalh / docker-compose.yaml
Last active December 31, 2023 16:03
Docker compose file for Jaeger all-in-one with OpenTelemetry collector support
version: '3.8'
services:
jaeger:
image: jaegertracing/all-in-one:1.51 # At least 1.35 if you want to have enabled collector
container_name: jaeger
environment:
- COLLECTOR_ZIPKIN_HOST_PORT=:9411
- COLLECTOR_OTLP_ENABLED=true
ports: # Some ports are optional or deprecated, but we still let them be here as it's a general snippet
- "5775:5775/udp" # agent accept zipkin.thrift over compact thrift protocol (deprecated, used by legacy clients only)
@arshamalh
arshamalh / deploy.yaml
Created August 9, 2023 05:46
Ldap client deployment file for Kubernetes
kind: Deployment
apiVersion: apps/v1
metadata:
name: ldapclient
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: ldapclient
@arshamalh
arshamalh / .zshrc
Last active July 29, 2023 15:09
My .zshrc config file including tools and aliases
export PATH="/go/bin:${PATH}"
eval "$(starship init zsh)"
echo "Hi Champion! 🔥"
# cfg file would be lile username=...\n port=...\n host=...\n you can read the full version on man command or github docs
alias cvpn1="sudo openfortivpn -c ~/etc/vpn.cfg -p 'blahblah'"
alias cvpn2="sudo openconnect -u <username> <host>:<port>"
alias dub="docker-compose up --build -d"
alias ocp="oc port-forward"
@arshamalh
arshamalh / interactiveShell.go
Last active November 2, 2022 08:55
Go simple interactive shell
package main
import (
"fmt"
"time"
)
const (
msg_welcome string = `
Welcome to Dockeroller!
@arshamalh
arshamalh / Dockerfile
Last active September 21, 2023 23:11
Go and UI Multistage Dockerfile
FROM golang:1.21-alpine3.18 AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . ./
RUN CGO_ENABLED=0 GOOS=linux go build -a -o main .
FROM node:18-alpine3.15 AS frontend
WORKDIR /ui
COPY ui .
@arshamalh
arshamalh / jwt_interval.go
Created June 10, 2022 21:57
Golang JWT and intervals (using goroutines and channels)
package main
import (
"fmt"
"time"
"github.com/golang-jwt/jwt"
)
func main() {
@arshamalh
arshamalh / keybindings.json
Last active September 11, 2023 10:05
my vscode settings
// Place your key bindings in this file to override the defaultsauto[]
[
{
"key": "cmd+b",
"command": "workbench.action.terminal.clear",
"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
},
{
"key": "cmd+k",
"command": "-workbench.action.terminal.clear",
@arshamalh
arshamalh / FastAPI_boiler_plate.py
Created April 3, 2022 14:33
Boilerplate for FastAPI returning UI, CORS, routers.
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.staticfiles import StaticFiles
from routes import routes_group_1, routes_group_2
api_app = FastAPI(title="api app")
api_app.add_middleware(
CORSMiddleware,
@arshamalh
arshamalh / calculator_api_server.go
Created March 5, 2022 20:04
Simple calculator API server in Golang
package main
import (
"encoding/json"
"fmt"
"math"
"net/http"
// go get "github.com/gorilla/mux"
"github.com/gorilla/mux"
)
@arshamalh
arshamalh / making_json_with_maps.go
Created March 5, 2022 00:13
Reading and writing JSON objects in Golang
package main
import (
"encoding/json"
"fmt"
)
func main() {
myJson := map[string]interface{}{
"name": "Arsham",