Friday, 19 August 2011
Save wrong line bash
A simple thing to do when you realize you just typed the wrong line is hit Ctrl+C; if you want to keep the line, but need to execute something else first, begin a new line with a back slash - \, then Ctrl+C. The line will remain in your history.
Latex Dashes
Hyphen: daughter-in-law, X-rated\\
En dash: pages 13--67\\
Em dash: yes---or no? \\
Minus sign: $0$, $1$ and $-1$
En dash: pages 13--67\\
Em dash: yes---or no? \\
Minus sign: $0$, $1$ and $-1$
Bash trim filename
However, buried in there is a section on Parameter Substitution which tells us that $foo is really a shorthand for ${foo} which is really the simplest case of several ${foo:operators} and similar constructs.
- Given:
- foo=/tmp/my.dir/filename.tar.gz
- We can use these expressions:
- path = ${foo%/*}
- To get: /tmp/my.dir (like dirname)
- file = ${foo##*/}
- To get: filename.tar.gz (like basename)
- base = ${file%%.*}
- To get: filename
- ext = ${file#*.}
- To get: tar.gz
-
- ${variable%pattern}
- Trim the shortest match from the end
- ${variable##pattern}
- Trim the longest match from the beginning
- ${variable%%pattern}
- Trim the longest match from the end
- ${variable#pattern}
- Trim the shortest match from the beginning
Thursday, 10 February 2011
Reverse Tunelling and x2x
To control a box behind a firewall using keyboard and mouse on another computer.
On firewalled computer run
ssh -R 22222:localhost:22 user@localcomp
On local computer run
ssh -p -X 22222 user@localhost
In the last ssh tunnel run
x2x -east -to :0
On firewalled computer run
ssh -R 22222:localhost:22 user@localcomp
On local computer run
ssh -p -X 22222 user@localhost
In the last ssh tunnel run
x2x -east -to :0
Wednesday, 5 May 2010
Gvim invisible cursor after vsplit
Vim code:
From:
http://old.nabble.com/Cursor-become-invisible.-td20630223.html
let &guifont=&guifont
From:
http://old.nabble.com/Cursor-become-invisible.-td20630223.html
Saturday, 12 September 2009
Ubuntu wireless driver eee 901 rt2860
You will need dkms for your kernel if you haven't got it.
cd /lib/modules/`uname -r`/kernel/drivers/staging/rt2860
sudo mv rt2860sta.ko rt2860.bak
Download new driver:
http://www.array.org/ubuntu/dists/intrepid/eeepc/binary-i386/rt2860-dkms_1.7.1.1_all.deb
then sudo dpkg -i rt2860-dkms_1.7.1.1_all.deb
sudo init 6
WPA1/2 should work now.
Subscribe to:
Posts (Atom)