Skip to content

Instantly share code, notes, and snippets.

View Kyeongrok's full-sized avatar

Kyeongrok Kim Kyeongrok

View GitHub Profile
var client = require('cheerio-httpcli');
var officegen = require('officegen');
var xlsx = officegen('xlsx');
var fs = require('fs');
var url = "https://search.naver.com/search.naver?where=post&sm=tab_pge&query=%EC%84%B1%ED%98%95%EC%99%B8%EA%B3%BC&st=sim&date_option=0&date_from=&date_to=&dup_remove=1&post_blogurl=&post_blogurl_without=&srchby=all&nso=&ie=utf8&start=1";
var param = {};
client.fetch(url, param, function(err, $, res){
if(err){console.log("error:", err); return;}
@Kyeongrok
Kyeongrok / gist:f79a2b1d825d7e8c2ad213950f66930a
Created May 9, 2017 16:27
python thread로 3초에 1번씩 hello 출력하는 코드
from threading import Thread
from time import sleep
def printHello():
while True:
print("hello")
sleep(3)
def main():
th = Thread(target=printHello)
@Kyeongrok
Kyeongrok / gist:e698874510a383425b523ce95396589a
Last active June 25, 2017 04:58
excel vba executeExcel4Macro example
'5주차 file 내용 불러오기
Sub main_file()
  result = getCellValue("C:\Users\FTA\Desktop\", _
"raw_data.xlsx", "Sheet1", 1, 1)
MsgBox (result)
End Sub
Function getCellValue(p_파일경로, p_파일명, p_시트명, p_행, p_열)
msg = "'" & p_파일경로 & "[" & p_파일명 & "]" & p_시트명 _
& "'!R1C1"
Sub main_file()
Call 출력_데이터("C:\Users\FTA\Desktop\", _
"예제_병원현황.xlsx", "20151001095606628_PhmHosMetrOrg", "병원현황")
End Sub
Sub 출력_데이터(p_파일경로, p_파일명, p_시트명, p_대상시트명)
On Error Resume Next
Sheets(p_대상시트명).Delete
Sheets.Add.Name = p_대상시트명
Private Sub CommandButton1_Click()
파일경로 = fileLocation.Value
파일명 = fileName.Value
form시트명 = fromSheetName.Value
대상시트명 = toSheetName.Value
Call 출력_데이터(파일경로, 파일명, form시트명, 대상시트명)
End Sub
Sub main()
    Call 출력_안녕하세요
    Call 출력_메세지("안녕히가세요")
    Call 출력_메세지("반갑습니다.")
    Call 출력_메세지_범위("또 뵙겠습니다.", "a3")
    Call 출력_메세지_범위("또 뵙겠습.", "a4")
    Call 출력_메세지_범위("안녕하세요 김경록님", "a5")
    Call 출력_메세지_범위("안녕히가세요 김경록님", "a6")
 Call 출력_메세지_범위_이름("안녕히가세요", "a7", "김경록")
'서브루틴 sub
'excel vba 명령 실행 단위
Sub main()
    Call 출력_안녕하세요
    Call 출력_안녕히가세요
    Call 출력_메세지("welcome to")
    Call 출력_메세지_누구("오랜만이네요", "경록")
    Call 출력_메세지_누구_범위("오랜만이네요", "경록", "b8")
 '" "
Sub main_loop()
    'F8 한줄씩 실행
    Cells.Clear
    'Call 연습_반복문
    Call 연습_반복문_가로로이동
    
End Sub

Sub 연습_반복문()
Private 인터넷익스플로러 As InternetExplorer
Sub main()
    'IE 객체 작성
    Set 인터넷익스플로러 = CreateObject("InternetExplorer.Application")
    검색어 = WorksheetFunction.EncodeURL("맛집")
    페이지주소 = "https://search.naver.com/search.naver?where=nexearch&sm=top_hty&fbm=1&ie=utf8&query=" & 검색어

    인터넷익스플로러.Visible = True
 인터넷익스플로러.Navigate2 (페이지주소)
function myFunction() {
  // 1. 페이지 불러오기
  var url = "http://finance.daum.net/item/main.daum?code=005930";
  var response = UrlFetchApp.fetch(url);
  var content = response.getContentText("UTF-8");
  
  // 2. 정규식으로 데이터 읽어오기
  var title = content.match(/<em class="screen_out">(.*?)<\/em>/);