自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

小猪爱拱地

勤奋和毅力是通向成功的阶梯

  • 博客(672)
  • 资源 (1)
  • 收藏
  • 关注

转载 Unzip Gz File Python: A Step-By-Step Guide

read file content of gzip file

2024-04-14 23:44:22 4

转载 Getting Started with C# in VS Code

CSharp

2024-04-12 23:29:14 6

原创 Ubuntu下安装 Dotnet

ubuntu下安装dotnet环境

2024-04-12 22:58:06 270

原创 Python 虚拟环境下安装 numpy和 matplotlib

安装 matplotlib。

2024-04-02 00:24:00 237

转载 动态开点线段树

本文要求读者对线段树较为熟悉,并能理解左闭右开的区间。动态开点线段树的写法非常多,读者应选择自己喜欢的方式去实现。

2024-02-18 09:50:06 114

原创 正则表达式的资源

https://www.regular-expressions.info/index.htmlhttps://regex101.com/

2023-12-16 10:30:16 565

转载 Structured binding declaration (since C++17)

【代码】Structured binding declaration (since C++17)

2023-11-10 03:00:36 408

原创 Ubuntu上安装 Chrome 浏览器

之后即使有更新也不用重新手动下载安装了,因为安装包会在 源里添加相应的信息。

2023-11-02 23:53:24 951

转载 How to enable/disable wayland on Ubuntu 22.04 Desktop

【代码】How to enable/disable wayland on Ubuntu 22.04 Desktop。

2023-10-28 00:04:01 312

原创 编译基于wanyland的 EFL

解决方法: 安装 gettext。

2023-10-28 00:01:59 175

原创 C++里的优先级队列

它是一个模板类:默认情况下是 max heap, 默认的比较函数是 std::less<T>.如果需要 min heap,或者是处理自定义的数据类型,需要提供定制的 比较函数。priority_queue 的实现使用了 std::make_heap, std::push_heap, std::pop_heap.

2023-07-31 00:14:35 171

原创 无线投屏手机(安卓)屏幕到 Linux(ubuntu 22.04)桌面

无线投屏安卓手机到 ubuntu

2023-07-23 18:23:26 2759 1

原创 宏函数的错误。

使用的时候发现结果不对,也没看出来错在哪了。现在能看出来代码错在哪了。

2023-07-03 01:03:24 185

转载 ubuntu中 删除 snap

snap

2023-06-06 00:55:53 952

原创 安装 Win11 + Ubuntu 22.04双系统

ubuntu+ win11 双系统安装

2023-04-16 22:57:50 1203 1

转载 Find Matching Text and Replace the Next Line

Find Matching Text and Replace the Next Line

2023-04-05 23:03:56 126

原创 力扣 1584. 连接所有点的最小费用

最小生成树

2023-01-27 11:46:12 161

原创 LeetCode: 最小体力消耗路径

优先级队列

2023-01-24 15:43:45 163

原创 如何找到发送信号杀死其他进程的程序

信号

2022-08-24 10:32:18 171

转载 How to find Which Process Is Killing mysqld With SIGKILL or SIGTERM on Linux

linux signal

2022-08-24 08:42:18 239

原创 Hanoi Tower问题的中间状态

Hanoi Tower问题

2022-08-06 18:24:01 111

原创 有序双向链表的实现。

双向链表

2022-07-24 17:24:20 407

原创 支持删除,更新任意结点的优先级队列

优先级队列

2022-06-26 16:10:41 167

原创 小写字母构成的字符串的哈希

字符串哈希

2022-06-18 16:44:14 257

转载 删除优先级队列的第k个元素

假定是最小堆。伪代码: 1, Delete a node from the array (this creates a "hole" and the tree is no longer "complete") 2. Replace the deletion node with the "fartest right node" on the lowest level of the Binary Tree (This step

2022-04-23 22:08:49 259

原创 Linux下怎么检查网线是否接上了

1. $ cat /sys/class/net/enp0s25/carrier11表示接上,0表示没接上。下面的命令表示网线状态是 UP还是DOWN:$ cat /sys/class/net/enp0s25/operstate upDown的话可以用命令 UP起来:ip link set dev eth1 up2.使用 ethtool$ ethtool enp0s25 | grep Link\ dCannot get wake-on-lan settings

2022-02-23 22:53:31 6904 2

转载 Opening a port on Linux

Before we learn about opening a port on Linux, let’s understand what network ports are. A port is a communication endpoint. Within an operating system, a port allows the data packets specific processes or network services.Typically, ports identify a spec

2022-02-23 22:30:59 303

原创 DJB Hash

unsigned long long hash( char *str){ unsigned long long hash = 5832; char c; while( (c = *str++) != '\0') { hash = (hash << 5) + hash + c; } return hash;}

2022-02-12 14:18:55 604

翻译 2D Transformations

1. 平移(translation)点 (x,y)平移到 (x',y'),经过的距离为 (tx, ty). 则x' = x + txy' = y + ty或者P' = P + T其中,2. 旋转(以坐标原点为中心喜转动角度 , 逆时针 大于0,顺时针 小于0假设点(x,y)绕原点逆时针转动 到(x',y'). 那么三角函数展开,最后可以得出:3. 绕任一点()旋转:3.1 平移点()到原点 T()3.2 旋转R(...

2022-01-13 08:32:40 328

原创 关于SIGBUS 信号

最近遇到一个程序因为收到 SIGBUS死机的问题。刚开始不清楚是哪个模块导致的,用 address sanitizer 也查不出来。后来想了一下,可以用gdb来执行程序,当收到了 BUS 消息的时候, gdb会自动在出问题的代码行停下来。下面是一个例子。// C program to demonstrate Bus Error#include <stdlib.h>#include <signal.h>#include <pthread.h>#incl

2022-01-09 23:46:42 3490

转载 Memory Layout of C++ Object in Different Scenarios

n this article, we will see the memory layout of different C++ Object. And how different storage & access specifiers affect this memory footprint. I am not going to discuss compiler augmented code, name mangling & working of any C++ mechanism relat

2021-10-21 22:19:59 147

原创 (C++)upcast的时候一定要用 dynamic_cast 吗?

如果是多继承,并且 upcast到不同的接口的时候,需要用dynamic_cast比如,下面的代码,第37行一定要用 dynamic_cast,因为它是从一个 基类接口转到另外一个基类借口。 1 class A 2 { 3 public: 4 virtual bool IsA(void) = 0; 5 protected: 6 int t_a; 7 }; 8 9 class B 10 { 11

2021-10-18 23:05:50 195

转载 Simple HTTP Server

ython has a super useful tool for serving files over HTTP. This is great if you just want to create a quick network share that other machines on your network can access. To do that just go to the directory you want to share and run:$ python -m SimpleH

2021-07-17 15:09:15 293

原创 怎么查看进程是不是有root privilege ?

可以用ps 命令看。ps elf | grep root$ ps -elf | grep root4 S root 1 0 0 80 0 - 6046 - 08:54 ? 00:00:02 /sbin/init1 S root 2 0 0 80 0 - 0 - 08:54 ? 00:00:00 [kthreadd]1 S root 3 2 0

2021-07-17 14:25:49 617

原创 error: expected expression before ‘{’ token

1 typedef struct 2 {3 int a;4 int b;5 }test;6 7 test tt[5];8 int main(void)9 {10 tt[1] = { 1, 2 };11 return 0;12 }GCC 编译出错:1.c:10:10: error: expected expression before ‘{’ token解决方法: 加上类型转换:tt[1] = (test){ 1, 2 };这里右边的 表达式实际上是 co.

2021-07-10 23:16:25 14298

转载 Leetcode 49. Group Anagrams

#include <stdlib.h>#include <stdio.h>#include <string.h>/*Entry represents a word. The key is string you get after re-arranging the word charachters in ascending order. Value represents the word itself.*/typedef struct { ch...

2021-05-30 10:14:37 130

原创 Heap sort

void maximizeHeap( int *nums, int idx, int size){ int v = nums[idx]; while( 2 * idx + 1 < size) { int a = 2 * idx +1; int b = 2 * idx +2; if( b < size && nums[b] >nums[a]) { a = .

2021-05-23 22:44:37 75

原创 Leetcode: 373. Find K Pairs with Smallest Sums

写的有问题的代码:/** * Return an array of arrays of size *returnSize. * The sizes of the arrays are returned as *returnColumnSizes array. * Note: Both returned array and *columnSizes array must be malloced, assume caller calls free(). */ struct pair {

2021-05-11 08:04:11 102

原创 std::async

std::async是用来异步的执行一个任务(通过一个函数)。它的声明如下:unspecified policy (1) template <class Fn, class... Args> future<typename result_of<Fn(Args...)>::type> async (Fn&& fn, Args&&... args);specific policy (2) template &l

2021-04-03 22:07:14 791

转载 What is this GLIBCXX error?

If you use enterprise or stable Linux distributions, sooner or later you will see an error like this:app: /lib64/libc.so.6: version `GLIBC_3.1.45' not found (required by ./app)Or like this:app: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not f

2021-03-27 23:41:48 221

Algorithm (4th), by Robert Sedgewick

Amazon 五星书。 Classic Reference The latest version of Sedgewick’s best-selling series, reflecting an indispensable body of knowledge developed over the past several decades. Broad Coverage Full treatment of data structures and algorithms for sorting, searching, graph processing, and string processing, including fifty algorithms every programmer should know. See algs4.cs.princeton.edu/code. Completely Revised Code New Java implementations written in an accessible modular programming style, where all of the code is exposed to the reader and ready to use.

2012-04-07

空空如也

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

TA关注的人

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