Sam Rose's blog
Use Perl to find and replace
Submitted by Sam Rose on Mon, 07/05/2010 - 03:28perl -pi -e "s/findtext/replacetext/g" *.txt
Deploy Drupal sites to remote server with GIT and Capistrano
Submitted by Sam Rose on Thu, 07/01/2010 - 06:25Follow the instructions here for creating users on source server:
http://mattrude.com/2009/07/creating-a-secure-git-repository-server/
(ignore the rest of instructions on that blog post)
Capistrano set up will then be the same as http://socialsynergyweb.org/network/blog/building-capistrano-recipe-rail...
example:
Running git commands, etc
capfile would run http://en.wikipedia.org/wiki/Secure_copy command from destination to secure copy over db dump.
PHP code for Mediawiki Auth via API
Submitted by Sam Rose on Mon, 06/07/2010 - 22:00adapted from: http://www.mwusers.com/forums/showthread.php?11287-Website-Login-with-AP...
<?php $ch=curl_init(); $postfield = "lgname=$username&lgpassword=$password"; $url = "http://localhost/wiki/api.php?action=login"; //url to wiki's api curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postfield); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); preg_match_all('/^Set-Cookie: (.*?)=(.*?);/m', curl_exec($ch), $m); curl_close($ch);
undo apt-get or aptitude build-deps
Submitted by Sam Rose on Sat, 05/29/2010 - 21:34sudo aptitude markauto $(apt-cache showsrc YOUR_APP_NAME | grep Build-Depends: | sed -e 's/Build-Depends:\|,\|([^)]*)//g')
Create login redirect in blocks Drupal 6.x
Submitted by Sam Rose on Sun, 04/18/2010 - 00:00if(!$user->uid){ drupal_get_path_alias($_GET['q']).' ">Login</a></li>'; $my_string = "Login"; $my_path = 'http://example.com/user/login?destination='. drupal_get_path_alias($_GET['q']);
(it is better if path is NOT hardcoded in $my_path)
Recursively find and replace across files using sed
Submitted by Sam Rose on Thu, 03/18/2010 - 06:59find ./* -type f -exec sed -i 's/oldstring/newstring/g' {} \;Install Confluence Ubuntu Karmic Koala 9.10
Submitted by Sam Rose on Wed, 11/18/2009 - 01:01Currently following http://confluence.atlassian.com/display/DOC/Installing+Confluence+Standa...
Passenger Apache Settings example
Submitted by Sam Rose on Tue, 11/10/2009 - 23:19<VirtualHost *:80> ServerName domain.com DocumentRoot /home/path/to/railsapp/public Options +FollowSymLinks +ExecCGI RailsEnv development </VirtualHost>
wagn action mailer settings
Submitted by Sam Rose on Tue, 10/27/2009 - 07:34The following goes into wagn.rb file (not environment.rb)
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "localhost",
:port => "25",
:domain => "mydomain.org",
}Install python-igraph Ubuntu 9.04 64 bit
Submitted by Sam Rose on Wed, 10/21/2009 - 21:05Download python-igraph nightly from http://code.google.com/p/igraph/downloads/list
tar xfvz the tar.gz your download
First, make sure you added the following line to your /etc/apt/sources.list:
deb http://cneurocvs.rmki.kfki.hu /packages/binary/
deb-src http://cneurocvs.rmki.kfki.hu /packages/source/
Invoke apt-get update as root to update the package list, then fetch the source code and let Ubuntu build a package:
apt-get build-dep igraph && apt-get -b source igraph
