User Tools

Site Tools


people:glen

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
people:glen [2012-10-14 00:17]
glen fix user homepages link
people:glen [2012-12-20 11:05]
glen syntax to blocks
Line 1: Line 1:
 +====== Elan Ruusamäe ======
  
- 
-====== Elan Ruusamäe ====== 
 [[http://​cia.vc/​stats/​author/​glen|{{http://​dev.gentoo.org/​~spock/​img/​icons/​cia-stats.png?​}}]] ​ [[http://​cia.vc/​stats/​author/​glen|{{http://​dev.gentoo.org/​~spock/​img/​icons/​cia-stats.png?​}}]] ​
- 
-/* UndefinedMacro:​ TableOfContents(None) */  
- 
  
  
Line 40: Line 36:
  
  
-<​file>​xprop -id $WINDOWID -notype WM_LOCALE_NAME+<​file ​bash>xprop -id $WINDOWID -notype WM_LOCALE_NAME
 </​file>​ </​file>​
  
Line 46: Line 42:
 ===== Detect PuTTY ===== ===== Detect PuTTY =====
  
- +<​file ​bash xterm-249/​vttests/​title.sh>
-<file># xterm-249/​vttests/​title.sh+
 old=$(stty -g) old=$(stty -g)
 stty raw -echo min 0 time 5 stty raw -echo min 0 time 5
Line 76: Line 71:
  
  
-<​file>​keychain -q --agents gpg+<​file ​bash> 
 +keychain -q --agents gpg
 if [ -f ~/​.keychain/​$HOSTNAME-sh-gpg ]; then if [ -f ~/​.keychain/​$HOSTNAME-sh-gpg ]; then
   . ~/​.keychain/​$HOSTNAME-sh-gpg   . ~/​.keychain/​$HOSTNAME-sh-gpg
Line 132: Line 128:
 for example my ''​~/​.bash_profile''​ on [[:​machines:​carme|carme]] contains: ​ for example my ''​~/​.bash_profile''​ on [[:​machines:​carme|carme]] contains: ​
  
-<​file>#​ force screen utf8 encoding+<​file ​bash> 
 +# force screen utf8 encoding
 if [[ "​$TERM"​ = screen* ]]; then if [[ "​$TERM"​ = screen* ]]; then
   echo -ne '​\033]83;​encoding utf8\007'​   echo -ne '​\033]83;​encoding utf8\007'​
Line 143: Line 140:
  
  
-<​file>#​ the server name is bogus actually, to satisfy mod_fastcgi+<​file ​apache> 
 +# the server name is bogus actually, to satisfy mod_fastcgi
 FastCgiExternalServer /bin/true -socket /​var/​run/​php/​fcgi.sock FastCgiExternalServer /bin/true -socket /​var/​run/​php/​fcgi.sock
 ScriptAlias /php-fcgi /bin/true ScriptAlias /php-fcgi /bin/true
Line 239: Line 237:
 now remove the old disk and voila! ​ now remove the old disk and voila! ​
  
 +===== PLD Linux VirtualBox images =====
  
 +I've created PLD VirtualBox images, exported into [[wp>​Open Virtualization Format|OVA (Open Virtualization Archive)]] format
 +
 +  * ftp://​ftp.pld-linux.org/​people/​glen/​vm/​
  
 ===== Upgrading PHP 5.3 -> PHP 5.4 ===== ===== Upgrading PHP 5.3 -> PHP 5.4 =====
Line 247: Line 249:
 </​file>​ </​file>​
  
 +===== Dropbox as picture share service =====
 +
 +Any file saved to ''​~/​Pictures/​Screenshots''​ gets renamed based on timestamp and moved to ''​~/​Dropbox/​Public''​ folder.
 +
 +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://​www.dropbox.com/​install?​os=lnx|dropboxd]] running, [[http://​ftp.gnome.org/​pub/​GNOME/​sources/​libnotify/​0.7/​|libnotify]],​ [[https://​github.com/​rvoicilas/​inotify-tools/​wiki|inotify-tools]]
 +
 +You should start the script at startup of your X session.
 +
 +<code bash ~/​.local/​bin/​dropbox-watch.sh>​
 +#!/bin/sh
 +# A script that watches ~/​Pictures/​Screenshots dir, and any new file is added there, it
 +# 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 <​glen@delfi.ee>​
 +# Date: 2012-11-09
 +
 +watchdir=$HOME/​Pictures/​Screenshots
 +# i'd use xdg-open here, but somewhy in GNOME 3.4 it opens dir containing the image
 +viewer=gpicview
 +
 +# Config
 +dropdir=$HOME/​Dropbox/​Public
 +dropuser=YOUR_DROPBOX_NUMERIC_USER_ID
 +dropurl=https://​dl.dropbox.com/​u/​$dropuser/​ss
 +
 +if [ ! -d $dropdir ]; then
 + echo >&2 "​Dropbox dir $dropdir missing!"​
 + exit 1
 +fi
 +
 +inotifywait -m -e moved_to -e close_write $watchdir | while read path change filename; do
 + case "​$change"​ in
 + CREATE|MOVED_TO|*CLOSE_WRITE*)
 + file=$path/​$filename
 + ;;
 + *)
 + continue
 + esac
 +
 + # reformat filename so it woult be nice url
 + mtime=$(stat -c "​%y"​ "​$file"​)
 + filename=$(date -d "​$mtime"​ '​+%Y-%m-%d_%H.%M.%S'​).png
 +
 + url="​$dropurl/​$filename"​
 +
 + mv "​$file"​ "​$dropdir/​$filename"​
 +
 + $viewer "​$dropdir/​$filename"​ &
 +
 + # Copy URL to clipboard and notify the user
 + echo -n "​$url"​ | xclip -selection c
 + notify-send --hint=int:​transient:​1 "​Screenshot Uploaded"​ "​Copied URL to clipboard:​\n$url"​
 +done
 +</​code>​
people/glen.txt · Last modified: 2016-01-16 09:33 by glen