easy_english_every_day

Easy English Every Day

01 打招呼

  • Great to see you!
  • Good to see you!
  • How are you doing?
  • How have you been?
  • What are you doing here?
  • Oh I’m meeing my friend.
  • I’m superised to see you here.
  • You look excited.
  • What’s going on?
  • Joe and I are getting married next month.
    And we’re having our honeymoon in Europe.

02 对不起

  • I heard Juliet divorced her husband.
  • Oh! I’m sorry to hear that.
  • You know, they fell in love at first sight and quickly jumped into marriage.
  • Really? I never heard.
  • She looks quite depressed.
  • It’s so sad. I hope she’ll get through this.

03 请再说一遍

  • Excuse me?
  • Sorry! I didn’t get you.
  • I could use some water.
  • I didn’t get the joke.
  • Could you say that again?
  • Could you slow down please?
  • Could you speak up a bit?

04 再见

  • I have some errands to run. I’v got to go.
  • OKay. I’ll catch you later.
  • run some errands.
  • I called, but I did’t catch you.
  • Oh!It’s getting late. I’d better go.
  • Bye!See you!
  • You’d better sit and have a rest.
  • I have another appointment. I probably should get going.
  • Nice talking to you.Bye!
  • have an appointment.
  • make an appointment.
  • keep an appointment.
  • I had an appointment with doctor.

05 求助

  • Hello! Could you help me a little bit?
  • No problem!
  • He always help me with the housework.
  • Could you give me a hand?
  • OKay!
  • Let me give you a hand with those bags.
  • Could you do me a favour?
  • Sure.I’d love do.

06 借东西

  • Could you lend me a book?
  • Sure, there you go.
  • Can I borrow you pen?
  • Yes, here you are.
  • Can I borrow you pen for a few days?
  • Do you have a pen?
  • I don’t have one with me.

07 谢谢

  • The coat looks great for you!
  • Tha’s very nice to you to say.
  • I was just noticing your boots, what a great color.
  • Your lasagna is delicious!
  • Oh, I’m glad you like it.
  • You’re the best teacher ever.
  • Thanks for saying so.

08 你知道吗

  • Do you know Andy?
  • Yes. We went to school together. What’s up?
  • Do you know where he is?
  • Do you happen to know his number?
  • Yes, I have his number.
  • Do you happen to know the nearest bookstore?
  • Do you have any idea how to contact him?
  • We locked our keys in the car! Do you have any idea how we can get in?

09 受够了

  • I’m fed up with the music.
  • Yeah! This place is really dull.
  • I’m fed up with you complaint.
  • Do you get along with your husband?
  • He’s driving me crazy!
  • That noise is driving mad.
  • This computer is annoying me!
  • Uh-oh! It broken down again. Your need to buy a new one.
  • It annoys me …
  • It really annoys me when people forget to say thank you.

10 婉拒邀请

  • Joe and I are having a party this Saturday. Would you like to come?
  • I’d love to, but I don’t think I can make it!
  • Will you come to my party weekend?
  • I’m so sorry! I have another commitment.
  • Drop by if you can.
  • Thanks for inviting me. May be another time.
  • Thank you for coming.

11 小长假

  • How was your weekend?
  • I went hiking with my family.
  • a long weekend
  • How was your day?
  • How was your trip?
  • Terrific! How was that?
  • We have a log of fun together. We also had a picnic by the lake.
  • no picnic
  • Bringing up kids is no picni.
  • How did you spend your weekend?
  • Oh, nothing special. I hung out with my friend.
  • I barely hang out with my frends.

12 接受邀请

  • Would you like to come over for dinner tonight?
  • Sure, want me to bring anything?
  • Thank you for dinner, it was sa tasty!
  • You’re welcome.
  • Thank you for such wonderful gift.
  • Thank you for having us. We had a good time.
  • Any time.
  • I had some friends over last night.

13 压力大,工作忙

  • How’s it going?
  • I’m very busy with work these days.
  • Then why don’t you take a few days off?
  • be in the middle of (doing) sth.
  • I’m in middle of a big project.
  • I’m in middle of my new business.
  • How is school?
  • I can never finish my homework.
  • Oh, relax! Everything will be ok.
  • be working on (doing) sth.
  • I’m woking on my homework/speech/essay.
  • I’m working on making new firends.
  • I’m under a lot of pressure right now.
  • Don’t let it get top of you.

14 失恋了,不开心

  • What’s the matter, Joanna? Why the long face?
  • It’s difficult to explain. I just feel so sad.
  • Try me. It’s not as sad as you think.
  • You know, my boyfirend broke up with me. I can’t get over him.
  • America is not as good as you think.
  • break up with sb.
  • divorce sb.
  • Move on! You need get over your ex!
  • Maybe tomorrow will be different.
  • Yes, maybe I should try starting to date someone new.
  • I’m dating my frend’s brother.

15 你俩很熟吗

  • Do you know that girl?
    • Are you familiar with someone? // 慎用,这样问可能是窥探人家的隐私
    • I thought hew was a bit familiar with my wife. // 我觉得他和我老婆有一点太随便了
    • Do you know someone well? // 应该这样问
  • The tall one?
  • No, not that one. The one in jacket, with long hair.
    • blond(blonde) 金黄色
    • brown 棕色的
    • chestnut 栗色的
    • the gril with brown hair
  • She’s Ann. She works with Max.
  • She’s cute.
  • And she’s smart. She graduated from Stanford.
    • She graduated from colleage tow years ago.

16 介绍朋友

  • Can I introduce you to my friend, Jane?
  • Hi, Jane! I’m Will. Haven’t we met before?
  • Will, meet my frend Jane.
  • Jane, this is Will, my work firend.
  • I’d like you to meet my friend, Jane.
  • Hi Jane, It’s pleasure to meet you!
  • I think you guys might hit it off.
    • We hit it off with each other as soon as we meet.
  • We sure did!

17 搭讪金句

  • You are a friend of Jenny’s right?
  • Yes, I am. Did I see you before?
  • I’m afraid you’ve got the wrong person.
  • I’m so sorry, my brain is not kicking into gear.
  • Please remind me about your name.
  • I feel like I know you from somewhere.
  • I know your face, but I can’t put a name to it.

18 和老外聊天

  • Where are you from? 你来自于哪里?
    • Where are you coming from? 你刚才从哪里来?
  • I’m from the States.
    • I’m originally from Oslo, Norway, but I live in Chicago.
  • Are you from Washington?
  • No. I’m from California.
  • I heard that California is known for its beaches, sunshine and year round great weather.
  • I’ve been to Los Angeles.
  • First time in Bejing?
  • Actually I first came here in 2012.
    • This is the first/second/third time I’ve been here.
  • What do you think is the most famous place in Beijing?

19 马上能用到的聊天技巧

  • Where did you grow up?
  • I was born in Beijing and brought up in Shanghai.
    • I was born and brought up in Beijing,
      but I moved to Shanghai with my parents 5 years ago.
  • How long have you been here?
    • How long have you worked here?
    • How long have you been single?
  • I’ve been here for 5 years.
  • How do you like it here so far?
    • How do you like the weather?
    • I wish it would stop raining.
    • I prefer it warmer.
  • I like the food and the secnic spots here.

20 聊职业

  • What do you do for a living?
  • I’m a marking manager for a tech company.
    • I’m a 职业 for 工作地.
    • I’m a music teacher for a private school.
  • What line of business are you in?
  • I’m a English teacher instructing people in English online.
    • instruct someone in something
    • He instructs me in use the gym enquiment.
  • What type of work do you do?
  • I’m a fitness trainer specializeing in creating easy and fun
    exercise programs for people who don’t enjoy going to the gym.
    • specialize in 专门从事,专攻
    • The hop specializes in handmade chocolates.
    • go to the gym 去健身房
    • I go go the gym twice a week.

21 聊运动健身

  • Do you do any sports?
    • do/play sports
    • What’s the favorite sport to play? 你最喜欢什么运动
    • What’s your favorite sport? 不一定是做运动
  • No, I don’t do sports, I’m not a big fan.
    • I’m not a fan. 我不热爱某事物
    • I’m not that into that. 我不太感兴趣。(这句语法很诡异)
  • Do you play any ball games?
    • play+球类
    • backetball, baseball, soccer, golf
  • Yes, I play backetball. It’s my thing.
  • Do you usually work out?
    • do lifting 做负重练习,举铁
    • do yoga 做瑜伽
    • do plank 做平板支撑
    • How often do you work out? 你多久锻炼一次啊?
    • How many hours do you usually spend on working out every day?
      你每天要锻炼多长时间啊?
  • I do the gym a lot, sometimes I do yoga.

22 最爱的书和电影

  • What kind of books do you read?
    • stick to 坚持,忠于做某事
    • science fiction 科幻小说/电影
  • I most like to sitck to science fiction.
    • tend to do 倾向于做某事
    • I tend to read books like ‘I’ll Give you the Sun’ by Jandy Nelson.
    • I read verfy little thrillers and fansasy.
    • I like all kinds of books.
  • What kind of movies do you like?
    • movie 电影
    • romantic comedy 浪漫喜剧
  • My favorite types of movies are romantic comedies.
    • I love … the most. 我最喜欢…
    • I never like horror movies.
    • action 动作片
    • thriller 惊险片
    • horror 恐怖片
    • comedy 喜剧片
  • Who’s your favorite actor?
    • actor 男演员
    • actress 女演员
    • ideal 完美的,理想的人或事物
  • I’m a fan of Matt Damon from the Martians. He is an ideal for me.
    • I’m a fan of 很喜欢某演员。
    • He’s a good family man. 他是个很有家庭观念的人。
    • He has a good sence of humor. 他是个很有幽默感的人。

23 你说怎么样?

  • How do you like your new job?
  • I like it. And I still have a lot to learn and improve
  • 词汇
    • learn 学习
    • improve 提高
  • 活用
    • How do you like …? 你觉得…怎么样?问客观评价
    • How did you like Paris?
    • How did you like it when you live in Paris?
    • How do you like these shoes?
  • How do you feel about your coworkers?
  • They are friendly and easy to get along with.
  • 词汇
    • coworker 同事
    • friendly 友善的
  • 活用
    • How do you feel about…? 你觉得…怎么样?问主管感受,真实想法
    • How do you feel about overtime?
    • I don’t mind working overtime at all,
      and I’m flexble with my hours,
      so I won’t have a problem.
  • What do you say we go to see a move?
  • OKay, Let’s go.
  • 词汇
    • tonight 今晚
  • 活用
    • What do you say? 征求别人的建议和想法
    • Let’s go to the movies tonight, wht do you say?
    • Let’s eat out tonight. What do you say?

24 学会夸人

  • That’s a lovely hat! It looks great on you!
  • Oh,!I’m glad you like it!
  • 词汇
    • lovely 好看的
    • hat 帽子
  • 活用
    • That’s a lovely … …真好看
    • something looks great on someone 更侧重于说东西漂亮。
    • I really like your… 夸别人的衣着,可以说,我很喜欢你的…
    • I really like your outfit. 我好喜欢你的衣服。
    • I really like the way you look. 我好喜欢你的打扮。
  • You look pretty in that dress!
  • Thank you. That’s very nice of you to say.
  • 词汇
    • pretty 漂亮的
    • dress 裙子
  • 活用
    • You look pretty in … 更侧重于说人(穿什么)漂亮
    • You are looking nice today! 你今天真漂亮!
    • 形容女人漂亮动人,还可以用 beautiful, stunning, gorgeous
  • Those errrings suit you well.
    这耳环真配你。
  • Thanks. My boyfirend send them to me as birthday gifts.
    谢谢,这耳环是我男朋友送我的生日礼物。
  • 词汇
    • earring 耳环
    • suit 相配,适合
  • 活用
    • Blue suits you well. 蓝色很适合你
    • It brings out your eyes. 它更显你漂亮(帅气)。
    • It really match your skin tone. 它很配你的肤色。

25 迟到了

  • You are 20 minutes late. What kept you?
    你迟到了20分钟,怎么回事?
  • I went the wrong way.
    我走错路了。
  • 词汇
    • minute 分钟
    • wrong 错误的
  • 活用
    • I wasn’t feeling well and overslept.
      我感觉不舒服,睡过头了。
    • I got stuck in the traffic.
      我遇到了交通堵塞。
    • I got stuck in the rain/snow.
      我被雨/雪困住了。
  • I’m sorry for being late. 对不起,我来晚了。
  • Never mind. 没关系的
  • 词汇
    • late 迟到的
    • mind 介意
  • 活用
    • My car broke down. 我的车坏了。
    • I missed the bus/train. 我没有赶上公共汽车/地铁。
  • Sorry for keep you waiting. 真抱歉让你久等了。
  • No bit deal. 没什么的。
  • 词汇
    • wait 等待
    • deal 交易
  • 活用
    • Sorry for taking up more or your time.
      真不好意思耽误了你那么久。
    • Thank you for your flexibility.
      感谢你抽出时间来见我。

26 征求同意

  • I was wondering if I could use your computer?
    不知道我能不能用一下你的电脑?
  • yes, feel free.
    可以,你用吧。
  • 词汇
    • wonder 想知道
    • computer 电脑
  • 活用场景
    • I was wondering if
      表示委婉征求同意,行吗?可以吗?
    • I was wondering if I could park here?
      请问这里能停车吗?
    • feel free
      请随意,回答别人的询问,表示你想怎么做都可以。
  • Do you mind me opening the window?
  • No, not at all. Please do so.
  • 词汇
    • mind 介意
    • window 窗户
  • 活用
    • Do you mind…?
      委婉征求同意,表示 你不介意…吗?
    • Do you mind if open the window?
    • I feel a little chilly, please don’t.
  • Is Mike cool with us using this house?
    Mike 不介意我们借用这房子吧?
  • Relax, he would be cool with that.
    放心,他不会介意的。
  • 词汇
    • cool 赞同的
    • use 使用
  • 活用
    • be cool with 同意,赞同某事
    • I’m cool with that 我没意见/我同意

27 社交网站头像

  • Excuse me!Could you take a picture of us?
    麻烦您能帮我们拍张照片吗?
  • OKay.
    可以的
  • 词汇
    • picture 照片
    • photo 照片
  • 活用
    • Could you please 可以表示 劳驾您,麻烦您
    • take a picture/photo of 给某人或景物照相
  • Could you take one more from this angle?
    能从这个角度再帮我拍一张吗?
  • Sure.
    好呀
  • 词汇
    • angle 角度
  • 活用
    • take one more (picture) 再拍一张(照片)
  • will you take a selfie with me?
    能跟我一起拍张照片吗?
  • No problem.
    没问题
  • 词汇
    • selfie 自拍照
    • profile picture (网站个人资料) 头像
  • 活用
    • Would you mind if we take a picture together?
      请问您能跟我合个影吗?
    • Hey, let’s take a quick picture.
      咱们拍张照片吧
    • Let’s document our firendship. CHEESE!
      我们来吧友谊记录下来吧。茄子!
    • Can we take a picture? I want a new profile pic.
      咱们拍张照片吧,我想换个新头像。

28 你有空吗?

  • Do you have a minite? 你有时间吗?
  • I would like to give you my full attention.
    我很想挺你把话说完,
    May I let you know when I can do that?
    不过我们可以下次有空再说吗?
  • 词汇
    • full 完全的
    • attention 注意力
  • 活用
    • Do you have a moment? 你有时间吗?
    • Can I talk you for a moment? 我能跟你说点事吗?
    • Could I have a word with you? 我能跟你说几句话吗?
  • Can you spare me a few seconds?
    能给我几分钟时间吗?
  • I’m sorry. I’m a little busy right now.
    不好意思,我现在很忙
  • 词汇
    • spare 空出,腾出
    • second 秒
  • 活用
    • I’m in such a rush. 我正在赶时间
    • I’m rushing a meeting. 我正赶着要开会
    • Can we make it another time?
      我们下次再约个时间吧
  • Can I have Lily for a second?
    我想找 Lily 说句话。
  • OKay. 好的
  • 词汇
    • interrupt 打断(谈话)
    • mean 有意,打算做某事
  • 活用
    • Ah…Sorry to interrupt. 呃。对不起,打扰一下。
    • Umm…I didn’t mean to interrupt.
      嗯,不好意思,打扰一下。
    • May I borrow Mike for a sec?
      我想找 Mike 一下,
      I need him to check on my computer.
      我想让他检查一下我的电脑。

29 道歉了,就一定会原谅?

  • I apologize for screwing up your plans.
    对不起把你的计划打乱了。
  • I hear you.
    我知道
  • 词汇
    • apologize 道歉
    • screw up 搅乱
  • 活用
    • apologize for 为…而道歉
    • I apologize for losing my temper
      对不起,我发脾气了。
  • I’t my fault. Will you forgive me?
    是我的错,你能原谅我吗?
  • I forgive you.
    我原谅你
  • 词汇
    • fault 错误
    • forgive 原谅
  • 活用
    • I accept your apology.
      我接受你的道歉。
    • I appreciate your apology.
      很感谢你能向我道歉。
  • I feel really bad about what I just said.
    我刚才那样说,真的很抱歉
  • It’s okay. 没事的。
  • 词汇
    • feel 感觉
  • 活用
    • feel bad about 为…感到愧疚,不好意思
    • I feel bad about leaving without saying goodbye.
      我连句再见都没说,心里感觉很过意不去。
    • I feel bad about not inviting hi.
      我没邀请他,觉得很过意不去。

30 听不清,没信号

  • Hello. Could I speak to Andrew Pryce, Please?
    你好,我想找一下 Andrew Pryce.
  • He’s not here. Would you lile to leave a message?
    他现在不在。我能帮你留言给他妈?
  • Oh, yes, could you ask him to call me back?
    好的,你能转告他给我回个电话吗?
  • May I ask who is calling?
    请问你是哪位呢?
  • 词汇
    • speak 说话
    • message 消息,留言
  • 活用
    • He’s not in the office.
      他没在办公室
    • Oh, thanks. I’ll call back later
      谢谢,我一会儿再打过来。
    • He’s on another call.
      他正在打电话
  • Hey, Dane, this is Joanna. Is Linda there?
    嗨,Dane,我是 Joanna。Linda 在吗?
  • Hang on a sec.
    你等一下
  • 词汇
    • hang on 等一下
  • 活用
    • This is … 我是…(打电话时)
    • Hold on. 等一下
    • Just a minute. 等一下
    • On moment please 请稍等
    • Please hold. 请稍等
    • I’ll get her/him. 我去叫他/她。
  • Your are breaking up. I can barely here you.
    你说话断断续续的,我几乎听不见你说什么。
  • We had a bad connection. Could you say that agaain
    我们的通话质量不好,你能再说一遍吗?

202308

shell

@a_b_c 的式样

  • a:基于索引(ind)还是值(val)来排序

  • b:按字符串(str)比较,按数值(num)比较和按类型(type)比较。如果是按照类型,在升序的情况下,数值>字符串>数组

  • c:指定升序(asc)或降序(desc)

    awk ‘BEGIN{a[“AAAA”]=“4”;a[“BBBB”]=“3”;a[“CCCC”]=“2”;a[“DDDD”]=“1”;PROCINFO[“sorted_in”]=“@ind_str_asc”;for(i in a)print i,a[i]}’

    AAAA 4
    BBBB 3
    CCCC 2
    DDDD 1

清理临时文件

sudo tmpreaper 3d /tmp

java

keycloak 是一个开源的进行身份认证和访问控制的软件。是由Red Hat基金会开发的,我们可以使用keycloak方便的向应用程序和安全服务添加身份认证,非常的方便。基于 Java 开发,支持多种数据库。

https://www.jianshu.com/p/2275ae26bcd1
https://www.keycloak.org/getting-started/getting-started-zip
https://keycloak.org.cn/docs/latest/securing_apps/index.htm

fellow是什么职位

  1. 定义

在职场中,“Fellow”这个词常常被提到,特别是在高科技领域或大型科技公司中。但是究竟什么是Fellow?

Fellow一般指一家公司内部地位非常高的职位,通常是该公司的高级工程师或研究员,以及在公司的业务领域内有卓越贡献的专家或者知名人士。

  1. 符号意义

Fellow是一种荣誉职位,通常并不属于资深的管理层,但是比其他技术职位更为高级。这样的职位通常拥有许多特权,例如能够拥有极高的薪水、股票期权、和决策权等等。此外,Fellow这一荣誉称号通常是有名有姓的,可以增加其个人名望影响力。

  1. 职责与作用

作为Fellow,他们不仅需要掌握自己所擅长的技术领域,更需要关注公司在其主要业务领域中所面临的各种挑战,对公司的业务发展提供战略上的支持和帮助。此外,Fellow还通常担任公司内部的技术指导角色,他森弊梁们需要指导和协助团队内的其他工程师或研此运究人员进行技术探讨和方案设计。

  1. 如何成为Fellow

通俗的讲,成为Fellow需要具备出色的技术能力,背景广泛,创新意识强,以及在业界享有广泛赞誉。但是正如各大高科技公司都非常注重的一点,除了技术能力外,想要成为Fellow还需要在公司的其他方面拥有贡献,例如文化影响力、创新推动、团队管卜坦理等等。因此,沉淀和积累多年的技术能力,加上个人的职业发展规划,透过事业上不断的提升,才能够拥有成为Fellow的机会。

  1. 不同公司的Fellow

尽管Fellow是一种荣誉职位,但是在不同的公司内,其意义和职责并不完全相同。在一些公司,Fellow与高级工程师等级相当,只是更为高端的称号,并没有其他明显的区别;而在一些公司中,Fellow则是公司内技术发展中不可或缺的重要人才。此外,在某些公司中,Fellow可以作为公司内部层级更高的一种董事会成员,直接参与公司战略设计和管理决策。

  1. 综合展望

Fellow的职位定位非常高,拥有丰富的工作经验、专业知识和独特的技能,是公司内部顶尖的科技人才。成为Fellow不仅需要掌握技术,更需要有广阔的视野和洞察力,能够全面了解公司的业务和发展规划。未来Fellows的标准可能会更高,要想成为科技领域的佼佼者,一定需要不断地完善自己的技能和知识储备,拥有更强的团队领导和规划战略的能力。

english

While building your web application, you may have some tasks, such as parsing and storing an uploaded CSV file, that take too long to perform during a typical web request. Thankfully, Laravel allows you to easily create queued jobs that may be processed in the background. By moving time intensive tasks to a queue, your application can respond to web requests with blazing speed and provide a better user experience to your customers.

For example, you may wish to allow users to backup their data once per hour while imposing no such limit on premium customers.

python

Building LLM applications for production
https://huyenchip.com/2023/04/11/llm-engineering.html

Python高性能编程六:multiprocessing模块
https://zhuanlan.zhihu.com/p/455171966

  • 多进程中运行了一定数量的Python进程,每个进程都有自己的内存空间等,所以没有GIL竞争。而对一个进程的多线程,会存在GIL竞争而造成额外开销,于是代码运行会变慢。
  • 每当一个线程被唤醒并设法获得GIL时,就使用了系统资源。如果一个线程忙碌,那么其他线程将重复不断地唤醒并设法获取GIL,这些重复造成开销越来越大。
  • 当然,这是多线程运行于多个CPU上的问题,多线程的单核CPU没有没有GIL竞争。
  • 同样比纯Python快了很多,并且线程越多,速度基本会越快。通过工作于GIL之外,numpy能够用多线程达到更快的速度。

是时候进行OAuth 2.1了
https://zhuanlan.zhihu.com/p/553934043?utm_id=0

如果您现在想要实施安全的OAuth解决方案,则需要阅读以下内容:RFC 6749(OAuth 2.0 Core),RFC 6750(持有者令牌),RFC 6819(威胁模型和安全注意事项),RFC 8252(本机应用程序的OAuth),RFC 8628(设备授予),基于浏览器的应用程序的OAuth,OAuth 2.0安全最佳实践,RFC 7009(令牌吊销),RFC 8414(授权服务器元数据), 如果您还要实现OAuth服务器,那么您需要阅读RFC 7519(JWT),JWT Best Current Practice,JWT Profile for Access Tokens,以及我忘记的其他一些内容。

OAuth 2.1中将包含的内容的细节仍在小组内进行讨论,并将在即将举行的IETF会议的议程中。这些讨论的起点大致如下。

从 OAuth 2.0 Core、RFC 6749 开始

  • 包括 OAuth 2.0 持有者令牌,RFC 6750
  • 采用安全 BCP,这将删除密码授予和隐式流
  • 要求所有客户端类型使用 PKCE,而不仅仅是公共客户端(在安全性 BCP 中定义)
  • 采用本机应用和基于浏览器的应用 BCP
  • 包括设备授予作为可用的顶级授权选项 (RFC 8626)
  • 包括令牌吊销 (RFC 7009)
  • 包括授权服务器元数据 (RFC 8414)

如果授权服务器打算与任意资源服务器(如 OAuth 服务和开源项目)进行互操作,则还有一组附加要求,其中包括:

  • 令牌自检 (RFC 7662)
  • JWT访问令牌(当前工作组草案)
  • 智威汤逊当前最佳实践(当前工作组草案)

我们都知道OAuth2.0的授权码模式是最安全的授权模式。但在非TLS链接发生时,该模式的部分授权流程可能被拦截导致“中间人攻击”。为了防止报文被修改,在授权码的基础上附加了一个PKCE流程RFC7636用于JavaScript单页应用,后面还出台了针对移动端的PKCE规范RFC8252。

登录鉴权理论知识串讲:OAuth2、JWT、session、refresh token、SSO、OIDC、IDP…
https://zhuanlan.zhihu.com/p/573697777

OAuth, OpenID Connect(OIDC), SAML, JWT, IDP, UMA, CAS,SSO,PKCE, LDAP, kerberos

OpenID Connect(简称 OIDC)1.0 是建立在 OAuth 2.0 上的身份验证机制,它允许客户端通过授权服务对用户进行认证,以及获取用户信息。其意义主要在于以安全的方式分发用户的唯一标识(访问凭证依然是 Access Token)。
http://timd.cn/openid-connect/

  • OP:OpenID Provider,即 OAuth 2.0 中的授权服务,用于对用户进行鉴权
  • RP:Relying Part,即 OAuth 2.0 中的客户端,它从 OP 获取对鉴权信息和用户信息
  • ID Token:是一个 JWT,包含本次授权的基本信息

金融

QuantLib是基于欧美成熟金融市场开发的大型金融产品定价分析框架,其涵盖的金融工具(Instruments)主要分为四类:固定收益(Fixed Income)、期权(Option)、信贷(Credit)和通胀(Inflation)。每一个大类又包含了多个金融工具或衍生品,比如固定收益产品包括远期(Forward)、债券(Bonds)和互换(Swaps)等。

高频交易的常见策略包括,

  • 做市策略(Market Making):这种策略中,做市商手中持有一定现货,在交易所挂限价单,同时和买卖双方进行交易,为市场提供流动性。这种策略的收入包括买卖价差和交易所返佣两个部分。
  • 趋势策略(Directional):简单说就是进行价格预测。高频使用了更深度、颗粒度更细的行情,会做相对中低频更精细的预测,并且会用报撤单速度的优势,先下单来人为制造趋势。
  • 套利策略(Arbitrage):简单说就是价格回归。流动性越好的市场,具有相关性的品种、合约价差会越快消失,速度最快的玩家才可以抓住这些转瞬即逝的机会。

在国内,证券交易所不允许日内交易,没有返佣;期货交易所流动性好的品种都限制日内报撤单数量,返佣非常不稳定。扣除高频在硬件和系统开发上的投入成本,(算算GPU,万兆网卡多少钱),纯粹的高频做市策略,收益绝对没有到“暴利”的程度。

而在套利策略和趋势策略中,其实高频交易主要提供的是运算速度和交易执行速度上的优势,但是一旦策略本身研发能力跟不上,速度也不会给策略带来明显的优势。而且套利和趋势策略追求的对价格和价格关系的准确计算,并不是说做到了高频就一定能赚钱,刻意提高频率,一味追求频繁交易只会增加交易费用,增加亏损的概率。

而且,高频的一大问题是,策略的资金容量非常有限。即使策略本身收益稳定且高,绝对收益的数量也是有上限的。

一般来说,国内的高频团队,能够赚钱的,都是在趋势策略、套利策略等其他策略上也很有实力的团队,都会逐渐往大资金容量的中长周期低频策略上发展,九坤、幻方、锐天、明泓、宽德都是如此。

卷因子更需要一些计算机和数学方面的能力,目前主流的利用机器学习遗传算法发现因子,需要强大的编程方面的能力,同时也需要数理统计方面的知识对数据进行处理,对超参数进行合理预估。

链接:https://www.zhihu.com/question/314495451/answer/1046204865

我一直很好奇,高中数学考试每次145+的人怎么做到的? - 川上老师的回答 - 知乎
https://www.zhihu.com/question/525449367/answer/2963025237

总结:
①计算能力★
②预习课本
③刷题
④广泛学习课外知识
⑤做题习惯好——心态好,稿纸、卷面工整
⑥考试合理分配时间
⑦检查考试卷——新法重做/逐步检验
⑧适当投机取巧
⑨不要懒惰,反复巩固

庄家能把散户看透到什么地步? - 酒馆的投资笔记的回答 - 知乎
https://www.zhihu.com/question/435574315/answer/2978606013

1、世人都有贪嗔痴,行情上涨总是想多赚点,行情一跌就开始装死,不愿意认输。好不容易解套,直接就成了放牛娃。在这个市场当中,如果你没有原则,你一定会被庄家左右,被自己的情绪左右,我的原则是每次亏损不超过本金5%,如果盈利则至少要10%,一旦10个点以上盈利开始回吐,至少要保证当笔交易不能亏损出局。这样即便你的胜率只有50%,100次,你的收益也将达到800%,难吗?难的是人的贪婪和恐惧,知行合一。

2、集中投资,学会空仓。散户的最大痛点:不会空仓,弱势亏损补仓,本金少股票多,亏损死扛,100万以下不宜超过3只股,把那些大级别均线系统向下的,股性不强,不在主流赛道的股票去掉,认错,可能对于你来说需要很大的勇气,但是承认自己的错误,是我们成功的开始。会买的是徒弟,会卖的是师父,会空仓的是祖师爷。当行情不好的时候,一定要能管住自己的手。而当你真正看好的时候,要敢于重仓,其实投资市场绝大部分盈利都是来自于几只好股票。我的持仓从来不超过3只,哪怕是在牛市。

3、我自始至终觉得成交量这个指标非常重要,学会这点你将碾压80%的交易选手。量比小于0.5,属于明显缩量,缩量能创新高,说明主力高度控盘,而且可以排除主力出货的可能,如果正好处于上升通道,则吃肉的概率极大。如果股票涨停,量比小于1,说明还有较大的上涨空间,次日再次涨停的概率极大,如果量比大于1.5,而且突破某个重要阻力位(比如20日均线)之后缩量回调的个股,是不可多得的买入对象。

4、暴跌是检验股票的试金石,牛市里行情暴跌意味着抄底的机会,也是选股的好时机,如果大盘暴跌,你的股票微跌甚至不跌,那明显是有资金抱团,拒绝下跌,所以这种票可以放心持有,必有回报。如果大盘暴跌,你的票大跌,第二天大盘涨它暴涨,这很可能是主力借大盘下跌洗盘,股性不错,这种票你可以在大盘暴跌时买入,大盘涨的时候出,短线反弹套利。

5、趋势为王,顺势而为。趋势一旦形成,不用多分析,必须跟随,跟着资金走,不猜,不预测,不假设,如果你不会判断趋势,你就看均线,所谓均线,就是把行情划分为多头和空头,多头就是向上,空头就是乡下,短线你就看5日均线,放量突破,你就跟进,中长线趋势你就看20日均线,放量突破你就进,破则出。

6、把握情绪冰点。大盘每天都有自己的情绪,大部分时候,盘中会出现一些情绪“冰点”,可能是在开盘,可能是开盘一段时间后的分歧点,也可能是下午,或者是尾盘,总之,每天的盘面几乎都有情绪冰点。这个时候往往会选择在冰点进行出手,因为冰点恰好可以考验出个股强弱,这样往往能够获得被情绪带下来的恐慌筹码,也能够有效避免追高。

7、懂得看题材:消息面、主线,资金,承接力度。消息是最能刺激行情的催化剂,这是短线选手必须要关注的点,主线就是市场最热门的方向,比如2021年的新能源、2022年的新冠药概念;资金主要看主力净流入,承接力度指的是板块的持续性,是否有资金愿意去抬轿形成合力。

8、做短期强势股要关注量能和换手率:大涨的时候,必须是放量的,说明有资金介入,看好未来的走势;另外,一般当天涨幅大于5个点以上,换手率不要低于5%,但最好不要超过30%,这些都是多年经验的总结,不信大家可以去观察最近的强势股走势,你会给我点赞的。

9、倍阳缩倍阴是非常靠谱的起涨形态,什么叫倍阳缩倍阴?就是大涨的当天是放倍量的,隔天的阴线量能缩一倍。但值得注意的是,回调没有破第一天大阳线的底部,随后出现小阴小阳的K线就是绝佳的进场机会,后市爆发力极高!

10、投资源于生活,从细节中寻找机会,看一个公告要从点推面。资金介入的逻辑是赚钱,赚钱的逻辑是价值,价值的逻辑是商业行为的落地。所以,思考的方向是消息面 - 逻辑面 - 资金面 - 技术面 – 分时盘口,从生活的案例中提炼出精华。

11、长线思维。看长做短,意思是你不一定要长期持有一个票,但是一定要有这种思维,所谓长线思维指的是你要有自己操作模式,不要人云亦云,坚持自己的思路,不断完善,你才能够稳定获利,精益求精。

12、大赚之后要学会空仓,散户大赚之后往往就会骄傲,然而骄兵必败,厉兵秣马再战,商品是有时间周期的,大赚以后会忘记时间的价值,当一个人成功一次后会增加自信心,连续成功便会自信心爆棚,对自己的判断是百分百认可,看好一个股就立马买了,如果买错了但小亏并不会让自己的信心减少多少,只有直到大亏时才会使信心大幅下降,当信心下降后,出手便会容易变形!不要妄想抓住每个版块的机会,同时追两只兔子的人,一直也会逮不到!

13、交易越是不顺的时候,越要沉住气,艰难的路不是谁都有资格走的,扛得住涅槃之痛,才配的上重生之美。股市就是这样,当赚钱效应出来的时候赚钱很容易。当亏钱效应出来的时候亏钱也很容易,关键点在于勇于出手和即时收手。

14、“一将功成万骨枯”,炒股其实是很血腥的,一赚二平七亏,是这个市场唯一不变的真理。我认识的很多股市高手,都会研究佛学,每一波大的行情,无论是上涨还是下跌,我们都会选择去放生,我知道这毫无意义,但求念头通畅。如果有一天大家都成功的时候,一定要记得做一些对社会有意义的事情!佛系点说这是因果,正经点说达则兼济天下!

以上都是我炒股16年实践经验和技术的总结,不一定适用每个人,需要每个人结合自己的实践去使用总结,作为交易者,最可怕的不是你技术上存在问题,而是你的认知不够,掉进了这些交易陷阱却不自知!没有无敌的交易系统,只有无敌地使用交易系统的人!这是真理,交易系统最终要回归到人身上!

个人维护一个20%收益的低频量化策略,难度有多大?现实吗? - quantkoala的回答 - 知乎
https://www.zhihu.com/question/270964258/answer/3138383627

前端

前端Web实战:从零打造一个类Visio的流程图拓扑图绘图工具
https://blog.csdn.net/Alsmile/article/details/131725305

其它

高中数学学那么多三角函数公式到底有什么用? - 吾欲揽六龙的回答 - 知乎
https://www.zhihu.com/question/62411548/answer/2572017203

Flink-Table API(概念、基础操作、流表转换)
https://www.cnblogs.com/EnzoDin/p/16743404.html

个人做量化交易靠谱吗? - 金融圈笛子的回答 - 知乎
https://www.zhihu.com/question/329206671/answer/2363335984

指数增强策略里最重要的一块是因子投资,也就是我们通过一定的标准,选出能够跑赢指数的股票组合。在海外几十年的历史中,人们总结了四大跑赢指数的因子:

  • 价值,也就是认为,低市盈率的公司可以跑赢高市盈率的公司。
  • 质量,也就是现金流好,负债率低的公司,可以跑赢现金流差,负债率高的公司。
  • 规模,也就是小盘股可以跑赢大盘股。
  • 动量,也就是过去强势的公司,在未来会跑赢过去弱势的公司。

量化交易都有哪些主要的策略模型? - 金融圈笛子的回答 - 知乎
https://www.zhihu.com/question/24179101/answer/2188611287

个人做量化交易靠谱吗? - 泛程序员的回答 - 知乎
https://www.zhihu.com/question/329206671/answer/2079148606

对于实时性不敏感的策略,再更一个散户白嫖AWS的信息。我有几个日内策略(1分钟蜡烛图)的策略是用AWS Lambda + DynamoDB + S3 + CloudWatch 实现的。因为aws每个月都有一定的免费额度,特别是lambda额度很大。。那几个策略就是白用的状态。因为是日内1分钟策略,每天的Lambda运算量只有几千秒,远远达不到aws收费限额。。。但是lambda省心,不用维护不用停机。。就这么省心。DynamoDB用来维护状态,因为lambda是无状态的,也是免费用。S3用来维护一些历史数据,定期清理,一个月0.2美金。。。就这样跑了大半年,没有出过任何问题。。日常交易、警报直接通过lambda发邮件过来。。。挺舒心的。。。

夏普率

  • 你实盘夏普超过1后,通常已经有比较好的框架了:包括资产配置和风险控制。
  • 且做到夏普过1,已经旱涝保收了,说实话,已经超过许多所谓“专家”了。
  • 夏普1的意思就是长期看,你每承担的1分风险,换得了1分回报,很公平。
  • 在这之前,没必要投资研究更好的回测系统和交易系统。
  • 如果你做了几年实盘,夏普低于0.7,请不要再做了。

交易中的高手高在哪里? - 道行天的回答 - 知乎
https://www.zhihu.com/question/322969695/answer/2945988471

