Skip to content

Instantly share code, notes, and snippets.

View findstr's full-sized avatar
🎯
Focusing

重归混沌 findstr

🎯
Focusing
View GitHub Profile
@findstr
findstr / check.lua
Created August 12, 2016 08:29
memleak check
local f = io.open("a.txt", "r")
local malloc = {}
for line in f:lines() do
local typ, ptr, src = string.match(line, "([^:]+):([^:]+):(.*)")
if typ == "malloc" then
malloc[ptr] = src
end
if typ == "free" then
malloc[ptr] = nil
@findstr
findstr / proxyc
Last active September 6, 2017 14:27
revert-proxy
daemon = 0
bootstrap = "test/testhttp.lua"
lualib_path = "test/?.lua;lualib/?.lua"
lualib_cpath = "test/?.so;luaclib/?.so"
ctrl="192.168.2.1@8002"
tunnel="192.168.2.1@8003"
@findstr
findstr / Template.shader
Created June 13, 2017 13:27
unity shader include specular and diffuse light
Shader "Template" {
Properties {
_Color("Color", Color) = (1, 1, 1, 1)
_Specular("Specular Color", Color) = (1, 1, 1, 1)
_Gloss("Gloss", Range(8.0, 256.0)) = 20
}
SubShader {
Tags { "RenderType"="Opaque" "Queue"="Geometry"}
Pass {
Tags { "LightMode"="ForwardBase" }
@findstr
findstr / linklist.c
Created August 25, 2017 06:24
linklist
@findstr
findstr / Decal.cs
Created June 17, 2018 01:40
Decal(Mesh Projector)
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEditor;
class MeshBuilder {
private readonly List<Vector3> vertices = new List<Vector3>();
private readonly List<Vector3> normals = new List<Vector3>();
@findstr
findstr / a.lua
Last active July 21, 2018 04:28
GC RACE
local LINK = require "link"
local buffer = setmetatable({
link = nil
}, {__gc = function(tbl)
LINK.free(tbl.link)
end})
buffer.link = LINK.new()
LINK.push(buffer.link)
LINK.push(buffer.link)
buffer = nil
@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 {
@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 / 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 / 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 = {}