Skip to content

Instantly share code, notes, and snippets.

View titipata's full-sized avatar
:octocat:

Titipat Achakulvisut titipata

:octocat:
View GitHub Profile
@titipata
titipata / useful_bash.md
Last active November 10, 2015 04:03
Useful bash command

Some useful bash command

  • List number of files in the current directory
ls -l | wc -l
  • Check space left on disk
df -h

Guide to use emg_analyzer

First, we have to add path of the package first

import sys
sys.path.insert(0, '/path/to/emg_gyro/emg_analyzer/')

Suppose we already load data using awscli to data/, here is

@titipata
titipata / imdb.md
Last active December 18, 2015 01:08

#Dowload IMDB data for LSTM example

Here is a snippet to download python code and imdb.pkl

wget http://deeplearning.net/tutorial/code/imdb.py
wget http://deeplearning.net/tutorial/code/lstm.py
wget http://www.iro.umontreal.ca/~lisa/deep/data/imdb.pkl
@titipata
titipata / lagrangian.md
Last active January 24, 2016 20:49
Snippet for Lagrangian Mechanics

Douple Pendulum Snippet (Thai)

(*ตัวแปรสำหรับสมการลากรานจ์*)
q = {{theta1[t]}, {theta2[t]}};
dq = D[q, t];
ddq = D[dq, t];

##Solr installation

not finalize yet

First change directory to solr-5.4.0 and start solr

cd /opt/solr-5.4.0
sudo ./bin/solr start -c -m 50g
@titipata
titipata / LDA implementation.ipynb
Created January 29, 2016 19:40
Linear discriminant analysis
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@titipata
titipata / search_through_excel.md
Last active February 26, 2016 00:52
Yasin's read excel and produce search

You need to install Python and pandas library before running this script.

Assuming we have .xlsx sheet sit right at where we run Python script.

sheets = pd.ExcelFile('Lista de e-mails & Email List.xlsx') # use pandas to read excel sheets
search_sheet = pd.read_excel('Exampl names.xls', header=None)[[2]].rename(columns={2: 'search_name'}) # also use to read search name

Here, I create function to parse excel sheets and grab all name founded in documents then concat them together

Parse Pubmed xml using Python (NLTK class)

You need lxml library to parse xml file (use pip install lxml or sudo pip install lxml)

import pandas as pd
from lxml import etree
from lxml.etree import tostring
from itertools import chain