Skip to content

Instantly share code, notes, and snippets.

View niklasfi's full-sized avatar

Niklas Fischer niklasfi

View GitHub Profile
server {
listen 80;
server_name 8082.example.com
root /var/www/8082;
location /static/ {
internal;
alias /var/www/8082/static/;
}
var m = require('./models.js'),
Cookies = require('cookies'),
fs = require('fs'),
conf = JSON.parse(fs.readFileSync('./8081.conf')),
http = require('http'),
log = require('./logger.js').customs;
var noop = function(){}
var cookieOptions = function(){
var m = require('./models.js'),
Cookies = require('cookies'),
fs = require('fs'),
conf = JSON.parse(fs.readFileSync('./8081.conf')),
http = require('http'),
log = require('./logger.js').customs;
var noop = function(){}
var cookieOptions = function(){
-- phpMyAdmin SQL Dump
-- version 2.11.8.1deb5+lenny8
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Erstellungszeit: 25. Februar 2011 um 14:24
-- Server Version: 5.0.51
-- PHP-Version: 5.2.6-1+lenny9
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
@niklasfi
niklasfi / gist:842860
Created February 24, 2011 20:53
fast
var http = require('http'),
url = require('url'),
fs = require('fs');
http.createServer(function(req,res){
var u = url.parse(req.url);
console.log(u.pathname);
if( u.pathname == '/bigfile' ){
res.writeHead(200);
fs.createReadStream('bigfile').pipe(res);
@niklasfi
niklasfi / gist:842734
Created February 24, 2011 19:40
Buffering
Server.prototype.file2res = function(path,call){
var start = call.start;
var remaining = call.end-call.start+1;
fs.open(path,'r',0666, function(err,fd){
if(err) throw err;
var b = new Buffer(1024*1024*10);
var onDrain = function(){
//console.log('rem: ' + remaining);
if (remaining)
=== CREATE TICKET ===
GET /createTicketFor/Matrix_Revolutions_11.02.13_22-30_pro7_155_TVOON_DE.mpg.avi.otrkey HTTP/1.1
Host: niklasfi.de:8080
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:2.0b12pre) Gecko/20110216 Firefox/4.0b12pre
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Hello guys,
maybe you can help me with this, as i cannot figure this problem. I am
quite shure the problem is on my end, but I would really appreciate it
if you helped me out.
I built web app which is supposed to serve Recorded TV as a download
(For the folks yelling out that that is illegal, I can tell them: in
Germany it isn't, if you do it right). You can have a look at the
project at http://niklasfi.de:8080.
@niklasfi
niklasfi / gist:826724
Created February 14, 2011 22:30
postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
home_mailbox = mails/
inet_interfaces = all
mailbox_size_limit = 0
mydestination = niklasfi.de, vs1145146.vserver.de, localhost.vserver.de, localhost
@niklasfi
niklasfi / this works however:
Created February 13, 2011 15:50
this throws an error:
var req = http.request({host: '127.0.0.1', port: '5984', path: '/ms/', method: 'POST', 'Content-Type': 'application/json'},function(res){
var sigma = '';
res.on('data',function(chunk){sigma+=chunk})
res.on('end',function(){
console.log(sigma); //{"error":"bad_content_type","reason":"Content-Type must be application/json"}
var reply = JSON.parse(sigma);
if(reply.ok == "true")
callback(reply.id);
else
callback(null);