Skip to content

Instantly share code, notes, and snippets.

View kemingy's full-sized avatar
☁️
🈚 🌕

Keming kemingy

☁️
🈚 🌕
View GitHub Profile
from random import randint
from time import time
def swap(array, i, j):
array[i], array[j] = array[j], array[i]
def bubble(array):
n = len(array)
@kemingy
kemingy / config.py
Last active February 12, 2019 07:31
Python project config template for deep learning
# run this with bash: `EPOCH=20 python config.py`
import os
class Config:
def __init__(self):
self.EMBEDDING_DIM = 256
self.EPOCH = 10
self.SAVE_PATH = os.path.join(os.path.curdir, 'checkpoint')
@kemingy
kemingy / ComputationalAdvertising.md
Created January 5, 2019 06:08
simple tips for computational advertising

Computational Advertising

  • Sponsored search
  • Contextual advertising
  • Display advertising

Pricing scheme

  • pay per click
  • pay per impression
@kemingy
kemingy / timeit_decorator.py
Created February 10, 2019 15:21
use decorator to count processing time
from time import time
def timeit(func):
def wrap(*args, **kwargs):
start = time()
result = func(*args, **kwargs)
print('[Time]: {:6f}'.format(time() - start))
return result
return wrap
@kemingy
kemingy / Makefile
Created February 11, 2019 11:28
makefile for python project
install:
pip install -e .
test:
py.test tests
doc:
cd docs && make html
clean:
@kemingy
kemingy / setup.py
Last active March 26, 2019 11:34
python setup template
from setuptools import setup, find_packages
from os import path
from io import open
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
readme = f.read()
@kemingy
kemingy / vim.md
Last active February 24, 2019 15:27
note for vimtutor

Note for vimtutor

Just type vimtutor to learn the basic usage of Vim.

1. Basic

1.1 Moving the cursor

 ^
@kemingy
kemingy / deep_learning_modelhub_design.md
Last active February 28, 2019 04:11
Explore the design of mature deep learning model repos.

Design of Deep Learning Model Projects

Questions:

  • How to organise different kinds of models?
  • How to design user-friendly interface?
  • How to make it easy to train and evaluation?
  • Is it necessary to offer CLI?
  • How to make it feasible for different frameworks?
@kemingy
kemingy / optimize_spelling_corrector.md
Last active March 2, 2019 12:02
optimize step by step

Optimizing spelling corrector writen in Rust

  1. Write in Rust
  2. Refactoring with structure and implementation
  3. Profiling
  4. Golang