Skip to content

Instantly share code, notes, and snippets.

View tianchaijz's full-sized avatar
🏠
Working from home

tianchaijz tianchaijz

🏠
Working from home
View GitHub Profile
--[[
https://zhuanlan.zhihu.com/p/26528101
完整的LuaJIT的exe版本都会带一个JIT目录,下面有大量LuaJIT的工具,其中有一个v.lua,
这是LuaJIT Verbose Mode(另外还有一个很重要的叫p.lua,luajit profiler,后面会提到),
可以追踪LuaJIT运行过程中的一些细节,其中就可以帮你追踪JIT失败的情况。
当你看到以下错误的时候,说明你遇到了JIT失败:
failed to allocate mcode memory,对应错误3.1
NYI: register coalescing too complex,对应错误3.2
@tianchaijz
tianchaijz / zcash-monitor.md
Created April 26, 2019 13:13 — forked from ageis/zcash-monitor.md
Prometheus exporter for monitoring statistics of Zcash daemon

zcash-monitor.py

This is a script written in Python intended to run alongside a Zcash node and export statistics for monitoring purposes. It assumes the existence of zcash-cli in the PATH and access to the RPC interface over localhost.

It tracks stuff like: block height, difficulty, number of peers, network solutions per second, errors, mempool size, size of recent blocks, number of transactions within blocks, chaintips, total bytes received and sent, transaction inputs and outputs, and the make-up of transactions in terms of JoinSplits, shielded, unshielded or mixed. These Zcash metrics are refreshed once every 2 minutes.

How it works

Prometheus is a monitoring system and time-series database.

local ngx = ngx
local md5 = ngx.md5
local ngx_time = ngx.time
local ngx_cookie_time = ngx.cookie_time
local decode_base64 = ngx.decode_base64
local string_sub = string.sub
local string_find = string.find
local string_format = string.format
local table_concat = table.concat
@tianchaijz
tianchaijz / 000-tunneld-server.md
Last active November 7, 2018 05:39 — forked from ubergesundheit/000-tunneld-server.md
Ngrok alternative with mmatczuk/go-http-tunnel server
-- https://news.ycombinator.com/item?id=14605922
-- Here's a JSON parser in LPeg, the excellent PEG parser from one of the Lua authors. The function "decode" returns the final, complete tree data structure.
local lpeg = require"lpeg"
local P, S, R, V = lpeg.P, lpeg.S, lpeg.R, lpeg.V
local C, Cc, Cf, Cg, Ct = lpeg.C, lpeg.Cc, lpeg.Cf, lpeg.Cg, lpeg.Ct
local function to8(n)
... -- Lua code to normalize UTF-16 to UTF-8
// Copyright (c) 2014-2018 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <vector>
#include <string>
#include <cctype>
#include <iostream>
#include <assert.h>
[Unit]
Description=ssh forwarding
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/ssh -N -o ServerAliveInterval=60 -o StrictHostKeyChecking=no -R 0.0.0.0:2922:127.0.0.1:22 x@y -p 22
Restart=on-failure
[Install]
package main
import (
"flag"
"log"
"net/url"
"os"
"os/signal"
"time"
Many users seem to use the gen_server for absolutely everything
and often force their problems to fit the gen_sever even though the
gen_server is not appropriate for their problems.
The gen_server is an extremely simple bit of code
which can be easily changed to fit other problems, though people don't
often do this.
In this posting I'll explain the basic idea of how the gen_server works.
#!/bin/sh
# https://github.com/oracle/opengrok/wiki/How-to-setup-OpenGrok
# https://github.com/OpenGrok/docker/blob/master/Dockerfile
VERSION="1.2.6"
LINK="https://github.com/oracle/opengrok/releases/download/${VERSION}/opengrok-${VERSION}.tar.gz"
TOMCAT_LINK="http://ftp.yz.yamagata-u.ac.jp/pub/network/apache/tomcat/tomcat-8/v8.5.39/bin/apache-tomcat-8.5.39.tar.gz"