多集群的配置文件管理,可以在~/.kube/
目录中,放置多个集群的配置文件,如
~/.kube/cluster_a.yaml
~/.kube/cluster_b.yaml
~/.kube/cluster_c.yaml
然后配置环境变量
package main | |
import ( | |
"context" | |
"fmt" | |
"github.com/aws/aws-sdk-go-v2/aws" | |
"github.com/aws/aws-sdk-go-v2/config" | |
"github.com/aws/aws-sdk-go-v2/feature/s3/manager" | |
"github.com/aws/aws-sdk-go-v2/service/s3" | |
"github.com/dustin/go-humanize" |
# -*- 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 |
多集群的配置文件管理,可以在~/.kube/
目录中,放置多个集群的配置文件,如
~/.kube/cluster_a.yaml
~/.kube/cluster_b.yaml
~/.kube/cluster_c.yaml
然后配置环境变量
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' |
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" |
[email protected] | |
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 |
# 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" |
package main | |
import ( | |
"context" | |
"fmt" | |
"github.com/ethereum/go-ethereum/common" | |
"github.com/ethereum/go-ethereum/ethclient" | |
"log" | |
) |
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" |
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 |