Archive

Tag Archives: fpaste

It is often useful to be able to easily paste text to our Fedora Pastebin at http://fpaste.org and this simple script will do that and return the resulting URL so that people may examine the output. This can hopefully help folks who are for some reason stuck without X, working remotely, or any other reason they may be unable to paste something into the pastebin.

Applicable to Fedora Versions

1.All Fedora Versions

Requirements
The script is a very simple bash script, the only real requirement is Curl. If curl is not installed, the script is kind enough to suggest how to install it, however it is installed by default.
1. Basic console/term skills
2. curl

Doing the Work
The script is very easy to use, and very simple in itself. It basically takes a filename as the only required argument and returns the resulting http://fpaste.org URL. This could be manually typed in, but this script simplifies uploading an arbitrary file/output to fpaste. The following examples are assuming you’re using the script in the same directory as the files you’re wanting to upload, so if they are not be sure to specify the full path. If you’re wanting to use the script more often, you could always chmod it and move it somewhere useful. Perhaps in the future this will get packaged, but for now I keep here on the Fedora Unity server for folks to grab.

1. First, get the script. Note that below, -O is a capital letter O, not a zero:

curl -O http://fedoraunity.org/Members/khaytsus/fupt.sh

2. Upload a specific file to fpaste, in this example, test.txt (which is in the current directory):

sh fupt.sh test.txt

3. Or, you may fpaste stdout data, such as the results of uname -a in this example:

uname -a | sh fupt.sh –

4. And when you’re done, you’ll get output such as this which you’ll tell whomever is looking at your paste:

Please tell us this resulting URL (may take a second): http://fpaste.org/####


Python Version

If you prefer, there is also a parallel version of this script written by zcat in Python. You could use this similarly to the shell script above, or perhaps integrate it into other Python projects, etc. How to get the script and a few examples are below.

1. First, get the script. Note that below, -O is a capital letter O, not a zero:

curl -O http://fedorasolved.org/Members/zcat/fpaste.py

2. Upload a specific file to fpaste, in this example, test.txt (which is in the current directory):

python fpaste.py file-to-paste.txt

3. Or, you may fpaste stdout data, such as the results of uname -a in this example:

uname -a | python fpaste.py

4. Or get extensive help from the tool itself:

python fpaste.py –help

Reference:http://fedorasolved.org/Members/khaytsus/fedora-unity-paste-tool

%d bloggers like this: