自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(91)
  • 收藏
  • 关注

原创 go file operation

f, err := os.Open(filename) //read onlyf, err := os.OpenFile(filename, os.O_WRONLY|os.O_APPEND|os.O_CREAE, 777) //appendos.O_RDONLY : read onlyos.O_WRONLY: write onlyos.O_RDWR: read and writeos.O_APPEND: write with appendos.O_CREAT: create ne

2022-05-15 18:12:45 222

原创 go connect mysql

connectpackage mainimport ( "database/sql" "fmt" _ "github.com/go-sql-driver/mysql")var db *sql.DBfunc init() { var err error //format: username:password@protocal(host:port)/database db, err = sql.Open("mysql", "root:123456@tcp(127.0.0.1:330

2022-05-13 16:59:49 368

原创 c++ stl

#include <iostream>#include <unordered_map>using namespace std;int main() { unordered_map<string, int> m { {"apple", 1}, {"banana", 2} }; printf("%d\n", m["banana"]); //2 m.insert({"pear", 3}); prin

2022-05-10 12:22:17 311

原创 go typical variable scope bug

problemvar cwd stringfunc init() { cwd, err := os.Getwd() // compile error: unused: cwd if err != nil { log.Fatalf("os.Getwd failed: %v", err) }}:= will make a local cwd variable, and the package variable cwd is still empty value.

2022-05-09 15:05:19 322

原创 go modules

init a project (module) named “gotest”go mod init gotest //go: creating new go.mod: module gotestcreate two packages to see how to import a package in the local space(1) hello package(2) main package(3) pathrun the project (module)go run go.

2022-05-09 13:51:37 76

原创 go strings

package mainimport ( "fmt" "strings")func main() { a := "hello" fmt.Println(strings.Contains(a, "ll")) // true fmt.Println(strings.Count(a, "l")) // 2 fmt.Println(strings.HasPrefix(a, "he")) // tru

2022-05-08 17:43:42 253

原创 go convert string to json quick solution

package mainimport ( "encoding/json" "fmt")func main() { s := `{"a": true, "b": 1, "c": "666"}` m := make(map[string]interface{}) json.Unmarshal([]byte(s), &m) fmt.Println(m["a"]) //true fmt.Println(m["b"]) //1 fmt.Println(m) //map

2022-05-07 21:17:46 323

原创 csapp chapter 3

3.2 程序编码C预处理器扩展源代码,插入所有用#include命令指定的文件,并扩展所有有用#define声明指定的宏。编译器将C源代码

2022-05-01 13:02:24 140

原创 C++ lambda

leetcode.547https://leetcode-cn.com/problems/number-of-provinces/class Solution {public: int findCircleNum(vector<vector<int>>& isConnected) { function<void(int)> dfs = [&](int x) -> void { isConnected

2022-04-16 10:07:31 551

原创 python 合并ts 合并二进制文件

os.system('copy /b ' + '+'.join([f'temp\\{i}.ts' for i in range(len(tss_url))]) + f' temp\\new.mp4')

2022-04-13 18:16:03 1278

原创 python ThreadPoolExecutor

from concurrent.futures import ThreadPoolExecutorwith ThreadPoolExecutor(max_workers=20) as t: t.map(lambda args: download_ts(*args), [[ts_url, i, len(tss_url)] for i, ts_url in enumerate(tss_url)])

2022-04-13 18:04:52 802

原创 347. 前 K 个高频元素 桶排序 计数器 堆

题目:https://leetcode-cn.com/problems/top-k-frequent-elements/思路1:计数,对数量进行桶排序class Solution: def topKFrequent(self, nums: List[int], k: int) -> List[int]: amount = collections.defaultdict(int) # 统计每个数字的数量 max_amount = 0 # 最大数量 for n

2022-04-04 11:05:25 396

原创 堆排序 堆

def heapify(arr, i, arr_len): left = 2 * i + 1 right = 2 * i + 2 largest = i if left < arr_len and arr[left] > arr[largest]: largest = left if right < arr_len and arr[right] > arr[largest]: largest = right

2022-04-04 10:03:31 418

原创 linux 常用操作

查找文件夹中所以文件包含关键词的行find ./ -name ‘*’ | xargs grep ‘pro’ -n(查找当前文件夹所以文件,显示包含‘pro’关键词的行及行号)find ./ -name ‘*.c’ | xargs grep ‘pro’ -n(查找当前文件夹以.c结尾的所以文件,显示包含‘pro’关键词的行及行号)...

2022-03-23 10:06:14 388

原创 vim vi

文首,文尾,行首,行尾 (都需要在命令行模式)文首:gg文尾:G行首:^ (shift + 6) (或者 0)行尾:$ (shift + 4)

2022-03-23 09:24:16 583

原创 writing pattern

…along with a corresponding boost in… e.g. The extensive evaluation performed, shows the consistent and rapid growth in the accuracy in the past few years along with a corresponding boost in model complexity and the availability of large-scale datasets..

2022-03-04 20:02:25 204

原创 new words in A Deep Journey into Super-resolution: A Survey 专业研究英语第1次作业

convolutional == 卷积exposition == a comprehensive description and explanation of an idea or theory.state-of-the-art == 最先进的benchmark == standard,设立基准taxonomy == 分类adversarial == 对抗性的progressive == 渐进的memory footprint == 内存占用...

2022-03-04 20:00:27 190

原创 python string format align get the same places

name = '123'name_list = ['123']print(f'{f"{name_list}":<20}, {name:<20},')['123'] , 123 ,if you want to use colon : to assign format, you need to use a string variable.print(f'{f"{name_list}":_<20}, {name:_<

2022-03-03 18:04:26 335

原创 英语老师Lee-From-2022-02-19-To-2022-02-24-note

you’re talking out the side of your neck? 你说话不用脑子吗?come again? 没听清再说一遍fly under my radar – 在我的地盘耍花样good to know – 好,我知道了

2022-02-27 12:26:08 83

原创 English-note-Programming-Languages-PartA

ado – nonsense bullshit 废话

2022-02-26 16:58:03 120

原创 python shutil

shutil.rmtree('temp') # remove the dirctory includes files.

2022-02-25 20:02:06 536 1

原创 emacs sml 快捷键操作

c-c + c-s + enter == open smlc-d == stop the current sml programc-x + c-s == save the file

2022-02-25 13:31:34 135

原创 ubuntu debug 模式下启动 django 项目

python3 确保安装安装 django 2.2.12命令如下:pip3 install django==2.2.12新建 django 项目(1) 切换到想要新建项目的目录我切换到了 ~/software/python 目录下

2022-01-28 12:31:02 1010

原创 JavaScript preparse(预解析)

varvar 声明的变量会被预解析提升到该变量作用域的最前面,但是赋值不会提升。例:会打印什么?function f1() { var a = b = c = 9; console.log(a); console.log(b); console.log(c);}f1();console.log(c);console.log(b);console.log(a);答案:9 //f1() a9 //b9 //c9 //c9 //berror: a is not

2022-01-13 15:28:45 243

原创 JavaScript Error-prone points

when using an arrow function, and want to pass an object 's property by destructuring, even if only one parameter, needs to add a paranthses.let f = ({name}) => name == "Tom";when using reduce function ( the higher order function ), if only one el.

2022-01-06 09:06:47 477

原创 python selenium 无头模式

from selenium.webdriver import Chromefrom selenium.webdriver import ChromeOptionsoption = ChromeOptions()option.add_argument('--headless')b = Chrome(r'D:\software\chromedriver\chromedriver.exe', options=option)b.set_window_size(1366, 768)b.get('htt

2021-11-26 11:28:22 788

原创 python DeprecationWarning 取消 警告 warning

import warningswarnings.filterwarnings("ignore",category=DeprecationWarning)

2021-11-25 21:56:58 1128

原创 python bs4 BeautifulSoup

from bs4 import BeautifulSoupsoup = BeautifulSoup(html, 'html.parser')# 定位所有标签 findAll, 定位第一个 findlst = soup.findAll('a', attrs={'class': 'count-limit'}) # 是一个listi = soup.find('a', attrs={'class': 'count-limit'}) # 一个对象i.string # 该节点的文本内容i['href'

2021-11-25 15:12:33 343

原创 python openpyxl 读取文件 整行 行读取

import openpyxlrwb = openpyxl.load_workbook('t.xlsx')data = [] # 存放读取的行数据for i in rwb['Sheet'][1]: # 'Sheet'为表单名称, 1 为第一行 data.append(i.value)print(data)

2021-11-25 14:15:37 4675

原创 python os.walk 遍历所有文件 文件夹

import osfor curDir, dirs, files in os.walk("test"): print("====================") print("现在的目录:" + curDir) print("该目录下包含的子目录:", dirs) print("该目录下包含的文件:", files)

2021-11-25 13:31:46 614

原创 常用的算法

文章目录最小生成树Prim 普利姆Kruskal 克鲁斯卡尔最短路径dijkstra 迪杰斯特拉 ( 单源 )Floyd 弗洛伊德 ( 多源 )最小生成树Prim 普利姆Kruskal 克鲁斯卡尔最短路径dijkstra 迪杰斯特拉 ( 单源 )Floyd 弗洛伊德 ( 多源 )...

2021-11-24 10:01:12 237

转载 奇诺之旅 贤者的故事

https://www.bilibili.com/video/BV1g54y1z7Rm?spm_id_from=333.999.0.0大家好,我是周扒片今天跟大家讲一个贤者的故事奇诺的摩托车燃料快用完了又逢倾盆大雨无休止好在听说前面有个小屋屋主是远近闻名的贤者不谈名不恋权所剩之物都会毫无保留给予他人奇诺心想怎么也能去要点汽油什么的于是赶到小屋 轻叩房门一位年轻的女子招呼她们进去奇诺擦干抹净开始打探消息莫非您就是远近闻名的贤者女孩表示她只是负责照顾他的贤者病重 来日无多

2021-11-22 20:05:15 137

原创 C++ #include<bits/stdc++.h>

#include<bits/stdc++.h>说明:include 所有包

2021-11-22 14:34:57 568

原创 C++ vector 初始化二维数组

vector<vector<double>> w(10,vector<double>(10,-1));说明:创建 10x10 二维数组, 初始值为 -1.0.

2021-11-22 14:32:05 736

原创 Java 实现 Runnable 接口 创建线程

需求:创建一个新的线程, 打印8次 "喵喵, 我是小猫咪"public class Test { public static void main(String[] args) throws InterruptedException { Cat cat = new Cat(); Thread thread = new Thread(cat); thread.start(); for (int i = 0; i < 8; i++

2021-11-19 17:24:05 216

原创 Java 继承 Thread 类 创建多线程

public class Test { public static void main(String[] args) throws InterruptedException { Cat cat = new Cat(); cat.start(); for (int i = 0; i < 1000; i++) { System.out.println(55555); } }}class Cat ex

2021-11-19 17:01:55 189

原创 python 发送邮件

def send(sending_msg): from email.mime.text import MIMEText from email.header import Header import smtplib import time msgObj = MIMEText(sending_msg) msgObj['From'] = Header("-", 'utf-8') msgObj['To'] = Header("-", 'utf-8')

2021-11-18 14:02:24 346

原创 python 获取当前时间

import timenow = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())print(now)2005-12-01 12:34:45

2021-11-18 12:35:56 191

原创 python pyppeteer 对选中的节点执行Javascript 代码

# 选中节点, 执行代码btn = await page.J('.amp-no-login-zh')await page.evaluate('node => node.click()', btn)# 选中所有a节点, 如果a节点的文本为办事大厅则点击nodeList = await page.JJ('a')for node in nodeList: print(await page.evaluate('node => node.innerText', node)) i

2021-11-17 12:59:36 1188

原创 python pyppeteer util 设置标签页面的大小

async def setPage(page): //传入要设置的页面对象即可 width, height = screen_size() await page.setViewport({'width': width, 'height': height}) await page.evaluateOnNewDocument('Object.defineProperty(navigator,"webdriver",{get:()=>undefined})')def scree

2021-11-17 12:25:21 381

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除