Tuesday, December 14, 2010

simulate a distant host in localhost

simulate 200ms pings. (100ms each leg)
tc qdisc add dev lo root handle 1:0 netem delay 100msec


Restore it back to normal again with:

tc qdisc del dev lo root


TODO: script to set that every second to a random value from 10 to 100

also:
iprelay -b30000 8000:localhost:80


references
  • from http://daniel.haxx.se/blog/2010/12/14/add-latency-to-localhost/
  • also in http://news.ycombinator.com/item?id=2004790
  • docs in http://www.linuxfoundation.org/collaborate/workgroups/networking/netem

usable tackaball

got a logitec usb trackman from ergo last week. really liked the middle style trackball, but missed scroll. the solution:

wrotenote-lx$ cat logitec_usb_trackball.sh 
#!/bin/sh
# 1 2 3 4 5 6 7 8 9
#xinput set-button-map "Logitech USB Trackball" 8 9 2 4 5 6 7 1 3
xinput set-button-map "Logitech USB Trackball" 1 9 2 4 5 6 7 1 3
# LF rt lf RT
# LF = big left button
# RT = big right button
# lf = small left button
# rt = small right button

# liga emulacao do whell por movimento do mouse
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation" 8 1
# diz q par de botoes o movimento no eixo X "clica"
#xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation X Axis" 8 6
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation Axes" 4 5 6 7

# apertar o botao 1 ativa emulacao acima
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation Button" 8 1



the buttons now do:
  • Big left button:

    • click for Button 1 (left click)
    • Hold for scroll on the trackball moviment (all four directions)

  • small left button: always button 1 (so i can drag things and select text)
  • small right button: Button 3 (right click) my least used button
  • Big Right button: middle click. I used that button a lot, to paste and thown windows to the bottom of my desktop zindex.

usable tackaball

got a logitec usb trackman from ergo last week. really liked the middle style trackball, but missed scroll. the solution:

wrotenote-lx$ cat logitec_usb_trackball.sh 
#!/bin/sh
# 1 2 3 4 5 6 7 8 9
#xinput set-button-map "Logitech USB Trackball" 8 9 2 4 5 6 7 1 3
xinput set-button-map "Logitech USB Trackball" 1 9 2 4 5 6 7 1 3
# LF rt lf RT
# LF = big left button
# RT = big right button
# lf = small left button
# rt = small right button

# liga emulacao do whell por movimento do mouse
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation" 8 1
# diz q par de botoes o movimento no eixo X "clica"
#xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation X Axis" 8 6
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation Axes" 4 5 6 7

# apertar o botao 1 ativa emulacao acima
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation Button" 8 1



the buttons now do:
  • Big left button:

    • click for Button 1 (left click)
    • Hold for scroll on the trackball moviment (all four directions)

  • small left button: always button 1 (so i can drag things and select text)
  • small right button: Button 3 (right click) my least used button
  • Big Right button: middle click. I used that button a lot, to paste and thown windows to the bottom of my desktop zindex.