Paste not working the way it should?

Many (if not most) websites are broken in various ways these days. One of the favorite bugs of web developers is breaking copy&paste. For whatever reason pasting text into form fields is not working at all on many websites.

Today gvim was annoying me with a different misfeature: Pasting text with more than one line is always inserted on a new line above the cursor. I want the text pasted where the cursor is, not where vim’s developers think they would like it. That’s the last straw.

To solve this problem for all times I wrote a small script which converts the paste buffer into keystrokes. For all applications it will look as if that text has been entered with the keyboard. Here is the code of my pastinator.py. Download it and bind it to a key, for example Tux+V (Windows+V) or any other key you like.

Now always when I press Tux+V I get the contents of the copy buffer pasted exactly how I want it.

UDEV rule for USBASP

Again I got permission denied to access USBASP using avrdude. To fix this an UDEV rule has to be created.

A long time ago I created the file /etc/udev/rules.d/99-USB-AVR-PRG.rules with the following content:
# see: http://www.mikrocontroller.net/articles/AVRDUDE#Aufruf_unter_Linux_als_user_.28non-root.29
#
# http://hackaday.com/2009/09/18/how-to-write-udev-rules/
#
# udevadm info -a -p /sys/bus/usb/devices/3-1
#
# After a change restart udev:
# systemctl restart udev.service

# borked rule
# Atmel AVR ISP mkII
#SUBSYSTEM=="usb", SYSFS{idVendor}=="03eb", SYSFS{idProduct}=="2104", GROUP="users", MODE="0660"

# usbprog bootloader
#ATTRS{idVendor}=="1781", ATTRS{idProduct}=="0c62", GROUP="users", MODE="0660"

# USBasp programmer
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", GROUP="users", MODE="0666"

# USBtiny programmer
#ATTRS{idVendor}=="1781", ATTRS{idProduct}=="0c9f", GROUP="users", MODE="0660"

Most of the content is shamelessly copied and then commented out, then for me the only interesting line is the one for USBASP.

After copying the file I restarted UDEV with the following command:
systemctl restart udev.service

Now after plugging in USBASP the device should get the appropriate permissions.

How to Create a Verified E-Aadhaar Card PDF on Linux

The E-Aadhaar Card PDF which can be downloaded from the UID Authority of India contains a signature and some brain damaged verification code. In the middle of the page on the right side it shows “Not verified”, a yellow question mark and some more text about the digital signature. This question mark has to be clicked which then verification process. When this process is finished the question mark is replaced by a green tick and the text reads “Signature valid”. Since everybody just prints the page and deletes the file this verification process is completely superfluous. Since a smart ass wanted to save some money these documents are not signed by a proper key which makes the whole process a bit cumbersome.

The following steps show how to download the Aadhaar Card and convert it to a nice PDF:

Continue reading

“Modern” Webpages Suck

These days almost all the web-morons think they have to fill their webpages with random useless crappy javascript for no reason.

Have a look at one example of many: python-gtk-3-tutorial.readthedocs.io. It consists of static content only, nothing that would justify the use of javascript. But anyway they thought it is clever to add tons of it:

wget -q -O - \
https://media.readthedocs.org/javascript/jquery/jquery-2.0.3.min.js \
https://media.readthedocs.org/javascript/jquery/jquery-migrate-1.2.1.min.js \
https://media.readthedocs.org/javascript/underscore.js \
https://media.readthedocs.org/javascript/doctools.js \
https://media.readthedocs.org/javascript/readthedocs-doc-embed.js \
http://python-gtk-3-tutorial.readthedocs.io/en/latest/_static/js/modernizr.min.js \
http://python-gtk-3-tutorial.readthedocs.io/en/latest/_static/readthedocs-data.js \
http://python-gtk-3-tutorial.readthedocs.io/en/latest/_static/readthedocs-dynamic-include.js \
| wc -c
141839

This is almost 140kB of javascript, more than the source text files which are around 100kB for the whole tutorial. Each page contains around 5kB content, so the ratio between javascript and content is 28:1 !

Another big problme is, that the code is written by gardeners or lumberjacks, but not by IT professionals. The bugs in the code make it very unreliable. For example on Aliexpress I get the following message pretty often: Due to network reasons , adding that fails, re-click the "Add to Wish List". But clicking “add to wishlist” again and again and again just results in the same error message. The only thing that helps is reloading the page.

But there are more drawbacks of using javascript, here is an incomplete list:

  • Javascript leads to more bandwith used which:
    • makes the webpage loading slower,
    • causes more load on the server,
    • causes more costs for the bandwith of the server,
    • and uses up the megabytes of my connection which I have to pay!
  • Javascript wastes the memory of my computer which I could better use for productive work.
  • Javascript executes slow and makes me yawn because of the very slow user experience. Many websites are completely unusable on slower machines.
  • Javascript code is neither security reviewed nor signed, it is completely untrusted code running on my machine.
  • Javascript is generally written by hobbyists with not much CS knowledge. That’s one reason these pages are very unreliable.
  • Javascript is often used to make very stupid things like breaking the back button or copy&paste. I don’t know if that is just a result of the stupidity of the coder or if it is done intentionally, no matter why it is done, it is very bad and annoying.
  • Javascript is most of the time written by amateurs, not by well educated IT professionals. Obviously nobody who is at least a little bit sane would want to write code in such an awful language.
  • Javascript code is never tested thoroughly. Or have you ever heard of someone writing a test suite for his webpage?
  • There are probably a lot more…

So please make the world a better place by limiting the use of javascript to only those cases which really need it.

Thank you.

Shutdown delayed by Avahi mDNS/DNS-SD using systemd

Sometimes systemd feels the urge to wait 2 minutes for some service which makes troubles and then continues to boot or shutdown. Two minute timeout is hopeless insane for this default configuration, even 5 seconds feels like endless waiting.

The timeout can be set in /etc/systemd/system.conf. Just add the following lines or change them if they already exist:
DefaultTimeoutStartSec=5s
DefaultTimeoutStopSec=5s

This Avahi mDNS daemon is for zeroconf. Just uninstall this bloody crApple rubbish:
apt-get remove --purge avahi-daemon

Another annoying delay is caused by the network code trying to get an IP address over a NIC where no cable is plugged in. I have no solution for this problem yet, but with lower timeout it’s not that awful anymore.

ELV sucks

A friend gave me a link to an ELV product which I copied and pasted into my browsers URL bar. ELV then presented me with this completely useless warning on their webpage:

elv-sucks

Additionally they set a shit load of cookies. Obviously one or more of them are used to prevent this retarded warning.

I wonder why should I run an anti-virus program when I access a website? Especially when my browser is running on a Linux box behind an OpenBSD firewall? I’m sorry but I haven’t seens something this retarded ever.

So my recommendation is:

Fuck ELV. Never ever ever ever never ever buy something from ELV!

Also don’t visit their site, block and delete all their cookies.