Recent Posts

[Tips]Why command “sleep 1m” doesn’t work in mac

Problem

In my shell script, “sleep 1m” command doesn’t wait 1 minutes but 1 second.

sleep.sh

#!/bin/sh
echo "start timer"
sleep 1m
echo "stop"

Environment

macOS Catalina 10.15.5

The cause of this problem

In Mac OS X, sleep command doesn’t work with quantifiers and takes argument num just as num seconds.

Reference: OSX bash “sleep”, Mac OS X Man Pages

Solution

Use 60 times minutes.

sleep.sh

#!/bin/sh
echo "start timer"
sleep 1*60
echo "stop"

[Tips] Where Is Python Module Directory?

GOAL

To find the directory where python libraries are.

Method

Use sys.path

You can get the list of module search paths. Find the directory you’d like from the list.

>python
Python 3.8.6
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
---The list of module search paths---

Appendix

You can find the directory where python.exe is by using “where” command.

>where python
C:\Users\<USER_NAME>\AppData\Local\Microsoft\WindowsApps\python.exe
C:\Python27\python.exe

How To Recover From An Error Caused By Plugin

I could neither open nor edit a post in WordPress. The error “Uncaught (in promise) TypeError: Cannot read property ‘replace’ of undefined” occurred.

Problem

I created a post with “Enlighter Sourcecode” block by using Enlighter plugin and save the post. When I opened the saved post, the error “Uncaught (in promise) TypeError: Cannot read property ‘replace’ of undefined” occurred and nothing was displayed.

Environment

WordPress 5.5.3
Enlighter – Customizable Syntax Highlighter 4.4.1

The cause of this problem

Reference: Unable to edit posts when EnlighterJs is enabled

The block is somehow corrupted.

Solution

1. Deactivate the plugin at issue.

2. Open the post in edit mode and copy all contents.

3. Activate the plugin again. And create new post and paste it.

Categories

AfterEffects Algorithm Artificial Intelligence Blender C++ Computer Graphics Computer Science Daily Life DataAnalytics Event Game ImageProcessing JavaScript Kotlin mathematics Maya PHP Python SoftwareEngineering Tips Today's paper Tools TroubleShooting Unity Visual Sudio Web Windows WordPress 未分類