Sunday, 1 October 2017

Jupyter Latex in Thai


\usepackage[thai]{babel}


  • https://www.ctan.org/tex-archive/language/thai/thailatex
  • https://github.com/jgm/pandoc/releases/tag/1.19.2.1

Monday, 28 August 2017

openvpn note

server
https://github.com/kylemanna/docker-openvpn

client
https://askubuntu.com/questions/229800/how-to-auto-start-openvpn-client-on-ubuntu-cli

Tuesday, 11 July 2017

set up Jupyter on Ubuntu

sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get install python-pip
pip install --upgrade pip
install jupyter
jupyter notebook --no-browser --port 8888 --ip='*'

Thursday, 11 May 2017

simple Django deployment on Digital Ocean

This is a basic deployment, installing all packages. I next time I should use docker compose. The simple deployment are following steps:

  1. create a Droplet from original Ubuntu 16.04
  2. sudo apt-get update
  3. sudo apt-get install build-essential libssl-dev libffi-dev python-dev
  4. sudo apt-get -y install python-pip

Sunday, 9 April 2017







แนะนำ database MariaDB (แมวน้ำ) เปรียบที่ยบเทียบประสิทธิภาพและนโยบายแล้วระหว่างค่ายหมอดูหรือช้างแล้ว แนะนำแมวน้ำคับ สามารถต่อ cluster ได้ด้วย galera cluster ค่ายใหญ่เช่น google facebook สนับสนุนแมวน้ำตั้งแต่ช่วง 2013 ชุมชนของค่ายแมวน้ำดูแข็งแรงและมีการพัฒนาต่อเนื่องทั้งใน github และ event network ต่างๆ

Monday, 13 March 2017

lambda testing

please check github

create EC2 for package preparation
sudo apt-get update
sudo apt-get install python-pip python-dev build-essential
pip install --upgrade pip
pip install virtualenv

-----------init.sh---------
virtualenv env
source env/bin/activate
pip install -r requirements.txt
cd $VIRTUAL_ENV/lib/python2.7/site-packages
zip -r9 ~/lambda.zip *
cd $VIRTUAL_ENV/lib64/python2.7/site-packages
zip -r9 ~/lambda.zip *
cd $VIRTUAL_ENV/..
zip -g ~/lambda.zip main.py

-----------requirements.txt---------
numpy==1.12.0

-----------requirements.txt---------
import numpy as np
def myfunction(event=None, context=None):
        mylist=[
                'My name is Wasit', 'Rule the world!!',
                'get data, process and turn on the switch',
                'get data and predict your future', 'keep coding',
        ]
        return np.random.randint(0, len(mylist))

if __name__ == "__main__":
        print myfunction()

Sunday, 4 December 2016

angular datatable sorting datetime

js
1. import euro-date.js
2.
app.controller('pid03_ctrl', function($scope, $http, $interval, DTOptionsBuilder,DTColumnBuilder, DTColumnDefBuilder)
3.
$scope.dtOptions = DTOptionsBuilder.newOptions() //angular-datatable
          .withPaginationType('full_numbers')
          .withDisplayLength(5)
          .withOption('order', [0, 'desc']);
$scope.dtColumnDefs = [
    DTColumnDefBuilder.newColumnDef([0,4])
        .withOption('type', 'date-euro')
];

html 

<table id="action_list" datatable="ng" dt-options="dtOptions"
dt-columns="dtColumns" dt-instance="dtInstance"
class="table table-bordered table-striped table-hover" dt-column-defs="dtColumnDefs">
    <thead>
        <th>Action Date Time</th>
        <th>Action Code</th>
        <th>Remarks</th>
        <th>Created By</th>
        <th>Next Review</th>
    </thead>
    <tbody>
        <tr ng-repeat="i in customer.activity_set" ng-cloak>
            <td>
                <a href="{% url 'main:pid19'%}[[i.id]]" target="_blank">
                [[i.created| date: "dd/MM/y H:mm:ss" ]]
            </td>
            <td>[[i.action_text]]</a></td>
            <td>[[i.memo]]</td>
            <td>[[i.action_by]]</td>
            <td>[[i.review_date | date: "dd/MM/y H:mm:ss" ]]</td>
        </tr>
    </tbody>
</table>

ref
https://forums.asp.net/t/2095474.aspx?Angularjs+Datatable+Ordering+not+working+for+DateTime+dd+MM+yyyy+HH+mm

http://stackoverflow.com/questions/34926231/angular-datatables-wrong-sorting-on-date