tech notes

           )
          *
         (|
    tech  |)
         (|  notes
          |)
          *
         (

Table of Contents

« Mad Catz R.A.T 7 »

Precision aim linux

2013-11-10

I just bought the absolutely awsome R.A.T 7 mouse. It didn't work right out of the box though.

I had to add a config file to etc/X11/xorg.conf.d. After that the mouse worked perfectly - except that the precision aim button did nothing. I almost got that to work using xbindkeys but unfortunatly keeping the precision aim button depressed made it impossible to press anything else including mouse 1 a.k.a the fire button.

  • Driver for X
    # filename: /etc/X11/xorg.conf.d/910-rat.conf
    Section "InputClass"
            Identifier "R.A.T."
            MatchProduct "R.A.T.7|R.A.T.9"
            MatchDevicePath "/dev/input/event*"
            Option "Buttons" "17"
            Option "ButtonMapping" "1 2 3 4 5 0 0 8 9 7 6 12 0 0 0 16 17"
            Option "AutoReleaseButtons" "13 14 15"
            Option "ZAxisMapping" "4 5 6 7"
    EndSection
    

    After restarting X, I then added the following to my Xbindkeysrc;

  • Precision aim
    # filename: ~/.xbindkeysrc
    ...
    
    "exec xinput --set-prop 'Mad Catz Mad Catz R.A.T.7 Contagion Mouse' 'Device Accel Constant Deceleration' 5"
    b:12
    
    "exec xinput --set-prop 'Mad Catz Mad Catz R.A.T.7 Contagion Mouse' 'Device Accel Constant Deceleration' 1"
    b:12 + Release
    
    ...
    

« Cygwin postinstall woes »

On M$ server 2013

2013-10-30

When cygwin throws up postinstall errors

  • Open Mintty
  • set path manaully
    export PATH=$PATH:/bin:/usr/bin etc etc
    
  • run all the scripts in /etc/postinstall manually

Now your cygwin installation might work!

« Fluidsynth woes »

PULSEAUDIO & FLUIDSYNTH FAIL

2013-10-05

Pulseaudio started to fail on me after installing cheese. It turnes out that one of the dependencies for cheese is fluidsynth. I had previously uninstalled fluidsynth because it made pulseaudio fail.

This time I needed to fix the problem. After googling around for a while I saw this post on the arch linux forums. Fluidsynth on my system was configured to use alsa. I switched from alsa to pulse by editing the file:

file:/usr/lib/systemd/system/fluidsynth.service

[Unit]
Description=FluidSynth Daemon
After=sound.target

[Service]
ExecStart=/usr/bin/fluidsynth -a pulseaudio -c2 -i -l -s # /usr/share/soundfonts/fluidr3/FluidR3GM.SF2
# ExecStart=/usr/bin/fluidsynth -is -a alsa -m alsa_seq -r 48000 # append soundfont path here

[Install]
WantedBy=multi-user.target

by changing the ExecStart line to:

"ExecStart=/usr/bin/fluidsynth -is -a alsa -m alsa_seq -r 48000"

I commented out the existing ExecStart-line to be on the safe side and the soundfont-path because I don't have any soundfonts on my system.

now audio would play properly… almost. I still couldn't change the volume using volwheel. It would change the Master volume which was mapped to pulse and didn't do anything.

Checking the alsa-wiki I found this on the arch-wiki. Explaining how to set the default soundcard using alsa. Setting the default soundcard using .asoundrc proved unsuccessful. I set the order the snd-modules where loaded.

$ cat /proc/asound/modules

will list the sound modules in the order they are loaded. In my case:

0 snd_hda_intel
1 snd_usb_audio
2 snd_hda_intel

By telling modprobe to load the modules in a particular order the proper soundcard was made default and volwheel works.

file: /etc/modprobe.d/alsa-base.conf

Options snd slots=snd_hda_intel,snd_hda_intel,snd_usb_audio
Options snd_hda_intel index=0
Options snd_hda_intel index=1
Options snd_usb_audio index=2

Now my audio works again… until next time ;-)

« loco locale »

set several locales

2012-08-19

Use several locales on the same system. If your like me you prefer to have the language of your computer set to english. I am myself Swedish but still prefer English as the system-language. I'm used to it and it makes googling for an answer just a little bit quicker. Having bash spit back swedish at me makes me a bit uneasy to be honest.

Enable the locales you want to access by uncommmenting the ones you want in /etc/locale.gen. Then run:

$ locale-gen

Add this to your /etc/profile;

