Skip to content

Instantly share code, notes, and snippets.

View titipata's full-sized avatar
:octocat:

Titipat Achakulvisut titipata

:octocat:
View GitHub Profile

Pretrain bin to txt

Function to turn word vector from http://bio.nlplab.org/#word-vectors into text file format so that easily read.

def w2v_binary_to_text(file_path):
    """
    Function to transform binary file of word vector file
    to text file format
    Ref: http://bio.nlplab.org/#word-vectors

Script for scraping train arrival time

Get list of date from today until 250 days before.

import requests
import time
import datetime

numdays = 250
best deepcut
วิทยาลัย| |มหาวิทยาลัยเชียงใหม่|ความ|นำ|การ|รั วิทยาลัย| |มหาวิทยาลัย|เชียงใหม่|ความ|นำ|การ|รั
ย่าง|ไม่|ตั้งใจ| |เนื่อง|ด้วย|ยัง|ไม่|สามารถ|ควบค ย่าง|ไม่|ตั้งใจ| |เนื่องด้วย|ยัง|ไม่|สามารถ|ควบค
resence|)| |และ|การ|เลือน|หาย| |(|absence|)| |ของ|วัต resence|)| |และ|การ|เลือนหาย| |(|absence|)| |ของ|วัต
ช่น| |มือ| |เท้า| |ที่|กวัดแกว่ง|เข้า|มา| |ทำ|ให้|ทาร ช่น| |มือ| |เท้า| |ที่|กวัด|แกว่ง|เข้า|มา| |ทำ|ให้|ทาร
่|ความ|สมบูรณ์|พร้อม|แม้|กระทั่ง|ตัวตน|ของ|เขา|เอ ่|ความ|สมบูรณ์|พร้อม|แม้กระทั่ง|ตัวตน|ของ|เขา|เอ
|14|-|16|)| |การ|มอง|แบบ|ขาดๆ หายๆ| |ไม่|ครบถ้วน|ใน|ต |14|-|16|)| |การ|มอง|แบบ|ขาด|ๆ| |หาย|ๆ| |ไม่|ครบถ้วน|ใน|ต
14|-|16|)| |การ|มอง|แบบ|ขาดๆ หายๆ| |ไม่|ครบถ้วน|ใน|ตอ 14|-|16|)| |การ|มอง|แบบ|ขาด|ๆ| |หาย|ๆ| |ไม่|ครบถ้วน|ใน|ตอ
4|-|16|)| |การ|มอง|แบบ|ขาดๆ หายๆ| |ไม่|ครบถ้วน|ใน|ตอน 4|-|16|)| |การ|มอง|แบบ|ขาด|ๆ| |หาย|ๆ| |ไม่|ครบถ้วน|ใน|ตอน
6|)| |การ|มอง|แบบ|ขาดๆ หายๆ| |ไม่|ครบถ้วน|ใน|ตอน|เด็ 6|)| |การ|มอง|แบบ|ขาด|ๆ| |หาย|ๆ| |ไม่|ครบถ้วน|ใน|ตอน|เด็
best deepcut
วาม|ตาย|ของ|นัก|ประพันธ์|จิรภักดิ์ จอมวิญญาณ์ วาม|ตาย|ของ|นัก|ประพันธ์จิรภักดิ์ จอมวิญญาณ์
resence|)| |และ|การ|เลือน|หาย| |(|absence|)| |ของ|วัต resence|)| |และ|การ|เลือนหาย| |(|absence|)| |ของ|วัต
ณ์|พร้อม|แม้|กระทั่ง|ตัวตน|ของ|เขา|เอง| |(|1|)|หลักก ณ์|พร้อม|แม้|กระทั่ง|ตัว|ตน|ของ|เขา|เอง| |(|1|)|หลักก
|14|-|16|)| |การ|มอง|แบบ|ขาดๆ หายๆ| |ไม่|ครบถ้วน|ใน|ต |14|-|16|)| |การ|มอง|แบบ|ขาด|ๆ| |หาย|ๆ| |ไม่|ครบถ้วน|ใน|ต
14|-|16|)| |การ|มอง|แบบ|ขาดๆ หายๆ| |ไม่|ครบถ้วน|ใน|ตอ 14|-|16|)| |การ|มอง|แบบ|ขาด|ๆ| |หาย|ๆ| |ไม่|ครบถ้วน|ใน|ตอ
4|-|16|)| |การ|มอง|แบบ|ขาดๆ หายๆ| |ไม่|ครบถ้วน|ใน|ตอน 4|-|16|)| |การ|มอง|แบบ|ขาด|ๆ| |หาย|ๆ| |ไม่|ครบถ้วน|ใน|ตอน
6|)| |การ|มอง|แบบ|ขาดๆ หายๆ| |ไม่|ครบถ้วน|ใน|ตอน|เด็ 6|)| |การ|มอง|แบบ|ขาด|ๆ| |หาย|ๆ| |ไม่|ครบถ้วน|ใน|ตอน|เด็
่|ใช่|การ|มอง|เห็น|กันและกัน| |(|visual| |reciproc ่|ใช่|การ|มอง|เห็น|กันและ|กัน| |(|visual| |reciproc
"| |(|ความ|ก้าวร้าว|ใน|จิตวิเคราะห์|)| |ของ| |ฌากส์ "| |(|ความ|ก้าวร้าว|ใน|จิต|วิเคราะห์|)| |ของ| |ฌากส์
[{"user_id":0,"chat_length":1,"char_length":8},{"user_id":0,"chat_length":1,"char_length":21},{"user_id":1,"chat_length":1,"char_length":8},{"user_id":0,"chat_length":5,"char_length":25},{"user_id":1,"chat_length":1,"char_length":3},{"user_id":1,"chat_length":1,"char_length":17},{"user_id":1,"chat_length":3,"char_length":9},{"user_id":0,"chat_length":2,"char_length":21},{"user_id":0,"chat_length":1,"char_length":12},{"user_id":0,"chat_length":1,"char_length":8},{"user_id":1,"chat_length":1,"char_length":8},{"user_id":0,"chat_length":1,"char_length":9},{"user_id":0,"chat_length":1,"char_length":41},{"user_id":1,"chat_length":1,"char_length":7},{"user_id":1,"chat_length":1,"char_length":13},{"user_id":1,"chat_length":2,"char_length":19},{"user_id":1,"chat_length":1,"char_length":8},{"user_id":0,"chat_length":2,"char_length":9},{"user_id":0,"chat_length":1,"char_length":8},{"user_id":0,"chat_length":1,"char_length":8},{"user_id":1,"chat_length":1,"char_length":7},{"user_id":1,"chat_length":1,"char_length":13},{"

Socket Programming

Client

import time
import socket
from threading import Timer

HOST = '192.168.128.147'

So called NostradaTul

This is the class of NostradaTul (Nostradamus + Tulakan = NostradaTul). I created this class because Tul always correctly predict the successful rate of me on hitting up a girl randomly selected from population of Thai girls (prediction is either successful or unsuccessful). This prediction class I wrote is dedicated to Tulakan, I called it NostradaTul predictor.

class NostradaTul():
[{"user_id":0,"chat_length":2,"char_length":11},{"user_id":0,"chat_length":6,"char_length":33},{"user_id":1,"chat_length":10,"char_length":49},{"user_id":1,"chat_length":11,"char_length":56},{"user_id":0,"chat_length":1,"char_length":7},{"user_id":0,"chat_length":6,"char_length":22},{"user_id":0,"chat_length":5,"char_length":26},{"user_id":0,"chat_length":1,"char_length":8},{"user_id":0,"chat_length":1,"char_length":3},{"user_id":0,"chat_length":9,"char_length":56},{"user_id":0,"chat_length":2,"char_length":45},{"user_id":0,"chat_length":1,"char_length":3},{"user_id":1,"chat_length":8,"char_length":42},{"user_id":1,"chat_length":12,"char_length":57},{"user_id":1,"chat_length":6,"char_length":30},{"user_id":0,"chat_length":1,"char_length":4},{"user_id":1,"chat_length":1,"char_length":3},{"user_id":1,"chat_length":1,"char_length":10},{"user_id":0,"chat_length":1,"char_length":6},{"user_id":1,"chat_length":5,"char_length":22},{"user_id":1,"chat_length":1,"char_length":6},{"user_id":1,"chat_length":2,"char_length
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<?xml version='1.0' encoding='UTF-8'?>
<GateDocument version="3">
<!-- The document's features-->
<GateDocumentFeatures>
<Feature>
<Name className="java.lang.String">gate.SourceURL</Name>
<Value className="java.lang.String">file:/Users/baharsateli/Repository/zeeva/Corpora/PropCorp/AZ_distribution/9407011.az-scixml</Value>
</Feature>
<Feature>