Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@forthxu
forthxu / TaskServer.php
Created April 20, 2023 07:58
swoole-1.8.5 多进程任务处理
<?php
/**
* 任务处理服务
$taskServer = new \TaskServer(
100,//工作进程数量
function($taskServer){//onMaster: 主进程任务
//测试发任务到工作进程
swoole_timer_tick(100, function () use ($taskServer) {
$taskServer->task("hello");
});
@forthxu
forthxu / date_convert_osx_example.sh
Created September 7, 2022 02:22 — forked from benwei/date_convert_osx_example.sh
MacOS convert timestamp by date command with GNU bash
#!/bin/bash
# author: terry, ben
# tested GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14)
# FYR (for Mac OS, may need some change for linux)
# second -> ISO8601
date -u -r 1453951368 +%FT%TZ
## ouptput: 2016-01-28T03:22:48Z
# ISO8601 -> second
date -ju -f "%FT%TZ" 2016-01-28T03:22:48Z +%s
## output: 1453951368
@forthxu
forthxu / subdomains.txt
Created May 15, 2020 01:48
常见子域名,用于蛮力查找
www
mail
ftp
smtp
pop
m
webmail
pop3
imap
localhost

Create self-signed certificates with OpenSSL

Root CA

Create Root CA key (enable password with '-des3' option)

$ openssl genrsa -des3 -out root.key 4096

Create Root CA

@forthxu
forthxu / btc.protocol
Created September 26, 2018 02:26
BTC和USDT(OMNI)转账协议分析
--------------------
--------------------
交易:a1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d
raw: https://btc.com/a1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d.rawhex
01 加锁数量
输出脚本:
0010a5d4e8000000 小头,八字节,转出数量 10000.00000000
19 脚本长度
@forthxu
forthxu / bqt.sol
Created June 20, 2018 07:14
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
pragma solidity ^0.4.23;
/**
* @title ERC20 interface
*/
contract ERC20 {
function totalSupply()
public view returns (uint256);
function balanceOf(address who)
@forthxu
forthxu / erc20.sol
Created March 27, 2018 06:27
erc20
pragma solidity 0.4.16;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
/**
* owned 是一个管理者
*/
contract owned {
address public owner;
@forthxu
forthxu / Keccak256.php
Created March 7, 2018 09:14
ethereum Keccak256(sha3-256),erc20,erc223,erc721
<?php
/**
* @copyright Bruno Bierbaumer, Vladimir Vyatkin
* @see https://github.com/0xbb/php-sha3
*/
namespace Keccak;
final class Keccak256
{
const KECCAK_ROUNDS = 24;
@forthxu
forthxu / BatchProcessingMysqlTable.sh
Created December 6, 2017 03:32
批量处理mysql数据表
#!/bin/bash
tables=`mysql -uroot jipai -e "select table_name from information_schema.tables where table_schema='jipai' and table_type='base table';" --batch --raw --skip-column-names`
for table in ${tables[@]}
do
echo ${table}, `mysql -uroot jipai -e "select count(*) from ${table};" --skip-column-names`
done
@forthxu
forthxu / blockchain.go
Created December 5, 2017 09:06
200行区块链-go语言版本 原版 https://github.com/lhartikk/naivechain.git
package main
import (
"context"
"crypto/sha256"
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"net"
"net/http"