Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jatin-lab49 on github.
  • I am jatinlab49 (https://keybase.io/jatinlab49) on keybase.
  • I have a public key ASDL2gGxoVavFI2u3i8X3sZNTTObiZazjtyEP0DGDfZj-wo

To claim this, I am signing this object:

@jatin-lab49
jatin-lab49 / cloudfront-cache.md
Last active May 6, 2020 22:13
TIL-Lab49/cloudfront-caching

Managing S3 cache-control for AWS Cloudfront

Turns out you need can set the Cache-Control value for your S3 objects to be used with AWS Cloudfront in two ways!
The documentation at https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html says it has to be in the MetaData property.
But, you can also have it defined as a CacheControl value on the object. This can be done by passing it as the argument --cache-control max-age=0 to the aws s3 sync command.

@jatin-lab49
jatin-lab49 / ionic-router-issues.md
Created May 21, 2020 14:08
TIL-Lab49/ionic-router

So, if using the IonReactRouter in your Ionic React app, do note that the Page/component does not get unmounted when navigating to another component.

This is by design, per the discussion here: ionic-team/ionic-framework#20543

Confusing, but good to know!

@jatin-lab49
jatin-lab49 / plantuml-lines.md
Last active May 27, 2020 19:19
TIL-Lab49/plantuml-lines

Linetypes in PlantUML

Sometimes your boxes in PlantUML end up next to each other. In this case, PlantUML by default adds a curved line which doesn't look very tidy.

gist_demo_reg

To fix this, you can use the skinparam linetype as below

Add ortho linetype:

@jatin-lab49
jatin-lab49 / github-images-cdn.md
Last active May 27, 2020 19:21
TIL-Lab49/github_gist_images
@jatin-lab49
jatin-lab49 / multi-artifact-gradle.md
Last active June 2, 2020 20:25
TIL-Lab49/Upload Multiple Artifacts via Gradle

Upload Multiple file artifacts with one Gradle file

I ran into an issue where the deploy process needed to download multiple configuration files from artifactory. To upload these files to artifactory, I used the artifacts block in the build.gradle file as below:

project.group='com.lab49.example'
version='0.0.1-SNAPSHOT'

def devFile = file("./environments/dev/redirects.config.json")
@jatin-lab49
jatin-lab49 / docker-image-pull.md
Last active June 22, 2020 20:34
TIL-Lab49/Docker image pull with private registry

Sometimes, if you are behind a corporate proxy - docker pull fails to download images from dockerhub with an error like below:

$ sudo docker pull swaggerapi/swagger-codegen-cli
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/: read tcp 10.0.2.15:50136->3.223.220.229:443: read: connection reset by peer

You can check if the image is in your private registry by prepending the private docker hub before the image and checking if it works.

@jatin-lab49
jatin-lab49 / gradle-compilecache-error.md
Created June 22, 2020 20:32
TIL-Lab49/Recovering from Gradle "Cannot lock Java compile cache"

Ran into a weird issue today where I was refactoring a lot of Java classes. Trying to run Gradle build via IntelliJ kept failing.

The error was:

> Task :compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
@jatin-lab49
jatin-lab49 / intellij-thread-dump.md
Created June 22, 2020 20:40
TIL-Lab49/Stop IntelliJ printing Java thread dump to console

On a new Ubuntu VM, I noticed my fresh install of IntelliJ was printing a lot of logs to the console. After playing around with the existing projects logging configuration etc, I still could not squelch logs that began with:

2020-06-18 16:07:08
Full thread dump OpenJDK 64-Bit Server VM (25.252-b09 mixed mode):

I finally realized IntelliJ was attaching itself to the process, and this issue helped me figure out how to stop that: https://youtrack.jetbrains.com/issue/IDEA-203543

The trick is to disable the debugger.attach.to.process.action registry key in IntelliJ. You can do this as follows:

  1. Open IntelliJ Help menu and click on Find Action...
@jatin-lab49
jatin-lab49 / git-rebase-onto.md
Last active December 26, 2023 09:19
TIL-Lab49/Rebase --onto to avoid dependent branch conflicts after squash merge

So, I love to squash commits for a feature branch when it is merged to develop (and then eventually to master). This works well if your Pull Requests (or Merge requests on Gitlab) are accepted and merged relatively quickly. Often though, I end up in this scenario:

  1. develop -> on commit A
  2. featureOne -> commit B-C-D added
  3. Pull request opened for featureOne against develop
  4. Need to start working on featureTwo branch which depends on featureOne
  5. featureTwo -> commit E-F-G added
  6. Pull request for featureOne against develop gets merged and squashed