Skip to content

Instantly share code, notes, and snippets.

View Marcus10110's full-sized avatar

Mark Marcus10110

View GitHub Profile
@Marcus10110
Marcus10110 / ts_init.sh
Last active November 13, 2021 23:41
Quick setup for a Nodejs TS project
npm init -y
yarn add --dev typescript ts-node nodemon @types/node
npx tsc --init --outDir Dist
touch index.ts
npx npm-add-script -k dev -v "nodemon index.ts"
npx npm-add-script -k start -v "ts-node index.ts"
mkdir .vscode
echo '{ "editor.formatOnSave": true }' > .vscode\settings.json
@autosquid
autosquid / ThreadPool
Created October 21, 2014 06:11
ThreadPool with boost thread and asio
namespace bamthread
{
typedef std::unique_ptr<boost::asio::io_service::work> asio_worker;
// the actual thread pool
struct ThreadPool {
ThreadPool(size_t threads) :service(), working(new asio_worker::element_type(service)) {
for ( std::size_t i = 0; i < threads; ++i ) {
auto worker = boost::bind(&boost::asio::io_service::run, &(this->service));
g.add_thread(new boost::thread(worker));
}