Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import os
import time
import math
from queue import Queue, Empty
from threading import Thread
import logging
from influxdb import InfluxDBClient
@SAPikachu
SAPikachu / openwrt-tcpoptstrip.patch
Last active May 6, 2022 09:04
OpenWrt TCPOPTSTRIP
diff --git a/include/netfilter.mk b/include/netfilter.mk
index 5d532ce..474a48b 100644
--- a/include/netfilter.mk
+++ b/include/netfilter.mk
@@ -262,6 +262,9 @@ $(eval $(call nf_add,IPT_TPROXY,CONFIG_NETFILTER_XT_TARGET_TPROXY, $(P_XT)xt_TPR
# led
$(eval $(call nf_add,IPT_LED,CONFIG_NETFILTER_XT_TARGET_LED, $(P_XT)xt_LED))
+# tcpoptstrip
+$(eval $(call nf_add,IPT_TCPOPTSTRIP,CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP, $(P_XT)xt_TCPOPTSTRIP))
This file has been truncated, but you can view the full file.
"use strict";
(function() {
Error.stackTraceLimit = Infinity;
var $global, $module;
if (typeof window !== "undefined") { /* web page */
$global = window;
} else if (typeof self !== "undefined") { /* web worker */
$global = self;

Keybase proof

I hereby claim:

  • I am sapikachu on github.
  • I am sapikachu (https://keybase.io/sapikachu) on keybase.
  • I have a public key ASCDs5kwFA8KZaR-ExqujHIKUUlxW1-IptukK3hxoOIM9Ao

To claim this, I am signing this object:

@SAPikachu
SAPikachu / ZFS + couchdb + zstd compression test.md
Last active August 1, 2021 03:22
ZFS / couchdb / zstd compression test

Environment

  • Ubuntu 20.04
  • Kernel 5.4.0-67
  • OpenZFS 2.0.4-0york2~20.04
  • ashift: 12
  • Compression: zstd, default level

Data

@SAPikachu
SAPikachu / 1. en.md
Last active May 25, 2023 08:14
Idea: Verifiably non-riggable shuffle algorithm for online mahjong games

Idea: Verifiably non-riggable shuffle algorithm for online mahjong games

  1. Server should save a random bytestring PS (regenerated after each full match) for each player. PS should be visible on game UI.
  2. Server should publish a global 1024-bit (128 bytes) random bytestring GS (changed every X minutes). Current and next GS should be visible on game UI.
  3. When a match starts, save timestamp T1.
  4. When a round starts, save timestamp T2, and generate a random bytestring R. Then, generate random seed for this round by calculating SHA512 hash of concatenation of following elements (|| denotes concatenation):
  • T1
  • T2
  • R
  • HMAC-SHA512(GS, T1 || T2 || R)
@SAPikachu
SAPikachu / GXToken.sol
Created January 16, 2025 04:41
GXToken.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract GXToken is ERC20 {
constructor() ERC20("Grindery X", "GX") {
_mint(msg.sender, 1_000_000_000 ether);
}