Weekly review: Week ending February 26, 2016

My time records this week are all out of whack. I was away from phone, computer, and paper for a few days. For an awesome reason, though! =) The next few weeks will probably be a crash course on the practical aspects of keeping a human being alive and thriving. There’s only so much you can learn from books, websites, and videos, after all.

I’m going to try to keep that daily journal habit going, as well as the occasional braindump. I don’t want to post too many details (the eternal memory of search engines!), but I’m looking forward to finding a good balance so that I can continue to think and learn out loud as we start on this new adventure. Here we go!

2016-02-29b Week ending 2016-02-26 -- index card #journal #weekly

output

Blog posts

Sketches

Focus areas and time review

  • Business (7.3h – 4%)
    • Earn (0.0h – 0% of Business)
    • Build (7.2h – 99% of Business)
      • Drawing (3.9h)
      • Paperwork (1.2h)
        • ☑ Plan payroll for 2016
    • Connect (0.1h – 0% of Business)
  • Relationships (5.0h – 2%)
    • ☑ Update family
  • Discretionary – Productive (2.3h – 1%)
    • Emacs (0.2h – 0% of all)
    • Sewing (0.0h)
    • Writing (2.1h)
      • ☑ Braindump and process things that have happened
    • ☑ Make a mini-app for NPM today view
    • ☑ Plan a simple tracking interface
    • ☑ Build data analysis tool for baby data
    • ☑ Easily dump CSV for baby data
    • ☑ Consider dentist change
  • Discretionary – Play (4.4h – 2%)
  • Personal routines (48.3h – 28%)
  • Unpaid work (57.8h – 34%)
  • Sleep (43.0h – 25% – average of 6.1 per day)

Emacs News on hiatus

Hey folks! Just a heads-up to let you know that I might not be able to get Emacs News out in a weekly manner for the next little while. If you feel like giving it a try yourself, you might be able to tweak these Emacs News-related code snippets to work for you, and I’ll happily repost or set you up with mailing list access.

Looking forward to getting this sorted out again when things settle down!

Extracting the xinput device number instead of hardcoding it

I’ve been using my wireless mouse more often these days. XWindows detected it fine and it works without a hitch, hooray! The downside is that as an additional input device, it threw my xinput device numbering off, so the script I was using to rotate the stylus input along with the screen on my tablet PC stopped working. Easy enough to fix by extracting the device number from the output of xinput using the cut command.

The relevant changes were:

xsetwacom set $(xinput | grep eraser | cut -c 55-56) rotate $direction
xsetwacom set $(xinput | grep touch | cut -c 55-56) rotate $direction
xsetwacom set $(xinput | grep stylus | cut -c 55-56) rotate $direction

My rotate-screen script on GitHub

Weekly review: Week ending February 19, 2016

This week was about shifting my systems and routines a little bit in order to support more learning. I’ve been thinking about how to build a regular today-I-learned habit as a way to keep myself moving forward a little bit at a time, and have been putting together little tools to make it easier for me to discover and share tidbits.

After reflecting on the various games I’d tried out on the tablet, I uninstalled a whole bunch of games that weren’t tickling my brain the way I wanted. I might keep Rising Super Chef around because I like the time management aspect, although I’d also be up for something with less randomness and either more skill or more humour. Possibly some kind of a word or math game, too. Anyway, I’ve been shifting towards using the tablet for reading Toronto Public Library e-books through OverDrive, browsing the Web (especially for answers to specific questions), and watching videos on Youtube.

I managed to go on a few long walks, despite the cold. I got through quite a lot of reading on the Kindle, too. I need to refresh the selection of items I have on it since I’m at the end of the fiction I’d lined up, but I can always go through the manuals for Emacs and Org Mode.

It was the fourth year mark for my 5-year experiment in semi-retirement, too, so I’ve been putting together a review covering the past year as well, an overall look at the past four years, and plans for the next year. It’s been a good year and a good experiment so far. It’s hard to imagine a better way to prepare for the next step. Milestones, yay!

2016-02-20a Week ending 2016-02-19 -- index card #journal #weekly

Blog posts

Sketches

