people:glen
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
people:glen [2014-07-22 16:54] – [Dropbox as picture share service] test xclip glen | people:glen [2016-01-16 09:33] (current) – glen | ||
---|---|---|---|
Line 4: | Line 4: | ||
- | ===== Inner Wiki links ===== | + | ===== Useful |
- | * [[: | + | * [[#PLD Linux VM Images]] |
- | * [[http:// | + | * [[http:// |
- | * [[: | + | |
* [[:: | * [[:: | ||
- | * [[: | ||
- | * [[: | ||
- | * [[: | ||
- | * [[: | ||
* [[: | * [[: | ||
* [[: | * [[: | ||
* [[http:// | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
===== Some ideas to do in PLD Linux ===== | ===== Some ideas to do in PLD Linux ===== | ||
Line 23: | Line 21: | ||
* generate / | * generate / | ||
* modularize rc-scripts, so the portions could be reused for example by initng. | * modularize rc-scripts, so the portions could be reused for example by initng. | ||
- | |||
- | |||
- | ===== links ===== | ||
- | |||
- | * [[http:// | ||
- | * [[http:// | ||
- | * [[http:// | ||
- | * [[http:// | ||
- | |||
===== Detect X application locale ===== | ===== Detect X application locale ===== | ||
Line 252: | Line 241: | ||
When the move is done, URL for the image is copied to clipboard and image viewer is opened so you can see your image before you paste the url to IM, e-mail, etc... | When the move is done, URL for the image is copied to clipboard and image viewer is opened so you can see your image before you paste the url to IM, e-mail, etc... | ||
- | Requirements: [[https:// | + | See: https:// |
- | + | ||
- | You should start the script at startup of your X session, example: | + | |
- | <code ini ~/ | + | |
- | [Desktop Entry] | + | |
- | Type=Application | + | |
- | Name=Dropbox watch | + | |
- | Comment=Launch dropbox watcher script | + | |
- | Icon=dropbox | + | |
- | Exec=$HOME/ | + | |
- | </ | + | |
- | + | ||
- | <code bash ~/ | + | |
- | #!/bin/sh | + | |
- | # A script that watches ~/ | + | |
- | # is renamed so it would contain filename modify timestamp (uses safe | + | |
- | # characters not to require urlencode) and moved to dropbox dir. Additionally | + | |
- | # dropbox url is copied to clipboard and image viewer is opened to show that | + | |
- | # screenshot. | + | |
- | # | + | |
- | # Author: Elan Ruusamäe < | + | |
- | # Date: 2012-11-09 | + | |
- | # Updated: 2014-07-22 (test all tools, more filename filters) | + | |
- | + | ||
- | watchdir=$HOME/ | + | |
- | viewer=xdg-open | + | |
- | + | ||
- | # Config | + | |
- | dropdir=$HOME/ | + | |
- | dropuser=YOUR_DROPBOX_NUMERIC_USER_ID | + | |
- | dropurl=https:// | + | |
- | + | ||
- | if [ ! -d $dropdir ]; then | + | |
- | echo >&2 " | + | |
- | exit 1 | + | |
- | fi | + | |
- | + | ||
- | if [ ! -d $watchdir ]; then | + | |
- | echo >&2 "Watch dir $watchdir missing!" | + | |
- | exit 1 | + | |
- | fi | + | |
- | + | ||
- | if ! which $viewer 2>/ | + | |
- | echo >&2 " | + | |
- | exit 1 | + | |
- | fi | + | |
- | + | ||
- | if ! which inotifywait 2>/ | + | |
- | echo >&2 " | + | |
- | exit 1 | + | |
- | fi | + | |
- | + | ||
- | if ! which notify-send 2>/ | + | |
- | echo >&2 " | + | |
- | exit 1 | + | |
- | fi | + | |
- | + | ||
- | if ! which xclip 2>/ | + | |
- | echo >&2 " | + | |
- | exit 1 | + | |
- | fi | + | |
- | + | ||
- | inotifywait -m -e moved_to -e close_write $watchdir | while read path change filename; do | + | |
- | case " | + | |
- | CREATE|MOVED_TO|*CLOSE_WRITE*) | + | |
- | file=$path/ | + | |
- | ;; | + | |
- | *) | + | |
- | continue | + | |
- | esac | + | |
- | + | ||
- | # reformat filename so it woult be nice url | + | |
- | mtime=$(stat -c " | + | |
- | # Strip ' | + | |
- | # strip ' | + | |
- | fn=$(echo " | + | |
- | # Strip ' | + | |
- | # Strip ' | + | |
- | fn=$(echo " | + | |
- | + | ||
- | # sanitize exts | + | |
- | fn=$(echo " | + | |
- | filename=$(date -d " | + | |
- | + | ||
- | # bugfixes | + | |
- | fn=$(echo " | + | |
- | + | ||
- | url=" | + | |
- | + | ||
- | mv " | + | |
- | + | ||
- | $viewer " | + | |
- | + | ||
- | # Copy URL to clipboard and notify the user | + | |
- | echo -n " | + | |
- | notify-send --hint=int: | + | |
- | done | + | |
- | </ | + | |
===== PLD svn and Subversion under ac ===== | ===== PLD svn and Subversion under ac ===== | ||
people/glen.1406040843.txt.gz · Last modified: 2014-07-22 16:54 by glen