Skip to content

Instantly share code, notes, and snippets.

@rosynirvana
rosynirvana / pac.js
Created August 1, 2017 12:25
20170801
var _http_map = {
'white': {
'any': [],
'bangumi.bilibili.com': [
/^\/index\/ding\-count\.json$/i
]
},
'proxy': {
'any': [
/^[^/]*\.cupid\.iqiyi\.com\//i,
@rosynirvana
rosynirvana / bilibili_api.lua
Created May 1, 2017 02:22 — forked from mimosa/bilibili_api.lua
B站 api key 规则,每3小时轮换一个 :(
function string.fh(str)
return (str:gsub('..', function (cc)
return string.char(tonumber(cc, 16))
end))
end
function sort_nums()
return ("6337393836663535306539363566613865616264646435653033363665356466"):fh()
end
bit = require('bit')
@rosynirvana
rosynirvana / yy.py
Last active April 16, 2018 08:09
fetch yy m3u8
#!/usr/bin/env python3
import requests
import random
import json
import re
def yy_m3u8(url):
m3u8_file = None
re_live = r'www\.yy\.com/(\d+)/(\d+)'
import requests
import logging
import time
class RangeDownloadException(Exception):
pass
def range_download(url, start, length, fp):
'''Low level routine. Caller should handle start and length with care'''
headers = {}
@rosynirvana
rosynirvana / mtv.co.uk.py
Last active February 28, 2017 06:22
dummy
#!/usr/bin/env python3
import sys
import tempfile
import logging
import requests
from Crypto.Cipher import AES
from bs4 import BeautifulSoup
BASE_URL = 'http://media.mtvnservices.com/player/html5/mediagen/?uri='
BASE_SUFFIX = '&device=iPad'
@rosynirvana
rosynirvana / gist:a085649a9c09f0cf78ad
Created October 8, 2014 02:54
As we all know, goto is branching
#include <stdio.h>
int interval_sum(int a, int b)
{
int result = 0, offset = 0;
start:
result += (a+offset);
if(a+offset < b){
offset += 1;
goto start;
/* http://cs.clackamas.cc.or.us/molatore/cs260Spr03/combsort.htm */
#include <stdio.h>
void combsort(int* ary, int size);
void swap(int*, int*);
int main()
{
int i = 0;
int ary[] = {9, 6, 2, 7, 8, 4, 1, 5};
#include <stdio.h>
#define FALSE 0
#define TRUE 1
int next_permutation(int* ary, int length);
void print_array(int* ary, int length);
int main()
{
int test_data[] = {1, 2, 3, 4};
@rosynirvana
rosynirvana / gist:5b241520e225639f77f8
Created May 8, 2014 13:57
From LanQiao programming contest
#include <iostream>
#include <vector>
#include <bitset>
#include <cmath>
using std::vector;
using std::bitset;
bitset<1300000> buf;
@rosynirvana
rosynirvana / paomian_oj_40
Created May 7, 2014 20:07
origin: baidu astar 2013.1.10
#include <iostream>
#include <algorithm>
#include <vector>
using std::vector;
int main()
{
int len;
while(std::cin >> len && len){