Skip to content

Instantly share code, notes, and snippets.

@kwon37xi
kwon37xi / .vimrc
Last active September 12, 2020 05:59
My Vim Configuration
" :vim set fileencoding=utf8
" 기본설정
" Windows Installation
" Windows에서는 closetag 를 심볼릭링크해줘야한다. 이 파일에서 closetag로 검색해볼것.
" Windows 에서는 $HOME\vimfiles 아래에 vimrc 로 설정파일을 두고 그 외 플러그인 디렉토리도 둔다. 즉 ~/.vim = $HOME\vimfiles
" cd $HOME\vimfiles
" curl -fLo autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
" mklink vimrc ..\tmp\vim\config\.vimrc
" HOME directory로 이동해서
" mklink vimrc_pc ..\tmp\vim\config\.vimrc_pc_win
@kwon37xi
kwon37xi / menu.xml
Last active January 30, 2016 04:33
Ubuntu Minimal openbox configurations
<?xml version="1.0" encoding="utf-8"?>
<openbox_menu xmlns="http://openbox.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://openbox.org/ file:///usr/share/openbox/menu.xsd">
<menu id="root-menu" label="Openbox 3">
<item label="인터넷 웹 브라우저">
<action name="Execute">
<execute>firefox</execute>
</action>
</item>
<item label="Gnome Commander" icon='/usr/share/pixmaps/gnome-commander.png'>
<action name="Execute">
@kwon37xi
kwon37xi / smi_timing.groovy
Created October 27, 2014 15:57
SMI (Video subscript file format) timing sync
if (args.length < 2) {
println "Usage groovy smi_timing filename milliseconds-to-adjust [encoding:default cp949]"
System.exit(-1)
}
def smi = new File(args[0])
def millis = Long.parseLong(args[1])
def encoding = args.length == 3 ? args[2] : "cp949"
println "$smi, $millis, $encoding"
/**
* 쿼리의 IN 처럼 기준 값을 리스트를 받아서 처리하긴 하지만, 너무 큰 리스트는
* 성능에 부담을 주기 때문에 나눠서 실행해야 할 경우, 자동으로 chunkSize에 따라
* 나눠서 호출해주는 유틸리티.
*/
public abstract class ChunkExecutionUtils {
public static final int DEFAULT_CHUNK_SIZE = 1000;
/**
@kwon37xi
kwon37xi / NumberBytesUtils.java
Last active August 29, 2015 14:01
Java number / byte arary convert
import java.util.Arrays;
/**
* int 형과 byte[] 간의 변환.
* ByteBuffer 를 사용하는 방법 대신, bit operator를 사용하는 기법.
*
* Java는 기본적으로 BigEndian이다.
*
* 참조
* - http://stackoverflow.com/questions/2383265/convert-4-bytes-to-int
@kwon37xi
kwon37xi / mysqldatetimetest.groovy
Last active February 13, 2018 08:11
MySQL 5.6의 DATETIME ms 반올림 버그와 구버전 JDBC 드라이버의 ms 절삭 버그 조합
/*
MySQL 5.6의 DATETIME 타입에 대한 밀리세컨드 부분 절삭 버그 재현
MySQL 5.6.4 ms 지원 : http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html
MySQL 5.6 DATETIME 타입에서 ms 반올림(round) 버그 : http://bugs.mysql.com/bug.php?id=68760
MySQL Connector/J 5.1.22 까지는 Date 객체의 ms 부분을 미리 절삭해 전송하는 버그 있음
MySQL Connector/J 5.1.23 부터는 Date 객체의 ms 부분도 함께 전송 -> MySQL 5.6 서버의 ms 반올림 버그 유발 -> 초,분,날짜가 바뀌는 현상 유발
** 아래코드를 반올림 버그가 있는 MySQL 5.6서버에서 JDBC 드라이버 바꿔가며 실행한 결과
@kwon37xi
kwon37xi / screenmargin.py
Last active December 30, 2015 14:09
Linux X Window Screen margin reservation tool.
#!/usr/bin/env python
import gtk
import sys
'''
X Window left/right edge margin reservation tool
Other windows cannot overlap the margin area.
Usage: screenmargin.py left|right pixel
# reserve left side 100 pixel
screenmargin.py left 100
@kwon37xi
kwon37xi / CacheLockTest.java
Created October 10, 2013 16:22
Google Guava cache에서 캐시의 특정 키에 값이 없는 상태에서 여러 쓰레드에서 요청이 들어와도 최초 요청 쓰레드 하나만 값을 가져오는 코드를 실행하고, 나머지는 기다렸가가 캐시의 결과를 리턴 받는 것을 시연한다.
package kr.pe.kwonnam.guavatest.cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
/**
@kwon37xi
kwon37xi / memcached_keys.php
Created October 7, 2013 04:55
Memcached Key list viewer PHP
<?php
$server = "localhost";
$port = 11211;
/**
* Taken directly from memcache PECL source
*
* http://pecl.php.net/package/memcache
*
*/
@kwon37xi
kwon37xi / (01장) 기본기.scala
Last active August 15, 2023 06:24
쉽게 배워서 빨리 써먹는 Scala 프로그래밍 연습문제 풀이
/** Chapter 01 **/
/*
문제에 오역이 좀 있다. 아래에서 문제 자체를 검색해서 확인해 볼 것.
Java 7 이상에서 실행할 것.
https://www.google.co.kr/search?client=ubuntu&channel=fs&q=scala+for+the+impatient+exercise&ie=utf-8&oe=utf-8&gws_rd=cr&redir_esc=&ei=oqvrUb-1B6LwiQfjk4GQBg
Scala Doc : http://www.scala-lang.org/api/current/index.html
*/