
Binance Card 办卡教程
https://www.binance.com/en/cards/写在之前:为什么选择币安卡?无需出金、免去冻卡困扰、web3的资金直接消费购物相比depay等平台、省去每次用的时候单独充值步骤、也没有平台跑路的风险(暂且认为币安是可靠的)国外旅游直接刷卡消费:银联不如visa通用中国公民是否可以办理?可以、基础认证必须是护照/帕劳;身份证不行,因为卡片上需要印刷名字拼音;所以务必使用带拼音的证件去完成基础认证。基础认证已经是身份证了怎么办?方法1: 通过如下方式re-set你基础认证kyc https://www.binance.com/en/my/settings/profile/reset-kyc方法2: 如果方法1对你不适用、可找客服帮你重置你的基础kyc;理由是申请币安卡用;借记卡还是信用卡?借记卡(Visa通道支付/不支持银联Pos机刷卡)使用范围可绑定 支付宝 线上消费或者线下实体商户消费 可绑定 Google Pay Amazon 线上消费 支持全部海外线上服务订阅:Netflix订阅、ChatGPT订阅、Quizlet订阅、Spotify订阅等 实体卡可在任意支...

Table - number of mobile phones and personal computers
The table below shows the number of mobile phones and personal computers per thousand people in six different countries in 2003. Summarise the information by selecting and reporting the main features, and make comparisons where relevant.The table gives information about the number of handsets and personal computers every 1000 people had in six countries in 2003. It is noticeable that the majority of Icelandic citizens had mobile phones, and most San Marino citizens had personal computers. As ...

Monad 高阶领水教程 (四)
背景信息Monad测试网目前水龙头几乎不可用、项目方没有加验证码和钱包余额验证、导致科学家们集体脚本并发领取、目前水龙头基本瘫痪; 如下是曲线救国的领水方案:Get fucet eth sepolia somewhere(faucet.quicknode.com)Bridge eth from sepolia to monad testnet via (testnet.orbiter.finance)Swap eth in monad testnet to mon via (monad.ambient.finance)整个过程分为3个步骤: 第一个步骤:空白账户领取ETH的sepolia测试网ETH代币(很多方式 可自行百度) 第二个步骤:桥接sepolia测试网的eth转账到Monad的测试网 第三个步骤:在Monad测试网用eth交易Mon、直接购买到Mon测试代币即可。领取测试ETHhttps://cloud.google.com/application/web3/faucet/ethereum/sepolia桥接ETH代币到Monadhttps://testnet.orb...
Workout | English | Tec | Crypto

Binance Card 办卡教程
https://www.binance.com/en/cards/写在之前:为什么选择币安卡?无需出金、免去冻卡困扰、web3的资金直接消费购物相比depay等平台、省去每次用的时候单独充值步骤、也没有平台跑路的风险(暂且认为币安是可靠的)国外旅游直接刷卡消费:银联不如visa通用中国公民是否可以办理?可以、基础认证必须是护照/帕劳;身份证不行,因为卡片上需要印刷名字拼音;所以务必使用带拼音的证件去完成基础认证。基础认证已经是身份证了怎么办?方法1: 通过如下方式re-set你基础认证kyc https://www.binance.com/en/my/settings/profile/reset-kyc方法2: 如果方法1对你不适用、可找客服帮你重置你的基础kyc;理由是申请币安卡用;借记卡还是信用卡?借记卡(Visa通道支付/不支持银联Pos机刷卡)使用范围可绑定 支付宝 线上消费或者线下实体商户消费 可绑定 Google Pay Amazon 线上消费 支持全部海外线上服务订阅:Netflix订阅、ChatGPT订阅、Quizlet订阅、Spotify订阅等 实体卡可在任意支...

Table - number of mobile phones and personal computers
The table below shows the number of mobile phones and personal computers per thousand people in six different countries in 2003. Summarise the information by selecting and reporting the main features, and make comparisons where relevant.The table gives information about the number of handsets and personal computers every 1000 people had in six countries in 2003. It is noticeable that the majority of Icelandic citizens had mobile phones, and most San Marino citizens had personal computers. As ...

