…with an open minded approach

Latest

tmux notes

After a long-time relationship with screen I also got to a point when tmux was more compeling… and there I go, into the tmux world, in a peacefull move (nothing bad said about screen ! there are already too much screen-hate-converted-tmuxers…)

Here I leave some personal notes for the switcher:

Configuration files

/etc/tmux.conf    – system-wide

~/.tmux.conf         – user-only

If terminal colors are all messed up (in vim and such)

Add these lines into ~/.tmux.conf

# set correct term
set -g default-terminal "screen-256color"
  # and add an alias into ~/.bashrc
  #   alias 'tmux'='TERM=xterm-256color tmux'
  # see http://unix.stackexchange.com/questions/1045/getting-256-colors-to-work-in-tmux

And this alis into ~/.bashrc

# Alias for tmux (fixes tmux terminal colors)
alias 'tmux'='TERM=xterm-256color tmux'

show in hexadecimal

# The text
#
$ echo 'the lazy dog jumped the impossible river'
the lazy dog jumped     the impossible river

# The text dumped in hexadecimal
#
$ echo 'the lazy dog jumped the impossible river' | od -ct x1
0000000   t   h   e       l   a   z   y       d   o   g       j   u   m
         74  68  65  20  6c  61  7a  79  20  64  6f  67  20  6a  75  6d
0000020   p   e   d  \t   t   h   e       i   m   p   o   s   s   i   b
         70  65  64  09  74  68  65  20  69  6d  70  6f  73  73  69  62
0000040   l   e       r   i   v   e   r  \n
         6c  65  20  72  69  76  65  72  0a

There is a disguised tab (\t) which is detected in the hexdump – ?can you see it?

byobu-screen: disabling the function keys (aka f-keys)

Byobu -screen has a shotcut available (Ctrl-a !)  to disable the function keys (see http://dodoincfedora.wordpress.com/2012/05/24/byobu-and-mc/), which lets you manually disable the function-keys for the current session.

To permanently disable the function-keys in *every* new session, I’ve found this way:

  • edit the file ~/.byobu/keybindings
  • after the existing line “source $BYOBU_PREFIX/share/byobu/keybindings/common”, add a new line “source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.screen.disable”

The file should finally look something like mine:

source $BYOBU_PREFIX/share/byobu/keybindings/common
source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.screen.disable
escape "^Aa"
register x "^A"
bindkey "^A"

 

Also if you use screen or byobu-screen through Putty, be aware of a bug explained in section BUGS of “man byobu”, basically saying that keys F1, F2, F3, F4 may not work correctly, which can be easily fixed:

“You can fix this problem in the PuTTY config,  Terminal -> Keyboard -> Function keys: Xterm R6.  See: http://www.mail-archive.com/screen-users@gnu.org/msg01525.html”

Cheers

Ubuntu server: check on terminal if system restart is required after upgrade

Basically check the existing of the file /var/run/reboot-required

For more info have a look at this answer in an ubuntu thread

Bash color prompt

For ubuntu it’s very ease to make the bash prompt colored -just follow the instructions

The reason that lead me to use it, is to easily distinguish the prompt in the middle of a lot of output, like in the end of log files or between commands – (see this ascii cast)

 

 

 

Documenting with Markdown, and reading it as webpage

I document my crazy projects with Markdown syntax – it uses only text, but still allows to express a rainbow of effects like *italic* **bold** bullet-lists, hierarquic headings… insert code (multiline or just short-pieces)

I began to do it using Strapdown which is a Javascript library that (among other things) parses Markdown to Html, and enables Syntax Highlight and even Bootstrap Themes (which is more than enough for my requirements)

 

The template I use is published as a github repo called strapdown_template and is pretty easy to use.

 

If its usefull to anyone else, or if you know a better way, don’t be shy and drop a comment :)

 

Cheers

 

git overview

Git is outstanding… so much that at some point, it can get confusing to use it without properly understanding what is happening behind the scenes…

The best tutorial that I’ve found so far, for my level of understanding and my needs, is Vogella’s Distributed Version Control with Git, which is generously available for reading online or in amazon as a kindle ebook

Also found very usefull to see the interactive Git CheatSheet from NDP Software

 

There – hope it is as useful to you as it is for me :)

Quick ssh socks5 tunnel (aka Dynamic tunnel)

LOCAL_LISTENING_PORT=12345
REMOTE_USER="zipizap"
REMOTE_SERVER="my.server.com"
ssh -N -D $SOCKS_LISTENING_PORT $REMOTE_USER@$REMOTE_SERVER sleep 60

This will create a persistent SOCKS5 tunnel, on port 12345 of your local-system.
The tunnel will dynamically forward the connections, to “my.server.com” as user “zipizap”, and from there it launch the connections to its final destination.

Cheers

Windows: launch minecraft behind a proxy

  • Copy the minecraft.jar file into a folder
  • open a command prompt (cmd.exe) in that folder and type (all in one line):
java -Dhttp.proxyHost=YourProxyIpOrUrl.com -Dhttp.proxyPort=8080 -Dhttps.proxyHost=YourProxyIpOrUrl.com -Dhttps.proxyPort=8080 -Xmx800m -jar minecraft.jar

subtituting  YourProxyIpOrUrl.com and 8080  with your proxy settings

 

Have fun

fstab entry for ntfs

A handy line to add an NTFS partition (/sda/sda1) into /etc/fstab file, with general options (user with id 1000 is considered the owner of the mounted device)

#Add this to /etc/fstab
/dev/sda1 /Windows ntfs-3g defaults,uid=1000,gid=1000,dmask=027,fmask=137 0 0
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: