Un machin doesn't mean "a machine" (that's une machine). In fact, it doesn't mean anything specific at all. It's a filler word, used when you're speaking generally or when you can't think of the proper word for something. It's an informal alternative to une chose (a thing), roughly equivalent to "thingy" or "thingamajig," or when plural, "stuff":
C'est-à-dire... de la confiture et des machins comme ça.
That is to say... jam and stuff like that.
Caption 10, Sophie et Patrice - Le petit-déjeuner
Play Caption
D'abord, je mets un peu d'acétone
First, I apply a little bit of acetone
parce que souvent y a des étiquettes, des machins avec de la colle.
because often there are labels, stuff with glue.
Captions 58-59, Sophie et Patrice - Les lampes de Sophie
Play Caption
C'est quoi ce machin-là?
What is that thing?
Je savais que ça n'allait pas être le single, le machin...
I knew that it was not going to be the single, the whatever...
Caption 110, Watt’s In - Maître Gims : J'me Tire Interview Exclu
Play Caption
Un truc is another informal way of saying une chose. It's basically synonymous with un machin:
Mais y a un truc aussi qui se faisait avant,
But there was another thing that was done before,
c'est que la police, ils intervenaient au collège...
it's that the police went in to the middle school...
Captions 16-17, Banlieues françaises - jeunes et policiers, l'impossible réconciliation?
Play Caption
Et on va aller acheter des trucs.
And we're gonna buy some stuff.
Caption 59, Actus Quartier - Fête de quartier Python-Duvernois
Play Caption
But unlike un machin, un truc can also mean "a trick":
Tout ça, c'est des trucs pour nous faire travailler encore plus!
All these are tricks to make us work even more!
Caption 42, Il était une fois: Notre Terre - 25. Technologies
Play Caption
And there are a couple of idioms with truc that can't be replaced with machin:
Je n'aime pas faire la fête. Ce n'est pas mon truc.
I don't like partying. It's not my thing.
Chacun son truc!
To each his own!
Likewise, there's one idiom that only uses machin:
Et quand je dis un grand ancien,
And when I say a great elder,
ça veut pas dire un vieux machin, pas du tout.
that doesn't mean an old so-and-so, not at all.
Captions 55-57, Uderzo et Goscinny - 1968
Play Caption
Un vieux machin is a grumpy old man, an old fogey.
You can even use machin and truc as proper nouns when you don't know or can't remember someone's name. In this case they're capitalized:
Demande à Machin* de t'aider.
Demande à Truc de t'aider.
Ask what's-his-name to help you.
*As a proper noun, Machin becomes Machine in the feminine (Demande à Machine de t'aider/Ask what's-her-name to help you). Truc doesn't change.
There's also another expression you can use when you don't know someone's name: Monsieur Untel/Madame Unetelle:
Demande à Monsieur Untel/Madame Unetelle de t'aider.
Ask Mr./Ms. so-and-so to help you.
So when you don't know the name of something or someone, or you're just talking about "stuff" in general, machin and truc are the words to use.