Things you rarely do

From wiki.alexcollins.org
Jump to: navigation, search

... that are difficult to remember

Create an ssh key (and upload it to a server)

Prerequisites

Which type of key to use can be discussed endlessly, here are some key considerations:

Creating the key pair

The keys must be created on the machine which you ssh from. To generate an RSA key:

ssh-keygen -t rsa -b 2048

To generate a DSA key:

ssh-keygen -t dsa

The command will ask you where to save the files. The default is a sane location.

Uploading the public key to the server

If you used the default location:

ssh-copy-id SERVER

If you saved it in a non-default location:

ssh-copy-id -i FILE SERVER

Create an svn repository and start using it via ssh

Server-side setup

Legend:

Do the following to create the repository

sudo svnadmin create /var/svn/REP
sudo chown -R REPUSER:REPUSER /var/svn/REP

Client-side

Legend:

cd LOCAL_REP
mkdir trunk/ tags/ branches/
svn import . svn+ssh://REPUSER@HOST/REP
svn co svn+ssh://REPUSER@HOST/REP/ .

If you don't want to have the tags/ and branches/ directories in your checkout directory, do the following:

rm -rf LOCAL_REP/*
cd LOCAL_REP
svn co svn+ssh://REPUSER@HOST/REP/trunk/ .

Change the URL of an SVN repository

Legend:

svn switch --relocate OLD_URL NEW_URL

SVN branching and merging

This website explains it in an excellent way: http://www.math-linux.com/spip.php?article118

Create a .htaccess/.htpasswd file for Apache HTTP Auth.

To create, simply run:

 htpasswd -c FILENAME USERNAME PASSWORD

Update .htaccess/.htpasswd

All you have to run is:

 htpasswd FILENAME USERNAME PASSWORD

If you'd rather be prompted for the password, pass the -b option to htpasswd.

Extract pages from a PDF

To create a new pdf file outfile.pdf containing pages 5-8 from inputfile.pdf:

Using pdftk:

pdftk A=inputfile.pdf cat A5-8 output outfile.pdf

Using ghostscript:

gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \
      -dFirstPage=5 -dLastPage=8 \
      -sOutputFile=outfile.pdf inputfile.pdf
Personal tools
Namespaces
Variants
Actions
Navigation
Eternal Lands
alexcollins.org
Toolbox