Skip to content

Instantly share code, notes, and snippets.

View yymao's full-sized avatar

Yao-Yuan Mao yymao

View GitHub Profile
@yymao
yymao / scatter.php
Last active August 4, 2017 17:52
Plots of Everything vs. Everything: A web interface which shows scatter plots with any two columns in a Google Spreadsheet with Google Charts API.
<?php
if (!isset($_GET['url']) or !preg_match('/(?:\/spreadsheets\/d\/|[?&]key=)([\w-]+)/', $_GET['url'], $matches)) {
?>
<!DOCTYPE html>
<html>
<head>
<title>Plots of Everything vs. Everything</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/build/pure-min.css">
@yymao
yymao / adstex.md
Last active November 13, 2019 20:23
This project has been moved to https://github.com/yymao/adstex

This project has been moved to https://github.com/yymao/adstex

You can now install adstex by

pip install adstex

and then run it with

adstex file1.tex [file2.tex [...]] -o references.bib
@yymao
yymao / astro-portal.php
Last active November 4, 2019 12:22
astro portal: search for arXiv, DOI, ADS bibcode, and first author + year, without typing syntax keywords!
<?php
if(isset($_GET['q'])){
$url_base = 'https://ui.adsabs.harvard.edu/#search/q=';
#doi
$re = '/\b10\.\d{4,}(?:\.\d+)*\/(?:(?![\'"&<>])\S)+/';
if (preg_match($re, $_GET['q'], $matches)){
if (isset($_GET['rd'])){
$url = $url_base . 'doi%3A' . urlencode($matches[0]);
}
@yymao
yymao / SimulationCheatsheet.py
Last active August 29, 2015 14:05
A python script to generate a "simulation cheat sheet" which shows the relation between number of particles, box sizes and mass resolutions.
# Simulation Cheatsheet by Yao-Yuan Mao
import math
import numpy as np
import matplotlib.pyplot as plt
rho_crit = 2.7745945707e+11
log10_rhom_30 = math.log10(rho_crit*0.30)
log10_rhom_25 = math.log10(rho_crit*0.25)
log2_10 = math.log(10, 2)
@yymao
yymao / TracyWidom.py
Last active January 13, 2021 07:18
Moved to https://github.com/yymao/TracyWidom - Provide the Tracy-Widom distribution functions for beta = 1, 2, or 4 in Python. Dependencies: NumPy and SciPy.
"""
This project has been moved to https://github.com/yymao/TracyWidom
You can install this package by `pip install TracyWidom`
Please open issues at https://github.com/yymao/TracyWidom/issues
TracyWidom.py
A Python module to generate Tracy-Widom distribution functions
Author: Yao-Yuan Mao (yymao)
The MIT License (MIT)