Skip to content

Instantly share code, notes, and snippets.

View duducheng's full-sized avatar

Jiancheng (JC) Yang duducheng

View GitHub Profile
@duducheng
duducheng / splay_tree.py
Created December 31, 2016 16:05
A light-weight implement of Splay Tree in Python (starter file)
# python3
__author__ = "github.com/duducheng"
'''A starter file for problem "set_range_sum" in Week 4 of
[Data Structure](https://www.coursera.org/learn/data-structures/) course. '''
class SplayTree:
def __init__(self):
@duducheng
duducheng / CAM.ipynb
Created February 3, 2018 15:12
Class Activation Map with DenseNet
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@duducheng
duducheng / clockwalk_rnn.py
Created March 15, 2018 08:39
Clockwalk RNN and Temporal Kernel RNN in TensorFlow
'''At present these implementations haven't used `tf.scan` or other tf functions to speed up.'''
import numpy as np
import tensorflow as tf
from functools import reduce
from tqdm import trange
import matplotlib.pyplot as plt
@duducheng
duducheng / Local PR test and merge.md
Created August 8, 2018 05:25 — forked from adam-p/Local PR test and merge.md
Testing a pull request, then merging locally; and avoiding TOCTOU

It's not immediately obvious how to pull down the code for a PR and test it locally. But it's pretty easy. (This assumes you have a remote for the main repo named upstream.)

Getting the PR code

  1. Make note of the PR number. For example, Rod's latest is PR #37: Psiphon-Labs/psiphon-tunnel-core#37

  2. Fetch the PR's pseudo-branch (or bookmark or rev pointer whatever the word is), and give it a local branch name. Here we'll name it pr37:

$ git fetch upstream pull/37/head:pr37
@duducheng
duducheng / plot_voxel_as_point_cloud.py
Created December 10, 2018 12:16
To plot voxel as point clouds by segmentation
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import plotly.graph_objs as go
import numpy as np
def hidden_axis(ax, r):
ax.showgrid = False
ax.zeroline = False
ax.showline = False
ax.ticks = ''
ax.showticklabels = False