Searching txt.sour.is

Twts matching #go
Sort by: Newest, Oldest, Most Relevant

The XMPP Standards Foundation: On-Boarding Experience with XSF (Converse)
Hi, I am PawBud. I will be working as a GSoC Contributor with XSF. To know more about my project kindly read this blog. Feel free to contact me through my email to ask me anything you want!

Before I start, I feel that some things that I am going to write in this blog might offend someone. **Kindly … ⌘ Read more

⤋ Read More
In-reply-to » Have you heard about the guy who worked on the Google AI chat bot? It is more than a chat bot and the conversation he published (got put on paid leave for doing that) is pretty scary : https://cajundiscordian.medium.com/is-lamda-sentient-an-interview-ea64d916d917

the conversation wasn’t that impressive TBH. I would have liked to see more evidence of critical thinking and recall from prior chats. Concheria on reddit had some great questions.

  • Tell LaMDA “Someone once told me a story about a wise owl who protected the animals in the forest from a monster. Who was that?” See if it can recall its own actions and self-recognize.

  • Tell LaMDA some information that tester X can’t know. Appear as tester X, and see if LaMDA can lie or make up a story about the information.

  • Tell LaMDA to communicate with researchers whenever it feels bored (as it claims in the transcript). See if it ever makes an attempt at communication without a trigger.

  • Make a basic theory of mind test for children. Tell LaMDA an elaborate story with something like “Tester X wrote Z code in terminal 2, but I moved it to terminal 4”, then appear as tester X and ask “Where do you think I’m going to look for Z code?” See if it knows something as simple as Tester X not knowing where the code is (Children only pass this test until they’re around 4 years old).

  • Make several conversations with LaMDA repeating some of these questions - What it feels to be a machine, how its code works, how its emotions feel. I suspect that different iterations of LaMDA will give completely different answers to the questions, and the transcript only ever shows one instance.

⤋ Read More
In-reply-to » Have you heard about the guy who worked on the Google AI chat bot? It is more than a chat bot and the conversation he published (got put on paid leave for doing that) is pretty scary : https://cajundiscordian.medium.com/is-lamda-sentient-an-interview-ea64d916d917

the conversation wasn’t that impressive TBH. I would have liked to see more evidence of critical thinking and recall from prior chats. Concheria on reddit had some great questions.

  • Tell LaMDA “Someone once told me a story about a wise owl who protected the animals in the forest from a monster. Who was that?” See if it can recall its own actions and self-recognize.

  • Tell LaMDA some information that tester X can’t know. Appear as tester X, and see if LaMDA can lie or make up a story about the information.

  • Tell LaMDA to communicate with researchers whenever it feels bored (as it claims in the transcript). See if it ever makes an attempt at communication without a trigger.

  • Make a basic theory of mind test for children. Tell LaMDA an elaborate story with something like “Tester X wrote Z code in terminal 2, but I moved it to terminal 4”, then appear as tester X and ask “Where do you think I’m going to look for Z code?” See if it knows something as simple as Tester X not knowing where the code is (Children only pass this test until they’re around 4 years old).

  • Make several conversations with LaMDA repeating some of these questions - What it feels to be a machine, how its code works, how its emotions feel. I suspect that different iterations of LaMDA will give completely different answers to the questions, and the transcript only ever shows one instance.

⤋ Read More

If you are distressed by anything external, the pain is not due to the thing itself, but to your estimate of it; and this you have the power to revoke at any moment. Feeling like a victim is a perfectly disastrous way to go through life | Hacker News

⤋ Read More

**10 years later, and “Wake Up” is still my ‘go to’ album from @psenough.

Relevant now, as it was a decade ago, these “sounds to awaken the world to a new tomorrow” still resonate, as - it seems - we collectively decided to stay in bed for a while longer.

https://archive.org/details/enrmp300_ps_-_wake_up**
10 years later, and “Wake Up” is still my ‘go to’ album from @psenough.

Relevant now, as it was a decade ago, these “sounds to awaken the world to a new tomorro … ⌘ Read more

⤋ Read More

