<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>Richard Penman</title>
 <link href="http://richardpenman.info/atom.xml" rel="self"/>
 <link href="http://richardpenman.info/"/>
 <updated>2011-12-26T11:05:44+09:00</updated>
 <id>http://richardpenman.info/</id>
 <author>
   <name>Richard Penman</name>
   <email>richard@sitescraper.net</email>
 </author>

 
 <entry>
   <title>Code paste</title>
   <link href="http://richardpenman.info/Code-paste/"/>
   <updated>2011-12-17T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Code-paste</id>
   <content type="html">&lt;p&gt;Use this service for pasting code with syntax highlighting and even test execution:&lt;br/&gt;
&lt;a href=&quot;http://codepad.org/&quot;&gt;http://codepad.org&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>How to make web2py faster</title>
   <link href="http://richardpenman.info/How-to-make-web2py-faster/"/>
   <updated>2011-11-26T00:00:00+09:00</updated>
   <id>http://richardpenman.info/How-to-make-web2py-faster</id>
   <content type="html">&lt;p&gt;Avoid regenerating tables:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;  
&lt;span class=&quot;n&quot;&gt;db&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DAL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;sqlite://storage.sqlite&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;migrate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;runonce&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Create indexes:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;  
&lt;span class=&quot;n&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;executesql&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;CREATE INDEX IF NOT EXISTS {table}_index ON {table} (id);&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;table&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;table&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Compile byte code in admin&lt;/p&gt;

&lt;p&gt;Serve static files direct from server&lt;/p&gt;

&lt;p&gt;Move as much logic as possible from models into controllers and modules&lt;/p&gt;

&lt;p&gt;Disable session if possible&lt;/p&gt;

&lt;p&gt;Cache database queries and controller functions:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;  
&lt;span class=&quot;nd&quot;&gt;@cache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path_info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;time_expire&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cache_model&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cache&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ram&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;select&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ALL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cache&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cache&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ram&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;



</content>
 </entry>
 
 <entry>
   <title>web2py with uwsgi</title>
   <link href="http://richardpenman.info/web2py-with-uwsgi/"/>
   <updated>2011-11-25T00:00:00+09:00</updated>
   <id>http://richardpenman.info/web2py-with-uwsgi</id>
   <content type="html">&lt;p&gt;I found Apache used too much memory so changed to uwsgi:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# build uwsgi  
hg clone http://projects.unbit.it/hg/uwsgi  
cd uwsgi  
make -f Makefile.Py27  
cd ..

# get web2py  
wget http://www.web2py.com/examples/static/web2py_src.zip  
unzip web2py_src.zip  
cd web2py  
# run web2py rocket server to setup password  
python2.7 web2py.py  
# set your password then kill the server  
cp parameters_8080.py parameters_PORT.py  
cd ..

# start uwsgi with 32 MB of memory, 24 threads, 1 process  
./uwsgi/uwsgi --http=127.0.0.1:PORT --pythonpath /path/web2py --module wsgihandler -d /path/uwsgi.log -t 20 --async 24 --ugreen --limit-as 32 -r --no-orphans -M -p 1 --touch-reload /path/uwsgireload.txt --reload-on-rss 50  

# reload server
touch /path/uwsgireload.txt
&lt;/code&gt;&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>Let webfaction serve your static content</title>
   <link href="http://richardpenman.info/Let-webfaction-serve-your-static-content/"/>
   <updated>2011-11-25T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Let-webfaction-serve-your-static-content</id>
   <content type="html">&lt;p&gt;Create a static symbolic link application:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Name: web2py_static  
App category: Symbolic link  
App type: Symbolic link to static-only app  
App doc: This creates a symlink from ~/webapps/ to theabsolute path specified in the extra info field.  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then in your website mount this at &lt;em&gt;/static&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now requests to static files will be handled directly by webfaction and never reach your app.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>How to determine what Linux is installed</title>
   <link href="http://richardpenman.info/How-to-determine-what-Linux-is-installed/"/>
   <updated>2011-11-25T00:00:00+09:00</updated>
   <id>http://richardpenman.info/How-to-determine-what-Linux-is-installed</id>
   <content type="html">&lt;p&gt;Kernel version:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;uname -r  
2.6.18-238.12.1.el5PAE  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Distribution name:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cat /etc/issue  
CentOS release 5.7 (Final)  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;32 or 64 bit:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;getconf LONG_BIT  
32  
&lt;/code&gt;&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>How to create an image mosaic</title>
   <link href="http://richardpenman.info/How-to-create-an-image-mosaic/"/>
   <updated>2011-11-18T00:00:00+09:00</updated>
   <id>http://richardpenman.info/How-to-create-an-image-mosaic</id>
   <content type="html">&lt;p&gt;For a birthday present I generated an image mosaic using the metapixel command.&lt;br/&gt;
Firstly get atleast 1000 images in [base_image_folder] and sub-directories. Then process the data with:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;metapixel-prepare --width=64 --height=96 -r [base_image_folder] [tmp_thumbnails_dir]  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This processing will take a while.Then generate the mosaic with:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;metapixel -w 48 -h 64 -s 8 --metapixel [image_pattern_for_mosaic] [output_image_file] --library [tmp_thumbnails_dir]  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This should only take a few minutes. For different resolutions change the size flag.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Automatically fix rotation of images</title>
   <link href="http://richardpenman.info/Automatically-fix-rotation-of-images/"/>
   <updated>2011-11-18T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Automatically-fix-rotation-of-images</id>
   <content type="html">&lt;p&gt;My camera stores the orientation of the images in the header, but this is not recognized by most programs.&lt;br/&gt;
You can automatically fix the image rotations with:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;jhead -autorot  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And to recursively rotate all images:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;find . -name &quot;*.JPG&quot; -exec jhead -autorot -exonly {} \;
&lt;/code&gt;&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>GoDaddy domains with webfaction hosting</title>
   <link href="http://richardpenman.info/GoDaddy-domains-with-webfaction-hosting/"/>
   <updated>2011-11-15T00:00:00+09:00</updated>
   <id>http://richardpenman.info/GoDaddy-domains-with-webfaction-hosting</id>
   <content type="html">&lt;p&gt;In your GoDaddy account select &lt;em&gt;Set Nameservers&lt;/em&gt; and then &lt;em&gt;I have specific name serversfor my domains&lt;/em&gt;(&lt;a href=&quot;http://help.godaddy.com/article/664#reghere&quot;&gt;Documented here&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Enter webfaction's domain name servers (&lt;a href=&quot;http://docs.webfaction.com/user-guide/domains.html#pointing-your-domain-to-webfaction-s-servers&quot;&gt;Documented here&lt;/a&gt;):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ns1.webfaction.com  
ns2.webfaction.com  
ns3.webfaction.com  
ns4.webfaction.com  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The docs say to wait atleast 2 hours but I found my website worked immediately.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Downloading data from GAE</title>
   <link href="http://richardpenman.info/Downloading-data-from-GAE/"/>
   <updated>2011-11-11T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Downloading-data-from-GAE</id>
   <content type="html">&lt;p&gt;As &lt;a href=&quot;http://code.google.com/appengine/docs/python/tools/uploadingdata.html&quot;&gt;documented here&lt;/a&gt; you can download your data into a blob:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;appcfg.py download_data --application=[app-id] --filename=[output dump file] --url=http://[app-id].appspot.com/_ah/remote_api  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And then upload to another app:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;appcfg.py upload_data --application=[app-id] --kind=[kind] --filename=[input dump file]  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Or to work with structured data first generate the bulkloader file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;appcfg.py create_bulkloader_config --filename=bulkloader.yaml --url=http://[app-id].appspot.com/_ah/remote_api  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and make sure to set the connectors to CSV&lt;/p&gt;

&lt;p&gt;Then download the data:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;appcfg.py download_data--application=[app-id] --config_file=bulkloader.yaml --filename=[csv file] --db_filename=progress.sql --kind=[which entity]  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;--db_filename is important for large uploads to avoid re-uploading the same data&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Deploying code with rsync</title>
   <link href="http://richardpenman.info/Deploying-code-with-rsync/"/>
   <updated>2011-11-10T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Deploying-code-with-rsync</id>
   <content type="html">&lt;p&gt;I use rsync to deploy code to my web server:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;rsync --recursive --compress \  
--verbose --progress --stats \  
--times --perms --delete \  
--exclude &quot;*~&quot; --exclude &quot;*.pyc&quot; \  
. login@server:path  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This command will transfer the current directory and all sub-directories and files to my server, but only transfer modified files to save time and bandwidth.&lt;br/&gt;
verbose, progress, and stats display useful output&lt;br/&gt;
times / perms ensure the file timestamps / permissions are the same on my server&lt;br/&gt;
delete will delete remote files when deleted locally&lt;br/&gt;
exclude temporary files&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Convert DVD to AVI</title>
   <link href="http://richardpenman.info/Convert-DVD-to-AVI/"/>
   <updated>2011-11-06T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Convert-DVD-to-AVI</id>
   <content type="html">&lt;p&gt;I tried a few programs to burn a DVD and found &lt;a href=&quot;http://sourceforge.net/projects/acidrip/&quot;&gt;acidrip&lt;/a&gt; works best.&lt;/p&gt;

&lt;p&gt;Remember:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;set size to around 1000 for each hour&lt;/li&gt;
&lt;li&gt;turn scale off&lt;/li&gt;
&lt;li&gt;detect the correct crop size&lt;/li&gt;
&lt;li&gt;preview results&lt;/li&gt;
&lt;/ul&gt;

</content>
 </entry>
 
 <entry>
   <title>Code syntax highlighting</title>
   <link href="http://richardpenman.info/Code-syntax-highlighting/"/>
   <updated>2011-11-06T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Code-syntax-highlighting</id>
   <content type="html">&lt;p&gt;I use this when I need to syntax highlight code snippets:&lt;br/&gt;
&lt;a href=&quot;http://tohtml.com/python/&quot;&gt;http://tohtml.com&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Writing in Korean</title>
   <link href="http://richardpenman.info/Writing-in-Korean/"/>
   <updated>2011-11-03T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Writing-in-Korean</id>
   <content type="html">&lt;p&gt;Install ibus, ibus-m17n, ibus-hangul&lt;/p&gt;

&lt;p&gt;Restart system - I couldn't use ibus in Chrome or choose the Romaji keyboard option until restarting&lt;/p&gt;

&lt;p&gt;Ctrl-Space to activate language. Change keyboard to Romaji for English keyboard.&lt;/p&gt;

&lt;p&gt;Scim also has a Korean package but I couldn't get it to activate reliably.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Set linux date</title>
   <link href="http://richardpenman.info/Set-linux-date/"/>
   <updated>2011-08-20T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Set-linux-date</id>
   <content type="html">&lt;p&gt;Use this graphical tool to set the timezone:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo dpkg-reconfigure tzdata
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Or set the time directly with:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo date MMDDhhmmYYYY
&lt;/code&gt;&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>Left hand mouse</title>
   <link href="http://richardpenman.info/Left-hand-mouse/"/>
   <updated>2011-07-31T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Left-hand-mouse</id>
   <content type="html">&lt;p&gt;One of the buttons on my laptop broke so to avoid that key I switched to using a left hand mouse.
Here are the codes for each key:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;xmodmap -pp  
There are 12 pointer buttons defined.

    Physical        Button
     Button          Code
        1              1
        2              2
        3              3
        4              4
        5              5
        6              6
        7              7
        8              8
        9              9
       10             10
       11             11
       12             12
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And here I switch the left and right buttons:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;xmodmap -e &quot;pointer = 3 2 1 4 5 6 7 8 9 11 12 13&quot;
&lt;/code&gt;&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>chrome user agent</title>
   <link href="http://richardpenman.info/chrome-user-agent/"/>
   <updated>2011-05-20T00:00:00+09:00</updated>
   <id>http://richardpenman.info/chrome-user-agent</id>
   <content type="html">&lt;p&gt;Chrome does not currently have a setting or extension to set the user-agent.&lt;/p&gt;

&lt;p&gt;You can however define it with a command line argument:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;chromium-browser --user-agent=&quot;richard&quot;
&lt;/code&gt;&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>Working with large CSV files</title>
   <link href="http://richardpenman.info/Working-with-large-CSV-files/"/>
   <updated>2011-05-02T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Working-with-large-CSV-files</id>
   <content type="html">&lt;p&gt;When working with large CSV files in Python I sometimes get this:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Traceback&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;most&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;recent&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;call&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;last&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;  
&lt;span class=&quot;n&quot;&gt;File&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;stats.py&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt;   
&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;row&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;enumerate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;csv&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;reader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;filename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))):&lt;/span&gt;  
&lt;span class=&quot;n&quot;&gt;_csv&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;field&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;larger&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;than&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;field&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;limit&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;131072&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;This means the CSV file contains more content between delimiters that allowed by default. To raise this limit use:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;sys&lt;/span&gt;  
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;csv&lt;/span&gt;  
&lt;span class=&quot;n&quot;&gt;csv&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;field_size_limit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;maxint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;



