Posts

Showing posts from January, 2024

How to use aws-lambda-python docker image with example in VSCode for local development

Image
Docker image: https://hub.docker.com/r/amazon/aws-lambda-python This docker image lacks working example on how to use. If you just want to test your lambda with this image locally, please read on. Let's assume the following: Your script is called `my_python.py` The function in this file that you want to execute is called `lambda_handler` Here is the docker command (I'm using windows): docker run --rm \ -p 9000:8080 \ --mount type=bind,src=/c/projects/my_lovely_proj,target=/var/task \ amazon/aws-lambda-python \ my_python.lambda_handler Brief explanation on above: --rm : Remove the container after terminating the script (i.e. Ctrl + C in command line).  So you don't need to run `docker stop <container_id>` and `docker rm <container_id>` -p 9000:8080: map the port of local machine 9000 to container port 8080.  This is super important and will be explained later. --mount: Mount the dir to /var/task in container.  All lambda script will be executed in this /var/task

Add WordPress Admin User via Database 2024 (and onwards)

If you are trying to add a user (probably admin), not using UI but via database directly.  Here is what you did. Refer to the following article to add a user to DB https://hk.godaddy.com/en/help/create-an-admin-user-in-the-wordpress-database-27023 (Recommended) https://help.one.com/hc/en-us/articles/17467509114385-How-to-add-an-Admin-User-to-the-WordPress-database https://wpengine.com/support/add-admin-user-phpmyadmin/ They are all talking about same steps, so just pick one and follow.  In case if you don't understand first article, read the next one and so on. Remember, if you are updating existing DB to use new prefix, you need to manually (or via SQL) update all table name to use your prefix. For example, if original prefix is 'wp_', and you want to change it to "my_lovely_", you need to update all table names, like "wp_posts" > "my_lovely_posts". Here is the missing steps:  Thanks to my colleagues, you also need to update {prefix}_optio