Skip to content

Instantly share code, notes, and snippets.

@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 <hu60.cn@gmail.com>
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 / 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 / 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 / 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 / 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!"}');