This file contains hidden or 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
# No longer need to use Powermock to mock statics, this is now supported in Mockito with .mockStatic() | |
# Alternative approach to https://gist.github.com/kevinhooke/b4035faa5f2c215e8166936a44db4fa3 | |
# Requires mockito-inline dependency instead of mockito-core | |
try (MockedStatic<ClassToMock> mock = Mockito.mockStatic(ClassToMock.class)) { | |
mock.when(ClassToMock::staticMethod).thenReturn(mockedReturn); | |
} |
This file contains hidden or 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
If building multi-module projects and publishing/installing to a repo, version properties like ${revision} are not | |
consistently replaced at install time. This results in errors when attempting to refer to one of these modules | |
as a dependency from another project, and instead of library:1.0.0 resolving, you'll see an error where | |
it's attempting to reference library:${revision} instead. | |
See discussion here: | |
https://stackoverflow.com/questions/41086512/maven-issue-to-build-one-module-using-revision-property | |
To fix, to need to add the flatten-maven-plugin: | |
https://maven.apache.org/guides/mini/guide-maven-ci-friendly.html#install-deploy |
This file contains hidden or 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
#To squash previous commits to a single commit | |
git rebase -i HEAD~[number of previous commits to squash] | |
#From the interactive list, each of the commits will be listed as 'pick'. Choose one of the commits into which | |
#the others should be merged, leave that as 'pick', and change all the others to 's' or 'squash' |
This file contains hidden or 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
#list projects | |
gcloud projects list | |
#list VMs | |
gcloud --project [project-id] compute instances list | |
#List Cloud Run services | |
gcloud --project [project-id] run services list | |
#Lookup GCP secret |
This file contains hidden or 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
#show response headers | |
curl -I some-url | |
#with basic auth | |
curl -u 'userid:password' some-url |
This file contains hidden or 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 reset HEAD~ |
This file contains hidden or 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
aws cloudformation describe-stack-resources --physical-resource-id example-s3-bucketname |
This file contains hidden or 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
# Heading 1 | |
## Heading 2 | |
### Heading 3 | |
# Tables | |
| a | b | | |
|---|---| | |
|aaa|bbb| | |
# Lists |
This file contains hidden or 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
Resources: | |
roleResourceName: | |
Type: AWS::IAM::Role | |
Properties: | |
RoleName: role-name | |
AssumeRolePolicyDocument: | |
Version: '2012-10-17' | |
Statement: | |
- Effect: Allow | |
Principal: |
This file contains hidden or 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
If you call lambda.invokeAsync() from one lambda calling another, if the calling lambda completes/exits before the second | |
lambda has been successfully invoked then depending on the timing it's possible the second Lambda will not invoke sucessfully. | |
The SDK docs show calling invokeAsync with a callback: | |
const params = { | |
"FunctionName": "fucntion-name-to-invoke", | |
"InvokeArgs": JSON.stringify(payload-to-pass-to-lambda) | |
}; | |
lambda.invokeAsync(params, function (error, result) { |
NewerOlder