Skip to content

Instantly share code, notes, and snippets.

View storyflow's full-sized avatar
🎯
Focusing

storyflow storyflow

🎯
Focusing
View GitHub Profile
[General]
Name=bing
;【渲染核心】
;(注意是载入方法,不是渲染方法)
;0:用FreeType载入字体
<?php
// 一致性哈希算法
class ConsistentHashing
{
protected $nodes = array(); //真实节点
protected $position = array(); //虚拟节点
protected $mul = 64; // 每个节点对应64个虚拟节点
/**
@storyflow
storyflow / gencert.sh
Created April 1, 2019 02:47
生成自签证书
#!/bin/sh
# create self-signed server certificate:
read -p "Enter your domain [www.example.com]: " DOMAIN
echo "Create server key..."
openssl genrsa -des3 -out $DOMAIN.key 1024
@storyflow
storyflow / Flexihash.php
Created February 13, 2019 03:53 — forked from zigo928/Flexihash.php
一致性hash算法实现-PHP版
<?php
/**
* Flexihash - A simple consistent hashing implementation for PHP.
*
* The MIT License
*
* Copyright (c) 2008 Paul Annesley
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
<?php
define('XDEBUG', "xdebug");
define('ZEND_DEBUGGER', "Zend Debugger");
function createXmlHeader()
{
return "<?xml version=\"1.0\"?>";
}
$db = function ($request, Closure $next) {
echo '成功建立数据库连接' . PHP_EOL;
$response = $next($request);
echo '成功关闭数据库连接' . PHP_EOL;
return $response;
};
$like = function ($request, Closure $next) {
echo '点赞+1' . PHP_EOL;
@storyflow
storyflow / insert_batch.php
Created March 22, 2018 08:43
【Mysql】批量插入数据
function insert_batch($table, $data)
{
global $ms_import;
$keys = array_keys(current($data));
$values = [];
foreach ($data as $clean) {
foreach ($clean as $kk=>$vv) {
$clean[$kk] = '\'' . addslashes($vv) . '\'';
@storyflow
storyflow / php7.Dockerfile
Created March 19, 2018 05:44 — forked from zz/php7.Dockerfile
Dockerfile for PHP7 memcache and Redis ext and zmq https://hub.docker.com/r/zhuzhu/php/
FROM php:7.1-fpm
ENV LIBEVENT_VERSION=2.0.22
RUN apt-get -y update && \
apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev \
libpng12-dev libmemcached-dev libmysqlclient-dev libicu-dev libcurl4-nss-dev \
libzmq-dev libpq-dev libyaml-dev zlib1g-dev \
curl git wget netcat && \
rm -rf /var/lib/apt/lists/*