mercredi 29 mai 2013

javascript/jQuery oneliner to remove iframes

jQuery("iframe").each(function(i,e) {var p=e.parentNode; p.removeChild(e);})
oh I think I saw a unnecessary variable declaration !
jQuery("iframe").each(function(i,e) {e.parentNode.removeChild(e);})

That's all Folks !!!

/me bugs out.

dimanche 19 mai 2013

Running HP Colorado T1000 tape drive under Linux - Part 1 : outdated drivers for linux 2.0

I have a HP Colorado T1000 drive with one backup tape from the win95 era (I can probably say there's doom on it). I'd like to leverage my new-found dell 4500s desktop to plug it and extract the 400-800MB of data, but the linux driver, namely `ftape`, is for linux 2.0 I believe. I downloaded the latest release, version 4.04, from 2000:

dummy@x60s_GPT ~/work/ftape-4.04
  % cloc .                                                                                                                                !4591
     132 text files.
     121 unique files.                                        
      30 files ignored.

http://cloc.sourceforge.net v 1.58  T=1.0 s (102.0 files/s, 31527.0 lines/s)
--------------------------------------------------------------------------------
Language                      files          blank        comment           code
--------------------------------------------------------------------------------
C                                36           2210           4634          17256
C/C++ Header                     48            838           2018           3354
Bourne Shell                      8             48            214            396
make                              8             62            228            203
Bourne Again Shell                2              1             47             18
--------------------------------------------------------------------------------
SUM:                            102           3159           7141          21227
--------------------------------------------------------------------------------


That's a lot of lines TT_TT

samedi 18 mai 2013

Crossing streams : How I swamped my ThinkPad X60s keyboard

I splought (when you choke to avoid coughing but end up spiting twice more with a now open mouth) on my keyboard. Some of it got under the keys. Fortunately I have spare parts, especially keyboards (touchtypist/IBM keyboard feel fetish) so I swap to let this one dry. After a little bit of tissue and a few minutes I plug it back, and I witness something for the first time : a keyboard bug. Pairs of adjacent keys are now influencing each others lines, typing 's' echo 'sa'. '1' echo '21'. 'tab' echo 'tab[invisible caps lock]' which means now it's FREE LISP STYLE. Before I toss it to the garbage I try remove the key support tryptic. It's a set of 3 fragile and tiny plastic parts: a bottom frame, and two crossing hooks forming a X supporting a little rectangle pushing over a latex cushion. I don't know what degree you need to do that, it's all so tiny and weak yet when plugged together its stable and sturdy. Plus it's very very easy to unmount/remount. At least when you figured it out. Anyway, it's amazing, and now that they're all off the keyboard plane, I can spill a little bit of isopropylic alcohol in the hope that it will improve things. It's unbelievably dirty here, full of 0.1mm breadcrumbs, and also lots of cat hair stuck in every possible way...
Time to plug it back for good, just after a quick keyless test (the key are just providing pressure for the board layers to connect, so your finger will do just fine) showing everything got back to order. Reassembling the 10~ keys and their X support is quite fun. And here I am typing this.















reassembly step 1 : pre slide

reassembly step 2 - half slide

reassembly step 3 - pre second half

reassembly step 4 - base seated

step 5 - cross up insertion

step 6 - up insertion done, bottom resting

step 7 - push bottom legs in their plug~

step 8 - legs done








locking claws~ to be clipped on top of Cross

jeudi 16 mai 2013

DELL 4500s from the forest - chapter 3 : the install-partying

So that old DELL 4500s runs. I also found an recent (using systemd) archlinux live cd so I can enjoy a more modern driver set and OS utils. But it can't boot usb, so I'll have to find another persistant storage device, namely : a hard drive. No problem, I have a dozen hard drive sleeping under my bed. Except half of them are < 4G or SATA, all but one [ex IBM] Hitachi Deskstar 80GB (you know, the model just after the Hitachi DeathStar 60GB failure generators). One empty slot in the partition table, 7GB+ of capacity, perfect. That doesn't solve the boot issue, I don't have a spare partition for grub. I'll try to bootstrap the boot from the live cd. I'm in the mood for some serious bad idea attempts tonight.

DELL 4500s from the forest - chapter 2 : the booting [yes it does do run]

A while back I found a Dell 4500S (2002) in the woods. Today I decided to procrastinate (job search) by not procrastinating (geekery), so I plugged an old PSU (the original PSU looked busted) and push the dreaded button. For the record, I saw this machine 2 days before I finally picked it up, it was probably there for 2 full nights with rainy sessions. Anyway, #1 it boots, it's stable. But it's 2002 and usb boot is not included in mainstream BIOS, so I dug up an old Knoppix. And yay, hello KDE3.
For fun I hand-copied a weird ANSI C program as a benchmark Pi calculation in Emacs 21. Was fun to do except for the fact that my fingers have internalized 12 inches ThinkPad keyboards and I miss half my strokes. The bench was too old to be of any use, 0.130s to run.

#2 Out of curiosity I tried the original PSU. It's a slim design, very neat, with a low noise fan. Quite cool. It's almost silent compared to my crappy ATX one.

I need to test networking and a more recent distro. In the end I'll probably give it away to charity, it's faster than a raspberry pi so they may want it.

Oh, some last minute things: 'they' took the hdd before throwing it. The BIOS seems DELL specific, and includes a log store; last event is from 2002. Weird.

ps: shit, this thing doesn't even have an ethernet chip, and the only extension slot is a slim thing, I doubt I can fit one of my old pci wifi card. Knoppix is too old for usb wifi it seems. I need to burn an old Linux Mint on a cd, 2000 style.

mardi 14 mai 2013

how bad mouse events are ergonomic papercuts

I tried to use this configuration bit to activate have trackpoint 'wheel' scrolling emulation.

Section "InputDevice"
       Identifier "TPPS/2 IBM TrackPoint"
       Driver     "evdev"
       Option     "Device" "/dev/input/by-path/platform-i8042-serio-1-event-mouse"
       Option     "GrabDevice" "False"
       Option     "EmulateWheel" "true" #Enable wheel emulation for the Trackpoint
       Option     "EmulateWheelButton" "2" #Use the middle button for the emulation
       Option     "XAxisMapping" "6 7" #Map trackpoint X axis to X axis of emulated wheel
       Option     "YAxisMapping" "4 5" #Map trackpoint Y axis to Y axis of emulated wheel
EndSection


I believe it caused some erroneous event duplications. Maybe down and up events being handled as being the same kind. It quickly drives you mad. Files asked to open instead of appended to selection. Boolean buttons doubly toggled in vain. So I backed to this old copy/pasted configuration. 

Section "InputDevice"
        Identifier      "USB Mouse"
        Driver          "mouse"
        Option          "Device"                "/dev/input/mice"
        Option          "SendCoreEvents"        "true"
        Option          "Protocol"              "IMPS/2"
        Option          "ZAxisMapping"          "4 5"
        Option          "Buttons"               "5"
EndSection


No frills but it works, and god does it makes you zen.

dimanche 12 mai 2013

archlinux pacman helper

I don't always follow pacman updates output. I believe this behavior was the reason I was left with an unbootable system. Mainly because of a long time due change for /bin/systemd to be removed, /bin/init being the sole entry point for the bootloader to continue. Anyway, as for LFS (Linux From Scratch), logging things could help, so as for now I'll use :

pacman -Su | tee pacman.dash.Su.`date +%d%b%G_%H%M%S`.log

in order to be able to read useful information later on.

lundi 6 mai 2013

another archlinux massive upgrade push

luser@x60s_GPT ~ (master*) $ pacman -Qu
avahi 0.6.31-6
cairo 1.12.14-3
cairomm 1.10.0-2
chromium 26.0.1410.63-1
dvdauthor 0.7.1-4
emacs 24.3-1
fbida 2.09-1
feh 2.9.1-1
gd 2.0.36RC1-5
gdk-pixbuf2 2.28.1-1
ghostscript 9.07-1
graphviz 2.30.1-2
gst-plugins-good 1.0.7-1
gstreamer0.10-bad 0.10.23-3
gstreamer0.10-bad-plugins 0.10.23-3
gstreamer0.10-good 0.10.31-1
gstreamer0.10-good-plugins 0.10.31-1
gthumb 3.2.1-1
guvcview 1.7.0-1
imagemagick 6.8.4.10-1
imlib2 1.4.5-2
jbig2dec 0.11-5
jdk7-openjdk 7.u21_2.3.9-1
jre7-openjdk 7.u21_2.3.9-1
jre7-openjdk-headless 7.u21_2.3.9-1
libgdiplus 2.10-3
libpng 1.5.15-1
librsvg 2.37.0-1
libtracker-sparql 0.16.0-4
libwebp 0.3.0-1
mjpegtools 2.0.0-2
mplayer 35920-1
php 5.4.14-1
php-apache 5.4.14-1
php-pear 5.4.14-1
poppler 0.22.3-2
qemu 1.4.1-1
qt4 4.8.4-16
rrdtool 1.4.7-5
sdl_image 1.2.12-2
slim 1.3.5-2
tumbler 0.1.27-2
virtualbox 4.2.12-1
webkitgtk2 1.10.2-4
webkitgtk3 2.0.1-1
wxgtk 2.8.12.1-4
xloadimage 4.1-12
xv 3.10a-16
luser@x60s_GPT ~ (master*) $

vimgolf in emacs :: old macdonald lullaby

Bored and unwilling so doing some emacs vintage timewasting using this : http://vimgolf.com/challenges/4d29ae2107e0177c7e000036


; solution
; making a template, then iterate/expand through input once
; repeat until EOF

;; in
cow moo
horse neigh
duck quack
goose honk
hen cluck
chick peep
pig oink
sheep baa

;;out
Old MacDonald had a farm, E I E I O.
And on that farm he had a cow, E I E I O.
With a moo, moo here and a moo, moo there.
Here a moo, there a moo, everywhere a moo, moo.
Old MacDonald had a farm, E I E I O.

Old MacDonald had a farm, E I E I O.
And on that farm he had a horse, E I E I O.
With a neigh, neigh here and a neigh, neigh there.
Here a neigh, there a neigh, everywhere a neigh, neigh.
Old MacDonald had a farm, E I E I O.

Old MacDonald had a farm, E I E I O.
And on that farm he had a duck, E I E I O.
With a quack, quack here and a quack, quack there.
Here a quack, there a quack, everywhere a quack, quack.
Old MacDonald had a farm, E I E I O.

Old MacDonald had a farm, E I E I O.
And on that farm he had a goose, E I E I O.
With a honk, honk here and a honk, honk there.
Here a honk, there a honk, everywhere a honk, honk.
Old MacDonald had a farm, E I E I O.

Old MacDonald had a farm, E I E I O.
And on that farm he had a hen, E I E I O.
With a cluck, cluck here and a cluck, cluck there.
Here a cluck, there a cluck, everywhere a cluck, cluck.
Old MacDonald had a farm, E I E I O.

Old MacDonald had a farm, E I E I O.
And on that farm he had a chick, E I E I O.
With a peep, peep here and a peep, peep there.
Here a peep, there a peep, everywhere a peep, peep.
Old MacDonald had a farm, E I E I O.

Old MacDonald had a farm, E I E I O.
And on that farm he had a pig, E I E I O.
With an oink, oink here and an oink, oink there.
Here an oink, there an oink, everywhere an oink, oink.
Old MacDonald had a farm, E I E I O.

Old MacDonald had a farm, E I E I O.
And on that farm he had a sheep, E I E I O.
With a baa, baa here and a baa, baa there.
Here a baa, there a baa, everywhere a baa, baa.
Old MacDonald had a farm, E I E I O.

;; tmpl
Old MacDonald had a farm, E I E I O.
And on that farm he had a {{wat}}, E I E I O.
With a {{snd}}, {{snd}} here and a {{snd}}, {{snd}} there.
Here a {{snd}}, there a {{snd}}, everywhere a {{snd}}, {{snd}}.
Old MacDonald had a farm, E I E I O.

;; pre
;; clipboard contains input data

C-x b i n C-j ;; (buffer in)
C-y ;; input

;; preprocess input
M-< C-M-% s SPC <return> SPC <return> !
M-< C-M-% g e e s e <return> g o o s e <return> !
M-<
;; prepare template from out
C-x b o u t <enter> M-< M-h M-w C-x b t e m p C-j C-y
M-<
C-M-% c o w <enter> { { w a t } } <enter>
C-M-% m o o <enter> { { s n d } } <enter>
C-x b i n <enter>
;; main macro
<f3>
;; copy and paste template
C-x o C-x o
M-h M-w
C-x o C-y
;; put animal, sound in kill-ring
C-k
;; move 2 'Old' up
C-r O l d C-r
C-a
;; replace wat -> animal
C-s w a t <return>
M-b <delete> <delete> <delete> <delete> <delete> <backspace> <backspace> C-y
M-b M-d <backspace>
;; replace snd -> sound
C-SPC M-} C-M-% { { s n d } } <return> C-y <return> !
;; next
M-}
C-f
C-u 8 <f4>