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); }
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
code PHP cURL Request/Response JSON Debugging an integrators code that was written in PHP and came up with this test snippet. I'm using php cURL as it is the simplest to convert and compare with the command line interface of cURL <?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL
code Windows Features Open an administrator level PowerShell console Get-WindowsOptionalFeature -Online | where FeatureName -like 'IIS-*' | where State -eq "Enabled" Output FeatureName : IIS-WebServerRole State : Enabled FeatureName : IIS-WebServer State : Enabled FeatureName : IIS-CommonHttpFeatures State : Enabled FeatureName : IIS-HttpErrors State : Enabled FeatureName : IIS-ApplicationDevelopment State : Enabled FeatureName : IIS-Security State : Enabled FeatureName :
code Advent of Code - 2022 Can I complete Advent of Code 2022 in python this year? Last years entry and how far I got * 2022 - Python solutions I finished!! A little later than 25th, but I did catch Covid for the week of 18th - 25th.
code Windows Subsystem for Linux 2 I am running manticore search and redis within my Ubuntu 22 on top of Windows Subsystem for Linux 2 (WSL2) this allows me to connect my Windows development environment (Internet Information Services - IIS) to use linuxy development tools that don't change and match the Amazon Web Services
code Insert With Common Table Expression - MySql In the case you have a MySql table filled with default Lookup ids for each user in your system to a messsage id. In this case you are looking to fill in the many to many relationships of bridging table from a User table to the Message table. For simplicity
code And this is what the Devil does - JavaScript JavaScript our Lord and master and it's broken as fuck math because of the desire to treat all numbers as floating point. I know exactly why Brendan Eich did this. It's easier to build a single number type at the instruction level because I took a
code Improving Software: Automated Testing Building testing after the code is written and deployed is hard and expensive, so why? Feedback This is the goal of all testing to get direct results from inputs and does it match the expected outputs Reduce Change risk and remove problems Improve Understanding of internal code structure Team Effort