要入行机器学习是不是非学数学不可?要学到什么程度,如何才能提高数学水平? - 生姜DrGinger的回答 - 知乎
https://www.zhihu.com/question/597884858/answer/3002690154

举个例子,仅仅满足调用Python机器学习、深度学习的包,比如SK-learn、PyTorch,是不够的。
为了调参,为了解释结果,也需要大家理解机器学习算法的底层数学知识。
这些数学基础大致可以分成如下几个板块:

  • 微积分(比如,向量微积分中的梯度、黑塞矩阵)
  • 线性代数(比如,向量空间、特征值分解、奇异值分解)
  • 概率统计(比如,最小二乘法、多元统计、多元高斯分布、最大似然估计MLE、贝叶斯推断、最大后验估计)
  • 数值与优化(比如,极值、数值微积分、拉格朗日乘子法、基于梯度的优化方法、遗传算法)

为了学习深度学习,大家当然可以进一步学习随机过程、自动微分、信息论、图论等内容。

对于国内理工科同学来说,虽然数学三件套(微积分、线性代数、概率统计)学了很多数学工具,但是想要入门机器学习,现有的数学三件套的知识体系已经很落后“时代需求”。

  • 微积分:过度一元,极少多元
  • 线性代数:为什么要那么强调行列式?
  • 线性代数:为什么不联系数据、几何、多元微积分、优化、统计?
  • 概率统计:太多一元,极少多元
  • 概率统计:太多频率派,极少贝叶斯派
  • 贝叶斯统计推断更靠近“人脑思维”模式

线性代数是现代计算的核心。最应该强调“多视角”,比如数据视角、几何视角、空间视角、优化视角、统计视角等等。“多重视角”把代数、线性代数、几何、解析几何、概率统计、微积分、优化方法等编织成一张绵密的网络。

为什么全世界都在加息,而中国却在减息,有金融大神科普一下吗? - 佐伊24的回答 - 知乎
https://www.zhihu.com/question/559951607/answer/3126681915

链接:https://zhuanlan.zhihu.com/p/439091470
分享的小白避免踩坑六大神句,分享给大家:

  • “长期持有”
  • “减少操作”
  • “大类配置”
  • “分散持仓”
  • “坚持定投”
  • “选基选人”
  • 用“选基选人”“分散持仓”规划自己的收入来源,让自己既有稳定的主业收入,也有爱好和投资收入,让自己接下来的人生选择更有底气。
  • 用“长期持有”“大类配置”去设定自己的人生目标,做长期主义者。
  • 用“减少操作”“坚持定投”去远离浮躁,一点点收获成长,实现自己的人生目标。
  • End~

在股市里怎么跑赢90%以上的股民? - 渔人日志的回答 - 知乎
https://www.zhihu.com/question/413391595/answer/2585672232

所有的指标都是事后诸葛,唯有成交量和换手率是一个例外,这两个指标都是真金白银堆出来的

3分钟”战胜“市场:一个简单的投资组合 - 泛程序员的文章 - 知乎
https://zhuanlan.zhihu.com/p/249909117

  • 如果你在开发新策略,至少需要检测两个参数,即 sharpe 和 相关性。
  • 即使新策略的sharpe超过了1.1,如果与市场相关性过高,那么并不一定是好的策略。
  • 相反的,即使新策略sharpe没有很好,但是相关性非常低,那么这个新策略就可以与市场形成一个新的投资组合,进而实现更高的sharpe。

看哪些纪录片可以提高认知? - 似舟的回答 - 知乎
https://www.zhihu.com/question/599621146/answer/3059427656

1《隐姓亿万富豪》

有自己的量化模型,可以提供两年实盘交易记录,如何找投资? - Spectre的回答 - 知乎
https://www.zhihu.com/question/561140482/answer/2958575664

其次是国内的公司quant思路,主流的就是高频交易、因子选股、日内交易,基本不会做低频CTA、统计套利和宏观对冲。

说说你的日内交易策略是什么? - 郑多多的回答 - 知乎
https://www.zhihu.com/question/42126058/answer/3046718478

  • 波动率突破,除了突破多空信号之外,还可以在波动线和加仓信号进场,日内交易机会很多。
  • 大部分行情都是震荡行情,利用成交量加权平均价通道来确定日内压力和支撑,如下图所示,能比较好的做好止盈和止损。
  • 主图粗线为vwap成交量加权平均价,上下沿分别为1和2单位的ATR标准差,视作支撑和压力

fin tune
https://mp.weixin.qq.com/s/4v45pshI8wwvMXPpBEPAQw

海龟交易策略使用了什么量化交易模型? - 李奇的回答 - 知乎
https://www.zhihu.com/question/495850466/answer/2207096515

深度学习做股票预测靠谱吗? - Spectator的回答 - 知乎
https://www.zhihu.com/question/54542998/answer/2867826714

线性代数到底是什么? - AK Fourier的回答 - 知乎
https://www.zhihu.com/question/489470968/answer/3117627141

「成考」和「自考」的区别是什么? - 自考上岸锦鲤的回答 - 知乎
https://www.zhihu.com/question/21912024/answer/2611884601

jstack命令详解 - 知乎用户BgiUTI的文章 - 知乎
https://zhuanlan.zhihu.com/p/475571849

终极找 bug 大法 - 二分
https://segmentfault.com/a/1190000041400805

https://www.51cto.com/article/677058.html
安全 | 零知识证明是零信任吗?

java 应用 cpu 过高故障排查
https://blog.csdn.net/qq_41538097/article/details/131842679

  • 查看进程下的线程详情 top -H -p 11748

  • 将线程 12240 的 pid 转为 16 进制 printf “0x%x\n” 12240

  • 使用 java jdk 下自带的 jstack 查看进程的快照 jstack 12227|grep -A 20 0x2fd0

  • GC问题:

    • top+top -Hp + jstack排查是"VM Thread"消耗过多资源,可以进一步使用jmap工具进行内存溢出排查。
  • 业务执行过慢问题:

    • top+top -Hp + jstack排查发现是普通业务线程,可看到具体是哪个接口。
  • 死锁:

    • jstack + Java进程打印堆栈信息中包含死锁信息deadlock
  • 线程处于waiting状态:

    • 多打印几次jstack信息,对比一直停留在waiting状态的线程。

原文链接:https://blog.csdn.net/wx17343624830/article/details/130946645

Java解决HTTP请求异常的方法
http://news.558idc.com/617235.html

  • 连接超时异常(ConnectTimeoutException):当HTTP请求连接超时时抛出此异常。通常是因为连接到外部系统花费的时间超过了预定的最大连接时间。
  • 请求超时异常(SocketTimeoutException):当HTTP请求发送后,在指定的时间内没有得到响应时,会抛出此异常。通常是由于外部系统处理请求的时间过长或者响应消息丢失造成。
  • 无法建立连接异常(ConnectionRefusedException):当向外部系统发起连接请求时,被拒绝连接时会抛出此异常。通常是由于外部系统关闭或者未启动。
  • 主机不可达异常(UnknownHostException):当通过域名解析得到的IP地址无法与目标主机建立连接时,会抛出此异常。通常是由于网络不可达或者域名解析错误引起。
  • SSL证书异常(SSLHandshakeException):当与外部系统进行HTTPS通信时,验证SSL证书失败时会抛出此异常。通常是由于证书过期、证书不受信任或者证书链不完整等原因引起。

Analysis of HTTP Performance problems
https://www.w3.org/Protocols/HTTP-NG/http-prob.html

Timing breakdown phases explained
https://developer.chrome.com/docs/devtools/network/reference/?utm_source=devtools#timing-explanation

有适合于2万元(人民币)以内小资金的股票量化策略吗? - 徐西摩的回答 - 知乎
https://www.zhihu.com/question/436291669/answer/3101205205

【105】因子择时到底行不行? - llanglli的文章 - 知乎
https://zhuanlan.zhihu.com/p/632461153

【量化课堂】多因子策略入门
https://www.joinquant.com/view/community/detail/fd9bf8d85320864d6718ed35e16d4c6a

二分查找 1000万数据和二分查找 500 万数据的速度变化

$ python3
Python 3.8.10 (default, Nov 14 2022, 12:59:47)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import timeit
>>> timeit.timeit('bisect.bisect(a,3)', 'import bisect;a = list(range(10000000))')
0.40884770452976227
>>> timeit.timeit('bisect.bisect(a,3)', 'import bisect;a = list(range(10000000))')
0.4190584868192673
>>> timeit.timeit('bisect.bisect(a,3)', 'import bisect;a = list(range(10000000))')
0.3647211641073227
>>> timeit.timeit('bisect.bisect(a,3)', 'import bisect;a = list(range(5000000))')
0.3612236827611923
>>> timeit.timeit('bisect.bisect(a,3)', 'import bisect;a = list(range(5000000))')
0.354061558842659
>>> timeit.timeit('bisect.bisect(a,3)', 'import bisect;a = list(range(5000000))')
0.35363607108592987

分区问题

一个表,8000万数据,有三列 id, user_id, created_at,物理设备就一块磁盘。

常用查询(需保证速度): select count(*) from t where user_id = xxx;
不常用的查询(慢点无所谓): select count(*) from t where created_at > '2023-08-06';

A 方案是就存单表,在user_id和created_at上加索引。
B 方案是根据 user_id 分成 5 个 hash 分区,user_id 和 created_at上依旧有索引。

只说常用查询,问 B 方案比 A方案性能快很多吗?为什么?

原文链接:https://blog.csdn.net/Hmj050117/article/details/121349435

指针数如何计算?
假设主键ID为bigint类型,长度为8字节,而指针大小在InnoDB源码中设置为6字节,这样一共14字节。

那么一个页中能存放多少这样的组合,就代表有多少指针,即 16384 / 14 = 1170。那么可以算出一棵高度为2 的B+树,能存放 1170 * 16 = 18720 条这样的数据记录。

同理:
高度为3的B+树可以存放的行数 = 1170 * 1170 * 16 = 21902400

千万级的数据存储只需要约3层B+树,查询数据时,每加载一页(page)代表一次IO。所以说,根据主键id索引查询约3次IO便可以找到目标结果。

金融里的IR和IC是什么

  • IC即信息系数(Information Coefficient),表示所选股票的因子值与股票下期收益率的截面相关系数 ,通过IC值可以判断因子值对下期收益率的预测能力。
  • 当IC的绝对值大于0.05时,因子的选股能力较强,当IR大于0.5时因子稳定获取超额收益能力较强
  • IR即信息比率(Information Ratio),是超额收益的均值与标准谁差之比,IR=IC的多周期均值/IC的标准谁方差,代表因子获取稳定Alpha的能力。

指数列表
https://www.joinquant.com/data/dict/indexData

只要三步,就能让你找到买了就会涨的股票! - 笑看人生886的文章 - 知乎
https://zhuanlan.zhihu.com/p/532831538

SVM 讲解
机器学习在量化交易上有应用吗,效果怎么样? - quantkoala的回答 - 知乎
https://www.zhihu.com/question/534980414/answer/3089883071

求期权的卖方策略,让资金取得长期稳定的低风险高收益? - 東雲的回答 - 知乎
https://www.zhihu.com/question/581979454/answer/2877622828

快速了解 OpenAI 的 fine-tune 和 Embedding 能力 - 人类观察所主任的文章 - 知乎
https://zhuanlan.zhihu.com/p/609359047

https://blog.csdn.net/weixin_39199838/article/details/130810313
利用openai的Chat-3模型fine-tuning训练自己的模型

这四个模型的成本差异比较大,给个直观的示例:我自己准备的10条文本数据(csv文件大小18K)用davinci训练花费是$1.56。

ChatGPT背后的技术-基于人类反馈的强化学习(RLHF)
https://zhuanlan.zhihu.com/p/616708590

OpenAI API (三)Fine-tuning
https://zhuanlan.zhihu.com/p/648714349

一句话解释,Fine-tuning就是在基础模型上根据新的数据训练出自定义模型。

通过Fine tuning,您可以从API提供的模型中获得更多好处,包括:

  • 比提示设计更高质量的结果
  • 能够训练超过提示所容纳的更多示例
  • 由于较短的提示而节省tokens

训练样本越多,效果就越好。数据集大小每翻倍,模型质量线性增加。

数云融合|探究GPT家族的进化之路:GPT-3、GPT-3.5和GPT-4的比较分析
https://zhuanlan.zhihu.com/p/616691512

OpenAI的GPT1,GPT2,GPT3,GPT4系列的模型概览
https://zhuanlan.zhihu.com/p/650057910

AI Canon
https://a16z.com/2023/05/25/ai-canon/

AI Linkedin Post Generator
https://taplio.com/generate-linkedin-posts

为什么有人不愿意承认能上985/211的大多是智商高的? - 走心小哥的文章 - 知乎
https://zhuanlan.zhihu.com/p/561073604

你在国内亲眼见过自己一个人全职做 量化交易、并比同等相近能力的上班族赚得多很多的人吗? - 金融圈笛子的回答 - 知乎
https://www.zhihu.com/question/360042171/answer/2415198507

你在国内亲眼见过自己一个人全职做 量化交易、并比同等相近能力的上班族赚得多很多的人吗? - 知乎
https://www.zhihu.com/question/360042171/answer/1989559460

交易产生手续费一万块,交易所返7500到期货公司,期货公司拿到这个钱,首先要交掉大约6.7%左右的税,这个是没办法免的,这以后才给你返90%或95%,事实上你到手的返佣/你交出去的手续费,大概就是50~60%这样。上期所会高很多,INE会低很多。当然这个月INE90%了,综合返率本月会上到70%+

托管机房里机器到交易所的RTT也就350us左右,标准差没几个us。

高频看不看K线,就跟造房子看不看牛顿三定律一样。K线是基石,但过于基础了,现在的做法已经在K线、微观之上,叠了太多太多太多的东西了,绝不是“肉眼看K线形态”这种电视股票脱口秀的东西了。

请教您行情源您用的是哪个呢?我不太懂,难不成您是用的ctp,然后直接tcpdump抓包,分析协议以后再进fpga处理?
直接交易所进期货公司第一级交换机的镜像数据。如果你也是同行,详询期货公司,这个现在已经普及了。

Elasticsearch:普通检索和向量检索的异同?
https://ost.51cto.com/posts/11561

如果你在搜索时不知道确切的query 词元,或者你希望能对更广泛的同/近义词所指向的内容进行召回,可以考虑通过向量搜索来完成
他们大多会具有以下一些特点:

1.较慢的索引速度
2.较大的索引大小
3.较慢的查询速度(在大数据量的场景)
4.限的缩放比例
5.(对于精确匹配)具有较低的精度
6.较差的词元和词组的搜索能力
7.通过向量(某些解决方案中可以包含一部分标量字段)进行召回
8.对近似语义的捕获程度较高,可以很好的处理同/近义词

OpenAI的新功能:Function Calling - BitByBit的文章 - 知乎
https://zhuanlan.zhihu.com/p/637107426

202307

english

余光中:怎样改进英式中文?- 论中文的常态与变态
https://open.leancloud.cn/improve-chinese/

前谷歌工程师的英语频道
https://www.youtube.com/watch?v=pDehb5xQfWc

英语口语教程
https://www.youtube.com/@SpeakEnglishWithTiffani/videos

https://engineering.linkedin.com/blog/2021/leveraging-behavior-analytic-computation-for-anti-abuse-defenses

Behavior analytic computation, on the other hand, can provide high quality features for bot-driven attacks without collecting extra user data.

The idea of behavior analytic computation is to capture the key bot/automation signatures hidden among the existing feature values or numbers—these signatures can be preserved even if the features are constantly changed.

It intelligently utilizes simple arithmetic and logarithmic operations to transform existing features into more robust ones in constant time.
Two key operations of behavior analytic computation are ratio and logarithm.
Ratio can capture the relative change of numbers instead of absolute numbers;
logarithm can amplify particular ratio values that differentiate bot/automation traffic and human traffic patterns.

When two features are independent of each other, statistically we will see some kinds of natural distributions between them.
Assuming X and Y are two feature types, xi and yi are values of the feature, respectively.
When a particular value x1 is selected and the request numbers from top values of Y within a certain time period are sorted descendingly, the distribution of different yi count can be obtained.

Another example where behavior analytic computation can contribute is by improving the quality of counters.
Counters are commonly used against large-scale abuse,
as higher counter values typically reflect the likelihood of automation-driven abuse.

However, certain behavioral and structural information that is not captured by counters will also be missed by models if only typical counters are used as the features.

Fig. 2 shows two examples of the requests from a single user within one hour where the x-axis is time and y-axis is the request index.

The counter values for both cases are identical, but different behaviors are shown.

While there is no obvious automation evidence found on Fig a, the requests on Fig b contain certain regular patterns indicating automation behind the scenes.

Behavior analytic computation again captures such a plot signature into a single automation score where more human-like plots (Fig. 2(a)) have lower scores and automation-like plots (Fig. 2(b)) have higher scores.

The extracted score is able to capture the key automation pattern even if users constantly adjust different regularities within the same time period.

The same lightweight computation continues to provide speed and flexibility to the defense.

More importantly, the extracted automation score is able to fill the gap where typical counters fail to differentiate between human requests or bot-driven automation requests at low counting numbers.

Due to its capability to detect low-frequency automation, this extracted automation score has almost doubled our machine learning model recall on detecting automation-driven abuse at LinkedIn.

Overall, we are able to leverage behavior analytic computation for our anti-abuse defense from three different aspects:

Behavior analytic computation can capture automation signatures as robust features,
thus improving model and rule resilience against fast-changing attacks.
When defending against an actual dynamic attack,
the extracted feature can bring significant robustness improvements

  • greatly extending the time of protection by more than two orders of magnitude.

The other key merit of behavior analytic computation is the ability to expand abuse labels.
The typical anti-abuse defense is based on supervised models.
However, for many bot-driven abuse types, such as scraping or account takeover,
often only a small portion of all abusive requests/users are labeled,
which limits the effectiveness of the models.

Behavior analytic computation
provides an unsupervised approach
where each extracted automation signature
can perform as an automation detection classifier.
Those signatures have helped
expand the overall recall
when defending against bot-driven large-scale attacks
in many abuse verticals at LinkedIn.

Overall, we are able to
leverage behavior analytic computation
for our anti-abuse defense
from three different aspects:

As bad actors can
persistently adapt to penetrate existing defenses
and additional applications on the platform
can provide entry points
for new abuse scenarios,
anti-abuse defense
inevitably needs to continually handle
new abuse scenarios and behaviors.

Quick turnaround to the new abuse activities
becomes critical to properly contain the overall damage.
Unlike other robust features,
such as browser or device fingerprinting,
which often require longer engineering time and higher cost to onboard,
behavior analytic computation
can provide a prompt response
to evolving attack signals
to mitigate the threat.

When facing new abuse scenarios
where early assessment of existing features
is critical to define anti-abuse strategy,
behavior analytic computation’s lightweight extraction
can also offer fast offline analysis
and quick preliminary defense onboarding.

Bad actors will always continue to change
and evolve their behaviors,
so resilience of the defense and fast turnaround
are essential to ensure long lasting anti-abuse success.
Behavior analytic computation is a newer concept
that offers a lightweight and quick defense onboarding
based on existing features,
while preserving member privacy.

