Skip to content

Instantly share code, notes, and snippets.

View binux's full-sized avatar

Roy Binux binux

View GitHub Profile
@binux
binux / xf_magnet.js
Last active October 19, 2023 02:38
QQ旋风网页版,磁力链支持 书签: javascript:void((function(){var d=document;var s=d.createElement('script');s.src='http://blog.binux.me/assets/image/xf_magnet.js';s.id='binux_script';d.body.appendChild(s)})())
// vim: set et sw=2 ts=2 sts=2 ff=unix fenc=utf8:
// Author: Binux<i@binux.me>
// http://binux.me
// Created on 2013-01-21 20:18:42
jQuery.ajax({
url: 'http://pyproxy.duapp.com/http://httpbin.duapp.com/cookies/set?userid=21',
cache: true,
dataType: 'script',
success: function() {
@binux
binux / aria2jsonrpc.js
Created July 15, 2012 13:09
aria2 jsonrpc client
var ARIA2 = (function() {
var jsonrpc_version = '2.0';
function get_auth(url) {
return url.match(/^(?:(?![^:@]+:[^:@\/]*@)[^:\/?#.]+:)?(?:\/\/)?(?:([^:@]*(?::[^:@]*)?)?@)?/)[1];
};
function request(jsonrpc_path, method, params) {
var request_obj = {
jsonrpc: jsonrpc_version,
@binux
binux / playlist.js
Created November 16, 2012 14:32
playlist for moe.fm
var _playlist = [];
var _next = '';
var _loading = false;
var _loaded = false;
var _current = 0;
function _load_more() {
if (_loading) return;
_loading = true;
$.get(_next, function(result){
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<roy@binux.me>
# http://binux.me
# Created on 2014-12-04 00:56:49
def get_py(word):
word = word.encode('gbk')
@binux
binux / logging_receiver
Created April 22, 2011 10:29
logging receiver for python logging module
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cPickle
import logging
import logging.handlers
import SocketServer
import struct
#!/bin/bash
EMAIL=$1
source vars
set -x
./pkitool $EMAIL
source sendca.sh
@binux
binux / iframe.html
Last active June 22, 2020 23:46
cross origin iframe
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<iframe src="sub_frame.html" width="640" height="480"></iframe>
<iframe src="https://httpbin.org/html" width="640" height="480"></iframe>
</body>
</html>
@binux
binux / auto_vpn.sh
Created January 16, 2014 14:48
自动添加gfwlist域名的对应ip到路由表,实现动态自动翻墙
#!/bin/sh
while :
do
dev=$(ip link | grep state | awk '{ sub(":", "", $2); print $2 }' | grep vpn)
if [ $? -ne 0 ]; then
sleep 5
continue
fi
break
const {app, BrowserWindow} = require('electron')
app.once('ready', async () => {
win = new BrowserWindow()
win.webContents.session.webRequest.onBeforeSendHeaders((details, callback) => callback({}));
win.webContents.once('did-finish-load', async () => {
const html = await win.webContents.executeJavaScript('document.documentElement.innerHTML');
console.log(html);
app.quit()
})
await win.webContents.loadURL('https://httpbin.org/headers', {"extraHeaders":"Addition-Header: hello world"})
@binux
binux / pool.py
Created May 26, 2011 06:39
使用threading+queue的线程池封装,使用对象在每个对象中保存独立的连接,可以安全地使用ctrl-c打断
# !/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
import time
import Queue
import threading
import traceback
class ExitException(Exception):