Skip to main content

Posts

Automagically adding 'ready to go' users to Congnito

 Step 1 Add the users via CSV upload and ensure the users get created. The user's will have the status ' RESET_REQUIRED '. But in order to use these users, we need the status to be ' CONFIRMED '. This can be done by setting the password for the user as an admin Step 2 Set the user's passwords as an Admin, use the aws CLI V2: $ aws cognito-idp admin-set-user-password --user-pool-id <MY_POOL_OD> --username <A_USERNAME> --password <A_PASSWORD> --permanent Step 3 Check the status of the user in the cognito console. Step 4 ??? Step 5 Profit!
Recent posts

Postgres Timestamps and Java

Postgres timestamps are up to microseconds resolution. This can be seen here in the Postgres V13 docs . This means that if you are trying to save a ZonedDateTime type into to the DB, you should cut-off the Nano-seconds portion of the time. Otherwise, if you save a time with Nano secs, and you read that time back from the DB, you will have different times. This is because the time from the DB is missing the nano-secs. So how does one go about doing this? Rounding Nanoseconds Essentially do to this, first need to get the nano secs of the second via: Integer nanoSecs = zonedDateTime .get( ChronoField . NANO_OF_SECOND ) ; This amount now has to be converted to micro-secs by dividing by 1000. This removes the nano-seconds the amount. Don't forget that the nano-secs that we just removed by dividing may be more then 500. In which case you should add 1 to the microseconds. Then we need to multiply by 1000 to get the amount back in nano-secs. By doing this we turn all the nano-secs to ZERO

Creating PDFs in Java

What's a good way to make PDFs in java? iText , pdfbox , and perhaps other libraries? However there is another way to create PDFs which is (at least for me and my use case) easier. And that is: create a HTML. Then convert that HTML into a PDF using flying saucer . Why is this easier? Because creating a PDF from scratch is something that makes me feel sick. To get good looking PDFs here is what I suggest: Use a good template library like thymeleaf to generate a html. You can style the HTML and you have a good turnaround time to get a good looking HTML. You can even use CSS to style it Use the flying saucer library to convert the HTML to PDF ??? Profit

How to get two docker-compose services to talk to each other

Imagine you have two services that are started by two different docker-compose files. And you would like these two services to talk to each other. How can we achieve this? Why would you want to do this in the first place? I had a use-case for this, that's why! The use case was as follows: I have a docker-compose file that contains linux-swag and mysql . These are resources that are not updated very often. So I can start them and forget about them. I have another docker-compose file that contains a Spring Boot application. This application can have different versions (prod, staging, dev). And these version get automatically deployed on each git-push.     The nginx serves HTTPS and reverse-proxies connections to the spring application. The spring application connects to the mysql to read and store stuff. The Secret Sauce The way to do this is with docker-compose networking . You see by default each docker-compse file creates it's own bridge network. So by default, in my exampl

Ubuntu Wireless iwlwifi and Windows 10 Dual Boot

If you have Windows 10 and an Ubuntu Dual boot, this may cause your wireless in Ubuntu to stop working. And the culprit seems to the the 'Fast startup' option in Windows. What you need to do is described here . Make sure that 'Fast startup' is turned off! Otherwise it can be that your iwlwifi doesn't get loaded into the Linux Kernel.

Simpler alternative to Conventional Commits

TLDR: Just put the fucking Issue ID in the commit message, you asshat! I keep reading about Conventional Commits , and I think they are somewhat contrived and over complicate a simple requirement of commits: What context was a change made for. As we all know, information is somewhat useless without context. And I feel the same what about commit messages. And the best context in a commit message a link to the original Ticket in the Issue Tracking system. Most Issue Tracking systems support linking to the SCM , so that you can have a bi-directional link. If you look at an issue you can have a list of SCM changes done for that issue. For example, here is a JIRA issue showing what code change was done for it: And if I look into my SCM I can see the JIRA issues that were used to make changes: And the way to do this is to always have the Issue ID in the commit message. That's it. JIRA has this feature, so does Git Hub. That's all you need to do. Every commit message

Gremlin Console with preloaded Air Routes Graph Data

I am currently learning Apache Tinkerpop . An excellent resource is the free online book PRACTICAL GREMLIN by Kelvin R. Lawrence . And one part of this following this book requires one to setup a Gremlin console. And this was a pain to do each time I would start reading/following the book. So I created a Docker Image which contains the Gremlin Console with the air-routes data preloaded so that you can start working immediately. Pull and Run Image docker pull srasul/gremlin-console-air-routes-data:latest docker run -it srasul/gremlin-console-air-routes-data:latest Example $ docker run -it srasul/gremlin-console-air-routes-data:latest Apr 12, 2020 10:24:01 PM java.util.prefs.FileSystemPreferences$1 run INFO: Created user preferences directory. \,,,/ (o o) -----oOOo-(3)-oOOo----- plugin activated: tinkerpop.server plugin activated: tinkerpop.utilities plugin activated: tinkerpop.tinkergraph gremlin> g ==>graphtraversalsource[tinkergraph[vertices:3742 e