Fabric from the thrift store

I’ve been raiding the thrift store for 100% cotton sheets with patterns or textures that appeal to me. After a trip through the washing machine and dryer, they’re ready to be turned into other things. It’s easier to imagine what they’ll wear like with the softness of well-washed cotton instead of the stiffness of fabric on the bolt. There’s so much fabric that it’s easy to take risks on sewing experiments without feeling like I need to worry too much about maximizing yardage or avoiding mistakes. At the moment, I’d rather buy fabric than finished clothes, if I think I can sew what I want. Every piece is an opportunity to learn something.

Value Village is a bit higher-priced than the other thrift stores, but it has the advantage of being the largest one within walking distance. The price differences aren’t large enough to justify going on the subway. My limiting factor for sewing certainly isn’t a lack of fabric in my stash!

It took me a while to realize that I could get lots of material from the thrift store instead of from the fabric store. When I started getting back into sewing last year, I sewed the same pattern in different solid-coloured fabrics, and then moved on to some of the patterns that I liked: gingham, floral, and even a Marvel Comics print. (Mwahaha!) The more I browsed through the selection at fabric stores, though, the more I felt that I didn’t need to find a specific print or colour in order to make something I would like. If I happened across something I liked at the thrift store, I could add it to my stash. If not, it was a good walk anyway, and there’s still more to sew beyond that.

I suppose it’s a little like how we plan our groceries around the weekly flyers. If diced tomatoes are on sale, then it’s a good time to stock up. If not, we can cook from storage. If we’re out, there are plenty of other things we can cook.

I’m now reasonably confident that I can turn fabric into something simple that I can comfortably wear, and that I might prefer wearing more that something I could buy either used or new. I’m also happy with the kind of fabric that I can easily get, with the occasional splurge or special order here and there. I could spend more – there’s room in my budget, considering it’s part utility, part entertainment, and part education – but I don’t need to, and I like not needing more.

Decision review: Mid-range phone (Moto G), and thinking about how to get even more out of it

My Samsung Galaxy S3 started uncontrollably turning off in February. Even after I cleaned the switches and contacts, it wouldn’t reliably stay on.

On W-‘s recommendation, I switched to a Moto G (2nd gen) a few days after my old phone died. I bought the mid-range Android phone from Staples instead of getting it through a phone contract.

I was a little nervous about my Moto G’s storage limits (16GB, no external storage), but surprisingly enough, it’s been fine. I subscribe to a handful of podcasts, and I’ve given up on the desire to keep an offline copy of my sketches for easy flipping. I’ve picked a few Evernote notebooks and Dropbox folders to synchronize offline, and I leave the rest for online or desktop use.

W- recommended the Otter Commuter case, so I got that too. His is black and mine is purple. Since the phones and cases are identical, sometimes I accidentally pick up his instead of mine if I’m not looking. The case has been working out nicely as well. It’s nice not having to worry so much about dropping my phone (which I’ve done more than a few times) or cracking the screen (which I haven’t).

It’s been almost eight months with the phone. I’m happy with the decision to go with the Moto G instead of splurging on a higher-end phone or choosing something more basic. I mostly use it for alarms, activity tracking, reading, mail, calls, weather forecasts, timers, tethering, remote cheque deposits, and the occasional app or game.

I still haven’t gotten around to Android development, even though that was one of the things I was curious about. Web development is easier for me and more generally useful. I did get around to learning more about Tasker and Javascript, and the quick activity tracker I put together for my most frequently-used categories has been handy. I haven’t played around much with NFC either, since that activity tracker’s been convenient enough for quick interactions and it’s always available.

The recent Android OS update improved the power use. I’ve been okay in terms of battery life – enough to feel comfortable listening to podcasts or leave the pedometer app running in the background.

I’ll probably use my phone even more over the next year, so it might be good to think about how I can get even more value out of it.

  • I haven’t quite gotten into the habit of reading e-books on my phone, even though I have the Kindle and Overdrive apps installed. I think it’s a combination of being impatient with the low information-density-per-page-turn of non-fiction books and not building up a fiction backlog instead. I read a bit of fanfiction from time to time. Hmm, maybe I can slowly work my way through classic literature.
  • In terms of podcasts, I like listening to CBC’s Ideas program, and W- and I sometimes chat about the episodes. I also listen to podcasts about philosophy, and Stoicism in particular. I can look around for tech shows, like the one that Daniel Gopar is starting up around Emacs.
  • It would probably be good to take more pictures, too. Sewing, maybe?
  • If I trim my Feedly blog subscriptions a bit more and then add feeds in line with my current interests, that would help me get more out of blog reading.
  • Jotting quick ideas in Evernote worked well before, but I haven’t been doing it lately because I’ve been casually browsing the web instead. Since browsing has diminishing returns, perhaps I’ll shift more attention towards writing.
  • I wonder if the performance and accuracy of speech recognition has improved enough for it to be mostly usable. Hmm…
  • Time to get back to doing flashcards, too!