Monad 高阶领水教程 (四)
背景信息Monad测试网目前水龙头几乎不可用、项目方没有加验证码和钱包余额验证、导致科学家们集体脚本并发领取、目前水龙头基本瘫痪; 如下是曲线救国的领水方案:Get fucet eth sepolia somewhere(faucet.quicknode.com)Bridge eth from sepolia to monad testnet via (testnet.orbiter.finance)Swap eth in monad testnet to mon via (monad.ambient.finance)整个过程分为3个步骤: 第一个步骤:空白账户领取ETH的sepolia测试网ETH代币(很多方式 可自行百度) 第二个步骤:桥接sepolia测试网的eth转账到Monad的测试网 第三个步骤:在Monad测试网用eth交易Mon、直接购买到Mon测试代币即可。领取测试ETHhttps://cloud.google.com/application/web3/faucet/ethereum/sepolia桥接ETH代币到Monadhttps://testnet.orb...
Workout | English | Tec | Crypto

Subscribe to Robin

Subscribe to Robin
Share Dialog
Share Dialog


<100 subscribers
<100 subscribers
package main
import (
"flag"
"fmt"
"log"
"os"
"os/signal"
"strconv"
"strings"
"sync"
"syscall"
"github.com/Shopify/sarama"
"github.com/Shopify/sarama/tools/tls"
)
// 从命令行终端获取参数
var (
brokerList = flag.String("brokers", os.Getenv("KAFKA_PEERS"), "The comma separated list of brokers in the Kafka cluster")
topic = flag.String("topic", "", "REQUIRED: the topic to consume")
partitions = flag.String("partitions", "all", "The partitions to consume, can be 'all' or comma-separated numbers")
offset = flag.String("offset", "newest", "The offset to start with. Can be `oldest`, `newest`")
verbose = flag.Bool("verbose", false, "Whether to turn on sarama logging")
tlsEnabled = flag.Bool("tls-enabled", false, "Whether or not to use TLS when connecting to the broker (defaults to false)")
tlsSkipVerify = flag.Bool("tls-skip-verify", false, "Whether skip TLS server cert verification")
tlsClientCert = flag.String("tls-client-cert", "", "Client cert for client authentication (use with -tls-enabled and -tls-client-key)")
tlsClientKey = flag.String("tls-client-key", "", "Client key for client authentication (use with tls-enabled and -tls-client-cert)")
saslEnabled = flag.Bool("sasl-enabled", false, "Whether or not to use SASL authentication when connecting to the broker (defaults to false)")
saslUser = flag.String("sasl-user", "", "The username used for SASL (use with -sasl-enable)")
saslPassword = flag.String("sasl-password", "", "The password used for SASL (use with -sasl-enable)")
bufferSize = flag.Int("buffer-size", 256, "The buffer size of the message channel.")
logger = log.New(os.Stderr, "", log.LstdFlags)
)
func main() {
flag.Parse()
if *brokerList == "" {
printUsageErrorAndExit("You have to provide -brokers as a comma-separated list, or set the KAFKA_PEERS environment variable.")
}
if *topic == "" {
printUsageErrorAndExit("-topic is required")
}
if *verbose {
sarama.Logger = logger
}
// 初始化读取位置;
var initialOffset int64
switch *offset {
case "oldest":
initialOffset = sarama.OffsetOldest
case "newest":
initialOffset = sarama.OffsetNewest
default:
printUsageErrorAndExit("-offset should be `oldest` or `newest`")
}
// 初始化kafka配置参数
config := sarama.NewConfig()
// 配置kafka版本
config.Version = sarama.V0_10_1_0
// 配置TLS相关
if *tlsEnabled {
tlsConfig, err := tls.NewConfig(*tlsClientCert, *tlsClientKey)
if err != nil {
printErrorAndExit(69, "Failed to create TLS config: %s", err)
}
config.Net.TLS.Enable = true
config.Net.TLS.Config = tlsConfig
config.Net.TLS.Config.InsecureSkipVerify = *tlsSkipVerify
}
// 配置用户名密码认证
if *saslEnabled {
config.Net.SASL.Enable = true
config.Net.SASL.User = *saslUser
config.Net.SASL.Password = *saslPassword
}
// 实例化consumer
c, err := sarama.NewConsumer(strings.Split(*brokerList, ","), config)
if err != nil {
printErrorAndExit(69, "Failed to start consumer: %s", err)
}
// 获取partition
partitionList, err := getPartitions(c)
if err != nil {
printErrorAndExit(69, "Failed to get the list of partitions: %s", err)
}
// 定义channel
var (
messages = make(chan *sarama.ConsumerMessage, *bufferSize)
closing = make(chan struct{})
wg sync.WaitGroup
)
// goroutin 等待系统中断信号
go func() {
signals := make(chan os.Signal, 1)
signal.Notify(signals, syscall.SIGTERM, os.Interrupt)
<-signals
logger.Println("Initiating shutdown of consumer...")
close(closing)
}()
// 根据partitionlist启动多个goroutin去消费
for _, partition := range partitionList {
pc, err := c.ConsumePartition(*topic, partition, initialOffset)
if err != nil {
printErrorAndExit(69, "Failed to start consumer for partition %d: %s", partition, err)
}
go func(pc sarama.PartitionConsumer) {
<-closing
pc.AsyncClose()
}(pc)
wg.Add(1)
go func(pc sarama.PartitionConsumer) {
defer wg.Done()
for message := range pc.Messages() {
messages <- message
}
}(pc)
}
go func() {
for msg := range messages {
fmt.Printf("Partition:\t%d\n", msg.Partition)
fmt.Printf("Offset:\t%d\n", msg.Offset)
fmt.Printf("Key:\t%s\n", string(msg.Key))
fmt.Printf("Value:\t%s\n", string(msg.Value))
fmt.Println()
}
}()
wg.Wait()
logger.Println("Done consuming topic", *topic)
close(messages)
if err := c.Close(); err != nil {
logger.Println("Failed to close consumer: ", err)
}
}
func getPartitions(c sarama.Consumer) ([]int32, error) {
if *partitions == "all" {
return c.Partitions(*topic)
}
tmp := strings.Split(*partitions, ",")
var pList []int32
for i := range tmp {
val, err := strconv.ParseInt(tmp[i], 10, 32)
if err != nil {
return nil, err
}
pList = append(pList, int32(val))
}
return pList, nil
}
func printErrorAndExit(code int, format string, values ...interface{}) {
fmt.Fprintf(os.Stderr, "ERROR: %s\n", fmt.Sprintf(format, values...))
fmt.Fprintln(os.Stderr)
os.Exit(code)
}
func printUsageErrorAndExit(format string, values ...interface{}) {
fmt.Fprintf(os.Stderr, "ERROR: %s\n", fmt.Sprintf(format, values...))
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, "Available command line options:")
flag.PrintDefaults()
os.Exit(64)
}
package main
import (
"flag"
"fmt"
"log"
"os"
"os/signal"
"strconv"
"strings"
"sync"
"syscall"
"github.com/Shopify/sarama"
"github.com/Shopify/sarama/tools/tls"
)
// 从命令行终端获取参数
var (
brokerList = flag.String("brokers", os.Getenv("KAFKA_PEERS"), "The comma separated list of brokers in the Kafka cluster")
topic = flag.String("topic", "", "REQUIRED: the topic to consume")
partitions = flag.String("partitions", "all", "The partitions to consume, can be 'all' or comma-separated numbers")
offset = flag.String("offset", "newest", "The offset to start with. Can be `oldest`, `newest`")
verbose = flag.Bool("verbose", false, "Whether to turn on sarama logging")
tlsEnabled = flag.Bool("tls-enabled", false, "Whether or not to use TLS when connecting to the broker (defaults to false)")
tlsSkipVerify = flag.Bool("tls-skip-verify", false, "Whether skip TLS server cert verification")
tlsClientCert = flag.String("tls-client-cert", "", "Client cert for client authentication (use with -tls-enabled and -tls-client-key)")
tlsClientKey = flag.String("tls-client-key", "", "Client key for client authentication (use with tls-enabled and -tls-client-cert)")
saslEnabled = flag.Bool("sasl-enabled", false, "Whether or not to use SASL authentication when connecting to the broker (defaults to false)")
saslUser = flag.String("sasl-user", "", "The username used for SASL (use with -sasl-enable)")
saslPassword = flag.String("sasl-password", "", "The password used for SASL (use with -sasl-enable)")
bufferSize = flag.Int("buffer-size", 256, "The buffer size of the message channel.")
logger = log.New(os.Stderr, "", log.LstdFlags)
)
func main() {
flag.Parse()
if *brokerList == "" {
printUsageErrorAndExit("You have to provide -brokers as a comma-separated list, or set the KAFKA_PEERS environment variable.")
}
if *topic == "" {
printUsageErrorAndExit("-topic is required")
}
if *verbose {
sarama.Logger = logger
}
// 初始化读取位置;
var initialOffset int64
switch *offset {
case "oldest":
initialOffset = sarama.OffsetOldest
case "newest":
initialOffset = sarama.OffsetNewest
default:
printUsageErrorAndExit("-offset should be `oldest` or `newest`")
}
// 初始化kafka配置参数
config := sarama.NewConfig()
// 配置kafka版本
config.Version = sarama.V0_10_1_0
// 配置TLS相关
if *tlsEnabled {
tlsConfig, err := tls.NewConfig(*tlsClientCert, *tlsClientKey)
if err != nil {
printErrorAndExit(69, "Failed to create TLS config: %s", err)
}
config.Net.TLS.Enable = true
config.Net.TLS.Config = tlsConfig
config.Net.TLS.Config.InsecureSkipVerify = *tlsSkipVerify
}
// 配置用户名密码认证
if *saslEnabled {
config.Net.SASL.Enable = true
config.Net.SASL.User = *saslUser
config.Net.SASL.Password = *saslPassword
}
// 实例化consumer
c, err := sarama.NewConsumer(strings.Split(*brokerList, ","), config)
if err != nil {
printErrorAndExit(69, "Failed to start consumer: %s", err)
}
// 获取partition
partitionList, err := getPartitions(c)
if err != nil {
printErrorAndExit(69, "Failed to get the list of partitions: %s", err)
}
// 定义channel
var (
messages = make(chan *sarama.ConsumerMessage, *bufferSize)
closing = make(chan struct{})
wg sync.WaitGroup
)
// goroutin 等待系统中断信号
go func() {
signals := make(chan os.Signal, 1)
signal.Notify(signals, syscall.SIGTERM, os.Interrupt)
<-signals
logger.Println("Initiating shutdown of consumer...")
close(closing)
}()
// 根据partitionlist启动多个goroutin去消费
for _, partition := range partitionList {
pc, err := c.ConsumePartition(*topic, partition, initialOffset)
if err != nil {
printErrorAndExit(69, "Failed to start consumer for partition %d: %s", partition, err)
}
go func(pc sarama.PartitionConsumer) {
<-closing
pc.AsyncClose()
}(pc)
wg.Add(1)
go func(pc sarama.PartitionConsumer) {
defer wg.Done()
for message := range pc.Messages() {
messages <- message
}
}(pc)
}
go func() {
for msg := range messages {
fmt.Printf("Partition:\t%d\n", msg.Partition)
fmt.Printf("Offset:\t%d\n", msg.Offset)
fmt.Printf("Key:\t%s\n", string(msg.Key))
fmt.Printf("Value:\t%s\n", string(msg.Value))
fmt.Println()
}
}()
wg.Wait()
logger.Println("Done consuming topic", *topic)
close(messages)
if err := c.Close(); err != nil {
logger.Println("Failed to close consumer: ", err)
}
}
func getPartitions(c sarama.Consumer) ([]int32, error) {
if *partitions == "all" {
return c.Partitions(*topic)
}
tmp := strings.Split(*partitions, ",")
var pList []int32
for i := range tmp {
val, err := strconv.ParseInt(tmp[i], 10, 32)
if err != nil {
return nil, err
}
pList = append(pList, int32(val))
}
return pList, nil
}
func printErrorAndExit(code int, format string, values ...interface{}) {
fmt.Fprintf(os.Stderr, "ERROR: %s\n", fmt.Sprintf(format, values...))
fmt.Fprintln(os.Stderr)
os.Exit(code)
}
func printUsageErrorAndExit(format string, values ...interface{}) {
fmt.Fprintf(os.Stderr, "ERROR: %s\n", fmt.Sprintf(format, values...))
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, "Available command line options:")
flag.PrintDefaults()
os.Exit(64)
}
No activity yet