Skip to content

Instantly share code, notes, and snippets.

View mchayapol's full-sized avatar

Chayapol Moemeng mchayapol

View GitHub Profile
@mchayapol
mchayapol / rd.js
Created December 27, 2019 07:45
Pulling VAT registrant data from Thai RD WebService
var url = 'https://rdws.rd.go.th/serviceRD3/vatserviceRD3.asmx?wsdl';
console.log("RD WebService Test\n", url)
var request = require('request');
var fs = require('fs');
var specialRequest = request.defaults({
agentOptions: {
ca: fs.readFileSync('./adhq1.cer') //path of CA cert file
}
@mchayapol
mchayapol / rd.py
Last active August 23, 2023 09:31
ดึงข้อมูลผู้เสียภาษีด้วยเลขประจำตัวจาก WebService ของกรมสรรพากร
from requests import Session
import zeep
from zeep import Client
from zeep.transports import Transport
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
session = Session()
session.verify = False
@mchayapol
mchayapol / detect_intent_texts.py
Created October 10, 2018 01:15
Python Dialogflow - detect intent from texts
import json
import dialogflow_v2 as dialogflow
def detect_intent_texts(project_id, session_id, texts, language_code,verbose=False):
"""Returns the result of detect intent with texts as inputs.
Using the same `session_id` between requests allows continuation
of the conversaion."""
session_client = dialogflow.SessionsClient()
@mchayapol
mchayapol / FileUpload.py
Created June 15, 2018 14:06
Firebase Admin SDK - File Upload
import firebase_admin
from firebase_admin import (
credentials, db, storage
)
from google.cloud.storage import Blob
if __name__ == '__main__':
service_account_json_path = '../../src/service_account.json'
cred = credentials.Certificate(service_account_json_path)
@mchayapol
mchayapol / SampleFileUpload.js
Created May 17, 2016 08:55
ngFileUpload sample
'use strict';
angular.module('car2App')
.controller('FileUploadCtrl', ['$scope', '$resource', 'Upload', '$timeout', function ($scope, $resource, Upload, $timeout) {
$scope.cropper = {};
$scope.cropper.sourceImage = null;
$scope.cropper.croppedImage = null;
$scope.bounds = {};
$scope.bounds.left = 0;
$scope.bounds.right = 0;
@mchayapol
mchayapol / Employee.java
Created March 29, 2016 08:41
OOP Staff Employee Example
package edu.au.hr;
public class Employee {
protected String id;
protected String name;
protected String dob;
static public String org = "AU";
public Employee(String id, String name, String dob) {
this.id = id;
package u5715111.adt.queue;
import java.util.Arrays;
public class Queue {
int head;
int tail;
int data[];
public Queue(int size) {
package edu.au.scitech.sc2101;
public class Tree<T> {
Node<T> root;
public Tree() {
root = null;
}
public boolean hasRoom(Node<T> n) {
@mchayapol
mchayapol / DoublyLinkedListTest.java
Created October 14, 2015 02:22
Test cases for Doubly Linked List
package edu.au.scitech.sc2101;
import static org.junit.Assert.*;
import org.junit.Test;
public class DoublyLinkedListTest {
@Test
public void test01() {
@mchayapol
mchayapol / gist:5a04a5a076f82aae3b97
Created September 30, 2015 02:51
Queue Skeleton
package edu.au.scitech.sc2101;
import edu.au.scitech.sc2101.IntegerLinkedList.Node;
public class Queue extends IntegerLinkedList {
Node tail;
@Override
public void add(int newValue) {