Skip to content

Instantly share code, notes, and snippets.

View kwarodom's full-sized avatar
🎯
Focusing

Warodom Khamphanchai kwarodom

🎯
Focusing
View GitHub Profile
@kwarodom
kwarodom / Publish_Agent_Msg_IEB
Last active August 29, 2015 14:22
Example of an agent code to publish a message with certain 'topic', 'header', and 'message' to the information exchange bus (IEB)
# -*- coding: utf-8 -*- {{{
from datetime import datetime
import logging
import sys
from volttron.lite.agent import BaseAgent, PublishMixin, periodic
from volttron.lite.agent import utils, matching
from volttron.lite.messaging import headers as headers_mod
utils.setup_logging()
_log = logging.getLogger(__name__)
@kwarodom
kwarodom / hadoop_install_ubuntu.sh
Last active June 12, 2017 19:50
This is the instruction how to install hadoop on Ubuntu > 16.04 using in DEPA Big Data Training Class
#!/bin/bash
#This is the installation file for hadoop: HDFS, Yarn, MapReduce on Ubuntu 17.04 64-bit
#WARNING!!!! DO NOT RUN THIS FILE
#update package
sudo apt-get update
#setup SSH
sudo apt-get install –y openssh-server

Keybase proof

I hereby claim:

  • I am kwarodom on github.
  • I am kwarodom89 (https://keybase.io/kwarodom89) on keybase.
  • I have a public key ASAsxvFsqPgdHdmq-Q4lp-bNd1FBDyYzN9wVul8F9hB7Ewo

To claim this, I am signing this object:

╔════════╦═════════════════════════════════════════════╦════════════════╦══════════════════╗
║ #Week. ║ Topic ║ Note ║ Instructor ║
╠════════╬═════════════════════════════════════════════╬════════════════╬══════════════════╣
║ 1 ║ An Exhaustive Review on Machine ║ 3 hours ║ Ta ║
║ ║ Learning Applications ║ ║ ║
║════════║═════════════════════════════════════════════║════════════════║══════════════════║
║ 2 ║ Introduction to Statistics for Machine ║ 3 hours ║ Ta ║
║ ║ Learning Engineers ║ ║ ║
║════════║═════════════════════════════════════════════║════════════════║══════════════════║
║   3   ║ Introduction to Python Programming         ║ 3 hours        ║ Arm ║
@kwarodom
kwarodom / gist:82f41af5926fa8b7a77277a9871e214d
Created October 28, 2017 10:34
OpenCV3 Python (you need to install opencv -> check https://anaconda.org/menpo/opencv3)
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
while(True):
ret, frame = cap.read()
frame = cv2.resize(frame, (0,0), fx=0.5,fy=0.5)
cv2.imshow("Frame",frame)
@kwarodom
kwarodom / gist:f26b66934e656c3c3fe2364e8480df31
Created March 27, 2018 03:50
javascript to sync firebase database
//current energy consumption update picture
function update_member(status) {
$("#member").text(String(status));
}
$( document ).ready(function() {
console.log("starting document!!!!");
// Initialize Firebase
console.log("Initialize Firebase");
<section class="header12 cid-qNk5IbnRmx mbr-fullscreen mbr-parallax-background" id="header12-3">
<div class="mbr-overlay" style="opacity: 0.9; background-color: rgb(15, 118, 153);">
</div>
<div class="container ">
<div class="m-portlet">
<div class="m-portlet__body m-portlet__body--no-padding">
<div class="row m-row--no-padding m-row--col-separator-xl">
<div class="col-md-12 col-lg-12 col-xl-4">
<!DOCTYPE html>
<html >
<head>
<!-- Site made with Mobirise Website Builder v4.5.4, https://mobirise.com -->
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Mobirise v4.5.4, mobirise.com">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<link rel="shortcut icon" href="assets/images/mbr-1920x1011.jpg" type="image/x-icon">
<meta name="description" content="">
@kwarodom
kwarodom / pythonsendemail.py
Created March 29, 2018 06:51
Python to send Email
# -*- coding: utf-8 -*-
# This Email class is for an agent wishing to send an email to any mail server
import smtplib # simple mail transfer protocol library
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import datetime
class EmailService:
# method1: GET a model number of a device by XML read
def sendEmail(self, fromaddr, recipients, username, password, subject, text, mailServer):
@kwarodom
kwarodom / emailpython.py
Created March 29, 2018 17:43
emailpython
# -*- coding: utf-8 -*-
# This Email class is for an agent wishing to send an email to any mail server
import smtplib # simple mail transfer protocol library
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import datetime
class EmailService:
# method1: GET a model number of a device by XML read
def sendEmail(self, fromaddr, recipients, username, password, subject, text, mailServer):