Skip to content

Instantly share code, notes, and snippets.

View alchem0x2A's full-sized avatar
👨‍🍼

T.Tian alchem0x2A

👨‍🍼
View GitHub Profile
@alchem0x2A
alchem0x2A / mathfont.org
Last active May 26, 2023 13:51
Useful math fonts in LaTeX

Math fonts that worth noting

Solutions taken from ftp://tug.ctan.org/pub/tex-archive/info/Free_Math_Font_Survey/survey.html in TUG.

Times-resemble math font

Use either txfonts or mathptmx for Times font support. I personally prefer txfonts since its mathcal symbols look more natural to me.

To use: include \usepackage{txfonts} or \usepackage{mathptmx} in

@alchem0x2A
alchem0x2A / blender_venv.org
Last active November 27, 2024 20:37
Enable 3rd-party packages in Blender using virtualenv

Install external python packages + virtualenv with Blender

Requirements: Blender 2.80+ (2.79 should also work with pip method, not tested thoroughly)

Step 1: Install virtualenv on the system

In order not to mix the packages installed for Blender (such as scipy, matplotlib) with those system-wide packages, we need to create a virtual environment for the Blender alone.

Best practice is to use a single virtualenv for each version of

@alchem0x2A
alchem0x2A / blender_cluster.org
Last active September 7, 2023 12:05
Render Blender file on cluster

Render Blender files on cluster

This is a easy workaround to enable Blender rendering on a super-computing cluster. The samples shown here are based on the Euler cluster of ETH Zürich (IBM LSF batch system).

Step 1: install Blender binary on cluster

@alchem0x2A
alchem0x2A / blender_snippet_2.8x_1.org
Created September 15, 2019 20:40
New python snippets Blender 2.8x
@alchem0x2A
alchem0x2A / python_lsf_install.org
Created September 23, 2019 13:40
Installation of python API for LSF system

Install python API for IBM LSF batch system

The short introduction describes how to install the python API for the IBM LSF batch system (like Euler cluster of ETH Zürich).

Find the system-wide LSF configure files

The python API relies on the system environment that is defined inside the file profile.lsf. On Euler cluster it is at: $LSF_ENVDIR/profile.lsf

Load the environmental variables by

@alchem0x2A
alchem0x2A / pybinding_obabel.org
Last active December 11, 2019 15:20
Installing Python binding for openbabel on HPC

Problem

Python binding for openbabel might be not trivial to install on HPC cluster. Simple pip install openbabel are very likely to fail. Sample error messages are like:

Error: SWIG failed. Is Open Babel installed?
    You may need to manually specify the location of Open Babel include and library directories. For example:
      python setup.py build_ext -I/usr/local/include/openbabel-2.0 -L/usr/local/lib
      python setup.py install
    ----------------------------------------
@alchem0x2A
alchem0x2A / compress-pdf-with-gs.md
Created March 19, 2020 11:19 — forked from drawveloper/compress-pdf-with-gs.md
Compress PDF files with ghostscript

This can reduce files to ~15% of their size (2.3M to 345K, in one case) with no obvious degradation of quality.

ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

Other options for PDFSETTINGS:

  • /screen selects low-resolution output similar to the Acrobat Distiller "Screen Optimized" setting.
  • /ebook selects medium-resolution output similar to the Acrobat Distiller "eBook" setting.
  • /printer selects output similar to the Acrobat Distiller "Print Optimized" setting.
  • /prepress selects output similar to Acrobat Distiller "Prepress Optimized" setting.
@alchem0x2A
alchem0x2A / ffmpeg-compress-mp4
Created March 19, 2020 11:20 — forked from lukehedger/ffmpeg-compress-mp4
Compress mp4 using FFMPEG
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4
@alchem0x2A
alchem0x2A / simple-nas-raspi.md
Last active April 14, 2023 14:53
NAS on Raspberrypi with Ubuntu Server 20.04

This is a very rough tutorial for myself when setting up the "NAS" on Raspi4. Don't copy all steps if you want RAID on the NAS (for the moment)

Network setting part

  1. Burn the image of Raspberry Pi onto the card. Follow this guide
  2. Edit the Wifi / SSH / password etc
  3. Install mDNS avahi-daemon. Remeber to enable the lines with

publish-workstation=yes

@alchem0x2A
alchem0x2A / fireworks_yaml_examples.md
Last active March 22, 2022 04:34
Example launchpad settings for FireWorks when working with mongodb.com database

Example yaml files to use launchpad in FireWorks

Choose the template for your configuration

  • Plaintext password: my_lauchpad_passwd.yaml
  • X509 TLS certificate: my_lauchpad_certx509.yaml

Remember to modify the fields marked with <>. The certificate file should be placed in a searchable location (with proper mode)