Skip to content

Instantly share code, notes, and snippets.

View BlackMetalz's full-sized avatar
🎯
Focusing

Luong Trung Kien BlackMetalz

🎯
Focusing
View GitHub Profile
#!/bin/bash
# Variables
VM_VERSION="v1.113.0"
VM_TAR="victoria-metrics-linux-amd64-${VM_VERSION}-cluster.tar.gz"
VM_UTILS_TAR="vmutils-linux-amd64-${VM_VERSION}.tar.gz"
VM_URL="https://github.com/VictoriaMetrics/VictoriaMetrics/releases/download/${VM_VERSION}/${VM_TAR}"
VM_UTILS_URL="https://github.com/VictoriaMetrics/VictoriaMetrics/releases/download/${VM_VERSION}/${VM_UTILS_TAR}"
INSTALL_DIR="/opt/victoriametrics"
STORAGE_DIR="/data/vmstorage"
@BlackMetalz
BlackMetalz / failed-deployment.yaml
Created February 16, 2025 12:47
Insecure deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: insecure-app
labels:
app: insecure-app
spec:
replicas: 1
selector:
matchLabels:
@BlackMetalz
BlackMetalz / deployment.yaml
Created February 16, 2025 12:44
Passed deployment kubesec
---
# Source: golang-webapp-testing/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: release-name-golang-webapp-testing
labels:
helm.sh/chart: golang-webapp-testing-0.1.0
app.kubernetes.io/name: golang-webapp-testing
app.kubernetes.io/instance: release-name
@BlackMetalz
BlackMetalz / main.go
Created February 8, 2025 03:44
Sample code contains secret.
package main
import (
"fmt"
"log"
)
const (
// AWS credentials
AWS_ACCESS_KEY = "AKIA4XXXXXXXXXXXXXXXXX"
@BlackMetalz
BlackMetalz / gist:40cae2899654a70f438026f0523bd6ad
Created September 29, 2024 04:36
Test with Redis Sentinel Only
root@kienlt-redis-sentinel-1:~# redis-cli -p 6800 -a 123123 info replication|head -n3
# Replication
role:master
connected_slaves:1
root@kienlt-redis-sentinel-2:~# redis-cli -p 6800 -a 123123 info replication|head -n 3
# Replication
role:slave
master_host:10.0.0.10
==> Shutdown server 10.0.0.10
[16:42:35] Success: 10, Failure: 0
@BlackMetalz
BlackMetalz / gist:94bfa44c29027a130bb5ba59f3a4f074
Created September 29, 2024 04:30
Test with Redis Sentinel + HA + DNS with simple python application
kienlt@ubuntu22-desktop:/data/test$ python3 redis_benchmark1.py
[15:17:36] Success: 10, Failure: 0
[15:17:41] Success: 10, Failure: 0
[15:17:46] Success: 10, Failure: 0
[15:17:51] Success: 10, Failure: 0
[15:17:56] Success: 10, Failure: 0
[15:18:01] Success: 10, Failure: 0
[15:18:07] Success: 10, Failure: 0
[15:18:12] Success: 10, Failure: 0
[15:18:17] Success: 10, Failure: 0
@BlackMetalz
BlackMetalz / sentinelNotification.py
Created September 29, 2024 03:55
Sentinel notification script. Idea of mine, code powered by Copilot xD
#!/usr/bin/python3
import requests
import sys
import socket
def send_telegram_message(bot_token, chat_id, message):
url = f"https://api.telegram.org/bot{bot_token}/sendMessage"
payload = {
'chat_id': chat_id,
'text': message,
// Spark of Zandalar - 138957
class spell_item_proc_charges_for_strength_transform : public SpellScriptLoader
{
public:
spell_item_proc_charges_for_strength_transform() : SpellScriptLoader("spell_item_proc_charges_for_strength_transform") { }
enum SparkOfZandalar
{
SPARK_OF_ZANDALAR = 138958,
ZANDALARI_WARRIOR = 138960,
@BlackMetalz
BlackMetalz / laravel_subfolder_nginx_conf
Created August 15, 2020 04:51
Laravel and wordpress config in same site
server {
listen 80;
server_name blackcms.local;
root /var/www/wordpress;
index index.php index.html index.htm;
client_max_body_size 200m;
access_log /var/log/nginx/app_access.log;