LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > linux-related notes
User Name
Password

Notices


Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
  1. Old Comment

    A very tiny quick dictionary look up script

    Quote:
    Is the space supposed to be before the slash or after bash? I had never noticed a space there in any script I've ever seen.
    I think what lupusarcanus is describing is a line like this:

    Code:
    #! /bin/bash
    …but IMO this works just as well:

    Code:
    #!/bin/bash
    The point is, you need a bang (exclamation point) in there to make it a valid interpreter selection line, otherwise it's simply interpreted as a comment, and the rest of the script is executed under the default shell*.

    (* - …which may be bash on most Linuxes, but if you're using bash-specific features, and you plan to run the script on systems where bash is not the default shell [but is installed], you'll want to explicitly tell the existing shell to switch to a different interpreter. )
    Posted 11-17-2011 at 05:40 AM by MrCode MrCode is offline
    Updated 11-17-2011 at 05:45 AM by MrCode
  2. Old Comment

    A very tiny quick dictionary look up script

    Thanks, I hadn't noticed. Is the space supposed to be before the slash or after bash? I had never noticed a space there in any script I've ever seen.
    Posted 11-16-2011 at 04:38 PM by the dsc the dsc is offline
  3. Old Comment

    A very tiny quick dictionary look up script

    Quote:
    You need to to add an exclamation mark after the number sign and a space
    I've never had to use a space in the shebang line of any script I've written…I think that's just a matter of style. :-\

    …but yes, you do need it to be a she-bang line, not just a she- line.
    Posted 11-14-2011 at 08:15 PM by MrCode MrCode is offline
  4. Old Comment

    A very tiny quick dictionary look up script

    You need to to add an exclamation mark after the number sign and a space (if you want to maintain compatibility).
    Posted 11-14-2011 at 07:58 PM by lupusarcanus lupusarcanus is offline
  5. Old Comment

    A very tiny quick dictionary look up script

    Kdict for kde3 still works these days though, and it's somewhat better than this script. It has links to other definitions within the text and such things. Combined with the qtcurve theme engine, it can even have the same look of all the other applications, even though it would normally be ignored by "more" native theme settings of KDE4, and completely ignored by gnome/gtk.
    Posted 11-13-2011 at 02:19 PM by the dsc the dsc is offline
  6. Old Comment

    Commanding openbox through scripts or command line

    I've figured that it can be faked via acpi_fakekey. Instead of using something like the hypothetical "openbox-command menu whatever", one can use in some script "<sudo> acpi_fakekey <number of some of those special keys that may not even exist in one's keyboard>". And this key, something like "Xf86Whatever" is set on openbox' rc.xml as a keybinding to the desired menu or openbox action.

    It's a shame we can't fake key combinations with acpi_fakekey. Or at least I don't know how to.
    Posted 10-21-2011 at 04:04 PM by the dsc the dsc is offline
  7. Old Comment

    Random song constrained by keyword on MPC

    Newer, improved version:

    Code:
    #!/bin/sh
    
    for i in $* ; do # search term parsing loop
    
    a="$a grep -i $i |" # makes a chain of greps from the search terms 
    
    done
    
    a="mpc playlist -f \"[(@(%position%)@) %artist% %title% %file%]\" | $a"    # adds a start to the grep chain - a start which is the generation of  playist with special character markings for easier later extraction of the music number
    
    mpc play `shuf -e $(eval $(echo $a| sed 's/.\{2\}$//') | sed 's:)@).*::g' | sed 's:(@(::g') -n 1 ` # evals the search, then extract the number via sed, plays it
    
    obmpc.sh osd &
    Now the search parameters aren't restricted by a single word, so it can work both as a randomizer when the parameters are broad, "mpcr band X", or a quick way to get a specific song, "mpcr bandx part of the song tittle"


    "obmpc.sh osd" is just a function of a different MPD-related script I have, would only show the selected song with aosd_cat at the bottom of the screen for a second.
    Posted 10-16-2011 at 07:42 PM by the dsc the dsc is offline
    Updated 10-16-2011 at 09:31 PM by the dsc
  8. Old Comment

    Fixing the annoying firefox' associations issue once and for all

    You're welcome.

    I think that despite of the fact that it's not gimp's business to open PDFs and thus it shouldn't be in it's gimp.desktop, the other way around, changing the file-type configurations is a bit safer because, as someone else posted on those threads from which I've quoted this post, you may well just uninstall gimp (or change gimp.desktop) and then it will try to open the pdf with krita, because the pdf settings are stupid.
    Posted 08-30-2011 at 02:32 PM by the dsc the dsc is offline
  9. Old Comment

    Fixing the annoying firefox' associations issue once and for all

    Thanks for this post. Though I tried using it for PackageKit .catalog files, the web server actually identified the mime type as text/plain so no luck there.

    Anyway, to make it permanent until the package for the program it self is updated, you can edit the desktop file it self for the correct programs.

    Open up
    gimp.desktop and remove "application/pdf" from it's MimeType list.

    Equally so, make sure the same is added to the one you want to use.

    The next program that installs a desktop file will then run the program to re-cache the info in the desktop files. I'm not sure how it decides on the order though. As mine goes "calibre-gui, evince, calibre-ebook-viewer" So alphabetical order is not a priority. In the same directory, there is also a default.list file that contains entries as well. Not sure what writes that file.... It' might be part of xdg-mime. On top of that, there is another file that gets edited by various things in ~/.local/share/applications/mimeapps.list

    So... yeah... lots of modifications to consider. The best bet, I would hope, is to default it in the user's home directory... but if you are using xdg-mime, that's probably where it set it and firefox is reading the other settings in the applications directory.... Or gimp is listed first in file the user's home...
    Posted 08-20-2011 at 12:29 AM by lumak lumak is offline
  10. Old Comment

    Notes on how I may have managed to get wacom tablet to work on Arch, before I completely forget it

    It turns out that I had to eventually add the same file on Debian, apparently after a GTK wacom settings GUI messed with my configuration -- after not being able to apply any settings at all (that's probably my fault though, the app was not made for debian).
    Posted 03-01-2011 at 09:53 AM by the dsc the dsc is offline

  



All times are GMT -5. The time now is 08:39 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration