tag:blogger.com,1999:blog-79246460293311720912009-02-21T05:30:08.419-08:00stuffhopefully-useful information that I want search engines to indexDan Erathttp://www.blogger.com/profile/13320957163729425518noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-7924646029331172091.post-27941490773465675662008-05-02T09:30:00.000-07:002008-05-02T10:28:57.079-07:00A friend asked me to give him a copy of some scripts that I wrote to back up my Linux system to <a href="http://aws.amazon.com/s3">Amazon's S3 online storage service</a>. The scripts produce GPG-encrypted tar files (both full backups and incremental ones that can be applied on top of full backups). Here's some quick documentation to go alongside the code. It assumes that you already have an S3 account and that you know how to create GPG keys, and that if you ever need to restore from a backup, you know how unencrypt GPG files and run tar. I like this approach because GPG and tar are old, common, well-tested tools. If you need something more complicated, you might want to take a look at <a href="http://search.cpan.org/%7Ebradfitz/Brackup/brackup">brackup</a>.<br /><br />No warranty, use at your own risk, etc. I'm writing this from memory. If you run into trouble, let me know and I'll try to help. This script has been working for me for a while now (as in, I've used it to recover data after losing hard disks), but you can never be too paranoid when doing backups. Read <a href="http://jwz.livejournal.com/801607.html">this post about backups by jwz</a> and do what he instructs. I do. I trust those hard disk backups more than my S3 ones, but I still additionally do a full backup to S3 every two months or so and an incremental backups on top of the last full every few weeks.<br /><br />First, download all of these things and put them into a directory:<br /><ul><li><a href="http://www.erat.org/files/backup/S3.rb"><code>S3.rb</code></a> - This is a Ruby library provided by Amazon for interacting with S3, slightly hacked-up to make it not keep the entirety of things that are being uploaded in memory and to add a progress callback on copies.<br /></li><li><a href="http://deisui.org/%7Eueno/ruby/hmac.html">ruby-hmac</a> - You'll need to install this library to use <code>S3.rb</code>. You should just put the <code>.rb</code> files in the same directory as everything else.<br /></li><li><a href="http://www.erat.org/files/backup/s3.rb"><code>s3.rb</code></a> - This is a utility script that implements some Unix-like commands on S3 (creating or removing buckets, listing the contents of buckets, copying files between the local machine and S3, etc.). Run <code>s3.rb help</code> for details.<br /></li><li><a href="http://www.erat.org/files/backup/backup.rb"><code>backup.rb</code></a> - This is a script that creates GPG-encrypted incremental tar backups of a set of paths, optionally copying the backups to S3 when done.<br /></li><li><a href="http://www.erat.org/files/backup/backup.sh"><code>backup.sh</code></a> - This is a shell script to invoke <code>backup.rb</code>. It can backup to a CD-R drive using <a href="http://cdrecord.berlios.de/">cdrecord</a> or do full and incremental backups to S3.</li></ul>Next, we need to get <code>s3.rb</code> working. In your home directory, create a file named <code>.s3_auth</code> containing a single line consisting of your S3 key ID, a space, and your S3 secret. After doing this, you should be able to run <code>./s3.rb mkbucket yourname</code> to create a bucket and then copy files to and from the bucket (I think that S3 uses a global namespace for all users' buckets, so you might run into trouble if your bucket name isn't original enough).<br /><br />Now open <code>backup.sh</code> in your favorite editor. You'll need to change the values of some of the variables at the top. <code>secret_key</code> needs to contain the signature of the GPG key that you want to use to encrypt your backups. <code>bucket</code> needs to contain the name of the S3 bucket that you previously created using <code>s3.rb</code>. You can ignore <code>image_dir</code>, <code>iso_file</code>, <code>cd_dev</code>, and <code>cd_mnt</code> if you're not going to write backups to CDs. Finally, scroll down to the line starting with <code>./backup.rb</code> and make the <code>--exclude</code> arguments list any paths that you want to exclude from backups, and check that the list of paths at the end of the command contains everything that you want to back up. At this point, if I didn't screw up these instructions, you should be able to run <code>./backup.sh full</code> to do a full backup to S3. As the file is copied, the script will print its progress onscreen. Temporary files and the index that tar uses to keep track of what's contained in full backups will go into <code>~/.backup</code>.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7924646029331172091-2794149077346567566?l=blog.erat.org'/></div>Dan Erathttp://www.blogger.com/profile/13320957163729425518noreply@blogger.com0tag:blogger.com,1999:blog-7924646029331172091.post-50095268749707637072008-03-25T21:10:00.000-07:002008-03-25T21:22:07.239-07:00getting encfs set up on ubuntu or debianJust so I don't forget later, here's how to set up an <a href="http://www.arg0.net/encfs">encfs</a> directory on a Debian-like system such that the directory will be automatically mounted the first time you log in.<br /><ul><li>As root, install the <code>encfs</code> and <code>libpam-encfs</code> packages.<br /><li>As root, add your user account to the <code>fuse</code> group in <code>/etc/group</code>. Log out and back in as your regular user.<br /><li>As your regular user, create the filesystem:<br /><blockquote><code>encfs $HOME/.enc $HOME/enc</code></blockquote><br />Choose the default options and enter your password.<br /><li>As root, edit <code>/etc/pam.d/common-auth</code> to look like this:<br /><blockquote><code>auth sufficient pam_encfs.so<br/><br />auth required pam_unix.so nullok_secure use_first_pass</code></blockquote><br /><li>As root, edit <code>fuse.conf</code> to look like this:<br /><blockquote><code>user_allow_other</code></blockquote><br /><li>As root, make <code>/etc/security/pam_encfs.conf</code> look like this:<br /><blockquote><code>drop_permissions<br/><br />fuse_default nonempty<br/><br /><br/><br /><user> /path/to/.enc /path/to/enc -v allow_other</blockquote><br /></ul><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7924646029331172091-5009526874970763707?l=blog.erat.org'/></div>Dan Erathttp://www.blogger.com/profile/13320957163729425518noreply@blogger.com0tag:blogger.com,1999:blog-7924646029331172091.post-61912727768131473622007-12-18T11:43:00.001-08:002008-03-25T21:18:32.787-07:00making ctrl-u work in firefoxI try to avoid the mouse when I'm using my computer. In Firefox, I commonly want to clear the text in the location bar and type in a new URL. Focusing the location bar is easy (<code>Ctrl-L</code>), but GTK doesn't appear to have a default keybinding to clear a text entry. <code>End, Shift-Home, Delete</code> works but has the unpleasant side effect of replacing the contents of the clipboard with the previous location — I'm often clearing the location bar so I can visit the URL that was previously in the clipboard.<br /><br />You can tell GTK to use an Emacs/readline()-like keyboard theme by adding <code>gtk-key-theme-name = "Emacs"</code> to <code>~/.gtkrc-2.0</code>, which allows you to use <code>Ctrl-U</code> to clear text entries, but it also adds a binding for <code>Ctrl-W</code>, leaving you with no Firefox keyboard shortcut to close a window. <a href="http://library.gnome.org/devel/gtk/unstable/gtk-Bindings.html">GTK added an "unbind" directive</a> that presumably would allow one to remove the <code>Ctrl-W</code> binding, but it's only present in 2.12 or later.<br /><br />The solution is to just add the <code>Ctrl-U</code> binding itself by putting the following into <code>~/.gtkrc-2.0</code>:<br /><br /><code></code><pre>binding "gtk-clear-text-entry" {<br />bind "<ctrl>k" {<br /> "delete-from-cursor" (paragraph-ends, 1)<br />}<br />bind "<ctrl>u" {<br /> "move-cursor" (paragraph-ends, -1, 0)<br /> "delete-from-cursor" (paragraph-ends, 1)<br />}<br />}<br />class "GtkEntry" binding "gtk-clear-text-entry"<br />class "GtkTextView" binding "gtk-clear-text-entry"</ctrl></pre><br /><br />You can test your bindings with <code>zenity --entry</code>.<br /><br />(Most of this was cribbed from <a href="http://kb.mozillazine.org/Talk:Emacs_Keybindings_-_Firefox">MozillaZine</a>. I don't have the issues that the author describes with Firefox ignoring user-defined bindings, but I suspect that may be because he/she is not unbinding the old <code>Ctrl-U</code> binding before defining a new one.)<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7924646029331172091-6191272776813147362?l=blog.erat.org'/></div>Dan Erathttp://www.blogger.com/profile/13320957163729425518noreply@blogger.com1tag:blogger.com,1999:blog-7924646029331172091.post-90414651061735232422007-09-06T07:14:00.000-07:002007-09-06T07:56:59.400-07:00reinstalling apps on a Symbian phone after a hard resetThe Symbian Series60 3rd Edition OS (used on Nokia's E61, E62, and E70 phones, for instance) can be more than a bit flaky. My E70 suddenly stopped receiving SMS messages a few days ago, and the only fix that I found was to perform a hard reset on the phone to wipe all my settings.<br /><br />The list of installed applications persists across a reset. Furthermore, the phone will try to reinstall missing applications every time it starts up, and will pause for a while and then beep and give you a bitchy message if it's unable to install any of the apps. You can see the missing apps in Menu -> Tools -> App. mgr., but the list unfortunately displays a hexadecimal GUID-looking-thing for each missing app instead of its actual name. I haven't found any good way to get the name, so I'm stuck trying to remember what I had installed before the reset.<br /><br />For reference, though, a00007a6.sis is <a href="http://www.drjukka.com/YBrowser.html">Y-Browser</a> and I think that 200018ff.sis is <a href="http://www.shapeservices.com/en/products/details.php?product=im">IM+</a>, although I haven't been able to install it successfully. I don't speak (or read) French, but <a href="http://www.planete-nokia.com/phpBB2/index.php?s=&showtopic=29627&view=findpost&p=313205">this post</a> appears to claim that you can delete a file using a program like Y-Browser to make the phone stop trying to install an app. I couldn't find the file on my phone.<br /><br />I also had trouble getting Internet access up and running again after the reinstall. I'm on Cingular-I-mean-AT&T as a former AT&T Wireless customer (a.k.a. "Cingular Blue"). This means that I'm using mMode rather than MEdia Net. Nokia provides a <a href="https://nokiags.wdsglobal.com/standard?siteLanguageId=118">service that will send you an SMS message containing settings for your phone</a>, but I still didn't have any luck after using it ("Nokia E70" -> "WAP/GPRS" -> "United States" -> "AT&T (Former AT&T Wireless customers)" -> "mMode"). To finally get things working, I had to go to Menu -> Tools -> Settings -> Connection -> Access Points, select the new "mMode" connection that was created by the SMS message, choose Options -> Advanced settings, and clear "Proxy serv. address" and set "Proxy port number" to 0 for good measure. Whew.<br /><br />I swear, one more problem and I'm buying an iPhone. :-(<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7924646029331172091-9041465106173523242?l=blog.erat.org'/></div>Dan Erathttp://www.blogger.com/profile/13320957163729425518noreply@blogger.com0tag:blogger.com,1999:blog-7924646029331172091.post-56625974775223888232007-09-05T15:14:00.000-07:002007-09-05T15:51:18.833-07:00burning man clothing<span style="font-size:100%;">I went to <a href="http://en.wikipedia.org/wiki/Burning_Man">Burning Man</a> for the first time this year and found that I brought too much of some things and not enough of others. I'm going to write down my experiences while they're still fresh so I can refer to them next year.<br /></span><ul><li><span style="font-size:100%;">sturdy pair of shorts</span></li><li><span style="font-size:100%;">two t-shirts</span></li><li><span style="font-size:100%;">three pairs of socks and underwear (eww, just three?)</span></li><li><span style="font-size:100%;">long pants</span></li><li><span style="font-size:100%;">sweatshirt</span></li><li><span style="font-size:100%;">wide-brimmed hat</span></li><li><span style="font-size:100%;">sandals suitable for walking long distances on hard ground</span></li><li><span style="font-size:100%;">closed-toe shoes</span></li><li><span style="font-size:100%;">a dust mask or two</span></li><li><span style="font-size:100%;">closed goggles</span></li><li><span style="font-size:100%;">sunglasses, if sunniness irritates your eyes</span></li><li><span style="font-size:100%;">a plastic poncho, if you're worried about rain</span></li><li><span style="font-size:100%;">two bottles of high-SPF sunscreen</span></li></ul><span style="font-size:100%;">You're going to be disgusting after a week in the desert, regardless of your typical hygiene standards. I erred on the side of bringing too many items of clothing (which isn't really a big deal; you're car-camping, not backpacking).<br /><br />Most days were sunny and in the 90s, and I generally walked around wearing just a pair of shorts, sandals, and my hat. It didn't get as cold as I'd heard at night; I was generally okay wearing long pants, a t-shirt, socks, and shoes. There wasn't more than a few minutes of rain, and I think I would've been fine just staying under shelter without raingear if there'd been more.<br /><br />There were hour-long dust storms the last few afternoons, so don't forget the dust mask. I had brought ventilated safety goggles and found that dirt got into my eyes when I was perpendicular with the wind. Swimming goggles would've been a better choice.<br /><br />You'll want to bring or borrow some costumes too.<br /><br />More to come later.<br /></span><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7924646029331172091-5662597477522388823?l=blog.erat.org'/></div>Dan Erathttp://www.blogger.com/profile/13320957163729425518noreply@blogger.com0tag:blogger.com,1999:blog-7924646029331172091.post-74327601865130175342007-01-28T11:26:00.000-08:002007-01-28T11:43:52.593-08:00mpd in debian stable is unable to play some filesI had trouble for a long time getting the version of <a href="http://musicpd.org/">MPD</a> in Debian Stable (0.11.5-3) to play certain MP3 files through ALSA. See, for example, <a href="http://www.durftal.com/music/cylob/CYLOB_3032.MP3">this one</a>. I'd get errors from MPD along the lines of "<code>problems opening audio device while playing [filename] ALSA snd_pcm_hw_params_set_channels error: Invalid argument</code>".<br /><br />After looking at the files in question and seeing the patch given <a href="http://mednafen.com/forum/index.php?t=msg&goto=643&">here</a> for a similar error in a different program, I'm pretty sure that this is an issue with MPD trying to output monaural MP3 files in stereo (maybe something is messed up in the files themselves that's telling it to do this). It seems to be fixed in the version in Debian Unstable, 0.12.1-1. I backported the packages to Stable; you can find them <a href="http://www.erat.org/files/mpd_backport/">here</a>. You'll need <code>mpd</code> and <code>libmpcdec3</code>, but not <code>libmpcdec-dev</code> unless you intend to build your own MPD package.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7924646029331172091-7432760186513017534?l=blog.erat.org'/></div>Dan Erathttp://www.blogger.com/profile/13320957163729425518noreply@blogger.com0