Skip to content

Instantly share code, notes, and snippets.

View joohee's full-sized avatar

Joohee Kang joohee

  • Korea
View GitHub Profile
#!/bin/bash
#
# tomcat
#
# chkconfig: 345 96 30
# description: Start up the Tomcat servlet engine.
#
# processname: java
# pidfile: /var/run/tomcat.pid
#
@joohee
joohee / tomcat_native_library.txt
Last active August 29, 2015 14:04
[TOMCAT] tomcat native library 설정
현상 : 로그에 The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path 찍힘.
해결 : tomcat native library 설치
http://tomcat.apache.org/tomcat-7.0-doc/apr.html 참고
1 Apache APR(Apache Portable Runtime) 설치
Apache APR 홈페이지 : http://apr.apache.org/
APR은 Apache2 버전이 설치되면 함께 설치 된다. $APACHE_HOME/bin/apr-1-config 를 확인 한다.
Apache 2 가 설치되어 있지 않다면 아래와 같이 설치해야 한다.
@joohee
joohee / dbupdate.js
Created May 2, 2014 06:10
dbupdate.js
var exec = require('child_process'),
mysql = require('mysql'),
fs = require('fs'),
readline = require('readline')
stream = require('stream'),
AWS = require('aws-sdk'),
domain = require('domain'),
crypto = require('crypto')
var env = require('./env.json')
@joohee
joohee / app.js
Created May 2, 2014 06:01
app.js
var exec = require('child_process'),
fs = require('fs'),
readline = require('readline')
stream = require('stream'),
AWS = require('aws-sdk'),
domain = require('domain'),
crypto = require('crypto')
var env = require('./env.json')
var instream = fs.createReadStream(env.query_result_filename);
@joohee
joohee / dbconnect.js
Last active August 29, 2015 14:00
dbconnect.js
var mysql = require('mysql');
var fs = require('fs');
var properties = require('./db-properties.json');
var env = require('./env.json');
var connection = mysql.createConnection(properties);
var filename = env.query_result_filename;
var surveyIds = [];
connection.query("use database");
#https://gist.github.com/rajraj/1556657
sudo yum update
sudo yum install java-1.7.0-openjdk.i686 -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.9.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
# for mac, remove comment.
#export LC_CTYPE=C
#export LANG=C
find . -type f -exec sed -i '' 's/SRC/DST/g' {} \;
@joohee
joohee / 1_download.py
Last active December 27, 2015 18:19
1. download 2. xml -> csv 변환 및 prdcode값만 따로 추출 - 정렬을 위해 prdcode값을 맨 앞으로 붙입니다. 3. diff 후 파일 저장 - 어제 있었는데 오늘 없는 파일은 삭제 대상이므로 deleted-%Y-%m-%d.txt 파일을 생성합니다. 샘플은 일단 삭제 ^_^)
#!/usr/env/python
# coding: utf8
import urllib
import urllib2
import requests
from datetime import date, datetime
## urllib는 파일 만들고 다운로드 + write 시작
## urllib2 다운로드 받은 후에 파일 write 시작
url = 'http://www.poombuy.com/sk_styletag/sk_stt_all.xml'
@joohee
joohee / Cynap.java
Created October 22, 2013 01:58
cynap test java version
public class Cynap {
private static final int BASE = 26;
public static void main(String[] args) {
if (args.length < 1) {
System.out.println("please insert value... ");
return;
}
System.out.println("input: " + args[0]);
@joohee
joohee / gist:6303387
Last active December 21, 2015 12:08
Luhn algorithm
public class CreditCardValidation {
public static void main (String[] args) {
if (args.length < 1) {
System.out.println("usage: CreditCardValidation number");
} else {
String cardNumber = args[0];
int checksum = 0;
int length = cardNumber.length();
for (int i = 0; i < length; i++) {