Author Archives: Gen2ly

Improve flash performance (a bit, maybe)

Header

I’ve been struggling with flash quite a bit. I like to watch flash videos online because the time I’m able to get to them are usually at odd times of the day. The issue with flash (I’m using the 64bit alpha but think this effects other versions too) is that higher definition flash can often become choppy, and tear – particularly in fullscreen. I read that this has to do with how flash uses Xvideo. I’ve tried numerous hacks I’ve seen around but none that have worked. Flash 64bit alpha has been around coming on 10 months now so hopefully we’ll see an update soon, but until then I did find something that might improve your flash performance a bit. This I found while going through the Ubuntu forums – (thanks to Labello who figured it out). This is just a simple xorg server edit that may on some systems be already enabled. Flash appears to require a couple options that some xorg.confs may not provide. To give an idea on performance, 1080 flash video before was unwatchable sometimes giving me as low as 1 frame every five seconds and 720 video would tear at times. With the edit, low motion 1080 video (yeah I know) like Law and Order is mostly tolerable and 720 is playing without a problem. To get these benefits (will vary from system to system) be sure that these settings are in your xorg.conf and then restart the xorg server.

Section "Extensions"
  Option      "Composite"     "Enable" # for 3D, alpha desktop effects
EndSection

Section "DRI"
  Mode 0666                            # helps flash performance
EndSection

There’s also an edit on the link about overriding gpu checks. I think that this may help a bit, but it could just be my imagination :), not sure.

Update: For KDE 4 users as of 08-10-2009 QT’s glib support can cause some hang on videos. Either put in your ~/.bashrc or run this before you start you browser should be able to help flash performance:

export QT_NO_GLIB=1

Apple Trailers Fix

HeaderAs some of you may have found out or read about, Apple trailer downloads for Linux are currently broken. Apple has implemented a Quicktime user agent check prior to downloading. Personally I agree with the decision because Apple is concerned about the quality of reproduction (though Apple trailers still play with an odd hue on Windows – think this has to do with Quicktime not correctly reading Window’s color setting – but I’m getting off topic). This means that movie players plugins for web browsers (like gecko-mediaplayer and totem) will no longer work. Until gstreamer gets a patch that fix’s this, here’s a script that can download them manually. To use the script, right-click on the download link and copy it to the clipboard then append it after the atget script.

You can comment wget line and uncomment the mplayer line to directly play the trailer. The mplayer line needs to have a cache to be sure the video is downloaded before it start or errors will occur (200MB should be enough for just about and video on the site).

Credits

  • Thanks to Ian on stack overflow, who help me figure out how to prepend a regex search.

Installing Perl Modules Manually

HeaderIf you do Perl programming or if a program you have needs a perl module, you could download and compile it manually but the easier way would be to use CPAN (the Comprehensive Perl Archive Network).

CPAN

First thing you should do is see if your distribution has it in it’s packages repository so that it can be easily added/removed. If it isn’t, be sure you have perl installed and start the cpan shell:

perl -MCPAN -e shell

Then upgrade the local CPAN module database:

install Bundle::CPAN
reload cpan

Then to install (for example HTML::Template):

install HTML::Template
exit

Once the database is downloaded you don’t need to use the shell anymore to add a module:

perl -MCPAN -e 'install HTML::Template'

Kmix Gets Support for OSSv4

Up until now, KDE 4 users have had to use OSSv4 own sound mixer (ossxmix) to change volumes levels while within KDE. Recently though preliminary support for OSSv4 has been built into kmix.

Testing

The Open Source Sound system is a sound system for *nix operating systems built on the original OSS format. A number of users have requested OSSv4 support in kmix for the last year. OSSv4 has now been added to the trunk of the kmix svn. I compiled kmix and tested it.

And it works pretty good.

I’ve built a PKGBUILD for Arch linux. If you’d like to compile it take a look at that for instructions.

What doesn’t work

  • Multimedia keys won’t be able to change volume and if you push them enough kmix magically disappears.
  • No support for adjusting program volumes levels.

Thanks for the KDE developer(s) work for helping get OSS back into KDE 4.

