zeldor.biz

Linux, programming and more

Copyright © 2025
Log in

Dropbox KDE integration

November 28, 2010 by Igor Drobot Leave a Comment

After working some time with Dropbox I wrote this little python script to make my work with Dropbox more efficient and faster.

With a right click I can Upload my file to my Dropbox account:

Right Click

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env python
# -*- coding:utf-8 -*-
 
import os, sys
 
PUBDIR = '/home/id/Dropbox/Public/'
USERID = 156881168
 
if len(sys.argv) > 1 and os.path.isfile(sys.argv[1]):
 os.popen('cp -f %s %s' % (sys.argv[1], PUBDIR))
 dest = 'https://dl.getdropbox.com/u/%s/%s' % (USERID, sys.argv[1].split('/')[-1])
 os.popen('kdialog --msgbox "Link was copied to the clipboard:\n%s"' % dest)
 os.system('dbus-send --print-reply --dest=org.kde.klipper \
    /klipper org.kde.klipper.klipper.setClipboardContents string:"%s"' % dest)
else:
 os.popen('kdialog --error "Please choose file!"')

#!/usr/bin/env python # -*- coding:utf-8 -*- import os, sys PUBDIR = '/home/id/Dropbox/Public/' USERID = 156881168 if len(sys.argv) > 1 and os.path.isfile(sys.argv[1]): os.popen('cp -f %s %s' % (sys.argv[1], PUBDIR)) dest = 'https://dl.getdropbox.com/u/%s/%s' % (USERID, sys.argv[1].split('/')[-1]) os.popen('kdialog --msgbox "Link was copied to the clipboard:\n%s"' % dest) os.system('dbus-send --print-reply --dest=org.kde.klipper \ /klipper org.kde.klipper.klipper.setClipboardContents string:"%s"' % dest) else: os.popen('kdialog --error "Please choose file!"')

Add a menu entry for right click:

1
2
3
4
5
6
7
8
9
10
11
12
13
vim /usr/share/kde4/services/ServiceMenus/dropbox.desktop
cat /usr/share/kde4/services/ServiceMenus/dropbox.desktop
 
[Desktop Entry]
Type=Service
ServiceTypes=KonqPopupMenu/Plugin,all/allfiles
Actions=DropboxURL
X-KDE-Priority=TopLevel
 
[Desktop Action DropboxURL]
Name=Share on DropBox
Icon=/home/id/Pictures/dropbox.png
Exec=/home/id/drop_IT.py "%u" %d

vim /usr/share/kde4/services/ServiceMenus/dropbox.desktop cat /usr/share/kde4/services/ServiceMenus/dropbox.desktop [Desktop Entry] Type=Service ServiceTypes=KonqPopupMenu/Plugin,all/allfiles Actions=DropboxURL X-KDE-Priority=TopLevel [Desktop Action DropboxURL] Name=Share on DropBox Icon=/home/id/Pictures/dropbox.png Exec=/home/id/drop_IT.py "%u" %d

Update:
If you want to make it work only for special users on the system, put dropbox.desktop in your home directory: “~/.kde/share/kde4/services/ServiceMenus”

Another bash based script:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash
 
DROPDIR=/home/id/Dropbox/Public/
USERID=156881168
 
if [ -e "$1" ]
then
        cp -f "$1" "$DROPDIR"
        file=`basename "$1"`
        link="http://dl.getdropbox.com/u/$USERID/$file"
        notify-send -i go-down "Dropbox" "Link to \"$file\" was copied to the clipboard"
        echo "$link" | xsel -bi
else
        notify-send -i go-down "Dropbox" "Please choose file!!"
fi

#!/bin/bash DROPDIR=/home/id/Dropbox/Public/ USERID=156881168 if [ -e "$1" ] then cp -f "$1" "$DROPDIR" file=`basename "$1"` link="http://dl.getdropbox.com/u/$USERID/$file" notify-send -i go-down "Dropbox" "Link to \"$file\" was copied to the clipboard" echo "$link" | xsel -bi else notify-send -i go-down "Dropbox" "Please choose file!!" fi

