Skip to content

Instantly share code, notes, and snippets.

View syedadeel2's full-sized avatar

Adeel Rizvi syedadeel2

  • West Hoxton, NSW, Australia
View GitHub Profile
@syedadeel2
syedadeel2 / ApolloClient.js
Created December 11, 2022 10:17
Using ApolloClient useSubscription in Class Components
import { ApolloClient, HttpLink, InMemoryCache, split } from "@apollo/client";
import { GraphQLWsLink } from '@apollo/client/link/subscriptions';
import { createClient } from "graphql-ws";
import { getMainDefinition } from "@apollo/client/utilities";
const scheme = ( proto ) =>
window.location.protocol === "https:" ? `${ proto }s` : proto;
const splitter = ( { query } ) => {
const { kind, operation } = getMainDefinition( query ) || {};
@syedadeel2
syedadeel2 / terraform.yaml
Created October 22, 2022 08:35
Get Terraform Output to Variables
name: "Terraform"
on:
push:
branches: main
permissions:
contents: read
jobs:
@syedadeel2
syedadeel2 / Validator.cs
Last active July 19, 2022 10:14
C# - ACN & ABN Digit Check
// Reference
// https://abr.business.gov.au/Help/AbnFormat
public static bool IsValidABN(string abn)
{
// return false if null
if ( abn == null ) return false;
// remove spaces
abn = abn.Replace( " ", "" );
@syedadeel2
syedadeel2 / goa_attribute.py
Last active March 24, 2022 11:11
GOA Design Spec Type Generator - Python
# AUTHOR : ADEEL RIZVI
# DATE : 24/03/2022
class GoaAttribute:
def __init__(self, name, desc, type, required):
self.name = name.replace(
'-', '_').replace('.', '_').replace(' ', '_')
self.desc = desc
@syedadeel2
syedadeel2 / Body.tsx
Created November 22, 2021 11:02
Simple React StateManager
import Header from "../components/header/Header";
function toggleSideBar() {
if (Header.MyState.sideBarclassName === "") {
Header.MyState.update("sideBarclassName", "active", Header.MyState);
} else {
Header.MyState.update("sideBarclassName", "", Header.MyState);
}
}
@syedadeel2
syedadeel2 / auto-git-nuget-auditor.ps1
Last active October 5, 2021 02:29
Export dotnet list package --vulnerable --include-transitive to CSV
# Author : Adeel Rizvi
# Description : My Org asked me to do audit for Nuget packages and export the CSV for each project, I found out that dotnet list doesn't export the csv.
# so i wrote the below function to export the output as csv. it only works with command "dotnet list package --vulnerable --include-transitive".
# To export the csv download this powershell script and place it on solution folder and run the script.
# This script will pull the repos and do the audit and if -ForceUpdate 1 mention it will do major package updates as well and push the branch back to repo.
# You want to just run the nuget report run like this >> .\Nuget-Auditor.ps1
# You want to just run the nuget report run & major packages update run like this >> .\Nuget-Auditor.ps1 -ForceUpdate 1
# You want to just run the nuget report & minor packages update run like this >> .\Nuget-Auditor.ps1 -ForceUpdate 1 -UpdateMinorVersion 1
param([bool]$ForceUpdate = 1,[bool]$UpdateMinorVersion = 1)
@syedadeel2
syedadeel2 / gist:f6b11ed3b6eff66a09553af5be248f8c
Created August 13, 2021 02:01
Fix Windows 10 Activation Error After Cloning
Open RegEdit
Goto HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\IDConfigDB\Hardware Profiles\0001
Look for Key "HWProfileGuid"
Generate the New GUID or change any number of the GUID lesser than 10.
Close RegEdit
Try To Activate windows again.