Here’s how to select a paper at random from Zotero.
In Zotero, select the folder you want to select the paper from.
Paste in the following code
var ZoteroPane = Zotero.getActiveZoteroPane();
var currentCollection = ZoteroPane.getSelectedCollection();
var items = currentCollection.getChildItems();
var i = Math.floor(Math.random() * items.length);
var item = items[i]
I was looking at the stack trace of a stack overflow exception, and it’s looong (1172 lines). I wanted to just see which lines occurred most often. Easy enough with the right incantation of sort and uniq.
If you try to run Eclipse Memory Analyzer (MAT) out of the box on macOS, you’ll likely get an error that you need version 11 or above of Java, even if you have version 11 installed (say, with SDKMAN!).
You need to tell Eclipse MAT where to find this version of Java. Don’t edit the info.plist file, because then you’ll get an invalid code signature error.
Instead, you want to edit the /Applications/mat.app/Contents/Eclipse/MemoryAnalyzer.ini file. I added the following two lines to the top of my file:
If you’re running a newer version of the JDK (9 or greater), you might have started to see warnings that look like this:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/Users/myname/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy/2.5.11/4d8f25c5da08af46fb204fd493ec894699a3f4e8/groovy-2.5.11.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
JDK9+ produces warnings with many libraries including Groovy due to some planned future restrictions in the JDK. Work is underway to re-engineer parts of Groovy to reduce/remove those warnings. Users wanting to hush the warnings as an interim measure may consider using the --add-opens escape clause offered by JDK9+. See commit 92bd96f (currently reverted) on the Groovy master branch for a potential list to add.
Groovy commit 92bd96f has the flags you can pass to the JVM to suppress the warnings, which I’ve reproduced below:
I often find myself copying strings of Java stack traces which have escaped tabs and newlines (\t\n). Those aren’t fun to read. Here’s a quick Python script I rigged up to grab what’s on the clipboard and format it properly. I call it unescape:
Grab the string on the clipboard and print it to standard out,
interpreting tabs and newlines appropriately
r = subprocess.run(["/usr/bin/pbpaste"], capture_output=True, encoding="unicode_escape")
tell script "Slack"
focus workspace "Netflix"
set status "online" with icon ":wfh-up:"
I couldn’t get Alfred to invoke this Applescript directly (I imagine it has something to do with Security settings in Catalina), so I saved it to a file (up.scpt), and then invoked it in a workflow as a bash script, where the command was:
When somebody rebases their PR, my local copy of that branch gets out of sync:
➜ keel git:(fix-paused-events) git status
On branch fix-paused-events
Your branch and 'luispollo/fix-paused-events' have diverged,
and have 8 and 16 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
I just want my local copy to reflect the remote one.
I created a “stomp” alias that resets my local branch with the upstream: