Skip to content

Instantly share code, notes, and snippets.

View rdapaz's full-sized avatar

ricdeez rdapaz

View GitHub Profile
@rdapaz
rdapaz / grab_latest.sql
Created July 24, 2024 05:53
Grab latest entry from database
SELECT *
FROM Summary t1
INNER JOIN (
SELECT system_id, MAX(ID) as max_id
FROM Summary
WHERE facility = 'MAC'
GROUP BY system_id
) t2 ON t1.system_id = t2.system_id AND t1.ID = t2.max_id
WHERE t1.facility = 'MAC'
ORDER BY T1.id
@rdapaz
rdapaz / document_intelligence.py
Created July 16, 2024 13:11 — forked from daveebbelaar/document_intelligence.py
A service class for interacting with Azure Document Intelligence API.
import logging
import requests
import time
from typing import Union, Dict
from config.settings import get_settings
class DocumentIntelligenceService:
"""
A service class for interacting with Azure Document Intelligence API.
@rdapaz
rdapaz / Excel_Column_Names.py
Last active June 12, 2024 13:52
Generate Column Names in Excel Spreadsheet with python and win32com
class Excel:
def __init__(self):
self.xlApp = win32com.client.gencache.EnsureDispatch('Excel.Application')
self.xlApp.Visible = True
self.wk = self.xlApp.Workbooks.Add()
def column_name(self, iVal):
if iVal <= 0:
return ""
elif iVal <= 26:
@rdapaz
rdapaz / regexp_sqlite.py
Created May 14, 2024 07:39
Use REGEXP with sqlite
# This makes use of REGEXP within an sqlite3 query
```python
def regexp(expr, item):
reg = re.compile(expr)
return reg.search(item) is not None
def make_data():
import sqlite3
sql = """
SELECT
@rdapaz
rdapaz / negotiatessh.md
Created September 26, 2023 04:01
Negotiate SSH

When attempting to SSH to a cisco switch from a raspbian device (raspberry pi), getting the following error:

unable to negotiate with 192.168.1.7 port 22: no matching key exchange method found. 
Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

Resolve by issuing ssh as follows:

@rdapaz
rdapaz / example.md
Created September 21, 2023 04:55
Enabling SSH Client on ASA Firewall

Here is a method how to SSH FROM a Cisco ASA over to any other device. Basically the SSH client has always been there, but required a secret menu.

ASA# debug menu ssh 1 192.168.1.20 admin P@ss1234
The authenticity of host ‘192.168.1.20 (192.168.1.20)’ can’t be established.
RSA key fingerprint is (SHA256).
Are you sure you want to continue connecting (yes/no)? yes

Please use the following commands to add the hash key to the configuration:

@rdapaz
rdapaz / PPHyperlinksSameDocument.py
Created August 31, 2023 20:27
Create Tables in Powerpoint with hyperlinks
import win32com.client
# Open the PowerPoint application and the presentation
Application = win32com.client.Dispatch("PowerPoint.Application")
pptPath = r'path\to\powerpoint.pptx'
Presentation = Application.Presentations.Open(pptPath)
# Dictionaries to store the results
reverse_index_hash = {}
forward_index_hash = {}
@rdapaz
rdapaz / Download_AllFiles.md
Created August 16, 2023 16:03
Download all files from Humble Bundle

Click on ... at the top of the browser Window on the left Select developer tools Go to console and type the following:

let zz = 0;
$('.flexbtn').children('a').each(function() {
setTimeout(() => { $(this).click(); }, zz);
zz += 1500;
});
@rdapaz
rdapaz / ThreeRouters.txt
Created April 12, 2023 17:59
GraphViz for 3 routers
digraph G {
node[style=filled, fillcolor=red, landscape=True, width=2.5, height=1.25]
R1 -> R2 [label="192.168.12.1/24", fontsize="12pt", arrowsize=0]
R1 -> R3 [label="192.168.13.1/24", fontsize="12pt", arrowsize=0]
R2 -> R3 [label="192.168.23.1/24", fontsize="12pt", arrowsize=0]
R1 -> R1 [label="lo1: 10.1.1.1 ", fontsize="12pt"]
R2 -> R2 [label="lo1: 10.2.2.2 ", fontsize="12pt"]
R3 -> R3 [label="lo1: 10.3.3.3 ", fontsize="12pt"]