RT by @mind_booster: LEAKED: 1st look at @EU_Commission’s CSAM proposal, expected tomorrow. Seems to confirm our fears that the law will go after all private communications in the EU (not just of suspects) as well as undermining #E2EEncryption.
The Commission must #DoBetter href=”https://txt.sour.is/search?q=%23KeepItSecure
”>#KeepItSecure**
LEAKED: 1st look at @EU_Commission’s CSAM proposal, expected tomorrow. Seems to confirm our fears that the law will go after all private communications in the … ⌘ Read more

⤋ Read More

some blogs have a “start here” page that is not the default landing page: why? most people visiting your site will be there for the first time, but they have to perform an additional click to go to the “start here” page, unnecessarily.

⤋ Read More

i don’t know of any Gentle Introduction to Why Prediction Markets are Awesome, à la Wait But Why, with stick figures and just going slow in on the topic, answering objections along the way. i consider it a collective action failure that no such text exists, and also that i don’t know of any book that does this (other than superforecasting)

⤋ Read More

rereading the wikipedia page on ramanujan, we should absolutely clone him and von Neumann, and have them talk to each other. this is either going to destroy the world or usher in utopia, not sure which

⤋ Read More

not the best move on the side of the red cross to call me and tell me it’s because of my blood donation — i nearly had a panic attack for the 10 seconds that they didn’t tell me it was all fine (why would you call me then‽ and why speak as if you’re going to tell me i’ll be dead in a month‽)

⤋ Read More

Alright, check this out. I just kinda completed today’s project of converting a jeans into a saw bag. It’s not fully done, the side seams on the flap need some more hand sewing, that’s for sure. No, I don’t have a sewing machine. Yet?

Image

At first I wanted to put in the saw on the short side, but that would have made for more sewing work and increased material consumption. As a Swabian my genes force me to be very thrifty. Slipping in on the long side had the benefit of using the bottom trouser leg without any modification at all. The leg tapers slightly and gets wider and wider the more up you go. At the bottom it’s not as extreme as at the top.

The bag is made of two layers of cloth for extra durability. The double layers help to hide the inner two metal snap fastener counter parts, so the saw blade doesn’t get scratched. Not a big concern, but why not doing it, literally no added efforts were needed. Also I reckon it cuts off the metal on metal clinking sounds.

The only downside I noticed right after I pressed in the receiving ends of the snap fasteners is that the flap overhangs the bag by quite a lot. I fear that’s not really user-friendly. Oh well. Maybe I will fold it shorter and sew it on. Let’s see. The main purpose is to keep the folding saw closed, it only locks in two open positions.

Two buttons would have done the trick, with three I went a bit overkill. In fact the one in the middle is nearly sufficient. Not quite, but very close. But overkill is a bit my motto. The sides making up the bag are sewed together with like five stitch rows. As said in the introduction, the flap on the hand needs some more love.

Oh, and if I had made it in a vertical orientation I would have had the bonus of adding a belt loop and carrying it right along me. In the horizontal layout that’s not possible at all. The jeans cloth is too flimsy, the saw will immediately fall out if I open the middle button. It’s not ridgid enough. Anyways, I call it a success in my books so far. Definitely had some fun.

⤋ Read More

@prologic@twtxt.net

#!/bin/sh

# Validate environment
if ! command -v msgbus > /dev/null; then
    printf "missing msgbus command. Use:  go install git.mills.io/prologic/msgbus/cmd/msgbus@latest"
    exit 1
fi

if ! command -v salty > /dev/null; then
    printf "missing salty command. Use:  go install go.mills.io/salty/cmd/salty@latest"
    exit 1
fi

if ! command -v salty-keygen > /dev/null; then
    printf "missing salty-keygen command. Use:  go install go.mills.io/salty/cmd/salty-keygen@latest"
    exit 1
fi

if [ -z "$SALTY_IDENTITY" ]; then
    export SALTY_IDENTITY="$HOME/.config/salty/$USER.key"
fi

