Initial for .fish
This commit is contained in:
commit
29a481031d
31
screenshot.fish
Normal file
31
screenshot.fish
Normal file
|
@ -0,0 +1,31 @@
|
|||
# Setup
|
||||
set SCP_USER "jmaa"
|
||||
set SRT_USER "j"
|
||||
|
||||
# Other stuff
|
||||
set SCP_HOST "strawberry.thedevcave.net"
|
||||
set SCP_PATH "~/public_html/screenshots"
|
||||
set HTTP_URL "http://dcav.pw/$SRT_USER"
|
||||
|
||||
if count $argv > /dev/null
|
||||
set FILE_EXT $argv[2]
|
||||
set TEMP_FILE $argv[1]
|
||||
else
|
||||
set FILE_EXT ".png"
|
||||
set TEMP_FILE "/tmp/screenshot_temp"$FILE_EXT
|
||||
scrot -rzu $TEMP_FILE
|
||||
end
|
||||
|
||||
set LINK (echo (sha256sum -b $TEMP_FILE) | xxd -r -p | base64 | cut -c-3)
|
||||
set FILENAME $LINK$FILE_EXT
|
||||
|
||||
if count $argv > /dev/null
|
||||
set LINK $FILENAME
|
||||
end
|
||||
|
||||
if test $TEMP_FILE
|
||||
echo $HTTP_URL$LINK | xclip -i -sel clip
|
||||
scp $TEMP_FILE "$SCP_USER@$SCP_HOST:$SCP_PATH/$FILENAME"
|
||||
rm $TEMP_FILE
|
||||
echo "File accessable at '$HTTP_URL$LINK'"
|
||||
end
|
Loading…
Reference in New Issue
Block a user