I’ve settled into comfortable routines, but there’s so much I haven’t explored yet. Looking forward to taking advantage of the phone’s capabilities!

2015-10-18 Emacs link round-up

How do you find out about cool new packages? Reddit suggests /r/emacs, emacs.zeef.com, Paradox or package-list-packages, @melpa_emacs, Emacs-related blogs, gnu.emacs.sources, rubikitch’s feed, the MELPA repository (also available as a feed), Emacsist, Awesome Emacs, and other sources. ericjmritz has also been posting overviews of recently released/updated Emacs packages together with suggested config and other resources. September features: eno or avy for navigation, modalka for modal editing, nameless for namespaces, and highlight-thing for seeing other instances of a keyword under point.)

Quite a few people posted navigation tweaks. Check out these Hydra-related blog posts about Paradox, navigation, and other packages. If you use isearch a lot, swiper might be a faster way to search (it now supports visual-line-mode too), and you might like this multiple-cursors extension for it too. Multiple-cursors is neat.

There were a couple of writing-related resources, too. Emacs for Writers was a talk by Jay Dixit at the New York Emacs Meetup. Also, /u/yamadpc asked about a focused mode for writing. Suggestions included focus, darkroom-mode, writeroom-mode, and olivetti. In terms of building your own from the ground up, Emacs, naked describes variables you can set and functions you can call in order to make your Emacs screen cleaner.



Also, just for fun: Pacman.

Links from planet.emacsen.org, reddit.com/r/emacs, Youtube.

Weekly review: Week ending October 16, 2015

Way more consulting than normal this week, helping the clients with reports and prototypes. Good stuff! I think I’m starting to get the hang of Q.defer() and promises in asynchronous Javascript. I also got around to getting Selenium working with both Chrome and Internet Explorer, so that should open up even more doors for automation. Yay!

The Emacs Hangout was lots of fun too. =) It’s great to have a place where people can chat about cool stuff they’re learning or working on.

This week was a good one for cooking: cheesecake and egg tarts for the Thanksgiving get-together, Japanese curry and pesto for dinners at home, and other little things here and there. Nice to get back into the swing of things.

2015-10-17b Week ending 2015-10-16 -- index card #journal #weekly output

Blog posts


Focus areas and time review

  • Business (37.3h – 22%)
    • Earn (31.9h – 85% of Business)
      • Earn: E1: 1-2 days of consulting
      • Earn: E1: 1-2 days of consulting
    • Build (5.4h – 14% of Business)
      • Drawing (5.3h)
      • Paperwork (0.0h)
    • Connect (0.0h – 0% of Business)
  • Relationships (5.7h – 3%)
  • Discretionary – Productive (13.7h – 8%)
    • Emacs (2.3h – 1% of all)
      • Re-cut wasamasa’s lightning talk on Emacs graphics
    • Sewing (5.8h)
    • Writing (0.9h)
      • Decision review: Mid-range phone (Motorola G)
    • Gather requirements for Philippine paperwork
  • Discretionary – Play (5.8h – 3%)
  • Personal routines (28.9h – 17%)
  • Unpaid work (11.1h – 6%)
  • Sleep (65.5h – 38% – average of 9.4 per day)

Wow, literate devops with Emacs and Org does actually work on Windows

Since I persist in using Microsoft Windows as my base system, I’m used to not being able to do the kind of nifty tricks that other people do with Emacs and shell stuff.

So I was delighted to find that the literate devops that Howard Abrams described – running shell scripts embedded in an Org Mode file on a remote server – actually worked with Plink.

Here’s my context: The Toronto Public Library publishes a list of new books on the 15th of every month. I’ve written a small Perl script that parses the list for a specified category and displays the Dewey decimal code, title, and item ID. I also have another script (Ruby on Rails, part of quantifiedawesome.com) that lets me request multiple items by pasting in text containing the item IDs. Tying these two together, I can take the output of the library new releases script, delete the lines I’m not interested in, and feed those lines to my library request script.

Instead of starting Putty, sshing to my server, and typing in the command line myself, I can now use C-c C-c on an Org Mode block like this:

