If youâre a developer of any sort, youâve probably heard of Pastebin.com, the most widely used web application for pasting and sharing text snippets. Pastebin.com is great, but itâs not the only pastebin tool out there.
In fact, itâs becoming increasingly common for websites to host their own pastebins. It can give you more freedom. There are many open source pastebin implementations; in researching this article, I came across at least twenty pastebin projects in active development. I tested a few of their online demos and settled on using Stikked for its advanced features and streamlined user interface.
Stikked is built with PHP and jQuery a nd uses the CodeIgniter framework.
Installing Stikked
Stikked requires that your server is running:
To download the latest version of Stikked, visit the Stikked GitHub page or go to your command line and run:
git clone https://github.com/claudehohl/Stikked.git |
Using git clone
will give you a folder called âStikked.â Within that folder is another folder called âhtdocsâ; copy the contents of htdocs to a directory of your choosing on your web server.
Before you can run Stikked, you need to prepare a few things. First create a MySQL database. If yo ur server uses cPanel, you can do this by going to your administration page and clicking on âMySQL Databases.â
Create a database, add a user to it, and grant the database user all privileges.
Now that youâve set up a database for your Stikked installation, you need to modify the file application/config/stikked.php to point to it. Go to lines 18 through 21 and change the database information appropriately. For example:
$ config['db_hostname'] = '127.0.0.1'; $ config['db_database'] = 'rujic_stikked'; $ config['db_username'] = 'rujic_rujic'; $ config['db_password'] = 'stikked'; |
Now you should be able to access your-stikked-installation.com/index.php and see this:
The stikked.php file contains some other settings you can change as well. For instance, to require LDAP authentication, edit line 117:
$ config['require_auth'] = true; |
Note that if you set this to true, you must also configure your LDAP settings in application/config/auth_ldap.php.
Fun fact: Line 99 lets you let you set the default nam e for anonymous posters to a random phrase:
$ config['unknown_poster'] = 'random'; |
Scroll down to line 136 to view or edit the list of random nouns, followed by the list of random adjectives.
Styling Your Stikked Installation
All of the style data exists in the directory called âstatic.â For kicks, take a look inside the sub-directory âfontsâ to see some interesting choices.
Most of the styling choices are made in the file âstatic -> styles -> main.cssâ. I modified main.css to include one of the pre-installed fonts using the @font-face
rule:
@font-face { font-family: font19; src: url('../fonts/font19.ttf'); } |
Here is my âCreateâ page after I had a bunch of fun with main.css:
Features
Stikked has a number of interesting features that make it stand out from the crowd of other pastebin scripts.
First off, it runs the gamut when it comes to syntax highlighting. Stikked supports a huge list of programming and scripting languages, from 4CS to Oz to ZXBasic. Whatever youâre coding in, your Stikked installation has (probably) got you covered.
Each snippetâs language is displayed in a table on the âRecentâ page; if the poster didnât specify a language for a paste, then it is labeled âtext.â The table also displays the title, posterâs name, and recency, along with an RSS icon. The RSS feed is located at your-stikked-inst allation.com/lists/rss.
The âTrendingâ page is nearly identical but with the addition of a âhitsâ column and no RSS feed. Hits appear to be calculated based on visits from unique IP addresses.
When you create a paste, you have the options to set an expiration date, create a short URL using the service at gw.gd, and/or make the post private. Note that a âprivateâ paste is not truly private; any user who has the pasteâs URL can see it, unless youâve enabled LDAP authentication â" in that case, every registered user with the URL can see it. âPrivateâ only means that the post wonât show up on the Recent or Trending pages.
Security aside, Stikked provides some neat utilities for viewing a paste. Iâm especially pleased with the embed code.
You can also reply to pastes and add your own edits from a form below the original paste. The only downside to this is that replies donât link back to the original post; if your pastebin has many different posts and replies made at different times, itâs easy to lose track of their structure. I can only hope that the developer will at some point introduce a solution, such as threading the replies and implementing a diff
viewer.
One last feature Iâll mention is spam control, which Stikked refers to as âspamadmin.â Set it up by entering credentials in config/stikked.php on lines 79 and 80:
$ config['spamadmin_user'] = 'stikked'; $ config['spamadmin_pass'] = 'stikked'; |
Go to your-stikked-installation.com/spamadmin to log in. There you can see which pastes came from which IP addresses, remove pastes, and block IP ranges.
API
Stikkedâs API allows you to paste to it from pastebin clients. The API URL to use in your client is your-stikked-installation.com/api/create.
A basic example is to use the cURL command to upload a file called âsmalltalk.st,â setting the title, name, privacy, language, and expiration time in minutes:
curl -d title='cURL test' -d name='Ruji' -d private=1 -d lang=smalltalk -d expire=45 |
This will return the URL of the paste.
Conclusion
If youâve read that Stikked is dead, youâre wrong. While the old Stikked was abandoned after version 0.5.4, the new Stikked is going strong and continuing to introduce useful features with every release. I recommend you give it a try if you want an easy way to collect and share text snippets on your own website.
What do you use pastebins for? Do you have a use for your own pastebin?
No comments:
Post a Comment