Skip to content

Instantly share code, notes, and snippets.

@pathcl
pathcl / docker-exec-ecs.sh
Created Jun 2, 2022 — forked from ipmb/docker-exec-ecs.sh
docker exec on AWS ECS with SSM
View docker-exec-ecs.sh
#!/bin/bash
# USAGE: CLUSTER=mycluster SERVICE=myservice ./docker-exec-ecs.sh
set -euf -o pipefail
TASK_ARN=$(aws ecs list-tasks --cluster=$CLUSTER --service=$SERVICE \
| jq -r .taskArns[0])
if [ "$TASK_ARN" = "null" ]; then
echo "Could not find any running tasks for $SERVICE on cluster:$CLUSTER."
exit 1
fi
@pathcl
pathcl / firewall.py
Last active Nov 7, 2021
Basic firewall on nftables && share internet
View firewall.py
#!/usr/bin/env python3
import argparse
import nftables
import json
from string import Template
def main(wan, lan):
'''
USE AT YOUR OWN RISK :)
@pathcl
pathcl / firewall.sh
Last active Nov 7, 2021
Basic firewall on nftables && share internet
View firewall.sh
#!/bin/bash
# executable for nftables
nft="/usr/sbin/nft"
# wan and lan ports
wan=$1
lan=$2
# check empty arguments
@pathcl
pathcl / latency.txt
Created Jun 23, 2021 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
View latency.txt
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@pathcl
pathcl / keybase.md
Last active Jul 12, 2021
keybase.md
View keybase.md

Keybase proof

I hereby claim:

  • I am pathcl on github.
  • I am pathcl (https://keybase.io/pathcl) on keybase.
  • I have a public key whose fingerprint is 3B68 1ED7 2997 AAD5 DFAF 2BCC 9ABD D154 5BBF 93A8

To claim this, I am signing this object:

@pathcl
pathcl / tail.py
Created Jan 6, 2021 — forked from amitsaha/tail.py
Simple implementation of the tail command in Python
View tail.py
'''
Basic tail command implementation
Usage:
tail.py filename numlines
'''
import sys
import linecache
@pathcl
pathcl / rabbitmq-cluster.md
Created Dec 20, 2020 — forked from pobsuwan/rabbitmq-cluster.md
How to config rabbitmq server cluster [3 nodes]
View rabbitmq-cluster.md

How to config rabbitmq server cluster [3 nodes]

Edit /etc/hosts

vi /etc/hosts
192.168.10.157  rabbitmq-1
192.168.10.159  rabbitmq-2
192.168.10.161  rabbitmq-3
View test.tf
provider "rabbitmq" {
endpoint = "https://someotherendpoint"
alias = "lab"
username = var.rabbit_username
password = var.rabbit_password
insecure = true
}
provider "rabbitmq" {
endpoint = "https://someendpoint"
View ingress-nginx.yaml
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: ingress-nginx
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
rules:
- apiGroups: [""]
View checkdhcp.py
#!/usr/bin/env python
#
# Author: Hari Sekhon
# Date: 2007-11-20 18:16:55 +0000 (Tue, 20 Nov 2007)
#
# https://github.com/harisekhon/nagios-plugins
#
# License: see accompanying LICENSE file
#