Skip to content

Instantly share code, notes, and snippets.

@dvv
dvv / codec.lua
Last active August 29, 2015 14:17
AE info encode
local M
do
-- cache
local char = string.char
--
local encode_info = function(args)
local r = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -- FIXME: lowlevel createtable with 8 + 2 * #args elements?
local n = 0
-- enlist arguments separated with NL
for i = 1, #args do
@dvv
dvv / grab.py
Created April 27, 2015 16:12
1torrenttv playlist rip
#!/usr/bin/env python2
import sys
import urllib
from HTMLParser import HTMLParser
import json
import time
import random
cats = dict()
--- mongodb.js.orig 2010-04-30 22:19:10.000000000 +0400
+++ mongodb.js 2010-05-01 16:03:49.000000000 +0400
@@ -85,7 +85,6 @@
if(typeof query === "string"){
query = parseQuery(query);
}
- var grabOneColumn, deleteId;
var options = {};
query.forEach(function(term){
function stringToValue(string, parameters){
switch(string){
case "true": return true;
case "false": return false;
case "null": return null;
default:
// DVV: handle arrays
if (string.indexOf(',') > -1) {
var r = [];
string.split(',').forEach(function(x){
--- rest-store.js.orig 2010-05-04 18:59:11.000000000 +0400
+++ rest-store.js 2010-05-04 01:08:07.000000000 +0400
@@ -63,19 +63,19 @@
else if(!METHOD_HAS_BODY[method]){
if(method === "get" && request.pathInfo.substring(request.pathInfo.length - 1) === "/"){
// handle the range header
- if(metadata.range){
- // invalid "Range:" just results in 0-Infinity
+ if (metadata.range) {
+ // invalid "Range:" are ignored
--- resource-query.js.orig 2010-05-03 20:15:43.000000000 +0400
+++ resource-query.js 2010-05-03 23:34:14.000000000 +0400
@@ -13,7 +13,8 @@
}
var terms = [];
var originalTerms = terms;
- if(query.replace(/([&\|,])?(([\+\*\-:\w%\._]+)(=[a-z]*=|=|=?<|=?>|!=)([\+\*\$\-:\w%\._]+)|(([\+\*\\$\-:\w%\._]+)(\(?))|(\))|(.+))/g,
+// if(query.replace(/([&\|,])?(([\+\*\-:\w%\._]+)(=[a-z]*=|=|=?<|=?>|!=)([\+\*\$\-:\w%\._]+)|(([\+\*\\$\-:\w%\._]+)(\(?))|(\))|(.+))/g,
+ if(query.replace(/([&\|,])?(([\+\*\-:\w%\._]+)(=[a-z]*=|=|=?<|=?>|!=)([\+\*\$\-:\w%\._,]+)|(([\+\*\\$\-:\w%\._]+)(\(?))|(\))|(.+))/g,
// <-delim-> <--- name --------- comparator ----- value ---->|<-function/value -- openParan->|<-closedParan->|<-illegalCharacter->
--- mongodb.js.orig 2010-05-04 18:59:13.000000000 +0400
+++ mongodb.js 2010-05-04 19:23:16.000000000 +0400
@@ -110,19 +110,23 @@
} else if (term.name == "select") {
options.fields = term.parameters;
} else if (term.name == "slice") {
- directives.start = term.parameters[0];
- directives.end = term.parameters[1];
+ // DVV: .start/.end MUST be numbers, or .start + a-number will result in string concat
+ // DVV: better to get rid of slice() at all, as it _may_ introduce inconsistency with range set via Range: header. As deanlandolt stated, .slice() is to mimic JS intrinsic Array.slice() and should be chainable. IOW, it doesn't fit to control server-side conditions
exports.convertors = {
"number" : function(x){
var n = +x;
return (!isNaN(n)) ? n : x;
},
"date" : function(x){
var date = x + "0000-01-01T00:00:00Z".substring(x.length);
date.replace(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/, function(dummy, y, mp1, d, h, m, s){
x = new Date(Date.UTC(+y, +mp1 - 1, +d, +h, +m, +s));
});
--- node-http-client.js.orig 2010-05-06 09:00:57.542606864 +0400
+++ node-http-client.js 2010-05-06 09:09:51.000000000 +0400
@@ -22,12 +22,12 @@
request.pathname = request.url;
var proxySettings = parse(exports.proxyServer);
request.port = proxySettings.port;
- request.host = proxySettings.host;
+ request.host = proxySettings.hostname;
}
var exports = {};
exports.jsonQueryCompatible = true;
var operatorMap = {
"=": "eq",
"==": "eq",
">": "gt",
">=": "ge",
"<": "lt",
"<=": "le",
"!=": "ne"