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
### S3 Bulk Delete by File Size ### | |
aws s3 ls s3://YOUR_BUCKET_NAME/content/article/data/ --profile YOUR_AWS_PROFILE --recursive | awk -F ' ' '{print $3,$4}' | awk -F ' ' '$1 < 100 {print $2}' | xargs -IP echo '{"Key": "P"}' > delete.txt | |
#Because bulk delete limit is 1000 per api call. | |
split -l 1000 delete.txt | |
#Append json start and end parts to complete a bulk delete request in every file. | |
for file in x*; do | |
echo '{"Objects": [' >> delete"$file" && paste -d, -s "$file" >> delete"$file" && | |
echo '],"Quiet": true }' >> delete"$file" |
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
# ------------------------------------------------------------------ | |
# Desigining "trending topics in 24 hours sliding window" with Redis | |
# ------------------------------------------------------------------ | |
redis-cli del tophashes:2010-12-07-08-00 | |
redis-cli del tophashes:2010-12-07-09-00 | |
redis-cli del tophashes:current | |
echo '=== 8:00 AM ===' |