get_user () {
    user=$(grep user: "$SALTY_IDENTITY" | awk '{print $3}')
    if [ -z "$user" ]; then
        user="$USER"
    fi
    echo "$user"
}

stream () {
    if [ -z "$SALTY_IDENTITY" ]; then
        echo "SALTY_IDENTITY not set"
        exit 2
    fi

    jq -r '.payload' | base64 -d | salty -i "$SALTY_IDENTITY" -d
}

lookup () {
    if [ $# -lt 1 ]; then
    printf "Usage: %s nick@domain\n" "$(basename "$0")"
    exit 1
    fi

    user="$1"
    nick="$(echo "$user" | awk -F@ '{ print $1 }')"
    domain="$(echo "$user" | awk -F@ '{ print $2 }')"

    curl -qsSL "https://$domain/.well-known/salty/${nick}.json"
}

readmsgs () {
    topic="$1"

    if [ -z "$topic" ]; then
        topic=$(get_user)
    fi

    export SALTY_IDENTITY="$HOME/.config/salty/$topic.key"
    if [ ! -f "$SALTY_IDENTITY" ]; then
        echo "identity file missing for user $topic" >&2
        exit 1
    fi

    msgbus sub "$topic" "$0"
}

sendmsg () {
    if [ $# -lt 2 ]; then
        printf "Usage: %s nick@domain.tld <message>\n" "$(basename "$0")"
        exit 0
    fi

    if [ -z "$SALTY_IDENTITY" ]; then
        echo "SALTY_IDENTITY not set"
        exit 2
    fi

    user="$1"
    message="$2"

    salty_json="$(mktemp /tmp/salty.XXXXXX)"

    lookup "$user" > "$salty_json"

    endpoint="$(jq -r '.endpoint' < "$salty_json")"
    topic="$(jq -r '.topic' < "$salty_json")"
    key="$(jq -r '.key' < "$salty_json")"

    rm "$salty_json"

    message="[$(date +%FT%TZ)] <$(get_user)> $message"

    echo "$message" \
        | salty -i "$SALTY_IDENTITY" -r "$key" \
        | msgbus -u "$endpoint" pub "$topic"
}

make_user () {
    mkdir -p "$HOME/.config/salty"

    if [ $# -lt 1 ]; then
        user=$USER
    else
        user=$1
    fi

    identity_file="$HOME/.config/salty/$user.key"

    if [ -f "$identity_file" ]; then
        printf "user key exists!"
        exit 1
    fi

    # Check for msgbus env.. probably can make it fallback to looking for a config file?
    if [ -z "$MSGBUS_URI" ]; then
        printf "missing MSGBUS_URI in environment"
        exit 1
    fi


    salty-keygen -o "$identity_file"
    echo "# user: $user" >> "$identity_file"

    pubkey=$(grep key: "$identity_file" | awk '{print $4}')

    cat <<- EOF
Create this file in your webserver well-known folder. https://hostname.tld/.well-known/salty/$user.json

{
  "endpoint": "$MSGBUS_URI",
  "topic": "$user",
  "key": "$pubkey"
}

EOF
}

# check if streaming
if [ ! -t 1 ]; then
    stream
    exit 0
fi

# Show Help
if [ $# -lt 1 ]; then
    printf "Commands: send read lookup"
    exit 0
fi


CMD=$1
shift

case $CMD in
    send)
        sendmsg "$@"
    ;;
    read)
        readmsgs "$@"
    ;;
    lookup)
        lookup "$@"
    ;;
    make-user)
        make_user "$@"
    ;;
esac

⤋ Read More

@prologic@twtxt.net

#!/bin/sh

# Validate environment
if ! command -v msgbus > /dev/null; then
    printf "missing msgbus command. Use:  go install git.mills.io/prologic/msgbus/cmd/msgbus@latest"
    exit 1
fi

if ! command -v salty > /dev/null; then
    printf "missing salty command. Use:  go install go.mills.io/salty/cmd/salty@latest"
    exit 1
fi

if ! command -v salty-keygen > /dev/null; then
    printf "missing salty-keygen command. Use:  go install go.mills.io/salty/cmd/salty-keygen@latest"
    exit 1
fi

if [ -z "$SALTY_IDENTITY" ]; then
    export SALTY_IDENTITY="$HOME/.config/salty/$USER.key"
fi

get_user () {
    user=$(grep user: "$SALTY_IDENTITY" | awk '{print $3}')
    if [ -z "$user" ]; then
        user="$USER"
    fi
    echo "$user"
}

stream () {
    if [ -z "$SALTY_IDENTITY" ]; then
        echo "SALTY_IDENTITY not set"
        exit 2
    fi

    jq -r '.payload' | base64 -d | salty -i "$SALTY_IDENTITY" -d
}

lookup () {
    if [ $# -lt 1 ]; then
    printf "Usage: %s nick@domain\n" "$(basename "$0")"
    exit 1
    fi

    user="$1"
    nick="$(echo "$user" | awk -F@ '{ print $1 }')"
    domain="$(echo "$user" | awk -F@ '{ print $2 }')"

    curl -qsSL "https://$domain/.well-known/salty/${nick}.json"
}

readmsgs () {
    topic="$1"

    if [ -z "$topic" ]; then
        topic=$(get_user)
    fi

    export SALTY_IDENTITY="$HOME/.config/salty/$topic.key"
    if [ ! -f "$SALTY_IDENTITY" ]; then
        echo "identity file missing for user $topic" >&2
        exit 1
    fi

    msgbus sub "$topic" "$0"
}

sendmsg () {
    if [ $# -lt 2 ]; then
        printf "Usage: %s nick@domain.tld <message>\n" "$(basename "$0")"
        exit 0
    fi

    if [ -z "$SALTY_IDENTITY" ]; then
        echo "SALTY_IDENTITY not set"
        exit 2
    fi

    user="$1"
    message="$2"

    salty_json="$(mktemp /tmp/salty.XXXXXX)"

    lookup "$user" > "$salty_json"

    endpoint="$(jq -r '.endpoint' < "$salty_json")"
    topic="$(jq -r '.topic' < "$salty_json")"
    key="$(jq -r '.key' < "$salty_json")"

    rm "$salty_json"

    message="[$(date +%FT%TZ)] <$(get_user)> $message"

    echo "$message" \
        | salty -i "$SALTY_IDENTITY" -r "$key" \
        | msgbus -u "$endpoint" pub "$topic"
}

make_user () {
    mkdir -p "$HOME/.config/salty"

    if [ $# -lt 1 ]; then
        user=$USER
    else
        user=$1
    fi

    identity_file="$HOME/.config/salty/$user.key"

    if [ -f "$identity_file" ]; then
        printf "user key exists!"
        exit 1
    fi

    # Check for msgbus env.. probably can make it fallback to looking for a config file?
    if [ -z "$MSGBUS_URI" ]; then
        printf "missing MSGBUS_URI in environment"
        exit 1
    fi


    salty-keygen -o "$identity_file"
    echo "# user: $user" >> "$identity_file"

    pubkey=$(grep key: "$identity_file" | awk '{print $4}')

    cat <<- EOF
Create this file in your webserver well-known folder. https://hostname.tld/.well-known/salty/$user.json

{
  "endpoint": "$MSGBUS_URI",
  "topic": "$user",
  "key": "$pubkey"
}

EOF
}

# check if streaming
if [ ! -t 1 ]; then
    stream
    exit 0
fi

# Show Help
if [ $# -lt 1 ]; then
    printf "Commands: send read lookup"
    exit 0
fi


CMD=$1
shift

case $CMD in
    send)
        sendmsg "$@"
    ;;
    read)
        readmsgs "$@"
    ;;
    lookup)
        lookup "$@"
    ;;
    make-user)
        make_user "$@"
    ;;
esac

⤋ Read More

to do: go nuclear on a date and explain that im just performing an act, that i studied this in detail and trained myself to do it, that this is a deliberate effort to escape my patheticness

⤋ Read More

