My name is Jimmy and I am engineer / entrepreneur living and working in beautiful Berkeley, CA. My interests revolve around technology, health, philosophy/spirituality and learning. In a former life, I founded and sold CodeEval. This blog is created via the awesome Hugo framework. It is hosted by Netlify. All the code for this site is available on Github. This is my personal blog. (Views expressed here are my own). It is an attempt to open source my knowledge.
OneHumanRace Trade your time/knowledge/skills for contributions to a charity of your choice. BioHacks Utilities for bio chemists (or others) to play around with DNA sequences. GoCVE A command line client to query Common Vulnerabilities and Exposures (CVE). Text to Morse Code Converts text to morse code and vice-versa. Some characters like the quotation mark(“”) is not supported in this implementation.
Trap in bash scripts
You may be familiar with the “set -e” you typically see in bash scripts. It means that the script should exit on error (default behaviour of bash is to keep going) Recently I needed a script to do some cleanup action. i.e. I wanted the script to exit on error, but I also wanted some cleanup action to be performed. A use case might be that if something fails, then before exiting, ship log files to an S3 bucket for troubleshooting.
Adding multiple certs to an ALB
If you are using AWS and ALBs, you have the ability to add multiple certs to the ALB and terminate SSL there. While it is easy to do via the AWS console, their documentation is not that clear as to how to do it in an automated way. The following is the code snippet, written with troposphere, to show you how to do it. First create a HTTS listener with a certificate: def create_lb_listener_https(alb, default_target_group, param_cert_one): return Listener(‘LoadBalancerListenerHTTPS’, Port='443’,Protocol='HTTPS’, LoadBalancerArn=Ref(alb), DefaultActions=[Action(Type='forward’,TargetGroupArn=Ref(default_target_group))],# Note, only one cert ARN can be specified here, else you will get an errorCertificates=[Certificate(CertificateArn=Ref(param_cert_one)),])
Docker image tagging in ECR
AWS provides a docker repository called ECR. This is similar to Docker Hub, Artifactory etc and provides a convenient place to place docker images for later use e.g. deployment. ECR supports Docker Image Manifest V2, Schema 2, providing the ability to add multiple tags per image. I recently ran into an issue wherein I tagged an image with multiple tags at build time and then just pushed one tag, thinking all tags would appear on ECR.