Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Wind010
Wind010 / batch_delete.sql
Last active April 20, 2024 20:13
SQL to batch delete specific rows wrapped wrapped in transaction.
/*
SQL to batch delete specific rows wrapped wrapped in transaction.
*/
DECLARE @BatchSize INT = 1000;
DECLARE @RowsAffected INT = 1;
DECLARE @Batches INT = 10;
DECLARE @BatchCount INT = 0;
WHILE @RowsAffected > 0 AND @BatchCount < @Batches
@Wind010
Wind010 / sp_GenerateDateRangeSelectQuery.sql
Created April 17, 2024 21:27
SQL query to generate a selection of date ranges based off parameters specified.
CREATE OR ALTER PROCEDURE sp_GenerateDateRangeSelectQuery
@TimeInterval NVARCHAR(10), -- 'HOUR', 'DAY', 'WEEK', 'MONTH'
@StartDate DATETIME,
@EndDate DATETIME,
@SchemaName NVARCHAR(128),
@TableName NVARCHAR(128),
@DateColumnName NVARCHAR(128)
AS
BEGIN
DECLARE @SQL NVARCHAR(MAX)
from datetime import datetime
from typing import Any, List, Tuple
from pyspark.sql import DataFrame, SparkSession
from jdbc_configuration import JdbcConfiguration
# https://www.youtube.com/watch?v=_p73PZIDQuA
NOT_PREPARED: str = "The prepared_statement param is None!"
SQL_FORMAT: str = '%Y-%m-%d %H:%M:%S'
@Wind010
Wind010 / gist:6d800a9121fa30fbb33b64d62abcf023
Created March 16, 2024 02:05
Bash script to enumerate all users on a CMD+CTRL Cyber Range
#!/bin/bash
set -e
# Endpoint URL
#endpoint=""
final_expected_response='{"profile":{"error":"invalid user id"}}'
# Default values
ids_to_enumerate=1
@Wind010
Wind010 / ascii_lord_oscar.txt
Created February 26, 2024 22:01
ASCII Lord Oscar
. .
++xx++;++++xxxxx+x+++;+++++++;++++++;++++;;;;;x+++++++x+++++++++++++++++x++xxxxXxxxxXXx+xxxxxxxxxxxx+xxxxxx++x+xXXXXXXxxXXxxXXxx+x++xxXxXXXXXXxxxxxXXXXXXXXxxxXXXXXXx+$X+XXXXXX$XXXXXXXxXXXxxX$xxX$$$$
++++++;:;+++++xx++++;+++++++++++++++++;;+++;+++;+++++++x+++xxxx+xx++xxxx+++xXxxXxXXXx+++++xxxxxxxx+xxxxxxXxxXxxXXxxxxxxXXxXXxxXXXXXXxxxxXXXXXxxxXXXXXXXx+xxXXXXXXXXxXXxxXXX$$$XXXXXXXX$$$XxXXXX&$$$XX$
xx;:::;;+++;++;+++++xx+x+++++++++++;;;+x++xxxxxx+++xx+xxxx++++;+x+++++++xxxXXXxxx+++++xxxXXxxXXx++xXxXXXXXxxx++xxXXxxxx+xXxXXXxXxxxxXXxxxXxxxxXXXxxXxxX$XxxXXXXXXxxXxxXXXXXXXXXxxXXXXXX+xXXXX$$$XxXXXX
;:;;;++++++++xx+xxxxx;;;;;++x+++++;;++++;+++;;;+++++++x++++++++++++++++++++++x++++xxxXXXxxx++xxXXXXXxxx++x+xX$$XX+xxxXXXXXXXXXx+xxXXxxX$xXXxxxXXXXXXXXxxXXXxxXXXXxxxxXXXXXxxXx+$XXXXXXxXXxX$$XXXXXXXXx
++++;;;+++;;+++++;
@Wind010
Wind010 / pass-butter_robot.txt
Created February 26, 2024 21:53
Pass butter robot
. =.
*-=*+**:**:*
=:= .%-. *+
@% +:- *+
:**= :%%:= *+ #+
#:-=*#%%*%=*::%+..*+ .@*%:
* ..:::--=+#=
- % .%
:: =+***+=: % %-
-: :%.#*::=%::*:#. % * *:
@Wind010
Wind010 / find_unused_dependencies.sh
Created February 9, 2024 21:55
Compare actually installed vs what the requirements.txt or setup.py references
#!/bin/bash
# Work in progerss. Currently the diff is not accurate.
# TODO: Take in setup.py and requirements_*.txt.
# Exit immediately if a command exits with a non-zero status
set -e
# Uncomment for debugging
#set -x
@Wind010
Wind010 / update_packages.sh
Last active February 9, 2024 22:03
Script to pull the existing packages from a setup.py, pip install latest versions of those packages, pip freeze those versions and repopulate the setup.py
#!/bin/bash
# Work in Progress
# The pip freeze will bring in a lot more packages explicitly than expected.
# Still need to populate/paste into setup.py correctly.
SETUP_PY_PATH="./setup.py"
# Extract install_requires values without versioning
INSTALL_REQUIRES=$(grep -oP '"[^"]+"' $SETUP_PY_PATH \
| grep -oP '"[^"]+"' \
@Wind010
Wind010 / dep_to_setup.py
Created February 9, 2024 03:00
Regenerate the setup.py with dependencies found in project. Useful if requirements.txt is missing
#!/bin/bash
# Requires existing template setup.py
SETUP_PY_PATH="./setup.py"
# Requires pipdeptree
pip install pipdeptree
# Generate a dependency tree for your project
pipdeptree --warn silence --warn silence -r --warn silence --warn silence --warn silence > dependencies.txt
@Wind010
Wind010 / m2_macbook_air_benchmark.txt
Last active January 28, 2024 05:11
Hashcat benchmark for M2 MacBook Air 15
hashcat --benchmark
hashcat (v6.2.6) starting in benchmark mode
Benchmarking uses hand-optimized kernel code by default.
You can use it in your cracking session by setting the -O option.
Note: Using optimized kernel code limits the maximum supported password length.
To disable the optimized kernel code in benchmark mode, use the -w option.
* Device #2: Apple's OpenCL drivers (GPU) are known to be unreliable.
You have been warned.