On a cursory look at the linked code, you just need to replace the omni callbacks with one for your joystick. That is, rather than the two subscribers and their callbacks for the omni, you can use just one of each for the joystick.
Then you need to change the transforms from handling the omni's output (a pose in its own frame) to the joystick output (which I assume you want to be a relative change in the marker's frame). Whereas the code you referenced simply copies a modified transform of the omni pose into an 'InteractionCursorUpdate' message, you'd want to modify the current marker pose according to your received joystick message. You can just get rid of any 'stylus' frames, as you'll (likely) just be working in the marker's frame.
I'm not sure how you're planning on mapping the inputs, but for instance, keeping 'p' as the update.pose, pushing forward on the joystick might result in a 'p.position.x += joy.axes[0]' line of code. Or, maybe you want pushing forward to pitch, so you'd have to modify the quaternion instead.
Disclaimer: I'm not familiar with the omni (working with a sixaxis) nor do I work in python (C++).