This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When using Spring Security to implement an OAuth login process.You may got | |
a authorization_request_not_found error when you deploy multiple application | |
instances. This is caused by that the spring security saved the authorization | |
requests in memory. Just implementing a AuthorizationRequestRepository to share | |
the requests can solve this problem. Such as HttpCookieOAuth2AuthorizationRequestRepository, | |
RedisCookieOAuth2AuthorizationRequestRepository. | |
reference: | |
docs: https://docs.spring.io/spring-security/site/docs/5.0.7.RELEASE/reference/html/oauth2login-advanced.html#oauth2login-advanced-authorization-request-repository | |
related source code: https://github.com/spring-projects/spring-security/blob/ea352e1c59507d70920246b2b0df35c31ef3ef0f/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/OAuth2LoginAuthenticationFilter.java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location /xxxx { | |
proxy_intercept_errors on; | |
error_page 404 502 = @fallback; | |
rewrite ^ /yyy.html break; | |
proxy_pass http://xxxx.com | |
} | |
nginx默认情况下只处理自己的404 502这一类错误,如果是代理服务返回的错误码,则不会处理。 | |
这时候需要使用proxy_intercept_erros on; 指令才能让其处理代理返回的错误码。 | |
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_intercept_errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"editor.glyphMargin": true, | |
"editor.detectIndentation": false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
一段很简单的代码: | |
res = db.table.find({"uid": 12345}) | |
l = [d['info'] for d in res] | |
在有100多条文档的时候,这段代码有时候会抛出 cursorNotFoundException | |
由于文档只有100多条,可以直接排除cursor超时的问题 | |
经和SA进行确认,链接mongodb的时候使用的是url的方式,部署方式如下: | |
app->lbc->mongos->mongod | |
其中app->lbc使用了长连接的方式,但是lbc->mongos并没有使用长连接。 | |
其中由于文档数量超过100条以后,会超过cursor的默认batach_size,超过batch_size以后需要从mongos拉取更多的数据。 | |
由于lbc->mongos没有使用长连接,有可能会出现这种情况,第一个batch使用了mongos A,取第二个batch时使用了mongos B。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git log查看最近的提交 | |
commit 8f937c683929b08379097828c8a04350b9b8e183 | |
Merge: 8989ee0 7c6b236 | |
Author: Ben James <[email protected]> | |
Date: Wed Aug 17 22:49:41 2011 +0100 | |
git revert 8f937c -m 8989ee0 | |
其中-m用于指定父分支,Merge字段中的提交按1, 2 来编号 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
问题: 使用jq将[{uid: 1, k1: v1, k2: v2}, {uid: 2, k1: v1, k2: v2}, ....]的list转换成 {'1': {k1: v1, k2: v2}, '2': {k1: v1, k2: v2},.....}这种形式 | |
jq: [.[] | {(.uid | tostring): {k1: .k1, k2: .k2}}] | add |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("form").submit(function() { | |
$(this).submit(function() { | |
return false; | |
}); | |
return true; | |
}); | |
$( "#target" ).submit(function( event ) { | |
alert( "Handler for .submit() called." ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. git status 查看状态 | |
On branch master | |
Your branch is behind 'origin/master' by 4 commits, and can be fast-forwarded. | |
(use "git pull" to update your local branch) | |
nothing to commit, working directory clean | |
2. git pull | |
Your configuration specifies to merge with the ref 'master' | |
from the remote, but no such ref was fetched. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |