Na Pata Da Esfinge...

terça-feira, 5 de maio de 2015

Well, everytime I read about shell (bash) parameter expansion I see examples ripping off the suffixes. But someday, I needed to do the inverse: Append suffixes. How to do that?I've made a simple bash script to do so:#!/bin/bashfor i in *; do mv ${i} ${i}.sh;doneexit 0

Using a for loop, I moved every file in the directory to the same name, with a ".sh" appended as suffix.

Feel free to change the suffix you want.To revert:#!/bin/bashfor i in *; domv ${i} ${i/.sh/};doneexit 0In this case, in every file of the directory, ".sh" will be substituted for nothing. It may cause some troubles. Let's suppose you have a dir, full of these files:1.shellvpower2.shellvpower3.shellvpower4.shellvpowerThey'll become:1ellvpower2ellvpower3ellvpower4ellvpowerSo, in a better way, to remove only the suffixes ".sh":for i in *; do mv ${i} ${i%%\.sh};doneexit 0Bonus:Append prefixes:To append, for instance, prefix "waka":#!/bin/bashfor i in *; domv ${i} ${i/#/waka};doneTip: "#" is before "i" (so, prefix). "%" would be after "i".It also can be done in a simpler way:#!/bin/bashfor i in *; domv ${i} waka${i};done

Make a file named user.js in $HOME/.mozilla/firefox/*.default/ with this content:user_pref("font.FreeType2.enable", "true");user_pref("font.FreeType2.autohinted", "true");user_pref("font.FreeType2.printing", "true");user_pref("font.FreeType2.unhinted", "false");

To improve fonts and other enhancements on firefox, I use the excellent ArchWiki, mainly for dpi adjustments (I'm not a fanboy of just one distro but since I'm linux user since 1997, I understand distros are just some kind of free expression to get the same thing, like religions, and btw I used arch, made good friends and learn a lot from some years because of the experience, but the rolling release model doesn't fit on the plans of my server). Here's the link: Firefox tweaks on ArchWiki

segunda-feira, 29 de abril de 2013

First, your user must be allowed to shut down the system. Do it editing /etc/sudoers (a glance at man should help). We don't focus the edition of sudoers here. Then, add to you rc.xml (making backup of it first, always):

<keybind key="C-A-Delete" chroot="true">

<keybind key="r">

<action name="Execute">

<prompt>Reiniciar o sistema?</prompt>

<execute>reboot</execute>

</action>

</keybind>

<keybind key="x">

<action name="Execute">

<prompt>Desligar o sistema?</prompt>

<execute>poweroff</execute>

</action>

</keybind>

<keybind key="Escape">

<action name="BreakChroot"/>

</keybind>

Doing so, when pressing ctrl+alt+del you'll be sent into a chroot that allows you to press x or r, the first will prompt a message to shutdown the system and the other, to restart it. If "yes" is chosen, the magic's done. Hope you like the tip.

There's quite some time I've been searching on how to do that and I finally found it. First, backup your $HOME/openbox/rc.xml. Then, insert these lines in your rc.xml in keyboard section, before </keyboard> , of course:

An openbox --reconfigure in the terminal will make it available in your openbox, after inserting the code into rc.xml file. The code enables two methods of doing aero-snapping: The first one allows you to make aero-snapping pressing ctrl+windows+1 to 4. The second one, pressing in the same time ctrl+windows+w you will be sent to a chroot and you can move windows with keyboard directionals (up, down, right and left), and escaping with "esc". Thanks for the idea, folks from Crunchbang forum!! I slightly change it, but it works like a charm! Hope it'll be useful for everyone! .