Skip to content

Instantly share code, notes, and snippets.

View EastonLee's full-sized avatar

Easton EastonLee

View GitHub Profile
#!/usr/bin/env python
# coding=utf-8
'''
This is not a difficult problem to solve, but the highlight of this problem-solving process is that
first I analyzed the vague problem very carefully and considered many edge cases, and
I solved it in 3 different ways from a naive way to a high-performance DP way and
I tested it with extensive test cases far beyond the scale of the problem asked to solve and
I gave the time and space complexity.
@EastonLee
EastonLee / sitemap.xml
Created August 21, 2017 06:27 — forked from nandomoreirame/sitemap.xml
Jekyll sitemap.xml
---
layout: null
sitemap:
exclude: 'yes'
---
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% for post in site.posts %}
{% unless post.published == false %}
<url>
@EastonLee
EastonLee / nnCostFunction.m
Created March 15, 2017 20:05
ex4_vectorized_implementation Coursera Machine Learning by Stanford University
function [J grad] = nnCostFunction(nn_params, ...
input_layer_size, ...
hidden_layer_size, ...
num_labels, ...
X, y, lambda)
%NNCOSTFUNCTION Implements the neural network cost function for a two layer
%neural network which performs classification
% [J grad] = NNCOSTFUNCTON(nn_params, hidden_layer_size, num_labels, ...
% X, y, lambda) computes the cost and gradient of the neural network. The
% parameters for the neural network are "unrolled" into the vector
@EastonLee
EastonLee / gsdproxy.py
Created September 1, 2016 04:32 — forked from ncode/gsdproxy.py
gevent simple dynamic reverse proxy
#!/usr/bin/env python
from gevent import monkey
monkey.patch_all()
import sys
import redis
import urllib2
import traceback
from cgi import escape
# -- gsdproxy
@EastonLee
EastonLee / code_probe.py
Last active September 20, 2023 13:32
utility that can print context source code on any frame of stack and variables you care against Python inspect
collective_code_location_message = '\n'
def print_dict(dict, verbose=True):
#callerframerecord = inspect.stack()[1] # 0 represents this line
# # 1 represents line at caller
#frame = callerframerecord[0]
#info = inspect.getframeinfo(frame)
#if info.function == 'print_sql_result':
# code_probe('',2)
#else:
# code_probe('', 1)