Skip to content

Instantly share code, notes, and snippets.

@oiehot
oiehot / naver_cafe_crawler_wip.py
Created Nov 4, 2017
Naver cafe crawler (wip)
View naver_cafe_crawler_wip.py
from selenium import webdriver
class Article():
def __init__(self, id, title, author, date, view_count=0, like_count=0, contents=''):
self.id = id
self.title = title
self.author = author
self.date = date
self.view_count = view_count
self.like_count = like_count
View clien_board_watcher.py
import json
import threading
import datetime
import re
import sqlite3
import requests
import log
from urllib.parse import urljoin, urlparse
from bs4 import BeautifulSoup
from telegram.bot import Bot
@oiehot
oiehot / telegram_bot.py
Created Oct 22, 2017
Python Telegram Bot
View telegram_bot.py
import threading
import telepot
import sqlite3
import log
SETTINGS_TABLE = 'settings'
SUBSCRIBER_TABLE = 'subscriber'
LAST_UPDATE_ID = 'last_update_id'
UPDATE_INTERVAL_SEC = 5
@oiehot
oiehot / ps_packer.jsx
Created Oct 14, 2017
Photoshop Sprite Packer
View ps_packer.jsx
SPRITE_MARGIN = 2
function rect_str(r) {
return "x: " + r.x + ", y: " + r.y + ", w: " + r.w + ", h: " + r.h
}
function rects_str(rects) {
str = ""
for(var i=0; i<rects.length; i++) {
str += "["+i+"]" + rect_str(rects[i]) + "\n"
@oiehot
oiehot / paste_in_place.py
Created Oct 5, 2017
PS Paste in Place with Python
View paste_in_place.py
import comtypes.client
app = comtypes.client.CreateObject('Photoshop.Application.60') # CS6
def paste_in_place():
# var idpast = charIDToTypeID( "past" );
idpast = app.CharIDToTypeID('past')
# var desc862 = new ActionDescriptor();
desc862 = comtypes.client.CreateObject('Photoshop.ActionDescriptor.60')
# var idinPlace = stringIDToTypeID( "inPlace" );
idinPlace = app.StringIDToTypeID('inPlace')
@oiehot
oiehot / render.py
Created Oct 2, 2017
Maya batch render with Python
View render.py
import os
import argparse
# command line options
parser = argparse.ArgumentParser(description='N9A Maya Batch render')
parser.add_argument('-prj', '--project', required=True, type=str, help='ex) d:/project/alice/maya')
parser.add_argument('-i', '--include_file', required=True, type=str, help='ex) include.txt')
parser.add_argument('-q', '--quality', required=True, type=str, help='ex) preview, production, default')
cmd_opts = parser.parse_args()
@oiehot
oiehot / composite.py
Created Oct 1, 2017
Building Photoshop layers with Python
View composite.py
import os
import comtypes.client
app = comtypes.client.CreateObject('Photoshop.Application.60') # CS6
# maya config
project_path = 'd:/project/alice/maya'
log_path = project_path + '/log'
images_path = project_path + '/images'
layers = ['master', 'prop_matte', 'shadow', 'wall_matte']
passes = ['beauty', 'N']
@oiehot
oiehot / react_redux_example.jsx
Created May 20, 2017
React Redux 사용 예
View react_redux_example.jsx
/* components/Todo.jsx */
import React from 'react'
import { connect } from 'react-redux'
import * as TodoAction from '../actions/todos'
class Todo extends React.Component {
render() {
return (
<div>
View redux_basic_pattern.jsx
/*
# Redux 기초
## 데이터 흐름
1. 액션을 스토어에 보냄.
2. Redux 스토어가 지정된 리듀서 함수들을 호출함. 이 때 현재 상태와 액션이 같이 넘어간다.
3. 루트 리듀서가 각 리듀서의 출력을 합쳐서 하나의 상태 트리로 만듬.
4. 반환된 상태 트리를 스토어에 저장함.
@oiehot
oiehot / my_site_process_1.md
Last active May 6, 2017
사이트 프로세스
View my_site_process_1.md

사이트 프로세스

사전에 나스에서 데스크탑으로 SVN 체크아웃을 한다. 예) svn://nas/oiehot.com/2017

다운로드 받은 파일들은 Hugo와 Stylus로 구성된 정적 사이트 컨텐츠다.

  1. 데스크탑에서 글을 쓴다.

  2. 데스크탑에서 나스SVN으로 커밋한다.

You can’t perform that action at this time.