Buy Me a Coffee

[GIMP/Linux] How to highlight on the screenshot with GIMP on Linux

Since I changed my Operating System from Windows to Ubuntu, I have been looking for a tool that can make a screenshot and put a highlight on it. Something like the Snipping Tool on Windows. It is hard to find such tool on Linux. However, I found a way to achieve the goal with two tools. Screenshot (Ubuntu installed software. Open it from Ubuntu Activities) GIMP (GNU Image Manipulation Program. Download from https://www.gimp.org/downloads/) This post will show how to use the above tool to highlight a screenshot step by step. ...

[Slack] no_text error with Slack integration

Recently I had a task to integrate Slack notification in Github Action workflow. Thanks to the repository slack-github-action, the work becomes much easier. The Slack integration works well when the payload only contains text and block. However, an error popped up while I changed the payload only with attachments. (We can add color to attachments which will highlight the message in Slack channel) The error was axios post failed, double check the payload being sent includes the keys Slack expects\n Error: no_text The first reaction after seeing the error is that I should add a text into the payload. But it turned out that the Slack message will only show the text content and ignore the attachment. ...

[Helm] How to check semantic version in helm chart

Helm chart supports the semantic veresion check function. We can find it here 1. Compare semantic version string It is very helpful for some cases. For example, if the helm chart needs to decide the probe port based on the docker image version. Let’s say that a web service started to support HTTPs feature since version 22.5.0, so if the installed docker image is after 22.5.0, the default probe port should be 8443. Otherwise, the default probe port will be 8000 ...

[Git] Unable access xxx: Is a directory

When I run git status, it shows the below error warning: unable to access '/etc/gitconfig': Is a directory warning: unable to access '/etc/gitconfig': Is a directory warning: unable to access '/etc/gitconfig': Is a directory The solution is to remove /etc/gitconfig. The target /etc/gitconfig might be varied from each case. With the below command, all can be solved. sudo rmdir /etc/gitconfig The reason that the problem suddenly pops up is because I ran a experiment docker command something like docker run --rm -v /etc/gitconfig:/etc/gitconfig ..... So the /etc/gitconfig is created. ...

[Git] Error: remote rejected (permission denied)

The error pop up When I pushed the changes on a new branch for the first time. ! [remote rejected] oscar-next -> oscar-next (permission denied) error: failed to push some refs to 'https://github.com/oscarzhou/portainer.git' The solution is to update the git config like below git config --local --list # old config remote.origin.url=https://github.com/oscarzhou/bar.git # update new config with git config remote.origin.url https://foo%40gmail.com@github.com/oscarzhou/bar.git After that, we can run git push --set-upstream origin <branch_name> ...

[Git] Fatal: this operation must be run in a work tree

fatal: this operation must be run in a work tree The error pop up while running git status. The solution is to change the repository not bare mode git config core.bare false

[Git] How to rebase the pushed branch

Learning the knowledage with a real case is always perferred. I met a case today that I need to use git rebase --interactive to solve the issue. The story is that my colleague created a branch for doing some research one year ago. Let’s say the branch name is feat/performance-research. As the branch is mainly for research purpose, it was not merged to the master branch at that time. However, some changes and results were quite valuable. ...

[Axios] How to extract header data in Axios response interceptor

Let me give an example first. Frontend sends an API request, and server will reject it and add a reason of the rejection into the response header. In this scenario, Frontend wants to extract the reason from the header in the response interceptor and then navigate to different page depending on the reason. The code is very straightforward like below. 1export function errorInterceptor(error: AxiosResponse) { 2 if (error.status === 401) { 3 const reason = error.headers['reason']; 4 if (reason === 'bar') { 5 window.location.href = '/#!/foo'; 6 } 7 } 8 return Promise.reject(error); 9} 10 11axios.interceptors.response.use( 12 (response: AxiosResponse) => response, 13 errorInterceptor 14); Unfortunately, the above code will behave unexpectedly. As the highlight code error.headers['reason'] will be undefined. ...

[Linux] Error: ENOSPC: System limit ...

I can do general frontend work, but I’m not specialized in front end. Today when I run up the front-end project, I met the following issue. Error: Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached... The reason is that there is restriction of opening files by one process in Linux. The default number of opening file might be too limited especially when you run with webpack. The solution is to increase the limitation. You can change as below. ...

[Ubuntu] How to mount the external hard drive permanently

I will introduce this topic with a real example. The scenario is that I have two external NTFS hard drives. I want them to behave like the partition on Windows, like D drive, E drive something. However, every time when the Ubuntu is rebooted, those two hard drives are mounted to the path /media/<username>/<label name> and they are read-only. I wrote a temporary solution for the above issue, but it stil requires to execute the command every time when PC boots. This post will give a one-go solution. ...

DigitalOcean Referral Badge
Sign up to get $200, 60-day account credit !