code Language phenotypes: Python, C# Doing a bucketing exercise on coderpad.io [https://coderpad.io/] which supports 30+ languages, but in actuality a language is only as good as its tools and libraries and in that respect coderpad.io is sorely lacking on many of the languages it supports. In truth coderpad.io is built
code Advent of Code Currently expanding my python [https://www.python.org/] knowledge by doing Advent of Code [https://adventofcode.com/] 2021 [https://adventofcode.com/2021]. This forces me to look up a lot of python libraries and syntax, but I feel like I am really getting a pythonic mindset now. Learning a lot
code Run As User In Linux/macOS you use the su [https://linuxize.com/post/su-command-in-linux/] command Windows does not have this and the closest thing it has is runas [https://ss64.com/nt/runas.html] with /user option. It will then prompt you for the password of this particular user. Key point here
code AWS Textract PDF to CSV PDFs are great for presenting information, but due to their structure and formatting getting structured data out of them is difficult and tedious and they could be considered unstructured data in my opinion. Say you have a PDF document like this, which is really a long table with a lot
code Code difference Code review doesn't do what I hear people tell me it does in every organization I have worked for For example * Makes code readable * Shares knowledge * Standardizes approach What it does do in my opinion (read earlier thoughts I had on this here code review [https://siliconheaven.info/
code Jinja2 Templating Experimenting with python templating of jinja2 [https://jinja.palletsprojects.com/en/3.0.x/] and finding it quite a bit nicer than the razor [https://docs.microsoft.com/en-us/aspnet/core/mvc/views/razor?view=aspnetcore-5.0] syntax in ASP.NET for one big reason to me that extracting the
code Octopus Deploy and Powershell Needed to deploy a pretty cool dynamic proxy called traefik [https://github.com/traefik/traefik], which is built on golang [https://golang.org/] and can be deployed as a single binary and along with some simply configs can take a lot of difficulties of say an nginx reverse proxy [https:
code Capture URL Screenshot Chrome+Windows Capturing a screenshot in Linux/macOS is documented and can be done in a single command as detailed here [https://siliconheaven.info/capture-url-screenshot-chrome-ubuntu] Doing this in Windows is a lot less clear and more painful, but you can do it like so I am not running with administrator rights so
code Capture URL Screenshot Chrome+Ubuntu Capturing a screenshot documentation Setup 1. Add google chrome package location: wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb 2. Install: sudo apt install ./google-chrome-stable_current_amd64.deb Capture 1. Capture the url contents of siliconheaven.info [https://siliconheaven.info/] google-chrome --headless --hide-scrollbars --window-size=1920,2000 --screenshot=
code Python Tesseract: Read Text from Image Reading text from images using the Tesseract Code import cv2 import pytesseract if __name__ == '__main__': # setup the path for the tesseract tool pytesseract.pytesseract.tesseract_cmd = r"C:\Tesseract-OCR\tesseract.exe" #load the image img = cv2.imread("code.png") #convert to grayscale gray = cv2.
code Explaining Software: Interview Questions - Pretend I'm not a tech person. Can you explain REST in simple terms? Everyone can be a tech person and I hope that my explanation covers the concept and intentions behind REST (REpresentational State Transfer). Executive Summary: REST is an informal software specification/guideline/principle to creating
code Async Python Asynchronous Python is a pleasant experience to work with. Nothing unexpected or weird about using the await/async keywords and how they work. Basic example of an asynchronous function async def this_takes_awhile(wait_time_seconds=1): await asyncio.sleep(wait_time_seconds) That's all it takes
code Parallelizing Lookups with Common Table Expressions Individual lookups against a rules system stored in a database can add up to a lot of computations and depending on the size of your ruleset cause delays. There are ways around this with caching [https://aws.amazon.com/caching/], in memory hashmaps [https://en.wikipedia.org/wiki/Hash_table]
code JavaScript: Function as arguments Wanted to create a chain of method call backs with some simple JavaScript [https://developer.mozilla.org/en-US/docs/Web/JavaScript] as in startMethod -> calls function on success and another function on failure and it had been awhile since I did this refreshed my memory on Promises and
code SQL Server: Making JSON relational Working on a task to create a relational ordered set of prompts from rules with dynamic model binding. This is one way to do it with JSON and SQL. In this case the prompts may change, but it is a rare event. The goal is to make the SQL server
code Ghost+MySql: Together built for sadness Again I am fighting with a MySql [https://mysqlserverteam.com/new-defaults-in-mysql-8-0/#:~:text=The%20default%20value%20of%20the,vast%20majority%20of%20MySQL%20users.] collations and character sets. Why would this be a problem when I have set the default collation and changed all the tables to character set utf8mb4 and collation
personal Covid 19 Vaccine distribution failure The USA government was gifted with powerful and effective vaccines against COVID19 in late 2020/early 2021. Supply was unable to keep up with demand for vaccination for the first couple of months, but now we have plateaued at a low vaccine rate per population something like low to mid
code Get column metadata Putting this here to remember how to query out the metadata of a view, using the AdventureWorks2017 [https://docs.microsoft.com/en-us/sql/samples/adventureworks-install-configure?view=sql-server-ver15&tabs=ssms] database view vAdditionalContactInfo for reference. use [AdventureWorks2017] SELECT [c].[column_id], [c].[name] AS [ColumnName] FROM [sys].[columns] [c] INNER
code Alter stored procedure across databases Needed to alter a particular stored procedure over a few thousand databases. Here is an example script that uses a cursor and dynamic sql to do this. Key point here is to have the USE statement switch the database prior to issuing the CREATE OR ALTER command so that each
code Handling implicit varchar conversions Got some quirky unexpected behavior when loading data from text files and SQL [https://en.wikipedia.org/wiki/SQL] statements when working with extended ASCII [https://theasciicode.com.ar/] characters and Unicode. These files in particular are UTF8 [https://www.utf8.com/] encoded as is standard when doing text editing
code Undo last git commit In the commit early and often strategy means checking in and commit code all the time like saving a file and sometimes when you do this you accidentally check in something that you shouldn't have and even push it up to the remote server(s) Do this to
code User Defined Function with Recursive Common Table Expression User defined functions suffer from inability to be query plan optimized, but this is a nice function I wrote to find ASCII control characters CREATE FUNCTION [dbo].[ContainsControlCharacters] ( @textToCheck NVARCHAR(MAX) ) RETURNS BIT AS BEGIN DECLARE @invalidCharCount INT; -- Sadness that it came to this -- Splits the input text
code Find invalid characters in SQL strings Sometimes due to circumstances beyond your control you get garbage in your database. Optimally you would filter this data out from getting to and residing in your data storage, but decisions are made and things are built to allow for partial mistaken data rather than complete perfect data. Today I