The extracted automation signatures
can not only enrich the feature set,
enhancing defense robustness,
but also provide expanded abuse labels
to significantly improve incident response time and coverage
for large-scale bot-driven attacks.

Fighting abuse at LinkedIn
is an ongoing effort
requiring extensive collaboration
between multiple teams.
I would like to acknowledge our partners from the following teams,
without whom this would not have been possible:

架构

技术架构评审需要考虑的问题-朱晔

  • 组件选型
    • A 不是开源的,出了问题怎么办?
    • B 虽然是开源的,但是是 Erlang 写的,公司没人能看懂怎么办?
    • C 我看待解决的 Issues 还有很多,有没有去了解过?
    • 这个组件在性能方面你是否了解过?
    • 开源的免费版本不支持集群怎么办?
    • 如果彻底要自己写这个组件有没有可能性?
  • 性能
    • 整体设计上会做到的 TPS、QPS 和 RT 是多少?
    • 随着数据量的增大系统性能会不会出现明显问题?
    • 系统哪个环节会是最大的瓶颈?
    • 是否打算做压力测试,压力测试方案是怎么样的?
    • 怎么提高前端用户的访问流畅性?
  • 可伸缩性
    • 每一个环节是否都是可以横向扩展的?
    • 扩容需要怎么做手动还是自动?
    • 数据库不能横向扩展怎么办?
    • 纵向扩展有多少效果?
    • 横向扩展是否是线性的?
    • 扩展后是否可以提高响应速度?
  • 灵活性
    • 是否有了解过产品层面以后会怎么发展?
    • 模块 A 是否能拆分出去独立为其它业务服务?
    • 模块 B 是否可以替换为另一种第三方数据源?
    • 如果流程有变,需要多大的工作量来适应?
    • 业务是否可以做到可配?
  • 可扩展性
    • 为什么 A 和 B 都有差不多的逻辑?
    • 是否考虑到了 A 业务的实现以后还有 B 的可能性?
    • 如果现在有两种策略以后扩展到了八种策略怎么做?
    • 以后是否可以把这个业务的 H5 前端适配到 PC?
  • 可靠性
    • 是否架构中有单点?
    • 故障转移是怎么实现的?
    • 集群内部故障转移需要多久?
    • MQ 或存储出现问题的时候系统会怎么样?
    • MQ 或存储出现问题又恢复了系统是否会自己恢复?
    • 是否考虑过异地故障转移的方案?
    • 是否考虑过多活的方案?
    • 是否有数据丢失的可能性?
    • 数据丢失后是否可以恢复?
    • 系统彻底挂了对其它业务的影响是什么?
    • 系统彻底挂了是否可以有线下的方式走业务?
  • 安全性
    • 是否彻底避免 SQL 注入和 XSS?
    • 是否做了风控策略?
    • 是否有防刷保护机制?
    • 数据库拖库了会怎么样?
    • 是否有数据泄露的可能性?
    • 数据的权限怎么控制的?
    • 功能的权限是怎么控制的?
    • 是否做了日志审计?
    • 受到了 DDOS 攻击怎么办?
    • 数据传输是否加密验签?
  • 兼容性
    • 老的系统打算怎么办?
    • 怎么进行新老系统替换?
    • 新老系统能否来回切换?
    • 别的系统怎么连接你这套新服务?
    • 上下游依赖是否梳理过,影响范围多大?
    • 上下游改造的难度怎么样?
    • 上下游改造有排期吗?
    • 上下游改造的计划和通知时间确定了吗?
    • 使用了新的数据源数据怎么迁移?
    • 使用了新的技术老项目开发能否适应?
  • 弹性处理
    • 这个数据重复消费会怎么样?
    • 这个接口重复调用会怎么样?
    • 是否考虑了服务降级?哪些业务支持降级?
    • 是否考虑了服务熔断?熔断后怎么处理?
    • 是否考虑了服务限流?限流后客户端表现怎么样?
    • 队列爆仓会怎么样?
    • 是否考虑了隔离性?
  • 事务性
    • 这段业务由谁保证事务性?
    • 数据库事务回滚后会怎么样?
    • 服务调用了失败怎么办?
    • 队列补偿怎么做的?
    • 服务调用补偿怎么做的?
    • 数据补偿实现最终一致需要多久?
    • 在数据不完整的时候用户会感知到吗?
  • 可测试性
    • 测试环境和线上的差异多大?
    • 是否支持部署多套隔离的测试环境?
    • 是否打算做单元测试,覆盖率目标是多少?
    • 测试黑盒白盒工作量的比例是怎么样的?
    • 是否支持接口层面的自动化测试?
    • 是否有可能做UI自动化测试?
    • 压测怎么造数据?
    • 是否可以在线上做压测?
    • 线上压测怎么隔离测试数据?
    • 是否有测试白名单功能?
  • 可运维性
    • 每一个组件对服务器哪方面的压力会最大?
    • 重新搭建整套系统最快需要多少时间?
    • 系统是否可以完全基于源代码构建?
    • 系统是否有初始化或预热的环节?
    • 系统里哪些环节需要人工参与?
    • 数据是否需要定期归档处理?
    • 会不会有突发的数据量业务量增大?
    • 随着时间的推移如果压力保持不变的话系统需要怎么来巡检和维护?
    • 怎么在容器里进行部署?
  • 监控
    • 业务层面哪些指标需要监控和报警?
    • 应用层面系统内部是否有暴露了一些指标作监控和报警?
    • 系统层面使用的中间件和存储是否有监控报警?
    • 是否所有环节都接入了全链路跟踪?
    • 出现报警的时候应该由谁来处理?
    • 每一个模块是否有固定的主要和次要负责人?
    • 有没有可能系统出了问题无法通过监控指标体现?
    • 哪些指标需要上大屏由监控进行7*24监控?

mysql

使用delete删除mysql数据的时候,mysql并没有把数据文件删除,而是将数据文件的标识位删除,没有整理文件,因此不会彻底释放空间。被删除的数据将会被保存在一个链接清单中,当有新数据写入的时候,mysql会利用这些已删除的空间再写入。即,删除操作会带来一些数据碎片,正是这些碎片在占用硬盘空间。 -

optimize table table_name
alter table table_name engine=engine_name

该方法通常用于切换表的引擎,例如MyISAM转为InnoDB,但是同样适用于释放表空间,只不过切换后的引擎和原来的engine相同罢了。

注意事项

  • 这两种方式都适用于我们常用的表,myisam和innodb。
  • 优化表的时候会锁表,数据表越大,耗时越长,因此不要在网站忙时进行表优化。

MySQL进阶三板斧(三)看清“触发器 (Trigger)”的真实面目
https://zhuanlan.zhihu.com/p/158670286

How to detect rows with chinese characters in MySQL?
https://stackoverflow.com/questions/9795137/how-to-detect-rows-with-chinese-characters-in-mysql

Notice the Chinese Character is from E4 to E9, hence we use the code

select number 
from Chinese_Test
where HEX(contents) REGEXP '^(..)*(E[4-9])';

python

如何使用Python画QQ图
https://blog.csdn.net/neweastsun/article/details/125859614

import numpy as np

np.random.seed(0)
data = np.random.normal(0,1, 1000)

import statsmodels.api as sm
import matplotlib.pyplot as plt

fig = sm.qqplot(data, line='45')
plt.show()

QQ 图的 X 轴是理论分位数,这意味着显示不是实际数据,而是实际数据在正态分布下的位置。
Y 轴显示实际数据。这意味着如果数据值沿45度角的大致直线下降,那么数据分布服从正态分布。

一文让你彻底搞懂最小二乘法(超详细推导)
https://blog.csdn.net/MoreAction_/article/details/106443383

用Python实现最小二乘算法
https://zhuanlan.zhihu.com/p/115648166
https://blog.csdn.net/weixin_43693650/article/details/120295362
https://blog.csdn.net/weixin_44231148/article/details/107149604
https://www.cnblogs.com/NanShan2016/p/5493429.html

from scipy.optimize import leastsq

def fun(p,x): #回归模型函数
    k,b = p
    return k*x+b

def error(p,x,y): #误差
    return fun(p,x)-y

p0 = np.array([1,3])
para = leastsq(error,p0,args=(Xi,Yi))

k,b = para[0]
  • 现实生活中我们可以利用最小二乘法解决更为复杂的问题。
  • 比方说有一个未知系数的二元二次函数 f(x,y)=w0x^2+w1y^2+w2xy+w3x+w4y+w5,这里 w0~w5 为未知的参数,为了确定下来这些参数,将会给定一些样本点 (xi,yi,f(xi,yi)),然后通过调整这些参数,找到这样一组 w0~w5,使得这些所有的样本点距离函数f(x,y)的距离平方之和最小。
  • 至于具体用何种方法来调整这些参数呢?有一种非常普遍的方法叫“梯度下降法”,它可以保证每一步调整参数,都使得f(x,y)朝比当前值更小的方向走,只要步长 α 选取合适,我们就可以达成这种目的。
  • 而这里不得不提的就是神经网络了。神经网络其实就是不断调整权值 w 和偏置 b,来使得cost函数最小,从这个意义上来讲它还是属于最小二乘法。
  • 更为可爱的一点是,神经网络的调参用到的仍是梯度下降法,其中最常用的当属随机梯度下降法。
  • 而后面伟大的 bp 算法,其实就是为了给梯度下降法做个铺垫而已,bp 算法的结果是 cost 函数对全部权值和全部偏置的偏导,而得知了这些偏导,对于各个权值 w 和偏置 b 该走向何方就指明了方向。
  • 因此,最小二乘法在某种程度上无异于机器学习中基础中的基础,且具有相当重要的地位。

线性回归是确定两种及两种以上变量的相互依赖关系。在数据分析中,线性回归是最简单且最有效的分析方法。
举个简单的例子,某商品的利润在售价为 2 元、5 元、10 元时分别为 4 元、10 元、20 元,我们很容易得出商品的利润与售价的关系符合直线:y=2x. 在上面这个简单的一元线性回归方程中,我们称 “2” 为回归系数,即斜率为其回归系数,回归系数表示商品的售价(x)每变动一个单位,其利润(y)与之对应的变动关系。

from numpy.linalg import inv  # 矩阵求逆
from numpy import dot  # 矩阵点乘
X = np.array([[1],[2],[3]])
Y = 2*X
#theta = (X.T*X)^-1X.T*Y
theta = dot(dot(inv(dot(X.T,X)),X.T),Y)
print(theta)

即X的转置与X点乘,再求逆, 再与X的转置点乘,再与Y点乘,一层层加括号即可。

python实现线性回归之最小二乘法,最小二乘法详解
https://blog.csdn.net/m0_38075425/article/details/90738415/

Thonny,更适合青少年学习编程的IDE工具。
https://zhuanlan.zhihu.com/p/464253266?utm_id=0

  • Python 编程工具比较多样,像比较入门的 Mu Editor,项目在用的 Pycharm、Pydev 等等
  • Thonny 由爱沙尼亚的 Tartu 大学开发,它的调试器是专为学习和教学编程而设计的,针对初学者学习 Python 语言优化了很多工具上的方式和方法

错误处理
Go

func main() {
   f, err := ioutil.ReadFile("test.xml")
   if err != nil {
      fmt.Println(err)
   } else {
      fmt.Println(f)
   }
}

Rust

fn main() {
    let f = File::open("hello.txt");
    match f {
        Ok(file) => {
            println!("File opened successfully.");
        },
        Err(err) => {
            println!("Failed to open the file.");
        }
    }
}

Java

try {
    File file = new File("test.txt");
    FileReader reader = new FileReader(file);
} catch (FileNotFoundException e) {
    System.out.println("文件不存在!");
} catch (IOException e) {
    System.out.println("文件读取失败!");
}

NodeJs

fs.readFile('file.txt', 'utf8', function (err, data) {
    if (err) rerurn console.log(err);
    console.log(data)
});

好的,对于普通可逆的矩阵,我们可以使用高斯-约当消元法来计算它的逆矩阵。这个算法包括三个步骤:

  1. 构造增广矩阵:将一个大小为 (N, 2N) 的增广矩阵创建为原始矩阵和单位矩阵的水平拼接。
  2. 对增广矩阵进行行变换:通过一系列行变换将增广矩阵变成上三角形矩阵。
  3. 反向代入:通过反向代入的方式,将上三角形矩阵转换成单位矩阵,同时右侧的部分即为原始矩阵的逆矩阵。

下面是一个用 Rust 实现这个函数的例子:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
fn matrix_inverse(matrix: Vec<Vec<f64>>) -> Option<Vec<Vec<f64>>> {
let n = matrix.len();

// 构造增广矩阵
let mut augmented_matrix = vec![vec![0.0; 2 * n]; n];
for i in 0..n {
for j in 0..n {
augmented_matrix[i][j] = matrix[i][j];
}
augmented_matrix[i][i + n] = 1.0;
}

// 行变换,将增广矩阵变成上三角形矩阵
for i in 0..n {
if augmented_matrix[i][i] == 0.0 {
// 如果主对角线上的元素为零,则矩阵不可逆
return None;
}
for j in i + 1..n {
let ratio = augmented_matrix[j][i] / augmented_matrix[i][i];
for k in 0..2 * n {
augmented_matrix[j][k] -= ratio * augmented_matrix[i][k];
}
}
}

// 反向代入,将上三角形矩阵变成单位矩阵以及右侧的部分即为逆矩阵
for i in (0..n).rev() {
for j in 0..n {
let mut sum = 0.0;
for k in i + 1..n {
sum += augmented_matrix[i][k] * augmented_matrix[k][j + n];
}
augmented_matrix[i][j + n] = (augmented_matrix[i][j + n] - sum) / augmented_matrix[i][i];
}
augmented_matrix[i][i] = 1.0; // 对角线上的元素变成1
}

// 提取逆矩阵部分并返回
let mut inverse_matrix = vec![vec![0.0; n]; n];
for i in 0..n {
for j in 0..n {
inverse_matrix[i][j] = augmented_matrix[i][j + n];
}
}

Some(inverse_matrix)
}

fn main() {
let matrix = vec![
vec![1.0, 2.0],
vec![3.0, 4.0],
];
let inverse_matrix = matrix_inverse(matrix).unwrap();
println!("{:?}", inverse_matrix);
}

你可以将你的矩阵作为参数传递给 matrix_inverse 函数,并得到其逆矩阵作为返回值。请注意,这个函数假设矩阵是可逆的,并且不对输入进行验证。

OAuth2.0 原理流程及其单点登录和权限控制
https://kefeng.wang/2018/04/06/oauth2-sso/

游戏

Rpg maker 教程1:RM系列软件异同
https://zhuanlan.zhihu.com/p/59197226

java

https://blog.csdn.net/wdays83892469/article/details/126216765

Java AOT 在经过一波三折的发展后,目前最为成熟可行的方案就是 GraalVM Native Image,它所带来的优势是显著的:

  • 更快的启动速度、
  • 更小的内存消耗、
  • 脱离JVM独立运行 。

但对应的,它也存在着非常多的限制,尤其是在充满了反射等动态特性的 Java 工程生态圈,很难得到大规模的广泛应用。

总的来说,Java AOT目前是有着明确使用场景的一种技术,主要可以应用于:

  • 编写命令行 CLI 程序,希望程序可以完整独立运行而不是需要额外安装JVM。
  • 运行环境资源严重受限的场景,例如 IoT 设备、边缘计算等场景。
  • 希望追求极致的启动速度,并且应用逻辑相对足够轻量,如 FaaS。

Java 9 ~Java 17 主要更新了什么?
https://www.zhihu.com/question/513873484/answer/2328624634

Spring Boot 最新版3.x 集成 OAuth 2.0实现认证授权服务、第三方应用客户端以及资源服务
https://blog.csdn.net/friendlytkyj/article/details/128889875

https://blog.csdn.net/hxx688/article/details/127035172
https://blog.csdn.net/qq_50909707/article/details/127165284

Spring Security OAuth停更了?探索官方进化版Spring Authorization Server的革新之处!
https://blog.csdn.net/citywu123/article/details/131080947

OAuth2一些常见问题的QA
https://felord.cn/oauth2-qa.html

前端

Chrome 80.0中将SameSite的默认值设为Lax,对现有的Cookie使用有什么影响?
https://www.zhihu.com/question/373011996/answer/2442976854?utm_id=0

The Marketing Secrets Apple & Tesla Always Use: Rory Sutherland | E165
https://www.youtube.com/watch?v=Hz3RWxJck68

后台

Fast, secure data deduplication solutions
https://redis.com/solutions/use-cases/deduplication/

RedisBloom: Probabilistic Data Structures for Redis
https://github.com/RedisBloom/RedisBloom

bloom filter之所以能做到在时间和空间上的效率比较高,是因为牺牲了判断的准确率、删除的便利性

  • 存在误判,可能要查到的元素并没有在容器中,但是 hash 之后得到的k个位置上值都是 1。
    • 如果 bloom filter 中存储的是黑名单,那么可以通过建立一个白名单来存储可能会误判的元素。
  • 删除困难。一个放入容器的元素映射到 bit 数组的 k 个位置上是1,删除的时候不能简单的直接置为0,可能会影响其他元素的判断。
    • 可以采用Counting Bloom Filter

测试
235w url, 占内存才 14M

Redis:HyperLogLog使用与应用场景
https://zhuanlan.zhihu.com/p/445885116

布隆过滤器的误判率该如何计算? - 领创集团Advance Group的回答 - 知乎
https://www.zhihu.com/question/38573286/answer/2750794079

过滤器中有 1 亿个元素, k 取值为 14,那么需要空间约为 20 亿 bit ( 238MB )
误报率是2.019*10^9

期权

买近卖远,卖近买远——好难把握的日历价差
http://options.hexun.com/2020-11-06/202380118.html

买近卖远

  • 图形和买跨有些类似, 都是中间震荡会亏损,两边大幅突破会盈利。但是稍微带点曲度。
  • 认购日历来说,如果大涨,希望近月涨的多,远月涨得少,那就赚了;
  • 如果大跌,希望近月跌有限,远月跌的多点,那也还是赚的。
  • 如果一直震荡,平值期权到期归零,远月还有价值,则整体可能亏损。
  • 买近卖远的目的还有一个
    • 就是希望在远月波动率比较高的时候(希腊字母vega相关),能赚取远月降波的收益
    • 同时,近月的gamma比较高,希望波动大点。

卖近买远

  • 图形类似于卖跨的损益图。
  • 希望标的近期震荡,然后再涨或者跌,把近月时间价值损耗完。
  • 通常笔者用于卖方末日轮的对冲。
  • 还可以赚取远月升波的收益。

策略难点

  • 该组合的价差,在日内基本上横在一个数值附近,远月近月合约涨跌的金额基本对等~全天来看,收益极少。
  • 日历策略的影响因素比较多:
    • 近月远月合约的涨跌金额
    • 近月远月合约的波动率升降规律
    • 上涨时谁上涨的多,下跌时谁下跌的少。
    • 标的窄幅震荡时,这个因素更没有可控性。

期权卖方终极指南-第七章:如何正确交易日历价差
https://zhuanlan.zhihu.com/p/443166257

本章将主要讨论做多日历价差,也就是买入远期的认购合约 卖出近月认购合约。

日历价差的最大亏损就是建仓付出的权利金之差,比如上述苹果的例子,每组损失 = 340美元。

平值日历价差的希腊字母如下:

  • Delta 中性 - 建仓时我们对于股价运动方向不敏感
  • 空 Gamma - 快速的上涨或下跌将使我们亏损
  • 多 Theta - 其他条件不变时,随着时间的推移我们会挣钱
  • 多 vega - 隐波上升时我们会挣钱

本质

  • 认为日历价差实际上多 vega 实际上是大多数人犯的错误
  • 日历价差的真正意义 - 针对远期隐波(Forward Volatility)下注
  • 日历价差实际上是在交易 gamma 和 vega 的相对值。
  • 可以认为日历价差做空 gamma 的同时用 vega 对冲,或者说针对远期隐波下注。
  • 7 月合约的损益主要来自 gamma,而 9 月合约的损益主要来自 vega。
  • 实际上,在日历价差中,波动率的变化带来的盈亏,会被期限结构完全对冲。

假如你得到消息某个制药公司将要在 9 月 1 日公布一个新药,此时不同合约的隐波如下:

七月 = 30%
八月 = 30%
九月 = 30%
十月 = 30%

  • 现在我们知道 9 月份会有一个大新闻,其他人并不知道。因此 9 月合约的隐波应该比现在的更高才对,那么我们就卖出八月合约同时买入九月合约。
  • 这样,当新药公布后 9 月合约的隐波将会上涨,我们的日历价差组合也会盈利。
  • 究其原因,这种隐波的变化并非是跨期的,近月的隐波没有变化。我们建立组合时买入的远期隐波 = 30%,而八月结束后,隐波上升了,所以我们赚钱了。

波动率锥可以帮我们评估对于同一行权价的合约,哪个到期日的合约的隐波被高估或者低估。

  • 比如说如果我们看到一张合约 30 日到期的隐波 = 80, 120 日到期的隐波 = 80,
  • 由于期限结构的存在,我们可以认为 120 日的隐波被高估了,特别是当股票的实际波动 = 100时,30 日隐蔽显然被低估了。
  • 对于这种情况,我们应该做空日历价差,卖出 120 日合约 + 买入 30 日合约。
  • 这个组合表达的观点是,gamma 相对于 vega 更便宜,所以我们做多 gamma,做空 vega。

讲讲低风险套利——日历价差
https://zhuanlan.zhihu.com/p/375927451

什么是波动率?它代表市场上人心的看法,买的人多就会升波,卖的人多就会降波。

围绕做空波动率这个核心,我们开展开讲讲什么时候做正(卖近买远),什么时候做反(买近卖远)。

  1. 如果股市一直打横,那所有合约波动率将趋于统一。股市震荡才是常态,高位似尖峰,终将回落。
  2. 如果市场认为最近市场要跌(买沽多),沽合约近月合约波动率先行升波,远月合约波动率滞后后行,反之亦然
  3. 如果市场认为最近市场跌无可跌(卖沽多),那沽合约近月波动率会降得比远月更低
  4. 远月合约价值高,一旦升波增长幅度会更大,反之亦然
  5. 近月合约时间价值消减数倍于远月

由上述原因我根据观察推出几个心得:

  • 如果近月波高,远月波低,那我们做正日历(卖近买远)。正日历乃王道,它完美贴合第1、4、5点的理念。因此它收益是最高的。
  • 如果近月波低,远月波高,那我们做反日历(买近卖远)。反日历做为正日历的补充,因为第2、3点的关系,它更温和稳健,回撤也更小。
  • 市场不可能又看涨(购合约),又看跌(沽合约),所以它们购沽双方经常一个适合做正,一个适合做反。可互为补充来选择适合自己的组合。

202306

linux

ModSecurity3_Nginx 指南
https://www.jianshu.com/p/d22f3914d153

理财

加仓方法

https://mp.weixin.qq.com/s/vBI_JG20xEDiWaqKVc8NXw

  • 定投加仓法:
    • 每个月设定一个或者多个定投日,只在定投日买入基金固定的金额。
    • 适合于那些没有过多时间精力投入到研究市场估值、宏观经济状况等因素的投资者。
  • 指数加仓法:
    • 根据单日指数的跌幅来决定是否加仓的。
    • 这最好是有纪律性的,而不是凭感觉。
      • 比如当单日跌幅大于某个数值,就可以加仓;
      • 或者近几日跌幅大于某个数值,就加仓。
    • 沪深 300 指数近 20 年单日跌幅超过一定比例的次数和概率
      • 单日跌幅超过 1% 的有 954 次,发生的概率是 20%;
      • 单日跌幅超 2% 的有 368 次,发生概率是 8%。
      • 具体按多少加仓,就看你想触发的加仓概率是多少。
    • 为了防止市场跌跌不休,指数的跌幅一直超过设定的参数,还需要加一个参数,
      • 即“ n 个交易日不重复触发”,通常可以选择 3、5、10 个交易日。
  • 正金字塔加仓法:
    • 简单地说,就是跌的越多,买的也越多。
    • 例如,投资者可以把资金分为6份,
      • 当下跌达10%时,加仓一份,也就是1/6。
      • 当下跌达20%时,加仓两份,也就是2/6。
      • 当下跌达30%时,加仓三份,也就是3/6。
      • 当然了,在按批次加过仓后,如果你还有充足的资金,可以继续加仓,
        一直到你觉得市场不在被低估为止,结束加仓。
    • 这种加仓的方法需要在开始投资之前,就确立好准备投入的总资金额,以便于将资金分配。
    • 到底跌多少再加仓,最好结合基金的回撤,这就引申到了下一个加仓方法。
  • 回撤加仓法:
    • 根据基金的回撤来买入。可以是等额买入,也可以是正金字塔买入。
    • 第一种,把 1 万元分成三等份,每跌 10%,补一份,就属于等额买入。
    • 第二种,把 1 万元分成三份,注意不是三等份,
      • 第一份占资金的 1/6,第二份占资金的 2/6,第三份占资金的 3/6,
      • 这就属于正金字塔买入,拉低成本价的效果更加明显。
    • 如果基金没跌这么多呢,比如跌了20%,万一只补仓了一点怎么办?
      • 假设跌 14%,补仓 = 10000*14%/42%=3333.33 元;
      • 然后跌到 20% 的时候,还可以补仓,补仓金额 = 10000*20%/42% - 第一次补仓的金额
        = 4761.90-3333.33=1428.57 元。
      • 如果跌到 25%,还可以继续补。
  • 对比:
    • 定投加仓法
      • 优势: 简单易操作、适合小白和繁忙上班族、资金支出稳定
      • 劣势:缺少对于市场估值的判断、跌幅较大的时候买的少
    • 正金字塔式加仓法
      • 优势:更低的持仓成本、总资金量确定、 可以与回撤加仓法搭配使用
      • 劣势:小回撒导致加仓不足
    • 回撤加仓法
      • 优势:资金投入灵活、参照历史最大回撒跌也不慌
      • 劣势:极端行情导致回撒超出、需较多精力跟踪回撒,小回撒导致加仓不足
    • 指数加仓法
      • 优势:直观易懂,明确下跌带来的机遇
      • 劣势:特定基金与指数相关性低,资金量不确定,跌幅闭值设罟难度大

雷公

趋势交易流程:

  1. 当前趋势的方向是怎样的?
  2. 趋势的斜率(时钟方向)是怎样的?
  3. 你打算交易的方向是怎样的?
  4. 你的预期是怎样的?
  5. 满足怎样的条件止盈出局?
  6. 你的底线是什么?
  7. 满足怎样的条件止损出局?
  8. 根据5、7两项计算理论盈亏比。
  9. 这笔交易你能承受的最大亏损金额是多少?
  10. 根据9.来确定持有头寸数量。

我的持仓构成:

  • 首先,大盘指数是机会成本,这部分投资占比30%以上;
  • 其次,个股投资主要分为两类:
    • 1)垄断巨头企业(长期持有)和
    • 2)动量交易(短期投机)。
    • 个股投资部分占比不超过30%;
  • 此外,我还持有30%左右的固定收益类品种,以此获取日常现金流。
  • 最后,10% 左右的备用金,以防不测。

日常现金流

  • 作为职业投资者,我的日常现金流主要就是来自固定收益类品种。
  • 持有债券还是持有高息存款,取决于两者的现金分红率的高低。
  • 目前我主要持有 GIC,平均利率在 4.5% 左右。
  • 最后,10% 备用金主要用于在市场不好的时候作对冲。

趋势的五种类型与交易策略

  • 第一类:1点钟~12点钟方向,斜率加速上涨的趋势。
    • 这类属于斜率加速的行情,通常出现在趋势刚开始的阶段,或者是趋势即将结束的阶段。
    • 交易策略:
        1. 无持仓,不参与;
        1. 有持仓,不急于兑现。
        1. 关注市场转向的迹象,等待明确出现关键性波动之后再考虑兑现出局。
  • 第二类:2点半~1点钟方向,稳定的上涨趋势。
    • 这类趋势的斜率稳定,可以走很长时间,是大行情的摇篮。
    • 交易策略:
        1. 趋势形成过程中,第一次回撤到短期均线、中期均线、长期均线,都是非常好的进入位置;
        1. 回撤有可能击穿均线,但不应改变均线运行方向;
        1. 进入时机:底部构造+低一级别多头排列
  • 第三类:2点半~3点半方向,横向整理姿态的趋势。
    • 这种类型的趋势也称之为「密集成交区」,通常是大周期趋势的中途休息站。
      休整结束之后,通常会延续原有大周期趋势的方向。
    • 交易策略:
        1. 横向波动的时间要足够长、均线密集之后;
        1. 在突破密集成交区之前完成了均线多头排列,可进入,赌突破。
  • 第四类:3点半~5点钟方向,稳定的下跌趋势。
    • 这类趋势的方向与第二类相反,交易策略相同但方向相反。
      第五类:5点钟~6点钟方向,加速下跌的趋势。
    • 这类趋势的方向与第一类相反,交易策略相同但方向相反。

操作个股是否需要以大盘指数为参考?

  • 不需要。
  • 我的每一只股票都会有各自的止损或止盈位置的设定,这些设定并不依据大盘指数为参考。
  • 很多时候,大盘还处在弱势格局,但是有一些股票已经满足交易条件,我就会进入交易,不理会大盘。
  • 同理,很多时候,大盘尚处在强势,而我的股票却已经纷纷触发止盈止损出局,我同样也不会理会大盘。
  • 在大盘很弱的时候,满足进入条件的股票却越来越多,这说们市场即将走强。
  • 相反,当满足退出条件的股票越来越多,而大盘还处在强势,这种强势大概率是虚假的。

雷公的 TradingView指标

掌握这些概念,我想你会想明白很多事情

  • 美元 是全球的资本成本,
  • 美债 是美元的资本成本,
  • Bitcoin 反应投机资本的活跃度。

杂项

  • 为了反对而反对,这是初学交易者最容易犯的错误。
  • 优秀的交易者在头脑中同时存在正反两方面的意见,不断地自我博弈过程,动态调整方向。
  • 你不必反驳任何人的观点,没有人掌握真理,多数人只是在表达情绪。
  • 请记住,你最大的对手,就是你自己——不要让情绪降低了智商。

杂项

  • 在我的词典中是没有「主力」「大户」这类假想敌的。
  • 我每次亏损并不是有人故意陷害所致,事实上,往往是我没有计划的随机交易、或者有计划却未能坚决执行时对我的伤害最大。
  • 交易者最大的对手不是别人,就是你自己。

杂项

  • 交易,不是一场「猜涨跌」的游戏。
  • 交易,是一门生意。你需要知道怎样更容易赚到钱;
  • 你需要拥有一个在你睡觉时也能为你赚钱的系统;
  • 你需要界定你的退出机制。

风险量化:

  • 交易资金管理的核心是风险数量化。 我的每一笔交易都设有止损价格。
  • 依据止损价格来明确每一笔交易的最大损失金额,由此倒算出我应该持有的头寸数量,这就是风险量化。
  • 每一笔交易都有对应的风险值,整个 Portfolio 的风险就可以数量化。
  • 这样就很清楚在极端情况下总体风险有多大。
  • 最重要的是,可以根据总体风险值来设计对冲策略。

亏钱原因:

  • 不懂看图,是绝大多数人在金融市场亏钱的主要原因;
  • 把图画得太复杂,是绝大多数会看图的人亏损的主要原因;
  • 试图找到一个决胜指标或者某个神奇数字,又是多数人在建立交易系统过程中亏钱的主要原因。
  • 在金融市场里长期获利,我认为以下两个认知非常重要。所有的方法工具都必须围绕这两点展开:
      1. 识别趋势。什么时候市场运动的方向对我有利,什么时候不利。不利的时候,不要参与或者出局;
      1. 趋势对我有利的时候,要抱住不放。直到趋势开始对我不利。 简而言之:认清趋势,让时间成为朋友。

币圈的繁荣,

  • 1)是建立在全球流动性泛滥基础上的,
  • 2)是传统投资领域(股市债市房地产)资本外溢的结果,
  • 3)在高速发展过程中的制度性漏洞被充裕的流动性掩盖。

做投资两件事最重要:

  • 第一,你必须要知道风险在哪,风险必须可以数量化;
  • 第二,你也必须要有办法对冲风险。有办法对冲的风险就不是风险,暂时没办法对冲的风险就不要去碰。
  • 本质上说,投资是在解决一系列风险问题的同时并获取回报的过程。
  • 风险越大、不确定性越大,你最终获取的回报也就越大。

英语

听力练习
https://www.youzack.com/ListeningExercise/Episode/3668/?mediaType=audio

腾讯微云网盘:
https://share.weiyun.com/ChATk7JK
请安装微云网盘客户端APP后,用客户端下载

百度网盘:
https://pan.baidu.com/s/14ryQc0HVxSpzCGi9scQLaA
提取码:2021
请安装百度网盘客户端APP后,用客户端下载

听力课堂
https://www.tingclass.net/show-5026-9-1.html

前端

傻傻分不清楚

  • Nest (NestJS) 是一个用于构建高效、可扩展的 Node.js 服务器端应用程序的开发框架。
  • NuxtJS 让你构建你的下一个 Vue.js 应用程序变得更有信心。这是一个 开源 的框架,让 web 开发变得简单而强大。
  • Next.js 为您提供生产环境所需的所有功能以及最佳的开发体验:包括静态及服务器端融合渲染、 支持 TypeScript、智能化打包、 路由预取等功能 无需任何配置。

多语言、登录SSO、日志、健康检查全都有 https://github.com/andrechristikan/ack-nestjs-boilerplate

JS原生—歌词滚动效果案例
https://blog.csdn.net/llllllllolllllll/article/details/129340505

font-size的改变就导致了元素几何信息的变化,几何信息的变化就意味着会导致reflow,会使页面重新布局,影响效率。 而transform 变形,并不是在渲染主线程中执行,不占用主线程,而是在合成线程中执行,最终的实现也是交给cpu,所以不会导致页面重新布局,不影响效率。

Vue3中使用this
https://juejin.cn/post/7028386809939755021

const { proxy, ctx } = getCurrentInstance()

Vue3中如何使用WeUI
https://blog.csdn.net/wangyangnuli/article/details/121397759

npm install weui.js weui -S

import { createApp } from 'vue'
import store from '@/store'
import weui from 'weui.js'
import 'weui'
import App from '@/App.vue'
import router from '@/router'
const app = createApp(App)
app.config.globalProperties.$weui = weui
app.use(store).use(router).mount('#app')


import { ref,getCurrentInstance } from 'vue'
const $weui = proxy.$weui;

const test = () => {
  $weui.alert("服务器错误");
}

WeUI.JS 中文文档
https://www.kancloud.cn/ywfwj2008/weuijs

十分钟,带你了解 Vue3 的新写法
https://juejin.cn/post/7225267685763907621

weui 文档
https://weui.shanliwawa.top/weui/index.html
https://weui.io/

vue3
https://www.runoob.com/vue3/vue3-v-for.html

助你上手Vue3全家桶之Vue-Router4教程
https://blog.csdn.net/pdd11997110103/article/details/121036684

游戏

模拟器游戏下载
https://www.emulatorgames.net/

浏览器中的 n64 模拟器
https://www.neilb.net/n64wasm/

mysql

自从MySQL启动起来的QPS的平均值

Threads: 350  Questions: 112619252828  Slow queries: 1156228  Opens: 138939  Flush tables: 1  Open tables: 2048  Queries per second avg: 23283.127

if (!(uptime= (ulong) (thd->start_time.tv_sec - server_start_time)))
    queries_per_second1000= 0;
else
    queries_per_second1000= thd->query_id * 1000LL / uptime;

length = my_snprintf(buff, buff_len - 1,
                    "Uptime: %lu  Threads: %d  Questions: %lu  "
                    "Slow queries: %llu  Opens: %llu  Flush tables: %lu  "
                    "Open tables: %u  Queries per second avg: %u.%03u",
                    uptime,
                    (int) thd_manager->get_thd_count(), (ulong) thd->query_id,
                    current_global_status_var.long_query_count,
                    current_global_status_var.opened_tables,
                    refresh_version,
                    table_cache_manager.cached_tables(),
                    (uint) (queries_per_second1000 / 1000),
                    (uint) (queries_per_second1000 % 1000));

other

制作ascii图表
https://asciiflow.com/#/

rust

https://rust-on-nails.com
Rust全栈WEB开发指南,体系化介绍了作者认为rust WEB开发过程中比较好的一些工具,也包含CI/CD、数据库等,有点意思

english

As the labeled abuse data is limited and more unsupervised approaches are explored, the feature quality becomes the key for machine learning models to succeed. The features used by models normally belong within two categories: 1) value features and 2) counting features. Value features are the most common category; they directly use the value of raw features, such as IP address, name, email, etc. Some abuse patterns can be found by finding identical or similar feature values among massive requests/users (e.g., clustering); some abuse patterns can be found by identifying different feature values from the same entity (e.g., account takeover). Counting features are based on the feature counting numbers within a certain time period, which are commonly used for large-scale abuse prevention. Various machine learning approaches (supervised/unsupervised) basically try to find the complex relationship between these features.

Counting features are based on the feature counting numbers within a certain time period, which are commonly used for large-scale abuse prevention. Various machine learning approaches (supervised/unsupervised) basically try to find the complex relationship between these features.

When abusers start to change their signals once anti-abuse defenses are applied, we often see both value features and counting features are subject to be compromised.

Rules and models based on value features often need to adjust parameters or retrain if feature values are changed/spoofed.

Counting features will lose the visibility to differentiate bot and human traffic once abusers lower their request rate.

The fact that features are constantly altered or changed can significantly degrade the performance of rules and models.

If you compare yourself to others in tech, you are going to rob yourself of your happiness faster than Nicolas Cage steals the Declaration of Independence.

One of the biggest benefits of the tech industry is being able to collaborate with extremely talented people - Don’t turn that into downside.

There are always going to be brilliant peers who grow at a much faster rate. That’s what we all signed up for when we decided to work in this crazy field.

You are only hurting yourself when you treat others’ accomplishments as a baseline for yourself, creating an unrealistic growth deadline to hit.

Your career is a marathon not a race. In order to keep on running, you can’t hold yourself back feeling bad that you aren’t at the same level as someone else.

