Skip to content

Instantly share code, notes, and snippets.

View ebongzzang's full-sized avatar

Sangbong Lee ebongzzang

View GitHub Profile
@ebongzzang
ebongzzang / HTMLCrawler.h
Last active March 24, 2017 16:59
ebong2's endic Crawler
#ifndef HTMLCRAWLER_H
#define HTMLCRAWLER_H
#include <iostream>
#include <fstream>
#include <curl/curl.h>
#include <fstream>
#include <stdio.h>
#include <libxml2/libxml/HTMLparser.h>
#include <libxml2/libxml/tree.h>
@ebongzzang
ebongzzang / Listener.h
Created March 31, 2017 11:02
Kakaotalk Chatbot using C++ REST SDK (casablanca)
#ifndef LISTENER_H
#define LISTENER_H
#include <cpprest/http_listener.h>
#include <cpprest/json.h>
using namespace web::http::experimental::listener;
using namespace web::http;
using namespace web;
using namespace utility;
@ebongzzang
ebongzzang / Listener.cpp
Created March 31, 2017 15:42
C++ REst SDK example
#include "Listener.h"
Listener::Listener(utility::string_t url) : m_listener(url)
{
m_listener.support(methods::GET, std::bind(&Listener::handle_get,this,std::placeholders::_1));
m_listener.support(methods::PUT, std::bind(&Listener::handle_put,this,std::placeholders::_1));
m_listener.support(methods::POST, std::bind(&Listener::handle_post,this,std::placeholders::_1));
m_listener.support(methods::DEL, std::bind(&Listener::handle_delete,this,std::placeholders::_1));
}
void Listener::handle_get(http_request message)
@ebongzzang
ebongzzang / LazyListener.h
Created April 3, 2017 09:13
KakaoTalk bot using C++ REST SDK(casablanca)
#ifndef LAZY_LISTENER_H
#define LAZY_LISTENER_H
#include "Listener.h"
#include <cpprest/http_listener.h>
#include <cpprest/json.h>
using namespace web::http::experimental::listener;
using namespace web::http;
using namespace web;
using namespace utility;
@ebongzzang
ebongzzang / LazyListener.cpp
Last active April 3, 2017 09:21
KakaoTalk Bot using C++ REST SDK(casablanca)
#include "LazyListener.h"
LazyListener::LazyListener(utility::string_t url) : Listener::Listener(url)
{
}
void LazyListener::handle_get(http_request message)
{
json::value obj;
std::cout << message.to_string() << std::endl;
@ebongzzang
ebongzzang / LazyMain.cpp
Created April 3, 2017 09:26
KakaoTalk Bot using C++ REST SDK(casablanca)
#include "LazyListener.h"
#include <unistd.h>
int main(void)
{
utility::string_t address = ("http://localhost:8081/keyboard");
uri_builder uri(address);
auto addr = uri.to_uri().to_string();
LazyListener * lazy = new LazyListener(addr);
try
@ebongzzang
ebongzzang / MessageListener.h
Created April 21, 2017 12:19
KakaoTalk Bot using C++ REST SDK(casablanca)
#ifndef MESSAGE_LISTENER_H
#define MESSAGE_LISTENER_H
#include "Listener.h"
#include <cpprest/http_listener.h>
#include <cpprest/json.h>
#include <map>
#include <string>
using namespace web::http::experimental::listener;
using namespace web::http;
using namespace web;
@ebongzzang
ebongzzang / MessageListener.cpp
Created April 21, 2017 12:30
KakaoTalk Bot using C++ REST SDK(casablanca)
#include "MessageListener.h"
#include "../HTMLCrawler.h"
#include <fstream>
#include <regex>
#include <locale>
static inline void ltrim(std::string &s)
{
s.erase(s.begin(), std::find_if(s.begin(), s.end(),std::not1(std::ptr_fun<int, int>(std::isspace))));
}
@ebongzzang
ebongzzang / MessageMain.cpp
Created April 21, 2017 12:43
KakaoTalk Bot using C++ REST SDK(casablanca)
#include "MessageListener.h"
#include <unistd.h>
int main(void)
{
utility::string_t address = ("http://localhost:8082/message");
uri_builder uri(address);
auto addr = uri.to_uri().to_string();
MessageListener * msg = new MessageListener(addr);
try
{
@ebongzzang
ebongzzang / hyper-v_backup.ps1
Last active August 8, 2017 13:55
hyper-v backup per month/week and compress using powershell script
#### hyper-v 백업 스크립트 (GIT-server) 제외 ####
### 인자 type: (month, week)
Param (
[Parameter(Mandatory=$true)]
[ValidateSet("Month","Week")]
[String]$Type
#TODO:일시 백업시 저장공간 추가
)