Focus areas and time review

  • Business (16.9h – 10%)
    • Earn (5.9h – 34% of Business)
      • ☐ Earn: E1: 1-2 days of consulting
    • Build (8.4h – 49% of Business)
      • Drawing (7.0h)
      • Paperwork (0.1h)
        • ☑ File federal annual return
    • Connect (2.6h – 15% of Business)
  • Relationships (6.6h – 3%)
    • ☑ Take pictures of stuff from Jen
  • Discretionary – Productive (8.6h – 5%)
    • Emacs (2.0h – 1% of all)
      • ☑ Do another Emacs News review
      • ☐ Do another Emacs News review
    • Sewing (0.0h)
    • Writing (4.1h)
    • Coding
      • ☑ See sketches in a range of dates
      • ☑ Authenticate
      • ☑ Make a mini-app for NPM today view
    • Latin
      • ☑ Re-memorize declensions
      • ☑ Memorize pronouns
    • ☑ Consider RRSP contribution
  • Discretionary – Play (32.3h – 19%)
  • Personal routines (31.2h – 18%)
  • Unpaid work (7.4h – 4%)
  • Sleep (65.0h – 38% – average of 9.3 per day)

Listing random npmjs.com packages updated today

I was looking for a way to randomly learn about packages hosted at npmjs.com so that I can come across libraries I might not have thought of searching for. The registry data is available at https://registry.npmjs.org/, and there’s a public CouchDB mirror at https://skimdb.npmjs.com/registry . Someday, when I know more about CouchDB, I might be able to query it and do other things.

In the meantime, this Github issue pointed me to a view of all packages modified today, which is a good-enough proxy for what I’m interested in.

Here’s an AngularJS app that displays the list and highlights a random item.

Screenshot_2016-02-20_21-09-21

<html ng-app="myApp">
  <head>
    <script type="text/javascript"
      src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular.min.js"></script>
    <script>
     // https://registry.npmjs.org/-/all/static/today.json
     // from https://github.com/npm/npm-registry-couchapp/issues/242
     var app = angular.module('myApp', []);
     app.controller('npmTodayCtrl', function($scope, $http) {
       $scope.randomize = function() {
         $scope.random = $scope.packages[Math.floor(Math.random() * $scope.packages.length)];
       }
       $http.get('https://registry.npmjs.org/-/all/static/today.json').then(function(info) {
         $scope.packages = info.data;
         $scope.randomize();
       });
     });
    </script>
  </head>
  <body ng-controller="npmTodayCtrl">
    <div><a href="" ng-click="randomize()">Random highlight:</a></div>
    <div ng-if="random" style="margin-top: 1em; font-size: x-large">
      <strong><a ng-href="https://npmjs.com/package/{{random.name}}">{{random.name}}</a></strong>
      {{random.description}}
    </div>
    <hr>
    <table>
      <tr ng-repeat="package in packages">
        <td><a ng-href="https://npmjs.com/package/{{package.name}}">{{package.name}}</a></td>
        <td>{{package.description}}</td>
      </tr>
    </table>
  </body>
</html>

Building a today-I-learned habit, and displaying the documentation for random Emacs commands

I’d like to build a habit of regularly learning one small thing each day in one of three domains: tech, life, and learning. My measurable output would probably be in the form of index cards, tweets, blog posts, and notes (in org-capture, Dropbox, or Evernote). I can get input from various sources like blog posts, videos, books, webpages, and so on.

2016-02-19a Preparing for a today-I-learned habit -- index card #til #learning

2016-02-19a Preparing for a today-I-learned habit — index card #til #learning

A little bit of randomness might be useful for learning more about Emacs. Emacswiki has a random page function, but the chunks are often a little large or irrelevant. On the other hand, displaying a random command from the packages that I already have loaded into my Emacs – that might be a good way to discover interesting things.

I started by looking at apropos-command, which led me to apropos-internal, which is a C function that referred to obarray. Using obarray by itself didn’t work (suspiciously few elements, so I often ended up looking at emms-related functions). I eventually found mapatoms, which seems to do a better job at listing an appreciable number of interactive functions. I filtered the list to include only documented functions that had not been marked as obsolete: 8,415 in my current Emacs, which should be plenty to go through. =)

(defun my/describe-random-interactive-function ()
  (interactive)
  "Show the documentation for a random interactive function.
Consider only documented, non-obsolete functions."
  (let (result)
    (mapatoms
     (lambda (s)
       (when (and (commandp s) 
                  (documentation s t)
                  (null (get s 'byte-obsolete-info)))
         (setq result (cons s result)))))
    (describe-function (elt result (random (length result))))))

I’ve added this to a key-chord + hydra keymap as a repeatable function, so I can type hh to start my Hydra and then type r as many times as I want in order to show the documentation for a random interactive function. If you’re curious about that, you can see the key-chord section of my config.

Anyway, today I learned more about obarray and mapatoms – they’re not interactive functions, but they were handy for building this little bit of code. We’ll see how it goes! =)