Friday, February 27, 2009
Turning off the PC Speaker on Ubuntu
modprobe -r pcspkr
Friday, February 6, 2009
Deleting files/folders with the same name characteristics in Linux
Here goes the trick and the explanation will follow it.
find /path/projectFolder -type d -name '.svn' | xargs rm -rf
Notice that we start this batch of commands with the find command. The find command takes 3 arguments. The find command will go through all directories and subdirectories starting from the path specified.
The first argument is the path to the folder where you want to perform the lookup of the file/folder. That's pretty straight forward
The second argument is the option "-type" where you define whether you are looking up a file or a directory. In the example given above I defined the type as being a directory. If I wanted to do a lookup for a file I would have an "f" there rather than a "d".
The third argument is the option "-name" where you define the name of the file or folder you want to look for enclosed by single quotes. You can also use wildcards in the name.
The second command I want to talk about is the rm -rf. This command removes all folders that are empty or has something in it.
Now here comes the trick. Every line that the find command returns is passed in to rm -rf through | xargs.
Now, having that in mind if you read from right to left this line commands should make more sense to you.
Google the commands find and xargs to see some cool stuff that you can do with them.
Hope this helps!
Thursday, November 6, 2008
Installing code repository subversion (SVN) on Linux Ubuntu
sudo apt-get install subversion libapache2-svn
We're going to create the subversion repository in /svn, although you should choose a location that has a good amount of space.
sudo svnadmin create /home/svn
Next we'll need to edit the configuration file for the subversion webdav module. You can use a different editor if you'd like.
sudo vim /etc/apache2/mods-enabled/dav_svn.conf
The Location element in the configuration file dictates the root directory where subversion will be accessible from, for instance: http://www.server.com/svn
The DAV line needs to be uncommented to enable the dav module
#Uncomment this to enable the repository
DAV svn
The SVNPath line should be set to the same place your created the repository with the svnadmin command.
#Set this to the path to your repository
SVNPath /home/svn
The next section will let you turn on authentication. This is just basic authentication, so don't consider it extremely secure. The password file will be located where the AuthUserFile setting sets it to
#Uncomment the following 3 lines to enable Basic Authentication
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
To create a user on the repository use, the following command:
sudo htpasswd -cm /etc/apache2/dav_svn.passwd
Note that you should only use the -c option the FIRST time that you create a user. After that you will only want to use the -m option, which specifies MD5 encryption of the password, but doesn't recreate the file.
Restart apache by running the following command:
sudo /etc/init.d/apache2 restart
Now if you go in your browser to http://www.server.com/svn, you should see that the repository is enabled for anonymous read access, but commit access will require a username.If you want to force all users to authenticate even for read access, add the following line right below the AuthUserFile line from above. Restart apache after changing this line.
Require valid-user
Now if you refresh your browser, you'll be prompted for your credentials.Credit goes to Jason Meridith (http://www.lostechies.com/blogs/jason_meridth/)