paste-service.md - www.codemadness.org - www.codemadness.org saait content files
(HTM) git clone git://git.codemadness.org/www.codemadness.org
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
paste-service.md (1243B)
---
1 ## Setup SSH authentication
2
3 Make sure to setup SSH public key authentication so you don't need to enter a
4 password each time and have a more secure authentication.
5
6 For example in the file $HOME/.ssh/config:
7
8 Host codemadness
9 Hostname codemadness.org
10 Port 22
11 IdentityFile ~/.ssh/codemadness/id_rsa
12
13 Of course also make sure to generate the private and public keys.
14
15
16 ## Shell alias
17
18 Make an alias or function in your shell config:
19
20 pastesrv() {
21 ssh user@codemadness "cat > /your/www/publicdir/paste/$1"
22 echo "https://codemadness.org/paste/$1"
23 }
24
25 This function reads any data from stdin and transfers the output securely via
26 SSH and writes it to a file at the specified path. This path can be visible via
27 HTTP, gopher or an other protocol. Then it writes the absolute URL to stdout,
28 this URL can be copied to the clipboard and pasted anywhere like to an e-mail,
29 IRC etc.
30
31
32 ## Usage and examples
33
34 To use it, here are some examples:
35
36 Create a patch of the last commit in the git repo and store it:
37
38 git format-patch --stdout HEAD^ | pastesrv 'somepatch.diff'
39
40 Create a screenshot of your current desktop and paste it:
41
42 xscreenshot | ff2png | pastesrv 'screenshot.png'
43
44 There are many other uses of course, use your imagination :)