Sometimes we want to test a function to see how… robust it is. This is a small example fuzzing function to input randomly generated characters that get passed to another function. It just uses randomBytes so much more logic could easily be added to constrain what’s being passed to whatever type it’s being passed to… but this satisfies my need. import Foundation func fuzz(function: () -> Void) { // Generate a random input to pass to the function we are fuzzing let input = Data(randomBytes: 1024) // Call the fuzzed function with the random input do { try function() } catch { print(error) } // Check the fuzzed function to…
-
-
File Lists And Version History With The Dropbox API
TLDR: See https://github.com/krypted/DropboxScripts for some python scripts for the Dropbox API I recently needed to get a list of changes to all files on Dropbox. To get there, I first found the list_folder endpoint, so here’s a script to dump a list of files https://github.com/krypted/DropboxScripts/blob/main/ListDropboxFiles.py However, then I realized I needed to look up the version history for files, so here’s a script to dump version history: https://github.com/krypted/DropboxScripts/blob/main/ListHistory.py Then to tie the two together, this script lists version changes for each dumped file recursively: https://github.com/krypted/DropboxScripts/blob/main/ListChangesPerFile.py Then I realized that the user was listed with a GUID rather than the actual user. I just need a paper trail and have few…
-
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.
-
Small Go Script To Send Some JSON To An Endpoint
The following was written to act as a Google Cloud Function or Lambda, and sends a simple POST to a standard rest endpoint at https://krypted.com/api/v1/sites with the json defined in jsonObject. The endpoint can easily be changed in http.NewRequest or converted to a variable. The response to the POST is then returned as stdout. package main import ( "fmt" "net/http" "encoding/json" ) func main() { // Create a new HTTP client. client := &http.Client{} // Create a new JSON object. jsonObject := map[string]string{ "name": "Krypted", "site": "www.krypted.com", } // Marshal the JSON object to a string. jsonString, err := json.Marshal(jsonObject) if err != nil { fmt.Println(err) return } // Create…
-
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.
-
Creating Unit Tests With Google Bard
Unit tests are one of those things that evolve over time. When we talk about test coverage, anyone that thinks they have full coverage is kidding themselves, but it’s not uncommon for my workflows to just build some stuff and go back and fill in the unit tests before I bring in a second person. And yet… we know we need to do them. Sometimes I’ve gotten help with this specific part of projects from sites like Upwork. There’s been a lot of talk about AI eating the world, so I thought I’d see how much of this kind of thing AI could get us for free. Let’s start with…
-
The History of Adobe; On Pueblos, Fonts, Graphics, && Marketing Clouds
-
The Evolution of Fonts
-
The Computerization of Flight: From Autopilot to Drones
-
Make The Keychain Work When Compiling Your Own NoMAD
Yesterday, I wrote up how to compile your own version of an open source Xcode app and used NoMAD as an example, for those who didn’t want to use the precompiled application bundle. Many software packages have permissions to do do various tasks. NoMAD interacts with the keychain, so will have to use a TeamID, or to expand the term, the Team Identifier Prefix. This means the new version won’t be able to access keychain items created by previous versions of NoMAD, which use the creators prefix (I didn’t reference Joel as “the Creator” – but “a creator” to be clear). Ergo, this article is really just for helping those…