In a previous post I discussed how to backup android with rsync. In this post, I’ll improve on that solution so it happens when you plug the phone in, rather than manually. My solution happens to know I have only one phone; you should adjust accordingly.
The process is
Plug the phone in
Unlock the screen (you’ll see a prompt to do this).
Backup starts automatically
Wait for the backup to finish before unplugging
First, let’s add a udev rule to auto-mount the phone when it’s plugged in and unlocked, and run appropriate scripts.
We’ll add something to mount and unmount the system. Keeping in mind that mounting only works when the screen is unlocked we’ll put that in a loop that checks if the mount worked:
#!/bin/sh
# /usr/local/bin/android-mountfs
android_locked()
{
ls /media/android 2>/dev/null >/dev/null
[ "$?" -eq 2 ]
}
jmtpfs /media/android # mount
while android_locked; do
fusermount -u /media/android
sleep 3
jmtpfs /media/android # mount
done
The contents of /usr/local/bin/phone-backup are pretty me-specific so I’ll omit it, but it copies /media/android over to a server. (fun detail: MTP doesn’t show all information even on a rooted phone, so there’s more work to do)
Compared with last update, the Dead Tree Publishing website is looking nicer.
Looking better
It’s served over HTTPS now (not needed for security, but it puts people at ease and enabled Chrome’s autocomplete) and you can order multiple books at a time.
Other than some more visual improvements, the main thing missing is proper detection of page size — my server doesn’t understand about page margins, so it things books are bigger than they really are.
UI menu.c32# Windows XP
LABEL windows_xp
MENU LABEL Run Windows ^XP Setup
COM32 chain.c32
APPEND fs ntldr=SETUPLDR.BIN
umount /mnt
Boot from the USB stick
Last post I discussed the publishing website I’m working on.
Today I added credit card processing and address forms–it’s functionally complete and available at https://publishing.za3k.com
Next up I have to clean the site up, because it looks like this:
I’ll also add HTTPS.
I started work on my publishing website again (Dead Tree Publishing). The idea is to make a really, really convenient way to get a physical copy of a PDF/epub book. Think: “send me a printed copy of this mailing list / tumblr”. Right now things are looking encouraging.
I use a “back end” publisher who does all the actual printing, and the one I was using before charged quite a lot and wasn’t amazingly fast; I just used them because they were the only publisher who was at all up to date. Seriously, order of $100 – $200 for a 100 page book, just absolutely ridiculous levels of expensive. I’m switching over to a new publisher who can offer that same book for something like $7 (maybe $12 in hardback), which is absolutely reasonable, and with similar 2-week turnaround times.
First you upload a PDF:
Uploading a book
Then I tell you what your ordering options are (hardcover, softcover, color), and what they cost. I’m also supposed to ask you your address to ship the book, and for you to pay for it, but those aren’t done yet.
Book-buying options
Hopefully in the next day or two I’ll have something up and running so people can order books, and then make it gradually nicer! I’m very excited about this website existing.
Just a quick shout-out to Chrome extension Stylish, which lets you add custom stylesheets to any web page. I’m using it with “display: none” and “visibility: hidden” exclusively, to hide annoying page elements.
I wrote a list of video games which I’ve enjoyed especially here.
Today I added support for development of za3k.com using git:
and markdown support, via a cgi markdown wrapper someone wrote for apache (yes, I’m still using Apache).
Edit: I ended up wanting support for tables in markdown, so I used Ruby‘s redcarpet markdown gem (the same thing Github uses, supports this style of tables as well as code blocks).
I don’t usually like IDEs. They’re hard to switch off of, they do too much. They don’t let me customize things, and I always have to use external tools anyway. I’d really rather do things with a bunch of small tools, the linux way. The problem is, if I close everything, I’ll have trouble getting started back up again. Saving state is one solution. Quick start-up is another. Basically, write a checklist for myself to make starting things up easy (open such-and-such files in the editor, start the server in debug mode, etc).
But we’re programmers, so obviously we’re not going to use a literal checklist. Instead, we’re going to write a little script to auto-start things in a new screen session:
#!/usr/bin/screen -c
# game_development.screen.conf
# Run stand-alone or with screen -c game_devel.screen.conf
screen -t "Vim" 2 bash -c "vim -p *.t"
bind "r" screen -t "Game" 2 bash run.sh
Or if you prefer tmux:
# game_development.tmux.conf
# Run with tmux -f game_development.tmux.conf attach
new-session -s game_development
new-window -n "Vim" "bash -c 'vim -p *.t'"
bind r new-window -n "Game" "bash run.sh"
Note the main features being used: a shebang line hack for screen, to let this file be self-contained and executable. Opening files in vim in place of a text editor. Binding keys for unit tests, running the program, restarting the server, etc. Now, a similar approach is to add new key bindings to the text editor, but I feel like text editors should edit text, and I like being able to document all the additions with help menus (which screen and tmux both support).
Note: ratpoison is similar to screen/tmux so you can do similar things in X.
One thing I’d love is if this kind of file was easy to dump from the current state, especially for things like positioning windows, etc. A little assistance is available, but not too much. Ratpoison and tmux let you dump sizing information. Nothing outputs keybindings or a list of running programs with their windows.
There is a program called tmuxinator to let you write the same config in nested YAML of sessions, panes, and windows, which might appeal to some users.
Also, check out dtach if you don’t need panes and windows, and just want a detachable process.
The default twitter icon is an egg. There are six available. One is chosen at random for each new user.