Skip to content

Instantly share code, notes, and snippets.

View ccbikai's full-sized avatar

面条 ccbikai

View GitHub Profile
@ccbikai
ccbikai / aria2.conf
Created July 19, 2013 07:22
aria2配置文件
#允许rpc
enable-rpc=true
#允许所有来源, web界面跨域权限需要
rpc-allow-origin-all=true
#允许非外部访问
rpc-listen-all=true
#RPC端口, 仅当默认端口被占用时修改
rpc-listen-port=6800
# 保存日志到文件,没有该文件用 touch 命令新建,不然会报错
log=/mnt/upan/aria2.log
@ccbikai
ccbikai / unsplash.py
Last active December 31, 2019 12:15
unsplash 全站下载脚本
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
# unsplash 全站下载脚本
# 请先安装 requests ,BeautifulSoup
# pip install requests beautifulsoup4
# 运行 python unsplash.py
# 输入最小页数和最大页数

Keybase proof

I hereby claim:

  • I am ccbikai on github.
  • I am ccbikai (https://keybase.io/ccbikai) on keybase.
  • I have a public key ASAayS5EUfE0yo6rmHR6YP6Q-eKmzFZlu8R0s3rW0TQ-NQo

To claim this, I am signing this object:

@ccbikai
ccbikai / gist.php
Last active May 13, 2017 15:54
Wordpress 嵌入 Gist代码
function wp_iframe_handler_gist( $matches, $attr, $url, $rawattr ) {
$iframe = '<iframe width="100%" height="300" src="https://gist.github.com/'. esc_attr($matches[1]) .'/'. esc_attr($matches[2]) . '.pibb" frameborder=0 ></iframe>';
return apply_filters( 'iframe_gist', $iframe, $matches, $attr, $url, $rawattr );
}
wp_embed_register_handler( 'gist_iframe', '#https://gist.github.com/(.*?)/([\w]+)#i', 'wp_iframe_handler_gist' )
@ccbikai
ccbikai / push.php
Created April 16, 2014 14:06
利用pushbullent推送wordpress评论
function pushbullet($title,$body)
{
$apikey='v1dFWupd5ifoOz0tajOc';
$device_iden='ujEH7v8iCkedjz';
$req_args = array(
'headers' => array(
'Authorization' => 'Basic ' . base64_encode( $apikey.':')
),
'timeout' => 50,
'sslverify' =>FALSE,
@ccbikai
ccbikai / xiami.py
Created April 3, 2014 10:59
利用SAE获得虾米音乐外链
# -*- coding: utf-8 -*-
#!/usr/bin/env python
import os
import sae
import web
import json
import urllib2
urls=('/','Index','/xiami/(.+)','Xiami')
@ccbikai
ccbikai / promise.js
Last active February 1, 2016 08:21
数组转换成 Promise 的序列
[1,2,3].reduce(function(sequence, i) {
return sequence.then(function() {
return Promise.resolve(i);
}).then(function(j) {
console.log(j);
});
}, Promise.resolve());
// 从一个完成状态的 Promise 开始
var sequence = Promise.resolve();
@ccbikai
ccbikai / nginx301.conf
Created November 8, 2013 12:17
nginx 泛域名301转发 核心代码
if ($host ~* ^(.*)\.nju\.pt\/^(*)) {
set $sub_name $1;
set $path $2;
rewrite ^(.*) http://$sub_name.njupt.edu.cn$path permanent;
}
@ccbikai
ccbikai / rename.py
Created November 7, 2013 15:09
python批量修改文件名后缀
import os
def change_suffix(dir_path):
for name in os.listdir(dir_path):
new_name=name.replace('.markdown','.md')
os.rename(name,new_name)
change_suffix(".")
@ccbikai
ccbikai / rem.js
Created December 24, 2015 06:27
rem自适应,宽度计算 1rem === 40px ;
(function(doc, win) {
var docEl = doc.documentElement,
resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
recalc = function() {
var clientWidth = docEl.clientWidth;
if (!clientWidth) {
return
};
if (clientWidth >= 640) {