Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

(Bill) Yuchen Lin yuchenlin

🎯
Focusing
Block or report user

Report or block yuchenlin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@chuanconggao
chuanconggao / prefixspan.py
Last active Nov 5, 2018
The original minimal 15 lines implementation of PrefixSpan. Full library at https://github.com/chuanconggao/PrefixSpan-py.
View prefixspan.py
from collections import defaultdict
def frequent_rec(patt, mdb):
results.append((len(mdb), patt))
occurs = defaultdict(list)
for (i, startpos) in mdb:
seq = db[i]
for j in range(startpos + 1, len(seq)):
l = occurs[seq[j]]
@peterjc123
peterjc123 / build.ps1
Last active Nov 12, 2018
Setup script for Windows PyTorch
View build.ps1
# Prerequisites
# 1. MSVC 2017 C++ Build Tools
# 2. CMAKE 3.0 or up
# 3. 64 bits of Windows
# 4. Anaconda / MiniConda 64 bits
# Prerequisites for CUDA
# 1. CUDA 8.0 or up
# 2. NVTX( in CUDA as Visual Studio Integration. if fail to install, you can extract
# the CUDA installer exe and found the NVTX installer under the CUDAVisualStudioIntegration)
View install-gcc-5.4.0.sh
#!/bin/bash
# this script installs GCC 5.4.0
# to use it navigate to your home directory and type:
# sh install-gcc-5.4.0.sh
# download and install gcc 4.9.3
wget https://github.com/gcc-mirror/gcc/archive/gcc-5_4_0-release.tar.gz
tar xzf gcc-5_4_0-release.tar.gz
cd gcc-5_4_0-release
@Tushar-N
Tushar-N / pad_packed_demo.py
Last active Aug 20, 2019
How to use pad_packed_sequence in pytorch
View pad_packed_demo.py
import torch
import torch.nn as nn
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
seqs = ['gigantic_string','tiny_str','medium_str']
# make <pad> idx 0
vocab = ['<pad>'] + sorted(set(''.join(seqs)))
# make model
@yuchenlin
yuchenlin / label_data.py
Last active May 23, 2017
Lable the price changes in a csv file
View label_data.py
import os
import pandas as pd
STEP = 20
filenames = []
DBExport = '/home/bill/dm_proj/DBExport'
for filename in os.listdir(DBExport):
if filename.endswith(".csv"):
filenames.append(os.path.join(DBExport, filename))
filenames.sort()
@nathanielove
nathanielove / how-to-setup-shadowsocks-on-your-ubuntu-server.md
Created Nov 1, 2016
How to setup Shadowsocks on your Ubuntu server
View how-to-setup-shadowsocks-on-your-ubuntu-server.md

How to setup Shadowsocks on your Ubuntu server

Your school or company network may block the access to a few specific websites. To solve this problem, I'd highly recommend Shadowsocks, since it is the easiest proxy tool I've ever found, and it's FREE (of course iff you have your own server running).

First, ssh to your server, and make sure you have Python and pip installed. If you have Python but not pip, install it using the following command

$ sudo apt-get install python3-pip
@tmdavid
tmdavid / word_embedding_vis.py
Last active Jan 30, 2019
Visualize word embeddings, using tsne.
View word_embedding_vis.py
"""
Visualize word embeddings, using tsne.
First computes cosine distance of the 100 closests words, and then shows a clustering graph
of the first 11 closest words (the first one is always the word)
IT REQUIRES GLOVE MODEL.txt
line 31: glove_file = '../TBIR/glove.840B.300d.txt' MODIFY with the appropiate path
To Use it, you can just type: python word_embedding_vis.py <list of words space separated>
e.g: python word_embedding_vis.py cake word embedding music
"""
@lucaswiman
lucaswiman / foo.dot
Created May 31, 2016
networkx / graphviz example
View foo.dot
digraph {
0 -> "*" [key=0,
label="[b]"];
1 -> "*" [key=0,
label="[d]"];
enter -> "*" [key=0,
label=ε];
"*" -> 0 [key=0,
label="[a]"];
"*" -> 1 [key=0,
@evanwill
evanwill / gitBash_windows.md
Last active Sep 13, 2019
how to add more utilities to git bash for windows, wget, make
View gitBash_windows.md

How to add more to Git Bash on Windows

Git for Windows comes bundled with the "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.

The basic idea is that C:\Program Files\Git\mingw64\ is your / directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git, the mingw64 in this directory is your root. Find it by using pwd -W). If you go to that directory, you will find the typical linux root folder structure (bin, etc, lib and so on).

If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corresponding directories. Sometimes the windows binary have funny prefixes, so

@jtilly
jtilly / install-gcc-4.9.3.sh
Last active Aug 29, 2019
Install GCC 4.9.3
View install-gcc-4.9.3.sh
#!/bin/bash
# this script installs GCC 4.9.3
# to use it navigate to your home directory and type:
# sh install-gcc-4.9.3.sh
# download and install gcc 4.9.3
wget https://ftp.gnu.org/gnu/gcc/gcc-4.9.3/gcc-4.9.3.tar.gz
tar xzf gcc-4.9.3.tar.gz
cd gcc-4.9.3
You can’t perform that action at this time.