Rescue mistakenly deleted files on Linux

First Aid

The first move should shutdown or unmount the partition, prevent further writing to the storage, then use a secondary system to do the rescue work.

The stretch

However, in my case, I was inside a virtual host. Here is what I do:
So I tried to do things with minimal steps to avoid crazy disk IO.


Casual brain-hacking, sort of

Back in 2018 June, I got a pretty big downtime of my life, so I had the chance to try out some of the supplements that I’ve been wondering for a while.

Since I have trying out Bulletproof Coffee to boost my productivity. It is nature for me to discover the sector of Nootropics. Simply put, a more dedicate way to mess up your own brain and squeeze some more production out of your mind.


Multiple bash sessions and their history

I’ve trying to move some console work to my mobile device, iPhone, especially.
So I start to use Blink Shell, which is an iOS app supports ssh and mosh connection.

Then, naturally I bump in to the problem when there is more than one bash session undergoing, the bash command history gets mess up.

If you ever use !numbers, eg. !1, run the first command in bash history, this situation gets annoying at some point.


Set up schnack! with Hexo

This post is a note to official tutorial, please read them altogeher.
Hope you will able to avoid some issues that I encounter during set up schnack!.

Before the installation

  • If you are using https, make sure also issue the ssl certificate to the subdomain that schnack! service is going to use.
    • This will avoid CORB and similar resource blocking issues.
    • Set up proxy pass (specific subdomain to a port) for schnack! service, this would also reduce some confuse for later set up.
  • If you are behind a firewall make sure open the port 3000(default) for schnack!.


Using git hook with Hexo on self-hosted server

Hexo supports github page by default, which is very nice. But when coming to use a local bare git repository is a bit tricky.

Here is the git hook script coming to rescue, {in target bare repo}/hooks/post-receive:

#!/usr/bin/env bash
git --work-tree=/home/$USER/{published repo} --git-dir=/home/$USER/{published repo}/.git pull

{published repo} is the working git repo that ideally also use for web server root path.

After _config.yml being properly set up, now I am able to streamline the deploying process without manuall pulling the published repository every single time.

$ hexo g -d