For those ahead of you, extract the learnings from their success, apply it to your own work, and keep on chugging along. You will eventually get to where you want to go.

To learn more about maintaining a healthy mentality, not comparing yourself to others, and long-term career growth, check out the in-depth discussion here:

As models are only able to learn from the information captured by the features, any information missed by the features will be overlooked by the models as well.

Higher quality features to capture more insights and provide higher resistance to attack variability are essential for successful anti-abuse defense.

There are other technologies that could serve the purpose, but they often require collecting additional user information.

算法

畅销20年,被麻省理工推荐,每个程序员都该读的编程珠玑
https://mp.weixin.qq.com/s?__biz=MzA3NTIzMzIxNQ==&mid=2652879187&idx=1&sn=4caaf94034ca7ff1313bc1d7b012dbfd&chksm=8498bb83b3ef3295785aca3b8aeba035e72bf7b2da2cda53fd0c5e1d7e333a0122292ab753b5&scene=27

《编程珠玑》习题练习In Python——第三章 数据决定程序结构
https://blog.csdn.net/vincent_hbl/article/details/53446014

《编程珠玑》习题练习In Python——第二章 啊哈!算法
https://blog.csdn.net/vincent_hbl/article/details/53438282

Programming Pearls Second Edition
https://github.com/Folgerjun/Programming-Pearls

202305

linux

sed

在每行的头添加字符,比如"HEAD",命令如下:

sed 's/^/HEAD&/g' test.file

#在每行的行尾添加字符,比如“TAIL”,命令如下:
sed ‘s/$/&TAIL/g’ test.file

Linux NFS服务的权限设置和身份映射
https://blog.csdn.net/m0_46756244/article/details/105342440

  • 权限主要分两种,ro(默认,只读)rw(读写)sync(同步,必须加);客户端还可以用*来表示,就代表所有客户端都可以访问
  • 在设置权限后,还应别忘了系统层面的权限设置
  • NFS 服务不具备用户身份验证的功能,而是基于客户端的 IP 来进行认证的
  • 在服务器上会有这么一个 nfsnobody 匿名用户,然后客户端在用nfs服务访问服务器上的共享目录时,就会被映射成这个用户来访问
  • 用户映射
    • root_squash,当 NFS 客户端以 root 用户身份访问时,映射为 NFS 服务器的 nfsnobody 用户
    • no_root_squash,当 NFS 客户端以 root 身份访问时,映射为 NFS 服务器的 root 用户,一般不建议采用。
    • all_squash,无论 NFS 客户端以哪种用户身份访问,均映射为 NFS 服务器的 nfsnobody 用户。
  • 如果在服务器端赋予某个用户对共享目录具有相应权限,而且在客户端正好也有一个相同 UID 的用户,那么当在客户端以该用户身份访问共享时,就会被映射成具有相同 UID 的用户,比如服务端和客户端都是 ubuntu 默认用户,避免这种情况就用 all_squash

linux 命令行查词
https://www.cnblogs.com/fusheng-rextimmy/p/15371057.html

sudo apt-get install ruby
sudo gem install fy
fy love

NGINX caching proxy fails with SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
https://stackoverflow.com/questions/25329941/nginx-caching-proxy-fails-with-ssl23-get-server-hellosslv3-alert-handshake-fail

proxy_ssl_server_name on;
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

nginx upstream failover 容错机制
https://blog.csdn.net/bigtree_3721/article/details/72792141

  • 失效节点的 6 种状态
    • time out
    • connect refuse
    • 500、502、503、504
    • 后四项 5XX 需要配置 proxy_next_upstream 中的状态才可以生效
  • 负载均衡方式一共有 5 种
    • rr(轮询模式)
    • ip_hash
    • fair
    • url_hash
    • weight(加权)。

编程

HyperLogLog 使用及其算法原理详细讲解
https://blog.csdn.net/qq_41125219/article/details/119776824

Dotnet Async Guidance
https://github.com/davidfowl/AspNetCoreDiagnosticScenarios/blob/master/AsyncGuidance.md

Tailwind CSS:百万美元启示录
https://hardcored.substack.com/p/tailwind-css

rust

安装 rust
https://www.rust-lang.org/tools/install

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"

Rustup - Rust工具链安装器
https://zhuanlan.zhihu.com/p/382810160

rust 教程
https://doc.rust-lang.org/rust-by-example/hello/print.html

通过例子学 Rust
https://rustwiki.org/zh-CN/rust-by-example/

Rust 程序设计语言
https://rustwiki.org/zh-CN/book/

vimrc 设置 F5 编译运行

autocmd FileType rust nnoremap <buffer> <F5> :!rustc % -o a.out && ./a.out<CR>

英语

175个最实用的英语会话句型
https://www.cnblogs.com/winrarz/p/16885550.html

python

python协程(1): 基本介绍及yield实现协程
https://blog.csdn.net/qq_37674086/article/details/113243190

vim

光标移动

  • gg 到文档第一行
  • G 到文档最后一行
  • 0 到行首(第 1 列)
  • ^ 到第一个非空白字符
  • $ 到行尾
  • Ctrl-B 和 Ctrl-F 以及 PageUp 和 PageDown 按全页滚动
  • Ctrl-U 和 Ctrl-D 默认滚动半页
  • Ctrl-Y 和 Ctrl-E 滚动一行
  • zz 把当前行置为屏幕的中央
  • zt 把当前行置于屏幕的顶端
  • zb 把当前行置于屏幕的底端
  • H 移动到屏幕顶端
  • M 移动到屏幕中间
  • L 移动到屏幕底部
  • w or W 向右移动到下一单词开头
  • e or E 向右移动到单词结尾
  • b or B 向左移动到单词开头
  • % 跳转到相配对的括号
  • gD 跳转到局部变量的定义处
  • { 跳到上一段的开头
  • } 跳到下一段的的开头
  • ( 移到这个句子的开头
  • ) 移到下一个句子的开头
  • [[ 跳转至上一个函数(要求代码块中’{‘必须单独占一行)
  • ]] 跳转至下一个函数(要求代码块中’{'必须单独占一行)

php

tinker 的输出默认不翻页
https://github.com/bobthecow/psysh/wiki/Config-options

php -d cli.pager=cat artisan tinker

202304

python

SQLite Vacuum
https://www.runoob.com/sqlite/sqlite-vacuum.html

VACUUM 命令通过复制主数据库中的内容到一个临时数据库文件,然后清空主数据库,并从副本中重新载入原始的数据库文件。这消除了空闲页,把表中的数据排列为连续的,另外会清理数据库文件结构。

基于selenium、BeautifulSoup与goose3的动态网络爬虫(以东方视野为例)
https://blog.csdn.net/qq_36274515/article/details/89631676

Flask-单元测试
https://blog.csdn.net/HuangXiongjin/article/details/103560721

Celery Daemonization
https://docs.celeryq.dev/en/latest/userguide/daemonizing.html#daemon-systemd-generic

python究竟要不要使用多线程

  • GIL 的特性,也就导致了 python 不能充分利用多核 cpu。
  • 而对面向 I/O 的(会调用内建操作系统C代码的)程序来说,GIL会在这个I/O调用之前被释放,以允许其他线程在这个线程等待I/O的时候运行。
  • 如果线程并未使用很多 I/O 操作,它会在自己的时间片一直占用处理器和 GIL。

创业

80+盈利创始人推荐,25本最佳书籍盘点!
http://www.yitb.com/article-38436

重新理解创业里程碑
https://yitanger.feishu.cn/docx/WQuRdqYE4oos1txDxvZcJkf2nL7

重磅案例课:小龙虾外卖
https://yitanger.feishu.cn/docs/doccnV1Yg9Jr1suZLQGspt6UfMe#DA9tR6

壁垒必修:预判项目长期壁垒课程
https://yitanger.feishu.cn/docs/doccnettFMyMZ8BuawbJBa8lUng#NwIJ9k

落地之夜,案例分享
https://yitanger.feishu.cn/docx/WLrBdameeokuKdxU6VgcHLpknpf

创业书单
https://yitanger.feishu.cn/docx/VBPEdcCl0oGlIwxTtu8cDwL8nle

ai

https://civitai.com/images/370200?modelId=4823&postId=108729&id=4823&slug=deliberate
https://civitai.com/images/213712?modelId=4823&postId=111233&id=4823&slug=deliberate
https://civitai.com/images/313863?modelId=4823&postId=116835&id=4823&slug=deliberate
https://civitai.com/images/392042?modelId=28620&postId=83099&id=28620&slug=mixreal-v2-sd-21

投资

8分钟教你什么是量比!
https://zhuanlan.zhihu.com/p/394928988

量比定义

  • 成交量是股价技术分析的重要指标,而分析成交量最重要的工具之一就是量比,量比是衡量相对成交量的指标
  • 它是指股市开市后平均每分钟的交易量与过去五个交易日平均每分钟的交易量之比。
  • 量比的数值越大,说明该股市场很活跃。
  • 量比的数值越小,说明该股市场很冷清。
  • 同时通过分析量比指标也能了解主力短期动向,适用于短线,量比选股法就是用于短期。

量比使用

  1. 当量比大于1时,说明当日每分钟的平均交易量大于过去五日平均每分钟交易量,交易比较活跃,为放量。
    • 当量比小于1时,说明交易比较清淡,为缩量。
  2. 当量比在 0.5 倍以下时,说明交易清淡,呈缩量情形,没有较大的分析意义。
  3. 当量比在 0.5-1.5 倍区间时,说明成交量为正常水平,需要观察,等待进场时机。
  4. 当量比在 1.5-2.5 倍区间时,说明成交量放量比较温和,应结合价格分析,
    • 如果股价也呈温和上涨态势,则可继续持有;
    • 如果股价呈下跌态势,那么该趋势短期内可能继续延续下去,应考虑止损离场。
  5. 当量价在 2.5-5 倍区间时,说明成交量放量较明显,
    • 如果股价在支撑位或压力位附近时,说明价格大概率会突破该关键位置,可以相应地采取行动。
  6. 当量比在 5-10 倍区间时,说明成交量放量较剧烈,
    • 如果股价在低位出现这种情况说明股价后期上涨的动力大;
    • 如果股价在高位并且股价已经拉升过了,应小心,可能为Z力的诱多行为,为出货做准备。
  7. 当量比在 10 倍以上的区间,说明成交量放巨量,为异动,物极必反,一般进行反向操作,
    • 如果股价在上涨趋势中,说明股价大概率见顶,可能后期会下跌,
    • 如果股价在下跌趋势的末期,则后期股价可能会大概率上涨。
  8. 当量比在 20 倍以上的区间,说明此时为极端放量,具有很强的反转信号,
    • 如果股价在高位滞涨,说明股价后期会下跌,应立刻离场。
    • 如果股价在下跌的趋势中,说明股价即将见底,可以进场等待拉升。

java

Spring Security Oauth2之获取token流程分析
https://blog.csdn.net/ityw520/article/details/128079499

oauth2的token认证接口/oauth/token、/oauth/check_token、/oauth/authorize在哪个包里
https://blog.csdn.net/qq_33036061/article/details/107076918

Non-resolvable parent POM 解决。分析 maven parent 解析顺序。
https://blog.csdn.net/wangrui1605/article/details/113746438
maven–解决was cached in the local repository, resolution will not be reattempted until the update
https://blog.csdn.net/feiying0canglang/article/details/125673756

Maven的常用命令
https://zhuanlan.zhihu.com/p/411883656

关于maven多module的依赖问题
https://www.cnblogs.com/westlin/p/10908778.html

Maven的聚合(多模块)和Parent继承
https://www.jb51.net/article/153441.htm

other

微服务经典文章:微服务 | Martin Fowler
https://zhuanlan.zhihu.com/p/472964950

AWS 上的数据加密策略
http://blog.light2cloud.com/?p=94

「 通达信 」的基本使用及常用设置
https://zhuanlan.zhihu.com/p/545826458

Nginx proxy_set_header参数设置
https://blog.csdn.net/summer_fish/article/details/117300072

proxy_pass http://172.31.5.0:5000;

proxy_set_header Host $host;
proxy_pass http://172.31.5.0:5000;

proxy_set_header Host $http_host;
proxy_pass http://172.31.5.0:5000;

202303

mysql

MYSQL解决 The total number of locks exceeds the lock table size 问题
https://blog.csdn.net/dingweiye123/article/details/80994576

show variables like "%tmp%";
SET GLOBAL  tmp_table_size =1024*1024*1024;

数据库血缘分析
https://github.com/reata/sqllineage

SQLLineage: 基于Python的SQL血缘分析工具
https://reata.github.io/blog/sqllineage-a-sql-lineage-analysis-tool/

SQLLineage v1.3:迈向字段血缘
https://reata.github.io/blog/sqllineage-towards-column-lineage/

Find the size of each index in a MySQL table
https://dba.stackexchange.com/questions/49656/find-the-size-of-each-index-in-a-mysql-table

How to estimate/predict data size and index size of a table in MySQL
https://dba.stackexchange.com/questions/46069/how-to-estimate-predict-data-size-and-index-size-of-a-table-in-mysql

SELECT
    CONCAT(FORMAT(DAT/POWER(1024,pw1),2),' ',SUBSTR(units,pw1*2+1,2)) DATSIZE,
    CONCAT(FORMAT(NDX/POWER(1024,pw2),2),' ',SUBSTR(units,pw2*2+1,2)) NDXSIZE,
    CONCAT(FORMAT(TBL/POWER(1024,pw3),2),' ',SUBSTR(units,pw3*2+1,2)) TBLSIZE
FROM
(
    SELECT DAT,NDX,TBL,IF(px>4,4,px) pw1,IF(py>4,4,py) pw2,IF(pz>4,4,pz) pw3
    FROM
    (
        SELECT data_length DAT,index_length NDX,data_length+index_length TBL,
        FLOOR(LOG(IF(data_length=0,1,data_length))/LOG(1024)) px,
        FLOOR(LOG(IF(index_length=0,1,index_length))/LOG(1024)) py,
        FLOOR(LOG(data_length+index_length)/LOG(1024)) pz
        FROM information_schema.tables
        WHERE table_schema='mydb'
        AND table_name='mytable'
    ) AA
) A,(SELECT 'B KBMBGBTB' units) B;

select database_name, table_name, index_name, stat_value*@@innodb_page_size
from mysql.innodb_index_stats where stat_name='size';

mysql 索引对 null 的处理

一个表 mytable 总共 100w 条数据,主键是 int unsigned 类型,索引列是 CHAR(50) 类型,下面是创建索引的语句。

create index ix_mytable_json_xxx on mytable ((JSON_VALUE(json, '$.xxx' RETURNING CHAR(50))));

其中 12572 条数据的 json->>‘$.xxx’ 有值,其余都是 NULL, 现在看 ix_mytable_json_xxx 索引占用空间 13 MB。

select database_name, table_name, index_name, stat_value*@@innodb_page_size/1024/1024 size_M
from mysql.innodb_index_stats
where stat_name='size' and  database_name='test' and table_name='mytable' and index_nam='ix_mytable_json_xxx';

假设每行数据在索引里占用 50+4 的话,需要 1000000*(50+4)/1024/1024=51.49 MB,这远远大于 13 MB,说明 mysql 的索引里是对 NULL有优化的。

data

Using pyarrow how do you append to parquet file?
https://9to5answer.com/using-pyarrow-how-do-you-append-to-parquet-file

Unfortunately, this cannot append to an existing .parquet file (see my answer that can). Reason: Once .close() is called, the file cannot be appended to, and before .close() is called, the .parquet file is not valid (will throw an exception due to a corrupted file as it’s missing its binary footer). The answer from @Contango solves this.

https://github.com/cldellow/csv2parquet/issues/13

The nature of the Parquet format is such that you can’t really update an existing file. (Wellllll, maybe it’s technically possible to do surgery and add new row groups and then update the footer. It’d require using relatively low-level APIs in the parquet library, though.)

linix

持续检查某个进程的 CPU 和内存占用

$ while true; do echo -n `date +'%H:%M:%S '`" ";ps -eo pid,%cpu,%mem,cmd | grep 'mysqld'| grep -v grep; sleep 1;done
03:22:55  3226830 39.6  4.0 /usr/sbin/mysqld
03:22:56  3226830 39.6  4.0 /usr/sbin/mysqld
03:22:57  3226830 39.6  4.0 /usr/sbin/mysqld
03:22:58  3226830 39.6  4.0 /usr/sbin/mysqld
03:22:59  3226830 39.6  4.0 /usr/sbin/mysqld
03:23:00  3226830 39.6  4.0 /usr/sbin/mysqld

java

Spring boot开启定时任务的三种方式
https://blog.csdn.net/qianlixiaomage/article/details/106599951

  • 第一种也就是最简单的一种:基于注解 (@Scheduled)的方式;
  • 第二种:基于接口 (SchedulingConfigurer);
  • 第三种:基于注解设定多线程定时任务。

Convert String to Hex in Java
https://www.delftstack.com/howto/java/string-to-hex-java/

// method 1
StringBuilder stringBuilder = new StringBuilder();

char[] charArray = str.toCharArray();

for (char c : charArray) {
    String charToHex = Integer.toHexString(c);
    stringBuilder.append(charToHex);
}

System.out.println("Converted Hex from String: "+stringBuilder.toString());

// method 2
import org.apache.commons.codec.binary.Hex;
import java.nio.charset.StandardCharsets;

byte[] byteArray = str.getBytes(StandardCharsets.UTF_8);
String convertedResult = Hex.encodeHexString(byteArray);

// method 3
byte[] getBytesFromString = str.getBytes(StandardCharsets.UTF_8);
BigInteger bigInteger = new BigInteger(1, getBytesFromString);

String convertedResult = String.format("%x", bigInteger);

System.out.println("Converted Hex from String: " + convertedResult);

linux

How to record reverse proxy upstream server serving request in Nginx log?
https://stackoverflow.com/questions/18627469/how-to-record-reverse-proxy-upstream-server-serving-request-in-nginx-log

log_format upstreamlog '[$time_local] $remote_addr - $remote_user - $server_name $host to: $upstream_addr: $request $status upstream_response_time $upstream_response_time msec $msec request_time $request_time';
access_log /var/log/nginx/access.log upstreamlog;

Experiments about a better locate using grep
https://a3nm.net/blog/better_locate.html

Approach	Time/query (s)  	Index size (MB)  
mlocate	5.5	300
GNU locate	4.6	75
grep	1.7	890
LC_ALL grep	0.7	890
LC_ALL grep (parallel)	0.3	890
LC_ALL grep (parallel) gzip  	1.3	105
LC_ALL grep (parallel) pigz  	1.0	105
LC_ALL grep (parallel) lz4	0.7	160

javascript

知识图谱项目前端可视化图论库——Cytoscape.js简介 DAG
https://www.cnblogs.com/zhilin/p/12074688.html

  • Cytoscape.js 是一个用原生JS编写的开源图论(又名网络)库。你可以使用Cytoscape.js进行图形分析和可视化。
  • Cytoscape.js 支持许多不同的图论用例。它支持有向图,无向图,混合图,循环,多图,复合图(一种超图),等等。

https://ourcodeworld.com/articles/read/159/top-5-best-free-diagrams-javascript-libraries
https://hackernoon.com/my-top-13-javascript-diagram-libraries-g2a53z6u

什么是Black-Litterman资产配置模型?
https://zhuanlan.zhihu.com/p/542122376

  • Black-Litterman 模型是一个关于投资组合配置(portfolio allocation)的贝叶斯模型(Bayesian model),它的初衷在于马科维茨(Markowitz)提出的现代投资组合理论(modern portfolio theory)在实际操作中的问题。
  • 在现代投资组合理论中,投资组合的最优权重是通过一个均值-方差最优化(mean-variance optimization)问题的求解得到的,而最优化问题中的资产预期收益率(expected returns)和协方差(covariances)都是给定的,它们不一定是对于预期收益率的合理估计。
  • 尤其在投资者对特定资产的未来表现持某些观点时,马科维茨均值-方差最优化给出的权重是不合理的。
  • 为解决此问题,Black-Litterman模型使用贝叶斯方法将投资者的观点纳入到对预期收益率的估计中。Black-Litterman模型有一个重要假设:所有资产收益率都遵循同样的概率分布(probability distribution)。

python

How could I use requests in asyncio?
https://stackoverflow.com/questions/22190403/how-could-i-use-requests-in-asyncio

import asyncio
import requests

async def main():
    loop = asyncio.get_event_loop()
    future1 = loop.run_in_executor(None, requests.get, 'http://www.google.com')
    future2 = loop.run_in_executor(None, requests.get, 'http://www.google.co.uk')
    response1 = await future1
    response2 = await future2
    print(response1.text)
    print(response2.text)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())


import asyncio
import aiohttp

@asyncio.coroutine
def do_request():
    proxy_url = 'http://localhost:8118'  # your proxy address
    response = yield from aiohttp.request(
        'GET', 'http://google.com',
        proxy=proxy_url,
    )
    return response

loop = asyncio.get_event_loop()
loop.run_until_complete(do_request())


import aiohttp
import asyncio

async def fetch(session, url):
    async with session.get(url) as response:
        return await response.text()

async def main():
    urls = [
            'http://python.org',
            'https://google.com',
            'http://yifei.me'
        ]
    tasks = []
    async with aiohttp.ClientSession() as session:
        for url in urls:
            tasks.append(fetch(session, url))
        htmls = await asyncio.gather(*tasks)
        for html in htmls:
            print(html[:100])

if __name__ == '__main__':
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())

浅度测评:requests、aiohttp、httpx 我应该用哪一个?
https://zhuanlan.zhihu.com/p/103711201

Make a Python asyncio call from a Flask route
https://stackoverflow.com/questions/47841985/make-a-python-asyncio-call-from-a-flask-route

How can I make python request module asyncio and aiohttp
https://stackoverflow.com/questions/75004160/how-can-i-make-python-request-module-asyncio-and-aiohttp

Making 1 million requests with python-aiohttp
https://pawelmhm.github.io/asyncio/python/aiohttp/2016/04/22/asyncio-aiohttp.html

AI

https://zhuanlan.zhihu.com/p/613155165

参考搜索引擎中“先检索再重排”的思路,针对文档问答设计“先检索再整合“的方案,整体思路如下:

  • 首先准备好文档,并整理为纯文本的格式。把每个文档切成若干个小的chunks
  • 调用文本转向量的接口,将每个chunk转为一个向量,并存入向量数据库
    • 文本转向量可以使用 openai embedding
    • 也可以使用其他方案,如 fasttext/simbert 等
  • 当用户发来一个问题的时候,将问题同样转为向量,并检索向量数据库,得到相关性最高的一个或几个chunk
  • 将问题和chunk合并重写为一个新的请求发给 openai api

sd 模型 webui
colab运行stable diffusion以及本地部署方法
https://zhuanlan.zhihu.com/p/561546984
https://blog.csdn.net/Kerry_Blue/article/details/128778005

国风
https://civitai.com/images/249208?modelId=10415&postId=119862&id=10415&slug=3-guofeng3
https://civitai.com/images/249210?modelId=10415&postId=119862&id=10415&slug=3-guofeng3

other

How to calculate cumulative sum / running total of a column in Excel?
https://www.extendoffice.com/documents/excel/5280-excel-calculate-cumulative-sum.html

=SUM($B$2:B2)
=IF(B2="","",SUM($B$2:B2))

条件 GPT 经验
https://c8xa9g10gh.feishu.cn/docx/SFnzdD0LqoM8kIxGVsrcAlRhn1d#SFnzdD0LqoM8kIxGVsrcAlRhn1d

202302

算法

为什么 360 面试官说 Trie 树没用?
https://www.zhihu.com/question/27168319

多模式匹配算法-AC算法等
https://blog.csdn.net/xiaof_90/article/details/77447625

问题一:如果有一个关键词,然后让你在一段长文本中找出这些关键词,如何做?
问题二:如果有10K个关键词,然后让你在一段长文本中找出这些关键词,如何做?

如上问题一中,一段长文本中找一个关键词,那么就是单模式匹配。除了朴素算法(暴力算法)之外,还有一些经典的算法,例如KMP算法等。
问题二中,一段长文本中找N个关键词,那么就是多模式匹配,除了朴素算法外,也有一些经典的算法,例如AC算法、BM算法等。

https://pypi.org/project/cyac/

>>> ac = AC.build([u"python", u"ruby"])
>>> for id, start, end in ac.match(u"python ruby"):
>>>     print(id, start, end)

适用于大规模的多关键字匹配的多模匹配算法

  • agrep 对处理大规模的多关键字匹配问题有高效。多模式中最著名的快速匹配算法之一。
  • MultiBDM 基于AC和DAWG两种自动机扫描思想的多模匹配算法。根据匹配过程中使用时可的不同,作者提出了两种改进。

python

获取异常信息

try:
    pass
except Exception as e:
    print getattr(e, 'message', repr(e))

Python性能分析工具Line_profiler
https://blog.csdn.net/weixin_44613728/article/details/120411325

Python代码优化工具——memory_profiler
https://blog.csdn.net/weixin_42245157/article/details/126623370

pip install line-profiler
pip install -U memory_profiler

def cpu_profiler():
    from line_profiler import LineProfiler
    p = LineProfiler()
    p.add_function(match_keywords)
    p_wrap = p(run)
    p_wrap()
    p.print_stats()

def mem_profiler():
    from memory_profiler import profile
    p = profile(precision=4)(run)
    p()

python ahocorasick介绍
https://blog.csdn.net/u010569893/article/details/97136696

ahocorasick 是个 python 模块,Aho-Corasick 算法是多模式匹配中的经典算法,目前在实际应用中较多。

  • Trie是一个字符串索引的词典,检索相关项时时间和字符串长度成正比。
  • AC自动机能够在一次运行中找到给定集合所有字符串。
  • AC自动机其实就是在Trie树上实现KMP,可以完成多模式串的匹配。

linux

Linux 内核 101:NUMA架构
https://zhuanlan.zhihu.com/p/62795773

proxy setting

bash <(curl -s -L https://git.io/v2ray.sh)
stress-ng -c 0 -l 30 -t 8640000000

mysql

带进度导入数据

pv database1.sql.gz | gunzip | mysql -uroot -p database1

字节面试:知道MySQL 的 NULL 值是怎么存放的吗?
https://blog.csdn.net/Javatutouhouduan/article/details/128150631

结果集行号

select @rowNum:=@rowNum + 1 AS '行号',a.username,a.money
from account a, (select @rowNum:=0) b

books

The Subtle Art of Not Giving a F*ck
https://book.douban.com/subject/26895197/

作者:易又饕(来自豆瓣)
来源:https://book.douban.com/review/10006306/

  • 第一,要区分“快乐”(happiness)和"快感"(high)。前者具有可持续性,能真正让生活变得美好。后者往往是短暂的生理刺激,在刺激结束后还可能带来更深的痛苦。
  • 第二,生活中充满了问题,因为问题本来就是生活的常态。不必为连绵不断的问题本身而感到苦恼,如果因为这些苦恼而纠结,我们必然就干不了其他事情,进而会为无所成就而进一步苦恼,陷入恶性循环。
  • 第三,快乐只有在解决问题的过程中才能获得,而从长期来看,逃避问题只能带来更多的压力和挑战。用追求快感的方式来逃避挑战,最后只能像喝海水解渴,越喝越渴。
  • 第四,既然痛苦和挣扎是人生不可避免的一部分,就应该时刻做好直面它们的准备。同时,要选择自己的战场,把精力、能力和毅力用到那些真正值得解决的问题上。
  • 第五,明白自己所在乎的价值,同时明白自己用以衡量这些价值的标尺是否真正合适。好的价值,是往往是自己可以掌控的、真实的并且不会伤害其他人。好的标尺,往往也不依赖于我们无法控制的他人评价。
  • 第六,真正能够持续带来快乐的,只有不断提升自我、不断达到目标、不断解决问题的过程,而任何存量指标,比如金钱的数量等等,一旦被我们达到,就不会再带来快乐了。
  • 第七,没有必要和别人比较。没有必要对自己感觉过于良好或者不好。有时候,我们觉得自己在某些方面表现平常,这本来就是生活的应有之义,接受就好。
  • 第八,与其抱怨自己没有灵感或者动力,不如直接上手去干事情。很多时候,灵感和动力是在劳动的过程中产生的。克服惰性与恐惧,踏踏实实开始行动,很多问题都会迎刃而解。
  • 第九,情感上的支持自有其意义和价值,但每个人的问题都要每个人自己去解决。亲密关系中最好的相处之道,不是施舍与依赖,而是坦诚与理解。
  • 第十,生命短暂,但生活充实的人在死亡面前就会变得坦然。我们所在乎的许多东西,在生命这个宏大的命题面前,可能根本就不值得为之纠结。我们要选择自己在乎什么。

AI

GPT in 60 Lines of NumPy
https://jaykmody.com/blog/gpt-from-scratch/

投资

在投资分析中,简单的往往是实用的。我的投资理念很简单:在好行业中挑选好公司,然后等待好价格时买入。与之相对应的投资分析工具也同样简单。

  • 波特五力分析。不要孤立地看待一只股票,而要把一个公司放到行业的上下游产业链和行业竞争格局的大背景中分析,重点搞清三个问题:
    • 公司对上下游的议价权
    • 与竞争对手的比较优势
    • 行业对潜在进入者的门槛。
  • 杜邦分析。弄清公司过去5年究竟是靠什么模式赚钱的(高利润、高周转还是高杠杆),然后看公司战略规划、团队背景和管理执行力等是否与其商业模式一致。例如,
    • 高利润模式的看其广告投入、研发投入、产品定位、差异化营销是否合理有效,
    • 高周转模式的看其运营管理能力、渠道管控能力、成本控制能力等是否具备
    • 高杠杆模式的看其风险控制能力、融资成本高低等。
  • 估值分析。通过同业横比和历史纵比,加上市值与未来成长空间比,在显著低估时买入。

这“三板斧”分别解决的是好行业、好公司和好价格的问题,挑出来的“三好学生”就是值得长期持有的好股票了。

javascript

js 爬虫
https://github.com/zloirock/core-js/blob/master/scripts/usage/usage.mjs

others

TL;DR: The Top 6 Text Summarization APIs
https://rapidapi.com/blog/top-text-summarization-apis/

随机卡通头像
Vanilla JavaScript Library For Creating Avatars On The Client or Server-Side
https://webcodeflow.com/avataaars-js

SQLite the only database you will ever need in most cases
https://www.unixsheikh.com/articles/sqlite-the-only-database-you-will-ever-need-in-most-cases.html
https://news.ycombinator.com/item?id=34812527

Goodbye, CSS-Tricks!
https://geoffgraham.me/goodbye-css-tricks/
https://news.ycombinator.com/item?id=34864701
https://css-tricks.com/snippets/css/a-guide-to-flexbox/

Write a First Person Game in 2KB With Rust
https://grantshandy.github.io/posts/raycasting/

数字人建模软件,有14天试用 https://www.agisoft.com/ Process digital images and generate 3D spatial data. Fast and highly accurate.

Deepfakes中文版,汉化版下载,各换脸软件下载(都已整理好)
https://blog.csdn.net/woniu211111/article/details/107901535
https://github.com/deepfakes/faceswap
https://blog.csdn.net/kaidikake/article/details/105224241

java

Bistoury原理解析
https://cloud.tencent.com/developer/article/1553180

Bistoury
去哪儿网开源的一个对应用透明无侵入的Java应用诊断工具,可以让开发人员无需登录机器或修改系统,就可以从日志、内存、线程、类信息、调试、机器和系统属性等各个方面对应用进行诊断,提升开发人员诊断问题的效率和能力。内部集成了arthas,所以它是arthas的超集。其中两个比较有特色的功能:在线DEBUG、动态监控,就是基于 Instrumentation + ASM 做的。

iBatis详解以及和MyBatis区别
https://www.iocoder.cn/MyBatis/x-plugins/

https://blog.csdn.net/zzuhkp/article/details/123518287

spring-boot-starter-parent 和 spring-boot-dependencies 都进行了依赖管理,如果依赖中存在漏洞我们就需要紧急进行修复,它们之间的升级方式有所不同。

  • 对于 spring-boot-starter-parent 而言,我们可以直接在 properties 中指定依赖的版本,因为在 spring-boot-dependencies 中包的坐标使用了这个属性值作为版本号
  • 对于 spring-boot-dependencies,如果要进行依赖升级,配置属性是不行的,需要在 spring-boot-dependencies 前面加上要升级的依赖的坐标
  • 如果要升级的依赖不是 spring-boot-starter-parent 或 spring-boot-dependencies 管理的依赖,还可以直接把它加到 dependencies 标签下,这样依据最短路径原则,我们直接配置的依赖会覆盖间接引入的依赖

202301

java

SpringCloud之Eureka详细的配置
https://www.cnblogs.com/BlogNetSpace/p/11264235.html
ubuntu 安装 rabbitmq
https://blog.csdn.net/sepnineth/article/details/126235964
搭建Eureka - 分区
https://blog.csdn.net/wxy540843763/article/details/100046858
Spring boot config 配置及刷新
https://blog.csdn.net/backonway/article/details/85094571
实体映射最强工具类:MapStruct 真香!
https://cloud.tencent.com/developer/article/1996748

mapstruct坑:Internal error in the mapping processor: java.lang.NullPointerException at org.mapstruct.
https://blog.csdn.net/qq_37132495/article/details/122010257

Setting -->Build,Execution,Deployment -->Compiler -->User-local build process VM options (overrides Shared options):
-Djps.track.ap.dependencies=false

解决 HikariPool-1 - Exception during pool initialization.问题
https://blog.csdn.net/qq_40369243/article/details/115818732

Spring Security 实战干货:用户信息UserDetails相关入门
https://segmentfault.com/a/1190000020628228?utm_source=tag-newest
spring-cloud-gateway之GlobalFilter
https://www.jianshu.com/p/55de48fc484b
SpringCloud:学习Gateway网关拦截器的ServerWebExchange
https://www.cnblogs.com/fdzang/p/11812348.html
统一认证中心 Oauth2 认证坑
https://blog.csdn.net/wangsofa/article/details/121155006
Spring Security OAuth2 单点登录
https://www.cnblogs.com/cjsblog/p/15512596.html
GateWay 中StripPrefix的作用
https://blog.csdn.net/pichcar1982/article/details/120427469
Spring Security Oauth2 ResourceServerConfigurerAdapter (资源服务器配置)
https://blog.csdn.net/wangooo/article/details/113924394
Spring Security OAuth2 Opaque 令牌的简单使用指南
https://blog.csdn.net/new_ord/article/details/127834421
springcloud — 微服务鉴权管理Spring Security OAuth2原理解析(五)
https://blog.csdn.net/qq_38658567/article/details/113249583
springboot以jar包运行
https://www.cnblogs.com/xiaohang123/p/14945194.html
如何在spring security手动自定义用户认证SecurityContextHolder设置Authentication?
https://blog.51cto.com/u_12004792/5786751

http://localhost:8611/auth-dev.yml
http://localhost:8611/auth/dev
http://localhost:8612/actuator/gateway/routes

前端

浏览器原生支持ES6 export和import模块
http://www.hlwen.com/2022/09/22/757.html

Node.js 如何处理 ES6 模块
http://www.ruanyifeng.com/blog/2020/08/how-nodejs-use-es6-module.html

vue项目多环境配置(.env)的实现
https://www.jb51.net/article/217747.htm

PWA超简单入门
https://juejin.cn/post/6844903584899792903
https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps
https://web.dev/progressive-web-apps/

尤雨溪:Turbopack真的比Vite快10倍吗?
https://blog.csdn.net/gtLBTNq9mr3/article/details/127680877

谈谈JS二进制:File、Blob、FileReader、ArrayBuffer、Base64
https://blog.csdn.net/qiwoo_weekly/article/details/127255281

webpack打包之sourcemap
https://blog.csdn.net/formylovetm/article/details/126095387

redis

一篇文章搞定Redis Stream
https://blog.csdn.net/lt_xiaodou/article/details/126525965

不管是list还是订阅/发布模式,都有其弊端,比如list不能友好的重复消费,需要重复消费的话,需要程序代码去控制;而订阅/发布模式是一种转发消息的模式,只有订阅者在线的时候才能接收到消息,订阅者不在线期间产生的消息,就丢掉了。而Stream,有借鉴Kafka一些市面上成熟的消息队列的思想,可以消费失败重复消费,消息是持久化的。

postgre

默认配置

$ cat ~/.psqlrc
\timing
\pset border 2

PostgreSQL中文文档
https://www.yiibai.com/manual/postgresql/index.html

linux

clear all iptables rules
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -t nat -F
iptables -t mangle -F
iptables -F
iptables -X

stress-ng: Simulate specific cpu percentages
https://serverfault.com/questions/796225/stress-ng-simulate-specific-cpu-percentages

I designed stress-ng so that one can specify 0 for the number of stressor processes to match the number of on-line CPUs, so to load each cpu at say 40%, use

stress-ng -c 0 -l 40

ssh 超时
https://www.bbsmax.com/A/MyJxnVG1dn/

服务端
vi /etc/ssh/sshd_config

    # server每隔60秒给客户端发送一次保活信息包给客户端
    ClientAliveInterval 60
    # server端发出的请求客户端没有回应的次数达到86400次的时候就断开连接,正常情况下客户端都会相应
    ClientAliveCountMax 86400

客户端
vi /etc/ssh/ssh_config

    # client 每隔60秒给客户端发送一次保活信息包给客户端
    ServerAliveInterval 60
    # client 端发出的请求服务端没有回应的次数达到86400次的时候就断开连接,正常情况下服务端都会相应
    ServerAliveCountMax 86400

How can I tail a zipped file without reading its entire contents?
https://stackoverflow.com/questions/1183001/how-can-i-tail-a-zipped-file-without-reading-its-entire-contents

No, you can’t. The zipping algorithm works on streams and adapts its internal codings to what the stream contains to achieve its high compression ratio.

Without knowing what the contents of the stream are before a certain point, it’s impossible to know how to go about de-compressing from that point on.

If it’s an option, then bzip2 might be a better compression algorithm to use for this purpose.

Bzip2 uses a block compression scheme. As such, if you take a chunk of the end of your file which you are sure is large enough to contain all of the last chunk, then you can recover it with bzip2recover.

How to get few lines from a .gz compressed file without uncompressing
https://stackoverflow.com/questions/8151380/how-to-get-few-lines-from-a-gz-compressed-file-without-uncompressing

gzip -cd CONN.20111109.0057.gz | head

zip, gzip, bzip2

  • gzip 只能压缩文件, 不能压缩目录, 后缀名为 .gz, 而且不保留原文件,还可以和 tar 命令一起构成 Linux 操作系统中比较流行的压缩文件格式。
  • bzip2 是gzip的升级版本,-压缩比比较高,- k 产生压缩文件后保留原文件

[译] 理解 zip 和 gzip 压缩格式背后的压缩算法
https://zhuanlan.zhihu.com/p/143459234

  • 虽然各种压缩算法适用于不同场景,但是它们的底层都是基于 DEFLATE。
  • DEFLATE 是同时使用了 LZ77 算法与哈夫曼编码(Huffman Coding)的一种无损数据压缩算法。
  • DEFLATE 最初是作为 LZW 以及其它受专利保护的数据压缩算法的替代版本而设计的。
  • 从技术上来说,zip 压缩格式是支持使用其他的压缩算法的,但是 DEFLATE 是其中最常用的一种。
  • zip 是一种相当简单的分别压缩每个文件的存档格式,分别压缩文件允许不必读取另外的数据而检索独立的文件。
  • zip 和 gzip(gz)不兼容,虽然它们都是使用相同的 deflate 压缩算法
  • zip 更像一个打包器,能把多个多件放到一个zip中;gzip 一次只对一个文件压缩,通常与 tar 命令一起用。
  • gz 的压缩速度更快,而 bz 的压缩比更好
  • GZIP 最早由 Jean-loup Gailly 和 Mark Adler 创建,用于 unix 系统的文件压缩,ZIP 文件格式是一种数据压缩和文档储存的文件格式。

Extract only a specific file from a zipped archive to a given directory
https://unix.stackexchange.com/questions/14120/extract-only-a-specific-file-from-a-zipped-archive-to-a-given-directory

unzip -l myarchive.zip
unzip -p myarchive.zip path/to/zipped/file.txt >file.txt
unzip -p myarchive.zip path/to/zipped/file.txt | head 
unzip -j "myarchive.zip" "in/archive/file.txt" -d "/path/to/unzip/to"
unzip -j myarchive.zip in/archive/file.txt another/file.ext -d /path/to/unzip/to
unzip -j archive.zip "sub/dir/*" -d "dest/dir"

I changed my hostname, why is my bash PS1 prompt unchanged?
https://unix.stackexchange.com/questions/15643/i-changed-my-hostname-why-is-my-bash-ps1-prompt-unchanged

echo 'mynewhostname' | sudo tee /etc/hostname
sudo hostname -F /etc/hostname
vi /etc/hosts
    127.0.0.1    mynewhostname.mydomainname.com    mynewhostname

SSH server gives “userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]” when connecting with Putty
https://unix.stackexchange.com/questions/721606/ssh-server-gives-userauth-pubkey-key-type-ssh-rsa-not-in-pubkeyacceptedalgorit

There are several types of keys and signature algorithms in the SSH protocol.
RSA keys, which have the key type ssh-rsa, can be used to sign with

  • SHA-1 (in which case, the signature type is ssh-rsa),
  • SHA-256 (which has signature type rsa-sha2-256),
  • or SHA-512 (which has signature type rsa-sha2-512).

backend

理解OAuth 2.0
http://www.ruanyifeng.com/blog/2014/05/oauth_2_0.html

Parquet 就是一种基于列式存储的文件格式,它有两个主要优点 [4]:

高度可压缩性:.json 或 .csv 文件通常默认未压缩,而 Parquet 会压缩数据,因此可以节省大量磁盘空间。表 通常包含具有大量唯一值的列(high cardinality(这里理解为出现次数多且值不同);例如用户 ID)和只有少数唯一值的列(low cardinality(虽然出现次数很多,但值都相同);例如国家)。频率越低,压缩效果越好(可能)——下一节将详细介绍。

文件查询/过滤下推:在读入之前修剪不必要的数据。这可以缩短加载时间并优化资源消耗。如果需要从一千个表中获取两列,你不需要扫描所有行来获取这两个属性——你直接获取整个这两列。

Arrow 序列化设计提供了一个“数据头”,它描述了表中所有列的所有内存缓冲区的确切位置和大小。这意味着你可以内存映射巨大的、大于 RAM 的数据集,并在它们上就地评估 pandas 风格的算法,而无需像现在使用 pandas 那样将它们加载到内存中。你可以从 1 TB 表的中间读取 1 兆字节,而只需支付执行这些总计 1 兆字节的随机读取的成本

下面这两个方式中需要进行权衡:

  • 优化磁盘空间/磁盘上的长期存储 → Parquet
  • 优化数据交换和快速检索 → Arrow

简单理解parquet文件格式——按列存储和元数据存储
https://blog.csdn.net/zhang35/article/details/122284903

Apache Arrow :零内存读取DataFrame
https://blog.csdn.net/qq_43232373/article/details/123995262

AWS 数据清洗技术栈

  • AWS S3 是一种对象存储服务,提供行业领先的可扩展性、数据可用性、安全性和性能。
  • Parquet 仅仅是一种列式存储格式,它是语言、平台无关的,并且不需要和任何一种数据处理框架绑定。
  • Apache Arrow 为平面和层次数据定义了一种与语言无关的柱状内存格式,这种格式的组织用于在现代硬件(如cpu和gpu)上进行高效的分析操作。pyarrow 是用于 Arrow 的 Python 库。
  • AWS Glue 是一项无服务器数据集成服务,它简化了发现、准备、移动和集成来自多个来源的数据以进行分析、机器学习(ML)和应用程序开发的工作。
  • Amazon Athena 是一种交互式查询服务,让您能够轻松使用标准 SQL 直接分析 Amazon S3 中的数据。

athena 的价格,扫描 1T 数据是5美元, 可以省钱的考虑点:

  • parquet 本身是压缩的,另外 athena 应该也支持压缩后的csv.gz格式。
  • parquet 是列数据库文件格式,如果查询语句里用不到所有列的话,一次查询可能不需要扫描整个文件,扫描量会少一些,这点比csv好。
  • parquet 支持分区,如果提前能知道以后可能的查询,可以设计好分区key,每次扫描可以继续减少扫描量。

mysql

mysql 排序,利用变量实现 显示排序序号
https://blog.csdn.net/weixin_55806809/article/details/122931550

  • “ := ” 赋值的意思 。 set 和 update 时, 但是一般都用 “ = ” 。 select 时 只能使用“ := ”方式
  • “ = ” set 和 update时 ,表示赋值。select 时 , 表示是判断。

code

set @i = 0;
set @sco = null;
select
student_id,
score,
case when @sco = score then @i else @i := @i + 1 end as 排名序号,
@sco := score
from tb_score where course_id = 1 ORDER BY score desc

SELECT sid,sname,gender,age,(@i:=@i+1) AS '序号'
FROM student,(SELECT @i:=0) AS itable;

MySQL 性能监控4大指标——第一部分
https://www.jianshu.com/p/36f385935ebd

Mysql Performance_schema简介, 表和常用性能查询
https://blog.csdn.net/solinger/article/details/122300008

哪类的SQL执行最多?

SELECT DIGEST_TEXT,COUNT_STAR,FIRST_SEEN,LAST_SEEN
FROM performance_schema.events_statements_summary_by_digest
ORDER BY COUNT_STAR DESC limit 10\G

哪类SQL的平均响应时间最多?
SELECT DIGEST_TEXT,COUNT_STAR,AVG_TIMER_WAIT,FIRST_SEEN,LAST_SEEN
FROM performance_schema.events_statements_summary_by_digest
ORDER BY AVG_TIMER_WAIT DESC limit 10\G

哪类SQL扫描记录数最多?
SELECT DIGEST_TEXT,SUM_ROWS_EXAMINED ,FIRST_SEEN,LAST_SEEN
FROM performance_schema.events_statements_summary_by_digest
ORDER BY SUM_ROWS_EXAMINED DESC limit 10\G

SELECT DIGEST_TEXT,ROUND((SUM(sum_timer_wait) / SUM(count_star)) avg_time,FIRST_SEEN,LAST_SEEN
FROM performance_schema.events_statements_summary_by_digest
ORDER BY ROUND((SUM(sum_timer_wait) / SUM(count_star))  DESC limit 10\G

SELECT * FROM sys.statements_with_runtimes_in_95th_percentile limit 10\G

SHOW GLOBAL STATUS LIKE "Questions";

SELECT schema_name
     , SUM(count_star) count
     , ROUND(   (SUM(sum_timer_wait) / SUM(count_star))
     / 1000000) AS avg_microsec

     FROM performance_schema.events_statements_summary_by_digest

 WHERE schema_name IS NOT NULL
 GROUP BY schema_name;

Find last query executed by specific session on MySQL server
https://dataedo.com/kb/query/mysql/find-last-query-executed-by-session

set global log_output = 'table';
set global general_log = 'on';
select *,CONVERT((argument) USING utf8) t  from mysql.general_log limit 10\G
set global general_log = 'off';

table operator

  • check table: 检查 InnoDB 和 MyIsam 是否有错误。检查表或者视图是否存在错误
  • optimize table: 恢复被删除的块和重组表,清理碎片
  • analyze table: 检测和重组表的关键字分布情况。用来分析和存储表的关键字的分布,使得系统获得准确的统计信息,影响 SQL 的执行计划的生成。
  • repair table : 修复表

MySQL中analyze table的作用是?生产上操作会有什么风险?
https://www.modb.pro/db/168442

一、analyze table的作用
1、analyze table 会统计索引分布信息。
2、对于 MyISAM 表,相当于执行了一次 myisamchk --analyze
3、支持 InnoDB、NDB、MyISAM 等存储引擎,但不支持视图(view)
4、执行 analyze table 时,会对表加上读锁(read lock)
5、该操作会记录binlog

二、生产上操作的风险
1、analyze table的需要扫描的page代价粗略估算公式:sample_pages * 索引数 * 表分区数。
2、因此,索引数量较多,或者表分区数量较多时,执行analyze table可能会比较费时,要自己评估代价,并默认只在负载低谷时执行。
3、特别提醒,如果某个表上当前有慢SQL,此时该表又执行analyze table,则该表后续的查询均会处于waiting for table flush的状态,严重的话会影响业务,因此执行前必须先检查有无慢查询。

算法

  • KMP:用于字符串的匹配问题,对于普通的做法需要O(n*m)的复杂度暴力匹配,一旦失配需要从这一次原串匹配的开头字符的下一个字符开始匹配,也就是意味着原串所正在匹配的位置 i 可能会一直回退。KMP复杂度O(m+n),KMP的做法就是保证了指向原串正在匹配的位置的i不会回退。

  • Trie树:(字典树,多模式串匹配算法)一种树形结构,它是一种专门处理字符串匹配的数据结构,用来解决在一组字符串集合中快速查找某个字符串的问题(本质是利用字符串之间的公共前缀,将重复的前缀合并在一起)。

  • AC自动机:Trie树跟AC自动机之间的关系,就像单串匹配中朴素的串匹配算法与KMP算法一样,只不过前者针对的是多模式串。所以AC自动机实际上就是在Trie树之上,加了类似KMP的next数组,只不过此处的next数组是构建在树上。

202212

## windows

powershell 提示没权限,先用管理员模式启动

set-ExecutionPolicy RemoteSigned

linux

无法用 key ssh 到远程主机

journalctl -fu ssh
    userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]

vi /etc/ssh/sshd_config.
    PubkeyAcceptedAlgorithms=+ssh-rsa

sudo systemctl restart sshd

LVM

pv lv vg 介绍

  • PV(physical volume) 即物理卷,就是物理磁盘,可以通过 fdisk -l 查看操作系统有几块硬盘
  • VG(volume group) 即卷组,就是一组物理磁盘的组合,里面可以有一块硬盘也可以有多块硬盘
  • LV(logical volume)及逻辑卷,就是在 VG (指定的物理磁盘组)里面划分出来的
  • 可以说成是 PV 就是硬盘,而 VG 就是管理硬盘的操作系统,而 LV 就是操作系统分出来的各个分区.
  • PV->VG->LV-> 文件系统使用(挂载到某个目录)
  • 硬盘或分区做成 pv,然后将 pv 或多个 pv 建立 vg,vg 上建立 lv

git 配置

git config --global http.proxy http://127.0.0.1:10800
git config --global https.proxy https://127.0.0.1:10800

git config --global --unset http.proxy
git config --global --unset https.proxy

git config --global url."https://".insteadOf git://

git config --list --show-origin

fio 磁盘性能测试工具
https://www.cnblogs.com/lyhabc/p/16708771.html

dd 命令来测试性能,有如下问题:

  • dd 命令的 IO 模型单一,只能测试顺序 IO,不能测试随机 IO。
  • dd 命令可设置的参数较少,并且测试结果不一定能反映出磁盘的真实性能。
  • dd 命令的设计初衷就不是用例测试性能的,在 dd 的手册中可以看到。
  • 无法设置队列深度,因此不推荐用 dd 命令来测试最大读 IOPS。

fio 测试模板

#read 顺序读 吞吐量
fio -ioengine=libaio -direct=1 -bs=4k -thread -rw=read -size=10G -nrfiles=1 -filename=fio_readputth_test.txt -name='fio read test' -iodepth=2 -runtime=120 -numjobs=4 -time_based=1 -allow_mounted_write=1 -group_reporting

#write 顺序写 吞吐量
fio -ioengine=libaio -direct=1 -bs=4k -thread -rw=write -size=10G -nrfiles=1 -filename=fio_writeputth_test.txt -name='fio write test' -iodepth=2 -runtime=120 -numjobs=4 -time_based=1 -allow_mounted_write=1 -group_reporting


#read 顺序读
fio -ioengine=libaio -direct=1 -bs=4k -thread -rw=read -size=2G -nrfiles=1 -filename=fio_read_test.txt -name='fio read test' -iodepth=4 -runtime=60 -numjobs=8 -time_based=1 -allow_mounted_write=1 -group_reporting

#write 顺序写
fio -ioengine=libaio -direct=1 -bs=4k -thread -rw=write -size=2G -nrfiles=1 -filename=fio_write_test.txt -name='fio write test' -iodepth=4 -runtime=60 -numjobs=8 -time_based=1 -allow_mounted_write=1 -group_reporting

#readwrite 顺序混合读写
fio -ioengine=libaio -direct=1 -bs=4k -thread -rw=readwrite -size=2G -nrfiles=1 -filename=fio_readwrite_test.txt -name='fio readwrite test' -iodepth=4 -runtime=60 -numjobs=8 -time_based=1 -allow_mounted_write=1 -group_reporting

#randread 随机读
fio -ioengine=libaio -direct=1 -bs=4k -thread -rw=randread -size=2G -nrfiles=1 -filename=fio_randread_test.txt -name='fio randread test' -iodepth=4 -runtime=60 -numjobs=8 -time_based=1 -allow_mounted_write=1 -group_reporting

#randwrite 随机写
fio -ioengine=libaio -direct=1 -bs=4k -thread -rw=randwrite -size=2G -nrfiles=1 -filename=fio_randwrite_test.txt -name='fio randwrite test' -iodepth=4 -runtime=60 -numjobs=8 -time_based=1 -allow_mounted_write=1 -group_reporting

#randrw 随机混合读写
fio -ioengine=libaio -direct=1 -bs=4k -thread -rw=randrw -size=2G -nrfiles=1 -filename=fio_randrw_test.txt -name='fio randrw test' -iodepth=4 -runtime=60 -numjobs=8 -time_based=1 -allow_mounted_write=1 -group_reporting

,对于小块io(以64k为界)只需要关注iops,平均时延(lat中的avg),大块io关注吞吐和平均时延(lat中的avg)即可

java

大白话讲解Spring的@bean注解
https://zhuanlan.zhihu.com/p/99870991

从广义上Spring注解可以分为两类:

  • 一类注解是用于注册 Bean,比如 @Component , @Repository , @ Controller , @Service , @Configration 这些注解就是用于注册 Bean,放进 IOC 容器中。
  • 一类注解是用于使用 Bean,比如 @Autowired , @Resource 注解,这些注解就是把屋子里的东西自己拿来用,如果你要拿,前提一定是屋子(IOC)里有的,不然就会报错。

Bean 注解

  • Spring 的 @Bean 注解用于告诉方法,产生一个 Bean 对象,然后这个 Bean 对象交给 Spring 管理。
    • 产生这个 Bean 对象的方法 Spring 只会调用一次,随后这个 Spring 将会将这个 Bean 对象放在自己的 IOC 容器中。
  • @Component , @Repository , @Controller , @Service 这些注解只局限于自己编写的类,
    • 而 @Bean 注解能把第三方库中的类实例加入 IOC 容器中并交给 spring 管理。
  • @Bean 注解的另一个好处就是能够动态获取一个 Bean 对象,能够根据环境不同得到不同的 Bean 对象。

Java随机生成RSA密钥对
https://blog.csdn.net/msq16021/article/details/123743361

SpringBoot Security 自定义登录页面
https://blog.csdn.net/weixin_42555971/article/details/127440094

基于数据库自定义UserDetailsService实现JWT认证
https://blog.csdn.net/lazy_LYF/article/details/127284982

单点登录SSO,JWT进行跨域身份验证,前端登录实现Coding在线(十一)
https://blog.csdn.net/wang121213145/article/details/123553741

SpringSecurity以及Oauth2(笔记)
https://blog.csdn.net/weixin_46949627/article/details/126698801

Spring MVC中redirect重定向3种方式(带参数)
https://blog.csdn.net/weixin_39973810/article/details/84847922

javascript

npm install 报错

  • git 挂代理:git config --global http.proxy http://127.0.0.1:10800
  • git 默认使用 http:git config --global url.“https://”.insteadOf git://
  • node-scss匹配的最高版本才nodjs 14,不能要最新版本的 nodejs
  • 跟linux还是windows没啥关系,linux也不行

其他

https://v2ex.com/t/901954 你们的 NAS 部署了什么有趣的服务?

  • 网盘:seafile,坚果云, dufs,filebrowser,baidunetdisk,timemachine,icloudpd,filebrowser
  • 文件同步:syncthing/nextcloud,etesync,icloudpd,samba
  • 照片:mt-photos,PhotoPrism,photoview
  • 内网穿透:cloudflared,frpc,tailscale
  • 内网组网:tailscale
  • 梯子:openclash,stashapp,subconverter,v2ray
  • 统一登录:authelia
  • 下载:aria2,aria2pro,qbittorrent
  • 搜索引擎:whoogle/searxng
  • 容器管理:portainer/watchtower
  • 密码管理:vaultwarden
  • 反代网关:traefik
  • git 仓库:gitea,Gogs
  • 网盘文件目录:alist
  • DNS:adguard-home,Adguard home DNS
  • 笔记博客:mastodon,outline,b3log/siyuan
  • 网站监控:uptime-kuma
  • RSS: rsshub,freshrss,ttrss
  • 智能家居:Home Assistant,doods2
  • 音视频:Jellyfin
  • 聊天:Snikket