From CPython bytecode up to function objects (in brief)
Python bytecode is thelow level heart of (C)Python; it's what the CPython interpreteractually processes in order to run your Python code. The dis module is the heart of informationon examining bytecode and on the bytecodes themselves. But CPythondoesn't just run bytecode in isolation. In practice bytecode is alwayspart of some other object, partly because bytecode by itself is notself-contained; it relies on various other things for context.
Bytecode by itself looks like this:
>>> fred
Track your disk failures
Here is something that we've been learning the hard way: if you haveany sort of fileserver environment with a significant number of disks(and maybe even if you don't), you should be tracking all of your diskfailures . What this tracking is for is identifying failure patterns inyour environment, things like whether certain sorts of disks fail moreoften, or disks in certain enclosures, and so on.
The very basic information you should record is full details forevery disk failure. What I'
Baidu's web spider ignores robots.txt (at least sometimes)
On my personal site I've had an entry in my robots.txt to totally disallow Baidu's web spider for a long time,for various reasons (including that it doesn't respect nofollow ). Recently I was looking at my logs for anotherreason, and, well, imagine my surprise when I saw requests fromsomething with a user-agent of Baiduspider/2.0 . Further investigationshowed that this has been going on for several months, although therequest volume was not high. Worse
You are not fooling us with broken bounce addresses
This is a close cousin on my previous blog entry on broken bounceaddresses , but today I'm feeling lesscharitable. Right now we have sitting in our mail queues a bounce that'strying to be delivered to the address mailreturn@smtp.ymlp44.net andhas been for the past ten hours. From past experience I know that thismessage will never be delivered; it will sit there until it times out.
Since this is an actual bounce, the original message was notscored as spam
My hack use for Chrome's Incognito mode
These days I have a script that starts Chrome in Incognito mode (or atleast opens another window if Chrome is already running, which I amstarting to arrange). It looks like this:
#!/bin/shexec google-chrome --incognito --new-window "$@"
(Note that --new-window is an undocumented option and thus may changesomeday.)
I don't do this because I like Chrome or because I need anonymitythat often (and anyways my
The difference between no argument and an empty argument
Here is a little Bourne shell quiz. Supposing that $VAR is notdefined, are the following two lines equivalent?
./acnt $VAR./acnt "$VAR"
The answer is no. If the acnt script is basically ' echo "$#" ',then the first one will print 0 and the second one will print 1; inother word, the first line called acnt with no argument and thesecond one called acnt with one argument (that happens to be an emptystring).
test is surprisingly smart
Via Hacker News Iwould up reading Common shell script mistakes . WhenI read this, I initially thought that it contained well-intentionedbut mistaken advice about test (aka ' [ ... ] '). Then I actuallychecked what test 's behavior is and got a bunch of surprised. Itturns out that test is really quite smart, sometimes disturbinglyso.
Here's two different versions of a test expression:
[ x"$var" = x"find" ] && echo yes
Why booting Linux from a ZFS root filesystem with GRUB can be hard
When I talked about the current weak areas of ZFS on Linux , one of them was using ZFS as your rootfilesystem (generally with Grub). Today I want to talk a bitmore about why this is a non-trivial thing and by extensionwhy booting from any new filesystem type takes more than youmight think.
But first, let's be technical here because there can be two filesystemsinvolved: your actual root filesystem and the boot filesystem. The bootfilesystem is the filesystem with your kernel and initramfs
The 10G Ethernet performance problem on Linux
It's clear that 10G Ethernet on Linux is not yet in the state that 1GEthernet is, where you can simply assume that you'll get wire speedunless your hardware is terrible (but sometimes your hardware isterrible, or at least not great). Instead you need to tune things forbest performance, and do so beyond the basics of MTU 9000 and largeapplication buffers. There are even any number of resources on the webto tell you things about this; for
Sending and receiving file descriptors in Python
On some but not all modern Unix systems, file descriptors (theunderlying operating system level thing behind open files, sockets, andso on) can be passed between cooperating processes using Unix domainsockets and special options to sendmsg() and recvmsg() . There are anumber of uses for this under various circumstances; the one that I'minterested in is selectively offloading incoming network connectionsfrom one process to another one that is better suited to handle someparticular connections.
In Python 3.3 and later,