#+begin_src sh :dir /[email protected]:~
perl library-new.pl Business

That’s in a task that’s scheduled to repeat monthly, for even more convenience, and I also have a link there to my web-based interface for bulk-requesting files. But really, now that I’ve got it in Emacs, I should add a #+NAME: above the #+RESULTS: and have Org Mode take care of requesting those books itself.

On a related note, I’d given up on being able to easily use TRAMP from Emacs on Windows before, because Cygwin SSH was complaining about a non-interactive terminal.

ssh -l sacha  -o ControlPath=c:/Users/Sacha/AppData/Local/Temp/tramp.13728lpv.%r@%h:%p -o ControlMaster=auto -o ControlPersist=no -e none direct.sachachua.com && exit || exit
Pseudo-terminal will not be allocated because stdin is not a terminal.
ssh_askpass: exec(/usr/sbin/ssh-askpass): No such file or directory
Permission denied, please try again.
ssh_askpass: exec(/usr/sbin/ssh-askpass): No such file or directory
Permission denied, please try again.
ssh_askpass: exec(/usr/sbin/ssh-askpass): No such file or directory
Permission denied (publickey,password).

As it turns out, setting the following made it work for me.

(setq tramp-default-method "plink")

Now I can do things like the following:

(find-file "/[email protected]:~/library-new.pl")

… which is, incidentally, this file (edited to remove my credentials):

# Displays new books from the Toronto Public Library
# Author: Sacha Chua ([email protected])
# Usage:
# perl library-new.pl <category> - print books
# perl library-new.pl <file> <username> <password> - request books
use Date::Parse;

#!/usr/bin/perl -w
use strict;
use URI::URL;
use WWW::Mechanize;
use WWW::Mechanize::FormFiller;
use WWW::Mechanize::TreeBuilder;
use HTML::TableExtract;
use Data::Dumper;
sub process_account($$$);
sub trim($);
sub to_renew($$);
sub clean_string($);

