Skip to content

Instantly share code, notes, and snippets.

View findstr's full-sized avatar
🎯
Focusing

重归混沌 findstr

🎯
Focusing
View GitHub Profile
@findstr
findstr / vimrc
Created September 15, 2022 05:53
set nu
set fenc=utf-8
set enc=utf-8
set nocompatible
set mouse=a
set backspace=indent,eol,start
set softtabstop=8
set shiftwidth=8
set noexpandtab
set linebreak
@findstr
findstr / overlay.shader
Created November 27, 2020 14:18
WorldMap
Shader "WorldMap/Hightlight"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Color("Color", Color) = (0,1,0)
_Scale("Scale", Float) = 1
_Brightness("Brightness", Float) = 1
}
SubShader
@findstr
findstr / dbq.lua
Created November 4, 2020 06:11
command cache for redis
local M = {}
local pairs = pairs
local length = 0
local seq = {}
local map = {}
local marshal = function(v, schema)
return v.hello .. ":" .. v.world
end

#分布式系统架构

现在很多公司都是使用dubbo或者类似dubbo的rpc调用。说说我对dubbo的理解 dubbo 存活检测感觉分为下面三个层面 服务端与注册中心的链接状态 通常注册中心是zookeeper,服务端注册临时节点,客户端注册这个节点的watch事件,一但服务端失联, 客户端将把该服务从自己可用服务列表中移除。(一个服务通常有多个提供者,只是把失联的提供者移除)。 zookeeper是通过心跳发现服务提供者失联的,心跳实际上就是以固定的频率(比如每秒)发送检测的数据包;

客户端与注册中心的链接状态

@findstr
findstr / zproto.php
Last active April 14, 2020 04:27
zproto for php parse
class zproto {
private $proto;
private $unpack;
function __construct($dom) {
$this->proto = $dom;
}
//for compatible less then 7.1.0
private function unpack($fmt, $dat, $off) {
$dat = substr($dat, $off);
return unpack($fmt, $dat);
@findstr
findstr / astar.lua
Last active March 18, 2022 07:36
astar
local M = {}
local queue = require "minheap"
local open = queue:create()
local close = {}
local camefrom = {}
local F = {}
local G = {}
local H = {}
local function clear(tbl)
@findstr
findstr / tie-tree.lua
Last active September 27, 2019 01:29
Trie for lua
local concat = table.concat
local tree = {}
local function tree_add(str)
local p = tree
for i = 1, #str do
local c = str:byte(i)
local n = p[c]
if not n then
n = {}
@findstr
findstr / NetSocket.cs
Created December 6, 2018 03:20
NetSocket.cs
using System;
using System.IO;
using System.Net;
using System.Collections;
using System.Net.Sockets;
using UnityEngine;
class Stream {
private byte[] buffer = null;
private int length = 0;
@findstr
findstr / dc3.c
Created November 1, 2018 03:03
dc3
#include <assert.h>
#include <time.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
//#define DEBUG
#define TERM (0)
@findstr
findstr / Profiler.cs
Created October 16, 2018 09:45
Detect Texture leak for Unity3D
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEditor;
using UnityEngine.Profiling;
namespace Profiler {