Skip to content

Instantly share code, notes, and snippets.

Avatar

Roy Binux binux

View GitHub Profile
View auto_click.js
// 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 _ = {};
View ip-up.sh
#!/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
View jsbin.uQinidA.html
<!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>
View html5_video.html
<!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 Dec 14, 2015
Google App Script of reader2plus A script record user's Google reader starred items as activities.
View gplus.gs
//
// 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');
View img_share.py
#!/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
View imgurl.py
#!/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
View selector.js
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;
View portal_info.js
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;
View google.maps.Polygon.js
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);