Skip to content

Instantly share code, notes, and snippets.

@Wicowyn
Wicowyn / tricky.java
Created May 30, 2017 07:55
How I have broke Java
for(int i = 126; i < 130; i++) {
Integer n1 = i;
Integer n2 = i;
System.out.println(String.format("%d => %b", i, n1 == n2));
}
/* Out :
126 => true
127 => true
version: '2'
services:
db:
image: mariadb:latest
restart: unless-stopped
container_name: ttrss_db
mem_limit: 512m
volumes:
- ./database:/var/lib/mysql
@Wicowyn
Wicowyn / DateTimeConverter.java
Created December 23, 2017 21:18
JPA Joda DateTime converter
public class DateTimeConverter implements AttributeConverter<DateTime, Date> {
@Override
public Date convertToDatabaseColumn(DateTime attribute) {
return attribute == null ? null: new Date(attribute
.withZone(DateTimeZone.UTC)
.withZoneRetainFields(DateTimeZone.getDefault())
.getMillis());
}
@Override
@Wicowyn
Wicowyn / update_postman.sh
Created June 6, 2018 21:53
Update Postman
wget https://dl.pstmn.io/download/latest/linux64 -O /tmp/postman.tar.gz
rm -rf /usr/bin/postman/*
tar --wildcards -C /usr/bin/postman -xf /tmp/postman.tar.gz Postman/* --strip 1
mv /usr/bin/postman/Postman /usr/bin/postman/postman