Skip to content

Instantly share code, notes, and snippets.

View TheWaWaR's full-sized avatar
🌀
Focusing

LingFeng TheWaWaR

🌀
Focusing
View GitHub Profile
@TheWaWaR
TheWaWaR / test-nat-traversal.sh
Created July 18, 2018 04:54
p2p NAT 穿透测试
git clone https://github.com/ustulation/p2p.git
cd p2p
RUST_LOG=p2p=trace cargo run --example tcp_rendezvous_connect -- --relay=104.238.181.214:20445 --traversal-server=104.238.181.214:20444 --traversal-server-key='{"sign":[38,31,210,213,23,70,235,152,27,52,173,110,168,154,2,231,79,98,56,132,188,50,18,23,133,239,161,29,151,53,9,242],"encrypt":[46,187,107,223,180,184,89,175,25,132,66,215,35,80,48,201,22,163,10,236,226,125,210,228,238,209,140,29,182,108,45,82]}' this-is-20445
@TheWaWaR
TheWaWaR / cita_install_develop_mac.sh
Created February 8, 2018 08:10
Install cita development environment on mac
brew install zeromq libsodium gperftools
sudo pip install ethereum==2.2.0 pysodium toml
wget https://github.com/ethereum/solidity/releases/download/v0.4.19/solc-static-linux
chmod +x solc-static-linux
sudo mv solc-static-linux /usr/local/bin/solc
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly-2017-12-05
@TheWaWaR
TheWaWaR / argparse_helper.py
Last active December 31, 2017 10:25
An argparse helper
#!/usr/bin/env python
# coding: utf-8
"""
A simple argparse helper.
Features:
=========
* Make nesting commands more elegant and easy to write.
* Without lose argparse's ability (means you can refactor current code)
@TheWaWaR
TheWaWaR / csharp-json-serialize.cs
Last active December 19, 2017 13:47
C# Json.Net serialize Dictionary<string, object>. You can run it on: http://rextester.com/JOT81793
//Rextester.Program.Main is the entry point for your code. Don't change it.
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@TheWaWaR
TheWaWaR / gen_cert.sh
Last active July 7, 2017 01:41
Shell script to generate SSL/TLS certificate in macOS.
########################################
# $ tree $HOME/local/etc/TLS
# .
# |-- CA
# | |-- index.txt
# | |-- index.txt.attr
# | |-- newcerts
# | | |-- 01.pem
# | | `-- 02.pem
# | |-- private
extern crate threadpool;
extern crate futures;
extern crate tokio_core;
use std::env;
use std::thread;
use std::net::SocketAddr;
use futures::Sink;
use futures::sync::mpsc::{channel, Receiver};
extern crate libc;
extern crate threadpool;
extern crate futures;
extern crate tokio_core;
use std::env;
use std::net::SocketAddr;
// use std::sync::mpsc::{channel, Receiver};
@TheWaWaR
TheWaWaR / prometheus-grafana.json
Created December 7, 2016 07:12
Grafana prometheus configuration
{
"id": 29,
"title": "Prometheus - Demo Dashboard",
"tags": [
"prometheus",
"node",
"misc"
],
"style": "dark",
"timezone": "browser",
@TheWaWaR
TheWaWaR / agent.py
Created December 7, 2016 07:10
Statsd host metrics (python psutil)
#!/usr/bin/env python
# coding: utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import os
import time
# Example YAML to get you started quickly.
# Be aware that YAML has indentation based scoping.
# Code completion support is available so start typing for available options.
swagger: '2.0'
# This is your document metadata
info:
version: "0.0.0"
title: <enter your title>