Skip to content

Instantly share code, notes, and snippets.

View qin-yu's full-sized avatar
🦏
Bioimage Safari

Qin Yu qin-yu

🦏
Bioimage Safari
  • EMBL
  • Heidelberg, Germany
  • 05:50 (UTC +02:00)
  • LinkedIn in/qin-yu
View GitHub Profile

When you are not able to embed/add an image from GitHub to your MarkDown files such as a page in Sphinx or Jupyter Book, maybe you are using blob instead of raw in the image URL.

For example, if you use https://github.com/hci-unihd/plant-seg/raw/assets/images/plantseg_overview.png then the link is to an image, but https://github.com/hci-unihd/plant-seg/blob/assets/images/plantseg_overview.png is to the GitHub page that contains the image.

Click to see the difference:

@qin-yu
qin-yu / change-creation-and-modified-dates.py
Last active November 19, 2023 15:41
How to change the date of creation and the date of modification of files on macOS, based on filename (and add an offset).
import os
import re
import subprocess
from datetime import datetime, timedelta
def set_creation_date(file_path, creation_date):
"""
Set the creation date of a file.

If Chrome browser doesn't show correct resolution and sharp boundaries, append this parameters /high-dpi-support=1 /force-device-scale-factor=1 to the target field in Properties:

image

Ubuntu20.04 Wine 6.0 微信中文显示方块/方框

如果希望在Ubuntu使用Windows版微信:

  1. 安装 Wine sudo apt-get install wine
  2. 先把环境改了省事:
    $ export WINEARCH=win32
    $ export WINEPREFIX=/home/qinyu/Wine/WeChat
  3. 创建 Wine Bottle

If conda install fails to resolve dependencies, install packages with all channels used before. For example, use

$ conda install napari vigra elf nifty pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c nvidia -c conda-forge -c cpape

instead of

$ conda install napari vigra nifty -c conda-forge

If you have GSettings schema undefined not found during installation of Panel World Clock (Lite) by Nei, then it might not be a problem with GSettings or gnome. If you installed gnome-clock with snap, remove it by snap remove gnome-clock and then reinstall it by apt. Now reinstall panel world clock, logout and login again.

@qin-yu
qin-yu / omp-error-no34.md
Last active May 7, 2021 18:05
OMP: Error #34: System unable to allocate necessary resources for OMP thread; OMP: System error #11: Resource temporarily unavailable; OMP: Hint Try decreasing the value of OMP_NUM_THREADS.

OMP: Error #34 Solution

by Qin Yu, May 2021

If you get the following error during training with TensorFlow, then this is relevant to you (though this is an OpenMP/OMP error):

OMP: Error #34: System unable to allocate necessary resources for OMP thread:
OMP: System error #11: Resource temporarily unavailable
OMP: Hint Try decreasing the value of OMP_NUM_THREADS.

Some important things to note when one tries to use a remote interpreter in PyCharm:

  1. If you are using two instances of PyCharm, e.g. on two differenct machines:
    • map the project to a separate folder in the remote disk, the default /tmp/_______ should be fine, but it could be anywhere.
    • map the .pycharm_helper folder to a separate directory too, e.g. for home machine access create a ~/.pycharm_helper_home to map to.
  2. If you are using conda environments, do the following to actually get conda working:
    • suppose you are using an environment called my_conda_env, find the location of the python executable, e.g. you can do
      $ conda activate my_conda_env
      $ which python