A Better Link

Update: This script has been updated, look at it, here.

Dedicated Home Partition

Header

Intro

How to use the same home partition for reinstalling a distro or using a new distro but wanting to use the same home partition (i.e. preferences, Documents…)

Before Installing

Find the user and group id’s (uid and gid) on your current distro before reinstalling/adding new distro and write them down:

id

And the username of your regular user:

whoami

Get your home partition fstab entry:

grep home /etc/fstab

If your fstab uses a UUID, keep in mind that this will change if you change your partition map.

Note: If only wanted to change the permissions on the home partition to match a new install, see the final step.

Install

During the installation process the you will be asked about partitioning. You should not partition unless you know what you are doing. Some distro’s will safely allow resizing and adding new partitions. Some partitions tools can safely shrink, expanded, and add new partition. If you need a new partition or a reorganization of partitions consider adding gparted to the installer CD if it isn’t already and partitioning with that.

When you got your disk partitioned, start the installer and manually set the partitions you plan to use. Don’t use the dedicated home partition or the installer will likely erase it. Also during the install don’t use the username from your previous install, likely the installer will choose a different uid and gid so this is best not to, later matching id’s will be set. Finish installation and reboot.

After Reboot

Exit if automatically logged in and goto console Ctl+Alt+F1. Log in as root (or ‘su -‘ to root from regular user if on Ubuntu) and find out what the newly created user uid/gid is.

id <new-username>

Keep a note of the groups the distro added and also be sure the new user didn’t get the same uid as the one you already had.

Add a new user:

adduser

For username select your old username, for uid match the old one. If you’d like to prevent possible uid conflicts in the future, consider using a higher uid like 1050. Enter gid to match the one you are using on the new system. Then add the groups that match the user that the distro created.

You can also use the useradd command but I find the former easier. For example on my gentoo system (careful though as groups may vary from system to system):

useradd -d /home/user --uid 1050 -G adm,audio,cdrom,cdrw,fcron,portage,users,usb,video,wheel -s /bin/bash

Delete distro created user:

userdel <username>

And delete the folder in the home directory for that user:

rm -rf /home/*

This will delete everthing in the home folder (it is not sane to mount a partition on an folder containing contents.)

Add home partition to fstab

Add the home partition to be loaded at boot (if already not added). For example:

nano /etc/fstab
...
/dev/sda5 /home       ext4    defaults   0 1

Besure to enter the correct filesytem type and settings.

Now reboot and login to your new user.

Match your home partition to your new distro ids

Warning: If you’ve done the above you’re already done, don’t this.

Mount the home partition and change to the directory of the dedicated home partition:

mount /dev/<home-partition>
cd /mnt/<home partition>

Then change the old user and group id’s to the new one:

find . -uid <old-uid-number> -gid <old-gid-number> -exec chown -h <username>:<usergroup> {} +

This will change permissions on all files/folders/links that have both the old uid number and gid number. Some (very few) files will not match but most programs will eventually write to them and update them. To update all file/folders/links:

find . -exec chown -h <username>:<usergroup> {} +

Desktop Yank

Every now and then I get the urge to put up my desktop, so here it is. Not much different (like the kcheckgmail and ktorrent thing). Haven’t got to updating to 4.3 yet because I’m going to have to do a full reinstall soon (don’t really need RTM anyhow). I got a computer that didn’t come with install disks for Vista so I gotta find a way to restore vista from the restore disks created by the emachines restore program (phew). I also got a partition at the beginning of the drive called PQSERVICE that I have no idea what it does. To my dismay I have previously tried to use the restore vista disks and got a big fail. Don’t think the program is able to wipe the disk with Linux partitions. Drat. Anyways, before I veer too far, here’s my desktop:

Clean

Dirty

Ok, I lied. Just updated:

Not too bad. KDE 4.3 doesn’t start up as fast but that might be because I’m still using the same ~/.kde4 folder. Doesn’t really have to tools I need yet (web browser, sound-recorder, network manager…) but a few good bugs got rid, so it’s a good update.

Week of bash scripts – rps and commentstrip

These two scripts will respectively: find if a program is running, and strip-comments from text files. The first is useful if you need to see if the program is running or if you need to kill the process with it’s id, comment strip is a good tool to use if posting configurations on forums as often developers or advanced users already know what the settings actually do.

rps

aspire ~/.scripts:
rps geany
todd      1827  0.1  0.3 184576 28616 ?        S    May31   1:05 geany

commentstrip

Commentstrip will display the output to the terminal. If you got xclip installed the ‘c’ option can be used to copy the output to the clipboard.

The final day of week of bash scripts… phew! I’d like to thank everyone that posted comments, and to those that stopped by this week.

Week of bash scripts – grok and cdf

These two scripts are two different find commands. The first (grok) will list all files in a directory recursively that contain a matched string; the second will locate a file/folder and the change to it’s directory. Neither of these are mine (though slightly edited), I’ve gotten them from the Arch forums where they have a great thread called Post your handy self made command line utilities.

Grok

This one is by rebugger and I call it grok. Syntax is:

grok <string> <*location>

If no location is given it uses the current directory.

aspire ~:
grok 127.0.0.1 /etc/
 Searching...
/etc/dnsmasq.conf
/etc/dnsmasq.conf.pacorig
/etc/hosts
/etc/NetworkManager/dispatcher.d/localhost-prepend
/etc/ntp.conf
/etc/resolv.conf
/etc/security/access.conf
/etc/xinetd.d/servers
/etc/xinetd.d/services

cdl

This one is by segoe that uses locate to find a file and that cd’s to the first match found.

aspire ~/.scripts:
cdl demo/PKG
aspire ~/.arch/pkgbuilds/amnesia-demo:

This one put in your ~/.bashrc:

cdf () { cd "$(dirname "$(locate -i "$*" | head -n 1)")" ; } # locate then cd

Week of bash scripts – newx and bgcmd

Header

Here are two scripts: one, that helps improve gaming performance, and the other to free up the terminal. I’ve talked about the later before, but I got a new trick up my sleeve. However, before I go any further, I’d like to point out how to use bash scripts so that they are easily accessible, yet (at the same time) out of the way.

Organization

I like to keep my bash scripts out of plain view. Some people like to put their bash scripts in a folder called scripts in their home folder. This works good but keeping the home folder just for documents can help reduce clutter:

Think about putting your scripts in a hidden directory in your home folder. For example, I use a folder called ~/.bin. To make the scripts executable anywhere, create a path to them in your ~/.bashrc:

export PATH="/home/gen2ly/.bin:$PATH

To quickly enter the script directory, you might want to create an alias to it:

alias cdb="cd /home/gen2ly/.bin && ls -h"

Now, reload the bash environment:

source ~/.bashrc

To get to your script directory you can now just do:

After you create a script or download one, it will need to be made executable. You can do this by:

chmod +x script-name

NewX

A basic script but useful for gamers that don’t have the most powerful graphic cards. Compositing can zap game performance pretty thoroughly. Rather than digging through menus and disable compositing this command will just start a new xorg server:

#!/bin/bash

DISPLAY=:1.0

xinit $* -- :1

By typing newx a new xorg server will be opened on the eighth virtual console (Ctl+Alt+F8). This will also open a terminal where commands can be entered. Typing exit will exit the new xorg server and return you to your original. Alternatively you can type newx urbanterror and urbanterror will be loaded.

Bgcmd

bgcmd will background a program so that it doesn’t overtake the terminal. I’ve written about this before but I’ve discovered how to add bash-completion to it. I’ve updated the page to reflect such:

Background a Process

Enjoy!

A week of bash scripts – Pack

Hello blogweb, this week I’ll be posting some of my bash scripts that I use on a regular basis. To begin:

Pack

I tend to do quite a bit of compressing files for uploading and I cannot always seem to remember the options and order of those options that tar needs. So I built a bash script that does it for me. I call it pack and it’s syntax is:

pack <file1> <folder1> ...
Follow

Get every new post delivered to your Inbox.

Join 52 other followers