</content>
 </entry>
 
 <entry>
   <title>Change keyboards</title>
   <link href="http://richardpenman.info/Change-keyboards/"/>
   <updated>2011-03-17T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Change-keyboards</id>
   <content type="html">&lt;p&gt;I have been testing how fast I can get with the DVORAK keyboard. To change keyboard to DVORAK:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;setxkbmap dvorak
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And back to QWERTY again:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;setxkbmap us
&lt;/code&gt;&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>My vimrc</title>
   <link href="http://richardpenman.info/My-vimrc/"/>
   <updated>2011-02-12T00:00:00+09:00</updated>
   <id>http://richardpenman.info/My-vimrc</id>
   <content type="html">

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;vim&quot;&gt;&lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;utf8  
  
&lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;textwidth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;  
&lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;tabstop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;&amp;quot; Number of spaces to expand tab (messy)  &lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;softtabstop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;&amp;quot; Number of spaces for insert for tab  &lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;shiftwidth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;&amp;quot; Number of spaces for &amp;lt;&amp;lt; or &amp;gt;&amp;gt;  &lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;expandtab&lt;/span&gt;  
  
&lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;ruler&lt;/span&gt;  
&lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;autoindent&lt;/span&gt;  
&lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;nocompatible&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;&amp;quot; use Vim defaults (much better!)  &lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;bs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;&amp;quot; allow backspacing over everything in insert mode  &lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;ai&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;&amp;quot; always set autoindenting on  &lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;vb&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;&amp;quot; turn off bell  &lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;guifont&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;Monospace\ &lt;span class=&quot;m&quot;&gt;12&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;&amp;quot; determined with &amp;#39;set gfn&amp;#39;  &lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;syntax&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;on&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;&amp;quot; switch syntax highlighting on  &lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;  &lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;&amp;quot; searching options  &lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;nowrapscan&lt;/span&gt;  
&lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;ignorecase&lt;/span&gt;  
&lt;span class=&quot;c&quot;&gt;  &lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;&amp;quot; use ALT key to treat wrapped text as new line when traversing  &lt;/span&gt;
map gj  
map gk  
imap gki  
imap gji  
&lt;span class=&quot;c&quot;&gt;  &lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;&amp;quot; disable indentation for pasting with f2  &lt;/span&gt;
nnoremap :&lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;invpaste&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;paste&lt;/span&gt;?  
&lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;pastetoggle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;  
&lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;showmode&lt;/span&gt;  
&lt;span class=&quot;c&quot;&gt;  &lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;&amp;quot; for working with Windows line endings  &lt;/span&gt;
autocmd &lt;span class=&quot;nb&quot;&gt;BufReadPost&lt;/span&gt; * nested  
\ &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;!&lt;/span&gt;exists&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;b:reload_dos&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &amp;amp;&amp;amp; &lt;span class=&quot;p&quot;&gt;!&lt;/span&gt;&amp;amp;&lt;span class=&quot;nb&quot;&gt;binary&lt;/span&gt; &amp;amp;&amp;amp; &amp;amp;&lt;span class=&quot;nb&quot;&gt;ff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;unix&amp;#39;&lt;/span&gt; &amp;amp;&amp;amp; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt; search&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;\r$&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;nc&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;  
\ &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;b&lt;/span&gt;:reload_dos &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;  
\ &lt;span class=&quot;k&quot;&gt;e&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;dos &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt;  
\ &lt;span class=&quot;k&quot;&gt;endif&lt;/span&gt;  