Icon — Could be a pretty icon (16×16) Icon Dropbox Upload
Exec — path to you *.py script

Filed Under: Bash, Linux

Upgrade Debian lenny to squeeze

November 20, 2010 by Igor Drobot 1 Comment

Debian Logo

This upgrade from lenny to squeeze is not more complexer then the update from etch to lenny.
If you read everything carefully your server will run after upgrade too:)

Before you go on please read the official Debian release notes:

Recording your session:

1
script -t 2>~/upgrade-squeezestep.time -a ~/upgrade-squeezestep.script

script -t 2>~/upgrade-squeezestep.time -a ~/upgrade-squeezestep.script

First you should update your running system:

1
aptitude update && aptitude dist-upgrade

aptitude update && aptitude dist-upgrade

Check the package state:

1
dpkg --audit

dpkg --audit

It will show any packages which have a status of Half-Installed or Failed-Config, and those with any error status.

If you had a kernel upgrade please reboot. After successfully updates replace the sources from lenny to squeeze:
[Read more…]

Filed Under: Bash, Debian, Kernel, Linux Tagged With: Debian squeeze, lenny to squeeze, Upgrade debian

Aptitude search

October 31, 2010 by Igor Drobot Leave a Comment

Very useful search hack for aptitude, to compare package versions. Normaly you see the versions if you open aptitude and it takes to much time.

1
aptitude search virtualbox -F '%p%V'

aptitude search virtualbox -F '%p%V'

Filed Under: Bash, Linux Tagged With: aptitude, aptitude search

‘Argument list too long’

October 18, 2010 by Igor Drobot Leave a Comment


root@web2:$ rm pe-warn-*.bz2
-bash: /bin/rm: Argument list too long

This peoblem happens when you are trying to delete too many files in a directory at the same time – it seems rm has special limits …

To solve the problem:
Use:

1
find . -name 'pe-warn-*.bz2' | xargs rm

find . -name 'pe-warn-*.bz2' | xargs rm

or

1
find . -name "pe-warn-*.bz2" -delete

find . -name "pe-warn-*.bz2" -delete

Filed Under: Bash, Debian, Linux, Ubuntu Tagged With: bash, limit, rm

Data Recovery

October 5, 2010 by Igor Drobot Leave a Comment

Each of you looses already some important files like photos or important documents.
After a normal Windows crash it’ s not a problem to get all your data back.
I show you some methods to get your data back.

These two examples are taken directly from the ddrescue info pages.

Example 1: Rescue an ext3 partition in /dev/hda2 to /dev/hdb2

1
2
3
dd_rescue /dev/hda2 /dev/hdb2 -l logfile.txt
e2fsck -v -f /dev/hdb2
mount -t ext3 -o ro /dev/hdb2 /mnt

dd_rescue /dev/hda2 /dev/hdb2 -l logfile.txt e2fsck -v -f /dev/hdb2 mount -t ext3 -o ro /dev/hdb2 /mnt

If you have a damaged hard disk /dev/sda1 and you have an empty space hard disk /dev/sdb1 You can copy data from /dev/sda1 to /dev/sdb1 use the following commnd

1
2
3
dd_rescue /dev/sda1 /dev/sda2/backup.img
# To mount use:
mount -t ext3 /dev/sda2/backup.img mnt/ -o loop

dd_rescue /dev/sda1 /dev/sda2/backup.img # To mount use: mount -t ext3 /dev/sda2/backup.img mnt/ -o loop

Example 2: Rescue a CD-ROM in /dev/cdrom

1
ddrescue -b 2048 /dev/cdrom cdimage logfile

ddrescue -b 2048 /dev/cdrom cdimage logfile

Filed Under: Bash, Debian, Linux, Ubuntu Tagged With: dd, dd_rescue. restore data, HDD recovery

  • « Previous Page
  • 1
  • …
  • 6
  • 7
  • 8
  • 9
  • 10
  • Next Page »
Yeaaah Cookie! We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok