Skip to content

Instantly share code, notes, and snippets.

View alanzchen's full-sized avatar
👨‍🎓
Finishing a Ph.D.

Alan Chen alanzchen

👨‍🎓
Finishing a Ph.D.
View GitHub Profile
@alanzchen
alanzchen / exercise.py
Last active March 10, 2017 16:03
Metropolis-Hasting Algorithm 2 Markov Chain
# coding: utf-8
#r = 8
# p is a probability constructed in the following way:
# node position: 0-0 0-1 0-2 1-0 1-1 1-2 2-0 2-1 2-2
# probability: 1/16 1/8 1/16 1/8 1/4 1/8 1/16 1/8 1/16
# so we have 8 nodes here, and the output will be a way such that the probability is stationary.
p = [0.0625 ,0.1250 ,0.0625 ,0.1250 ,0.2500 ,0.1250,0.0625 ,0.1250 ,0.0625]
#p = [0.5, 0.33333333, 0.166666667]
@alanzchen
alanzchen / Sendgrid to Telegram.js
Last active December 12, 2016 17:18
A scriptr.io script to bridge sendgrid notification and telegram.
//First, we'll require the 'http' library to use later for calling a 3rd party webservice
var http = require("http");
//Getting parameters from the request body. For a nested json, we only want the first one.
try {
var parameters = JSON.parse(request.rawBody);
parameters = parameters[0]
var ip = parameters.ip;
var email = parameters.email;
@alanzchen
alanzchen / WeChat_Pay_Bill_Export.py
Last active August 25, 2022 07:41
WeChat Pay Bill Export
# Install the Python Requests library:
# `pip install requests`
import requests
import datetime
import pickle
set_date = datetime.datetime
# Simply call get_record and it will return a json object containing your bill.
@alanzchen
alanzchen / keybase.md
Created January 16, 2017 04:57
keybase.md

Keybase proof

I hereby claim:

  • I am alanzchen on github.
  • I am alanchen (https://keybase.io/alanchen) on keybase.
  • I have a public key ASCTAEcX1pPYgMKi4hFzuLuFb-Hd5S0QIuYbiofxtipRnQo

To claim this, I am signing this object:

@alanzchen
alanzchen / Google+Scholar-Simple-Parser.ipynb
Created February 23, 2017 08:37
A simple parser for Google Scholar profiles.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alanzchen
alanzchen / LDA_Profiling_Draft.ipynb
Created March 31, 2017 13:09
A draft of a jupyter notebook about profiling and matching authors and reviewers using LDA model for FindMyReviewers.com.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alanzchen
alanzchen / Vocabulary_Audio_Generator.ipynb
Created April 5, 2017 04:45
This script takes the pronunciation and a short piece of human-friendly explanation from Vocabulary.com with which it generates a synthesised audio.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alanzchen
alanzchen / Hangman-v3-Wordnik-final.ipynb
Created April 28, 2017 06:03
The hangman solution to Strikingly's hangman game.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from flask import Flask, request, jsonify
import json
from hashlib import sha256
from datetime import datetime
from glob import glob
import os
app = Flask(__name__)
SECRET = "some_random_string"