Elric's random thoughts in idle times

"Why stop now, when I'm just starting to hate it?" – Marvin the robot

Archive for the ‘debian’ Category

Debian: script to manipulate apt sources quickly from the command line

with 5 comments

I’m one of those who just uses the command line to manage packages, and since I don’t use synaptic, it makes no sense to have the application ‘Software Preferences’ installed, which all in all pulls in a lot of packages.

But sometimes it’s tiresome to open an editor to enable or disable sources, or throw some sed command to change the line, which is anyway some typing. And it’s worse if you want to enable or disable several repositories at once.

So I created a bash script, aptsources (pretty unoriginal), to deal with repositories’ files under the directory ‘/etc/apt/sources.list.d/’. It doesn’t touch the file ‘/etc/apt/sources.list’ file at all, as it’s the file I edit the least. I have most Debian’s distributions entries uncommented (squeeze, sid, etc), with the use of apt-pinning.

The script allows to enable, disable, remove and add files under that directory. It also sets launchpad’s ppa repositories (Note and disclaimer: Ubuntu packages are not binary compatible!) with a syntax similar to add-apt-repository, allowing to set as an argument the Ubuntu version you think your Debian system is closer to. Thanks to Anant Shirvastava, as this function uses the code in his script. It also does backup, shows content, etc…

You can only specify one parameter a time, but some of them (--enable, --disable, --source) accept multiple arguments.

This is:

# aptsources --enable wine zeitgeist

would enable (uncomment) the ‘deb’ lines (not the ‘deb-src’ ones) in the files ‘wine.list’ and ‘zeitgeist.list’ at once.

One handy feature of the script is listing repos grouping them as enabled or disabled.

omar~$ aptsources -l
Enabled: cardapio docky multimedia synapse
Disabled: awn burg codeblocks getdeb hadret mpd-sound-menu notify-osd orta playdeb translate ufw-gtk vineyard wine zeitgeist

The script doesn’t run “exotic” commands, and it’s very easy to read. I stopped posting it here cause it got too big. You can download it from github. Click on the “Download” button and you will get a compressed archive with the latest version. You can install the script to ‘/usr/local/bin’ and bash-completion feature with aptsources.sh -i. I still enhance with small things so you better come back once or twice :)

Play with it and I hope it’s useful for more people than just me.

Enjoy!

Written by elric80

January 8, 2011 at 6:46 pm

Posted in debian, linux

Tagged with , , , , , ,

Using vim-addons and PO plugin

leave a comment »

I really like vim-addons. It provides a very convenient and quick way to install, enable, disable, and more, addons for Vim. You can do it per-user if you run without privileges (a link is created under ~/.vim, or system-wide. To work, it needs some data fields in a yaml file for every plugin. The package vim-scripts in Debian provides such file, so I just used that one.

By default, vim-addons searches for plugins under /usr/share/vim/addons, whereas the plugins provided by vim-scripts are located under /usr/share/vim-scripts. This means you can add any plugin under /addons with the knowledge that it won’t interfere with other vim-scripts.

The reason I did this is because I don’t like the PO plugin file provided with vim-scripts. I rather like its fork, which also includes documentation. This is the entry I created for it in /usr/share/vim/registry/vim-scripts.yaml. You can also create a new yaml file and place it under the same directory. I didn’t have to specify the field basedir, as I placed the files under vim/addons.

addon: po-fork
description: "Enhanced PO addon"
disabledby: "let loaded_alternateFile = 1"
files:
- ftplugin/po.vim
- doc/po.txt
---

This done, use vim-addons list to see all addons with a yaml file, and vim-addons install addon to activate it. Use vim-addons help to get an idea of what you can do with this program.

Enjoy!

Written by elric80

December 1, 2010 at 12:30 pm

Posted in debian, l10n, linux, vim

Tagged with , , , ,

Debian Squeeze nautilus-dropbox.deb i386 package

with 17 comments

Edit 2: Official Debian dropbox package on the way :) http://raphaelhertzog.com/2011/06/06/official-debian-ubuntu-packages-for-nautilus-dropbox/

Edit: The package nautilus-dropbox is now available in Hadret’s Debian PPA (among other interesting stuff). You might be better off using it.

If you are looking for the amd64 version, go here.

This is the nautilus-dropbox package built on Debian Squeeze i386.

nautilus-dropbox_0.6.3_i386.deb

It will call the real installation and that’s about it. Don’t be mistaken by the version number, it will download the latest version, just hover over the notification icon and you’ll see the real version. You can upgrade by just deleting the appropriate folder in your home directory.

Enjoy!

Written by elric80

October 6, 2010 at 1:31 pm

Posted in debian, gnome, linux

Tagged with , , , ,

Kupfer 202 for Squeeze

leave a comment »

I built this Kupfer package v202 for Squeeze as it includes some bug fixes and appindicator support, which I use. Thought to share so you can just download it.

