欢迎来到 艾瑞可erik 的魔法世界 🧙‍♂️

给我一个需求,还你一个项目——别管它是什么。这就是全栈。

📚 291 篇文章 🏷️ 504 个标签 📂 90 个分类

🔥 最新文章

Step-by-Step: Reproducing the Log4j2 Vulnerability

1. Introduction

Apache Log4j2 is an open-source Java logging framework that is widely used in middleware, development frameworks and web applications.

2. Vulnerability Overview

This vulnerability comes from the recursive resolution feature in certain Apache Log4j2 functionality: an unauthenticated attacker can send a specially crafted malicious packet and execute arbitrary code on the target server.

新冠真就是流感而已么?我问了四个阳了的朋友。。。

这段时间,各地新冠感染人数都在暴增,大家出门记得戴口罩。

这几天,咱编辑部也充满了风雨欲来的危机感,不过,办公室刚出现病例,咱们就迅速进行了一个居家办公,所以目前情况还不错。

但即便如此,我们每天讨论最多的话题,仍然是新冠,不仅仅是编辑部,差评君在的大部分群聊里也是这个状况。

“ 听说现在新冠跟流感一样了?”

“ 抢到药了么?我咋到处买不到药?”

“ 现在得新冠还会有啥后遗症么?”

Is COVID Really Just the Flu? I Asked Four Friends Who Tested Positive...

During this period, the number of COVID infections has been soaring everywhere. Remember to wear a mask when you go out.

These past few days our editorial team has also been filled with a sense of impending crisis, but as soon as a case appeared in the office we quickly switched to working from home, so the current situation is still not bad.

Even so, the topic we discuss most every day is still COVID — and it’s not just the editorial team. Most of the group chats 差评君 is in are in the same state.

“Do I hear that COVID is the same as the flu now?”

“Did you manage to grab any medicine? How come I can’t buy any anywhere?”

“Will catching COVID now still leave any after-effects?”

如何把极路由从砖头变正常

家里有一个闲置的极路由2,试试刷个openwrt,结果一不小心刷成砖头了。开机不能通电,没有指示灯亮。本来想着就这样丢了,再弄个查查咸鱼,二手的都要100多。果断找找解决办法。找这篇文章极路由X编程器救砖教程编程器刷PandoraBox,根据这篇文章,到万能的淘宝买了CH341A编程器 + 烧录夹

How to Turn a Bricked HiWiFi Router Back to Normal

There is an idle HiWiFi 2 sitting at home, so I tried flashing openwrt on it, and one careless move bricked it. It would not power on, and no indicator light came on. I had originally thought of just throwing it away, but then I checked Xianyu and second-hand ones cost over 100. So I resolutely looked for a solution. I found this article HiWiFi X programmer brick rescue tutorial: flashing PandoraBox with a programmer, and following it, I bought a CH341A programmer + flashing clip from the almighty Taobao

go-zero微服务试用

参考地址:https://go-zero.dev/cn/docs/quick-start/micro-service#%E5%88%9B%E5%BB%BAuser-rpc%E6%9C%8D%E5%8A%A1

go-zero介绍

go-zero(收录于 CNCF 云原生技术全景图:https://landscape.cncf.io/?selected=go-zero)是一个集成了各种工程实践的 web 和 rpc 框架。通过弹性设计保障了大并发服务端的稳定性,经受了充分的实战检验。

Trying Out go-zero Microservices

Reference address: https://go-zero.dev/cn/docs/quick-start/micro-service#%E5%88%9B%E5%BB%BAuser-rpc%E6%9C%8D%E5%8A%A1

Introduction to go-zero

go-zero (included in the CNCF Cloud Native Landscape: https://landscape.cncf.io/?selected=go-zero) is a web and rpc framework that integrates a variety of engineering practices. Through resilient design it guarantees the stability of highly concurrent server-side services and has been fully proven in practice.

beego中数据库分页

beego中数据库分页

  func PageDB(limit int, page int, count int64) (int, int) {
      pageSetNum := limit // 每页条数

      pageCount := math.Ceil((float64(count)) / (float64(pageSetNum))) // 总页数
      pageNum := page                                                  // 当前页码

      if pageNum > int(pageCount) { // 如果传入的页码超出范围
          pageNum = int(pageCount)
      }
      offset := pageSetNum * (pageNum - 1)
      if offset < 0 {
          offset = 0
      }
      return pageSetNum, offset
  }

Database Pagination in beego

Database pagination in beego

  func PageDB(limit int, page int, count int64) (int, int) {
      pageSetNum := limit // items per page

      pageCount := math.Ceil((float64(count)) / (float64(pageSetNum))) // total pages
      pageNum := page                                                  // current page number

      if pageNum > int(pageCount) { // if the page number passed in is out of range
          pageNum = int(pageCount)
      }
      offset := pageSetNum * (pageNum - 1)
      if offset < 0 {
          offset = 0
      }
      return pageSetNum, offset
  }

go对接快递

  • 韵达签名
  func YunDaSign(structData interface{}) ([]byte, string, string) {
      jsonData, _ := json.Marshal(structData)
      appKey := "你的key"
      appSecret := "你的秘钥"
      newStr := string(jsonData) + "_" + appSecret
      md := md5.New()
      md.Write([]byte(newStr))
      md5Str := hex.EncodeToString(md.Sum(nil))
      return jsonData, appKey, md5Str
  }

go中时间范围的获取

获取部分时间范围

//获得当前月的初始和结束日期
func GetMonthDay(types int) (string, string) {
    now := time.Now()
    currentYear, currentMonth, _ := now.Date()
    currentLocation := now.Location()

    firstOfMonth := time.Date(currentYear, currentMonth, 1, 0, 0, 0, 0, currentLocation)
    lastOfMonth := firstOfMonth.AddDate(0, 1, -1)
    f := firstOfMonth.Unix()
    l := lastOfMonth.Unix()
    if types == 1 {
        return time.Unix(f, 0).Format("2006-01-02"), time.Unix(l, 0).Format("2006-01-02")
    }
    return time.Unix(f, 0).Format("2006-01-02") + " 00:00:00", time.Unix(l, 0).Format("2006-01-02") + " 23:59:59"
}

Getting Date Ranges in Go

Getting some date ranges

// Get the start and end dates of the current month
func GetMonthDay(types int) (string, string) {
    now := time.Now()
    currentYear, currentMonth, _ := now.Date()
    currentLocation := now.Location()

    firstOfMonth := time.Date(currentYear, currentMonth, 1, 0, 0, 0, 0, currentLocation)
    lastOfMonth := firstOfMonth.AddDate(0, 1, -1)
    f := firstOfMonth.Unix()
    l := lastOfMonth.Unix()
    if types == 1 {
        return time.Unix(f, 0).Format("2006-01-02"), time.Unix(l, 0).Format("2006-01-02")
    }
    return time.Unix(f, 0).Format("2006-01-02") + " 00:00:00", time.Unix(l, 0).Format("2006-01-02") + " 23:59:59"
}