&lt;span class=&quot;c&quot;&gt;&amp;quot; Protect large files from sourcing and other overhead.  &lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;!&lt;/span&gt;exists&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;my_auto_commands_loaded&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;  
&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; my_auto_commands_loaded &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;  
&lt;span class=&quot;c&quot;&gt;&amp;quot; Large files are &amp;gt; 10M  &lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;&amp;quot; Set options:  &lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;&amp;quot; eventignore+=FileType (no syntax highlighting etc  &lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;&amp;quot; assumes FileType always on)  &lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;&amp;quot; noswapfile (save copy of file)  &lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;&amp;quot; bufhidden=unload (save memory when other file is viewed)  &lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;&amp;quot; undolevels=-1 (no undo possible)  &lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; g:LargeFile &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1024&lt;/span&gt; * &lt;span class=&quot;m&quot;&gt;1024&lt;/span&gt; * &lt;span class=&quot;m&quot;&gt;10&lt;/span&gt;  
augroup LargeFile  
autocmd &lt;span class=&quot;nb&quot;&gt;BufReadPre&lt;/span&gt; * &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;expand&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; getfsize&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; g:LargeFile &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;eventignore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;+=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;FileType&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;setlocal&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;noswapfile&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;bufhidden&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;unload &lt;span class=&quot;nb&quot;&gt;undolevels&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;-1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;eventignore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;-=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;FileType&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;endif&lt;/span&gt;  
augroup END  
&lt;span class=&quot;k&quot;&gt;endif&lt;/span&gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;



</content>
 </entry>
 
 <entry>
   <title>Format harddrive</title>
   <link href="http://richardpenman.info/Format-harddrive/"/>
   <updated>2010-11-09T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Format-harddrive</id>
   <content type="html">&lt;p&gt;First find hard drive name:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ls -l /dev/disk/by-id/  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And then format harddrive name:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo mkfs.ext3 /dev/sdb1 -L &quot;Buffalo&quot;
&lt;/code&gt;&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>Amazon EC2</title>
   <link href="http://richardpenman.info/Amazon-EC2/"/>
   <updated>2010-11-09T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Amazon-EC2</id>
   <content type="html">&lt;p&gt;Steps for setting up a free ec2 micro account:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sign up for a &lt;a href=&quot;http://aws.amazon.com/free/&quot;&gt;free ec2 account&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;You will need to create a new AWS account if you already have one&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Log into the&lt;a href=&quot;https://console.aws.amazon.com/ec2/home&quot;&gt;AWS Management Console&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Create a micro Linux account - choose an EBS backedAMI(Official Ubuntu AMI's are uploaded by user 099720109477)&lt;/li&gt;
&lt;li&gt;Make sure security group has SSH access&lt;/li&gt;
&lt;li&gt;Download pem file (can store in same directory or ~/.ssh/identity - ~/.ssh/id_dsa for newer ssh versions)&lt;/li&gt;
&lt;li&gt;chmod 400 [KEY].pem&lt;/li&gt;
&lt;li&gt;From folder of pem file connect with: ssh -i [KEY].pem ec2-user@[ID].compute-1.amazonaws.com (user name may be root or ubuntu, depending on instance)&lt;/li&gt;
&lt;li&gt;Send files with: scp -i [KEY].pem file [USER]@[ID].compute-1.amazonaws.com:&lt;/li&gt;
&lt;li&gt;Mount filesystem: sshfs [USER]@[ID].compute-1.amazonaws.com: ~/mnt -o IdentityFile=[KEY].pem&lt;/li&gt;
&lt;li&gt;Unmount: fusermount -u ~/mnt&lt;/li&gt;
&lt;/ul&gt;

</content>
 </entry>
 
 <entry>
   <title>Grep-fu</title>
   <link href="http://richardpenman.info/Grepfu/"/>
   <updated>2010-08-31T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Grepfu</id>
   <content type="html">&lt;p&gt;How to display list of files with given extension with given text:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;grep -lr --include=&quot;*.py&quot; &quot;firefox_&quot; *
&lt;/code&gt;&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>Installing Crunchbang</title>
   <link href="http://richardpenman.info/Installing-Crunchbang/"/>
   <updated>2010-07-11T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Installing-Crunchbang</id>
   <content type="html">&lt;ul&gt;
