Skip to content

Commit

Permalink
2025-02-11 17:13:16.853057 new snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardocerqueira committed Feb 11, 2025
1 parent 35950ea commit c4bf01b
Show file tree
Hide file tree
Showing 17 changed files with 1,587 additions and 732 deletions.
31 changes: 31 additions & 0 deletions seeker/report.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
--------------------------------------------------------------------------------
2025-02-11 17:13:16.853057
--------------------------------------------------------------------------------
On branch main
Your branch is up to date with 'origin/main'.

Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: snippet/gistfile1.txt

Untracked files:
(use "git add <file>..." to include in what will be committed)
snippet/PortScanner.go
snippet/bilateral.py
snippet/custom_data.py
snippet/dilation.py
snippet/erosion.py
snippet/gaussian.py
snippet/grpo-peft.py
snippet/iKB1_CPY.py
snippet/kernel.py
snippet/main.py
snippet/medium.py
snippet/morph_grad.py
snippet/notebook.py
snippet/open_close.py
snippet/pdf2images.py

no changes added to commit (use "git add" and/or "git commit -a")

--------------------------------------------------------------------------------
2025-02-10 17:11:54.112006
--------------------------------------------------------------------------------
Expand Down
54 changes: 54 additions & 0 deletions seeker/snippet/PortScanner.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//date: 2025-02-11T16:49:54Z
//url: https://api.github.com/gists/ab420b11b153844aa3613def8d239b51
//owner: https://api.github.com/users/xandersavvy

package main

import (
"fmt"
"net"
"sync"
"time"
)

func scanPort(host string, port int, wg *sync.WaitGroup) {
defer wg.Done()
address := fmt.Sprintf("%s:%d", host, port)
conn, err := net.DialTimeout("tcp", address, 1*time.Second)
if err == nil {
fmt.Printf("[+] Port %d is open\n", port)
conn.Close()
}
}

func main() {
var host string
var startPort, endPort int

fmt.Print("Enter target host (IP or domain): ")
fmt.Scanln(&host)
fmt.Print("Enter start port: ")
fmt.Scanln(&startPort)
fmt.Print("Enter end port: ")
fmt.Scanln(&endPort)

var wg sync.WaitGroup

for port := startPort; port <= endPort; port++ {
wg.Add(1)
go scanPort(host, port, &wg)
}

wg.Wait()
}
// Things to learn not from GPT 😂
/****
*printf just prints but Sprintf print and also return the formatted string which can be stored later
*Waitgroup to add go routine so main function does not exit unless every go routine is resolved
*net.DialTImeout to establish connection
******/
/***
*Hey if you are here and have some development project please feel free to contact me on [email protected]
****/


5 changes: 5 additions & 0 deletions seeker/snippet/bilateral.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#date: 2025-02-11T17:09:28Z
#url: https://api.github.com/gists/468a0ae55b280c7973243a029280d40d
#owner: https://api.github.com/users/Zaryob

bilateral_filtered = cv2.bilateralFilter(image, 9, 75, 75)
58 changes: 58 additions & 0 deletions seeker/snippet/custom_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#date: 2025-02-11T17:02:09Z
#url: https://api.github.com/gists/aa582b938e1c3391f18c65af22ba79d0
#owner: https://api.github.com/users/Sdy603

import pandas as pd
import requests
import json

# Load the CSV file
file_path = 'df_getrunresults.csv'
df = pd.read_csv(file_path)

# Define the Custom Data API endpoint and API key
API_ENDPOINT = 'https://yourinstance.getdx.net/api/customData.setAll' # Replace with the actual endpoint
API_KEY = "**********"

# Headers for the API request
headers = {
'Accepts': 'application/json',
'Authorization': f'Bearer {API_KEY}',
'Content-Type': 'application/json'
}

# Function to format the data as required by the Custom Data API
def format_payload(row):
return {
"reference": f"{row['id']}", # Using id as part of the reference
"key": f"status-{row['test_id']}", # Using test_id as the key
"value": {
"status_id": row['status_id'],
"created_on": row['created_on'],
"assignedto_id": row['assignedto_id'] if pd.notna(row['assignedto_id']) else None,
"comment": row['comment'] if pd.notna(row['comment']) else "",
"version": row['version'] if pd.notna(row['version']) else "N/A",
"elapsed": row['elapsed'] if pd.notna(row['elapsed']) else "0",
"defects": row['defects'] if pd.notna(row['defects']) else "None",
"created_by": row['created_by'],
"custom_step_results": row['custom_step_results'] if pd.notna(row['custom_step_results']) else None,
"custom_chaos_testing_comments": row['custom_chaos_testing_comments'] if pd.notna(row['custom_chaos_testing_comments']) else None,
"attachment_ids": json.loads(row['attachment_ids']) if pd.notna(row['attachment_ids']) else []
},
"timestamp": row['created_on']
}

# Create the payload with all data
payload = {
"data": [format_payload(row) for index, row in df.iterrows()]
}

# Send the data to the API
response = requests.post(API_ENDPOINT, headers=headers, json=payload)

# Log the response
if response.status_code == 200:
print('Successfully sent data to the Custom Data API')
else:
print(f'Failed to send data: {response.status_code}, {response.text}')
data: {response.status_code}, {response.text}')
6 changes: 6 additions & 0 deletions seeker/snippet/dilation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#date: 2025-02-11T16:58:33Z
#url: https://api.github.com/gists/cd530a0c185a799e624272dfd1092961
#owner: https://api.github.com/users/Zaryob

# b) Dilation (Genişletme): Nesnelerin kenarlarına piksel ekleme.
dilation = cv2.dilate(image, kernel, iterations=1)
6 changes: 6 additions & 0 deletions seeker/snippet/erosion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#date: 2025-02-11T16:57:35Z
#url: https://api.github.com/gists/1f85cbd9d7db0666c6aa4b857085b701
#owner: https://api.github.com/users/Zaryob

# a) Erosion (Aşındırma): Nesnelerin kenarlarından piksel kaybı sağlar.
erosion = cv2.erode(image, kernel, iterations=1)
5 changes: 5 additions & 0 deletions seeker/snippet/gaussian.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#date: 2025-02-11T17:04:58Z
#url: https://api.github.com/gists/998edbf13e78ae30922e7c7c40628144
#owner: https://api.github.com/users/Zaryob

gaussian_blurred = cv2.GaussianBlur(image, (5, 5), 0)
Loading

0 comments on commit c4bf01b

Please sign in to comment.