Skip to content

Instantly share code, notes, and snippets.

@SwimmingTiger
SwimmingTiger / bcoin-rpc-proxy.php
Created March 13, 2017 06:22
bcoin-rpc-proxy.php
<?php
header('Content-Type: application/json');
$url = 'http://localhost:xxxx/';
$auth = 'xxxx';
$userPw = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : '';
if (!hash_equals($auth, $userPw)) {
die('{"error":"Auth failed!"}');
@SwimmingTiger
SwimmingTiger / nc-not-works.log.c
Last active October 5, 2017 07:43
logs of running `strace nc -l 4444`. (the `.c` postfix only for highlight)
execve("/bin/nc", ["nc", "-l", "4444"], [/* 15 vars */]) = 0
brk(NULL) = 0xd42000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fcaae0b0000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=20683, ...}) = 0
mmap(NULL, 20683, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fcaae0b7000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
@SwimmingTiger
SwimmingTiger / simply-tcp-echo-server.c
Last active October 5, 2017 08:52
simply-tcp-server.c
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h>
#define BUFFER_SIZE 1024
@SwimmingTiger
SwimmingTiger / spawn-demo.js
Last active June 17, 2018 11:32
关于生成器函数和async/await的区别与联系的DEMO
function now() {
var d = new Date();
return ('0' + d.getHours()).substr(-2) + ':' + ('0' + d.getMinutes()).substr(-2) + ':' + ('0' + d.getSeconds()).substr(-2);
}
function sleep(t, n) {
return new Promise(function (resolve) {
console.log('begin: ' + n + ' sleep ' + t + 'ms, ' + now());
setTimeout(function () {
console.log('end: ' + n + ' slept ' + t + 'ms, ' + now());
@SwimmingTiger
SwimmingTiger / 0001-Fix-the-icon-on-the-world-map-disappears-when-mouse-over-a-totem.patch
Last active August 29, 2018 16:20
Paku Totems: Fix the icon on the world map disappears when mouse over a totem
From 1c3d1b105a924a5ec7f76df155806c634c11fea7 Mon Sep 17 00:00:00 2001
From: SwimmingTiger <[email protected]>
Date: Thu, 30 Aug 2018 00:04:49 +0800
Subject: [PATCH] Fix the icon on the world map disappears when mouse over a
totem.
---
Paku_Totems.lua | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@SwimmingTiger
SwimmingTiger / add-i18n-support-add-locale-zhCN.patch
Created August 29, 2018 17:19
Paku_Totems: add i18n support; add locale: zhCN.
From 4ab4be88a21e3807141a4ac20f4c7a9480a82391 Mon Sep 17 00:00:00 2001
From: SwimmingTiger <[email protected]>
Date: Thu, 30 Aug 2018 01:16:21 +0800
Subject: [PATCH] add i18n support; add locale: zhCN.
---
Libs/AceLocale-3.0/AceLocale-3.0.lua | 137 +++++++++++++++++++++++++++++++++++
Libs/AceLocale-3.0/AceLocale-3.0.xml | 4 +
Locales/zhCN.lua | 20 +++++
Paku_Totems.lua | 36 ++++-----
@SwimmingTiger
SwimmingTiger / A_Low_Difficulty_Beam_Private_Testnet.md
Last active June 4, 2019 03:10
创建一个低难度的Beam私有测试网络

创建一个低难度的Beam私有测试网络

步骤

  1. 点击右上角的Download ZIP下载该Gist中的相关配置文件。
  2. 下载 beam节点源代码 的Beam源代码。 如果要使用git获取源代码,请检出cold_wallet这个tag。注意某些分支或tag可能由于equihash参数不同,导致GPU Miner无法挖矿。 参考命令:
git clone https://github.com/BeamMW/beam.git
@SwimmingTiger
SwimmingTiger / tcp_proxy.go
Created May 15, 2019 10:55
Simple GO TCP proxy
// From https://gist.github.com/wallrat/3059639
package main
import (
"net"
"fmt"
"io"
"os"
)
func main() {
if len(os.Args) != 3 {
@SwimmingTiger
SwimmingTiger / qiniu-upload.go
Created July 8, 2019 09:55
Qiniu Cloud Storage Upload Tool (Support Breakpoint Resume) | 七牛云文件上传工具(支持断点续传)
package main
import (
"crypto/md5"
"encoding/hex"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
@SwimmingTiger
SwimmingTiger / branch-diff.php
Created July 19, 2019 09:25
按提交注释和提交时间比较两个分支的差异,仅列出不同的部分
#!/usr/bin/env php
<?php
function usage() {
global $argv;
die("Usage: $argv[0] <branch1> <branch2>\n");
}
if ($argc < 3) {
usage();
}