Pages

Tuesday, 28 August 2012

Computer: Give me ű betű

Ah, I am Hungarian, however, recently I changed to a GB keyboard. I was really missing letter ű So I did:
xmodmap -e "keycode  94 = backslash bar backslash bar U00171 U00170 d"
So that when I press Right Alt + \ I have my ű, with Shift, I have my Ű

Special thanks goes to: Black Eternal and Bill Beiga

Wednesday, 8 August 2012

tmux, gvim automation

tmux

List panes
tmux list-panes
Select a pane
tmux select-pane -t 0
Send Ctrl-P and Ctrl-N to pane #1
tmux send-keys -t 1 C-p C-m

gvim

you will need gvim to do these things

Start vim as a server
vim --servername "coding"
Send a message to vim
vim --servername "coding" --remote-send '<Esc>:!ls<CR>'

Saturday, 30 June 2012

Uncle Bob Videos

I simply like them:

svn in virtualenv

I had some issues having svn in my virtual env - because it is created with the --no-site-packages (as it is the default).
What to do?
From the local python, this script will print out the commands for you:
python - << EOF
from os.path import dirname, join
import svn
dist_packages_dir = dirname(dirname(svn.__file__))
print 'cp -r', ' '.join(
  [join(dist_packages_dir, lib) 
    for lib in ['svn', 'libsvn']]),\
  "yourvirtualenvssitepackagesdir"
EOF
And replace yourvirtualenvssitepackagesdir with the site packages dir of your virtualenv

Saturday, 23 June 2012

Useless Tests

Make sure, that all the tested functionality is used

Connect Bluetooth Mouse to Linux

Thanks, Arch wiki
hciconfig
hcitool scan
Scanning ...
       00:02:76:25:A2:23ThinkPad Bluetooth Laser Mouse
echo "0000" | bluez-simple-agent hci0 00:02:76:25:A2:23
RequestPinCode (/org/bluez/899/hci0/dev_00_02_76_25_A2_23)
Enter PIN Code: Release
New device (/org/bluez/899/hci0/dev_00_02_76_25_A2_23)
dbus-send --system --type=method_call --print-reply --dest=org.bluez "/" org.bluez.Manager.ListAdapters
dbus-send --system --type=method_call --print-reply \
--dest=org.bluez "/org/bluez/899/hci0/dev_00_02_76_25_A2_23" \
org.bluez.Device.SetProperty \
string:Trusted variant:boolean:true
sudo hidd --connect 00:02:76:25:A2:23

Saturday, 9 June 2012

Python package structure

I always forgot what should be - the project structure - the contents of setup.py Basically it is just a duplication of The Hitchhiker's Guide to Packaging v1.0 documentation/Creating a Package
TowelStuff/
    bin/
    CHANGES.txt
    docs/
    LICENSE.txt
    MANIFEST.in
    README.txt
    setup.py
    towelstuff/
        __init__.py
        location.py
        utils.py
        test/
            __init__.py
            test_location.py
            test_utils.py
And your setup.py should look like this:
from setuptools import setup

setup(
    name="TowelStuff",
    version="0.1",
    packages=["towelstuff"],
    install_requires=["nose"]
    )
The other question: What should the subversion structure look like? I looked the Trac guys, to see how they do:
http://svn.edgewall.org/repos/trac/trunk/
  ...
  trac
  setup.py
  ...
So I will use the same setup.