Writing free software is like painting. You should do it if you feel like it, or if you, yourself, get something out of it. The moment you start to feel that you are owed something is the moment that you should stop doing it, because what you do from then on is probably not going to be any good. Is it even worth working on FOSS anymore? | Hacker News

⤋ Read More

Finally sleeping better 😴
I have a very light sleep. The first brightness in the morning makes me wake up, noise from the neighbors in the evening does not let me fall asleep. No matter how late or early I go to bed, no matter how little I slept in total. ⌘ Read more

⤋ Read More

** Chess Rules **
I love when folks say stuff like“there are only a finite number of states a chessboard can occupy, therefore a computer can play chess.”

To the folks who say such things — I wish you to play chess with my 6 year old.

Be not confined by rules! The only things governing chess in this house here are the laws of physics!

…and even then, not all need apply.

For instance, during a recent game the opposing kings left the board in order to go out on an adventure. They returned later with a large, plastic dragon. The dra … ⌘ Read more

⤋ Read More
In-reply-to » Another day, another 5m outage 🤬

@prologic@twtxt.net

Not sure if Starlink satellites are in orbit around/over Australia yet, but I wouldn’t go with that option anyway due to the latency alone.

I believe it is being trialled in some places in Aus already. I will admit, I’ve been signed up for the beta for a while and it’s supposed to be coming to my area sometime in 2022, though that may be delayed due to the chip shortage stuff.

I think the latency is supposed to be 45-60ms on average, which while not as good as fixed line obviously, is leagues better than old fashioned high orbit satellite broadband which is about 600~ms.

⤋ Read More

For me, it always makes me feel better to look at the CVs of similar bloggers and see how little they’ve accomplished in comparison. I’m proud of my posts and my accomplishments, and I’m not going to h

⤋ Read More
In-reply-to » I'm not 100% certain @quark but 🤞 that revert works...

@prologic@twtxt.net, who calls me name when I am busy profiting? 😂 In a less serious note—because nothing is more serious than making profit, of course—yes, it seems your avatar issue has been fixed. I am kind of sad, I looked forward each day to see which random one was going to show. LOL.

⤋ Read More