&lt;li&gt;Download &lt;a href=&quot;http://linuxtracker.org/download.php?id=91089d5469234ffd2415d0fac4d39168ea69b64d&amp;amp;f=Crunchbang%2010%20Statler%20A2%20OpenBox.torrent&quot;&gt;Crunchbang development torrent&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Format USB as FAT32&lt;/li&gt;
&lt;li&gt;Download recent version of &lt;a href=&quot;http://unetbootin.sourceforge.net/&quot;&gt;unetbootin&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Create Debian Unstable HDMedia environment on USB&lt;/li&gt;
&lt;li&gt;Copy Crunchbang ISO to USB at root&lt;/li&gt;
&lt;li&gt;Boot from USB to install&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Post install:&lt;br/&gt;
  * Add account to sudoers with visudo
  * Add http://ftp.debian.org/debian/ and http://www.debian-multimedia.org/ to /etc/apt/sources.list
  * Add &quot;setxkbmap us &amp;amp;&quot; to ~/.config/openbox/autostart.sh to set US keyboard
  * install ttf-* packages for foreign fonts (Chinese: arphic-uming, Korean: unfonts-extra)
  * Install vim, codecs, etc
  * Customize .vimrc, .bashrc&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>iso install</title>
   <link href="http://richardpenman.info/iso-install/"/>
   <updated>2010-07-06T00:00:00+09:00</updated>
   <id>http://richardpenman.info/iso-install</id>
   <content type="html">&lt;ol&gt;
&lt;li&gt;Find path to USB with: &lt;em&gt;ls -l /dev/disk/by-id/usb&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Format USB to FAT32: &lt;em&gt;sudo umount /dev/sdx &amp;amp;&amp;amp; sudo mkfs.vfat -I -n &quot;custom name&quot; /dev/sdX&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Replug USB&lt;/li&gt;
&lt;li&gt;Write ISO to usb with: &lt;em&gt;sudo dd if=/path/to/iso of=/dev/sdX bs=4M;sync&lt;/em&gt; (or use UNetbootin)&lt;/li&gt;
&lt;li&gt;Make USB first in BIOS boot order (hit F2 or Del at startup)&lt;/li&gt;
&lt;/ol&gt;

</content>
 </entry>
 
 <entry>
   <title>OCR for Linux</title>
   <link href="http://richardpenman.info/OCR-for-Linux/"/>
   <updated>2010-07-01T00:00:00+09:00</updated>
   <id>http://richardpenman.info/OCR-for-Linux</id>
   <content type="html">&lt;p&gt;I tried a few solutions to extract text out of a clear image containing &lt;em&gt;alan0@hotmail.com&lt;/em&gt;:&lt;/p&gt;

&lt;p&gt;Install with:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo apt-get install gocr tesseract ocrad  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Gocr&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;gocr -i email.png   
aIan0hdmaiI.com  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Tesseract&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;convert email.png email.tif # requires tif  
tesseract email.tif out  
cat out.txt  
Ina rrykeeg a  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Ocrad&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;convert email.png email.ppm # requires p[bgp]m  
ocrad email.ppm   
alano_no_mall.  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Upscaling the image slightly improved the results but still none were correct.&lt;br/&gt;
Disappointing ...&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>web2py on webfaction</title>
   <link href="http://richardpenman.info/web2py-on-webfaction/"/>
   <updated>2010-06-30T00:00:00+09:00</updated>
   <id>http://richardpenman.info/web2py-on-webfaction</id>
   <content type="html">&lt;p&gt;In Panel create a &lt;em&gt;custom script&lt;/em&gt; and then paste this URL: http://wiki.webfaction.com/wiki/Web2py-LatestSource&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Tor on Ubuntu</title>
   <link href="http://richardpenman.info/Tor-on-Ubuntu/"/>
   <updated>2010-06-28T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Tor-on-Ubuntu</id>
   <content type="html">&lt;p&gt;I found Tor works with privoxy but not the recommended polipo on Ubuntu 9.10. To run tor first add the following to &lt;em&gt;/etc/apt/sources.list&lt;/em&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;deb http://deb.torproject.org/torproject.org [distribution] main
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now install Tor and the proxy server with:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;sudo aptitude install tor privoxy&lt;/li&gt;
&lt;li&gt;sudo vim /etc/tor/torrc and modifyMaxCircuitDirtiness&lt;/li&gt;
&lt;li&gt;sudo vim /etc/privoxy/config&lt;/li&gt;
&lt;li&gt;comment out: logfile logfile&lt;/li&gt;
&lt;li&gt;find: listen-address 127.0.0.1:8118&lt;/li&gt;
&lt;li&gt;add (on next line): forward-socks4a / localhost:9050 . (including the period)&lt;/li&gt;
&lt;li&gt;sudo /etc/init.d/tor restart &amp;amp;&amp;amp; sudo /etc/init.d/privoxy restart&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Now set 127.0.0.1:8118 as proxy (eg in firefox) to access the Tor network.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>GAE domains</title>
   <link href="http://richardpenman.info/GAE-domains/"/>
   <updated>2010-05-29T00:00:00+09:00</updated>
   <id>http://richardpenman.info/GAE-domains</id>
   <content type="html">&lt;p&gt;How to register a domain with godaddy and enable free hosting on Google:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Purchase domain from godaddy

