This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Color on | |
syntax on | |
" Set line number, this is convenient when using <jk> to move forward and backward | |
set number | |
set relativenumber | |
" This allows command `W` to write file with sudo privilege | |
command W w !sudo tee % >/dev/null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
[Description] View structure of a torch checkpoint (table) | |
[Author] chaonan99 | |
[Date] 08/17/2016 | |
[Contact] [email protected] | |
--]] | |
require 'torch' | |
require 'nn' | |
require 'nngraph' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
[Description] View the abstract of a large json file | |
[Author] chaonan99 | |
[Date] 08/15/2016 | |
[Contact] [email protected] | |
""" | |
import json, argparse, sys | |
def view_dict(in_dict, num, spaces): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
New security policy don't support (username, password) to access gmail account for third-party application. | |
When you attempt to use gmail to send notification, it may give a smtplib.SMTPAuthenticationError. You have | |
two options to fix this. | |
1. At http://www.google.com/settings/security/lesssecureapps | |
enable less secure application access then you can use this script. | |
2. Follow http://stackoverflow.com/questions/25944883/how-to-send-an-email-through-gmail-without-enabling-insecure-access | |
and use gmail_notify.py script. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# [Description] This file download dataset from a set of urls | |
# [Author] chaonan99 | |
# [Date] 08/09/2016 | |
# [Email] [email protected] | |
import os,re,optparse,urllib,string | |
import numpy as np | |
parser = optparse.OptionParser() | |
parser.add_option('-i', '--input', dest='infile', help='input txt file name') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nn' | |
require 'nngraph' | |
local LSTM = {} | |
function LSTM.lstm(input_size, output_size, rnn_size, n, frame_per_video, seq_per_video, dropout) | |
dropout = dropout or 0 | |
-- TODO: No idea how to choose attention size... | |
att_size = att_size or 512 | |
-- there will be 2*n+1 inputs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import matplotlib | |
import pylab as plt | |
import numpy as np | |
s = open('default.log','r').read() | |
pattern = re.compile(r'iter (\d+): (\d+.\d+)') | |
grou = np.asarray(pattern.findall(s)).astype(np.float32) | |
plt.plot(grou[:,0],grou[:,1]) | |
plt.title('title') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# [Description] A script to extract exact number of frames from a sequence video | |
# [Author] chaonan99 | |
# [Date] 2016/07/17/ | |
# [Last Modified] 2016/09/01 | |
# [Email] [email protected] | |
import subprocess as sp | |
import re | |
import optparse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function []=bs() | |
x=[0,0]; | |
dfx_val = dfx(x); | |
normdfx = norm(dfx_val); | |
k = 0; | |
f_val = zeros(1000,1); | |
dfx_val_pre = [1,1]; | |
p_pre = [0,0]; | |
while normdfx>1e-10 | |
if mod(k,2) == 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function []=OR_HW1() | |
x=[0,0]; | |
dfx_val = dfx(x); | |
normdfx = norm(dfx_val); | |
k = 0; | |
f_val = zeros(1000,1); | |
while normdfx>1e-6 | |
t = newton(x,-dfx_val); | |
x = x-t*dfx_val; | |
dfx_val = dfx(x); |