Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am zacyu on github.
* I am zyu (https://keybase.io/zyu) on keybase.
* I have a public key whose fingerprint is F066 BBA5 6531 FF61 813D 8307 F8E6 8C8A 578B 717B
To claim this, I am signing this object:
@zacyu
zacyu / insertChar.js
Last active September 17, 2015 02:52
insert characters to a phrase, breaking non-Latin
var insertChar = function(pharse, targetChar) {
if (!targetChar) targetChar = '\u2606';
for (var i = 0; i < pharse.length; i++) {
if (pharse.charCodeAt(i) == 32) {
pharse = pharse.substr(0, i) + targetChar + pharse.substr(i + 1, pharse.length - i - 1);
}
if (pharse.charAt(i) == targetChar) {
if (i > 0 && pharse.charAt(i - 1) == targetChar) {
pharse = pharse.substr(0, i) + pharse.substr(i + 1, pharse.length - i - 1);
i--; continue;

Keybase proof

I hereby claim:

  • I am zacyu on github.
  • I am zyu (https://keybase.io/zyu) on keybase.
  • I have a public key whose fingerprint is 4D7D FC20 12DA 3E60 1D86 F19D D466 A0C2 FD0F 6793

To claim this, I am signing this object:

@zacyu
zacyu / wpu.js
Created December 7, 2014 01:32
Weibo Photo Util
var e=document.createElement("script");e.type="text/javascript",e.onload=function(){jQuery(".box_plus .describe span").each(function(e,t){var n,r;jQuery(t).text(jQuery(t).attr("title")),n=jQuery(t).closest(".WB_cardwrap").find(".ph_ar_box"),r=n.find("img.photo_pic").attr("src").replace("cmw218","large"),n.find('a').remove();n.append('<a class="W_btn_b" href='+r+' target="_blank">原图: '+r+"</a>")})},e.src="https://code.jquery.com/jquery-2.1.1.min.js",document.body.appendChild(e);
@zacyu
zacyu / 3.cpp
Created December 4, 2014 23:07
paizaオンラインハッカソン Vol.4 ミッション3
#include <iostream>
using namespace std;
int main(void){
// 自分の得意な言語で
// Let's チャレンジ!!
int m, t, n, sum = 0, max = 0;
cin >> t >> n;
int *tmp = new int[t];
for (int i = 0; i < n; i++) {
cin >> m;
103.6.86.153 www.bilibili.tv static.hdslb.com static-s.bilibili.tv interface.bilibili.cn
183.178.216.210 i0.hdslb.com i1.hdslb.com i2.hdslb.com
@zacyu
zacyu / api.bilibili.signature.js
Created February 11, 2014 12:08
Bilibili API Query Signature
var crypto = require('crypto'),
_ = require('underscore'),
APP_KEY = false,
APP_SECRET = false;
function getSignedQueryString(query) {
if (!APP_SECRET) {
throw 'ERROR: App-Secret not provided';
return false;
}
var queryKeys = [],