Skip to content

Instantly share code, notes, and snippets.

@pintomau
pintomau / JacksonHandlerMethodArgumentResolver.kt
Created December 18, 2024 14:27
Jackson parson of Azure JMS Service Bus Messages
package com.pitch.common.jms_azure_jackson
import com.fasterxml.jackson.core.JsonProcessingException
import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.ObjectMapper
import java.io.Serializable
import org.springframework.core.MethodParameter
import org.springframework.jms.support.converter.MessageConversionException
import org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolver
@pintomau
pintomau / RedisEnvPostProcessor.java
Last active January 24, 2020 09:15
Spring cloud config self configuration with redis backend
/**
* Enables self-configuring by loading properties from redis to be used by Spring.
*/
public class RedisEnvPostProcessor implements EnvironmentPostProcessor {
@Override
public void postProcessEnvironment(
final ConfigurableEnvironment environment, final SpringApplication application) {
final List<String> activeProfiles = Arrays.asList(environment.getActiveProfiles());
/* Kalman Filter */
float Qvalue;
long locationTimeInMillis = (long)(location.getElapsedRealtimeNanos() / 1000000);
long elapsedTimeInMillis = locationTimeInMillis - runStartTimeInMillis;
if(currentSpeed == 0.0f){
Qvalue = 3.0f; //3 meters per second
}else{
Qvalue = currentSpeed; // meters per second
@pintomau
pintomau / binarysearch.php
Created May 10, 2018 11:21
PHP Binary Search
<?php
declare(strict_types=1);
interface BinarySearchComparatorInterface
{
public function compare($element, $needle): int;
}
@pintomau
pintomau / multiple_ssh_setting.md
Created September 7, 2016 10:24 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
https://coderwall.com/p/uaohzg
@pintomau
pintomau / gist:91036f6b1de362d380ff
Created August 26, 2014 20:45
slow ubuntu dns lookup
http://askubuntu.com/questions/272358/extrememly-slow-dns-lookup
@pintomau
pintomau / gist:5cde6bb8c7e8be797935
Created July 28, 2014 18:50
Gnome numix customization
sudo add-apt-repository ppa:noobslab/themes
sudo add-apt-repository ppa:satyajit-happy/themes
sudo add-apt-repository ppa:numix/ppa
sudo apt-get update
sudo apt-get install numix-gtk-theme
sudo apt-get install gnome-shell-theme-elegance-colors
@pintomau
pintomau / .htaccess
Created February 28, 2014 15:30
Office mime types for apache
# Office files
AddType application/vnd.ms-word.document.macroEnabled.12 docm
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
AddType application/vnd.ms-powerpoint.template.macroEnabled.12 potm
AddType application/vnd.openxmlformats-officedocument.presentationml.template potx
AddType application/vnd.ms-powerpoint.addin.macroEnabled.12 ppam
AddType application/vnd.ms-powerpoint.slideshow.macroEnabled.12 ppsm
AddType application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
AddType application/vnd.ms-powerpoint.presentation.macroEnabled.12 pptm
@pintomau
pintomau / gist:9070052
Created February 18, 2014 12:27
Grant View permissions only in MySQL
GRANT SELECT ON database.VIEW TO 'user'@'host';
GRANT SHOW VIEW ON database.VIEW TO 'user'@'host';