export LANG=en_GB.UTF-8
export LANGUAGE="en_US:en"
export LC_CTYPE=sv_SE.UTF-8
export LC_NUMERIC=sv_SE.UTF-8
export LC_TIME=sv_SE.UTF-8
export LC_COLLATE=sv_SE.UTF-8
export LC_MONETARY=sv_SE.UTF-8
export LC_MESSAGES=sv_SE.UTF-8
export LC_PAPER=sv_SE.UTF-8
export LC_NAME=sv_SE.UTF-8
export LC_ADDRESS=sv_SE.UTF-8
export LC_TELEPHONE=sv_SE.UTF-8
export LC_MEASUREMENT=sv_SE.UTF-8
export LC_IDENTIFICATION=sv_SE.UTF-8

This will enable you to tweak your language-settings. I use english as a preferred language while retaining swedish compability in everything else.

« Postfix Your Gmail »

Use gmail to send mail directly

2012-08-19

After finally setting up my backup-script and making sure it runs properly it was time to make it more admin-friendly by having the script mail me when something went awry. I figured I'd set up a ssmtp instance to send a mail with a report on what had happened. As it turns out ssmtp isn't supported anymore so I had to find another solution. I found the solution at yhager.com.

But alas I'm not weilding a FQDN on the pc where I run the script so his solution was out. Fortunatly for me I found another good solution in the comments. Posted by some one going by the name Marcelo was a list of instructions on how to get postfix to use gmail as a smarthost.

The original instructions were from a spanish blog which he had translated and put in the comment-section of the yhager blog. Thanks for that!

Link to instructions

This is run down of the steps I took.

  1. Setup postfix config file Edit /etc/postfix/main.cf and paste in the following:
    # SMTP relayhost
    relayhost = [smtp.gmail.com]:587
    
    # TLS Settings
    smtp_tls_loglevel = 1
    smtp_tls_CAfile = /etc/postfix/certs/CAcert.pem
    smtp_tls_cert_file = /etc/postfix/certs/mycert.pem
    smtp_tls_key_file = /etc/postfix/certs/mykey.pem
    smtp_use_tls = yes
    smtpd_tls_CAfile = /etc/postfix/certs/CAcert.pem
    smtpd_tls_cert_file = /etc/postfix/certs/mycert.pem
    smtpd_tls_key_file = /etc/postfix/certs/mykey.pem
    smtpd_tls_received_header = yes
    
    # SASL Settings
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    smtp_sasl_security_options = noanonymous
    smtp_sasl_tls_security_options = noanonymous
    
    # Inside to outside transport mapping alias
    smtp_generic_maps = hash:/etc/postfix/generic
    
  2. Setup authentication; edit /etc/postfix/generic by pasting and editing this:
    root@localhost yourusername@gmail.com
    root@localhost.localdomain yourusername@gmail.com
    
  3. Fix SASL; Create "/etc/postfix/sasl_passwd" - Paste in:
    [smtp.gmail.com]:587 yourusername@gmail.com:yourpassword
    
  4. Create Certs; create directory /etc/postfix/certs, cd into certs directory. Create neccecssary certs:
    $ sudo openssl dsaparam 1024 -out dsa1024.pem
    $ sudo openssl req -x509 -nodes -days 3650 -newkey dsa:dsa1024.pem -out mycert.pem -keyout mykey.pem
    $ sudo ln -s mycert.pem CAcert.pem
    $ sudo openssl req -x509 -new -days 3650 -key mykey.pem -out mycert.pem
    $ sudo rm dsa1024.pem
    
  5. Finish setting up postfix
    $ sudo postmap /etc/postfix/sasl_passwd
    $ sudo postmap /etc/postfix/generic
    $ sudo postmap /etc/postfix/main.cf
    
  6. Forward mail to local user to gmail account 6.1 Edit ~/.forward and insert:
    yourusername@gmail.com
    
  7. Restart postfix, c'est tout!

When I sat down to integrate email-capabilities into my script I got an email from my computer - reporting on how the backup-script had done!!! It turns out that if a working email mta is found on the system cron will automatically send you an email when it has carried out a task. Awsome!

« boot iso »

using grub2

2012-08-13

For a while I've been contemplating creating a bootable usb as a portable pc on a stick. A good way to ensure that I would always have the excellent tools of a modern linux distro at hand wherever I happened to be.

I also thought it would be great if I could run some utiliy isos off it. stuff like SpinRite, cloneZilla, an install iso and so on.

So far I have been able to install a complete Linux Mint system on my usb-drive, place a couple of isos on it and boot them from the grub2 bootloader on the usb-stick.

This turns out to be simpler than I first thought it would be. Using Linux Mint one installs the grub-bootiso then create the directory /boot/images, place the images you want to boot there run grub2-update and in the best case scenario just reboot and choose the grub entry for the iso you want to boot.

In the cases where the iso's don't "just work" out of the box there are a couple of things one could do