&lt;ul&gt;
&lt;li&gt;This will use the default godaddy nameservers (ns35.domaincontrol.com, ns36.domaincontrol.com, etc)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Set up &lt;a href=&quot;http://www.google.com/a/cpanel/domain/new&quot;&gt;Google Apps&lt;/a&gt; for domain

&lt;ul&gt;
&lt;li&gt;Complete signup form and request cname value to verify domain&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Login to godaddy domain manager (advanced)

&lt;ul&gt;
&lt;li&gt;Add www forwarding to get naked domain to work (use masking)&lt;/li&gt;
&lt;li&gt;Delete all the default cname values, which point to various services&lt;/li&gt;
&lt;li&gt;Add google.com cname value and use default TTL&lt;/li&gt;
&lt;li&gt;Add cnameghs.google.com with alias www&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Add www sub domain through GAE dashboard&lt;/li&gt;
&lt;li&gt;To enable email use &lt;a href=&quot;https://www.godaddy.com/gdshop/google/gmail_login.asp&quot;&gt;this service&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Had to wait 10 minutes before service was active&lt;/li&gt;
&lt;/ul&gt;

</content>
 </entry>
 
 <entry>
   <title>SSH timeouts</title>
   <link href="http://richardpenman.info/SSH-timeouts/"/>
   <updated>2010-05-03T00:00:00+09:00</updated>
   <id>http://richardpenman.info/SSH-timeouts</id>
   <content type="html">&lt;p&gt;Add this to ~/.ssh/config to avoid ssh timeouts (create file if does not exist):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Host *  
ServerAliveInterval 240
&lt;/code&gt;&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>Memcached on webfaction</title>
   <link href="http://richardpenman.info/Memcached-on-webfaction/"/>
   <updated>2010-05-01T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Memcached-on-webfaction</id>
   <content type="html">&lt;p&gt;Choose memcached from &lt;a href=&quot;http://wiki.webfaction.com/wiki/InstallScripts&quot;&gt;custom install scripts&lt;/a&gt; and set extra info to maximum number of MB (eg 2)&lt;br/&gt;
This executes:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;memcached start -d -l 127.0.0.1 -m 5 -P $PWD/memcached.pid -p XXXXX
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Take note of port used.
Then can be accessed with gluon.contrib.memcache&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Call url with CRON</title>
   <link href="http://richardpenman.info/Call-url-with-CRON/"/>
   <updated>2010-05-01T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Call-url-with-CRON</id>
   <content type="html">&lt;p&gt;Call URL periodically with CRON, discard HTML, and send all output (including errors) to file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;crontab -e   
0 * * * * wget URL -O /dev/null 2&amp;gt;&amp;gt; ~/cron.log
&lt;/code&gt;&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>Komodo</title>
   <link href="http://richardpenman.info/Komodo/"/>
   <updated>2010-03-17T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Komodo</id>
   <content type="html">&lt;p&gt;Run current file with Python:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;%(python) &quot;%F&quot;
&lt;/code&gt;&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>screen</title>
   <link href="http://richardpenman.info/screen/"/>
   <updated>2009-09-26T00:00:00+09:00</updated>
   <id>http://richardpenman.info/screen</id>
   <content type="html">&lt;p&gt;Use ssh to login to server and start screen:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ssh -t $1 'screen -dRR'
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Common commands for manipulating screen:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;screen -S main # create new screen session named main  
^a d # log out of screen, but leave running  
^a c # new window  
^a k # close window  
^a n # next window  
^a p # previous window  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Configuration file to paste in ~/.screenrc:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;hardstatus on  
hardstatus alwayslastline  
startup_message off  
termcapinfo xterm ti@:te@  
hardstatus string &quot;%{= kG}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a &quot;  
screen -t bash1 1  
screen -t bash2 2  
screen -t bash3 3  
screen -t bash4 4  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href=&quot;http://www.scribd.com/doc/3612/screen-quickref&quot;&gt;Good reference &lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>mercurial</title>
   <link href="http://richardpenman.info/mercurial/"/>
   <updated>2009-09-26T00:00:00+09:00</updated>
   <id>http://richardpenman.info/mercurial</id>
   <content type="html">&lt;p&gt;My .hgrc:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[ui]  
username = Richard Baron Penman
verbose = True
merge = internal:merge
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Common commands:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;hg clone URL # checkout  
hg pull # update  
hg commit -m &quot;...&quot; # save to local  
hg rollback # undo commit  
hg push # save to remote
&lt;/code&gt;&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>Essential Firefox settings</title>
   <link href="http://richardpenman.info/Essential-Firefox-settings/"/>
   <updated>2009-05-20T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Essential-Firefox-settings</id>
   <content type="html">&lt;p&gt;Install these extensions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/26&quot;&gt;Download statusbar&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/1843&quot;&gt;Firebug&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/6647&quot;&gt;HttpFox&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/1956&quot;&gt;Relative tabs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/2324&quot;&gt;Session manager&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Set home page to &lt;a href=&quot;http://www.google.com/&quot;&gt;Google&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Enable master password.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Regular expressions</title>
   <link href="http://richardpenman.info/Regular-expressions/"/>
   <updated>2008-10-30T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Regular-expressions</id>
   <content type="html">&lt;p&gt;Some useful regular expressions&lt;/p&gt;

