Page 3 of 4

Tmux for the impatient

New session : tmux

Attach to a session : tmux a

Detach : Ctrl+b d

Scroll : Ctrl+b PgUp/PgDown (quit with q) also can use mouse after first page up or down

Copy mode : Ctrl+b [ (quit with q)

Split horizontally : Ctrl+b “

Split vertically : Ctrl+b %

Switch pane : Ctrl+b arrow key

Resize pane : Hold Ctrl+b + arrow keys

 

install xclip so buffer copied insied tmux are also available to X : sudo apt-get install xclip

Wireless auto configuration with guessnet on Linux

The wireless tour eiffel
Assume we have access to the wifi at work and at home. How can I configure my laptop to automatically connect to the right network without using a graphical network manager ? Welcome guessnet !
Read more →

The Extreme Productivity Philosophy that Created Facebook and PayPal

Back in 2005, long before they began approaching $10 billion in annual revenue, everyone thought that Facebook was a cool app, but no one thought that it would ever make any money.  Observers laughed at the idea that Facebook could be a real business.

With that backdrop of doubters and detractors, Noah Kagan, employee #30 at Facebook, pitched Mark Zuckerberg with what he thought was a genius idea: prove the Facebook skeptics wrong and show them that the fledgling startup could make real money.

 

Read more : http://blog.idonethis.com/one-thing-extreme-focus-facebook-mark-zuckerberg-paypal-peter-thiel

If ssh client disconnect and freeze

Add in your ~/.ssh/config :

Host *
 ServerAliveInterval 240

src = superuser.com

Git delete remote branch

As of Git v1.7.0, you can delete a remote branch using

git push origin --delete <branchName>

src = stackoverflow.com

Horizontal rule in zsh prompt

zsh-horizontal-rule-prompt

Put in your ~/.zshrc :

PS1=$'%U${(r:$COLUMNS:: :)}%u'$PS1

src = superuser.com

Increase wordpress max file upload size

On Ubuntu/Debian distro, edit the /etc/wordpress/htaccess and add this lines :

php_value upload_max_filesize 50M
php_value post_max_size 50M
php_value memory_limit 50M

Substitute a text only in files where it appears

For example, to substitute foo with bar

for f in `grep -lR foo`; do
	echo -n ">> $f";
	sed 's/foo/bar/g' $f > $f.tmp ;
	mv $f.tmp $f ;
	echo " done.";
done
  • 1) for loops on all files containing the text “foo”, grep -l only show the file name with corresponding text inside.
  • 3) sed replace foo with bar in all file
  • 4) mv save the modification (delete if you don’t want to overwrite the original files, the modified files is named with .tmp at the end)
  • 2) & 5) echo: which file is treated

Convert multiple files to utf8 using vim

The fastest and more efficient way to batch multiple files encoding conversion :

vim +"argdo se fileencoding=utf-8 | w | bnext" +"q" ` find . -type f -name "*.rsp" `

+”argdo” : execute the following vim commands for each file (filencode, save and next buffer)

+”q” : quit after last one

find : get all files with corresponding name

GIT – stop tracking files

If you have some files that you need to have in your repo but don’t need to have updates, git allows it :

git update-index --skip-worktree <FILES>

Then a “git status” won’t show those files until you do :

git update-index --no-skip-worktree <FILES>

To show the skipped files :

git ls-files -v . | grep ^S

–skip-worktree is a better solution than –assume-unchanged because status will not get lost once an upstream change is pulled.

source : http://stackoverflow.com/a/39776107/3181414