Skip to content

Instantly share code, notes, and snippets.

View felix021's full-sized avatar

Felix021 felix021

View GitHub Profile
@felix021
felix021 / stack
Created November 5, 2023 09:16
frugal-case-goroutine-stack
0 0x0000000008fc153f in runtime.asyncPreempt2
at /opt/tiger/tango1_19_stretch/src/runtime/preempt.go:310
1 0x0000000008ff92db in runtime.asyncPreempt
at /opt/tiger/tango1_19_stretch/src/runtime/preempt_amd64.s:50
2 0x000000000a423309 in github.com/chenzhuoyu/iasm/x86_64.(*Label).offset
at /opt/tiger/compile_path/pkg/mod/github.com/chenzhuoyu/iasm@v0.9.1/x86_64/operands.go:99
3 0x000000000a423309 in github.com/chenzhuoyu/iasm/x86_64.(*Program).Assemble
at /opt/tiger/compile_path/pkg/mod/github.com/chenzhuoyu/iasm@v0.9.1/x86_64/program.go:509
4 0x000000000a45bbe5 in github.com/cloudwego/frugal/internal/atm/pgen.(*CodeGen).Generate
at /opt/tiger/compile_path/pkg/mod/github.com/cloudwego/frugal@v0.1.8/internal/atm/pgen/pgen_amd64.go:399
@felix021
felix021 / wifi_muter.sh
Created January 25, 2021 03:28
Automatically mute your speaker according to specific wifi ssid.
#!/bin/bash
# USAGE: register in crontab with "*/10 0 0 0 0"
YourSSID="YOUR WIFI SSID"
YourDevice="MacBook Pro Speakers"
source /etc/profile
which AdjustVolume &>/dev/null
@felix021
felix021 / tunnel_kcp.go
Created January 18, 2021 16:55
A low latency, encrypted tunnel using kcp & chacha20.
package main
import (
"crypto/md5"
"crypto/rand"
"errors"
"flag"
"fmt"
"io"
"log"
@felix021
felix021 / tunnel.go
Created January 6, 2021 18:29
A fast secure tunnel written in Golang
package main
import (
"crypto/md5"
"crypto/rand"
"errors"
"flag"
"fmt"
"io"
"net"
@felix021
felix021 / socks5_proxy.py
Last active June 23, 2021 14:15
socks5 proxy implementation from shadowsocks
#!/usr/bin/env python
# Copyright (c) 2013 clowwindy
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@felix021
felix021 / socks5_proxy.go
Created November 21, 2020 08:12
Minimal socks5 proxy implementation in Golang
package main
import (
"encoding/binary"
"errors"
"fmt"
"io"
"net"
)
MINUTES_OF_DAY = 1440
# [begin, end)
class TimeRange(object):
def __init__(self, begin, end):
self.begin = begin
self.end = end
def getMinutes(schedule):
minutes = [0] * MINUTES_OF_DAY
@felix021
felix021 / skiplist.py
Created September 18, 2018 21:13
A Basic Skip List Implementation
#coding:utf-8
import random
class Node(object):
def __init__(self, height, key=None):
self.key = key
self.next = [None] * height
def height(self):
@felix021
felix021 / IdNumChecksum
Last active September 14, 2018 13:47
中国身份证号校验码计算
def IdNumChecksum(id_num):
return '10X98765432'[sum([int(num) * (2 ** (17 - idx) % 11) for idx, num in enumerate(id_num[:17])]) % 11]
@felix021
felix021 / Ethereum.md
Last active February 21, 2024 09:14
以太坊区块链长什么样? —— 自建 ethereum 私有链指南

之前接触以太坊的时候,确实能搜到很多资料,还有一个看起来很丰富的 Homestead Documentation,但这些材料都太不接地气了,看完还是不知道以太坊区块链到底长什么样,因此整理了这篇说明,希望能够在一定程度上解决这个问题吧。

1. 安装 ethereum (@ubuntu)

参考 官方说明:

sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update

sudo apt-get install ethereum