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 and direct
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 'https://', CURLOPT_
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 (AWS) cloud
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 compiler/architecture class so
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
code Mobile Application Justification Native App - Flutter * Exposes current and new API for users * Validation of capabilities * Sample implementation (if open sourced) * Consistent experience for implementators * Enforces separation of responsibilities Benefits * Users get native application performance * Notifications are now prioritized * Background * Immediate Application * Grants API capabilities dictating form and consistency is kept * Native
code MySql - Delete all with foreign keys You want to delete a record in a MySql database but it has foreign keys and gives you the error code 1217 Generate all the applicable delete statements with the following query. Example I would like to delete the last record from the TheTable Statement SELECT Id From TheTable Order
code Stages of Rust Learning Rust stages * This is cool 🆒 * I am protected from mistakes 👑 * Why can't I do this borrow checker? 🤔 * Now there is a chain of fixes I must make 🧾 * Help please 😭 * Go back to Python and JavaScript 😸
code Disagree and commit Cult terms Have people used this term in your work lately? Disagree and commit It's a cult phrase and it is actively making me mad because this is what it means to me. * Disagree and submit (to what others say) * Disagree and ignore (the fuckup that is coming because ignoring
code Fetch using Cross Site Request Forgery (CSRF) Need to post a request to service side method using fetch and CSRF. First tried the option of using credentials as this is secured and token authenticated. That didn't work so I need to use the MVC expected token authenticator header in this case of the Cross Site Request AntiForgery
code Mobile hacks: CSS, JavaScript Request is to center a div content within a widget (embedded html+javascript+css) into a large website. From this to this on mobile devices JavaScript The JavaScript injected code would need to be placed in a block. Suggested the JavaScript injection as CSS can be tricky when multiple styles
code Terminal Setup Windows Install * oh-my-posh * posh-git * Windows Terminal Powershell Set the profile.ps1 notepad $PROFILE Import-Module PSReadLine Import-Module -Name Terminal-Icons Set-PoshPrompt -Theme paradox Set-PSReadLineOption -PredictionSource History Set-PSReadLineOption -PredictionViewStyle ListView Set-PSReadLineOption -EditMode Windows Setting themes, fonts and icons in Windows TerminalI’ve been using Windows Terminal more and more over the past couple
code Google maps replace markers Sometimes you don't have the control or the ability to make direct changes to the served content of a webpage and especially a google maps. Google maps expects you to keep track of your markers as you place them on your map div, but if you are modifying a map
code Nginx Upgrade Gotchas Looking at my server configuration and saw that my Nginx version was 1.18.x which was release approximately April 2020 and that corresponds to probably when I was last editing my nginx reverse proxy start of Covid 19 restrictions etc. Time to upgrade to latest and greatest, what could