Skip to content

Instantly share code, notes, and snippets.

View binux's full-sized avatar

Roy Binux binux

View GitHub Profile
// vim: set et sw=2 ts=2 sts=2 ff=unix fenc=utf8:
// Author: Binux<i@binux.me>
// http://binux.me
// Created on 2013-09-17 10:53:19
(function() {
window.console = window.console || {};
window.console.log = window.console.log || function() {};
var _ = {};
#!/bin/sh
# parameters
# $1 the interface name used by pppd (e.g. ppp3)
# $2 the tty device name
# $3 the tty device speed
# $4 the local IP address for the interface
# $5 the remote IP address
# $6 the parameter specified by the 'ipparam' option to pppd
ip rule | grep vpn || ip rule add table vpn
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://vjs.zencdn.net/4.3/video.js"></script>
<link href="http://vjs.zencdn.net/4.3/video-js.css" rel="stylesheet">
<meta charset=utf-8 />
<title>非常厉害的播放器</title>
</head>
<body>
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<input type="file" id="file" name="file" /><br>
<button class=load id="load0" data-start="0" data-stop="0.1" disabled>load 0-10%</button>
<button class=load id="load5" data-start="0.1" data-stop="0.2" disabled>load 10%-20%</button>
@binux
binux / gplus.gs
Last active December 14, 2015 17:39
Google App Script of reader2plus A script record user's Google reader starred items as activities.
//
// 1. Depoly as web app (https://developers.google.com/apps-script/execution_web_apps#deploying)
// 2. register as web app through the APIs Console (https://code.google.com/apis/console#access)
// 3. add 'client_id', 'client_secret' to project properties.
// 4. If published to anyone else, make sure they access to the code. (https://developers.google.com/apps-script/execution_time_triggers)
//
var script_url = ScriptApp.getService().getUrl();
var client_id = ScriptProperties.getProperty('client_id');
var client_secret = ScriptProperties.getProperty('client_secret');
@binux
binux / img_share.py
Last active December 14, 2015 10:58
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<17175297.hk@gmail.com>
# http://binux.me
# Created on 2012-12-15 16:11:13
import re
import json
import os.path
@binux
binux / imgurl.py
Last active December 14, 2015 10:19
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<i@binux.me>
# http://binux.me
# Created on 2013-03-02 19:50:18
import os
import re
import sys
@binux
binux / selector.js
Last active December 14, 2015 04:19
function binux_init() {
var bdiv = document.createElement('div');bdiv.id = 'binux-overlay';bdiv.setAttribute('style', 'display: none;');
(document.body || document.documentElement).appendChild(bdiv);
function getOffset(elem) {
var top = 0;
var left = 0;
do {
if ( !isNaN( elem.offsetLeft) ) left += elem.offsetLeft;
if ( !isNaN( elem.offsetTop) ) top += elem.offsetTop;
@binux
binux / portal_info.js
Last active December 11, 2015 22:39
function message(msg) {
$('#plexts').append('<div class="plext"><div class="pl_timestamp">'+(new Date()).getHours()+':'+(new Date()).getMinutes()+'</div><div class="pl_content pl_player"><span class="ALIENS">System: </span>'+msg+'</div></div>');
$('#plext_container').scrollTop($('#plext_container')[0].scrollHeight);
}
google.maps.event.addListener(Z.c().h, 'rightclick', function(event) {
message('@'+event.latLng.Ya+', '+event.latLng.Za);
});
U.prototype._show = U.prototype.show;
var _map = R;
var rectangle = new google.maps.Rectangle({
bounds: _map.getBounds(),
editable: true,
map: _map
});
function message(msg) {
$('#plexts').append('<div class="plext"><div class="pl_timestamp">'+(new Date()).getHours()+':'+(new Date()).getMinutes()+'</div><div class="pl_content pl_player"><span class="ALIENS">System: </span>'+msg+'</div></div>');
$('#plext_container').scrollTop($('#plext_container')[0].scrollHeight);