-
-
Save papertigers/1901d24e1498917d1d1d to your computer and use it in GitHub Desktop.
Revisions
-
bahamas10 revised this gist
Aug 3, 2015 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -39,6 +39,8 @@ Will open the SmartOS changelog in your browser (on a Mac). Pass a file as the first argument, or as stdin, to create a paste in manta and print the URL to stdout Requires `Pygments`, which can be installed with `sudo easy_install Pygments` or similiar. Example ``` -
bahamas10 created this gist
Aug 3, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,69 @@ Joyent Manta Functions ====================== Taken from https://github.com/bahamas10/dotfiles/blob/master/bashrc `mbillable` ----------- > Show amount of billable storage spaced used in Manta Allows the user to optionally be specified as the first argument Example ``` $ mbillable bahamas10 => using 2 GB (3 GB billable) $ mbillable papertigers papertigers => using 4 GB (5 GB billable) ``` `mopen` ------- > Open Manta files using `open` on the current system Example ``` $ mopen /Joyent_Dev/public/SmartOS/smartos.html ``` Will open the SmartOS changelog in your browser (on a Mac). `mpaste` -------- > Store pastebin style pastes with syntax highlighting in Manta Pass a file as the first argument, or as stdin, to create a paste in manta and print the URL to stdout Example ``` $ mpaste .bashrc https://us-east.manta.joyent.com/[email protected]/public/pastes/1438621637.html $ cat .vimrc | mpaste https://us-east.manta.joyent.com/[email protected]/public/pastes/1438621641.html ``` (see https://us-east.manta.joyent.com/[email protected]/public/pastes/1438621637.html) `murl` ------ > Convert Manta filenames to URLs Example ``` $ murl ~~/public/foo /papertigers/public/foo https://us-east.manta.joyent.com/bahamas10/public/foo https://us-east.manta.joyent.com/papertigers/public/foo ``` License ------- MIT License 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ # Total the billable amount in Manta mbillable() { local u=${1:-$MANTA_USER} mget -q "/$u/reports/usage/storage/latest" |\ json storage | json {public,stor,reports,jobs}.bytes |\ awk -v "u=$u" " { s += \$1; } END { gb = s / 1024 / 1024 / 1024; billable = gb + 1; printf(\"%s => using %d GB (%d GB billable)\\n\", u, gb, billable); } " } # Open files from manta in the browser mopen() { murl "$@" | xargs open } # Paste bin using manta mpaste() { local mfile=~~/public/pastes/$(date +%s).html pygmentize -f html -O full "$@" | mput -p "$mfile" murl "$mfile" } # convert manta paths into URLs murl() { local u for u in "$@"; do echo "$MANTA_URL${u/#~~//$MANTA_USER}" done }