Skip to content

Instantly share code, notes, and snippets.

@bluesid
bluesid / proxmox_wol_command.sh
Created April 13, 2024 06:34
#proxmox #wol #command
# ethtool 설치
$ apt install ethtool
# 어탭터와 맥 주소 IP 확인
$ ip addr
root@proxmox:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
BigDecimal a = new BigDecimal("0.4");
BigDecimal b = new BigDecimal("0.40");
// 객체의 레퍼런스 주소에 대한 비교 연산자, 무의식적으로 값의 비교를 위해 사용하면 오동작
// false
a == b;
// 값의 비교를 위해 사용, 소수점 맨 끝의 0까지 완전히 값이 동일해야 true 반환
// false
a.equals(b);
@bluesid
bluesid / StackTrace.Java
Created February 13, 2024 02:56
Converting a Stack Trace to a String in Java #printStackTrace #JAVA
// https://www.baeldung.com/java-stacktrace-to-string
String stacktrace = ExceptionUtils.getStackTrace(e);
// commons-lang3 jar 구현체
public static String getStackTrace(Throwable throwable) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw, true);
throwable.printStackTrace(pw);
return sw.getBuffer().toString();
}
@bluesid
bluesid / getRequestEntity.java
Created January 25, 2024 07:25
#getRequestEntity #HttpMethod
// https://www.tabnine.com/code/java/methods/org.apache.commons.httpclient.methods.PostMethod/getRequestEntity
((StringRequestEntity)post.getRequestEntity()).getContent();
@bluesid
bluesid / get_domain.js
Created January 4, 2024 04:23
#domain #currentdomain #js #javascript
// https://stackoverflow.com/questions/11401897/get-the-current-domain-name-with-javascript-not-the-path-etc
function getDomain(url, subdomain) {
subdomain = subdomain || false;
url = url.replace(/(https?:\/\/)?(www.)?/i, '');
if (!subdomain) {
url = url.split('.');
url = url.slice(url.length - 2).join('.');
@bluesid
bluesid / httpie_sample.sh
Last active November 17, 2023 00:57
#httpie
# http version
$ http --version
# https://stackoverflow.com/questions/37215565/sending-nested-json-object-using-httpie
$ echo '{ "user": { "name": "john", "age": 10 } }' | http httpbin.org/post
$ http PUT localhost:8080/user <<<'{ "user": { "name": "john", "age": 10 }}'
@bluesid
bluesid / nginx.md
Last active November 9, 2023 00:45
nginx
@bluesid
bluesid / hey.md
Created February 22, 2023 23:38
#httploadgenerator #hey