Skip to content

Instantly share code, notes, and snippets.

View aitormagan's full-sized avatar

Aitor Magán García aitormagan

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="/socket.io/socket.io.js">
</script>
<script>
var iosocket;
function connect_first() {
var cleverPush="\
local arguments=ARGV\n\
local max_mem=tonumber(table.remove(arguments))\n\
local queue=KEYS[1]\n\
local s=redis.call('info','memory')\n\
local mem=tonumber(string.match(s,'used_memory:(.-)\\r\\n'))\n\
if mem<(max_mem) then\n\
return redis.call('lpush', queue, unpack(arguments))\n\
else\n\
return {err='Max queue size reached: infomem: '..tostring(mem)..' max_mem: '..tostring(max_mem)}\n\
@aitormagan
aitormagan / movistar_tv_channel_retriever.py
Created February 25, 2015 22:58
Script to retrieve the streaming URLs of Movistar TV channels
import requests
# Basic Variables
MIN_RANGE = 22000
MAX_RANGE = 40000
BASE_URL = 'http://B%d.cdn.telefonica.com/%d/%s_SUB.m3u8'
CHANNELS_IDS = ['NICK', 'DSNJR', '40TV', 'DSNYXD', 'COCINA', '24HORAS', 'INVITADO', 'FOX',
'AXN', 'CLL13', 'TNT', 'FOXCRIME', 'CSMO', 'AXNWHITE', 'PCMDY', 'SYFY', 'TCM',
'CPLUSLG', 'MOVFUTBOL', 'CPLUSCHP', 'NTLG', 'NATGEOWILD', 'CPLUS1']
#EXTINF:-1,Nickelodeon
http://B29273.cdn.telefonica.com/29273/NICK_SUB.m3u8
#EXTINF:-1,Disney Junior
http://B29285.cdn.telefonica.com/29285/DSNJR_SUB.m3u8
#EXTINF:-1,40TV
http://B31312.cdn.telefonica.com/31312/40TV_SUB.m3u8
#EXTINF:-1,Disney XD
http://B31309.cdn.telefonica.com/31309/DSNYXD_SUB.m3u8
#EXTINF:-1,Canal Cocina
http://B31305.cdn.telefonica.com/31305/COCINA_SUB.m3u8
@aitormagan
aitormagan / proxy.js
Created October 8, 2015 14:02
Node Proxy Transparent to Log external (iOS, Android) HTTP requests
var http = require("http");
var fs = require("fs");
var url = require("url")
http.createServer(function(clientRequest, clientResponse) {
var requestBody = "";
clientRequest.on("data", function(new_data) {
requestBody += new_data;
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 CoNWeT Lab., Universidad Politécnica de Madrid
# This file is part of CKAN Data Requests Extension.
# CKAN Data Requests Extension is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.