Laura Arjona: Upgrading my computers to Debian Jessie: Husband s laptop (Acer Aspire 5250)
Filed under: My experiences and opinion Tagged: Debian, English, Moving into free software
http://nagios-server.example.org:5001?contact=danielScreenshots Here I demonstrate using Mozilla Lightning / Iceowl-extension to aggregate issues from Nagios, the Fedora instance of Bugzilla and Lumicall's Github issues into a single to-do list.
-CONFIG_X86_SYSFB=y +# CONFIG_X86_SYSFB is not set -CONFIG_FB_SIMPLE=y +# CONFIG_FB_SIMPLE is not setWithout these modifications, the screen would be garbled some 5-6 seconds after boot (but SSH would still work, as far as I remember).
acpi -V as
well as via the KDE widget. Hibernation via systemctl
hibernate works as well.
What does not work is the warning when my battery is low, or
automagic hibernation when shutting the lid or when the battery
level is critical.
From what I gather, something in the communication between
upower and KDE broke down, but I can't find what it is. I have also
been told that Cinnamon is affected as well, so this seems to be a
more general problem
Sadly, me and anyone else who's affected has been unable to fix
this.
So, dear lazyweb, please help.
In loosely related news, this old status is still
valid. UMTS is stable-ish now but even though I saved the SIM's
PIN, KDE always displays a "SIM PIN unlock request" prompt after
booting or hibernating. Once I enter that PIN, systemd tells me
that a system policy prevents the change and wants my user
password. If anyone knows how to get rid of that, I would
also appreciate any pointers.
I've done a bunch of hacking on the Redis key/value database server recently:
Lua-based maxmemory eviction scripts. (#2319) (This changeset was sponsored by an anonymous client.) Redis typically stores the entire data set in memory, using the operating system's virtual memory facilities if required. However, one can use Redis more like a cache or ring buffer by enabling a "maxmemory policy" where a RAM limit is set and then data is evicted when required based on a predefined algorithm. This change enables entirely custom control over exactly what data to remove from RAM when this maxmemory limit is reached. This is an advantage over the existing policies of, say, removing entire keys based on the existing TTL, Least Recently Used (LRU) or random eviction strategies as it permits bespoke behaviours based on application-specific requirements, crucially without maintaining a private fork of Redis. As an example behaviour of what is possible with this change, to remove the lowest ranked member of an arbitrary sorted set, you could load the following eviction policy script:
local bestkey = nil local bestval = 0 for s = 1, 5 do local key = redis.call("RANDOMKEY") local type_ = redis.call("TYPE", key) if type_.ok == "zset" then local tail = redis.call("ZRANGE", key, "0", "0", "WITHSCORES") local val = tonumber(tail[2]) if not bestkey or val < bestval then bestkey = key bestval = val end end end if not bestkey then -- We couldn't find anything to remove, so return an error return false end redis.call("ZREMRANGEBYRANK", bestkey, "0", "0") return true
TCP_FASTOPEN support. (#2307) The aim of TCP_FASTOPEN is to eliminate one roundtrip from a TCP conversation by allowing data to be included as part of the SYN segment that initiates the connection. (More info.)
Support infinitely repeating commands in redis-cli. (#2297)
Add --failfast option to testsuite runner. (#2290)
Add a -q (quiet) argument to redis-cli. (#2305)
Making some Redis Sentinel defaults a little saner. (#2292)
Add run-parts(8) directories to be executed at various points in the daemon's lifecycle. (e427f8) This is especially useful for loading Lua scripts as they are not persisted across restarts.
Split out Redis Sentinel into its own package. (#775414, 39f642) This makes it possible to run Sentinel sanely on Debian systems without bespoke scripts, etc.
Ensure /etc/init.d/redis-server start idempotency with --oknodo (60b7dd) Idempotency in initscripts is especially important given the rise of configuration managment systems.
Uploaded 3.0.0 RC2 to Debian experimental. (37ac55)
Re-enabled the testsuite. (7b9ed1)
Since July, I have been aware of an ugly problem with
propellor. Certain
propellor configurations could have a bug. I've tried to solve the problem at
least a half-dozen times without success; it's eaten several weekends.
Today I finally managed to fix propellor so it's impossible to write code that
has the bug, bending the Haskell type checker to my will with the power of
GADTs and type-level functions.
the bug
Code with the bug looked innocuous enough. Something like this:
foo :: Property
foo = property "foo" $
unlessM (liftIO $ doesFileExist "/etc/foo") $ do
bar <- liftIO $ readFile "/etc/foo.template"
ensureProperty $ setupFoo bar
ensureProperty
line, and the setupFoo Property is run only sometimes, and is
passed data that is read from the filesystem.
This makes it very hard, indeed probably impossible for Propellor to
look inside the monad, realize that setupFoo is being used, and add
its Info to the host.
Probably, setupFoo doesn't have Info associated with it -- most
properties do not. But, it's hard to tell, when writing such a Property
if it's safe to use ensureProperty. And worse, setupFoo could later
be changed to have Info.
Now, in most languages, once this problem was noticed, the solution would
probably be to make ensureProperty notice when it's called on a Property
that has Info, and print a warning message. That's Good Enough in a sense.
But it also really stinks as a solution. It means that building propellor
isn't good enough to know you have a working system; you have to let it
run on each host, and watch out for warnings. Ugh, no!
the solution
This screams for GADTs. (Well, it did once I learned how what GADTs are
and what they can do.)
With GADTs, Property NoInfo and Property HasInfo can be separate data
types. Most functions will work on either type (Property i) but
ensureProperty can be limited to only accept a Property NoInfo.
data Property i where
IProperty :: Desc -> ... -> Info -> Property HasInfo
SProperty :: Desc -> ... -> Property NoInfo
data HasInfo
data NoInfo
ensureProperty :: Property NoInfo -> Propellor Result
requires,
which only runs the first Property after the second one has successfully
been met.
So, what's it's type when used with GADT Property?
requires :: Property i1 -> Property i2 -> Property ???
class Combine x y r where
requires :: x -> y -> r
Combines, for each combination
of 2 Properties with HasInfo or NoInfo.
It type checked. But, type inference was busted. A simple expression
like
foo requires bar
blew up:
No instance for (Requires (Property HasInfo) (Property HasInfo) r0)
arising from a use of requires'
The type variable r0' is ambiguous
Possible fix: add a type signature that fixes these type variable(s)
Note: there is a potential instance available:
instance Requires
(Property HasInfo) (Property HasInfo) (Property HasInfo)
-- Defined at Propellor/Types.hs:167:10
To avoid that, it needed ":: Property HasInfo" appended --
I didn't want the user to need to write that.
I got stuck here for an long time, well over a month.
type level programming
Finally today I realized that I could fix this with a little type-level
programming.
class Combine x y where
requires :: x -> y -> CombinedType x y
CombinedType is a type-level function, that calculates the type that
should be used for a combination of types x and y. This turns out to be really
easy to do, once you get your head around type level functions.
type family CInfo x y
type instance CInfo HasInfo HasInfo = HasInfo
type instance CInfo HasInfo NoInfo = HasInfo
type instance CInfo NoInfo HasInfo = HasInfo
type instance CInfo NoInfo NoInfo = NoInfo
type family CombinedType x y
type instance CombinedType (Property x) (Property y) = Property (CInfo x y)
before :: (IsProp x, Combines y x, IsProp (CombinedType y x)) => x -> y -> CombinedType y x
before x y = (y requires x) describe (propertyDesc x)
onChange
:: (Combines (Property x) (Property y))
=> Property x
=> Property y
=> CombinedType (Property x) (Property y)
onChange = -- 6 lines of code omitted
fallback :: (Combines (Property p1) (Property p2)) => Property p1 -> Property p2 -> Property (CInfo p1 p2)
fallback = -- 4 lines of code omitted
[Property], and since a haskell list can only contain a
single type, while Property Info and Property NoInfo are two different
types, that needed to be dealt with. Happily, I was able to extend
propellor's existing (&) and (!) operators to work in this situation,
so a list can be constructed of properties of several different types:
propertyList "foos" $ props
& foo
& foobar
! oldfoo
$ sudo apt-get install python-yaml python-icalendar python-flask python-pygithubJust create an API token in Github and put it into a configuration file like this:
api_token: 6b36b3d7579d06c9f8e88bc6fb33864e4765e5fac4a3c2fd1bc33aad bind_address: ::0 bind_port: 5000 filter: allRun it from the shell:
$ ./github_icalendar/main.py github-ics.cfgand connect to it with your favourite iCalendar client. Consolidating issue lists from Bugzilla, Github, Debian BTS and other sources A single iCalendar client can usually support multiple sources and thereby consolidate lists of issues from multiple bug trackers. This can be much more powerful than combining RSS bug feeds because iCalendar has built-in support for concepts such as priority and deadline. The client can use these to help you identify the most critical issues across all your projects, no matter which bug tracker they use. Bugzilla bugtrackers already expose iCalendar feeds directly, just look for the iCalendar link at the bottom of any search results page. Here is an example URL from the Mozilla instance of Bugzilla. The Ultimate Debian Database consolidates information from the Debian and Ubuntu universe and can already export it as an RSS feed, there is discussion about extrapolating that to an iCalendar feed too. Further possibilities
A new version of RcppAnnoy is now on CRAN. RcppAnnoy wraps the small, fast, and lightweight C++ template header library Annoy written by Erik Bernhardsson for use at Spotify. RcppAnnoy uses Rcpp Modules to offer the exact same functionality as the Python module wrapped around Annoy.
This version contains a trivial one-character change requested by CRAN to cleanse the Makevars file of possible GNU Make-isms. Oh well. This release also overcomes an undefined behaviour sanitizer bug noticed by CRAN that took somewhat more effort to deal with. As mentioned recently in another blog post, it took some work to create a proper Docker container with the required compiler and subsequent R setup, but we have one now, and the aforementioned blog post has details on how we replicated the CRAN finding of an UBSAN issue. It also took Erik some extra efforts to set something up for his C++/Python side, but eventually an EC2 instance with Ubuntu 14.10 did the task as my Docker sales skills are seemingly not convincing enough. In any event, he very quickly added the right fix, and I synced RcppAnnoy with his Annoy code.
Courtesy of CRANberries, there is also a diffstat report for this release. More detailed information is on the RcppAnnoy page page.
This post by Dirk Eddelbuettel originated on his Thinking inside the box blog. Please report excessive re-aggregation in third-party for-profit settings.
Lever Rukhin Photographs Los Angeles From His CarPhoblographer: It looks like many of these images have artificial lighting in them. What s your gear setup, and how do you introduce so much light into the scene from your car? Lever: About 9 months ago, I affixed a Mola beauty dish onto the roof rack of my 75 Volvo and juice it with a profoto bi-tube. This takes a bit of practice, as making a turn changes the light completely, which I always try to keep balanced. The Canon 5D3 with a 24mm f1.4 is set up on a tripod. The strobe has allowed me to capture more detail as well as creating a somewhat surreal feel to the sets.
Lev Rukhin http://www.levrukhin.com/Pitchfork: The world has a difficult time with the female auteur. B: I have nothing against Kanye West. Help me with this I m not dissing him this is about how people talk about him. With the last album he did, he got all the best beatmakers on the planet at the time to make beats for him. A lot of the time, he wasn t even there. Yet no one would question his authorship for a second. If whatever I m saying to you now helps women, I m up for saying it. For example, I did 80% of the beats on Vespertine and it took me three years to work on that album, because it was all microbeats it was like doing a huge embroidery piece. Matmos came in the last two weeks and added percussion on top of the songs, but they didn t do any of the main parts, and they are credited everywhere as having done the whole album. [Matmos ] Drew [Daniel] is a close friend of mine, and in every single interview he did, he corrected it. And they don t even listen to him. It really is strange.In Defense of the Selfie Stick
When you ask someone to take a picture of you, technically, they are the photographer, and they own the copyright of your picture. ( ) All of a sudden, your backpacking adventure in Europe requires you to pack a stack of legal contracts. Now your exchange goes from Can you take a picture of us? to Can you take a picture of us, making sure that the church is on the top right corner, and also, I am going to need you to sign this paper .I don t know what s with the selfie stick hate. Let people have fun, it doesn t hurt. If anything, it prevents them from asking you to take their photo, and if we already established you are the kind of people not a big fan of strangers, all the better, right? Why Top Tech CEOs Want Employees With Liberal Arts Degrees
Both Yi and Sheer recognize that the scientific method is valuable, with its emphasis on logic and reason, especially when dealing with data or engineering problems. But they believe this approach can sometimes be limiting. When I collaborate with people who have a strictly technical background, says Yi, the perspective I find most lacking is an understanding of what motivates people and how to balance multiple factors that are at work outside the realm of technology.Interesting food for thought, specially if you know an engineer that ditches the arts as of little value for personal growth in their careers/life.
I recently started using the Slack group chat tool in a few teams. Wishing to add some vanity notifications such as sales and user growth milestones from some Django-based projects, I put together an easy-to-use integration between the two called django-slack.
Whilst you can use any generic Python-based method of sending messages to Slack, using a Django-specific integration has some advantages:
from django_slack import slack_message @login_required def view(request, item_id): item = get_object_or_404(Item, pk=item_id) slack_message('items/viewed.slack', 'item': item, 'user': request.user, ) return render(request, 'items/view.html', 'item': item, )
% extends django_slack % % block text % user.get_full_name just viewed item.title ( item.content urlize ). % endblock %.slack files are regular Django templates text is automatically escaped as appropriate and that you can use the regular template filters and tags such as urlize, loops, etc. By default, django-slack posts to the #general channel, but it can be overridden on a per-message basis by specifying a channel block:
% block channel % #mychannel % endblock %You can also set the icon, URL and emoji in a similar fashion. You can set global defaults for all of these attributes to avoid DRY violations within .slack templates as well. For more information please see the project homepage or read the documentation. Patches and other contributions are welcome via the django-slack GitHub project.
| Week | Squeeze | Wheezy | Jessie |
|---|---|---|---|
| 43 | 284 (213+71) | 468 (332+136) | 319 (240+79) |
| 44 | 261 (201+60) | 408 (265+143) | 274 (224+50) |
| 45 | 261 (205+56) | 425 (291+134) | 295 (229+66) |
| 46 | 271 (200+71) | 401 (258+143) | 427 (313+114) |
| 47 | 283 (209+74) | 366 (221+145) | 342 (260+82) |
| 48 | 256 (177+79) | 378 (230+148) | 274 (189+85) |
| 49 | 256 (180+76) | 360 (216+155) | 226 (147+79) |
| 50 | 204 (148+56) | 339 (195+144) | ??? |
| 51 | 178 (124+54) | 323 (190+133) | 189 (134+55) |
| 52 | 115 (78+37) | 289 (190+99) | 147 (112+35) |
| 1 | 93 (60+33) | 287 (171+116) | 140 (104+36) |
| 1 | 93 (60+33) | 287 (171+116) | 140 (104+36) |
| 2 | 82 (46+36) | 271 (162+109) | 157 (124+33) |
| 3 | 25 (15+10) | 249 (165+84) | 172 (128+44) |
| 4 | 14 (8+6) | 244 (176+68) | 187 (132+55) |
| 5 | 2 (0+2) | 224 (132+92) | |
| 6 | release! | 212 (129+83) | |
| 7 | release+1 | 194 (128+66) | |
| 8 | release+2 | 206 (144+62) | |
| 9 | release+3 | 174 (105+69) | |
| 10 | release+4 | 120 (72+48) | |
| 11 | release+5 | 115 (74+41) | |
| 12 | release+6 | 93 (47+46) | |
| 13 | release+7 | 50 (24+26) | |
| 14 | release+8 | 51 (32+19) | |
| 15 | release+9 | 39 (32+7) | |
| 16 | release+10 | 20 (12+8) | |
| 17 | release+11 | 24 (19+5) | |
| 18 | release+12 | 2 (2+0) |
Last weekend I went to Mumbai to attend the Mini-Debconf held at IIT-Bombay. These are my impressions of the trip.
Arrival and Impressions of Mumbai
Getting there was a quite an adventure in itself. Unlike during my ill-fated attempt to visit a Debian event in Kerala last year when a bureaucratic snafu left me unable to get a visa, the organizers started the process much earlier at their end this time and with proper permissions. Yet in India, the wheels only turn as fast as they want to turn so despite their efforts, it was only literally at the last minute that I actually managed to secure my visa. I should note however that Indian government has done a lot to improve the process compared to the hell I remember from, say, a decade ago. It's fairly straightforward for tourist visas now and I trust they will get around to doing the same for conference visas in the fullness of time. I didn't want to commit to buying a plane ticket until I had the visa so I became concerned that the only flights left would be either really expensive or on the type of airline that flies you over Syria or under the Indian Ocean. I lucked out and got a good price on a Swiss Air flight, not non-stop but you can't have everything.
So Thursday afternoon I set off for JFK. With only one small suitcase getting there by subway was no problem and I arrived and checked in with plenty of time. Even TSA passed me through with only a minimal amount of indignity. The first leg of my journey took me to Zurich in about eight hours. We were only in Zurich for an hour and then (by now Friday) it was another 9 hours to Mumbai. Friday was Safala Ekadashi but owing to the necessity of staying hydrated on a long flight I drank a lot of water and ate some fruit which I don't normally do on a fasting day. It was tolerable but not too pleasant; I definitely want to try and make travel plans to avoid such situations in the future.
Friday evening local time I got to Mumbai. Chhattrapati Shivaji airport has improved a lot since I saw t last and now has all the amenities an international traveller needs including unrestricted free wifi (Zurich airport are you taking notes?) But here my first ominous piece of bad luck began. No sign of my suitcase. Happily some asking around revealed that it had somehow gotten on some earlier Swiss Air flight instead of the one I was on and was actually waiting for me. I got outside and Debian Developer Praveen Arimbrathodiyil was waiting to pick me up.
Normally I don't lke staying in Mumbai very much even though I have relatives there but that's because we usually went during July-August the monsoon season when Mumbai reverts back to the swampy archipelago it was originally built on. This time the weather was nice, cold by local standards, but lovely and spring-like to someone from snowy New Jersey. There have been a lot of improvements to the road infrastructure and people are actually obeying the traffic laws. (Within reason of course. Whether or not a family of six can arrange themselves on one Bajaj scooter is no business of the cops.)
The Hotel Tuliip (yes, two i's. Manager didn't know why.) Residency where I was to stay while not quite a five star establishment was adequate for my needs with a bed, hot water shower, and air conditioning. And a TV which to the bellhops great confusion I did not want turned on. (He asked about five times.) There was no Internet access per se but the manager offered to hook up a wireless router to a cable. Which on closer inspection turned out to have been severed at the base. He assured me it would be fixed tomorrow so I didn't complain and decided to do something more productive thank checking my email like sleeping.
The next day I woke up in total darkness. Apparently there had been some kind of power problem during the night which tripped a fuse or something. A call to the front desk got them to fix that and then the second piece of bad luck happened. I plugged my Thinkpad in and woke it up from hibernation and a minute later there was a loud pop from the power adapter. Note I have a travel international plug adapter with surge protector so nothing bad ought to have happened but the laptop would on turning on display the message "critical low battery error" and immediately power off. I was unable to google what that meant without Internet access but I decided not to panic and continue getting ready. I would have plenty of opportunity to troubleshoot at the conference venue. Or so I thought...
I took an autorickshaw to IIT. There also there have been positive improvements. Being quite obviously a foreigner I was fully prepared to be taken along the "scenic route." But now there are fair zones and the rickshaws all have (tamperproof!) digital fare meters so I was deposited at the main gate without fuss. After reading a board with a scary list of dos and don'ts I presented myself at security only to be inexplicably waved through without a second glance. Later I found out they've abandoned all the security theatre but not got around to updating the signs yet. Mumbai is one of the biggest, densely populated cities in the world but the IIT campus is an oasis of tranquility on the shores of Lake Powai. It's a lot bigger than it looked on the map so I had to wander around a bit before I reached the conference venue but I did make for the official registration time.
Registration
I was happy to meet several old friends (Such as Kartik Mistry and Kumar Appiah who along with Praveen and myself were the other DDs there,) people who I've corresponded with but never met, and many new people. I'm told 200+ people registered altogether. Most seemed to be students from IIT and elsewhere in Mumbai but there were also some Debian enthusiasts from further afield and most hearteningly some "civilians" who wanted to know what this was all about.
With the help of a borrowed Thinkpad adapter I got my laptop running again. (Thankfully, despite the error message, the battery itself was unharmed.) However, my streak of bad luck was not yet over. It was that very weekend that IIT had a freak campus-wide network outage something that had never happened before. And as the presentation for the talk I was to give had apparently been open when I hibernated my laptop the night before, the sudden forced shutdown had trashed the file. (ls showed it as 0 length. An fsck didn't help.) I possibly had a backup on my server but with no Internet access I had no way to retrieve it. I still remained cool. The talk was scheduled for the second day so I could recover it at the hotel.
Keynotes
Professor Kannan Maudgalya of the FOSSEE (Free and Open Source Software for Education) Project which is part of the central government Ministry for Human Resource Development spoke about various activities of his project. Of particular interest to us are:
For one of our customers we are using the Open Monitoring Distribution which includes Check_MK as monitoring system. We re monitoring the switches (Cisco) via SNMP. The switches as well as all the servers support GBit connections, though there are some systems in the wild which are still operating at 100MBit (or even worse on 10MBit). Recently there have been some performance issues related to network access. To make sure it s not the fault of a server or a service we decided to monitor the switch ports for their network speed. By default we assume all ports to be running at GBit speed. This can be configured either manually via:
cat etc/check_mk/conf.d/wato/rules.mk
[...]
checkgroup_parameters.setdefault('if', [])
checkgroup_parameters['if'] = [
( 'speed': 1000000000 , [], ['switch1', 'switch2', 'switch3', 'switch4'], ALL_SERVICES, 'comment': u'GBit links should be used as default on all switches' ),
] + checkgroup_parameters['if']
or by visting Check_MK s admin web-interface at WATO Configuration -> Host & Service Parameters -> Parameters for Inventorized Checks -> Networking -> Network interfaces and switch ports and creating a rule for the Explicit hosts switch1, switch2, etc and setting Operating speed to 1 GBit/s there.
So far so straight forward and this works fine. Thanks to this setup we could identify several systems which used 100Mbit and 10MBit links. Definitely something to investigate on the according systems with their auto-negotiation configuration. But to avoid flooding the monitoring system and its notifications we want to explicitly ignore those systems in the monitoring setup until those issues have been resolved.
First step: identify the checks and their format by either invoking cmk -D switch2 or looking at var/check_mk/autochecks/switch2.mk:
OMD[synpros]:~$ cat var/check_mk/autochecks/switch2.mk
[
("switch2", "cisco_cpu", None, cisco_cpu_default_levels),
("switch2", "cisco_fan", 'Switch#1, Fan#1', None),
("switch2", "cisco_mem", 'Driver text', cisco_mem_default_levels),
("switch2", "cisco_mem", 'I/O', cisco_mem_default_levels),
("switch2", "cisco_mem", 'Processor', cisco_mem_default_levels),
("switch2", "cisco_temp_perf", 'SW#1, Sensor#1, GREEN', None),
("switch2", "if64", '10101', 'state': ['1'], 'speed': 1000000000 ),
("switch2", "if64", '10102', 'state': ['1'], 'speed': 1000000000 ),
("switch2", "if64", '10103', 'state': ['1'], 'speed': 1000000000 ),
[...]
("switch2", "snmp_info", None, None),
("switch2", "snmp_uptime", None, ),
]
OMD[synpros]:~$
Second step: translate this into the according format for usage in etc/check_mk/main.mk:
checks = [ ( 'switch2', 'if64', '10105', 'state': ['1'], 'errors': (0.01, 0.1), 'speed': None ), # MAC: 00:42:de:ad:be:af, 10MBit ( 'switch2', 'if64', '10107', 'state': ['1'], 'errors': (0.01, 0.1), 'speed': None ), # MAC: 00:23:de:ad:be:af, 100MBit ( 'switch2', 'if64', '10139', 'state': ['1'], 'errors': (0.01, 0.1), 'speed': None ), # MAC: 00:42:de:ad:be:af, 100MBit [...] ]Using this configuration we ignore the operation speed on ports 10105, 10107 and 10139 of switch2 using the the if64 check. We kept the state setting untouched where sensible ( 1 means that the expected operational status of the interface is to be up ). The errors settings specifies the error rates in percent for warnings (0.01%) and critical (0.1%). For further details refer to the online documentation or invoke cmk -M if64 . Final step: after modifying the checks configuration make sure to run cmk -IIu switch2 ; cmk -R to renew the inventory for switch2 and apply the changes. Do not forget to verify the running configuration by invoking cmk -D switch2 :
Writing Your Way to Happiness (nytimes.com)The concept is based on the idea that we all have a personal narrative that shapes our view of the world and ourselves. But sometimes our inner voice doesn t get it completely right. Some researchers believe that by writing and then editing our own stories, we can change our perceptions of ourselves and identify obstacles that stand in the way of better health. It may sound like self-help nonsense, but research suggests the effects are real. Students who had been prompted to change their personal stories improved their grade-point averages and were less likely to drop out over the next year than the students who received no information. In the control group, which had received no advice about grades, 20 percent of the students had dropped out within a year. But in the intervention group, only 1 student or just 5 percent dropped out.Old Masters at the Top of Their Game (nytimes.com)
Now I am 79. I ve written many hundreds of essays, 10 times that number of misbegotten drafts both early and late, and I begin to understand that failure is its own reward. It is in the effort to close the distance between the work imagined and the work achieved wherein it is to be found that the ceaseless labor is the freedom of play, that what s at stake isn t a reflection in the mirror of fame but the escape from the prison of the self. T. H. White, the British naturalist turned novelist to write The Once and Future King, calls upon the druid Merlyn to teach the lesson to the young prince Arthur: You may grow old and trembling in your anatomies, you may lie awake at night listening to the disorder of your veins, you may miss your only love, you may see the world about you devastated by evil lunatics, or know your honour trampled in the sewers of baser minds. There is only one thing for it then to learn. Learn why the world wags and what wags it. That is the only thing which the mind can never exhaust, never alienate, never be tortured by, never fear or distrust, and never dream of regretting.A Life with a View (ribbonfarm.com)
The arrival fallacy is about seeking a life from which one can look with a complacent equanimity upon the rest of reality, without yearning. It is an ideal of a life that is defined primarily by blindness to itself. You yearn while you see your life as others see it, until you arrive at a situation where you can disappear into the broader background, and see comfortably without being seen discomfittingly, especially by yourself. Once you re there, the yearning stops, so the theory goes. Of course it is a laughably bad theory.How To Escape From A Moving Car (mrporter.com)
Everyone s first instinct is to put their hands or legs down first. That s the worst thing you can do: you will break something. The pointy parts of your body hurt elbows, knees, hips, ankles. Put your fists under your chin, and bring your elbows together. Keep your chin tucked in to your chest to protect your head. The best point of impact is the back of the shoulder and your back. If you dive out directly onto your shoulder you ll break it.What the World Looks Like with Social Anxiety (collegehumor.com)
Shea Strauss.Georges Braque has said that out of limited means, new forms emerge. I say, we find out what we will do by knowing what we will not do. And so, if your heart is set on 8 10 platinum landscapes in misty southern terrains, work your way through those who inspire you, ride their bus route and damn those who would say you are merely repeating what has been done before. Wait for the months and years to pass and soon your differences will begin to appear with clarity and intelligence, when your originality will become visible, even the works from those very first years of trepidation when everything you did seemed so done before.At 90, She s Designing Tech For Aging Boomers (npr.org)
And for the bulging demographic of baby boomers growing old, Beskind has this advice: Embrace change and design for it.
$ gpg --keyserver keyring.debian.org --send-keys 24B17D29#
# be sure to do "apt-get install python-gnupg"
#
import gnupg
import datetime
def check_keys(keyring, tab = ""):
gpg = gnupg.GPG(keyring = keyring)
gpg.decode_errors = 'replace' # see: https://bugs.debian.org/738483
keys = gpg.list_keys()
now = datetime.datetime.now()
for key in keys:
uids = key['uids']
uid = uids[0]
if key['expires'] != '':
expire = datetime.datetime.fromtimestamp(int(key['expires']))
diff = expire - now
if diff.days < 0:
print(u' EXPIRED: Key of expired days ago.'.format(tab, uid, -diff.days))
mangled_uids = [ u for u in uids if u'\ufffd' in u ]
if len(mangled_uids) > 0:
print(u' MANGLED: Key of has some mangled uids: '.format(tab, uid, mangled_uids))
keyrings = [
"/usr/share/keyrings/debian-keyring.gpg",
"/usr/share/keyrings/debian-maintainers.gpg"
]
for keyring in keyrings:
print(u"CHECKING ".format(keyring))
check_keys(keyring, tab = " ")#!/usr/bin/env python3
#coding: utf-8
# Copyright 2015 Enrico Zini <enrico@enricozini.org>. Licensed under the terms
# of the GNU General Public License, version 2 or any later version.
import argparse
import fcntl
import select
import curses
import contextlib
import subprocess
import os
import sys
import collections
import shlex
import shutil
import logging
def stream_output(proc):
"""
Take a subprocess.Popen object and generate its output, line by line,
annotated with "stdout" or "stderr". At process termination it generates
one last element: ("result", return_code) with the return code of the
process.
"""
fds = [proc.stdout, proc.stderr]
bufs = [b"", b""]
types = ["stdout", "stderr"]
# Set both pipes as non-blocking
for fd in fds:
fcntl.fcntl(fd, fcntl.F_SETFL, os.O_NONBLOCK)
# Multiplex stdout and stderr with different prefixes
while len(fds) > 0:
s = select.select(fds, (), ())
for fd in s[0]:
idx = fds.index(fd)
buf = fd.read()
if len(buf) == 0:
fds.pop(idx)
if len(bufs[idx]) != 0:
yield types[idx], bufs.pop(idx)
types.pop(idx)
else:
bufs[idx] += buf
lines = bufs[idx].split(b"\n")
bufs[idx] = lines.pop()
for l in lines:
yield types[idx], l
res = proc.wait()
yield "result", res
@contextlib.contextmanager
def miniscreen(has_fancyterm, name, maxlines=3, silent=False):
"""
Show the output of a process scrolling in a portion of the screen.
has_fancyterm: true if the terminal supports fancy features; if false, just
write lines to standard output
name: name of the process being run, to use as a header
maxlines: maximum height of the miniscreen
silent: do nothing whatsoever, used to disable this without needing to
change the code structure
Usage:
with miniscreen(True, "my process", 5) as print_line:
for i in range(10):
print_line(("stdout", "stderr")[i % 2], "Line # ".format(i))
"""
if not silent and has_fancyterm:
# Discover all the terminal control sequences that we need
output_normal = str(curses.tigetstr("sgr0"), "ascii")
output_up = str(curses.tigetstr("cuu1"), "ascii")
output_clreol = str(curses.tigetstr("el"), "ascii")
cols, lines = shutil.get_terminal_size()
output_width = cols
fg_color = (curses.tigetstr("setaf") or
curses.tigetstr("setf") or "")
sys.stdout.write(str(curses.tparm(fg_color, 6), "ascii"))
output_lines = collections.deque(maxlen=maxlines)
def print_lines():
"""
Print the lines in our buffer, then move back to the beginning
"""
sys.stdout.write(" progress:".format(name))
sys.stdout.write(output_clreol)
for msg in output_lines:
sys.stdout.write("\n")
sys.stdout.write(msg)
sys.stdout.write(output_clreol)
sys.stdout.write(output_up * len(output_lines))
sys.stdout.write("\r")
try:
print_lines()
def _progress_line(type, line):
"""
Print a new line to the miniscreen
"""
# Add the new line to our output buffer
msg = " ".format("." if type == "stdout" else "!", line)
if len(msg) > output_width - 4:
msg = msg[:output_width - 4] + "..."
output_lines.append(msg)
# Update the miniscreen
print_lines()
yield _progress_line
# Clear the miniscreen by filling our ring buffer with empty lines
# then printing them out
for i in range(maxlines):
output_lines.append("")
print_lines()
finally:
sys.stdout.write(output_normal)
elif not silent:
def _progress_line(type, line):
print(" : ".format(type, line))
yield _progress_line
else:
def _progress_line(type, line):
pass
yield _progress_line
def run_command_fancy(name, cmd, env=None, logfd=None, fancy=True, debug=False):
quoted_cmd = " ".join(shlex.quote(x) for x in cmd)
log.info("%s running command %s", name, quoted_cmd)
if logfd: print("runcmd:", quoted_cmd, file=logfd)
# Run the script itself on an empty environment, so that what was
# documented is exactly what was run
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
with miniscreen(fancy, name, silent=debug) as progress:
stderr = []
for type, val in stream_output(proc):
if type == "stdout":
val = val.decode("utf-8")
if logfd: print("stdout:", val, file=logfd)
log.debug("%s stdout: %s", name, val)
progress(type, val)
elif type == "stderr":
val = val.decode("utf-8")
if logfd: print("stderr:", val, file=logfd)
stderr.append(val)
log.debug("%s stderr: %s", name, val)
progress(type, val)
elif type == "result":
if logfd: print("retval:", val, file=logfd)
log.debug("%s retval: %d", name, val)
retval = val
if retval != 0:
lastlines = min(len(stderr), 5)
log.error("%s exited with code %s", name, retval)
log.error("Last %d lines of standard error:", lastlines)
for line in stderr[-lastlines:]:
log.error("%s: %s", name, line)
return retval
parser = argparse.ArgumentParser(description="run a command showing only a portion of its output")
parser.add_argument("--logfile", action="store", help="specify a file where the full execution log will be written")
parser.add_argument("--debug", action="store_true", help="debugging output on the terminal")
parser.add_argument("--verbose", action="store_true", help="verbose output on the terminal")
parser.add_argument("command", nargs="*", help="command to run")
args = parser.parse_args()
if args.debug:
loglevel = logging.DEBUG
elif args.verbose:
loglevel = logging.INFO
else:
loglevel = logging.WARN
logging.basicConfig(level=loglevel, stream=sys.stderr)
log = logging.getLogger()
fancy = False
if not args.debug and sys.stdout.isatty():
curses.setupterm()
if curses.tigetnum("colors") > 0:
fancy = True
if args.logfile:
logfd = open("output.log", "wt")
else:
logfd = None
retval = run_command_fancy("miniscreen example", args.command, logfd=logfd)
sys.exit(retval)
I ve been meaning to move away from Movable Type for a while; they no longer provide the Open Source variant, I ve had some issues with the commenting side of things (more the fault of spammers than Movable Type itself) and there are a few minor niggles that I wanted to resolve. Nothing has been particularly pressing me to move and I haven t been blogging as much so while I ve been keeping an eye open for a replacement I haven t exerted a lot of energy into the process. I have a little bit of time at present so I asked around on IRC for suggestions. One was ikiwiki, which I use as part of helping maintain the SPI website (and think is fantastic for that), the other was Jekyll. Both are available as part of Debian Jessie.
Jekyll looked a bit fancier out of the box (I m no web designer so pre-canned themes help me a lot), so I decided to spend some time investigating it a bit more. I d found a Movable Type to ikiwiki converter which provided a starting point for exporting from the SQLite3 DB I was using for MT. Most of my posts are in markdown, the rest (mostly from my Blosxom days) are plain HTML, so there wasn t any need to do any conversion on the actual content. A minor amount of poking convinced Jekyll to use the same URL format (permalink: /:year/:month/:title.html in the _config.yml did what I wanted) and I had to do a few bits of fix up for some images that had been uploaded into MT, but overall fairly simple stuff.
Next I had to think about comments. My initial thought was to just ignore them for the moment; they weren t really working on the MT install that well so it s not a huge loss. I then decided I should at least see what the options were. Google+ has the ability to embed in your site, so I had a play with that. It worked well enough but I didn t really want to force commenters into the Google ecosystem. Next up was Disqus, which I ve seen used in various places. It seems to allow logins via various 3rd parties, can cope with threading and deals with the despamming. It was easy enough to integrate to play with, and while I was doing so I discovered that it could cope with importing comments. So I tweaked my conversion script to generate a WXR based file of the comments. This then imported easily into Disqus (and also I double checked that the export system worked).
I m sure the use of a third party to handle comments will put some people off, but given the ability to export I m confident if I really feel like dealing with despamming comments again at some point I can switch to something locally hosted. I do wish it didn t require Javascript, but again it s a trade off I m willing to make at present.
Anyway. Thanks to Tollef for the pointer (and others who made various suggestions). Hopefully I haven t broken (or produced a slew of new posts for) any of the feed readers pointed at my site (but you should update to use feed.xml rather than any of the others - I may remove them in the future once I see usage has died down).
(On the off chance it s useful to someone else the conversion script I ended up with is available. There s a built in Jekyll importer that may be a better move, but I liked ending up with a git repository containing a commit for each post.)
Next.