Skip to content

Instantly share code, notes, and snippets.

View mxmlnglt's full-sized avatar

Maxime Lenglet mxmlnglt

View GitHub Profile
@jaygooby
jaygooby / log4j-jndi.conf
Last active February 2, 2022 12:04
fail2ban filter rule for the log4j CVE-2021-44228 exploit
# log4j jndi exploit CVE-2021-44228 filter
# Save this file as /etc/fail2ban/filter.d/log4j-jndi.conf
# then copy and uncomment the [log4j-jndi] section
# to /etc/fail2ban/jail.local
#
# jay@gooby.org
# https://jay.gooby.org/2021/12/13/a-fail2ban-filter-for-the-log4j-cve-2021-44228
# https://gist.github.com/jaygooby/3502143639e09bb694e9c0f3c6203949
# Thanks to https://gist.github.com/kocour for a better regex
#
@sverhagen
sverhagen / PagedResultDeserializer.java
Created August 6, 2017 06:23
Contextual deserializer for generic wrapper type in Jackson
package com.example;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.ObjectCodec;
import com.fasterxml.jackson.databind.BeanProperty;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@darylteo
darylteo / ArrayOrObject.java
Last active November 8, 2022 10:48
Jackson Deserializer based on several StackOverflow posts.
import java.util.List;
@Data
public class ArrayOrObject<T> {
private List<T> data;
private Boolean isObject;
}
@gotomypc
gotomypc / Beanutils.java
Created October 28, 2012 05:05 — forked from ideiudicibus/Beanutils.java
Merge two java beans useful when discovering differences
class Beanutils{
//merge two bean by discovering differences
private <M> void merge(M target, M destination) throws Exception {
BeanInfo beanInfo = Introspector.getBeanInfo(target.getClass());
// Iterate over all the attributes
for (PropertyDescriptor descriptor : beanInfo.getPropertyDescriptors()) {
// Only copy writable attributes
if (descriptor.getWriteMethod() != null) {