Red Hat Enterprise Virtualization Log Collector extractor
Wow, it’s been over a year since I’ve posted anything here. Been busy with work and life.
Here’s a script called rhevx that I created to painlessly extract the logs gathered by the Log Collector Utility shipped with Red Hat Enterprise Virtualization Manager 2.x
http://wiki.control-d.com/index.php?title=Red_Hat_Enterprise_Virtualization_Log_Collector_extractor
If you’re curious enough to try to sift through the logs yourself here is some information from the RHEV Administration Guide that explains some of the more important logs:
You can also find help over IRC on Freenode in #rhev
Updated hilightphrase XChat plugin
I finally found some free time and updated my hilightphrase XChat python plugin.
The Changes:
1. When listing out the highlighted strings, they are displayed in a separate tab instead of the current tab
2. The list of phrases contains are numbered so that you can delete them using the index instead of typing to whole string back out
3. Added a help command for a short explanation of each command
4. There is only one command now, /hilight, that accepts the options like “add”, “help”, “list”, etc.
Updated my wiki
I finally updated my wiki page, Ubuntu Jaunty Jackalope (9.04) on a Toshiba Protege M400, with more information on rotating the screen, and how to get the fingerprint scanner working.
Ubuntu Firefox/Shiretoko 3.5 and User Agent string
I installed the firefox-3.5 package in Jaunty and found that the facebook chat applet on their page stopped working. It seemed to think I was running an outdated browser. A quick google search came up with a result: http://rrenomeron.wordpress.com/2009/07/07/ubuntus-firefox-3-5-and-facebook-chat/
I could’ve installed the addon, but there’s an easy, simpler way:
- Type about:config in the browser url bar
- Type useragent into the filter bar
- Edit the general.useragent.extra.firefox and change Shiretoko to Firefox, leaving the rest of the value the same
Ubuntu Jaunty Jackalope (9.04) on a Toshiba Protege M400
Sorry it took me so long, but I’ve updated my wiki with information on how to get most everything working on the tablet. The wacom tablet works out of the box now with no xorg.conf, but it took me a little while to figure out where all of the devices were being created and what they were now called.
http://wiki.control-d.com/index.php?title=Ubuntu_Jaunty_Jackalope_(9.04)_on_a_Toshiba_Protege_M400
XChat notification and highlighting on phrases instead of single words
I wrote the following xchat plugin after they decided to “fix” the Extra words to highlight feature in XChat 2.8.6
The python plugin can be downloaded here
__module_name__ = 'hilight-phrase' __module_description__ = 'XChat notification and hilighting on phrases instead of single words' __module_version__ = '2.0' import xchat, os, re CONFFILE = os.environ['HOME'] + '/.xchat2/hilight-phrase.conf' list=[] xchat.prnt('%(name)s, version %(version)s' % {'name': __module_name__, 'version': __module_version__}) def read_list(): try: conf = open(CONFFILE,'r') except: xchat.prnt(CONFFILE + " currently doesn't exist, creating") return None lines = conf.readlines() for each in lines: list.append(re.sub(r'\n','',each)) conf.close() def save_list(): conf = open(CONFFILE,'w') for phrase in list: conf.write(phrase + '\n') conf.close() def check_msg(word, word_eol, userdata): for phrase in list: if phrase in word_eol[1].lower(): xchat.command("gui color 3") xchat.emit_print( "Channel Msg Hilight", word[0], word[1] ) return xchat.EAT_ALL return xchat.EAT_NONE def add_hilight_phrase(word, word_eol, userdata): if len(word) == 1: return list_hilight_phrase(word, word_eol, userdata) phrase = word_eol[1] if phrase not in list: list.append(phrase) xchat.prnt('\x032* "%s" will be hilighted' % phrase) else: xchat.prnt('\x032* "%s" is already being hilighted' % phrase) save_list() return xchat.EAT_XCHAT def list_hilight_phrase(word, word_eol, userdata): xchat.prnt('\x032Current hilight-phrase list: %d hilighted.' % len(list)) for phrase in list: xchat.prnt('\x032 -- %s' % phrase) xchat.prnt('\x032* End of hilight-phrase list') return xchat.EAT_XCHAT def remove_hilight_phrase(word, word_eol, userdata): phrase = word_eol[1] if phrase in list: list.remove(phrase) xchat.prnt('\x032 "%s" has been removed from the hilight list' % phrase) else: xchat.prnt('\x032 "%s" is not in the hilight list' % phrase) save_list() return xchat.EAT_XCHAT read_list() xchat.hook_command("hilight-add", add_hilight_phrase) xchat.hook_command("hilight-list", list_hilight_phrase) xchat.hook_command("hilight-remove", remove_hilight_phrase) xchat.hook_print("Channel Message", check_msg)
You can use the plugin by either:
1. manually loading the file through the menu (Windows -> Plugins and Scripts) every time you restart xchat
2. copy the hilightphrase.py to your $HOME/.xchat2/ direcory where it will get loaded automatically when xchat is run.
Once loaded, a /hilight-list will list all of the currently active phrases to highlight. A /hilight-add <phrase> where <phrase> is a string will add the specified phrase to the list. As you can probably guess, a /hilight-remove <phrase> where <phrase> is a currently active phrase will remove it from the list.
Feel free to comment and leave suggestions.
Converting mp3 files to iPhone ringtones in Linux
It should go without saying that with “iPhone” and “Linux” in the same sentence you’ll need a jailbroken phone for this. Use the following commands to dump your mp3 file to WAV then convert it to m4a:
1. mplayer -vo null -vc null -ao pcm:fast:file=file.wav file.mp3
2. faac -b 128 -c 44100 -w file.wav
You’ll end up with a file.m4a file. Once you have the OpenSSH package installed and running on your iPhone you can use the scp command to copy the ringtone to the correct location:
scp file.m4a root@iphone:/Library/Ringtones/file.m4r
The root password by default is “alpine”. As you can see the file will need to be renamed to end in “.m4r” instead of “.m4a” to be used as a ringtone. You’ll now be able to see it listed with the other ringtones under Settings -> Sounds -> Ringtone.
Changing GNOME desktop background based on time of day
This has already been done before, but I wanted to try to do it myself. It turned out a bit more complicated than I thought it would be on Ubuntu 8.10 and Fedora 10 because of the way gconftool-2 now interacts with D-BUS.
First, I created a script that could be used to change in between a set of predefined background images:
#!/bin/bash case $1 in 1) gconftool-2 -t str --set /desktop/gnome/background/picture_filename "/home/derrick/wallpaper/Solar_3200x1200_SunRiseTime.png";; 2) gconftool-2 -t str --set /desktop/gnome/background/picture_filename "/home/derrick/wallpaper/Solar_3200x1200_DayTime.png";; 3) gconftool-2 -t str --set /desktop/gnome/background/picture_filename "/home/derrick/wallpaper/Solar_3200x1200_SunSetTime.png";; 4) gconftool-2 -t str --set /desktop/gnome/background/picture_filename "/home/derrick/wallpaper/Solar_3200x1200_NightTime.png";; *) echo "Usage: bgchange.sh [1|2|3|4]";; esac
Then, using the solution that allows gconftool-2 to communicate using dbus while being run by cron, I created another script:
#!/bin/bash # Export the dbus session address on startup so it can be used by cron touch $HOME/.Xdbus chmod 600 $HOME/.Xdbus env | grep DBUS_SESSION_BUS_ADDRESS > $HOME/.Xdbus echo 'export DBUS_SESSION_BUS_ADDRESS' >> $HOME/.Xdbus # Export XAUTHORITY value on startup so it can be used by cron env | grep XAUTHORITY >> $HOME/.Xdbus echo 'export XAUTHORITY' >> $HOME/.Xdbus
As the post says, I made the script run each time I logged in by selecting System -> Preferences -> Sessions and adding /home/derrick/bin/.make_Xdbus as a Startup program.
Next, I edited by crontab by running ‘crontab -e’ and adding the following jobs:
00 07 * * * . /home/derrick/.Xdbus; /home/derrick/bin/bgchange.sh 1 00 08 * * * . /home/derrick/.Xdbus; /home/derrick/bin/bgchange.sh 2 00 17 * * * . /home/derrick/.Xdbus; /home/derrick/bin/bgchange.sh 3 00 18 * * * . /home/derrick/.Xdbus; /home/derrick/bin/bgchange.sh 4
The /home/derrick/.Xdbus file is created each time I log in after adding the previous script as an entry in Sessions. You can adjust at what time the script changes the background to what picture. If you’re not familiar with crontab syntax you can take a look at the crontab(5) man page using the command ‘man 5 cron’.
Ubuntu Intrepid Ibex (8.10) on a Toshiba Portege M400
I decided to go ahead and do a fresh install of the Intrepid beta and report my results. So far everything but the fingerprint scanner is working.
http://wiki.control-d.com/index.php?title=Ubuntu_Intrepid_Ibex_(8.10)_on_a_Toshiba_Protege_M400