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
//SlackSignIn gives the Authentication token in return to the code | |
func (LoginService) SlackSignIn(ctx context.Context, code string) (token SlackTokenResponse, err error) { | |
conf := &oauth2.Config{ | |
ClientID: slackClientID, | |
ClientSecret: slackClientSecret, | |
Scopes: slackScopes, | |
Endpoint: oauth2.Endpoint{ | |
AuthURL: slackAuthURL, | |
TokenURL: slackTokenURL, |
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
{ | |
"AccessToken": "xoxp-827479-624459-260853-a4291948ksjkjdksdds6df5511ea", | |
"Expiry": "0001-01-01T00:00:00Z", | |
"RefreshToken": "", | |
"TokenType": "" | |
} |
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
//Elastic match_all gives all records | |
{ | |
"query": { | |
"match_all": { | |
"boost":1.5 | |
} | |
} | |
} |
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
//size retrieves only 10 documents back | |
{ | |
"size": 10, | |
"query": { | |
"match_all": {} | |
} | |
} |
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
//This brings the record from 100th document and gets the next 100 document | |
{ | |
"query": { | |
"match_all": {}, | |
"from": 100, | |
"size": 100 | |
} | |
} |
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
//sort query sorts the document based on the field specified | |
{ | |
"query": { | |
"match_all": {}, | |
"sort": [ | |
{ | |
"id": { | |
"order": "desc" | |
} | |
}, |
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
{ | |
"_source":["id","name"], | |
"query":{ | |
"match_all":{} | |
} | |
} |
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
//match query retrieves all documents which has a title like 'Japan%' | |
{ | |
"_source":["id","name"], | |
"query":{ | |
"match":{ | |
"title": "Japan" | |
} | |
} | |
} |
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
//AND operation syntax | |
{ | |
"query":{ | |
"bool":{ | |
"must":[] | |
} | |
} | |
} | |
//OR operation syntax |
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
#!/bin/bash | |
# This is a very naive script, it doesn't do grouping and returns all branches | |
# I only really care about branches that have not seen commits in two months | |
# | |
# I am hoping to find some time to write a tool that can output these reports for me | |
# In the meantime, I am using this | |
echo "Merged branches" | |
for branch in `git branch -r --merged | grep -v HEAD`;do echo -e `git log --no-merges -n 1 --format="%ci, %cr, %an, %ae, " $branch | head -n 1` \\t$branch; done | sort -r |