Senarios Let’s say we have a directory animes, with several sub directories, one of which is animes/Dandadan. And now: In this scenario, we could use ACL (getfacl and setfacl) to achieve such permission management. Check ACL Status First let’s go to animes directory: -a/–access means only showing the access setting, without default::*, we will useContinue reading “Create Shared-Permission Directory Using ACL”
Author Archives: Oyasumi
Clash Load Balancing to Bypass Speed Limit
Note: Author is using: As the image shows, some proxy providers will provide some nodes specifically dedicated to downloading task, with lower ratio but lower rate limit (10Mbps in image above). This post demonstrates how to use Load Balance proxy group feature in clash core to download files using several such “download nodes”, effectively bypassingContinue reading “Clash Load Balancing to Bypass Speed Limit”
Git LFS
Enable LFS Install & Track First of all, install lfs for git using following command: Then add track of large files using lfs: Note that the command above will also update .gitattributes file automatically. Migrate Steps above will only handle future large files. To migrate large file to LFS storage for previous commits, we couldContinue reading “Git LFS”
About GPG
For GPG basic concepts, check out this blog post on Median, which well explained what GPG is and the basic practice is about it. Sign Content Here we use Kleopatra on Windows to demonstrate how to sign content using its Notepad feature. As shown above: Sign Commit Using Git Set Up GPG Sign for GitContinue reading “About GPG”
A Simple Image Hosting Solution Using FTP
Previously trying to use NextCloud and webdav as the way to upload and manage images, but it turns out that deal with share links of those images in NextCloud is not a easy thing to do, so I started to think another way. I found this project on GitHub called PicGo, which allows user toContinue reading “A Simple Image Hosting Solution Using FTP”
Gitea – Self-Hosted Git & CI/CD Tools
This article is about my deployment experience of Gitea, a self-hosted GitHub like code hosting service which also support CI/CD pipeline workflows like GitHub Action. Why I Need It Recently, I was searching for a way to host Obsidian vault on the Internet. There is an official way to achieve this using Obsidian Publish, however,Continue reading “Gitea – Self-Hosted Git & CI/CD Tools”
Simple Callback Function In C++
This article will discuss the basic practice of using callback functions in C++ Function Type To use function type as parameter, it’s recommended to use functional library to define function type: In the code snippet above: Use With Lambda It’s recommended to use Function Type with Lambda Expression: For more info about the C++ LambdaContinue reading “Simple Callback Function In C++”
Segment Tree
Theorem Some diagrams and contents are based on Segment Tree – Algorithms for Competitive Programming. A segment tree should be a binary tree like the one below, additionally, we could proof that Segment Tree should NOT have any node with degree 11. Based on the property of binary tree, we can calculate the index ofContinue reading “Segment Tree”
Lambda Expression in C++
Lambda表达式是编程中很实用的工具,作为热门的,最受欢迎编程语言之一(大概?),C++11及其以后版本,也提供了对lambda表达式的支持,下面让我们逐步学习和了解C++中的Lambda表达式吧 首先我们先看一个lambda表达式的使用例子: 观察得到,C++ lambda表达式基本结构如下: 接下来我们将逐个部份进行介绍。 Capture Clause 首先是第一部份[]。这一部份被称之为捕获语句(Capture Clause)。在这一部份,你可以捕获lambda声明时范围内的变量。你可以在周围环境中捕获需要的变量,同时可以选择捕获类型为值传递还是引用传递。 默认情况下,Capture语句中捕获的变量将会以值传递形式传递。 需要注意,配置默认捕获模式将会将周围环境的所有变量暴露给lambda表达式。如上述代码,lambda c和d均设置了默认Capture设置,这种情况下,周围环境的所有变量都将会被Capture,c和d可以各自依照自己设定好的默认捕获模式访问到num2,但是a和b不能访问到num2。 同时,lambda表达式初始化时,也允许进行赋值操作,请看下面的代码。 如上述代码,我们可以在lambda表达式的 Capture Clause 部分声明新的变量。新的声明变量同样可以是值传递或者引用传递。需要注意的是,在 Capture Clause 声明变量时,我们无需显式指定变量类型,lambda表达式会自动推断其类型(如上述代码中,refToC自动被推断为 int & 类型) 还有一个需要注意的点,默认情况下,Capture Clause 中捕获和声明的所有变量将会以const形式进行传递。也就是说lambda body中,默认不可以对 Capture Clause 中的变量进行更改。如果您想在 lambda body 中对 Capture Clause 中的值或者引用进行更新或修改,请在参数列表,函数体前加上mutable关键字。
An Approach to Implement Log2 Lower Bound Function
If we consider the binary representation of numbers, we could find that the result of log2(n)\log_2(n) is actually related to the position of the first appearance of 11 in the binary bits. Let’s see some example below: For any positive integer nn, we have the following relationship: