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
  • 03:30 (UTC +02:00)
  • LinkedIn in/qin-yu
View GitHub Profile
@qin-yu
qin-yu / install-cuda-ubuntu.md
Last active April 6, 2020 20:32
Install CUDA 10.1 on Ubuntu 18.04
@qin-yu
qin-yu / fixpip3.md
Last active January 19, 2020 14:40
When pip3 gives errors on "No module named 'pip._internal'"

How to fix No module named 'pip._internal'

$ pip3

Traceback (most recent call last):
File "/home/qinyu/.local/bin/pip3", line 7, in <module>
   from pip._internal import main
ModuleNotFoundError: No module named 'pip._internal'
@qin-yu
qin-yu / pythongpu.md
Last active January 19, 2020 14:30
how to specify gpu used for python scripts

If you have > 1 gpu, the first gpu is #0 and the second is therefore #1, etc.

$ CUDA_VISIBLE_DEVICES=1 python3 ~/.../faceswap.py train -A ~/.../face1 -B ~/.../face2 -m ~/.../models -p

How to move Mac Time Machine backup from one disk to another (or two) disk(s) THE RIGHT WAY

(In fact, you can have more than one Time Machine backup disks, MacOS will backup your whole system alternately into them)

!! DO NOT USE APPLE OFFICIAL APPROACH (DRAG-N-DROP), WHICH COSTS WEEKS TO FINISH WRITING 10x DISKS !!

  1. Open Disk Utility (/Applications/Utilities/Disk Utility.app).
  2. Check the format of your new backup drive. It needs to be a GUID partition and formatted as Mac OS Extended (Journaled).
  3. Temporarily turn Time Machine off.
  4. In Disk Utility select the new backup drive.
@qin-yu
qin-yu / ubuntu-mic.md
Created January 19, 2020 14:27
How to fix it when Ubuntu detect your mic but still no input
@qin-yu
qin-yu / search-math-symbol.md
Last active January 19, 2020 21:15
How to search for a mathematics symbol of which you don't know the name?

How to search for a mathematics symbol of which you don't know the name?

When typing in Latex, I often desperately wonder what are those weird mathematics symbols called???

Solution:

Go to the Detexify website and draw it!

p.s. it turned out to be in a GitHub repo: kirel/detexify.

@qin-yu
qin-yu / shortcut-macos.md
Created January 21, 2020 15:53
Shortcuts not working on Mac/MacOS

Shortcuts not working on Mac/MacOS

One possibility is that the keyboard setting is bad for the massive amount of shortcuts we are using. The system default input source is ABC - Extended, which causes ++f to input a ̰ character. For example, in VS Code, to format a document, one uses ++f, which inputs ̰ instead of executing the shortcut.

Solution

Just change the ABC - Extended input source to ABC.

@qin-yu
qin-yu / auto-format-matlab.md
Created January 22, 2020 18:57
How to format MATLAB files?

How to format MATLAB files?

  1. Go to the GitHub repo of MBeautifier and clone/download it to anywhere as a library/package for MATLAB.
  2. Add the root directory of MBeautifier to the MATLAB path, e.g. on MacOS:
  • Add the folder /path/to/MBeautifier to the beginning of the search path on a UNIX® system:
oldpath = path;
path('/path/to/MBeautifier',oldpath)
  1. Perform formatting on the currently active page of MATLAB Editor. Command:
@qin-yu
qin-yu / fortran-system.md
Created January 23, 2020 16:32
Error: The CALL statement is invoking a function subprogram as a subroutine

SYSTEM is a function that returns an integer result, so declare a variable:

integer iret

and then change the call to:

iret = system(tmpline)

The Fortran standard does not allow calling a function as a subroutine. Indeed, earlier versions of our compiler did allow this, under some conditions, but the restrictions were not enough to avoid possible bad results and, after long debate, we decided that as the number of cases where this was harmless was small enough it was simpler to just make it an error. The problem has to do with mismatched assumptions about where arguments and return values get placed.