All archs download

Checkout Kupfer’s monochrome icons too if you want to integrate it with indicator-applet’s icons.

Enjoy.

Written by elric80

September 6, 2010 at 4:14 pm

Posted in debian, gnome, linux

Tagged with , , ,

John Goerzen orphans offlineimap

leave a comment »

There are things that break my heart badly… such as this. This tool is by far the fastest imap sync tool I’ve ever used (including the ones integrated in apps such as Thunderbird), works great on my poor internet connection, and I love to use it with Mutt.

Luckily enough, the tool is far enough for a regular gmail account, and as such I will keep it till it starts segfaulting due to an incompatible dependency upgrade :***

So… thanks John Goerzen for the time spent on this fantastic tool. Sometimes I wish I had studied programming instead of language so I could maintain apps that I like and get unmaintained.

And I also hope you (John) will become unsatisfied with imap mail fetchers once again :)

Written by elric80

June 21, 2010 at 12:03 pm

Posted in debian, linux

Tagged with , , , , , ,

Debian: virtaal 0.6.1 and translate-toolkit 1.7

with 3 comments

Edit: You might want to try the newest beta releases. The packages have been tested on Debian Squeeze and Ubuntu 10.04 and 10.10, and work just fine. Take a look into the amazing enhancements this release will offer by downloading the deb packages from Translate.org.za!

Definitely, virtaal is my po editor of choice. It’s clean interface and ease of use are the best virtues of this application. translate-toolkit is a dependency for virtaal and Pootle as well as a CLI tool to manipulate po files. If you haven’t used it yet, you’ll be surprised by the enhances it may bring to your work.
Ok, virtaal doesn’t do half of what Lokalize does, but I only use a quarter of what Lokalize does. Gtranslator is a fine tool, but development seems to be stopped. It is a stable and full piece of software, but I’m not a fan of the interface either. Poedit isn’t that great, in my opinion. However, Virtaal’s integration with translate-toolkit, offering nice enhancements, promising a bright future, and its interface just beat all aforementioned.

Obligatory image:

As you can see there are NO extra buttons, and the layout looks like a side-by-side sheet presentation. Beautiful.
It also allows access to machine translation services such as Google, Moses and Opentran. Other features include highlighted diffs between the translation memory suggestions, a don’t-touch-your-mouse approach, and much more.

One thing that saddens me is how late updates can be for these two packages in Debian (not incredibly late, just to much for me to wait :), and in this particular case, there was a bug rendering the preferences window pretty useless that was fixed in this release (thanks to Walter). As I couldn’t wait for long :) I just built the packages from the latest sources. It’s working great for me, but use at your own risk.
Actually, I’m doing this so often (build newer packages or rebuild other with different options) that I should consider starting a ppa. Anway, these are the links for both packages.

translate-toolkit_1.7_all.deb

virtaal_0.6.1_all.deb

Happy FOSS translating!

Written by elric80

June 4, 2010 at 11:10 am

Better notify-osd integration on non-Ubuntu systems

leave a comment »

I really like some of the simplifications Ubuntu throws into the desktop. However, a lot of these new things (most) are only well integrated in their desktop. One example is notify-osd. It installs just fine from ppa under Debian, but both bright and volume controls may not work as expected.
I longed for a better integration with my Debian system, as I don’t like regular gnome notifications. Thankfully, there are scripts :) I found both in the Archlinux forums (some forums!).

This is the script that allows to change the volume using notify-osd.
http://bbs.archlinux.org/viewtopic.php?id=69589 Check up post number 10. (Thanks to abarilla for the original script).

Save the script as “vol”, cp to /usr/bin (or wherever in the PATH). Next, configure volume shortcuts under System -> Pref -> Keyb Shortcuts, being the commands, i.e., “vol up” “vol down” and “vol mute”. You might have to reconfigure your actual volume shortcuts so they won’t clash with the new ones.

The one for brightness is available at the following address. (Thanks to xabz).
http://foro.archlinux.cl/viewtopic.php?id=61,
Do cat /sys/class/backlight/acpi_video0/actual_brightness with maximum brightness, and replace the number 9 in the script with whatever value it returns.
Now set keyboard shortcuts.

The problem here is that Gnome may “forget” your shortcuts for brightness or volume if they are special keys “hardware” shortcuts…. I only suffer it with brightness on my laptop.

If you use compiz, you may encounter an issue with notify-osd flickering when it fades in or out. This is because notify-osd integrates its effects so they are the same regardless of the composite manager. The way to avoid such flickering is to add & !(name=notify-osd) in the “Window Match” section in ccsm for the animations that you use, and that may affect it.

Last but not least, I found this instructions in webupd8.org to install a configurable notify-osd. Add the launchpad ppa and your good to go!

Enjoy!

Written by elric80

May 17, 2010 at 5:19 pm

Posted in debian, gnome, linux

Tagged with , , , , ,