The best place to ask programming/development questions, imo. UPDATE: stackoverflow is the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but a great reference for finding answers.

My Music (Nickleus)

20120615

automatically connect to remote server by ssh then perform remote commands using expect script


first you need to install expect:
sudo apt-get install expect
then create a new expect script file:
nano -w expect_ssh.exp
and give it this code:
#!/usr/bin/expect
eval spawn ssh -oStrictHostKeyChecking=no -oCheckHostIP=no myuser@myremoteserver.example.com
# i know that the remote shell uses $ at the end of their prompt
set prompt "\\$"
expect "*?assword:*"
send -- "mySecretPassword\r"
interact -o -nobuffer -re $prompt return
send -- "rm -f remote_file_to_be_deleted.txt\r"
interact -o -nobuffer -re $prompt return
make the script executable:
chmod +x expect_ssh.exp
run the script like this:
./expect_ssh.exp

thanks to:
http://bash.cyberciti.biz/security/expect-ssh-login-script/
http://stackoverflow.com/questions/4780893/use-expect-in-bash-script-to-provide-password-to-ssh-command
man expect (huge man page, lots to read)

domeneshop - Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

this morning on the train a customer called and told me our company site was down. we use wordpress, hosted on domeneshop.no.

when i went to the site all i got was a blank white page with:
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
i hadn't changed anything recently with the website configuration so i found this:
https://www.domeneshop.no/faq.cgi?id=207&session=c577762610996232

they had recently been upgrading servers from php 5.2 to php 5.3, so after a lot of frantic googling i finally figured out that i just had to remove my php.ini file. it was incompatible with the new version of php.

now everything seems to be working again =)

20120614

how to install internet explorer 8 (IE8) on ubuntu 12.04: playonlinux


do this in a terminal:
wget -q "http://deb.playonlinux.com/public.gpg" -O- | sudo apt-key add -

sudo wget http://deb.playonlinux.com/playonlinux_precise.list -O /etc/apt/sources.list.d/playonlinux.list

sudo apt-get update

sudo apt-get install playonlinux

then start playonlinux and click Install, then type "internet" in the search box and choose IE8. i chose to not install updates when asked and not to restart.


source:
http://www.playonlinux.com/en/download.html

20120613

restrict non-authorized users from viewing list of svn repositories in apache


i've setup subversion so that each project is its own repository, so there's a list of repositories in /srv/svn/repos.

the configuration below restricts listing the repo names from non-auth'ed users while auth'ed users can see the list.

/etc/apache2/sites-available/default-ssl.svn:
####################
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin webmaster@localhost

DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

LogLevel warn

CustomLog /var/log/apache2/ssl_access.log combined

SSLEngine on

SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key


# requires alias mod: sudo a2enmod alias
# without this, if you try to list repos by visiting /repos instead of /repos/, you'll get an error
Alias /repos "/srv/svn/repos/"


        <Location /repos/>
                DAV svn
                SVNParentPath /srv/svn/repos
                AuthzSVNAccessFile /srv/svn/repos/repo1/conf/authz
                SVNListParentPath on
                AuthType Basic
                AuthName "My Company Repository"
                AuthUserFile /etc/subversion/passwd
                Require valid-user
        </Location>

SSLOptions +StrictRequire

</VirtualHost>
</IfModule>
####################


/srv/svn/repos/repo1/conf/authz:
####################
[groups]
super_devs = superuser1, superuser2
restricted_devs = restricteduser1, restricteduser2

[/]
@super_devs = rw
@restricted_devs =

[repo1:/branches/branchForRestrictedUsers]
@restricted_devs = rw

[repoForRestrictedUsers:/]
@restricted_devs = rw
####################


MODS ENABLED

ls /etc/apache2/mods-enabled/:
alias.conf  auth_basic.load  authz_host.load  autoindex.conf  dav.load      dav_svn.load  dir.load  mime.conf  rewrite.load   setenvif.load  ssl.load
alias.load  authn_file.load  authz_user.load  autoindex.load  dav_svn.conf  dir.conf      env.load  mime.load  setenvif.conf  ssl.conf



i've posted this solution here:
http://www.svnforum.org/threads/35420-SVNListParentPath-AuthzSVNAccessFile-conflict/page2?s=3706b24889a40489495e5155473d0a86
but i'm waiting for a mod to approve my post.

also useful:
http://svnbook.red-bean.com/en/1.4/svn.serverconfig.pathbasedauthz.html