Friday 5 December 2008

smb.conf

# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options (perhaps too
# many!) most of which are not shown in this example
#
# Any line which starts with a ; (semi-colon) or a # (hash)
# is a comment and is ignored. In this example we will use a #
# for commentry and a ; for parts of the config file that you
# may wish to enable
#
# NOTE: Whenever you modify this file you should run the command #"testparm" # to check that you have not made any basic syntactic #errors.
#
#======================= Global Settings =====================================
[global]

workgroup = home
netbios name = mistervole
server string = mistervole

# Logging Options:
# this tells Samba to use a separate log file for each machine
# that connects

log file = /var/log/samba/log.%m

# Put a capping on the size of the log files (in Kb).
max log size = 50

hosts allow = 192.168.1.100 192.168.1.101 192.168.1.102 192.168.1.103 127.

# Security mode. Most people will want user level security. See
# security_level.txt for details.

security = user

# Password Level allows matching of _n_ characters of the password for
# all combinations of upper and lower case.

password level = 8

# You may wish to use password encryption. Please read
# ENCRYPTION.txt, Win95.txt and WinNT.txt in the Samba documentation.
# Do not enable this option unless you have read those documents
# Encrypted passwords are required for any use of samba in a Windows NT domain
# The smbpasswd file is only required by a server doing authentication,
# thus members of a domain do not need one.

encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd

# Browser Control and Networking Options:
# Most people will find that this option gives better performance.
# See speed.txt and the manual pages for details

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

# DNS Proxy - tells Samba whether or not to try to resolve NetBIOS
# names via DNS nslookups. The built-in default for versions 1.9.17 is
# yes, this has been changed in version 1.9.18 to no.

dns proxy = no

#============================ Share Definitions ==============================

[homes]
comment = Home Directories
browseable = no
writable = no

# This one is useful for people to share files
;[tmp]
; comment = Temporary file space
; path = /tmp
; read only = no
; public = yes

# A publicly accessible directory, but read only, except for people in
# the "staff" group
;[public]
; comment = Public Stuff
; path = /home/samba/public
; public = yes
; writable = no
; write list = @staff
# Audited directory through experimental VFS audit.so module:
# Uncomment next line.
; vfs object = /usr/lib/samba/vfs/audit.so

[photos]
path = /usr/share/data/photos
valid users = user1
public = no
writeable = yes
browseable = yes
available = yes
guest ok = no

[music]
path = /usr/share/data/music
valid users = user1
public = no
writeable = yes
browseable = yes
available = yes
guest ok = no

[video]
path = /usr/share/data/video
valid users = user1 user2
public = no
writeable = no
browseable = yes
available = yes
guest ok = no

-----------------------------------------------------------
# A private directory, usable only by Fred. Note that Fred requires
# write access to the directory.

;[fredsdir]

# [Agustin]
; comment = Fred's Service
# comment = Agustin Private Files
; path = /usr/somewhere/private
# path = /home/agustin/Documents
; valid users = fred
# valid users = agustin
; public = no
; writable = yes
# writable = yes
; printable = no

Monday 26 May 2008

.lircrc config file goes in ~

For Totem, VLC and Rhythmbox

---------------------------------------------------------

# lircrc for iMON
#
# To check button names on your remote, make sure lircd is running and run irw
# Pressing buttons will show the appropriate button name
#

# Non-program specific
#

# Command bindings

begin irexec

begin
button = MyMovie
prog = irexec
repeat = 0
config = vlc
mode = vlc
end

begin
button = MyMusic
prog = irexec
repeat = 0
config = rhythmbox
mode = rhythmbox
end

end irexec

##############################################
### Rhythmbox juke box player
###############################################

begin rhythmbox

begin
button = MyMovie
prog = irexec
repeat = 0
config = totem
mode = totem
end

begin
button = MyMusic
prog = irexec
repeat = 0
config = rhythmbox
mode = rhythmbox
end

begin
prog = Rhythmbox
button = AppExit
config = quit
flags = mode
end

begin
prog = Rhythmbox
button = Play
config = play
end

begin
prog = Rhythmbox
button = Pause
config = pause
config = play
repeat = 0
end

begin
prog = Rhythmbox
button = Stop
config = stop
end

begin
prog = Rhythmbox
button = Vol+
config = volume_up
repeat = 3
end

begin
prog = Rhythmbox
button = Vol-
config = volume_down
repeat = 3
end

begin
prog = Rhythmbox
button = NextChapter
config = next
end

begin
prog = RhythmBox
button = PrevChapter
config = previous
end

begin
prog = RhythmBox
button = Mute
config = mute
end

begin
prog = RhythmBox
button = Eject
config = shuffle
end

begin
prog = RhythmBox
button = FastForward
config = seek_forward
repeat = 5
end

