Skip to content

Instantly share code, notes, and snippets.

View cwhy's full-sized avatar

Chen Yu cwhy

View GitHub Profile
@cwhy
cwhy / mixed_moments.py
Last active May 27, 2017 13:54
Calculate mixed moments of multi-variate data
# By CWhy
# [email protected]
import numpy as np
import tensorflow as tf
# Generate equation for mixed moments
def moments_eqn(_l, order):
if order == 1:
return _l
r = []
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cwhy
cwhy / local_ver.md
Last active March 29, 2020 11:08
Create a local version of python
sudo apt install build-essential zlib1g-dev libssl-dev openssl sqlite libsqlite3-dev libbz2-dev tk-dev libffi-dev
mkdir $HOME/local
cd $HOME/local
mkdir bin
mkdir lib
mkdir include

Create a file in $HOME/local/set_env.py

@cwhy
cwhy / theme_setup.md
Created July 24, 2016 05:16 — forked from mborodov/theme_setup.md
My theme setup for Ubuntu

My Ubuntu theme config

My Ubuntu theme config

A Unity theme inspired by OSX Yosemite based on Ambiance.

sudo apt-add-repository ppa:bsundman/themes
sudo apt-get update
sudo apt-get install -y yosembiance-theme
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
letsencrypt certonly --manual
# And follow the instructions
(defn argmax [l] (key (apply max-key val (into {} (map-indexed vector l)))))
@cwhy
cwhy / classDict.py
Created March 14, 2016 05:32
Class-like dictionary in python
# It is not very pythonic but I don't like a lot of [[[['''']]]]'''' symbols
class Fake_dict:
def __iter__(self):
for attr in dir(Fake_dict):
if not attr.startswith("__"):
yield attr
<a href="javascript:{_l=window.location;window.location='http://'+_l.hostname+'.ezlibproxy1.ntu.edu.sg/'+_l.pathname;};">NTU Libraries Proxy Bookmarklet</a>