Skip to content

Instantly share code, notes, and snippets.

View vdparikh's full-sized avatar

Vishal Parikh vdparikh

View GitHub Profile
import os
import fnmatch
import pandas as pd
from presidio_analyzer import AnalyzerEngine, RecognizerResult, PatternRecognizer, Pattern
from presidio_anonymizer import AnonymizerEngine
from presidio_anonymizer.entities import EngineResult
from presidio_image_redactor import ImageRedactorEngine, ImageAnalyzerEngine
from PIL import Image
import docx2txt
from pdf2image import convert_from_path
@vdparikh
vdparikh / Problem.md
Created September 7, 2023 17:31
Insurance Policy Management

Imagine you are designing a simple system for an insurance company to manage their insurance policies. Each insurance policy has the following attributes:

  • Policy ID (a unique identifier)
  • Policyholder Name
  • Policy Start Date
  • Policy End Date
  • Premium Amount

Your task is to create a simple API or a command-line program in a programming language of your choice (e.g., Python, Java, C#) to manage these insurance policies. You need to implement the following functionalities:

@vdparikh
vdparikh / main.cs
Last active September 29, 2023 22:43
Key Store
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Newtonsoft.Json;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading.Tasks;
@vdparikh
vdparikh / Badge and Company.md
Last active September 6, 2023 17:30
Details

The following coding problem requires Senior engineer level or up to finish two questions within 50 minutes.

We are working on a security system for a badged-access room in our company's building.

  1. Given an ordered list of employees who used their badge to enter or exit the room, write a function that returns two collections: a. All employees who didn't use their badge while exiting the room – they recorded an enter without a matching exit. b. All employees who didn't use their badge while entering the room – they recorded an exit without a matching enter.
badge_records = [
 ["Martha", "exit"],
@vdparikh
vdparikh / main.py
Last active May 15, 2023 06:39
ChatGPT4All
wget https://the-eye.eu/public/AI/models/nomic-ai/gpt4all/gpt4all-lora-quantized.bin
pip install pyllama
mkdir llama
python -m llama.download --model_size 7B --folder llama/
# https://github.com/nomic-ai/pygpt4all/pyllamacpp
# pip install pyllamacpp fails and so directly download it from github
@vdparikh
vdparikh / GPT4all-langchain-demo.ipynb
Created May 8, 2023 17:13 — forked from psychemedia/GPT4all-langchain-demo.ipynb
Example of running GPT4all local LLM via langchain in a Jupyter notebook (Python)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Slack script to call ChatGPT and participate in conversations when mentioned, summarize long threads, and query a sqlite database containing an organizational knowledge-base
@vdparikh
vdparikh / README.md
Last active April 30, 2023 22:04
Nitro Enclave

What is Nitro Enclave

https://aws.amazon.com/ec2/nitro/nitro-enclaves/#:~:text=AWS%20Nitro%20Enclaves%20enables%20customers,within%20their%20Amazon%20EC2%20instances.

AWS Nitro Enclaves are isolated compute environments that provide additional security for highly sensitive data processing workloads. Nitro Enclaves are based on Nitro System, a combination of dedicated hardware and lightweight hypervisor, that isolates and protects resources like CPU, memory, and storage from the underlying infrastructure and other workloads.

Nitro Enclaves allow customers to securely process highly sensitive data without exposing the data to the underlying host, reducing the risk of data exfiltration and enabling compliance with strict security requirements.

Nitro Enclaves can run applications that require a secure and isolated environment, such as cryptographic key generation and storage, data processing in financial services, and code signing. Nitro Enclaves are integrated with AWS Key Management Service (KMS), AWS S

@vdparikh
vdparikh / openai.go
Last active April 25, 2023 17:42
OpenAI API for completion
package main
import (
"fmt"
"net/http"
"bytes"
"io/ioutil"
)
func main() {
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import "forge-std/Test.sol";
contract InvariantBreaker {
bool public flag0 = true;
bool public flag1 = true;