menuentry "Linux Mint 13 Mate 32bit Live DVD" {
loopback loop (hd0,msdos1)/linuxmint-13-mate-dvd-32bit.iso
linux (loop)/casper/vmlinuz boot=casper \
iso-scan/filename=/linuxmint-13-mate-dvd-32bit.iso noeject noprompt --
initrd (loop)/casper/initrd.lz
}
menuentry "CloneZilla Live 20120620 Precise" {
loopback loop (hd0,msdos2)/boot/images/clonezilla-live.iso
linux (loop)/live/vmlinuz boot=live \
iso-scan/filename=/clonezilla.iso noeject noprompt --
initrd (loop)/live/initrd.img
}

« Shut it down »

Enable shutdown in openbox

2012-08-08

tuesday: hello. tisdag. Courtesy of morra and ninjaprawn on the the arch forums: Fire up a terminal and start up visudo to edit the sudoers file. Insert the following line;

%users  ArchLinux = NOPASSWD: /sbin/shutdown -h now, /sbin/shutdown -r now

Edit the ~/.config/openbox/menu.xml file and insert the following lines.

<item label="Exit">
 <action name="Exit"/>
</item>
 
<item label="Reboot">
 <action name="Execute">
  <prompt>Are you sure you want to reboot?</prompt>
   <execute>sudo shutdown -r now</execute>
 </action>
</item>

<item label="Shutdown">
 <action name="Execute">
  <prompt>Are you sure you want to shutdown?</prompt>
   <execute>sudo shutdown -h now</execute>
 </action>
</item>

Done. Now you'll be able to shutdown and reboot directly from the menu.

« Device is busy »

Flasher won't see the n900

2012-06-30

I found the solution at talk.maemo.org posted by alendit;


    sudo modprobe -r cdc_phonet

    

« Enable ctrl-alt-bksp »

in X, on Arch:

2012-05-13


    # file:/etc/X11/xorg.conf.d/10-evdev.conf

    Section "InputClass"
        Identifier             "Keyboard Defaults"
        MatchIsKeyboard        "yes"
        Option                 "XkbOptions" "terminate:ctrl_alt_bksp"
    EndSection
    

Taken directly from the awsome arch wiki, check it for complete instructions.

« About »

this page

2012-08-05

I wanted a way of being able to use the source-code of the rendered page as working notes.

I have a couple of things on my wishlist for this setup.

  • Easy access to the file
  • render it out to an outward facing webpage for access away from home
  • Easy editing - basically just type

Some of these points proved harder than others. I settled on org-mode in emacs because i love editing text in emacs.

Easy access to the file This was pretty easy in it self. I just added the following line to my .emacs file;

;; File to load by default
(setq initial-buffer-choice "~/doc/org/log/index.org")

In a nutshell what it does is fairly self explanatory. The line tells emacs to open with the named buffer open. All I have to do to access the file is to load emacs.

Render it out as an html document Using org-mode

  • Define project to export as html

    This is how that was accomplished. I added the following to the .emacs file.

    ; org-mode publishing options
    (setq org-export-html-style-include-default nil)
    (setq org-export-html-style-default "")
         (setq org-publish-project-alist
               '(("orgfiles"
                   :base-directory "~/doc/org/log"
                   :base-extension "org"
    ;;             :publishing-directory "/ssh:user@host:~/html/notebook/"
                   :publishing-directory "~/public_html/org"
                   :publishing-function org-publish-org-to-html
                   :exclude "PrivatePage.org"   ;; regexp
                   :headline-levels 3
                   :section-numbers nil
                   :table-of-contents nil
                   :style "<link rel=\"stylesheet\"
                           href=\"other/style.css\" type=\"text/css\"/>"
                   :html-preamble t)
    
                  ("images"
                   :base-directory "~/doc/org/log/images/"
                   :base-extension "jpg\\|gif\\|png"
                   :publishing-directory "~/public_html/org/images/"
                   :publishing-function org-publish-attachment)
    
                  ("other"
                   :base-directory "~/doc/org/log/other/"
                   :base-extension "css\\|el"
                   :publishing-directory "~/public_html/org/other"
                   :publishing-function org-publish-attachment)
                  ("website" :components ("orgfiles" "images" "other"))))
    

    This defines how org-publish runs. How all this works is described at the org-mode site. Next we will need to;

  • Run the commands
    run org-publish in the minibuffer when it prompts for "publish project" type in one of the definitions we defined earlier in the .emacs-file. In this example publishing the project "website" everything gets published.

    Change DIV on mouse-over

Date: 2012-03-03 Sat

Author: Daniel Davis

Org version 7.9.3f with Emacs version 24

Validate XHTML 1.0