admin@instance-20240226-151936:~$ curl https://test.co.id -v
* Trying 10.94.2.24:443...
^C
admin@instance-20240226-151936:~$ sudo ipsec start
Starting strongSwan 5.9.8 IPsec [starter]...
admin@instance-20240226-151936:~$ curl https://test.co.id -v -I
* Trying 10.94.2.24:443...
* Connected to test.co.id (10.94.2.24) port 443 (#0)
* ALPN: offers h2,http/1.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
KEYSTORE_PATH=${ARTIFACT_DIR}/client.keystore.p12 | |
TRUSTORE_PATH=${ARTIFACT_DIR}/client.truststore.jks | |
PRIVKEY_RSA_PATH=${ARTIFACT_DIR}/service_key.pem | |
PRIVKEY_PATH=${ARTIFACT_DIR}/service.key | |
PUBKEY_RSA_PATH=${ARTIFACT_DIR}/service_cert.pem | |
PUBKEY_PATH=${ARTIFACT_DIR}/service.cert | |
CAKEY_PATH=${ARTIFACT_DIR}/ca.pem |
To DNAT the traffic from 10.1.1.1:5432
to 192.168.1.1:5432
using iptables
, you can follow these steps:
-
Enable IP forwarding:
sysctl net.ipv4.ip_forward=1
-
Create the DNAT rule:
iptables -t nat -A PREROUTING -i ens4 -p tcp --dport 5432 -j DNAT --to-destination 192.168.1.1:5432
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: Namespace | |
metadata: | |
name: net-tools | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: net-tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl get namespace "terminating-namespace" -o json \ | |
| tr -d "\n" | sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/" \ | |
| kubectl replace --raw /api/v1/namespaces/terminating-namespace/finalize -f - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
log=/var/log/docker-prune.log | |
date +'=== docker-prune execute at %Y.%m.%d %H:%M ===' >> $log | |
docker system prune -af --filter "until=$((30*24))h" >> $log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ECHO='echo ' | |
for branch in $(git branch -a | sed 's/^\s*//' | sed 's/^remotes\///' | grep -v 'master$\|main$\|develop$'); do | |
if ! ( [[ -f "$branch" ]] || [[ -d "$branch" ]] ) && [[ "$(git log $branch --since "3 month ago" | wc -l)" -eq 0 ]]; then | |
local_branch_name=$(echo "$branch" | sed 's/remotes\/origin\///') | |
$ECHO git branch -d "${local_branch_name}" | |
$ECHO git push origin --delete "${local_branch_name}" | |
fi | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
echo "${DEPLOYMENT_TARGET_CSV}" | while IFS=, read -r serviceName serviceRole serviceCountry others;do | |
if [ -z "$serviceName" ] || [ -z "$serviceRole" ] || [ -z "$serviceCountry" ];then | |
continue | |
fi | |
QUERY="INSERT IGNORE INTO newton.deployment_target (service_name,role,country_abbrv) VALUES ('${serviceName}','${serviceRole}','${serviceCountry}');" | |
echo ">${QUERY}" | |
mysql --user="$mysql_user" --password="$mysql_password" --host="$mysql_host" -ss --execute="${QUERY}" > /dev/null 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dump mongodb | |
mongodump --uri "mongodb://username:password@mongo-host:27017/db_name?authSource=admin&readPreference=primary" \ | |
--gzip --archive=backup.gz | |
# Restore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3.8-alpine as base | |
FROM base as builder | |
WORKDIR /source | |
COPY requirements.txt /requirements.txt | |
RUN pip install --install-option="--prefix=/source" -r /requirements.txt | |
FROM base | |
COPY --from=builder /source /usr/local | |
COPY src /app | |
WORKDIR /app | |
CMD ["gunicorn", "-w 4", "main:app"] |
NewerOlder