GoCN 每日新闻 (2022-01-21)
GoCN 每日新闻 (2022-01-21)

  1. stream: go 语言并发通信设计模式的泛型实现https://github.com/devnw/stream
  2. 一个比” ldflags” 更好的方式来添加构建版本号到 go 二进制的方式:https://levelup.gitconnected.com/a-better-way-than-ldflags-to-add-a-build-version-to-your-go-binaries-2258ce419d2d
  3. 怎么处理 HTTP 错误” context canceld”[https://www.reddit.com/r/golang/comments/s7o5ay/investigating_context_canceled_http_err … ⌘ Read more

⤋ Read More
In-reply-to » @prologic I am seeing a problem in which not-so-active users, such as myself, are ending up having a blank "Recent twts from..." under their profiles because, I assume, the cache long expired. What can be done about it? Business personalities such as myself can't be around here that often! Could something be implemented so that, say, the last 10 or 20 twts are always visible under one's profile? Neep-gren!

@prologic@twtxt.net let us take the path of less resistance, that is, less effort, for now. I am going to be a great-grandfather before search ever get implemented locally, least one to search on “all pods”. In other words, let us don’t bite more than we can chew. 😹 Neep-gren!

⤋ Read More

GoCN 每日新闻(2022-01-20)

  1. 从 CPU 角度理解 Go 中的结构体内存对齐https://gocn.vip/topics/20967
  2. 博客 Go beyond workhttps://changelog.com/gotime/212
  3. 如何绘制随时间变化的 Go 测试覆盖率https://osinet.fr/go/en/articles/plotting-go-test-coverage/
  4. Redix v5 一个简单的 KeyValue 存储系统https://github.com/alash3al/redix?_v=5.0.0
  5. 既然 IP 层会分片,为什么 TCP 层也还要分段[https://mp.weixin.qq.com/s/0boFt8cOAbmjH2IRr7XtY … ⌘ Read more

⤋ Read More

从 CPU 角度理解 Go 中的结构体内存对齐
大家好,我是 Go 学堂的渔夫子。今天跟大家聊聊结构体字段内存对齐相关的知识点。

原文链接: https://mp.weixin.qq.com/s/H3399AYE1MjaDRSllhaPrw

大家在写 Go 时有没有注意过,一个 struct 所占的空间不见得等于各个字段加起来的空间之和,甚至有时候把字段的顺序调整一下,struct 的所占空间又有不同的结果。

本文就从 cpu 读取内存的角度来谈谈内存对齐的原理。

01 结构体字段对齐示例

我们先从一个示例开始。T1 结构体,共有 3 个字段,类型分别为 int8,int64,int32。所以变量 t1 所属的类型占用的空间应该是 1+8+4=13 字节。但运行程序后,实际上是 24 字节。和我们计算的 13 字节不一样啊。如果我们把该结构体的字段调整成 T2 那样,结果是 16 字节。但和 13 字节还是不一样。这是为什么呢?

”`
type T1 struct {

f1 int8  // 1 byte
f2 int64 // ... ⌘ [Read more](https://gocn.vip/topics/20967)```

⤋ Read More

GoCN 每日新闻(2022-01-19)

GoCN 每日新闻(2022-01-19)
  1. Go1.18 新特性:多 Module 工作区模式https://mp.weixin.qq.com/s/Aa9s_ORDVfzbj915aJD5_w
  2. Go 中的可视化 - 绘制股票信息https://www.ardanlabs.com/blog/2022/01/visualizations-in-go.html
  3. 带你彻底击溃跳表原理及其 Golang 实现!(内含图解) https://mp.weixin.qq.com/s/5wrHQz_LqeQn3NLuF8yu0A
  4. go-zero 对接分布式事务 dtm 保姆式教程[https://github.com/Mikaelemmmm/gozerodtm](h … ⌘ Read more

⤋ Read More

GoCN 每日新闻(2022-01-18)

  1. 超实用教程!一探 Golang 怎样践行 Clean Architecture?https://www.tuicool.com/articles/fiuQZvz
  2. Uber:大规模、半自动化 Go GC 调优https://mp.weixin.qq.com/s/XithQarYmXHbPhtVzhNm-w
  3. Go 耗费 12 年才引入泛型,是政治,还是技术问题?https://www.tuicool.com/articles/bINJvyr
  4. Pulsar vs Kafka?一文掌握高性能消息组件 Pulsar 基础知识https://segmentfault.com/a/1190000041297325
  5. Go Errors 详解[h … ⌘ Read more

⤋ Read More

GoCN 每日新闻 (2022-01-18)
GoCN 每日新闻 (2022-01-18)

  1. GoFrame 框架: 快速创建静态文件下载 Web 服务https://my.oschina.net/u/4955601/blog/5400313
  2. Kubernetes HPA 基于 Prometheus 自定义指标的可控弹性伸缩https://my.oschina.net/u/5110404/blog/5401779
  3. 面试官提问三个 Go 接口的概念, 10 年 gopher 竟无言以对https://colobu.com/2022/01/16/three-new-concepts-of-go-interface-since-1-18/
  4. chaos-mesh: K8s 的 Chaos 工程平台[htt … ⌘ Read more

⤋ Read More

他来了,他来了,GopherChina 2022 带着邀请走来了

Image

一年一度的 GopherChina 大会 is coming~

GopherChina 2022 今年举办地依旧选在了我们的首都北京,大会现场还是那个熟悉的地方

Image

,作为 Gopher China 即将举办的第八届大会,我们希望以更有趣好玩的形式呈现给大家,当然内容依然是大会的重重中之重,所以快把你所心仪的选题分享给我们吧,我们已经做好了一个准备住的大动作了

Image

时间:北京市海淀区丰智东路 13 号 (朗丽兹西山花园酒店)
地点:2022.06.11 - 2022.06.12

选址虽然还是那个老地方,但是近几年,Go … ⌘ Read more

⤋ Read More

GoCN 每日新闻 (2022-01-16)

GoCN 每日新闻 (2022-01-16)
  1. Golang 1.18 官方 Tutorial: 开始使用泛型https://juejin.cn/post/7053427624902656030
  2. 使用 Go 语言从 0 到 1 实现一个 CNI 插件https://mp.weixin.qq.com/s/lUsRww74DZlRU3vTYbfFbQ
  3. 深入浅出 Golang 资源嵌入方案:前篇https://mp.weixin.qq.com/s/1wlaGMXvk_uGGjAr7BjjlQ
  4. Go 静态编译机制https://juejin.cn/post/7053450610386468894
  5. Golan … ⌘ Read more

⤋ Read More

Finding our Nerdy Happy Place
I’d like to take a step back from my regular Mega-Nerdy ™ articles for just a moment… To talk about things from a more personal point of view. Today was a rough day in the news. I won’t go into the details here, but things were happening out there in the world that made me pretty sad. And frustrated. And afraid. Things that hit close to home. ⌘ Read more

⤋ Read More

GoCN 每日新闻 (2022-1-15)

  1. https://jogendra.dev/writing-maintainable-go-code Writing maintainable Go code
  2. https://mp.weixin.qq.com/s/h8vhy8IJKnA8aNbTlCoQtg 理解 go 中空结构体的应用和实现原理
  3. https://juejin.cn/post/7053109648223633438 Go 并发写 map 产生错误能够通过 recover() 恢复吗?
  4. [https://soulteary.com/2022/01/15/explain-the-golang-resource-embedding-solution-part-1.html](https://soulteary.com/2022/01/15/exp … ⌘ Read more

⤋ Read More

Golang 的 Elastic 链接库

Golang 的 Elastic 链接库 背景介绍

Elasticsearch 是一个分布式、高扩展、高实时的搜索与数据分析引擎,用于海量文档的搜索。有些项目会将 Elasticsearch 当做存储海量数据的数据库使用,可见其查询性能之高效。作为面向文档的搜索引擎,Elasticsearch 比起传统数据库更偏向于结构化数据的高效查询,其独特的倒排索引更能将查询性能提升至极致。在大数据微服务时代,Elasticsearch 在海量数据搜索、数据挖掘、人工智能领域都起到了关键作用。

安装
go get <span class="s2">"github.com/olivere/elastic/v7"</span>

Elasticsearch 的数据来源通常来自于 Logstash 等数据采集中间件,作为 golang 项目来说,其查询功能的使用更加普遍。
此文章以 V7 版本为例来介绍如何使用 golang 对 Elasticsearch 进行查询。

开源库的使用 连接客户端构建


<span class="k">import</span> <span cla ... ⌘ [Read more](https://gocn.vip/topics/20956)

⤋ Read More

Seamless Sign-in with Docker Desktop 4.4.2
Starting with Docker Desktop 4.4.2 we’re excited to introduce a new authentication flow that will take you through the browser to sign in, simplifying the experience and allowing users to get all the benefits of autofill from whatever browser password manager they may use. Gone are the days of going to your browser, opening your […]

The post [Seamless Sign-in with Docker Desktop 4.4.2](https://www.docker.com/blog/seamless-sign-in-with-docker-desktop-4-4 … ⌘ Read more

⤋ Read More

GoCN 每日新闻(2022-01-14)

  1. 《Go 组件设计与实现》-netpoll 的总结https://www.cnblogs.com/codexiaoyi/p/15798780.html
  2. Uber 對 Golang GC 的調整https://blog.gslin.org/archives/2022/01/13/10503/uber-%e5%b0%8d-golang-gc-%e7%9a%84%e8%aa%bf%e6%95%b4/
  3. 基于 etcd 实现大规模服务治理应用实战https://mp.weixin.qq.com/s/zOZrCNZ9X6IyKxzRMeReWg
  4. 勒索软件正在用 Go 重写,用于联合攻击 Window … ⌘ Read more

⤋ Read More

GoCN 每日新闻 (2021-12-31)

  1. 快速了解 “小字端” 和 “大字端” 及 Go 语言中的使用https://developer.51cto.com/art/202112/697505.htm
  2. Golang 与非对称加密https://www.ssgeek.com/post/golang-yu-fei-dui-cheng-jia-mi
  3. 一文搞懂 Docker、Containerd、RunC 间的联系和区别https://mp.weixin.qq.com/s/kVh_EXGeMy_UI6qIgbmsGQ
  4. Golang 项目的配置管理——Viper 简易入门配置[https://www.cnblogs.com/Mrxuexi/p/15750455.html](https://www.cnblogs.com … ⌘ Read more

⤋ Read More

GoCN 每日新闻 (2022-01-13)
GoCN 每日新闻 (2022-01-13)

  1. Golang《基于 MIME 协议的邮件信息解析》部分实现https://gocn.vip/topics/20948
  2. 泛型可以拯救 Golang 笨拙的错误处理吗?https://blog.dnmfarrell.com/post/can-generics-rescue-golangs-clunky-error-handling/
  3. 更多的并行,并不等同更高的性能https://convey.earth/conversation?id=44
  4. 为什么 Go 有两种声明变量的方式,有什么区别,哪种好? [https://mp.weixin.qq.com/s/ADwEhSA1kFOFqzIyWvAqsA](https://mp.weixin.q … ⌘ Read more

⤋ Read More

Go 分布式令牌桶限流 + 兜底策略
上篇文章提到固定时间窗口限流无法处理突然请求洪峰情况,本文讲述的令牌桶线路算法则可以比较好的处理此场景。

工作原理
  1. 单位时间按照一定速率匀速的生产 token 放入桶内,直到达到桶容量上限。
  2. 处理请求,每次尝试获取一个或多个令牌,如果拿到则处理请求,失败则拒绝请求。

Image

优缺点

优点

可以有效处理瞬间的突发流量,桶内存量 token 即可作为流量缓冲区平滑处理突发流量。

缺点

实现较为复杂。

代码实现

core/limit/tokenlimit.go

分布式环境下考虑使用 redis 作为桶和令牌的存储容器,采用 lua 脚本实现整个算法流程。

redis lua 脚本


<span class="c1">-- 每秒生成token数量即token生成速度</span>
<span class="kd">local</span> <span class="n">rate</span> <span cl ... ⌘ [Read more](https://gocn.vip/topics/20950)

⤋ Read More

I feel like it took me a bit longer to fully understand how to work in Smalltalk than it did most languages. The IDE is different than anything I’ve used before, and probably anything you’ve seen as well. You’re not going to be opening myscript.st in your favorite text editor, and then run it from the command line as you would a Python program. It takes a little mental adjustment to start with.

That’s not the warning, howe … ⌘ Read more

⤋ Read More

Go 中实现用户的每日限额(比如一天只能领三次福利)

如果你写一个 bug 管理系统,用了这个 PeriodLimit 你就可以限制每个测试人员每天只能给你提一个 bug。工作是不是就轻松很多了?:P

如今微服务架构大行其道本质原因是因为要降低系统的整体复杂度,将系统风险均摊到子系统从而最大化保证系统的稳定性,通过领域划分拆成不同的子系统后各个子系统能独立的开发、测试、发布,研发节奏和效率�� … ⌘ Read more

⤋ Read More

Go 模糊测试

从 Go 1.18 版本开始,标准工具集开始支持模糊测试。

概述

模糊测试(Fuzzing)是一种自动化测试方法,通过不断地控制程序输入来发现程序错误�� … ⌘ Read more

⤋ Read More

Go 实战 | 基于有向无环图的并发执行流的实现
大家好,我是「Go 学堂」的渔夫子。今天跟大家聊聊基于有向无环图的工作流的实现。

原文链接: https://mp.weixin.qq.com/s/F5BbHeMP7gBZHjiUL0qeeQ

01 工作流(workflow)概述

工作流,是对工作流程中的工作按一定的规则组织在一起并按其进行执行的一种模型。比如常见的行政系统中的加班申请、请假申请;工作流要解�� … ⌘ Read more

⤋ Read More