&lt;p&gt;Email regex:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[a-zA-Z0-9._-]+@(([a-zA-Z0-9_-]{2,99}\.)+[a-zA-Z]{2,4})|((25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9])\.
(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9])\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9])\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9]))  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;URL regex:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[a-zA-Z]{3,4}[sS]?://((([\w\d\-]+\.)+[ a-zA-Z]{2,4})|((25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9])\.
(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9])\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9])\.
(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9])))((\?|/)[\w/=+#_~&amp;amp;:;%\-\?\.]*)  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;IP reg exp:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9])\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9])\.
(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9])\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[1-9])
&lt;/code&gt;&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>Automate sudo password</title>
   <link href="http://richardpenman.info/Automate-sudo-password/"/>
   <updated>2008-10-03T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Automate-sudo-password</id>
   <content type="html">&lt;p&gt;I am tired of typing my password to add new packages with Synaptic.&lt;/p&gt;

&lt;p&gt;One solution is to edit the sudoers list with sudo visudo. To automate the sudo password for all programs add:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;%yourgroup ALL = NOPASSWD: ALL
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;But this is excessive, so to automate the password for just a particular program provide its path like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;%yourgroup ALL = NOPASSWD: /usr/sbin/synaptic
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now I can add new packages with Synaptic without being prompted for a password.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Fun with Festival</title>
   <link href="http://richardpenman.info/Fun-with-Festival/"/>
   <updated>2008-06-01T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Fun-with-Festival</id>
   <content type="html">&lt;p&gt;Festival is a light weight text to speech program originally developed at The University of Edinburgh.&lt;/p&gt;

&lt;p&gt;From the command line&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;echo &quot;hello world&quot; | festival --tts  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;From a file&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;echo &quot;hello world&quot; &amp;gt; file  
festival --tts file
&lt;/code&gt;&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>file conversion</title>
   <link href="http://richardpenman.info/file-conversion/"/>
   <updated>2008-05-28T00:00:00+09:00</updated>
   <id>http://richardpenman.info/file-conversion</id>
   <content type="html">&lt;p&gt;Open source developers have focussed a lot of energy on the plumbing. Here are some examples for manipulating file types:&lt;/p&gt;

&lt;p&gt;Convert between video formats&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ffmpeg -i input.flv output.mpg  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Convert between image formats&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;convert input.png output.jpeg  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Join together audio files&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sox in_1.wav in_2.wav out.wav  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Remove sound from video&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mencoder -ovc copy -nosound video.avi -o video_nosound.avi  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Add sound to video&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mencoder -ovc copy -audiofile soundtrack.mp3 -oac copy video_nosound.avi -o video_sound.avi
&lt;/code&gt;&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>firefox proxy</title>
   <link href="http://richardpenman.info/firefox-proxy/"/>
   <updated>2008-04-05T00:00:00+09:00</updated>
   <id>http://richardpenman.info/firefox-proxy</id>
   <content type="html">&lt;p&gt;If your web browsing is restricted you can use a remote server to get round it. In the firefox network settings choose manual proxy and a port number. Then at the command line type:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ssh -XfN -D PORT -p 22 user@server  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now when you surf the packets will be redirected through this ssh tunnel.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Password protect grub</title>
   <link href="http://richardpenman.info/Password-protect-grub/"/>
   <updated>2008-03-30T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Password-protect-grub</id>
   <content type="html">&lt;p&gt;By default with Ubuntu the user can use grub to login with root privileges WITHOUT a password, which I don't feel comfortable with. This is how I password protected grub to prevent changing the boot process:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;grub  
grub&amp;gt; md5crypt  

Password: YOUR_PASSWORD  
Encrypted: abcdef  

grub&amp;gt; quit  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now copy the encrypted string into the start of the grub file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo vim /boot/grub/menu.lst  
password --md5 abcdef  
lock  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;After saving change the permissions to prevent other uses viewing the file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo chmod 600 /boot/grub/menu.lst
&lt;/code&gt;&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>Recover password</title>
   <link href="http://richardpenman.info/Recover-password/"/>
   <updated>2008-03-29T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Recover-password</id>
   <content type="html">&lt;p&gt;If you forget your login password it can be recovered through grub. At boot enter the grub menu and choose &lt;em&gt;single&lt;/em&gt;. This will get you a root command prompt. Now run &lt;em&gt;passwd&lt;/em&gt; to set a new password. Now anyone can do this if they get access to your machine so you should password protect grub. I will write how to do this later.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Email from the command line</title>
   <link href="http://richardpenman.info/Email-from-the-command-line/"/>
   <updated>2008-03-01T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Email-from-the-command-line</id>
   <content type="html">&lt;p&gt;Send email from the command line:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;echo &quot;message&quot; | mutt -s &quot;subject&quot; -x address@host.com
&lt;/code&gt;&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>Passwordless ssh</title>
   <link href="http://richardpenman.info/Passwordless-ssh/"/>
   <updated>2008-02-28T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Passwordless-ssh</id>
   <content type="html">&lt;p&gt;It becomes a hassle hopping between servers with ssh if you have to type the password each time. To enable passwordless ssh go:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ssh-keygen -t dsa (ENTER to skip password)  
