Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@gmile
Last active December 20, 2015 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmile/6148170 to your computer and use it in GitHub Desktop.
Save gmile/6148170 to your computer and use it in GitHub Desktop.
Collection of shell scripts
tar -czf folder_name.tar.gz folder_name/
curl \
-H "aftership-api-key: 11111111-1111-1111-1111-1111111111" \
-H "Content-Type: application/json" \
'https://api.aftership.com/v4/trackings?keyword=24159488'
ack -l 'pattern' | xargs perl -pi -E 's/pattern/replacement/g'
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=finished.pdf file1.pdf file2.pdf
for url in `cat urls.txt`
do
echo $url
curl -o /dev/null --silent --head --write-out '%{http_code} %{redirect_url}\n' $url
done
#!/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
rake db:migrate:status | awk '/down/' | wc -l
for FILENAME in *; do mv $FILENAME Unix_$FILENAME; done
sed -n '15,20p' my_file
@gmile
Copy link
Author

gmile commented Jan 12, 2015

cat fix.csv | csvprintf -i '%1$s  %4$-32s %16$-16s %18$-5s %19$-40s %33$s\n'

@gmile
Copy link
Author

gmile commented Feb 23, 2015

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;

@gmile
Copy link
Author

gmile commented Jun 12, 2015

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