# Get the arguments
if ($#ARGV < 0) {
    print "Usage:\n";
    print "perl library-new.pl <category/filename> [username] [password]\n";

my $agent = WWW::Mechanize->new( autocheck => 1 );
my $formfiller = WWW::Mechanize::FormFiller->new();
if ($#ARGV > 0) {
  my $filename = shift(@ARGV);
  my $username = "NOT ACTUALLY MY USERNAME";
  my $password = "NOT ACTUALLY MY PASSWORD";
  print "Requesting books\n";
  request_books($agent, $username, $password, $filename);
} else {
  my $category = shift(@ARGV);
  print_new_books($agent, $category);

## FUNCTIONS ###############################################

# Perl trim function to remove whitespace from the start and end of the string
sub trim($)
  my $string = shift;
  $string =~ s/^\s+//;
  $string =~ s/\s+$//;
  return $string;

sub request_books($$$$)
  my $agent = shift;
  my $username = shift;
  my $password = shift;
  my $filename = shift;

  # Read titles and IDs
  open(DATA, $filename) or die("Couldn't open file.");
  my @lines = <DATA>;

  my %requests = ();

  my $line;
  my $title;
  my $id;
  foreach $line (@lines) {
    ($title, $id) = split /\t/, $line;
    chomp $id;
    $requests{$id} = $title;

  # Log in
  log_in_to_library($agent, $username, $password);
  print "Retrieving checked-out and requested books...";
  # Retrieve my list of checked-out and requested books
  my $current_ids = get_current_ids($agent);

  # Retrieve a stem URL that I can use for requests
  my $base_url = 'https://www.torontopubliclibrary.ca/placehold?itemId=';
  my @already_out;
  my @success;
  my @failure;
  # For each line in the file
  while (($id, $title) = each(%requests)) {
    # Do I already have it checked out or on hold? Skip.
    if ($current_ids->{$id}) {
      push @already_out, $title . " (" . $current_ids->{$id} . ")";
    } else {
      # Request the hold
      my $url = $base_url . $id;
      if ($agent->content =~ /The hold was successfully placed/) {
        # print "Borrowed ", $title, "\n";
        ## Did it successfully get checked out? Save title in success list
        push @success, $title;
      } else {
        # Else, save title and ID in fail list
        push @failure, $title . "\t" . $id;
  # Print out success list
  if ($#success > 0) {
    print "BOOKS REQUESTED:\n";
    foreach my $title (@success) {
      print $title, "\n";
    print "\n";
  # Print out already-out list
  if ($#already_out > 0) {
    foreach my $s (@already_out) {
      print $s, "\n";
    print "\n";
  # Print out fail list
  if ($#failure > 0) {
    print "COULD NOT REQUEST:\n";
    foreach my $s (@failure) {
      print $s, "\n";
    print "\n";

sub get_current_ids($)
  my $agent = shift;
  my %current_ids = ();
  my $string = $agent->content;
  while ($string =~ m/TITLE\^([0-9]+)\^/g) {
    $current_ids{$1} = 'requested';
  while ($string =~ m/RENEW\^([0-9]+)\^/g) {
    $current_ids{$1} = 'checked out';
  return \%current_ids;

sub print_new_books($$)
  my $agent = shift;
  my $category = shift;
  $agent->follow_link(text_regex => qr/Our Newest Titles/);
  $agent->follow_link(text_regex => qr/$category/i);

  my $continue = 1;
  while ($continue) {
    if ($agent->form_with_fields('SCROLL^F')) {
    } else {
      $continue = 0;

# Print out all the entries on this page
sub print_titles_on_page($)
  my $agent = shift;
  my @titles = $agent->look_down(sub {
                                $_[0]->tag() eq 'strong' and
                                $_[0]->parent->attr('class') and
                                $_[0]->parent->attr('class') eq 'itemlisting'; });
  foreach my $title (@titles) {
    my $hold = $title->parent->parent->parent->parent->look_down(sub {
                                                          $_[0]->attr('alt') and
                                                          $_[0]->attr('alt') eq 'Place Hold'; });
    my $id = "";
    my $call_no = "";
    if ($hold && $hold->parent && $hold->parent->attr('href') =~ /item_id=([^&]+)&.*?callnum=([^ "&]+)/) {
      $id = $1;
      $call_no = $2;
    print $call_no . "\t" . $title->as_text . "\t" . $id . "\n";

sub clean_string($)
    my $string = shift;
    $string =~ s#^.*?(<form id="renewitems" [^>]+>)#<html><body>\1#s;
    $string =~ s#</form>.*#</form></html>#s;
    $string =~ s#<table border="0" bordercolor="red".*(<table border="0" bordercolor="blue" cellspacing="0" cellpadding="0">)#\1#s;
    $string =~ s#</table>.*</form>#</table></form>#s;
# Clean up for parsing
    $string =~ s#<!-- Print the date due -->##g;
    $string =~ s#<br> <!-- Displays Date -->##g;
    return $string;

sub log_in_to_library($$$) {
    my $agent = shift;
    my $username = shift;
    my $password = shift;
    $agent->current_form->value('userId', $username);
    $agent->current_form->value('password', $password);

Ah, Emacs!

2015-10-14 Emacs Hangout

Another Emacs Hangout, hooray! Thanks to everyone who participated. Enjoy watching, and I hope to see you at the next one!

Event pageMailing list for notifications

Partial list of fuzzy timestamps:

  • 0:04 using org babel for a git dashboard link
  • 0:14 org tables and timestamps – whoops, focused on the wrong video, but here’s the blog post: link
  • 0:22 projectile and tags
  • 0:32 jabber and org contacts
  • 0:37 org-download
  • 0:41 Kindle highlights
  • 0:42 archiving
  • 0:45 visible-mode
  • 0:48 company-mode
  • 0:50 elfeed, pinboard
  • 0:58 building from source

Text chat:

Eric Hanchrow 8:56 PM I’m so much more comfortable with text than video … if other people join, will I see their icons?
me 8:56 PM Yup. Text chat is totally cool, it gets saved and posted too. and I can read things into the audio for people just listening to the stream (Livestream viewers won’t see the text chat during the hangout – only people in the actual Hangout will see it, so that’s why I repeat cool stuff. )
Eric Hanchrow 8:57 PM uh … so “livestream” is something different from Hangout? :-\ livestream must be “read only”
me 8:58 PM Yup, livestream (Youtube, etc.) is read only
Eric Hanchrow 8:58 PM ah dinnertime already!
Puneeth Chaganti 9:09 PM Hi everyone.
me 9:10 PM Hi Puneeth!
Kiran Gangadharan 9:37 PM https://github.com/abo-abo/org-download
Puneeth Chaganti 9:41 PM https://github.com/punchagan/clip2org I have to head off folks! I’ll catch up with video later. Have a good day/night!
me 9:57 PM See you!
Dave Marquardt 10:13 PM Sacha, what was the name of that mode that scatters tasks? I think I saw something like that in orgbox…. Now I see it in the Org info. Thanks! Thanks for setting it up!