Skip to content

Instantly share code, notes, and snippets.

View shyuep's full-sized avatar
👁️

Shyue Ping Ong shyuep

👁️
View GitHub Profile
@shyuep
shyuep / create_local_mp.py
Last active May 19, 2022 16:20
Creating a local MP database for fast querying.
import pymongo
from pymatgen.ext.matproj import MPRester
# This connects to your local MongoDB without any credentials.
client = pymongo.MongoClient()
db = client.matproj
mpr = MPRester()
entries = mpr.get_entries(
{},
inc_structure=True,
#!/usr/bin/env python
"""
Script for managing PBS queue systems. Only dependencies required are
xmltodict and tabulate, which are easily pip installable.
"""
import os
import sys
import re
@shyuep
shyuep / collaborators_list.py
Last active May 4, 2023 02:06
Generates a NSF collaborator list from a bibtex.
#!/usr/bin/env python
"""
Script for generating collaborators in a csv file from a bibtex, for easy
insertion into the new NSF format.
"""
from __future__ import division
import datetime
@shyuep
shyuep / reqman
Last active August 21, 2019 19:50
Requirements.txt manager
#!/usr/bin/env python
import subprocess
import sys
import argparse
import warnings
import re
from pkg_resources import get_distribution, parse_version, DistributionNotFound
@shyuep
shyuep / SP's Approved Eating Places in SoCal.md
Last active May 13, 2017 17:48
SP's Approved Eating Places in SoCal

SP's Approved Eating Places in SoCal

List is not ranked. At this level, food preference dominates.

Chinese

  1. Chun's Seafood and Grill - 9355 Kearny Mesa Rd, San Diego, CA 92126. Good Shanghainese. The Lion's Head Casserole is decent. On weekends, the brunch is excellent with reasonable soy bean curd and deep fried fritters.

  2. China Max - 4698 Convoy St C101, San Diego, CA 92111. The only reasonable dim sum place in SD. Jasmine down the street is ok and offers an authentic "cart-style" experience, but extremely busy. Personally, think China Max is better food-wise.

@shyuep
shyuep / cleangd
Last active December 13, 2015 21:38
Clean Google Drive
#!/usr/bin/env python
import os
import glob
import re
import shutil
import filecmp
"""
Simple script for cleaning Google Drive of bad renames (e.g., add " (1)" to file or folder names)
@shyuep
shyuep / pyltx
Last active June 11, 2017 05:38
pyltx is a script with some useful tools to working with LaTeX. Download or clone it, give it executable permissions, and then run "pyltx -h" to see what it can do.
#!/usr/bin/env python
"""
pyltx is a script with some useful tools to working with LaTeX.
Run "pyltx -h" to see what it can do.
Some basic functionality include:
1. Compiling latex with multiple repetitions to ensure correct references,
with options to clean previous output files and build a file with an
integrated bibliography.
@shyuep
shyuep / convert_struct.py
Last active December 21, 2015 11:38
A simple, no-dependencies script to convert a structure to and from various formats using the MAVRL's matgenie REST interface.
#!/usr/bin/env python
import json
import urllib
import urllib2
import sys
if len(sys.argv) != 4:
print('Usage is "python convert_struct.py filename input_format output_format".'
'Input/output formats should be any one of poscar, cif, cssr or mson')
@shyuep
shyuep / mp_reaction.py
Created September 1, 2012 11:28
Getting calculated and experimental reaction energies using the Materials API + pymatgen.
#!/usr/bin/env python
from pymatgen.matproj.rest import MPRester
from pymatgen import Composition
from pymatgen.entries.computed_entries import ComputedEntry
from pymatgen.core.physical_constants import EV_PER_ATOM_TO_KJ_PER_MOL
from pymatgen.analysis.reaction_calculator import ComputedReaction
#This initializes the REST adaptor. Put your own API key in.
a = MPRester("YOUR_API_KEY")
@shyuep
shyuep / mp_phase_diagram.py
Created September 1, 2012 11:23
Phase stability using the Materials API + pymatgen.
#!/usr/bin/env python
from pymatgen.matproj.rest import MPRester
from pymatgen.phasediagram.pdmaker import PhaseDiagram
from pymatgen.phasediagram.plotter import PDPlotter
#This initializes the REST adaptor. Put your own API key in.
a = MPRester("YOUR_API_KEY")
#Entries are the basic unit for thermodynamic and other analyses in pymatgen.