It’s not uncommon to expect CIDR notation vs an IP address in a script (e.g. one that’s being passed to another API. So the following script is an example of using the re module to identify if an entry is in CIDR or not (since it’s not always obvious how to go about doing so): The array can easily be changed or filled with a network mask or array of them rather than fixed as they are here – and the output could easily be to call another function rather than to just print output.
-
-
Detecting LLM-Generated Code
Large language models (LLMs) are a type of artificial intelligence that generates text, translates languages, writes different kinds of creative content, creates net-new artistic works, and answers questions in an informative way. They are trained on massive datasets of text and code, and can learn to produce human-quality output. Because of how they import massive troves of data and create similar content, they can then be fairly formulaic in their output. A few things to look for to help determine if code was written by an LLM: If you are suspicious that a piece of code was written by an LLM, you can use a number of tools to help…
-
Scripts To Show Browser Extensions In Windows
Posted scripts to return browser extensions installed in Firefox, Google Chrome, and Windows Edge at https://github.com/krypted/extensionsmanager/tree/main/Windows%20Extensions. There’s a python and a VBscript version of each. The VBScript uses a Set objShell = CreateObject(“WScript.Shell”) statement to create a new instance of the WScript.Shell object and the strExtensionsPath = objShell.ExpandEnvironmentStrings(“%APPDATA%\Mozilla\Firefox\Profiles\%USERNAME%\extensions”) statement gets the path to the extensions directory, so if it’s different for a given environment, make sure to change that per-script. The Set colExtensions = objShell.EnumFiles(strExtensionsPath, “*.xpi”) statement gets a collection of all the extensions in the extensions directory. The Chrome version looks for crx, etc. Might be a way to do these with custom extension types that I’m not aware…
-
Google Cloud Function To Validate Email Addresses
The following is a simple Google Cloud Function that will validate that text entered into a field (passed to the function in the request body when called) is a valid format of an email address. The email address might not be real, but at least we aren’t accepting a string that’s incorrectly formatted: This function will validate the email address that is passed in the request body. If the email address is valid, the function will return a success response (200). If the email address is not valid, the function will return an error response (400).
-
Google Cloud Function To Add JSON To A Cloud SQL Database
Here’s a Google Cloud Function that takes some arbitrary json (in json_data) and posts it to a new record in a Cloud SQL database. No error handling or deduplication/matching, just a straight post: https://github.com/krypted/tinyconverters/blob/548892cc377e1063770ab4a8cd53dc6573bae950/json_to_cloud_SQL.py Before using, it needs information to connect to the database, so customize the INSTANCE_NAME, DATABASE_NAME, and TABLE_NAME for the INSERT. For more on Cloud SQL, see https://cloud.google.com/sql/docs.
-
Google Cloud Function To Convert Property Lists To JSON Documents
I’ve written a lot of little scripts to convert files or types from one format to another, over the years. It’s easier to import something that can do the work for you and just use a Lambda or a Google Cloud Function that you call from other tools. This is the microservice way. So here’s a little python Google Cloud Function that converts a property list to a JSON document: To use the function, first create a Google Cloud Function that uses the property_list_to_json() function from the Google Cloud Console or the gcloud CLI. Once you have the URL, simply call it with a POST to the function’s URL. The…
-
Google Cloud Function To Encrypt A JSON Document With An ECC Key
To use this function, create a Google Cloud Function that uses the encrypt_json() function in Google Cloud Console or the gcloud command-line tool. Once created the function, invoke it by sending a POST request to the function’s URL. The request body should contain the JSON document to encrypt. The response body will contain the encrypted JSON document. For example, to encrypt the JSON document my_data.json, you would use the following command: The response body will contain the encrypted JSON document. This function uses the Google Cloud KMS service to encrypt the JSON document. So make sure there’s a KMS key enabled in a project before using the function.
-
Tiny hex and binary converters in swift, go, python, && javascript
Have a few scripts that I’ve been bringing into projects for awhile (and altering for each so ymmv on the state, but you’ll get the general idea). https://github.com/krypted/tinyconverters As the names and file extensions imply, these simply take ascii as an input and output as binary or hex, or take the binary or hex and output as ascii.
-
Hibernate to GraphQL Mapping Script
Worked on this little script to extract the mappings from a Hibernate XML file and create the quick and dirty graphql types.
-
Lightweight Audio Transcription Script
Quick and dirty audio file transcription script that should be easy to use as a droplet or for desktop transcribing automations at https://github.com/krypted/lightweighttranscription. To use it: Install awsCLI and boto3: pip install boto3 –user (or pip3 install boto3 –user) Mac client available at: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-mac.html Run the $ aws configure setup Set access key, secret key, region and output format Instead of passing the credentials in the script, it is recommanded to install awscli and setup credential profile. If running as a microservice, simply hit the endpoint in the script instead. If running on a computer, keep the Input file and script in the same dir to avoid search path failures. Run script `python3 …