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
#usecase: remove pdf password, os: works in MacOS10+ | |
#pre-requisite: brew install qpdf; | |
qpdf --password='file-password' --decrypt password-protected-file.pdf file-without-password.pdf | |
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
#!/usr/bin/env bash | |
# Josh Skidmore <[email protected]> | |
# Basic example of using an HTTP range header to extract EXIF data | |
# from a JPEG file without having to download the entire image. | |
# This has no error handling and assumes the EXIF data is embedded | |
# within the first $KB_TO_DOWNLOAD kilobytes of the image | |
# Requirements: | |
# * curl |
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
""" | |
Non blocking example: | |
1. Browse to `localhost:8000/sleep1` | |
2. Browse to `localhost:8000/` | |
You'll observe that the first call will take 5 seconds and the second call will be executed immediately. | |
Blocking example: | |
1. Browse to `localhost:8000/sleep2` | |
2. Browse to `localhost:8000/` |
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 | |
# Usage: ./deletes3files.sh "bucketname" "30 days" | |
olderThan=$(date -d "-$2" +%s) | |
s3cmd ls s3://$1 | while read -r line; | |
do | |
createDate=$(echo $line|awk {'print $1" "$2'}) | |
createDate=$(date -d "$createDate" +%s) |
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 | |
OUTDIR=. | |
while read -r db ; do | |
while read -r table ; do | |
if [ "$db" == "system" ]; then | |
echo "skip system db" | |
continue 2; |
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
/** | |
* This script will automatically sync all updates from one database to another. It is meant to be run while | |
* syncing the database using mongodump and mongorestore. | |
* | |
* Example: | |
* node livesync.js mongodb://<user>:<pass>@dbhost.com:10645/app-production \ | |
* mongodb://<user>:<pass>@dbhost.com:10499/local?authSource=app-production \ | |
* app-production \ | |
* mongodb://<user>:<pass>@newdbhost.com/app-prod | |
*/ |
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
#!/usr/bin/env python | |
""" | |
Very simple HTTP server in python. | |
Usage:: | |
./dummy-web-server.py [<port>] | |
Send a GET request:: | |
curl http://localhost |