I'll split the answer in two, one for blinded and one for deafened. Note that these are DM adjudication, except for when I'm quoting Crawford or PHB.
Yes. Simply closing your eyes is enough to blind yourself. Crawford agrees.
With your eyes closed, you're blinded. No effect on movement. See "Unseen Attackers and Targets" (PH, 194). #DnD
Closing your eyes is a "free" action (it does have a cost though, thus "free"). You remain with your eyes closed until you open them again. You can open them in your next turn, or possibly by using your Reaction to Ready the "I open my eyes when I hear X thing" action and spending your reaction to do so. Putting or removing the blindfold has the same effect and spends the same resources.
This one is a bit harder. First because, unlike closing your eyes, which is directly useful e.g. for the Medusa fight, being deaf has less direct applications I know of, thus AFAIK no Crawford or rulebook statement about self-inflicting the condition.
Second because simply covering your ears is fairly different from the actual condition
A deafened creature can’t hear and automatically fails any ability check that requires hearing.
It doesn't say "can't hear clearly". It says can't hear. Covering your ears is not enough to not being able to hear any more. Note that our adventurers have senses a lot better than ours (i.e. their Passive Perception is usually way higher than 10), so if you can hear while covering your ears, your Elf Ranger certainly can as well.
Putting some sound-blocking object inside your ear might be enough, but that is up to the DM. The duration is also straight-forward here: it lasts as long as the object is inside the ear. It probably should take one free action (object interaction) to put it there and one to take it out.
Not that temporary
Disclaimer: Slightly gore for people that like to imagine what I'm describing. But the "pierce your eardrums" already agonized me enough, so I'm keeping that line.
Well, you can always take the knife out and cut your eyeballs out or pierce your ears. You can then revert it by casting Regenerate. Yeah, your Bard/cleric/druid isn't happy to waste his 7th level spell slot because you decided to cut your eyes, but it works.
Again: the duration is until you fix it.