Skip to content

Instantly share code, notes, and snippets.

View SwarajKetan's full-sized avatar

Swaraj(SwarajKetan) SwarajKetan

View GitHub Profile
@SwarajKetan
SwarajKetan / FwRuleModificationOnStartup.cs
Last active April 24, 2022 06:53
You need to have a reference to %system32%/FirewallAPI.dll
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NetFwTypeLib;
namespace ConsoleApp1
{
@SwarajKetan
SwarajKetan / design_pattern_singleton.cpp
Created October 20, 2020 04:32
Nice way to implement thread-safe singleton pattern with enhanced security
#include <ctime>
#include <chrono>
class Singleton
{
private:
Singleton() { }
void operator delete(void*) {}; // such that its not deleted accidentally
public:
Singleton(Singleton&) = delete; // Copy prohibited