scp ~/.ssh/id_dsa.pub user@other_server  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And on the other server:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cat ~/id_dsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys  
rm ~/id_dsa.pub  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Depending on the server may need to set permissions so no one can view the file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;chmod 600 ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 750 ~
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now you can hop between servers without a password.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Extracting tar balls</title>
   <link href="http://richardpenman.info/Extracting-tar-balls/"/>
   <updated>2008-02-16T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Extracting-tar-balls</id>
   <content type="html">&lt;p&gt;I often forget the flags:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;tar -xvvf file.tar  
tar -xvvzf file.tar.gz  
tar -zxvf file.tgz  
tar xjvf file.tar.bz2
&lt;/code&gt;&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>Moving and svn repository</title>
   <link href="http://richardpenman.info/Moving-and-svn-repository/"/>
   <updated>2008-02-15T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Moving-and-svn-repository</id>
   <content type="html">&lt;p&gt;To move an svn repository first dump it to a file with:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;svnadmin dump /path/to/repository &amp;gt; svn.dump  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now to create the new repository go:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;svnadmin create new_repository_name  
svnadmin load new_repository_name &amp;lt; svn.dump
&lt;/code&gt;&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>Mediawiki upload settings</title>
   <link href="http://richardpenman.info/Mediawiki-upload-settings/"/>
   <updated>2008-01-30T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Mediawiki-upload-settings</id>
   <content type="html">&lt;p&gt;By default the Mediawiki upload settings are too restrictive because they deny most filetypes. And changing the file extension is not enough because Mediawiki also checks the mime type. As a quick and dirty to allow what you want open &lt;em&gt;LocalSettings.php&lt;/em&gt; and add:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;php&quot;&gt;&lt;span class=&quot;x&quot;&gt;$wgStrictFileExtensions = false;  &lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;$wgCheckFileExtensions = false;  &lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;$wgVerifyMimeType = false;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;



</content>
 </entry>
 
 <entry>
   <title>Mediawiki printing</title>
   <link href="http://richardpenman.info/Mediawiki-printing/"/>
   <updated>2008-01-20T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Mediawiki-printing</id>
   <content type="html">&lt;p&gt;By default mediawiki includes header and footer information, which looks unprofessional when printing. To disable this open up &lt;em&gt;_skins/common/commonPrint.css&lt;/em&gt; and add:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;&lt;span class=&quot;nf&quot;&gt;#footer&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;  
    &lt;span class=&quot;k&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;none&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;  
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;  
&lt;span class=&quot;nc&quot;&gt;.printfooter&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;  
    &lt;span class=&quot;k&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;none&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;  
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;  
&lt;span class=&quot;nf&quot;&gt;#bodyContent&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;  
    &lt;span class=&quot;k&quot;&gt;font-family&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;courier&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;  
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;



</content>
 </entry>
 
 <entry>
   <title>Mediawiki sidebar</title>
   <link href="http://richardpenman.info/Mediawiki-sidebar/"/>
   <updated>2008-01-15T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Mediawiki-sidebar</id>
   <content type="html">&lt;p&gt;To change the Mediawiki sidebar login as sysop and edit the page &lt;em&gt;MediaWiki:Sidebar&lt;/em&gt;. Note that the default sysop login name is &lt;em&gt;WikiSysop&lt;/em&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Mediawiki refresh</title>
   <link href="http://richardpenman.info/Mediawiki-refresh/"/>
   <updated>2008-01-12T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Mediawiki-refresh</id>
   <content type="html">&lt;p&gt;To force Mediawiki to refresh anything it has cached just update LocalSettings.php:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;touch /var/lib/mediawiki/LocalSettings.php
&lt;/code&gt;&lt;/pre&gt;
</content>
 </entry>
 
 <entry>
   <title>Mediawiki disable new accounts</title>
   <link href="http://richardpenman.info/Mediawiki-disable-new-accounts/"/>
   <updated>2008-01-10T00:00:00+09:00</updated>
   <id>http://richardpenman.info/Mediawiki-disable-new-accounts</id>
   <content type="html">&lt;p&gt;For privacy I recently made my wiki (Mediawiki 1.7) private and disabled new account creations. To do this I opened LocalSettings.php and added:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;php&quot;&gt;&lt;span class=&quot;x&quot;&gt;$wgGroupPermissions[&amp;#39;*&amp;#39;][&amp;#39;createaccount&amp;#39;] = false;  &lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;$wgGroupPermissions[&amp;#39;*&amp;#39;][&amp;#39;read&amp;#39;] = false;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;The problem is this prevents users logging in. I finally figured out I need to make the login page an exception for anonymous users with:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;php&quot;&gt;&lt;span class=&quot;x&quot;&gt;$wgWhitelistRead = array(&amp;quot;Special:Userlogin&amp;quot;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;



</content>
 </entry>
 
 <entry>
   <title>First post!</title>
   <link href="http://richardpenman.info/First-post/"/>
   <updated>2008-01-02T00:00:00+09:00</updated>
   <id>http://richardpenman.info/First-post</id>
   <content type="html">&lt;p&gt;This blog will serve as a repository of solutions to technical problems I faced.&lt;br/&gt;
Currently I use the following technologies often:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python&lt;/li&gt;
&lt;li&gt;Linux (Ubuntu)&lt;/li&gt;
&lt;li&gt;jQuery&lt;/li&gt;
&lt;li&gt;web2py&lt;/li&gt;
&lt;li&gt;Qt&lt;/li&gt;
&lt;/ul&gt;

</content>
 </entry>
 
 
</feed>