begin
prog = RhythmBox
button = Rewind
config = seek_backward
repeat = 5
end

end rhythmbox

##############################################
### Totem player
###############################################

begin totem

begin
button = MyMusic
prog = irexec
repeat = 0
config = rhythmbox
mode = rhythmbox
end

begin
button = MyMovie
prog = irexec
repeat = 0
config = totem
mode = totem
end

begin
prog = Totem
button = AppExit
config = quit
flags = mode
end

begin
prog = Totem
button = Play
config = play
end

begin
prog = Totem
button = Pause
config = pause
config = play
repeat = 0
end

begin
prog = Totem
button = Stop
config = stop
end

begin
prog = Totem
button = Vol+
config = volume_up
repeat = 3
end

begin
prog = Totem
button = Vol-
config = volume_down
repeat = 3
end

begin
prog = Totem
button = NextChapter
config = next
end

begin
prog = Totem
button = PrevChapter
config = previous
end

begin
prog = Totem
button = Mute
config = mute
end

begin
prog = Totem
button = Eject
config = shuffle
end

begin
prog = Totem
button = FastForward
config = seek_forward
repeat = 5
end

begin
prog = Totem
button = Rewind
config = seek_backward
repeat = 5
end

end totem

##############################################
### VLC player
###############################################

begin vlc

begin
button = MyMusic
prog = irexec
repeat = 0
config = rhythmbox
mode = rhythmbox
end

begin
button = MyMovie
prog = irexec
repeat = 0
config = vlc
mode = vlc
end

begin
prog = Totem
button = AppExit
config = key-quit
flags = mode
end

begin
prog = vlc
button = Play
config = key-play-pause
end
begin
prog = vlc
button = Pause
config = key-play-pause
end
begin
prog = vlc
button = Stop
config = key-stop
end
begin
prog = vlc
button = FastForward
config = key-jump+medium
end
begin
prog = vlc
button = forward
config = key-next
end
begin
prog = vlc
button = Rewind
config = key-prev
end
begin
prog = vlc
button = Vol+
config = key-vol-up
repeat = 1
end
begin
prog = vlc
button = Vol-
config = key-vol-down
repeat = 1
end
begin
prog = vlc
button = Mute
config = key-vol-mute
end
end vlc

Thursday 7 February 2008

Readahead for GDM login

From http://ubuntuforums.org/showthread.php?t=565651

PART 1: Profile Login Sequence

First, we need to ask readahead to monitor a login sequence and make note of all the files read during this period. Advanced users may point out that during bootup, there is a GRUB argument "profile" that causes Ubuntu to optimize bootup. We will need to essentially manually replicate what this boot option does, but save the output to a different file.

First, let's store our readahead list into a ~/.readahead directory.

Code:
mkdir ~/.readahead
Now, log out, and press CTRL+ALT+F1 to log into a terminal. Start the profiler:

Code:
sudo readahead-watch -o ~/.readahead/gnome.root /
This will grind the disk for a while (up to a few minutes) then it will return you to a command prompt. The profiler is now in the background watching all actions. Now, without logging out, go to your GDM prompt (ALT+F8 ) and log in normally.

after you are fully logged in, press CTRL+ALT+F1 to go back to your terminal, then run:
Code:
sudo killall readahead-watch
sudo chown jdong:jdong ~/.readahead -R
Replace jdong:jdong with your user and group name. Now, we need to go prune this list a bit. Especially if you have large files on your desktop (like a 1GB AVI), the login sequence may touch it, causing readahead to think it should load the whole thing into memory! In a terminal, run:

Code:
cat ~/.readahead/gnome.root | xargs -i ls -lk {} | sort -rn -k +5 | less
This will display all the files readahead wants to cache, sorted by largest file first. The 5th column (before date) is the size of the file in KB. Make sure there's nothing glaringly large. If it's bigger than 10,000KB or so, it's probably not worth preloading. You can remove unwanted files from the preload list by opening ~/.readahead/gnome.root in your favorite editor, and deleting its line.

If you have home on a different partition as root, you should repeat Part 1 for each partition, replacing gnome.root with a different name, and replacing the mountpoint / with each interested mountpoint.


PART 2: Hooking this into the login sequence.

Next, we need to tell Ubuntu to do this readahead on every login. I am going to use /etc/X11/Xsession.d for this, but if you have another preferred way to execute things before everything loads, be my guest!

Create a file called /etc/X11/Xsession.d/00readahead and put this in it:
Code:
for list in ~/.readahead/*; do
readahead-list $list &
done

wait
Save the file. Now, you can reboot to try it out. You will notice the login
"hang" at the orange screen while the disk works without much grinding, then once that is done the bootup should soar as if it were a fully cached login. This brings my login session to around 30 seconds, a notable improvement.

PART 3: Hook into bootup sequence

Often times, we don't log in immediately when the prompt comes up. We might be getting a cup of coffee, or an entire lab might be turned on before students arrive. It makes sense to cache a login as a part of bootup. Open up /etc/rc.local in your favorite text editor, and before the exit 0 statement, add:
Code:
for list in /home/jdong/.readahead/*; do
readahead-list $list
done
Note you need to hard-code a particular user in there, and this time we don't background it. (We could, but there is not much motivation to)

Now, reboot, and wait for all disk activity to stop before logging in. This
time, I get a login speed of 19 seconds.

You might have two common questions at this point:

1. How much time does it take to call readahead again on files that have been cached once already? About 0.05 seconds to call readahead on the same list a second time

2. How much overhead does it add to bootup if the background readahead was still going, and you tried to log in? About 2 seconds on my setup


CONCLUSION:

In my case, applying this readahead hack lead to a 10-second improvement in login speed in the worst-case scenario, and a remarkable doubling in login speed when the system idles at the login prompt for a few seconds.

This is a pretty appreciable improvement and it would be nice if a nicer version of this hack can be added to Ubuntu. The basic idea should be fairly simple to adapt to an /etc/readahead/readahead.gnome file representative of the default system and hooked by an Xsession.d script.

Potential follow-ups?

Many more applications come to mind as taking a long time to load while the disk grinds (Firefox? Openoffice? Eclipse?). You can use a procedure very similar to this to write a "wrapper script" that first performs a readahead-list call on a list, then call the application with the original arguments. I'd be interested to hear of any improvements gained by that method.

Undoing This Tip

Remove, remove, remove! Delete the ~/.readahead directory, delete /etc/X11/Xsession.d/00readahead, and delete the line you added to /etc/rc.local

Sunday 3 February 2008

lirc config

Save as .lircrc in ~

# lircrc for iMON
#
# To check button names on your remote, make sure lircd is running and run irw
# Pressing buttons will show the appropriate button name
#

# Non-program specific
#

# Command bindings

begin irexec

begin
button = MyMovie
prog = irexec
repeat = 0
config = totem
mode = totem
end

begin
button = MyMusic
prog = irexec
repeat = 0
config = rhythmbox
mode = rhythmbox
end

end irexec

##############################################
### Rhythmbox juke box player
###############################################

begin rhythmbox

begin
button = MyMovie
prog = irexec
repeat = 0
config = totem
mode = totem
end

begin
button = MyMusic
prog = irexec
repeat = 0
config = rhythmbox
mode = rhythmbox
end

begin
prog = Rhythmbox
button = AppExit
config = quit
flags = mode
end

begin
prog = Rhythmbox
button = Play
config = play
end

begin
prog = Rhythmbox
button = Pause
config = pause
config = play
repeat = 0
end

begin
prog = Rhythmbox
button = Stop
config = stop
end

begin
prog = Rhythmbox
button = Vol+
config = volume_up
repeat = 3
end

begin
prog = Rhythmbox
button = Vol-
config = volume_down
repeat = 3
end

begin
prog = Rhythmbox
button = NextChapter
config = next
end

begin
prog = RhythmBox
button = PrevChapter
config = previous
end

begin
prog = RhythmBox
button = Mute
config = mute
end

begin
prog = RhythmBox
button = Eject
config = shuffle
end

begin
prog = RhythmBox
button = FastForward
config = seek_forward
repeat = 5
end

begin
prog = RhythmBox
button = Rewind
config = seek_backward
repeat = 5
end

end rhythmbox

##############################################
### Totem player
###############################################

begin totem

begin
button = MyMusic
prog = irexec
repeat = 0
config = rhythmbox
mode = rhythmbox
end

begin
button = MyMovie
prog = irexec
repeat = 0
config = totem
mode = totem
end

begin
prog = Totem
button = AppExit
config = quit
flags = mode
end

begin
prog = Totem
button = Play
config = play
end

begin
prog = Totem
button = Pause
config = pause
config = play
repeat = 0
end

begin
prog = Totem
button = Stop
config = stop
end

begin
prog = Totem
button = Vol+
config = volume_up
repeat = 3
end

begin
prog = Totem
button = Vol-
config = volume_down
repeat = 3
end

begin
prog = Totem
button = NextChapter
config = next
end

begin
prog = Totem
button = PrevChapter
config = previous
end

begin
prog = Totem
button = Mute
config = mute
end

begin
prog = Totem
button = Eject
config = shuffle
end

begin
prog = Totem
button = FastForward
config = seek_forward
repeat = 5
end

begin
prog = Totem
button = Rewind
config = seek_backward
repeat = 5
end

end totem

Sunday 13 January 2008