Skip to content

Instantly share code, notes, and snippets.

Avatar

Sanghyuk Jung benelog

View GitHub Profile
@benelog
benelog / RestCall.kt
Last active April 18, 2019 19:38
RestTemplate 활용
View RestCall.kt
private fun getResponse(disqusOauthUrl: String): ResponseEntity<String> {
val endpoint = URI.create(disqusOauthUrl)
val req = RequestEntity<Any>(HttpMethod.GET, endpoint)
val resType = object : ParameterizedTypeReference<String>() {}
return RestTemplate().exchange<String>(req, resType)
}
@benelog
benelog / AspectTest.java
Created April 9, 2019 19:56
spring aop order 테스트
View AspectTest.java
package com.test.aop;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@benelog
benelog / Test.jsh
Last active December 3, 2017 04:14
View Test.jsh
int count = 3; // main count1;
int count2 = 3; // main count2;
int count3 = 3; // main count3;
int count4 = 3; // main count4;
int causeCategoryCount = 3; // main count1;
View effecitve-java.txt
I hope this edition captures my continued enthusiasm for the platform and helps make your use of the platform and its new features more effective and enjoyable.
@benelog
benelog / commands.txt
Created January 20, 2017 21:02
tcplay
View commands.txt
sudo tcplay -c -d /dev/loop0 -a whirlpool -b AES-256-XTS
sudo mkfs.ext4 /dev/mapper/source.tc
losetup /dev/loop0 source.tc
tcplay -m source.tc -d /dev/loop0
mount /dev/mapper/source.tc /mnt/source/
@benelog
benelog / presentation-framework.md
Last active January 8, 2017 13:13
presentation-framework.md
View presentation-framework.md

Slidy

장점

  • 한 슬라이드 내에서 스크롤 지원
  • Asciidoc 지원
  • 프린트, PDF변환 자연스럽게 됨.

단점

  • Markdown, Asciidoc을 쓸 때 명시적으로 페이지 구분자를 넣을 수 없음.
    • H2 태그 기준으로만 페이지 전환
@benelog
benelog / java-string-concat.md
Last active March 8, 2023 23:15
String 최적화 JDK 1.5
View java-string-concat.md

jdk1.5에서 String 더하기의 컴파일시의 최적화]

String 클래스를 "+"로 반복해서 더하는 연산을 어떤 경우에 컴파일러에서 자동으로 최적화해주는지 알고 있다면 보다 융퉁성 있게 쓸 수가 있습니다.

몇년전에 javaservice.net에서의 String vs StringBuffer에 대한 논의에서도 이 이야기가 오고 갔었고, 그를 통해 제가 알게 되었던 바는 다음과 같습니다.

  1. 한줄에서 상수 String끼리만 더하는 것은 모두 합쳐진 문자열로 바꿔준다. 즉 String a= "a" + "b" + "c"; 라고 쓰면 String ="abc"; 로 알아서 컴파일해준다는 거죠.
  2. 한줄에서 상수와 다른 String 클래스를 더하는 것은 StringBuffer의 append, toString 메서드를 쓰는 코드로 준다. jdk 1.4 javadoc 의 StringBuffer API설명 에 명시되어 있네요.

String buffers are used by the compiler to implement the binary string concatenation operator . For example, the code:

@benelog
benelog / README.md
Last active January 19, 2017 23:57
SMS to TTS
View README.md

활용요소

  • IFTTT
  • Dropbox
  • Google TTS API
  • mplayer (Linux mp3 player)
  • Python watchdog 라이브러리

사용방법

  1. IFTTT가입
  2. 레서피 복사하여 활성화
View pad.sh
#!/bin/bash
echo xinput map-to-output for Multi-Touch-V3004
input_id=`xinput | grep Multi-Touch-V3004 | awk '{print substr($5,4,length($5)-3)}'`
echo Input device id: $input_id
output_id=$1
if [[ -z $output_id ]]; then
output_id=2
fi