Node.js – Find home directory in platform agnostic way

As mentioned in a more recent answer, the preferred way is now simply: const homedir = require(‘os’).homedir(); [Original Answer] Why not use the USERPROFILE environment variable on win32? function getUserHome() { return process.env[(process.platform == ‘win32’) ? ‘USERPROFILE’ : ‘HOME’]; }

Platform independent size_t Format specifiers in c?

Yes: use the z length modifier: size_t size = sizeof(char); printf(“the size is %zu\n”, size); // decimal size_t (“u” for unsigned) printf(“the size is %zx\n”, size); // hex size_t The other length modifiers that are available are hh (for char), h (for short), l (for long), ll (for long long), j (for intmax_t), t (for … Read more

Where is Boost.Process?

Boost.Process was accepted for inclusion into Boost on November 9, 2016; and has been included in the 1.64 released on April 19, 2017. Boost.Process is now an official Boost library! It’s documentation is available here: http://www.boost.org/doc/libs/1_64_0/doc/html/process.html For the record, the sources that were reviewed from October 27, 2016 through November 5, 2016 are available on … Read more

Play a Sound with Python [duplicate]

For Windows, you can use winsound. It’s built in import winsound winsound.PlaySound(‘sound.wav’, winsound.SND_FILENAME) You should be able to use ossaudiodev for linux: from wave import open as waveOpen from ossaudiodev import open as ossOpen s = waveOpen(‘tada.wav’,’rb’) (nc,sw,fr,nf,comptype, compname) = s.getparams( ) dsp = ossOpen(‘/dev/dsp’,’w’) try: from ossaudiodev import AFMT_S16_NE except ImportError: from sys import … Read more