Last active
December 20, 2015 14:39
-
-
Save gmile/6148170 to your computer and use it in GitHub Desktop.
Collection of shell scripts
This file contains hidden or 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
| tar -czf folder_name.tar.gz folder_name/ |
This file contains hidden or 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
| curl \ | |
| -H "aftership-api-key: 11111111-1111-1111-1111-1111111111" \ | |
| -H "Content-Type: application/json" \ | |
| 'https://api.aftership.com/v4/trackings?keyword=24159488' |
This file contains hidden or 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
| ack -l 'pattern' | xargs perl -pi -E 's/pattern/replacement/g' |
This file contains hidden or 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
| gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=finished.pdf file1.pdf file2.pdf |
This file contains hidden or 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
| for url in `cat urls.txt` | |
| do | |
| echo $url | |
| curl -o /dev/null --silent --head --write-out '%{http_code} %{redirect_url}\n' $url | |
| done |
This file contains hidden or 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 | |
| FILES=$(git diff-tree --no-commit-id --name-only -r HEAD | grep db/migrate/) | |
| timestamp=20130801010001 | |
| for file in $FILES | |
| do | |
| re='s/[0-9]{14}/'$timestamp'/g' | |
| x=$(echo $file | sed -E $re) | |
| git mv $file $x | |
| ((timestamp++)) | |
| done |
This file contains hidden or 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
| rake db:migrate:status | awk '/down/' | wc -l |
This file contains hidden or 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
| for FILENAME in *; do mv $FILENAME Unix_$FILENAME; done |
This file contains hidden or 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
| sed -n '15,20p' my_file |
Author
gmile
commented
Jan 12, 2015
Author
select group_concat(o.id), s.id, group_concat(o.quantity order by o.quantity desc), o.created_on from order_items o join shipments s on s.id = o.shipment_id where warehouse_id = 61 group by s.id;
Author
for dest in $(<destfile.txt); do
scp ourfile.txt ${dest}:remote/path/
done
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment