Skip to content

Instantly share code, notes, and snippets.

View yohangdev's full-sized avatar
🏠
Working from home

Yoga Hanggara yohangdev

🏠
Working from home
View GitHub Profile
@yohangdev
yohangdev / aws-s3-bulk-metadata.sh
Created February 19, 2024 16:40
AWS S3 Bulk Update Metadata using Command Line (CLI)
aws s3 cp \
s3://bucket/path/ \
s3://bucket/path/ \
--exclude '*' \
--include '*.png' \
--no-guess-mime-type \
--content-type="image/png" \
--metadata-directive="REPLACE" \
--recursive
@yohangdev
yohangdev / xdebug-mac.md
Created October 14, 2023 11:11 — forked from ankurk91/xdebug-mac.md
php xDebug v3 on Ubuntu/Mac and phpStorm

🪲 Install and Configure xDebug v3 on MacOS for PhpStorm 🐘

  • Assuming that you have already installed php and apache via Homebrew

  • Install xDebug php extension

pecl channel-update pecl.php.net
pecl clear-cache

pecl install xdebug
@yohangdev
yohangdev / download_playlist.sh
Created May 28, 2022 03:03
Youtube Downloader Batch (Also Convert)
yt-dlp --download-archive archive.txt --no-abort-on-error --exec "ffmpeg -i {} -target pal-dvd -q:v 20 -aspect 16:9 -y {}.mpg && rm {}" https://www.youtube.com/playlist?list=xxxx
@yohangdev
yohangdev / benchmark.sh
Created December 27, 2021 13:46
CLI commands for benchmarking linux servers
# https://bench.sh
curl -Lso- bench.sh | bash
# https://github.com/masonr/yet-another-bench-script
curl -sL yabs.sh | bash
# Ref
# https://repo.telematika.org/project/haydenjames_bench-scripts/
@yohangdev
yohangdev / helpful-docker-commands.sh
Created October 17, 2021 11:06 — forked from garystafford/helpful-docker-commands.sh
My list of helpful docker commands
###############################################################################
# Helpful Docker commands and code snippets
###############################################################################
### CONTAINERS ###
docker stop $(docker ps -a -q) #stop ALL containers
docker rm -f $(docker ps -a -q) # remove ALL containers
docker rm -f $(sudo docker ps --before="container_id_here" -q) # can also filter
# exec into container
@yohangdev
yohangdev / jcc-openapi-spec.yaml
Last active April 6, 2022 05:31
Jabar Coding Camp - Backend Challenge - API Specification
swagger: "2.0"
info:
description: "Ini adalah dokumentasi API Specification untuk challenge Get Nearby Places."
version: "1.0.0"
title: "Get Nearby Places"
host: "localhost:8000"
schemes:
- "http"
- "https"
paths:
@yohangdev
yohangdev / delete-evicted-pods-all-namespaces.sh
Last active December 26, 2021 15:49
Delete evicted pods from all namespaces (also ImagePullBackOff and ErrImagePull)
#!/bin/sh
# based on https://gist.github.com/ipedrazas/9c622404fb41f2343a0db85b3821275d
# https://github.com/kubernetes/kubernetes/issues/55051
# delete all evicted pods from all namespaces
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
# delete all stuck shutdown
kubectl get pods --all-namespaces | grep Shutdown | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
@yohangdev
yohangdev / BlastTemplate.txt
Last active July 11, 2021 16:27
AWS Lambda (Python 3.8 runtime) for bulk processing CSV file, processing message template with dynamic variables, then push message to AWS SQS
Hello {param1}
This is your invoice number {param2}
Total cost: {param3}
@yohangdev
yohangdev / datadog.sh
Created May 19, 2021 17:20
Datadog Cheatsheet
# Docker
docker run -d -v /var/run/docker.sock:/var/run/docker.sock:ro -v /proc/:/host/proc/:ro -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro -p 8126:8126 -e DD_API_KEY=XXX datadog/agent:latest
docker run -p 8080:8080 -e APP_KEY="base64:DehW3/DSAR0r4R+tEOuT8MUw/br98yVdOWHbaVh/qsk=" --rm -it -e CONTAINER_ROLE=app -e DD_AGENT_HOST=172.17.0.3 -e DD_SERVICE=test-service -e DD_ENV=production -e DD_VERSION=1.0.0 micro-datadog
# Kubernetes
# https://docs.datadoghq.com/agent/kubernetes/?tab=helm
helm install datadog-agent -f values.yaml datadog/datadog --set datadog.apiKey=XXX --set targetSystem=linux
@yohangdev
yohangdev / Dockerfile
Created May 7, 2021 16:54
Dockerfile PHP 8 & Newrelic Agent
FROM alpine:3.13
LABEL Maintainer="Yoga Hanggara <yohang88@gmail.com>" \
Description="Lightweight Laravel app container with Nginx 1.18 & PHP-FPM 8 based on Alpine Linux."
ARG PHP_VERSION="8.0.2-r0"
# Install packages
RUN apk --no-cache add php8=${PHP_VERSION} php8-fpm php8-opcache php8-openssl php8-curl php8-phar php8-session \
php8-fileinfo php8-pdo php8-pdo_mysql php8-mysqli php8-mbstring php8-dom \