Skip to content

Instantly share code, notes, and snippets.

View yiyuezhuo's full-sized avatar
🦆

January Desk yiyuezhuo

🦆
View GitHub Profile
@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.
@yiyuezhuo
yiyuezhuo / hoi4_land_unit.html
Last active March 5, 2020 17:04
hoi4_raw_data
<!DOCTYPE html>
<html class="client-nojs" lang="en" dir="ltr">
<head>
<meta charset="UTF-8"/>
<title>Land units - Hearts of Iron 4 Wiki</title>
<script>document.documentElement.className = document.documentElement.className.replace( /(^|\s)client-nojs(\s|$)/, "$1client-js$2" );</script>
<script>(window.RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"Land_units","wgTitle":"Land units","wgCurRevisionId":35637,"wgRevisionId":35637,"wgArticleId":339,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["Potentially outdated","1.5","Units"],"wgBreakFrames":false,"wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgMonthNamesS