-
Quick Search Results using Raycast and DDGR
This is more or less a proof of concept. I wanted a fast way to look up facts without navigating away from what I’m working on.
Using Raycast is a natural place to start given you can pull it up and make it go away with ease. I looked for extensions in the Raycast Store (they’re free, despite the name) that might help but nothing seemed to do what I wanted. The Wikipedia extension does a great job of pulling information but it’s not as useful if I want a quick fact like “zip code for Portland Maine”.
Next I began looking for command line tools that return web search results. Googler came up as a top choice but the project has been archived. ddgr was the next one I came across; it works beautifully to return DuckDuckGo search results as JSON. I installed it with homebrew ( brew install ddgr ).
Finally, I whipped up a quick Raycast script command that would accept an argument, use ddgr to get the top search results, then spit them out in the Raycast output window. Raycast scrolls to the bottom of the output automatically, so I reversed the order of the top 10 results so that the most relevant appears at the bottom. That’s it!
There isn’t any graceful error handling, automated test coverage, etc. Use it at your own risk. 😉
12345678910111213141516171819202122232425262728#!/usr/bin/env python3# Required parameters:# @raycast.schemaVersion 1# @raycast.title DDGR Search# @raycast.mode fullOutput# Optional parameters:# @raycast.icon 🔍# @raycast.argument1 { "type": "text", "placeholder": "search query", "percentEncoded": false }# Documentation:# @raycast.description Search using the ddgr command line tool# @raycast.author Adam Courtemancheimport jsonimport subprocessimport sysquery = sys.argv[1]output = subprocess.check_output(["ddgr", "--json", query])data = json.loads(output)# Reverse the results so the most relevant are at the bottom# because Raycast will scroll you to the bottom of the outputdata.reverse()for result in data:print(f"{result['abstract']} {result['url']}")print("") -
Python Faker with the Fake App (Mac OS)
Fake App is a fantastic way to automate form filling, especially for folks without coding skills. The click-and-drag to target an element lets you quickly build your macros.
Python Faker is a utility library that I leverage with tools like Fake App, Alfred, Keyboard Maestro, etc. to generate realistic dummy text. This blog post shows one method of how to get Python Faker data into Fake App; I imagine there might be a simpler way but this works well and is fairly intuitive.
The idea is to just write the Faker output to a file and read that file into a variable for use in Faker. With this method you could even store variables for re-use. For example, if you had three fields: First Name, Last Name, and Full Name, you could easily store the first and last names to separate files and use both values for the Full Name field. With the power of Faker your dummy text options are extensive; you can generate very realistic values for your form filling. See all of the “providers” here.
This example below took just minutes to setup (and it was the first time I’ve used this technique).
-
Paramiko error: Use module Crypto.Signature.pkcs1_15 instead
Recently I started getting the following error in a script that never had any problems in the past:
1NotImplementedError: Use module Crypto.Signature.pkcs1_15 insteadThere wasn’t much information related to this error in regards to Paramiko.
Eventually I was able to “fix” it by running:
123sudo -H pip uninstall paramikosudo -H pip uninstall pycryptosudo -H pip install paramiko