Skip to content

Instantly share code, notes, and snippets.

View savitoh's full-sized avatar
🏠
Working From Home

Sávio Raires de Souza savitoh

🏠
Working From Home
View GitHub Profile
@rponte
rponte / StringUtils.java
Last active April 10, 2024 23:01
Removing accents and special characters in Java: StringUtils.java and StringUtilsTest.java
package br.com.triadworks.rponte.util;
import java.text.Normalizer;
public class StringUtils {
/**
* Remove toda a acentuação da string substituindo por caracteres simples sem acento.
*/
public static String unaccent(String src) {
@robinhowlett
robinhowlett / YesNoBooleanDeserializer.java
Last active September 4, 2022 20:27
Building a Custom Jackson Deserializer
package com.robinhowlett.blog;
import java.io.IOException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
@PurpleBooth
PurpleBooth / README-Template.md
Last active June 22, 2024 22:08
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@rkueny
rkueny / snx_install.sh
Created July 21, 2016 08:33
Checkpoint SNX VPN client installation shell script
mkdir temp && cd temp
# for linux 'amd64' architecture install those packages:
sudo apt-get install libx11-6:i386 libpam0g:i386 libstdc++5:i386 lib32z1 lib32ncurses5 lib32bz2-1.0
wget https://vpnportal.aktifbank.com.tr/SNX/INSTALL/snx_install.sh
sudo ./snx_install.sh
cd .. && rm -rf temp/
@alanphil
alanphil / login_test.scala
Created August 16, 2016 14:04
Gatling login example and showing how to pull out the HTTP authorization header into a variable
package test
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
class LoginTest extends Simulation {
@MariadeAnton
MariadeAnton / hi-satellite.md
Last active August 7, 2022 18:06
Travis CI Demo Examples - GitHub Satellite 2019
@koraktor
koraktor / RepositoryImpl.java
Created August 18, 2017 10:43
Combining specifications and projections in Spring Data JPA
public class RepositoryImpl<T, ID extends Serializable>
extends SimpleJpaRepository<T, ID extends Serializable> {
ProjectionFactory projectionFactory;
public <P> List<P> findProjected(Specification<?> spec, Sort sort, Class<P> projectionClass) {
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<Tuple> tupleQuery = criteriaBuilder.createTupleQuery();
Root<?> root = tupleQuery.from(getDomainClass());
@anderson-custodio
anderson-custodio / profiling-jvm-kubernetes-visualvm.md
Last active January 23, 2024 13:41
Profiling JVM on Kubernetes using VisualVM

Profiling JVM on Kubernetes using VisualVM

Enable JMX server

Edit Dockerfile to enable JMX server and change the hostname with the IP where the container will run:

FROM openjdk:8-jre-alpine
ADD ./target/app.jar app.jar
EXPOSE 8080
ENTRYPOINT java -Dcom.sun.management.jmxremote.rmi.port=9090 -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=false -Djava.rmi.server.hostname=192.168.1.2 -jar app.jar
@petrbouda
petrbouda / memory-limit-request-jvm.md
Last active May 30, 2024 09:48
Memory LIMIT and REQUEST in Containers and JVM

Memory LIMIT and REQUEST in Containers and JVM

  • Do you run a JVM inside a container on Kubernetes (or maybe OpenShift)?
  • Do you struggle with REQUEST and LIMIT parameters?
  • Do you know the impact of those parameters on your JVM?
  • Have you met OOM Killer?

Hope you will find answers to these questions in this example-based article.

How to set up JVM Heap size in a Container

@byt3bl33d3r
byt3bl33d3r / log4j_rce_check.py
Created December 10, 2021 06:02
Python script to detect if an HTTP server is potentially vulnerable to the log4j 0day RCE (https://www.lunasec.io/docs/blog/log4j-zero-day/)
#! /usr/bin/env python3
'''
Needs Requests (pip3 install requests)
Author: Marcello Salvati, Twitter: @byt3bl33d3r
License: DWTFUWANTWTL (Do What Ever the Fuck You Want With This License)
This should allow you to detect if something is potentially exploitable to the log4j 0day dropped on December 9th 2021.