Skip to content

Instantly share code, notes, and snippets.

View ehzawad's full-sized avatar
🎃
Wasteland Baby!

ehzawad ehzawad

🎃
Wasteland Baby!
View GitHub Profile
#!/usr/bin/env python
import re
import os
import sys
from typing import Tuple, Dict, Any
def extract_title_from_front_matter(content: str) -> str:
"""
Extract the 'title: ...' line from the front matter if present.
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from webdriver_manager.chrome import ChromeDriverManager
from tqdm import tqdm
import time
import os
class ActionAskYaqeenFaq(Action):
def name(self) -> Text:
return "action_ask_yaqeen_faq"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
last_text = tracker.latest_message["text"]
@ehzawad
ehzawad / interactive_DFS.js
Created September 10, 2024 11:58
interactive_dfs.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>React D3.js Interactive Directed Graph Representation</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.8.6/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.8.6/umd/react-dom.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.16.0/d3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script>
function addSuggestion(suggestions) {
console.log("addSuggestion called with suggestions:", suggestions);
const suggLength = suggestions.length;
console.log("Number of suggestions:", suggLength);
const suggestionsHTML = `
<div class="singleCard">
<div class="suggestions">
<div class="menu"></div>
</div>
# Intermediate server (Jump Host)
Host jumphost
HostName 45.251.56.227
User root
IdentityFile ~/.ssh/id_rsa_legacy
PubkeyAuthentication yes
PasswordAuthentication yes
PreferredAuthentications publickey,password
ConnectTimeout 30
ServerAliveInterval 60
import requests
from typing import Any, Text, Dict, List
class BankAPI:
def __init__(self):
self.headers = {"Content-Type": "application/json"}
def data_validation(self, data_list):
data_list = list(map(str, data_list))
return data_list
@ehzawad
ehzawad / otp_sending.py
Created August 7, 2024 09:03
OTP-sending
# OTP Implementation Flow and Code
## 1. Generate OTP
When a sensitive operation is requested, a new OTP is generated.
```python
def opt_generator(self):
opt_number = random.randint(self.otp_srange, self.opt_erange)
return opt_number
# Cell 1: Install dependencies
!pip install -q -U transformers llama-index accelerate pypdf einops bitsandbytes
!pip install -q llama-index-llms-huggingface
!pip install -q llama-index-embeddings-huggingface
# Cell 2: Import libraries and set up warnings
import warnings
warnings.filterwarnings('ignore')
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, ServiceContext
@ehzawad
ehzawad / domain.yml
Created June 4, 2024 02:04
A sample domain.yml for managing flow
version: "3.1"
intents:
- greet
- goodbye
- affirm
- deny
- mood_great
- mood_unhappy