Skip to content

Instantly share code, notes, and snippets.

@guoyu07
guoyu07 / curl.md
Created December 4, 2018 12:53 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@guoyu07
guoyu07 / Calibree
Created October 11, 2018 06:25 — forked from easonlee24/Calibree
使用Calibre制作格式良好的mobi书籍
<p>这几天在搜一本书–《别独自用餐》,书怎么样先不谈。鄙人在网上费了九牛二虎之力,终于找到一本想要的mobi版本。下载下来 用Kindle for PC打开一看发现不是完整版的,得,只能退而求其次,下txt版的吧,毕竟下完可以用calibre转为mobi版,结果下了十多个版本发现基本全是只有前八章,积分被骗光了不说,还浪费了时间。</p>
<p>我郁闷出了内伤,在心里深深的鄙视了网上那群骗下载积分的,悲伤过后,我决定自己动手制作一个mobi版的。</p>
<p>一下午找了大量的资料,差不多算是搞懂了整个流程,现在把我所学到的分享出来,写的可能会有点啰嗦,因为我除了写怎么做以外,还想稍微谈谈为什么这么做,另外分享一些很好的资源,有心人可以参考。 <br>
<!--more--></p><div class="se-section-delimiter"></div>
<h1 id="目录">目录</h1>
<p><div class="toc"><div class="toc">
@guoyu07
guoyu07 / encryption.js
Created August 6, 2018 12:51 — forked from vlucas/encryption.ts
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bytes (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', new Buffer(ENCRYPTION_KEY), iv);
@guoyu07
guoyu07 / random_weight.py
Created July 1, 2018 11:43 — forked from orangle/random_weight.py
基于权重的随机数2种实现方式
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#python2.7x
#random_weight.py
#author: [email protected] 2014-10-11
'''
每个元素都有权重,然后根据权重随机取值
输入 {"A":2, "B":2, "C":4, "D":10, "E": 20}
@guoyu07
guoyu07 / SplClassLoader.php
Created June 29, 2018 02:58 — forked from jwage/SplClassLoader.php
Add MIT license.
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
@guoyu07
guoyu07 / default.conf
Created June 28, 2018 10:18 — forked from wahyudibo/default.conf
Install nginx, php 70 (with fpm), and mysql in Mac OS X
server {
listen 80;
server_name localhost;
root /Users/wahyudibo/Projects/mylabs/php/nginx;
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
@guoyu07
guoyu07 / my_thoughts_on_msgpack.md
Created June 15, 2018 06:09 — forked from frsyuki/my_thoughts_on_msgpack.md
My thoughts on MessagePack

My thoughts on MessagePack

Hi. My name is Sadayuki "Sada" Furuhashi. I am the author of the MessagePack serialization format as well as its implementation in C/C++/Ruby.

Recently, MessagePack made it to the front page of Hacker News with this blog entry by Olaf, the creator of the Facebook game ZeroPilot. In the comment thread, there were several criticisms for the blog post as well as MessagePack itself, and I thought this was a good opportunity for me to address the questions and share my thoughts.

My high-level response to the comments

To the best of my understanding, roughly speaking, the criticisms fell into the following two categories.

@guoyu07
guoyu07 / report.txt
Created June 4, 2018 09:22 — forked from cloudwu/report.txt
tracelog
net=5.422477ms,cluster=91.399046ms,cpu=323.263431ms,latency=5.447901ms,time=425.532855ms
login1:00000063 122.286771ms trace gm
login1:00000063 102.904420ms(net=3.207950ms,cluster=0.250590ms,cpu=3.580064ms,time=7.038604ms) call : @./service/agent/player/war_base.lua:363 @./service/agent/player/war_base.lua:130 @./service/agent/agent_lock.lua:62
login1:00000009 3.568610ms request
login1:00000009 3.458540ms(time=0.250590ms) sleep : @./skynet/lualib/skynet/socketchannel.lua:374 @./skynet/service/clusterd.lua:147 @./skynet/service/clusterd.lua:252
center:0000005d 0.250590ms tracecall begin
center:00000056 0.069562ms request
center:00000056 response
center:0000005d tracecall end
login1:00000009 0.011454ms resume
@guoyu07
guoyu07 / array_sum.js
Created May 29, 2018 02:34 — forked from oozzal/array_sum.js
Recursive Array Sum in Javascript
function arraySum(arr) {
if(typeof arr == 'number') return arr;
return arr.filter(function(item) {
return Array.isArray(item) || Number.isFinite(item);
}).reduce(function(memo, item) {
return memo + arraySum(item);
}, 0);
}
var arr = [7,4,1, [3,true,2], 1, '123'];
alert(arraySum(arr));