Skip to content

Instantly share code, notes, and snippets.

View chapel's full-sized avatar

Jacob Chapel chapel

View GitHub Profile
@chapel
chapel / testb.js
Created October 26, 2010 15:32
node-oauth testb.js
var sys= require('sys');
var OAuth= require('oauth').OAuth;
oa= new OAuth("https://twitter.com/oauth/request_token",
"https://twitter.com/oauth/access_token",
"consumer", "secret",
"1.0A", "http://localhost:3000/oauth/callback", "HMAC-SHA1");
setInterval(function() {
var request= oa.get("http://stream.twitter.com/1/statuses/sample.json", 'consumer-user', 'secret-user');
var chain = require("slide/chain"),
asyncMap = require("slide/async-map"),
ClientPool = require('./client_pool'),
LimitingQueue = require('./lib/limitingqueue'),
q = new LimitingQueue(10),
api = new ClientPool(80, 'www.bungie.net', 100),
db = new ClientPool(5984, 'secret', 100)
apikey = 'secret'
Slash-Hack:nodejs chapel$ npm version connect-auth
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm ERR! Error: invalid version: connect-auth
npm ERR! at Object.version (/usr/local/lib/node/.npm/npm/0.2.10/package/lib/version.js:17:26)
npm ERR! at /usr/local/lib/node/.npm/npm/0.2.10/package/cli.js:82:23
npm ERR! at cb (/usr/local/lib/node/.npm/npm/0.2.10/package/npm.js:105:29)
npm ERR! at S (/usr/local/lib/node/.npm/npm/0.2.10/package/lib/utils/mkdir-p.js:18:33)
npm ERR! at MKDIRCB (/usr/local/lib/node/.npm/npm/0.2.10/package/lib/utils/mkdir-p.js:32:18)
var app = require('express').createServer()
urls = ['http://i.imgur.com/M75xU.jpg',
'http://i.imgur.com/sKhEM.jpg',
'http://i.imgur.com/ZvgN0.jpg',
'http://i.imgur.com/PsRlb.jpg',
'http://i.imgur.com/RxOTo.jpg',
'http://i.imgur.com/Fr22q.jpg']
function stats(col, rand) {
if (!statStore[col]) {
db.get(col+'-stats', function(err, data){
if (err) var data = {}
else data = JSON.parse(data)
if (data[rand]) data[rand]++
else data[rand] = 1
statStore[col] = data
setInterval(db.set(col+'-stats', JSON.stringify(statStore[col]), function(err){
statStore[col] = false
{"failed":"init","error":{"message":"Command failed: Host key verification failed.\r\nfatal: The remote end hung up unexpectedly\n","stack":"Error: Command failed: Host key verification failed.\r\nfatal: The remote end hung up unexpectedly\n\n at ChildProcess.exithandler (child_process.js:81:15)\n at ChildProcess.emit (events.js:27:15)\n at ChildProcess.onexit (child_process.js:169:12)","killed":false,"code":128,"signal":null}}
test
var data = querystring.stringify({'file_ext[gistfile1]': opt.ext, 'file_name[gistfile1]': opt.file, 'file_contents[gistfile1]': contents })
var request = client.request('POST', '/gists', {
'Host': 'gist.github.com',
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': data.length
})
request.end(data)
{{"ActionScript", ".as"},{"C", ".c"},{"Csharp", ".cs"},{"Common_Lisp", ".cl"},{"emacs_lisp", ".sls"},{"erlang", ".hrl"},{"haskell", ".hs"},{"html", ".html"},{"java", ".java"},{"lua", ".lua"},{"objective_c", ".m"},{"perl", ".pl"},{"Scala", ".scala"},{"scheme", ".sls"},{"TeX", ".tex"},{"XML", ".xml"},{"Ada", ".adb"},{"AppleScript", ".scpt"},{"Arc", ".arc"},{"ASP", ".ascx"},{"Assembly", ".asm"},{"Batchfile", ".bat"},{"Befunge", ".befunge"},{"Boo", ".boo"},{"Brainfuck", ".b"},{"C_ObjDump", ".c-objdump"},{"ChucK", ".java"},{"Clojure", ".clj"},{"CoffeeScript", ".coffee"},{"ColdFusion", ".cfm"},{"Cpp_ObjDump", ".cppobjdump"},{"Cucumber", ".feature"},{"D", ".d"},{"D_ObjDump", ".d -objdump"},{"Darcs_Patch", ".darcspatch"},{"Delphi", ".pas"},{"Duby", ".rb"},{"Dylan", ".dylan"},{"Eiffel", ".e"},{"Fsharp", ".fs"},{"Factor", ".factor"},{"FORTRAN", ".f"},{"GAS", ".s"},{"Genshi", ".kid"},{"Gentoo_Ebuild", ".sh"},{"Gentoo_Eclass", ".sh"},{"Gettext_Catalog", ".po"},{"Go", ".go"},{"Groff", ".man"},{"Groovy", ".groovy"},{"Haml"
-- -------------------------------------- -- Gist Script for Linkinus -- by Jacob Chapel -- Version 0.5 -- -------------------------------------- on linkinuscmd(paste_type) set useGrowl to do shell script "defaults read com.conceitedsoftware.Linkinus alertGrowl" set theURL to "" set file_type to ".txt" set file_types to {{"ActionScript", ".as"}, {"C", ".c"}, {"Csharp", ".cs"}, {"Common_Lisp", ".cl"}, {"emacs_lisp", ".sls"}, {"erlang", ".hrl"}, {"haskell", ".hs"}, {"html", ".html"}, {"java", ".java"}, {"lua", ".lua"}, {"objective_c", ".m"}, {"perl", ".pl"}, {"Scala", ".scala"}, {"scheme", ".sls"}, {"TeX", ".tex"}, {"XML", ".xml"}, {"Ada", ".adb"}, {"AppleScript", ".scpt"}, {"Arc", ".arc"}, {"ASP", ".ascx"}, {"Assembly", ".asm"}, {"Batchfile", ".bat"}, {"Befunge", ".befunge"}, {"Boo", ".boo"}, {"Brainfuck", ".b"}, {"C_ObjDump", ".c-objdump"}, {"ChucK", ".java"}, {"Clojure", ".clj"}, {"CoffeeScript", ".coffee"}, {"ColdFusion", ".cfm"}, {"Cpp_ObjDump", ".cppobjdump"}, {"Cucumber", ".feature"}, {"D", ".d"},