Source code for the Rick and Morty portal gun at https://www.thingiverse.com/thing:981091, modified to work with the 7-segment display listed, and using a pullup for the button, making it Arduino-compatible.
The source code is in the public domain according to the original author, Mike Moss. (https://www.thingiverse.com/doomsdaywombats/about) All modifications by me, yorickthreski, are similarly released into the public domain.