Skip to content

Instantly share code, notes, and snippets.

@chux0519
chux0519 / README.md
Last active November 24, 2021 08:26
quorum 黑名单

问题一:被 block 的节点还是能正常发送消息

使用 main 分支,启动三个节点,bootstrap,节点 A 和节点 B

  • A 监听 8003 端口提供 API
  • B 监听 8004 端口提供 API

A 创建一个组,owner 是 A

Keybase proof

I hereby claim:

  • I am chux0519 on github.
  • I am chux0519 (https://keybase.io/chux0519) on keybase.
  • I have a public key whose fingerprint is 8DE3 3838 48F2 FD61 8A26 A67E 5E7F 0933 4CD4 38E7

To claim this, I am signing this object:

@chux0519
chux0519 / main.go
Last active September 6, 2021 08:15
badger-restore
package main
import (
"fmt"
"log"
"os"
badger "github.com/dgraph-io/badger/v3"
badgerOptions "github.com/dgraph-io/badger/v3/options"
)
@chux0519
chux0519 / echo.c
Created February 18, 2021 14:14
echo server(udp and tcp using libevent)
#include <event2/buffer.h>
#include <event2/bufferevent.h>
#include <event2/event.h>
#include <event2/listener.h>
#include <event2/util.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <signal.h>
@chux0519
chux0519 / bundle.sh
Created December 18, 2020 08:58
flameshot bundle script
#! /bin/bash
app_path=build/flameshot.app/Contents
bin_path="$app_path/MacOS"
CreateApp() {
rm -rf build/flameshot.app
mkdir -p $bin_path && cp build/src/flameshot $bin_path/flameshot
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
diff --git a/tg/controllers.py b/tg/controllers.py
index e608d94..f861a89 100644
--- a/tg/controllers.py
+++ b/tg/controllers.py
@@ -873,7 +873,7 @@ class Controller:
return
# notify
- if self.model.is_me(msg["sender_user_id"]):
+ if self.model.is_me(msg["sender"].get("user_id")):
@chux0519
chux0519 / notes
Created July 10, 2019 09:24
docker cp into vlomue
docker container create --name temp -v the-craft-of-selfteaching:/data alpine
docker cp . temp:/data
docker rm temp
## macos only
docker run -it --rm --privileged --pid=host justincormack/nsenter1
https://stage.press.one/p/v?s=46af64a5f97f6cc0938a23a2fa6879148d946013a5f55eda9df30155e7994d4cf479bb58ca3e13a60125678525db61fe81de8b1f767143e33aec3c49a5474dea1&h=f9f2860430e7973536650a3ef3f1730941212b431ba05d123ce7d2c400d26a76&a=54e9679b057faa1e38474b8e705625829643f963&f=P1&v=3
@chux0519
chux0519 / .gitconfig
Last active June 5, 2020 04:00
Linux Setup
[user]
email = chuxdesign@hotmail.com
name = chux0519
[core]
excludesfile = ~/.gitignore
editor = nvim
[merge]
tool = kdiff3
[mergetool]
prompt = false
@chux0519
chux0519 / multi-level-sort.rs
Created February 5, 2019 13:21
multi level sort in rust
/// Multi-level sort a slice of Foobars according to [(field, reverse)]
fn sort_by_names(f: &mut [Foobar], orderings: &[(Foofields, bool)]) {
use std::cmp::Ordering;
f.sort_by(|a, b| {
let mut cmp = Ordering::Equal;
for (field, reverse) in orderings {
if cmp != Ordering::Equal {
break;
}