Skip to content

Instantly share code, notes, and snippets.

View crazygit's full-sized avatar

Crazygit crazygit

View GitHub Profile
@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 / 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 / run_ss_client.sh
Last active March 2, 2024 01:20
run shadowsocks-libev client with docker
#!/usr/bin/env bash
# 配置参考:
# https://github.com/shadowsocks/shadowsocks-libev/blob/master/docker/alpine/README.md
SERVER_ADDR="your_server_ip"
SERVER_PORT="your_server_port"
PASSWORD="your_password"
METHOD="aes-256-cfb"
TIMEOUT=300
@crazygit
crazygit / README.md
Last active January 3, 2024 05:12
使用容器快速搭建服务端远程桌面连接环境

项目参考

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

技术实现:

  • Guacamole Server
  • xrdp Server

参考文档

@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 / get_autosaling_name.sh
Created April 14, 2017 06:54
get aws ec2 autoscaling group name
# get current ec2 AutoScaling group name
# note: change region option as yours
aws autoscaling describe-auto-scaling-instances --region us-east-1 --output text --query=AutoScalingInstances[].AutoScalingGroupName --instance-ids=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)
@crazygit
crazygit / LocalRepository.kt
Last active July 25, 2023 22:31
Jetpack DataStore in MVVM
import com.github.crazygit.tikheart.TikHeartApplication
import com.github.crazygit.tikheart.data.dao.UserInfoDao
import com.github.crazygit.tikheart.data.model.UserInfo
import com.github.crazygit.tikheart.utilities.LocalStorage
object LocalRepository {
private val localStorage = LocalStorage(TikHeartApplication.appContext)
private val localUserDao = UserInfoDao(localStorage)
@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 / diff_of_scrapy_Compose_and_MapCompse.py
Last active March 13, 2023 15:33
The difference of scrapy built in loader processor Compose and MapComose
from scrapy.loader.processors import Compose, MapCompose
proc = Compose(lambda v: v[0], str.upper)
proc(['hello', 'world']) # HELLO
mproc = MapCompose(lambda v: v[0], str.upper)
mproc(['hello', 'world']) # ['H', 'W']
@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"