Skip to content

Instantly share code, notes, and snippets.

View korakot's full-sized avatar

Korakot Chaovavanich korakot

  • Bangkok, Thailand
View GitHub Profile
@korakot
korakot / hello.py
Last active June 22, 2016 03:15
Yet another hello world. #python
print("Hello World")
@korakot
korakot / addpath.m
Last active June 22, 2016 03:16
Add octave search path #m
% octave will search m-file here too
addpath('C:\Users\ang\Desktop')
@korakot
korakot / basic.R
Created June 22, 2016 03:25
Basic R #R
a <- 10
b <- 32
a+b
@korakot
korakot / hyphen
Last active June 22, 2016 03:37
soft hyphen #unicode
soft hyphen (ISO 8859: 0xAD, Unicode U+00AD SOFT HYPHEN, HTML: &#173; &shy;)
or syllable hyphen (EBCDIC: 0xCA), abbreviated SHY,
is a code point reserved in some coded character sets for the purpose of
breaking words across lines by inserting visible hyphens.
@korakot
korakot / vector.R
Created June 22, 2016 04:41
Vector in R #R
remain <- c(11,12,11,13)
# name the elements
suits <- c("spades", "hearts", "diamonds", "clubs")
names(remain) <- suits
# shortcut
remain <- c(spades=11, hearts=12, diamonds=11, clubs=13)
str(remain) # see detail
@korakot
korakot / 59-06-22
Last active June 22, 2016 05:10
Gist and Gisto #chat #gist
11:51 AM
วันนี้​ ที่​ achieve หลัก​ คือ​ได้​ tool จด​ knowledge แล้ว
ใช้​ gist + gisto
gist.github.com/korakot
gisto app มี​บน​ทั้ง​ mac/win
สำคัญ​คือ​เรื่อง​ #tag ให้​ค้นหา​ง่าย
ถ้า​เล่น​บน​ ipad ก็​ใช้​ web interface ไป
ข้อ​เจ๋ง​ คือ backend เป็น​ git จึง​มี​ track history และ​ compare versions ได้​
เรื่อง​ tool เก็บ knowledge เป็น​เรื่อง​ใหญ่​มาก​ของ​พี่​ เพราะ​เป็น​ foundation ของ​เรื่อง​อื่น​ทุก​เรื่อง​
@korakot
korakot / .profile
Created July 8, 2016 02:49
.profile (no .bashrc on mac) #bash #alias
alias ll="ls -l"
@korakot
korakot / pyenchant.py
Last active June 30, 2017 15:08
ตรวจคำสะกด โดยทำ word list เอง
# ลง hunspell + python ไม่สำเร็จ
# แต่มาเจอ pyenchant ที่ใช้ได้เหมือนกัน และมี custom word list ด้วย
>>> import enchant
>>> pwl = enchant.request_pwl_dict("royin_2542_wordlist.txt")
>>> pwl.check("กรกฎ")
True
>>> pwl.check("กรกำ")
False
>>> pwl.suggest("กรกำ")
@korakot
korakot / spell.py
Created July 19, 2017 04:35
Check spelling
>>> import enchant
>>> d = enchant.request_pwl_dict("royin_2542_wordlist.txt")
>>> d.check("กรกำ")
False
>>> d.suggest("กรกำ")
['กรก', 'กรกฎ', 'กรกฏ', 'กรกช', 'กรำ', 'กร่ำ']
@korakot
korakot / els.py
Last active July 31, 2017 10:54
Elasticearch IPython magic. Change to %%els to avoid collision. Allow # comment
# From https://github.com/graphaelli/ipython-elasticsearch
import json
import os, re
import urllib.parse
from IPython.core.magic import Magics, magics_class, line_cell_magic
import requests