Skip to content

Instantly share code, notes, and snippets.

View yiyuezhuo's full-sized avatar
🦆

January Desk yiyuezhuo

🦆
View GitHub Profile
@yiyuezhuo
yiyuezhuo / gist:b1cf63ee922589034f222192c6fc49bb
Created March 2, 2019 13:23
convert_latex_into_docx.py
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 2 18:11:45 2019
@author: yiyuezhuo
Require:
python-docx
https://github.com/python-openxml/python-docx/issues/320
https://python-docx.readthedocs.io/en/latest/user/quickstart.html
@yiyuezhuo
yiyuezhuo / char figure
Created April 30, 2019 05:17
char figure
zzz
 <⌒/ヽ-、___
/<_/____/
 ̄ ̄ ̄ ̄ ̄ ̄ ̄
    ∧_∧
   ( ・ω・) 谜叔撸洞打雷又更新了!看爆!
  _| ⊃/(___
/ └-(____/
 ̄ ̄ ̄ ̄ ̄ ̄ ̄
@yiyuezhuo
yiyuezhuo / HTMLClipboard.py
Created May 18, 2019 14:21 — forked from Erreinion/HTMLClipboard.py
HTMLClipboard with updates for Python 3. Includes exception handling for locked clipboard. Improvement of: http://code.activestate.com/recipes/474121/
"""
Created on Sep 24, 2013
@author: RandomHardcoreJerks
Requires pywin32
original: http://code.activestate.com/recipes/474121/
# HtmlClipboard
@yiyuezhuo
yiyuezhuo / grad.py
Last active August 2, 2019 07:18
compute gradient in pytorch. I try to extend the original one(https://gist.github.com/sbarratt/37356c46ad1350d4c30aefbd488a4faa) to implement multiple dimention support:
def compute_jacobian(f, x, output_dims):
'''
Normal:
f: input_dims -> output_dims
Jacobian mode:
f: output_dims x input_dims -> output_dims x output_dims
'''
repeat_dims = tuple(output_dims) + (1,) * len(x.shape)
jac_x = x.detach().repeat(*repeat_dims)
jac_x.requires_grad_()
@yiyuezhuo
yiyuezhuo / reset_envs4.bat
Created September 18, 2019 07:47
reset python env
set path=""
set path=%cd%\anaconda_silent;%cd%\anaconda_silent\Scripts;%cd%\anaconda_silent\Library\bin
set path=%path%;C:\Windows\system32;C:\Windows
cmd
@yiyuezhuo
yiyuezhuo / test.ipynb
Created December 29, 2019 08:10
extract_points
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yiyuezhuo
yiyuezhuo / model_ensemble.ipynb
Created February 6, 2020 03:58
video ensemble result
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yiyuezhuo
yiyuezhuo / test_mle_cleaned.ipynb
Created February 14, 2020 04:33
Some Julia Optim.jl MLE example
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yiyuezhuo
yiyuezhuo / StanModel_cache.py
Created February 16, 2020 00:34
colab gists
import pystan
import pickle
from hashlib import md5
def StanModel_cache(model_code, model_name=None, **kwargs):
"""Use just as you would `stan`"""
code_hash = md5(model_code.encode('ascii')).hexdigest()
if model_name is None:
cache_fn = 'cached-model-{}.pkl'.format(code_hash)
else:
@yiyuezhuo
yiyuezhuo / arviz_julia_union_2.ipynb
Created March 4, 2020 16:12
8 school trace and conditional distribution
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.