Skip to content

Instantly share code, notes, and snippets.

View aliabidzaidi's full-sized avatar
🌱

Ali Abid Zaidi aliabidzaidi

🌱
View GitHub Profile
@aliabidzaidi
aliabidzaidi / Riverpod.md
Created September 1, 2024 20:03
Riverpod notes

Riverpod

Riverpod is primarily used for managing application state. State refers to data that can change over time and affects the UI Consists of Providers that define how the state is created, shared and updated. Secondly, Consumers which are widgets that access state from providers, additionally they rebuild automatically when state changes

Provider

Provider creates an object as a state and allows widgets to listen to it. Create from one place and access from multiple locations from the widget tree. Optimizes performance by filtering widget rebuilds or caching expensive state computations Makes code testable since providers can be overridden to behave differently during tests

REST API (Link)

Introduction

RESTful API is an interface that two computer systems use to exchange information securely over the internet.
Example Image

Components of a Restful API

@aliabidzaidi
aliabidzaidi / Readme.md
Created July 26, 2023 12:43
C++ dynamic memory

C++ Dynamic memory

Smart pointers in c++ enable automatic, exception safe, object lifetime management

  • unique_ptr
  • shared_ptr
  • weak_ptr
  • auto_ptr

Unique pointer

Smart pointer that owns and manages another object through a pointer and disposes that object the the pointer goes out of scope.

@aliabidzaidi
aliabidzaidi / TimeExecutionTest.cpp
Last active December 19, 2022 19:24
Ways to Measure Execution Time
// https://levelup.gitconnected.com/8-ways-to-measure-execution-time-in-c-c-48634458d0f9
// Ways to Measure exeuction time in c++
// 1. Using the ‘time’ Linux command (Run program with "time ./program")
// 2. Using <chrono>
// 3. With <sys/time.h> and gettimeofday()
// 4. With <time.h> and time()
// 5. Using <time.h> and clock()
// 6. With <time.h> and clock_gettime()
// 7. With <sysinfoapi.h> and GetTickCount64() (For windows)
// 8. With <processthreadsapi.h> and GetProcessTimes() (For windows)
@aliabidzaidi
aliabidzaidi / Readme.md
Created October 19, 2022 16:57
DHCP KEA Docker container stuck

Fix for docker kea container restarting

export LOCAL_DIR=$(docker inspect -f '{{ .GraphDriver.Data.UpperDir }}' dhcp-kea-1)
pushd $LOCAL_DIR/run/kea/
rm kea.kea-dhcp4.pid
popd
@aliabidzaidi
aliabidzaidi / main.cpp
Last active June 10, 2022 01:11
Google Test and Mock example
// To Build and Run
// g++ main.cpp -g -lgtest -lgmock
// ./a.out
// links
// https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md
// https://stackoverflow.com/questions/58501850/googlemock-how-to-use-mocking-in-test
// https://qiangbo-workspace.oss-cn-shanghai.aliyuncs.com/2018-12-05-gtest-and-coverage/PlainGoogleQuickTestReferenceGuide1.pdf
#include "gtest/gtest.h"
#include "gmock/gmock.h"
@aliabidzaidi
aliabidzaidi / Readme.md
Last active January 25, 2022 19:35
Allama Iqbal Poetry

Allama Iqbal's Poetry

Baal-e-Jibril Link

Apni Jolangah Zair-e-Asman Samjha Tha Main Link

اپنی جولاں گاہ زير آسماں سمجھا تھا ميں آب و گل کے کھيل کو اپنا جہاں سمجھا تھا ميں

@aliabidzaidi
aliabidzaidi / Readme.md
Created November 16, 2021 06:33
Add Disk to Linux
@aliabidzaidi
aliabidzaidi / test2.c
Created November 3, 2021 07:24
Kafka Pushes into 1 out of 4 partitions only
// To Compile & Run
// gcc -o test2 test2.c -lrdkafka -ljansson
// ./test2
#include <stdio.h>
#include <unistd.h>
#include "kafkaProducer.h"
#include <librdkafka/rdkafka.h>
#include <jansson.h>
@aliabidzaidi
aliabidzaidi / Readme.md
Last active February 18, 2022 07:23
Notes on Apache Spark