Skip to content

Instantly share code, notes, and snippets.

View lloydzhou's full-sized avatar
:octocat:
Focusing

Lloyd Zhou lloydzhou

:octocat:
Focusing
View GitHub Profile
@lloydzhou
lloydzhou / 书籍.md
Created June 7, 2020 12:19 — forked from ckeyer/书籍.md
经典编程书籍大全

经典编程书籍大全

100+ 经典技术书籍,涵盖:计算机系统与网络、系统架构、算法与数据结构、前端开发、后端开发、移动开发、数据库、测试、项目与团队、程序员职业修炼、求职面试 和 编程相关的经典书籍。

这个列表综合了伯乐在线网站以往推荐经典书籍文章中的列表,以及在微信和微博中被广泛推荐的好书。虽然已经包括了100多本,覆盖的面也比较全。仍然有很多方面需要补充,而且相信还有很多没有被收录的好书。欢迎大家在 issues 中推荐或自荐。

计算机系统与网络

@lloydzhou
lloydzhou / redis-aggregate.lua
Last active October 9, 2020 05:53 — forked from Hidendra/redis-aggregate.lua
Aggregate values in a redis sorted set. Returns {count, sum, min, max}
local count = 0
local sum = 0
local min = 0
local max = 0
local cursor = "0"
local result = nil
local data = nil
repeat
result = redis.call("zscan", KEYS[1], cursor, "count", 100)
#!/usr/bin/env python
# http://www.rabbitmq.com/tutorials/tutorial-two-python.html
from connect import connection, pika
channel = connection.channel()
channel.exchange_declare(exchange='dlx')
result = channel.queue_declare(queue='dl')
queue_name = result.method.queue
@lloydzhou
lloydzhou / access.lua
Created May 22, 2018 06:13 — forked from mariocesar/access.lua
Nginx Lua script redis based for Basic user authentication
function password_encode(password)
local bcrypt = require 'bcrypt'
return bcrypt.digest(password, 12)
end
function check_password(password, encoded_password)
local bcrypt = require 'bcrypt'
return bcrypt.verify(password, encoded_password)
end
@lloydzhou
lloydzhou / get-old-chromium-binary.md
Created July 12, 2017 09:38 — forked from cletusw/get-old-chromium-binary.md
Download an old Chromium binary

(source)

Taking [denilson-sá's answer][2] further...

You need revision numbers to grab downloads. So first lookup the full version string from the following URL, adjusting parameters as needed:

https://omahaproxy.appspot.com/history.json?channel=stable&os=mac

For Chrome version 28 the full version string is 28.0.1500.71. Now go to https://omahaproxy.appspot.com and enter the full version string ("28.0.1500.71") into the Position Lookup box. Copy the Base Position number ("209842" in this case).

@lloydzhou
lloydzhou / LICENSE.txt
Created May 16, 2016 09:54 — forked from jed/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
<?php
function logger($path = 'php.log', $cond = true) {
$logs = array();
register_shutdown_function(function() use ($path, &$logs){
return count($logs) > 0 ? @file_put_contents($path, implode(array_map(function($log){
return count($log) > 1 ? call_user_func_array('sprintf', $log) : current($log);
@lloydzhou
lloydzhou / t.php
Created January 14, 2016 10:10
template
<?php
function t($t,$d='data'){return "extract(\$$d);".str_replace(['{{','}}','{%','%}'],['");$c(',');$c("','");','$c("'],'%}'.$t.'{%');}
// demo
$data = [
'title' => 'test title',
'messages' => ['message1', 'message2', 'message3']
];
$c='print_r';
<?php
$template = tplite();
$callback = function($s){print $s;};
$template(file_get_contents('test.tpl'), [
'title'=>'test title',
'messages' => ['test message1', 'test messages2']
], $callback);
?>
<app>
<home class="app-page" data-page="true"></home>
<detail class="app-page" data-page="true"></detail>
<cart class="app-page" data-page="true"></cart>
<checkout class="app-page" data-page="true"></checkout>
var path = location.pathname.split('/')
var collections = ['home', 'detail', 'cart', 'checkout']
, pages = {}, activeClass = 'app-active'
, currentCollection = path.length > 2 && path[2] ? path[2] : 'home'