Compare commits
1 Commits
eba23bd088
...
bea448306d
Author | SHA1 | Date |
---|---|---|
Jack Hadrill | bea448306d |
|
@ -0,0 +1,61 @@
|
||||||
|
# Haste
|
||||||
|
|
||||||
|
Sharing code is a good thing, and it should be _really_ easy to do it.
|
||||||
|
A lot of times, I want to show you something I'm seeing - and that's where we
|
||||||
|
use pastebins.
|
||||||
|
|
||||||
|
Haste is the prettiest, easiest to use pastebin ever made.
|
||||||
|
|
||||||
|
## Basic Usage
|
||||||
|
|
||||||
|
Type what you want me to see, click "Save", and then copy the URL. Send that
|
||||||
|
URL to someone and they'll see what you see.
|
||||||
|
|
||||||
|
To make a new entry, click "New" (or type 'control + n')
|
||||||
|
|
||||||
|
## From the Console
|
||||||
|
|
||||||
|
Most of the time I want to show you some text, it's coming from my current
|
||||||
|
console session. We should make it really easy to take code from the console
|
||||||
|
and send it to people.
|
||||||
|
|
||||||
|
`cat something | haste` # https://hastebin.com/1238193
|
||||||
|
|
||||||
|
You can even take this a step further, and cut out the last step of copying the
|
||||||
|
URL with:
|
||||||
|
|
||||||
|
* osx: `cat something | haste | pbcopy`
|
||||||
|
* linux: `cat something | haste | xsel`
|
||||||
|
* windows: check out [WinHaste](https://github.com/ajryan/WinHaste)
|
||||||
|
|
||||||
|
After running that, the STDOUT output of `cat something` will show up at a URL
|
||||||
|
which has been conveniently copied to your clipboard.
|
||||||
|
|
||||||
|
That's all there is to that, and you can install it with `gem install haste`
|
||||||
|
right now.
|
||||||
|
* osx: you will need to have an up to date version of Xcode
|
||||||
|
* linux: you will need to have rubygems and ruby-devel installed
|
||||||
|
|
||||||
|
## Duration
|
||||||
|
|
||||||
|
Pastes will stay for 30 days from their last view. They may be removed earlier
|
||||||
|
and without notice.
|
||||||
|
|
||||||
|
## Privacy
|
||||||
|
|
||||||
|
While the contents of hastebin.com are not directly crawled by any search robot
|
||||||
|
that obeys "robots.txt", there should be no great expectation of privacy. Post
|
||||||
|
things at your own risk. Not responsible for any loss of data or removed
|
||||||
|
pastes.
|
||||||
|
|
||||||
|
## Open Source
|
||||||
|
|
||||||
|
Haste can easily be installed behind your network, and it's all open source!
|
||||||
|
|
||||||
|
* [haste-client](https://github.com/seejohnrun/haste-client)
|
||||||
|
* [haste-server](https://github.com/seejohnrun/haste-server)
|
||||||
|
|
||||||
|
## Author
|
||||||
|
|
||||||
|
Code by John Crepezzi <john.crepezzi@gmail.com>
|
||||||
|
Key Design by Brian Dawson <bridawson@gmail.com>
|
13
config.js
13
config.js
|
@ -11,5 +11,16 @@
|
||||||
"type": "Console",
|
"type": "Console",
|
||||||
"colorize": true
|
"colorize": true
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"rateLimits": {
|
||||||
|
"categories": {
|
||||||
|
"normal": {
|
||||||
|
"totalRequests": 500,
|
||||||
|
"every": 60000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"documents": {
|
||||||
|
"about": "./about.md"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,26 @@
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var crypto = require('crypto');
|
var crypto = require('crypto');
|
||||||
|
|
||||||
|
var winston = require('winston');
|
||||||
|
|
||||||
|
// For storing in files
|
||||||
|
// options[type] = file
|
||||||
|
// options[path] - Where to store
|
||||||
|
|
||||||
var FileDocumentStore = function() {
|
var FileDocumentStore = function() {
|
||||||
this.basePath = '/data';
|
this.basePath = '/data';
|
||||||
this.expire = null;
|
this.expire = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Generate md5 of a string
|
||||||
FileDocumentStore.md5 = function(str) {
|
FileDocumentStore.md5 = function(str) {
|
||||||
var md5sum = crypto.createHash('md5');
|
var md5sum = crypto.createHash('md5');
|
||||||
md5sum.update(str);
|
md5sum.update(str);
|
||||||
return md5sum.digest('hex');
|
return md5sum.digest('hex');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Save data in a file, key as md5 - since we don't know what we could
|
||||||
|
// be passed here
|
||||||
FileDocumentStore.prototype.set = function(key, data, callback) {
|
FileDocumentStore.prototype.set = function(key, data, callback) {
|
||||||
try {
|
try {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
@ -31,6 +40,7 @@ FileDocumentStore.prototype.set = function(key, data, callback) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Get data from a file from key
|
||||||
FileDocumentStore.prototype.get = function(key, callback) {
|
FileDocumentStore.prototype.get = function(key, callback) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
var fn = this.basePath + '/' + FileDocumentStore.md5(key);
|
var fn = this.basePath + '/' + FileDocumentStore.md5(key);
|
||||||
|
|
|
@ -11,8 +11,8 @@ var DocumentHandler = require('./lib/document_handler');
|
||||||
|
|
||||||
// Load the configuration and set some defaults
|
// Load the configuration and set some defaults
|
||||||
var config = JSON.parse(fs.readFileSync('./config.js', 'utf8'));
|
var config = JSON.parse(fs.readFileSync('./config.js', 'utf8'));
|
||||||
config.host = config.host || '127.0.0.1';
|
config.port = process.env.PORT || config.port || 7777;
|
||||||
config.port = config.port || 7777;
|
config.host = process.env.HOST || config.host || 'localhost';
|
||||||
|
|
||||||
// Set up the logger
|
// Set up the logger
|
||||||
if (config.logging) {
|
if (config.logging) {
|
||||||
|
|
Loading…
Reference in New Issue