Apt update stuck waiting for headers


I tried to update the apt cache on a machine that had not been updated in a long time:

$ sudo apt-get update

But that got stuck at one of the repositories Waiting for headers. No matter how many times I tried the command, it would get stuck at this.


The problem went away once I cleared the cache using these steps as explained here:

$ sudo apt-get clean
$ cd /var/lib/apt
$ sudo mv lists lists.old
$ sudo mkdir -p lists/partial
$ sudo apt-get clean
$ sudo apt-get update 

Tried with: Ubuntu 16.04

Cache file could not be renamed error


I installed a fresh copy of Eclipse. I opened its Update Software section to install some software. The Mars section took forever to load and in the end threw this error:

Unable to read repository at http://download.eclipse.org/releases/mars.
An error occurred while downloading http://download.eclipse.org/releases/mars/201506241002/content.xml.xz.
The cache file /home/joe/eclipse/p2/org.eclipse.equinox.p2.repository/cache/downloading/467561694 could not be renamed to /home/joe/eclipse_/p2/org.eclipse.equinox.p2.repository/cache/467561694.


This error persisted no matter if I restarted Eclipse. In the end, I just deleted the p2/org.eclipse.equinox.p2.repository/cache directory. The software list uploaded fine after that.

Tried with: Eclipse 4.5 and Ubuntu 14.04

How to change the directory and size of AFS cache

A typical OpenAFS installation uses the /var/cache/openafs directory as a cache for the files and directories you access on the AFS distributed file system. It typically mounts the file system at the local directory named /afs where you can access it as if it existed on your local storage. The commonly used size of the cache is 50MB.

To change any of these 3 parameters, edit the /etc/openafs/cacheinfo file. A typical line in this file is:


The first item is the local directory where AFS is mounted, the second is the location of the cache and the third is the size in KB. Change these to any values you want and restart the OpenAFS client for it to take effect:

$ sudo /etc/init.d/openafs-client restart

Tried with: OpenAFS 1.6.7 and Ubuntu 14.04

Integer caching in Python

When a Python program assigns integers to variables, thus giving a name to a value, integer objects need to be created for them. Integers like 0, -1 or small integers are very common in programs. For integer object creation, use and destruction to be efficient for these common values, these objects are created only once and cached to be used for any variable that need such a value.

The range of integers that are cached by Python is specific to the implementation. But, this can be discovered easily by using the is operator, which returns True is two names are refer to the same object.

On my Python 3.2 64-bit CPython implementation, the range of integers that are cached seems to be -5 to 256.

Tried with: Python 3.2 64-bit on Windows 7