Skip to content

Instantly share code, notes, and snippets.

@mosfet1kg
mosfet1kg / config.lua
Created September 26, 2023 07:57 — forked from un-def/config.lua
nginx lua balancer example
return {
servers = {
foo = {'127.0.0.1', 9001},
bar = {'127.0.0.1', 9002},
baz = {'127.0.0.1', 9003},
}
}
@mosfet1kg
mosfet1kg / tcp_flags.txt
Created January 19, 2021 05:41 — forked from tuxfight3r/tcp_flags.txt
tcpdump - reading tcp flags
##TCP FLAGS##
Unskilled Attackers Pester Real Security Folks
==============================================
TCPDUMP FLAGS
Unskilled = URG = (Not Displayed in Flag Field, Displayed elsewhere)
Attackers = ACK = (Not Displayed in Flag Field, Displayed elsewhere)
Pester = PSH = [P] (Push Data)
Real = RST = [R] (Reset Connection)
Security = SYN = [S] (Start Connection)
@mosfet1kg
mosfet1kg / tcp_flags.txt
Created January 19, 2021 05:41 — forked from tuxfight3r/tcp_flags.txt
tcpdump - reading tcp flags
##TCP FLAGS##
Unskilled Attackers Pester Real Security Folks
==============================================
TCPDUMP FLAGS
Unskilled = URG = (Not Displayed in Flag Field, Displayed elsewhere)
Attackers = ACK = (Not Displayed in Flag Field, Displayed elsewhere)
Pester = PSH = [P] (Push Data)
Real = RST = [R] (Reset Connection)
Security = SYN = [S] (Start Connection)
@mosfet1kg
mosfet1kg / diskusage.go
Created January 16, 2021 12:03 — forked from alwqx/diskusage.go
calculate disk usage in golang (Linux only) by parse output of command `df`
import(
"fmt"
"strconv"
"strings"
"os/exec"
"log"
)
func main() {
out, _ := exec.Command("df", "-P").Output()
URL="http://stackoverflow.com/"
# store the whole response with the status at the and
HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -X POST $URL)
# extract the body
HTTP_BODY=$(echo $HTTP_RESPONSE | sed -e 's/HTTPSTATUS\:.*//g')
# extract the status
HTTP_STATUS=$(echo $HTTP_RESPONSE | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')
@mosfet1kg
mosfet1kg / jwtRS256.sh
Created January 8, 2021 03:16 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@mosfet1kg
mosfet1kg / main.go
Created December 7, 2020 13:37 — forked from magiconair/main.go
prometheus counter example
package main
import (
"net/http"
"github.com/prometheus/client_golang/prometheus"
)
var (
cpuTemp = prometheus.NewGauge(prometheus.GaugeOpts{
---
marp: true
#theme: uncover
paginate: true
footer: '![](./image/nbp.png)'
---
<!-- _paginate: false -->
<!-- _theme: uncover -->
# <!--fit--> 개발환경 세팅
@mosfet1kg
mosfet1kg / k8s-svc-annotations.md
Created January 30, 2019 05:40 — forked from mgoodness/k8s-svc-annotations.md
AWS ELB-related annotations for Kubernetes Services (as of v1.12.0)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-emit-interval (in minutes)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-enabled (true|false)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-name
  • service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-prefix
  • service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags (comma-separated list of key=value)
  • service.beta.kubernetes.io/aws-load-balancer-backend-protocol (http|https|ssl|tcp)
  • service.beta.kubernetes.io/aws-load-balancer-connection-draining-enabled (true|false)
@mosfet1kg
mosfet1kg / haproxy.sh
Created March 15, 2018 14:59 — forked from trungv0/haproxy.sh
RabbitMQ cluster with HAProxy & Keepalived for high availability
# install haproxy
yum install -y haproxy
# config haproxy for rabbitmq
cat > /etc/haproxy/haproxy.cfg << "EOF"
global
log 127.0.0.1 local0 notice
maxconn 10000
user haproxy