Skip to content

Instantly share code, notes, and snippets.

View muhammad-asn's full-sized avatar
🎯
Focusing

Muhammad Ardivan muhammad-asn

🎯
Focusing
View GitHub Profile
@muhammad-asn
muhammad-asn / debug-cloudbuild-cicd.md
Last active February 25, 2023 09:42
Secure Reverse-Shell for debug Cloudbuild CI/CD

Motivation

When attempting to debug an issue, it can be challenging to reproduce the problem on the machine used in the CI/CD process, especially if it is different from the local development environment. Because there is no direct access to the runner machine in cloudbuild, there is alternative way by applying the reverse-shell method that allows gaining access to the CI/CD environment.

Note: Establishing a reverse shell should only be done for the purpose of debugging and testing and not to be misused.

On client (can be accessed from public)

$ sudo apt-get install rlwrap # readline wrapper for nice tty
@lukeplausin
lukeplausin / transfer_ssm_file.sh
Last active May 6, 2025 05:58
Transfer a file to EC2 SSM instance without using S3 (SSM only)
# This script will explain how to transfer a file to EC2 using SSM ONLY!
# You will need to have permission to run SSM commands on the target machine and have sudo access as well
# Infos
INSTANCE_ID=i-1234567890
FILE_NAME=the_file.tar.gz
# Step 1: Run command on machine to install netcat and dump from port to filename
# < Start session
@r0mdau
r0mdau / README.md
Last active January 19, 2025 22:05
Rust Actix vs Rust Hyper vs Go fasthttp vs Go net/http httprouter

Load tests

Injector

wrk is the binary used as injector, always used with these options:

./wrk -t12 -c1000 -d15s http://127.0.0.1:8080/

Results

@zapisnicar
zapisnicar / telegram_bot.md
Last active April 29, 2025 08:18
How to create Telegram bot and send messages to group

How to create Telegram Bot and send messages to your group

  1. Create Telegram bot:

    Search for user @BotFather in Telegram app. Type /help in BotFather chat and wait for the reply. Type in the chat:

    /newbot

or select /newbot command from Help text. Answer few setup questions:

@petrbouda
petrbouda / memory-limit-request-jvm.md
Last active April 30, 2025 18:04
Memory LIMIT and REQUEST in Containers and JVM

Memory LIMIT and REQUEST in Containers and JVM

  • Do you run a JVM inside a container on Kubernetes (or maybe OpenShift)?
  • Do you struggle with REQUEST and LIMIT parameters?
  • Do you know the impact of those parameters on your JVM?
  • Have you met OOM Killer?

Hope you will find answers to these questions in this example-based article.

How to set up JVM Heap size in a Container

@fortejas
fortejas / Dockerfile
Last active April 13, 2022 08:34
Python script to catch the Docker SIGTERM signal
FROM python:3-onbuild
EXPOSE 8000
CMD ["./server.py"]
@max-rocket-internet
max-rocket-internet / prom-k8s-request-limits.md
Last active May 1, 2025 05:24
How to display Kubernetes request and limit in Grafana / Prometheus properly

CPU: percentage of limit

A lot of people land when trying to find out how to calculate CPU usage metric correctly in prometheus, myself included! So I'll post what I eventually ended up using as I think it's still a little difficult trying to tie together all the snippets of info here and elsewhere.

This is specific to k8s and containers that have CPU limits set.

To show CPU usage as a percentage of the limit given to the container, this is the Prometheus query we used to create nice graphs in Grafana:

sum(rate(container_cpu_usage_seconds_total{name!~".*prometheus.*", image!="", container_name!="POD"}[5m])) by (pod_name, container_name) /
@q7r
q7r / gist:d21b52e7342f2ece1e50871bff6bae85
Created March 19, 2018 07:42
curl_loop_status_code
while true; sleep 1; do curl -I --silent http://nginx1.k8s.ubox.one | grep HTTP; done
@Alex-D
Alex-D / test-commit.sh
Last active April 4, 2022 02:23
Check commits sticks to Git Karma commit
# http://karma-runner.github.io/1.0/dev/git-commit-msg.html
bash -c "! git log -100 --pretty=format:%s | egrep --color=auto -v '^(((feat|fix|docs|style|refactor|test|chore)(\(\w+\))?:\s)|Merge).*'"