rtorrent sequential download

Patch libtorrent

diff --git a/src/download/chunk_selector.cc b/src/download/chunk_selector.cc
index 850fec0f..248a29f9 100644
--- a/src/download/chunk_selector.cc
+++ b/src/download/chunk_selector.cc
@@ -82,7 +82,7 @@ ChunkSelector::update_priorities() {
   m_sharedQueue.clear();
 
   if (m_position == invalid_chunk)
-    m_position = random() % size();
+    m_position = 0;
 
   advance_position();
 }
@@ -100,14 +100,6 @@ ChunkSelector::find(PeerChunks* pc, __UNUSED bool highPriority) {
   // set.
   rak::partial_queue* queue = pc->is_seeder() ? &m_sharedQueue : pc->download_cache();
 
-  // Randomize position on average every 16 chunks to prevent
-  // inefficient distribution with a slow seed and fast peers
-  // all arriving at the same position.
-  if ((random() & 63) == 0) {
-    m_position = random() % size();
-    queue->clear();
-  }
-
   if (queue->is_enabled()) {
 
     // First check the cached queue.

Libvirt – Auto resize does not work on most linux guests

It is left to the DM to resize after being informed by libvirt there has been a change. Many don’t.
Poor design decision IMHO.

xrandr --output Virtual-1 --auto

Will resize to the window size you have chosen. The Virtual-1 part might need adjusting. You can find out by using

xrandr

on it’s own. In the case of a Manjero VM I just installed

$ xrandr
Screen 0: minimum 320 x 200, current 1256 x 869, maximum 8192 x 8192
Virtual-1 connected primary 1256x869+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1256x869      59.98*+
   2560x1600     59.99    59.97  ....................................

So it’s Virtual-1.

Make a script and link it to a hotkey and it’s less of an annoyance.

Note: spice-vdagent may need to be installed and running for this to work ?

Bezel correction and multiple displays with Nvidia driver on Linux – Metamode seems to be ignored

In theory it should be as easy as using offsets in a ‘metamode’ line. in he screen section of xorg.conf eg.

	Option         "metamodes" "DP-0: 1920x1080_75 +0+0,DP-2: 1920x1080_75 +1962+0, DP-4: 1920x1080_75 +3924+0

Where +0+0 , +1962+0 and +3924+0 is adding 42 pixels between monitors to account for the size of my bezels. But it doesn’t work. The metamode line is ignored and the nvidia driver make it’s own metamode line, as seen in Xorg.log

[ 40517.093] (**) NVIDIA(0): Option "MetaModes" "DP-2: 1920x1080_75 +1920+0, DP-0: 1920x1080_75 +0+0, DP-4: 1920x1080_75 +3840+0"

I can change the absolute positions in the nvidia-settings GUI. Press apply and it works. I have my bezel correction. But then click ‘Save to Xconfig file’, Fire up an xserver with that .conf and it overrides the custom metamode again.

Work around:

Use nvidia-settings gui to position the displays with the offsets you want. Click apply.
On the command line
nvidia-settings –query Currentmetamode
Which gave me

Attribute ‘CurrentMetaMode’ (gent:1.0): id=50, switchable=no, source=nv-control :: DPY-3: 1920x1080_75 @1920x1080
+1962+0 {ViewPortIn=1920x1080, ViewPortOut=1920x1080+0+0}, DPY-0: 1920x1080_75 @1920x1080 +0+0
{ViewPortIn=1920x1080, ViewPortOut=1920x1080+0+0}, DPY-5: 1920x1080_75 @1920x1080 +3924+0 {ViewPortIn=1920x1080,
ViewPortOut=1920x1080+0+0}

You’ll need to clean up newlines and extra white space so its all on one line . Get rid of the “(gent:1.0): id=50, switchable=no, source=nv-control ::” bit (when I didn’t the command succeeded but I lost my middle display). Get rid of Attribute, put an = after ‘CurrentMetaMode’ and double quotes around every following, and nvidia-settings –assign at the start and you should be left with some thing like this

nvidia-settings --assign 'CurrentMetaMode'="DPY-3: 1920x1080_75 @1920x1080 +1962+0  {ViewPortIn=1920x1080, ViewPortOut=1920x1080+0+0}, DPY-0: 1920x1080_75 @1920x1080 +0+0 {ViewPortIn=1920x1080, ViewPortOut=1920x1080+0+0}, DPY-5: 1920x1080_75 @1920x1080 +3924+0 {ViewPortIn=1920x1080, ViewPortOut=1920x1080+0+0}"

So that command is run before playing a game where bezel correction is required. Run it again without the offsets to go back to normal.

compile gcc on odroid-u2 with mfpu=neon – Arch linux

currently gcc 4.8.1 on Arch (07.10.13)

Flags in makepkg.conf

CPPFLAGS=""
CFLAGS="-O3 -pipe -march=armv7-a -mcpu=cortex-a9 -mfloat-abi=hard -mfpu=neon -fstack-protector --param=ssp-buffer-size=4"
CXXFLAGS="-O3 -pipe -march=armv7-a -mcpu=cortex-a9 -mfloat-abi=hard -mfpu=neon -fstack-protector --param=ssp-buffer-size=4"

PKGBUILD needs one patch adding (neon-update3.patch) and one removing (armhf-triplet-trunk.diff)
As it is patch will fail to find the file to be patched and you will have to supply the full path.
in my case

 /var/build/gcc/src/gcc-4.8-20130725/gcc/config/arm/neon.md

Also need to change flags pass to GCC by configure.

[[ $CARCH == "armv7h" ]] && CONFIGFLAG="--host=armv7l-unknown-linux-gnueabihf --build=armv7l-unknown-linux-gnueabihf --with-arch=armv7-a --with-float=hard --with-fpu=neon"

The PKGBUILD with the changes is attached as is neon-update3.patch

The original PKGBUILD is from https://github.com/archlinuxarm/PKGBUILDs/blob/master/core/gcc/PKGBUILD

neon-update3.patch is from http://gcc.1065356.n5.nabble.com/PATCH-ARM-Fix-unrecognizable-vector-comparisons-td947064.html

PKGBUILD.orig

PKGBUILD

neon-update3.patch

Force Mono (Black and White) with LPR

In the below substitute HL4140CN with the printer name. (also the option names may difer, this is for a brother)

List the options with:

lpoptions -p HL4140CN -l

Add an “instance” of the printer with the option for Mono printing

lpoptions -p HL4140CN/bw -o BRMonoColor=Mono

Now the following will print Mono

lpr -P HL4140CN/bw any.txt

What this blog is and isn’t

What this blog is

This blog is something I’ve been meaning to do for a very long time.

I’ve been messing around with Linux, servers and websites for years. Some parts come easy, some parts I have trouble with. Some things I (almost) always remember, some things I never do.

So I intend to record ‘snippets’ of information, as and when I come across them, which I believe I may find helpful to myself in the future. So that I don’t have to go google hunting for the same  information every time I encounter the same problem.

If anyone else come across this blog and it helps them all good. But it probably won’t.

What this blog isn’t

A step by step guide on anything.

Guaranteed to be accurate.

Well written.

PS

I sell electronic cigarettes and e-liquid