Skip to content

Instantly share code, notes, and snippets.

View kusor's full-sized avatar
💭
Positively happy

Pedro Palazón Candel kusor

💭
Positively happy
  • Joyent Inc.
  • Murcia (Spain)
  • X @kusor
View GitHub Profile
ssh-dss AAAAB3NzaC1kc3MAAACBAKLOcaiwGAw8IRrXyYP1zjc3caxyzjXkiWcOKL0rn+x25VUJNefRMwd94RrajYDzKos8wBhlqQ9ojK4NFLh3jOEAB3W6PbM+R7HwZ4a+xc6JsljcSwrJGry2u26cxBIbR8rj32UDpH81ZGltorcOjRwMio0C7iZ2pgQ/aoeQdu49AAAAFQDMWNod89Qq/iBuvPpWvMw6EovWgwAAAIATOcr2L4QCQaPciBS/a2WsiC+RMd1jhfebIecnvUGcvl1TT6iaeer7ojWnzHczBP+9Bfg+0mvvNLzksCvGpeqhu4pwlElz9/zwoiZ9dfq85Mx/gnZDyyhr0F/FLlo6Q7eWB/jGy1KgaoODQuc4B4brTIYoqPfSXQV4LvBjYOHaMgAAAIB8hPWgUZLrtnVCuwl+q44EZLHX2lKYygpwO6v4yerosdR691rCwAmiqREn4YLAG4Gzo/oZJtYTS0mry28HzGRZ6pKpGCZwelgtwOQGBkbiFcFQBOX777odT46SxAwWdzymaRH+beQ7iLkim5JqsCHqEfpAGDJC+zZqHcdI7cwizw== [email protected]
@kusor
kusor / decrypt.rb
Created June 11, 2010 10:58
Ruby OpenSSL Cipher
require 'openssl'
require 'digest/sha1'
require 'yaml'
puts "Enter passphrase: "
passphrase = gets.chomp
cipher = OpenSSL::Cipher::Cipher.new("AES-256-CBC")
@kusor
kusor / .gitmodules
Created May 16, 2010 08:20
NodeJS AMQP Exchanges
[submodule "amqp"]
path = amqp
url = http://github.com/ry/node-amqp.git
@kusor
kusor / info.txt
Created March 12, 2010 15:24 — forked from konobi/info.txt
# In .ssh/config:
Host *
ControlMaster no # Connections by default are not a master
ControlPath ~/.ssh/master-%r@%h:%p
ServerAliveInterval 60
ServerAliveCountMax 60
# On normal connections, if there is no master running on the ControlPath it will behave as normal
ssh some.host
@kusor
kusor / gist:266676
Created December 31, 2009 08:56
Smart JavaScript Console
/*
Smart JavaScript Console:
$ cd /Applications/Smart.app/Contents/Resources/Image
$ ./bin/js
*/
js> help();
JavaScript-C 1.8.0 pre-release 1 2007-10-03
@kusor
kusor / custom.error.js
Created December 30, 2009 18:38
Custom JavaScript Error
$ ./bin/js
js> function ResourceValidationError() {
Error.apply(this, arguments);
if (arguments.length >= 1) {
this.message = arguments[0];
}
}
js> ResourceValidationError.prototype = new Error();
Error
js> ResourceValidationError.prototype.constructor = ResourceValidationError;
@kusor
kusor / smart.basic.auth.js
Created December 28, 2009 11:45
Smart HTTP Basic Auth
before(function(){
system.use("info.webtoolkit.Base64");
var username = 'foo';
var password = 'bar';
var auth = "Basic " + Base64.encode(username + ":"+ password);
if (!this.request.headers.hasOwnProperty('Authorization') || (this.request.headers.hasOwnProperty('Authorization') && (auth != this.request.headers['Authorization']))) {
this.response.headers['WWW-Authenticate'] = 'Basic realm="Protected Area"';
this.response.code = 401;
this.response.body = "Not Authorized\n";
throw this.response;
@kusor
kusor / identica-api-client-node.js
Created December 20, 2009 10:15
Playing with identi.ca API using node.js
var sys = require('sys'),
http = require('http');
var identica = {
host: 'identi.ca',
root: '/api',
search: '/search.json?q=',
statuses: '/statuses',
publicTimeline: function() {
return( this.root + this.statuses + "/public_timeline.json" );
@kusor
kusor / cron-test.js
Created December 20, 2009 10:14 — forked from onewland/cron-test.js
simple cron API for node.js
var cron = require('./cron'), sys = require('sys');
cron.Every((2).seconds(), function() { sys.puts('Working!'); });
@kusor
kusor / sinatra_http_options.rb
Created December 12, 2009 16:04
Sinatra HTTP Options
module Sinatra
class Base
def self.http_options(path, opts={}, &bk)
route('OPTIONS', path, opts, &bk )
end
end
module Delegator
delegate :http_options
end
end