- 博客(59)
- 资源 (2)
- 收藏
- 关注
原创 深入了解HTTPDNS-使用Python实现一个HTTPDNS服务
传统的DNS(Domain Name System)是互联网的核心协议之一,负责将人类可读的域名解析为机器可理解的IP地址。Mock数据来实现一个简单的HTTPDNS服务,同时根据客户端的地区和运营商返回数据,并在需要时回退到系统原生的DNS解析。对于全球性业务的公司,通过HTTPDNS直接返回本地化的解析结果,可以极大提升用户的访问速度和体验。它通过HTTP协议进行域名解析,解决传统DNS的部分痛点,同时提供更强的灵活性。在移动网络中,HTTPDNS可绕过运营商的限制和劫持,确保解析的正确性和稳定性。
2024-12-11 13:45:58
361
原创 requests源码阅读:requests发起一个请求的时候,做了什么?
当我们简单的调用requests发起一个请求的时候,到底发生了什么?让我们从一行代码看起。
2024-11-23 16:27:24
975
原创 深入解析 Web 应用中的 CHIPS(Partitioned Cookie Attribute)
CHIPS 提供了一种隐私友好的跨站点 Cookie 管理方式,通过分区存储解决了传统第三方 Cookie 的隐私问题。在 Web 应用中,开发者可以通过后端设置带有属性的 Cookie,并在前端正确传递和管理这些 Cookie,实现安全可靠的跨站功能。随着 Web 隐私标准的不断演进,CHIPS 将成为构建现代 Web 应用的关键工具之一。如果你的应用需要支持跨站场景,赶快尝试使用 CHIPS 优化隐私和功能吧!
2024-11-23 13:06:31
1148
原创 基于python实现限流器-漏桶算法
核心思想:漏桶算法由一个固定容量的桶和一个恒定的流出速率组成。当请求到达时,先将请求放入桶中。如果桶未满,请求可以立即被处理;如果桶已满,新到达的请求将被拒绝或排队等待。
2024-11-11 12:00:00
302
原创 Python深度解析:装饰器—提升代码灵活性与可维护性的艺术
定义一个接收函数作为参数的装饰器函数。在装饰器函数内部定义一个包装函数,处理传入的参数和返回值。在包装函数内编写所需的附加逻辑。返回包装函数,使其替代原始函数。"""一个装饰器,它会重复执行被装饰的函数指定的次数"""# 示例函数")# 调用示例函数。
2024-08-20 14:42:51
529
原创 Python深度解析:描述符的内部机制与高级用法
Python 的描述符协议是一种允许对象管理访问属性的特殊协议。描述符是实现了特定协议的对象,这个协议允许你控制属性的访问、赋值和删除行为。
2024-08-18 09:00:00
777
原创 Python深度解析:上下文协议设计与应用技巧
Python的上下文管理协议是一组特殊方法的集合,它们允许对象与with语句配合使用,以确保在代码块执行前后正确地管理资源。这个协议分为同步上下文管理协议和异步同步上下文管理协议。协议主要是实现两种方法上下文管理器是实现了上下文管理协议的对象。通过上下文管理器,能够实现精确控制资源创建和释放时机。它允许你执行一些设置和清理工作,而不需要显式地编写这些代码。和__exit__()。除了使用内置的上下文管理器,你还可以创建自定义的上下文管理器。这可以通过定义一个类并实现和__exit__()方法来完成。
2024-08-17 12:19:24
731
2
原创 浅谈Servlet
文章目录为什么还需要学习Servlet为什么还需要学习Servlet我从Java SE转向Java Web学习的时候,心中就总有那么一个疑问,main函数去哪里了?为什么在学习Java SE的时候,总是从main函数开始运行,而在学习Java Web的时候,按照步骤莫名奇妙的就可以跑起来了。这个疑问之前困扰了我很久。后面渐渐的Spring的兴起,渐渐的main函数又出现了。不得不说,Spring使得Java Web的学习曲线平滑了少许。不过现在回过头来看,对于Java EE来说,main函数已经封装在
2021-01-24 17:16:36
283
原创 浅谈Spring IOC
文章目录浅谈Spring IOC如何创建对象Spring IOC 是如何创建对象的Spring IOC对对象进行操作浅谈Spring IOC如何创建对象在Java中,我们通常创建对象都是通过new Object 的形式来创建一个新的对象的,然后通过这个对象的set方法对一个对象里面的属性进行赋值。譬如 User user = new User() user.setName = 'Liming'除了通过new的方式以外,我们也可以通过反射的方法创建对象。Class<?> clz
2021-01-06 23:08:51
218
原创 LeetCode28. Implement strStr() 字符串匹配
文章目录28.字符串匹配28. Implement strStr()暴力破解Rabin-Karp算法KMP算法BM算法(Boyer-Moore)Sunday算法28.字符串匹配28. Implement strStr()Implement strStr().Return the index of the first occurrence of needle in haystack, or ...
2020-04-05 10:08:44
247
原创 LeetCode 27.Remove Element 移除数组中的元素
文章目录移除元素27. Remove Element快慢双指针头尾双指针移除元素27. Remove ElementGiven an array nums and a value val, remove all instances of that value in-place and return the new length.Do not allocate extra space for...
2020-03-01 14:51:08
259
原创 LeetCode 26.Remove Duplicates from Sorted Array 移除有序数组的重复元素
文章目录26.移除有序数组的重复元素26. Remove Duplicates from Sorted Array双指针法26.移除有序数组的重复元素26. Remove Duplicates from Sorted ArrayGiven a sorted array nums, remove the duplicates in-place such that each element ap...
2020-02-29 00:21:30
175
原创 LeetCode 25. Reverse Nodes in k-Group 以组的形式反转节点
文章目录25.以组的形式反转节点25. Reverse Nodes in k-Group尾插法头插法25.以组的形式反转节点25. Reverse Nodes in k-GroupGiven a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a po...
2020-02-26 23:07:40
308
原创 LeetCode 24.Swap Nodes in Pairs 成对交换链表节点
文章目录24.成对交换链表节点24. Swap Nodes in Pairs迭代法递归24.成对交换链表节点24. Swap Nodes in PairsGiven a linked list, swap every two adjacent nodes and return its head.You may not modify the values in the list’s node...
2020-02-25 16:01:29
220
原创 LeetCode 23.Merge k Sorted Lists 合并K个的有序链表
文章目录23.合并排序N个有序链表23. Merge k Sorted Lists直接合并分治法23.合并排序N个有序链表23. Merge k Sorted ListsMerge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.Example:Inpu...
2020-02-24 19:55:45
284
原创 LeetCode22.Generate Parentheses 产生括号组合
22.产生括号组合22. Generate ParenthesesGiven n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", ...
2020-02-23 16:40:46
183
原创 LeetCode 19.Remove Nth Node From End of List 移除链表从后算起第几个元素
文章目录19.移除链表从后算起第几个元素19. Remove Nth Node From End of List两次遍历单次遍历19.移除链表从后算起第几个元素19. Remove Nth Node From End of ListGiven a linked list, remove the n-th node from the end of list and return its hea...
2020-02-17 21:41:20
110
原创 LeetCode17. Letter Combinations of a Phone Number电话号码组合
文章目录17. 电话号码组合17. Letter Combinations of a Phone Number深度优先遍历(DFS)直接拼接17. 电话号码组合17. Letter Combinations of a Phone NumberGiven a string containing digits from 2-9 inclusive, return all possible let...
2020-02-16 18:53:38
463
原创 LeetCode 18. 4Sum四数之和
18.4Sum 四数之和18. 4SumGiven an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array whic...
2020-02-13 19:47:48
264
原创 LeetCode16. 3Sum Closest 三数之和改
16.3Sum Closest最接近目标值的三数之和3Sum ClosestGiven an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integer...
2020-02-10 20:36:50
130
原创 LeetCode15.3Sum 三数之和
文章目录15. 3Sum 三数之和15. 3Sum双指针使用Map15. 3Sum 三数之和15. 3SumGiven an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which give...
2020-02-08 11:57:49
168
原创 LeetCode 14. Longest Common Prefix最长公共子前缀
最长公共子前缀14. Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings.If there is no common prefix, return an empty string "".Example 1:Input: ["fl...
2020-02-04 12:24:57
340
原创 LeetCode 13. Roman to Integer 罗马数字转阿拉伯数字
13. 罗马数字转阿拉伯数字13. Roman to IntegerLeetCode 12 的镜像问题Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X ...
2020-02-02 15:09:30
224
原创 LeetCode 12.Integer to Roman 阿拉伯数字转换为罗马数字
LeetCode 12.Integer to Roman 阿拉伯数字转换为罗马数字12. Integer to RomanRoman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X ...
2020-02-01 20:26:22
275
原创 LeetCode 11. Container With Most Water 容器最大水容量
11. Container With Most Water 容器最大水容量11. Container With Most WaterGiven n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such t...
2020-01-30 10:37:42
210
原创 LeetCode 10.Regular Expression Matching 正则匹配
LeetCode 10 . Regular Expression Matching 正则匹配10. Regular Expression MatchingGiven an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'.'.' Mat...
2020-01-29 10:13:17
237
原创 LeetCode 9. Palindrome Number 回文数字
LeetCode 9. Palindrome Number9.Palindrome NumberDetermine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.Example 1:Input: 121Output: tru...
2020-01-27 09:17:56
379
原创 LeetCode 8. String to Integer (atoi) 字符串转整形
LeetCode 8. String to Integer (atoi) 字符串转整形8. String to Integer (atoi)Implement atoi which converts a string to an integer.The function first discards as many whitespace characters as necessary unt...
2020-01-24 22:37:40
157
原创 LeetCode 7. Reverse Integer 反转整数
LeetCode 7. Reverse Integer 反转整数文章目录LeetCode 7. Reverse Integer 反转整数7. Reverse Integer直接反转7. Reverse IntegerGiven a 32-bit signed integer, reverse digits of an integer.Example 1:Input: 123Output...
2020-01-22 21:06:21
369
原创 LeetCode 6. ZigZag ConversionZ字形转换
LeetCode 6. ZigZag ConversionZ字形转换文章目录LeetCode 6. ZigZag ConversionZ字形转换6. ZigZag Conversion直接跳转法(横着走)拉链法(竖着走)6. ZigZag ConversionThe string "PAYPALISHIRING" is written in a zigzag pattern on a giv...
2020-01-21 21:41:32
309
原创 LeetCode5. Longest Palindromic Substring 最长子回文串
最长子回文串5. Longest Palindromic SubstringGiven a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example 1:Input: "babad"Output: "bab"Note...
2020-01-19 23:18:22
163
原创 LeetCode4.Median of Two Sorted Arrays 求有序数组的中位数
Median of Two Sorted Arrays 有序数组的中位数4. Median of Two Sorted ArraysThere are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run ...
2020-01-16 19:57:53
124
原创 LeetCode3. Longest Substring Without Repeating Characters 子字符串长度
文章目录字符串的长度3. Longest Substring Without Repeating Characters暴力破解滑动窗口(双指针法)滑动窗口改进字符串的长度3. Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring withou...
2020-01-13 21:53:17
113
原创 强烈安利几款效率工具
文章目录工具集视频:爱奇艺万能播放器文件搜索:everything,Wox截图:greenshot垃圾清理:CCleanerMarkdown编辑器:Typora预览器:Seer浏览器:Chrome,firefox文本编辑器:Notepad++IDE:VSCode,IDEATodoList:滴答清单工具集视频:爱奇艺万能播放器无广告,支持格式多文件搜索:everything,Wox...
2020-01-12 17:57:55
904
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人