Skip to content

Instantly share code, notes, and snippets.

import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.security.oauth2.resource.FixedPrincipalExtractor;
import org.springframework.boot.autoconfigure.security.oauth2.resource.PrincipalExtractor;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.social.ApiException;
import org.springframework.social.connect.ApiAdapter;
import org.springframework.social.connect.ConnectionValues;
@kakawait
kakawait / twitter-profile.json
Created February 13, 2017 10:04
Common OAuth1/2 provider profile response
{
"contributors_enabled": true,
"created_at": "Sat May 09 17:58:22 +0000 2009",
"default_profile": false,
"default_profile_image": false,
"description": "I taught your phone that thing you like. The Mobile Partner Engineer @Twitter. ",
"favourites_count": 588,
"follow_request_sent": null,
"followers_count": 10625,
"following": null,
@kakawait
kakawait / mac-mackbook-fr.kmap
Last active January 8, 2017 15:05
mac-mackbook-fr.kmap
# marc.shapiro@inria.fr 4-october-1998
# French Macintosh keyboard
# attempt to align to the standard Mac meaning of keys.
# mostly intuitive!
# option=AltGr; Apple/Command=Alt (==> meta)
# changes : Etienne Herlent <eherlent@linux-france.org> june 2000
# adapted to "linux" keycodes :
# Martin Costabel <costabel@wanadoo.fr> 3-jan-2001
# changes for '=' symbol from the numeric keybap to work :
# Etienne Herlent <eherlent@linux-france.org> 14-jan-2001
@kakawait
kakawait / DiscoveryHostUrlFilter.java
Created December 16, 2016 20:47
DiscoveryHostUrlFilter
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import org.springframework.stereotype.Component;
import java.net.URL;
/**
* <i>Spring Cloud Netflix - Zuul</i> does not support <i>load-balanced</i> routing if target service has
* context path different than {@code /}.
*
@kakawait
kakawait / LoadBalancedUrlFilter.java
Created August 12, 2016 09:06
LoadBalancedUrlFilter
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.netflix.zuul.filters.ZuulProperties;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.net.URL;
@kakawait
kakawait / CustomMappingHandler.java
Created December 24, 2014 14:49
Custom handler to support @controller & @RepositoryRestController
package com.kakawait;
import org.springframework.core.Ordered;
import org.springframework.util.Assert;
import org.springframework.web.servlet.HandlerExecutionChain;
import org.springframework.web.servlet.HandlerMapping;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@kakawait
kakawait / conf.py
Last active August 4, 2022 09:35
Sphinx only plugin
import sys, os
# The path where you put the only.py file
sys.path.append(os.path.abspath('../sphinx-ext/'))
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['scope']
@kakawait
kakawait / .bash_profile
Last active December 11, 2015 08:18
my dotfile configuration on MacOSX 10.8. Edit from https://github.com/mathiasbynens/dotfiles
#############################
# MAIN #
#############################
# Append to the Bash history file, rather than overwriting it
shopt -s histappend
# Autocorrect typos in path names when using `cd`
shopt -s cdspell