Skip to content

Instantly share code, notes, and snippets.

View crazygit's full-sized avatar

Crazygit crazygit

View GitHub Profile
@crazygit
crazygit / Vagrantfile
Created November 27, 2023 04:44
Setup K8S Cluster with Vagrant and Kubeadm
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# common config for master and node
config.vm.provision "shell", path: "init.sh"
config.vm.box = "gyptazy/ubuntu22.04-arm64"
config.vm.box_check_update = false
@crazygit
crazygit / kubectl_config.md
Last active April 21, 2023 12:02
kubectl多配置文件管理

多集群的配置文件管理,可以在~/.kube/目录中,放置多个集群的配置文件,如

~/.kube/cluster_a.yaml
~/.kube/cluster_b.yaml
~/.kube/cluster_c.yaml

然后配置环境变量

@crazygit
crazygit / telegram_auto_checkin.py
Last active March 19, 2024 09:35
Telegram auto checkin script
from telethon import TelegramClient, events
import pathlib
# Remember to use your own values from my.telegram.org!
api_id = 12345
api_hash = '0123456789abcdef0123456789abcdef'
# Replace the checkin bot and text with yourown
checkin_at_bot_id = '@checkin_bot'
checkin_text = '/checkin'
@crazygit
crazygit / parseTransaction.go
Last active May 9, 2024 13:22
Parse Ethereum Transaction, Decode input data, Decode output data
package main
import (
"context"
"encoding/hex"
"fmt"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
@crazygit
crazygit / .env.example
Last active May 8, 2022 14:38
Use traefik in docker swarm cluster, Ultimate configuration
ACME_EMAIL=your_mail@example.com
DASHBOARD_DOMAIN=traefik.example.com
WHOAMI_SERVICE_DOMAIN=whoami.example.com
# echo "DASHBOARD_USER=$(htpasswd -nb your_name your_password)" >> .env
DASHBOARD_USER=your_name:$apr1$eMFHYd7e$2rl6G/UF80alLYInwv/tz0
@crazygit
crazygit / traefik-bare-secure-mode.yml
Last active May 8, 2022 14:38
Expose Traefik dashboard in secure mode
# bare secure mode: no https, no basic auth
version: '3.8'
services:
reverse_proxy:
image: traefik:v2.6
command:
# - "--log.level=DEBUG"
# Enable Docker in Traefik, so that it reads labels from Docker services
- "--providers.docker"
@crazygit
crazygit / go-ethereum-get-transaction.go
Created April 26, 2022 09:29
Get transaction value and data
package main
import (
"context"
"fmt"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
"log"
)
@crazygit
crazygit / go-ethereum-read-event.go
Last active April 26, 2022 08:48
read contract event with go ethereum
package main
import (
"context"
"fmt"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"log"
"math/big"
@crazygit
crazygit / python_first_or_none.py
Created July 28, 2021 03:04
firstOrNone Implementation in python
def first_or_none(predicate, seq):
return next(filter(predicate, seq), None)
if __name__ == '__main__':
print(first_or_none(lambda x: x % 2 == 0, [2, 4, 6, 8])) # 2
print(first_or_none(lambda x: x % 2 == 0, [1, 3, 5, 7])) # None
@crazygit
crazygit / README.md
Last active January 3, 2024 05:12
使用容器快速搭建服务端远程桌面连接环境

项目参考

使用容器快速创建远程桌面的GUI连接

技术实现:

  • Guacamole Server
  • xrdp Server

参考文档