Monday, December 12, 2011

9menu - create a menu to run commands

9menu is a simple program that accepts a list of menu item and command pairs on the command line. It creates a window that consists of nothing but a menu. When a particular item is selected, the corresponding command is executed.
http://pwet.fr/man/linux/commandes/9menu

Friday, December 02, 2011

Convert data tables: Mr Data Converter

A javascript program that will take your csv tables and will output them in other formats: Python dictionaries, SQL, HTML, etc.
Available in git: https://github.com/shancarter/Mr-Data-Converter

Fine grain control for volume and brightness

MacOS offers a way to get a finer control on the steps of increase and decrease of volume and screen brightness, to access the fine grain mode, also press the keys shift+option when changing the sound or brightness level.

Thursday, November 17, 2011

csshx and spark

csshx is a mac OS tool to connect in parallel to several machine and send the same command to all the machines see project page http://code.google.com/p/csshx/ spark is shell script to produce sparklines from your command line, project page https://github.com/holman/spark Suggestion from http://onethingwell.org

Saturday, September 03, 2011

Kindle reboot and network choice

To reboot the kindle you must do:
1. Menu
2. Settings
3. Menu
4. Restart

To choose manually the network to connect to do:
1. Menu
2. Settings
3. Type 311
You will get a menu with the detected networks.

Tuesday, August 23, 2011

Derpbox replacement for Dropbox, written in bash

Derpbox is a secure replacement for Dropbox, written in bash. Released under the beer-ware license, a pint of cider is fine too. It runs fine with GNU bash 4.2.8 and rsync 3.0.7.

https://github.com/L-P/Derpbox

Tuesday, July 26, 2011

Convert sound files using command line

MacOs X comes with a neat tool to convert sound files, afconvert. It has a bit of a crappy error reporting.
I used the following command to convert from aiff to wave: afconvert -f WAVE -d UI8 Mail_Sent.aiff
Some nice details here

Saturday, July 23, 2011

Time machine for linux

flyback :
Apple's Time Machine is a great feature in their OS, and Linux has almost all of the required technology already built in to recreate it. This is a simple GUI to make it easy to use.

Via onethingwell

Screen, tmux and reparenting

reptyr is a utility for taking an existing running program and
attaching it to a new terminal. Started a long-running process over
ssh, but have to leave and don't want to interrupt it? Just start a
screen, use reptyr to grab it, and then kill the ssh session and head
on home.

tmux is a terminal multiplexer: it enables a number of terminals (or windows), each running a separate program, to be created, accessed, and controlled from a single screen. tmux may be detached from a screen and continue running in the background, then later reattached. (Maybe a nice replacement of screen)

Wednesday, June 01, 2011

Export RSS fedds from Mac Mail

MacOS comes with a command line tool pubsub to access the RSS feeds.
Some interesting commands are:
  • Get list of clients:
    pubsub list clients:
  • Get list of RSS feeds from client com.apple.mail:
    pubsub list client com.apple.mail
  • Get only the URLs:
    pubsub list client com.apple.mail | cut -f3
Update: use background for the commands

Friday, May 27, 2011

Hide Dock Icon for an application

To instruct an application to hide the icon from the dock, you need to edit the file Info.plist, located in application.app/Contents.
Add the code
<key>LSUIElement</key> <string>1</string>

Wednesday, May 11, 2011

Pow and the website is up!

Pow

Pow is a zero-config Rack server for Mac OS X. Have it serving your apps locally in under a minute.

Via onethingwell

Monday, May 02, 2011

Ermine - package packer

Ermine packs a GNU/Linux application together with any needed shared libraries and data files into a single executable. This file can be copied to any GNU/Linux host and run without further modifications.

http://www.magicermine.com/

Suggestion form One Thing Well

Tuesday, January 11, 2011

Global shortucut for opening new Finder window

A shortcut I always used heavily in windows was the win-e to open a explorer windows.
In Mac OS this shortcut does not exist globally.
Searching on google you get many suggestions, but all of them are in the form:
Select Finder and choose "New window". DUHHH!!
I don't like this solution because is a 2 step thing that is something I want to avoid.
Finnaly I found in this this site http://contented.qolc.net/articles/osx-global-shortcut-key-new-finder-window a good solution using the services that will allow for a global, single shortcut to open a new finder window (plus: you can tune the script to open the window in a selected location)

The service I created can be found here.

Some of the 2 step solution are interesting, so I leave here some notable solutions:
  1. Use of option-command-space that will open a search window, that is, in itself a finder window.
  2. Use ctrl-f3, this will move the focus to the Dock, pressing return will sellect the finder, because this is always the first application in the Dock.

Saturday, January 08, 2011

Remapping keys in linux

My problem:

I got a very crappy PS2 to USB cable, and when I use the mouse scroll, from time to time a extra mouse key press was sent (key 9). This was not a problem in most of the places, except in firefox where it would trigger a back in history when I scrolled up (very annoying).
I've changed all the firefox preferences in about:config in mousewheel.* to only scroll (action=0), but I was always getting the back in scroll up. (about:config information here.)

Diagnosis:

To figure out what was the problem I used xev That will print to the terminal the events occurred in the small x window created by the program. Here is the problem I was having, the log is from me scrolling down, you can see at some point the keys sent are 9 and 8:
ButtonPress event, serial 40, synthetic NO, window 0x3800001,
    root 0xb6, subw 0x0, time 747353, (40,101), root:(1358,514),
    state 0x10, button 4, same_screen YES
ButtonRelease event, serial 40, synthetic NO, window 0x3800001,
    root 0xb6, subw 0x0, time 747353, (40,101), root:(1358,514),
    state 0x810, button 4, same_screen YES
MotionNotify event, serial 40, synthetic NO, window 0x3800001,
    root 0xb6, subw 0x0, time 747449, (40,102), root:(1358,515),
    state 0x10, is_hint 0, same_screen YES
ButtonRelease event, serial 40, synthetic NO, window 0x3800001,
    root 0xb6, subw 0x0, time 747449, (40,102), root:(1358,515),
    state 0x10, button 8, same_screen YES
ButtonRelease event, serial 40, synthetic NO, window 0x3800001,
    root 0xb6, subw 0x0, time 747449, (40,102), root:(1358,515),
    state 0x10, button 9, same_screen YES
MotionNotify event, serial 40, synthetic NO, window 0x3800001,
    root 0xb6, subw 0x0, time 747553, (40,102), root:(1358,515),
    state 0x10, is_hint 0, same_screen YES
ButtonPress event, serial 40, synthetic NO, window 0x3800001,
    root 0xb6, subw 0x0, time 747553, (40,102), root:(1358,515),
    state 0x10, button 8, same_screen YES
ButtonPress event, serial 40, synthetic NO, window 0x3800001,
    root 0xb6, subw 0x0, time 747553, (40,102), root:(1358,515),
    state 0x10, button 9, same_screen YES
ButtonPress event, serial 40, synthetic NO, window 0x3800001,
    root 0xb6, subw 0x0, time 747553, (40,102), root:(1358,515),
    state 0x10, button 4, same_screen YES
As my mouse only has 2 buttons and a scroll wheel, I changed the mouse mapping to disable all the other buttons (buttons above 5 are set to button 0). The command is:
xmodmap -e "pointer = 1 2 3 4 5 0 0 0 0 0 0 0 0 0 "
You can check what mapping you are using by doing: xmodmap -pp In my case, after changing the mapping I get:
# xmodmap -pp
There are 14 pointer buttons defined.

Physical        Button
 Button          Code
    1              1
    2              2
    3              3
    4              4
    5              5
    6              0
    7              0
    8              0
    9              0
   10              0
   11              0
   12              0
   13              0
   14              0
To return to the default mapping you can do : # xmodmap -e "pointer = default" And check:
# xmodmap -pp
There are 14 pointer buttons defined.

Physical        Button
 Button          Code
    1              1
    2              2
    3              3
    4              4
    5              5
    6              6
    7              7
    8              8
    9              9
   10             10
   11             11
   12             12
   13             13
   14             14
To make this change permanent you just need to create a file ~/.Xmodmap with the content:
pointer = 1 2 3 4 5 0 0 0 0 0 0 0 0 0
You can check the correctness of your file by doing xmodmap ~/.Xmodmap and check if the mapping was changed correctly.