Skip to content

Instantly share code, notes, and snippets.

View convict-git's full-sized avatar

Priyanshu Shrivastav convict-git

  • IIT Palakkad
View GitHub Profile
@convict-git
convict-git / concurrency-sync-cpp.md
Created August 8, 2021 13:31
Concurrency and Synchronization using Modern C++ - (Not so) Short Notes

Concurrency and Synchronization using Modern C++

Thread Management

Each running program has at least one thread which is occupied by its entry point. There can be many threads for a single program and the memory is shared among all threads. The objects possessed by the main thread (and shared by other threads as a reference to it) would be destroyed as soon as they go out of scope. This might lead to corrupt memory access by the rest of the threads.

Hence, sometimes, it's very important to make sure that all the threads are joined using std::thread::join() before the main thread terminates. Other times, you basically want a daemon thread running in background even after the termination of main thread and that can be achieved by calling std::thread::detach(), but it may or may not be possible to join a detachable thread.

Resource Acquisition Is Initialization (RAII) is a famous programming idiom in C++ (a misnomer actually) also (better) known and understood as **Scope-Bound Resource Managemen

@convict-git
convict-git / React-short-notes.md
Last active August 30, 2021 04:30
Revisit React from the Docs (Notes for Noobs)
@convict-git
convict-git / GraphQL-apollo-short-notes.md
Last active August 27, 2021 07:23
{GraphQL, Apollo GraphQL, Client Side} Notes for noobs

{GraphQL, Apollo GraphQL, Client Side} Notes for noobs

  • Client's cache policies API can be used to connect a object between two queries so we don't have to fetch information that we know is already available. Link(see the last part)

  • Apollo Client includes local state management features out of the box, that allow you to use your Apollo cache as the single source of truth for data in your application.

Table of Contents
@convict-git
convict-git / webpack.md
Created December 16, 2022 19:42
Webpack for noobs

‎‎​

@convict-git
convict-git / rebase.sh
Last active March 12, 2023 01:50
Rebase stacked branches easily
#!/bin/bash
set -euo pipefail
# Some constants
BASE_DIR="${HOME}/.rebase"
INDEX_LOG_FILE="index.log"
# Color codes
RED='\033[0;31m'