Skip to content

Instantly share code, notes, and snippets.

View repeat-in-sed.sh
# sed에서는 \1 이 $1 과 같은 역활을 함
$ git tag -l | grep prod/ | sed "s|prod/\(.*\)|test/\1 test_\1|"
test/200601_111050 test_200601_111050
test/200603_183259 test_200603_183259
test/200608_160836 test_200608_160836
test/200610_131331 test_200610_131331
test/200612_102757 test_200612_102757
test/200613_004623 test_200613_004623
test/200613_004827 test_200613_004827
test/200613_005522 test_200613_005522
View how-to-reset-kafka-offset.txt
offset reset (0.8.2 기준)
topic을 지워봐야 zookeeper에 보존된 low-level offset을 초기화 할 수 없음.
따라서 zookeeper shell에 접근해서 low-level offset을 초기화해야함.
[root@sv-kafka-dev01 bin]# ./zookeeper-shell.sh sv-zkdev1a.idincu.net:2181/kafka
Connecting to sv-zkdev1a.idincu.net:2181/kafka
ls /consumers
View web-screenshot-by-selenium.groovy
def testScreenshot() {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Greg\\Downloads\\chromedriver79.exe")
new File("screenshot.png").withOutputStream {
ChromeOptions options = new ChromeOptions()
options.headless = true
WebDriver driver = new ChromeDriver(ChromeDriverService.createDefaultService(), options)
try {
driver.get("https://www.google.com")
it.write(driver.getScreenshotAs(OutputType.BYTES))
} finally {
@leewin12
leewin12 / parseDate.java
Created Oct 9, 2019
parse general date time format
View parseDate.java
**
* @param text
* @return
* @See https://github.com/spring-projects/spring-boot/pull/9930
*/
public static Date parseDate(String text) {
if (text == null || text.length() == 0) {
return null;
}
@leewin12
leewin12 / how-to-extend-lvm.sh
Last active Oct 7, 2019
CentOS_6/7 lvm 추가하는 방법
View how-to-extend-lvm.sh
0. lvm 설치
$ yum install lvm2 -y
1. 디스크 먼저 추가
(/dev/xvdb 라고 가정)
2. fdisk 로 해당 디스크 파티셔닝 및 파일시스템을 Linux LVM (8e) 타입으로 변경
$ fdisk /dev/xvdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xe866154b.
@leewin12
leewin12 / jpa-mysql-json.java
Last active Apr 12, 2020
Build JPA 2.0 CriteriaQuery with MySQL JSON column
View jpa-mysql-json.java
CriteriaBuilder cb = new CriteriaBuilder();
// = SELECT * FROM entity WHERE JSON_EXTRACT("json_column", "$.path")
Root<entity> root;
cb.equal(
cb.function("JSON_EXTRACT", Integer.class, root.get("json_column"), "$.path"),
100);
@leewin12
leewin12 / mysql.service
Created Sep 6, 2019
Percona MySQL 5.7.x limits config
View mysql.service
$ vim /etc/systemd/system/mysql.service
[Service]
LimitNOFILE = infinity
LimitCore = infinity
LimitMEMLOCK = infinity
$ systemctl daemon-reload
$ service mysql restart
$ ps -ef | grep mysql | awk '{print $2}' | head -n1 | xargs -I{} cat /proc/{}/limits
@leewin12
leewin12 / my.cnf
Last active Oct 15, 2019
Percona MySQL 5.7.x my.cnf 2core / 8G
View my.cnf
[client]
default-character-set = utf8mb4
no-auto-rehash # faster cli interaction but no autocomplete
show-warnings # show warnings when it happens
prompt=\u@\h:\d\_\R:\m:\\s> # make cli prompt better ex) root@localhost:(profile) 17:08:55>
pager="less -n -i -F -X -E" # using less for long result rows
[mysqld]
# default
character-set-server = utf8mb4
@leewin12
leewin12 / jvm-launch.sh
Created Jul 17, 2019
jvm config and nohup without nohup.out
View jvm-launch.sh
nohup java -jar {{ jvm_config }} -verbose:gc -XX:+UseG1GC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:MetaspaceSize=100M -XX:MaxMetaspaceSize=100M -Xloggc:logs/gc.log -XX:NumberOfGCLogFiles=4 -XX:GCLogFileSize=1M -XX:+UseGCLogFileRotation -Dspring.profiles.active={{ BUILD_PROFILE }} -Dfile.encoding=utf-8 {{ project_name }}.jar 1>/dev/null 2> >(exec nohup logger -t {{ project_name }}) &
@leewin12
leewin12 / hs_err_pid.log
Created Jun 18, 2019
JVM Crash - [libjvm.so+0xa3598c] ObjectSynchronizer::FastHashCode(Thread*, oopDesc*)+0x5c
View hs_err_pid.log
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f9b77e6498c, pid=7618, tid=0x00007f9b10ba5700
#
# JRE version: OpenJDK Runtime Environment (Zulu 8.38.0.13-CA-linux64) (8.0_212-b04) (build 1.8.0_212-b04)
# Java VM: OpenJDK 64-Bit Server VM (25.212-b04 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V [libjvm.so+0xa3598c] ObjectSynchronizer::FastHashCode(Thread*, oopDesc*)+0x5c
#
You can’t perform that action at this time.