Skip to content

Instantly share code, notes, and snippets.

View DarkStar1997's full-sized avatar
🎯
Focusing

Rohan Mark Gomes DarkStar1997

🎯
Focusing
  • Institute of Engineering and Management
View GitHub Profile

Setup Windows

  1. Visual Studio 2022
    1. Select Desktop development with C++
  2. Ninja
    1. Install chocolatey
    2. From an admin shell run choco install ninja

Run the commands from developer prompt for VS 2022

Clone the repo

  1. git clone https://github.com/sayansil/Ecosystem -b realtime-plot
@DarkStar1997
DarkStar1997 / sfinae.cpp
Created August 17, 2022 22:29
Sample SFINAE examples
#include <iostream>
#include <type_traits>
struct tag1{};
struct tag2{};
enum class Tags {
type1,
type2,
};
@DarkStar1997
DarkStar1997 / progress_bar.cpp
Last active October 30, 2021 15:47
Progress bar with fmt
#include <fmt/core.h>
#include <fmt/color.h>
#include <chrono>
#include <thread>
void update_bar(int percent)
{
int total = 100;
int done = (percent / 100.0) * total;
fmt::print("\r[");
@DarkStar1997
DarkStar1997 / polymorphic_vector.cpp
Created October 30, 2019 20:56
A vector which should be capable of holding elements of any type implemented with polymorphism
#include <iostream>
#include <vector>
#include <memory>
#include <algorithm>
void* operator new(std::size_t size)
{
std::cout << "Allocating " << size << " bytes\n";
return malloc(size);
}
@DarkStar1997
DarkStar1997 / Notes.md
Last active October 4, 2019 08:47
Random Notes
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 2
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
@DarkStar1997
DarkStar1997 / test.cpp
Created March 23, 2018 20:09
Calculating factorial manually (naively by running a loop) using GMP C++ Class Interface
#include <iostream>
#include <gmpxx.h>
#include <chrono>
using namespace std;
int main()
{
int n; cin>>n;
auto start=chrono::high_resolution_clock::now();
mpz_class a=1;
for(int i=2; i<=n; i++)