docker

基本概念 Follow me 根据debian镜像,创建一个sshd服务。本地使用的环境是windows11 docker desktop + WSL2。 docker commit 创建镜像 1 2 # pull debian image and enter bash docker run

IFS生成分形图案

最近看到一种分形图案hexaflake,其介绍可以在wiki看到,尝试使用python来生成这个图案。 IFS 生成方法叫做IFS,迭代函数系统。I

最大堆操作

最大堆的应用

在刷题时遇到一个适合使用最大堆来解决的问题,刚好在C++标准库的算法库中有堆操作的相关算法,可以直接应用在容器上。回忆一下最大堆的原理,简单实现一下堆操作。

C++函数式编程与Rust对比

在刷leetcode的时候,想使用c++20的范围库,体验一下函数式编程的快乐。这一题是leetcode 300题。 300. Longest Increasing Subsequence Given an integer array nums, return the length of

记一次文件锁死锁问题

flock是Linux系统提供的一个系统级的锁,可以用作进程间的同步,man 2 flock,显示其用法是

1
2
3
4
5
NAME
       flock - apply or remove an advisory lock on an open file
SYNOPSIS
       #include <sys/file.h>
       int flock(int fd, int operation);