Skip to content

Instantly share code, notes, and snippets.

View alchem0x2A's full-sized avatar
👨‍🍼

T.Tian alchem0x2A

👨‍🍼
View GitHub Profile
@alchem0x2A
alchem0x2A / Boot Into LiveCD from Grub.md
Last active July 6, 2023 20:26 — forked from carlitoplatanito/Boot Into LiveCD from Grub
Boot into a LiveCD from Grub when bootable CD or USB is broken on old PC

Useful command when Alt+power fails in macbook installation

  1. Determine the disk number
# Enter grub cmdline by pressing Right-Shift and c
grub> ls
(proc) (hd0) ...
@alchem0x2A
alchem0x2A / gh_colab_init.sh
Last active January 21, 2023 07:32
Initialize google colab with ocpmodels dependencies
#!/bin/bash
# This script runs a bootstrap process to setup gh in google colab and setup the authentication
# It requires GITHUB_TOKEN to be set (e.g. use a cell with `getpass`)
if [ -z "$GITHUB_TOKEN" ] && [ -z "$GH_TOKEN" ]
then
echo "Neither GITHUB_TOKEN nor GH_TOKEN not set! Exit"
exit 1
fi
# Download the gh cli for debian
@alchem0x2A
alchem0x2A / cori_hsw.txt
Last active April 3, 2023 14:58
vasp-interactive related gists
vasp/5.4.4-hsw, all pass
vasp/6.2.1-hsw, all pass
vasp/6.3.2-hsw, all pass
vasp-tpc/5.4.4-hsw, all pass
vasp-tpc/6.2.1-hsw, all pass
vasp-tpc/6.3.2-hsw, all pass
#Last updated: 2022-10-28T19:33:13-0700
@alchem0x2A
alchem0x2A / oal_exp_gpu.py
Last active April 18, 2022 15:39
Finetuna w/ GPU training
from finetuna.atomistic_methods import Relaxation
from finetuna.online_learner.online_learner import OnlineLearner
from vasp_interactive import VaspInteractive
from ase.optimize import BFGS
from finetuna.ml_potentials.finetuner_ensemble_calc import FinetunerEnsembleCalc
from ase.io import Trajectory
from finetuna.utils import calculate_surface_k_points
if __name__ == "__main__":
@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)

@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 / 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 / compress-pdf-with-gs.md
Created March 19, 2020 11:19 — forked from guifromrio/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 / 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 / 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