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…
-
-
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…
-
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…
-
swiftquiver.com
swiftquiver is a framework to embed wizards into apps. It’s fairly simple, localized, and really, really modular. The source is at https://github.com/krypted/swiftquiver and it’s all in swiftui. Easily add more steps to a wizard, remove those that aren’t needed, call other functions once added, etc. Hope it helps anyone out there doing the same type of stuff!
-
Powershelling Away At Bitlocker
The Enable-BitLocker cmdlet is available in Powershell to encrypt drives. The command is fairly straight forward once we figure out how to do a few things. In the following we’ll use -mountPoint to define that it’s the default C: drive that we’re encrypting, followed by -EncryptionMethod as an Aes128 or an Aes256 and then who can unlock, in this case, the CharlesEdge short name on the Krypted domain, then we’ll prompt (that can be removed) and define a -pin of 2345 to unlock the recovery key and finally drop the key off at a -RecoveryKeyPath. Seems like a lot but it’s not and there are ways to do a password…
-
Riddles in Assembly
global _start I just got this book ecx, odd_msg AND holy buckets it’s fun. len2 jmp outprog
-
On PASCAL
PASCAL was designed in 1969 by the Swiss computer scientist Niklaus Wirth and released in 1970. Wirth was a PhD student at Berkeley in the early 1960s, at the same time Ken Thompson, co-inventor of Unix and author of the Go programming language was in school there. It’s not uncommon for a language to kick around for a decade or more gathering steam. In 1983, PASCAL got legit and was standardized, in ISO 7185. The next year Wirth would win the 1984 Turing Award. Perhaps he listened to When Doves Cry when he heard. PASCAL is named after Blaise Pascal, the French Philosopher and Mathemetician. PASCAL was built to teach…
-
Create Jira Issues From The Command Line
You can use the command line to create Jira tickets. In the below one-liner, we’re going to bring in some standard json and create a ticket. We’ll use curl and use -u to define a username and password, then -X to define a POST and –data to define the contents of the post, wrapped in the single quotes below. Then -H defines the content type as json and a URL to your Jira rest endpoint, “Issues” in the below code: curl -D- -u krypted:MySuperSecretPassword -X POST --data '{"fields":{"project":{"key": “DOG”},”summary": “Make my feature better.”,”description": “Going to make everything better ever ever ever by doing things and by things I mean allll…
-
Updated My Apple Admin Conferences Page
I’ve been keeping a list of Apple Admin conferences for a few years now. I probably should have versioned it and kept each iteration, but… no need to pollute the interwebs with more outdated stuffs than I already have. So here’s the link for the latest version, updated with all the event dates announced thus far: https://krypted.com//community/macadmin-conferences/ Hope to see you at some!
-
Define docstrings in Python
Bryson mentioned Docstrings in the latest episode of the MacAdmins Podcast. But how do you use them? Documentation strings (or docstrings for short) are an easy way to document Python objects (classes, functions, methods, and modules in-line with your code. Docstrings are created using three double-quotes in the first statement of the definition and are meant to describe in a human readable way what the object does. Let’s look at an example for hello_krypted: def hello_krypted(): """This simply echos Hello Krypted. But there's so much potential to do more! """ Docstrings can then be accessed using the __doc__ attribute on objects (e.g. via print): >>> print hello_krypted.__doc__ This simply echos…