TS16GWSDHC10

The TS16GWSDHC10 is a Wi-Fi SD-card with 16 GByte produced by Transcend. After uploading a autorun.sh script it is possible to access the Linux system on the card.

# /usr/local/bin/busybox free -m
             total         used         free       shared      buffers
Mem:            29           13           15            0            0
-/+ buffers:                 13           15
Swap:            0            0            0
# cat /proc/cpuinfo 
Processor       : ARM926EJ-S rev 5 (v5l)
BogoMIPS        : 421.06
Features        : swp half fastmult edsp java 
CPU implementer : 0x41
CPU architecture: 5TEJ
CPU variant     : 0x0
CPU part        : 0x926
CPU revision    : 5

Hardware        : KeyASIC Ka2000 EVM
Revision        : 0000
Serial          : 0000000000000000
# /usr/local/bin/busybox uname -a
Linux (none) 2.6.32.28 #137 PREEMPT Fri Mar 22 18:21:52 CST 2013 armv5tejl GNU/Linux
# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/mtdblock0            1.0M    748.0K    276.0K  73% /mnt/mtd
/dev/mmcblk0p1           15.4G      1.1M     15.4G   0% /mnt/sd

Thinkpad X240: make clickpad usable

The default configuration of the clickpad is unusable. Create the /etc/X11/xorg.conf.d/99-synaptics.conf file with the following content and restart the X server:

Section "InputClass"
  Identifier "Default clickpad buttons"
  MatchDriver "synaptics"
	
  Option "SoftButtonAreas" "60% 0 0 2400 40% 60% 0 2400"
  Option "AreaTopEdge" "2400"

  Option "TapButton1" "1"
  Option "TapButton3" "2"
  Option "TapButton2" "3"

  # Calm the pad down while clicking
  Option "VertHysteresis" "50"
  Option "HorizHysteresis" "50"

  # Drag lock
  Option "LockedDrags" "1"

  # Tap to click
  Option "FingerLow" "50"
  Option "FingerHigh" "55"
	
  # Prevent accidental clicks
  Option "PalmDetect" "1"
  Option "PalmMinWidth" "5"
  Option "PalmMinZ" "40"
	
  # Natural scrolling
  Option "VertTwoFingerScroll" "1"
  Option "VertScrollDelta" "-90"
  Option "HorizTwoFingerScroll" "1"
  Option "HorizScrollDelta" "-90"
	
  Option "MinSpeed" "1"
  Option "MaxSpeed" "1"
	
  Option "AccelerationProfile" "2"
  Option "ConstantDeceleration" "4"
EndSection

Source: http://www.thinkwiki.org/wiki/Buttonless_Touchpad

Empty a Glacier vault

#!/usr/bin/python

# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

# documentation: http://boto.readthedocs.org/en/latest/ref/glacier.html

# ~/.boto:
# [Credentials]
# aws_access_key_id = YOURACCESSKEY
# aws_secret_access_key = YOURSECRETKEY

from __future__ import print_function

REGION="eu-west-1"
VAULT="TESTING"

import boto.glacier
import logging
import sys

logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)

try:
    glacier = boto.glacier.connect_to_region(REGION)
    vault = glacier.get_vault(VAULT)
except:
    logging.error("vault '%s' does not exist or connection to glacier not possible" % VAULT)
    sys.exit(1)

if not vault.list_jobs():
    try:
        job = vault.retrieve_inventory()
    except:
        logging.error("it was not possible to create an inventory job for the vault '%s'" % VAULT)
        sys.exit(1)
    logging.info("inventory job (%s) started, run this script again in a few hours" % job)
    sys.exit(0)

for job in vault.list_jobs():
    try:
        output = job.get_output()
        for archive in output['ArchiveList']:
            logging.info("removing archive: %s" % archive['ArchiveId'])
            vault.delete_archive(archive['ArchiveId'])
    except boto.glacier.exceptions.UnexpectedHTTPResponseError as e:
        if e.code == 'InvalidParameterValueException':
            logging.error("inventory job (%s) still running, try it again later" % job.arn)

Avoid trailing white spaces before pushing a review request

I often forget to check my patches for trailing white spaces before pushing a review request to Gerrit. To avoid trailing white spaces before pushing a review request I added the following pre commit hook into the .git/hooks/pre-commit file.

#!/bin/bash -xe

# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

git diff-index --check --cached HEAD --

if [[ $? -ne 0 ]]; then
  echo "Commit aborted. Remove trailing whitespaces first."
  exit 1
fi