Skip to content

Instantly share code, notes, and snippets.

View j67678's full-sized avatar

j67678

View GitHub Profile
@j67678
j67678 / function.php
Created November 2, 2013 09:51
抓取正方课表
<?php
function str_extract($string,$before,$after){
if(!strpos($string, $before))return false;
$start = strpos($string, $before) + strlen($before);
$string = substr($string, $start);
$end = strpos($string, $after);
return substr($string, 0, $end);
}
function strip_breaks($str){
$str = str_replace('
@j67678
j67678 / hkc.js
Created November 3, 2013 04:11
casperjs capture
var casper = require("casper").create({
pageSettings: {
loadImages: false,
loadPlugins: false
}
}),
utils = require('utils');
casper.start('http://opac.hkc.edu.cn/opac/newpub/cls');
@j67678
j67678 / nginx-custom.PKGBUILD
Created September 14, 2014 05:09
ZNC log hosted on nginx with fancyindex
# Maintainer: Alexander Kuznecov <alexander@kuznetcov.me>
_pkgname="nginx"
_user="http"
_group="http"
_doc_root="/usr/share/${_pkgname}/http"
_sysconf_path="etc"
_conf_path="${_sysconf_path}/${_pkgname}"
_tmp_path="/var/spool/${_pkgname}"
_pid_path="/run"
@j67678
j67678 / config.yaml
Last active August 29, 2015 14:16
anti anti-link
name: cnbeta1
version: 1
handle:
- rewrite: if ( path ~ "^(.*)\.png$" ) goto "img.php?url=$1.png"
- rewrite: if ( path ~ "^(.*)\.gif$" ) goto "img.php?url=$1.gif"
- rewrite: if ( path ~ "^(.*)\.jpg$" ) goto "img.php?url=$1.jpg"
- rewrite: if ( path ~ "^(.*)\.jpeg$" ) goto "img.php?url=$1.jpeg"
@j67678
j67678 / imagebot.php
Last active September 22, 2015 07:12
Simple bearychat image robot in world's best language
<?php
$post = json_decode(file_get_contents("php://input"));
if (!$post) {
die('Hello world!');
}
$text = trim(substr($post->text, strlen($post->trigger_word)));
if (!$text) {
die('{ "text": "what?" }');
}
$ret = json_decode(file_get_contents('http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=8&imgsz=small|medium|large&q=' . urlencode($text)));
<?php
$post = json_decode(file_get_contents("php://input"));
if (!$post) {
exit;
}
$max = 100;
$text = trim(substr($post->text, strlen($post->trigger_word)));
if ($text && is_numeric($text)) {
$max = $text;
}
@j67678
j67678 / surge.conf
Created October 28, 2015 05:57 — forked from soffchen/surge.conf
surge.conf
[General]
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local
bypass-tun = 0.0.0.0/8, 1.0.0.0/9, 1.160.0.0/11, 1.192.0.0/11, 10.0.0.0/8, 14.0.0.0/11, 14.96.0.0/11, 14.128.0.0/11, 14.192.0.0/11, 27.0.0.0/10, 27.96.0.0/11, 27.128.0.0/9, 36.0.0.0/10, 36.96.0.0/11, 36.128.0.0/9, 39.0.0.0/11, 39.64.0.0/10, 39.128.0.0/10, 42.0.0.0/8, 43.224.0.0/11, 45.64.0.0/10, 47.64.0.0/10, 49.0.0.0/9, 49.128.0.0/11, 49.192.0.0/10, 54.192.0.0/11, 58.0.0.0/9, 58.128.0.0/11, 58.192.0.0/10, 59.32.0.0/11, 59.64.0.0/10, 59.128.0.0/9, 60.0.0.0/10, 60.160.0.0/11, 60.192.0.0/10, 61.0.0.0/10, 61.64.0.0/11, 61.128.0.0/10, 61.224.0.0/11, 100.64.0.0/10, 101.0.0.0/9, 101.128.0.0/11, 101.192.0.0/10, 103.0.0.0/10, 103.192.0.0/10, 106.0.0.0/9, 106.224.0.0/11, 110.0.0.0/7, 112.0.0.0/9, 112.128.0.0/11, 112.192.0.0/10, 113.0.0.0/9, 113.128.0.0/11, 113.192.0.0/10, 114.0.0.0/9, 114.128.0.0/11, 114.192.0.0/10, 115.0.0.0/8, 116.0.0.0/8, 117.0.0.0/9, 117.128.0.0/10, 118.0.0.0/11, 118.64.0.0/10, 118.128.0.0/9, 119.0.
server=/.google.com/208.67.220.220#443
server=/.google.com.hk/208.67.220.220#443
server=/.gstatic.com/208.67.220.220#443
server=/.ggpht.com/208.67.220.220#443
server=/.googleusercontent.com/208.67.220.220#443
server=/.appspot.com/208.67.220.220#443
server=/.googlecode.com/208.67.220.220#443
server=/.googleapis.com/208.67.220.220#443
server=/.gmail.com/208.67.220.220#443
server=/.google-analytics.com/208.67.220.220#443
@j67678
j67678 / gist:5fca57ddd351e69d0640
Created February 16, 2016 08:06
download jdk in cli
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/ejdk/8u73-b02/ejdk-8u73-linux-i586.tar.gz
@j67678
j67678 / .htaccess
Last active March 24, 2016 03:01
PAC Server
RewriteEngine on
RewriteRule ^/?pac/(.*)$ pac.php?proxy=$1 [L]
RewriteRule ^/?pac2/(.*)$ pac2.php?proxy=$1 [L]