Skip to content

Instantly share code, notes, and snippets.

View jcardus's full-sized avatar

Joaquim Cardeira jcardus

  • Fleetmap
  • Portugal
View GitHub Profile
@jcardus
jcardus / connection_count_to_cloudwatch.sh
Last active December 26, 2025 23:42
traccar connections to cloudwatch
NAMESPACE="Traccar"
INTERVAL=600
REGION="us-east-1"
while true; do
date;
total=$(ss -tanH | wc -l);
echo "Total connections: $total";
aws cloudwatch put-metric-data --namespace "$NAMESPACE" --metric-name "Connections" --value "$total" --unit "Count" --region "$REGION";
@jcardus
jcardus / delete-positions-repack.sh
Created November 4, 2025 13:56
delete-positions-repack.sh
#!/bin/bash
DB="traccar"
USER="neondb_owner"
HOST="ep-late-cherry-a460jx6n.us-east-1.aws.neon.tech"
export PGOPTIONS='-c idle_in_transaction_session_timeout=0'
pg_repack -h $HOST -U $USER -d $DB --table=tc_positions -k -e