code GitHub automatically create + publish Docker workflow guide If you have a working Dockerfile defined in your GitHub repository means that you can automatically create and publish your Docker image for others to use and view from the repo. At first I used DockerHub from Docker, but do to changes in their policies there are now size restrictions
code Playwright Scraping a Website Previously I documented using Puppeteer to scrape a website, but this doesn't work well with Pipedream (it times out unexpectedly because of Pipedream limitations) Therefore a better solution I have come up with is to create a FastAPI Dockerified version using Playwright instead to do the same thing.
code MySql Recursive Common Table Expressions (CTE) Working with a thorny denormalized table that contains id references to itself in a Parent column that indicates a tree hierarchical structure and had to bring out the recursvie Common Table Expressions (CTE) Simplified table example create table TaskLookup ( Id int unsigned auto_increment primary key, ParentId int unsigned, Body
Puppeteer and Pipedream Need to grab a secured iFrame JSON response that is limited to single origin Cross-Origin Resource Sharing CORS Pipedream has a free level of access that combined with their own puppeteer module allows me to open a secured webpage with a headless browser and then intercept and respond back with
code The 5 Stages of Software Development * Shock and Denial ⛔ I don't believe this will work, We won't build this ⛔ * Anger 😡 Why is everything broken! 😡 * Bargaining 🙏 I can make this work somehow if I keep trying 🙏 * Depression 😭I can't make this work no matter what I try 😭 * Acceptance 😔 This is my
code JavaScript async/await warnings TLDR; NEVER EVER EVER USE map, filter, reduce with async/await Frustrated over why a segment of code was not working which looked like this Example const results = inputs.map(async z => { return { id: getId(z), result: await sendId(z) } }); The structure and formatting is correct and you would
code NPM node validate expected version Use package.json and add the lines { ... "scripts": { "start": "node index.js", "test": "lab tests/api.tests.js", "preinstall": "node checkNodeVersion" }, "engines": { "node": ">=20", "npm": "^10&
code Webhook debugging with ngrok There are several tools to reroute external webhook urls to local dev. Ngrok is one of the easier options and works with multiple host header files locally with some commands. There are alternatives like localtunnel * Sign up for a free ngrok account * Download the mechanism you wish to run ngrok
code Recursive CTE (Sqlite) for generate_series substitute In large modern databases you usually have a function available called generate_series that is useful for creating an inline series numbers, dates, etc Example SELECT * FROM generate_series(2,4); Produces the results of generate_series ----------------- 2 3 4 You can also combine this with dates and date
code Command line zip and submit to an API Expanding on automating sending data and getting results from the FastAPI I wrote here, that is deployed here. Tied some command line processing tools together to build out a nice script automation one liner (a long line, but still works) to achieve the goal of zip up a set of
code Deploy FastAPI to DigitalOcean App Platform Previously I developed a python FastAPI tool that I developed locally to ingest Google ARI XML messages and produce a price quote here. Now I want to publish this to get a deployed instance for public use Using Digital Ocean to turn the above FastAPI into a deployed instance Create
code FastAPI with PyDapper and Sqlite Google operates a free listing service for Hotels and Vacation Rentals to integrate with their maps and search engine. In theory the idea is that you supply Google with information about your listing and it will be verified and placed into their system at no cost to you. It is
code Filtering and find with jq Debugging a JavaScript Object Notation (JSON) response and wanted to filter and find a specific case and then convert the matches into a Comma Separated Values (CSV) response for others to work with in a spreadsheet. Need to quickly push this out with little or no work and well that
code HTTP Status Codes Reference Quick reference HTTP status code summarized groups * 1XX - Information * 2XX - Happiness * 3XX - Multiple choice * 4XX - My fault * 5XX - Your fault
code iTerm set Back/Forward word keys Not sure, but iTerm was not recognizing my backward/forward word keys which is annoying. The key combinations I am talking about are ALT - b for backwards one word on terminal and ALT -f for forwards one word on terminal. This seems odd as regular terminal works off of
code Dynamically insert iFrame I needed to insert an iFrame that operates off of the query string parameters like so /someplaceid12345/andthis?alsothis=93293 In the above situation I want to extract the someplaceid12345 and match it to another location to create a dynamic url source for the embedded iFrame First extract the id
code DOM node removed Needed to listen for the removal of a node from the Document Object Model (DOM). In this case a dynamic modal popup div that after closing should clear the cache. window.addEventListener("DOMNodeRemoved", e => { console.log(`${e.target} removed`); }); Hook the window event listener to handle the
code Find your IP Address Script Needed to find the outgoing true IP address for computer to provide for whitelisting to another proxy. Here I am using a third party website to get an IP result icanhazip.com Ideally I would create a client side call that is handled by the server and then queries the
code Enhancing the console.log Messing around with the console.log and in particular the %c stylized log and tried some experiments and you can enhance the log to render out images etc and in this case I am making a canvas element to hold text and styling it so that the log And here
code Detect PNG image header in data stream Byte check header for the PNG header in a data stream public static bool HasPngImageHeader(byte[] imageContents) { byte[] imageHeader = { 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A }; return imageContents.Take(8).SequenceEqual(imageHeader); }
Hapijs + MapBox + Glitch Example Built out a MapBox test page for use and decided to use glitch.com because it is easy to get something live to test with and then embed and here is the code. Had to get back into the nodejs frameset and working with hapijs after a few years rust,
code Hapijs + Glitch Example Built out a Open API test page for use and decided to use glitch.com because it is easy to get something live to test with and then embed and here is the code. Had to get back into the nodejs frameset and working with hapijs after a few years
code Fixing Elementor Popups with JavaScript Elementor is a free WordPress plugin that enhances your website to allow graphical drag and drop editing of websites and it's free. It is full of nice and helpful snippets with an especially powerful one being the ability add in Popups. This can give your website focus areas
code JavaScript Onetime Script with Delay Needed to have some JavaScript to do a onetime execution process after content is in the Document Object Model (DOM) and created. Hook into the load event https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event Add an event listener to the window that is looking for the
code Chat GPT - ...Thoughts... I have some quick thoughts that about chat bots built on large language models. TLDR; They produce words in a reasonable pattern matched process, they do not understand or form any value or levels of truth to it and that is the stumbling block that is hitting people now and