Skip to content

Instantly share code, notes, and snippets.

@ibrezm1
ibrezm1 / Duplicate.sql
Last active January 12, 2025 18:46
SQL Server Duplicate records in same tables ( base - child and grandchild) Example
-- Step 1: Duplicate the college with a new name
DECLARE @NewCollegeID INT;
-- Insert new college and capture the new CollegeID
INSERT INTO College (CollegeName)
SELECT CollegeName + ' Copy 3'
FROM College
WHERE CollegeID = 1; -- Assuming CollegeID = 1 is the college to duplicate
-- Get the newly inserted CollegeID
@ibrezm1
ibrezm1 / getallkeyssorted.sh
Created July 29, 2024 21:25
Get all service account keys in multiple projects
#!/bin/bash
# Get the current date and the date 9 months ago
current_date=$(date +%Y-%m-%d)
nine_months_ago=$(date -d "$current_date - 9 months" +%Y-%m-%d)
# Get the list of all projects
projects=("zeta-yen-319702")
@ibrezm1
ibrezm1 / api.php
Last active June 30, 2024 05:31
PHP PDO and test
<?php
require 'db_config.php';
header('Content-Type: application/json');
// Basic Auth credentials
define('USERNAME', 'u');
define('PASSWORD', 'p');
// Function to check basic auth credentials
@ibrezm1
ibrezm1 / onenote to html.ps1
Created June 8, 2024 11:12
Bulk export OneNote 2013/2016 pages as HTML
# Copied from https://passbe.com/2019/bulk-export-onenote-2013-2016-pages-as-html/
# https://stackoverflow.com/questions/53689087/powershell-and-onenote
# http://thebackend.info/powershell/2017/12/onenote-read-and-write-content-with-powershell/
# https://stackoverflow.com/questions/53639041/how-to-access-contents-of-onenote-page
# Get export folder
Function Get-Folder($initialDirectory) {
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms")|Out-Null
$foldername = New-Object System.Windows.Forms.FolderBrowserDialog
@ibrezm1
ibrezm1 / curloutput.txt
Created February 25, 2024 13:45
php session management using Curl
$ curl -X POST -c cookies.txt -H "Content-Type: application/json" -d '{"username": "your_username", "password": "your_password"}' http://localhost/be/auth/login.php
{"success":true,"message":"Login successful"}ibrez@ibrez-OptiPlex-9020:be
$ curl -b cookies.txt http://localhost/be/auth/login.php
{"loggedIn":true,"username":"your_username"}ibrez@ibrez-OptiPlex-9020:be
$ curl -b cookies.txt http://localhost/be/auth/logout.php
{"success":true,"message":"Logout successful"}ibrez@ibrez-OptiPlex-9020:be
@ibrezm1
ibrezm1 / Setup Hadoop, Spark wsl.md
Created September 2, 2023 15:55
Setup Hadoop, Spark
@ibrezm1
ibrezm1 / encrypt_decrypt.sh
Created June 24, 2023 01:32
encrypt local files
#!/bin/bash
# chmod +x encrypt_decrypt.sh
#
# export ENCRYPTION_KEY="mysecretkey"
#
# Encrypt a file
#./encrypt_decrypt.sh encrypt sensitive_file.txt
#
# Decrypt a file
@ibrezm1
ibrezm1 / unlocked.vbs
Created June 22, 2023 07:06
Vbscript csvript keep unlocked till time
Sub forceCScriptExecution
Dim Arg, Str
If Not LCase( Right( WScript.FullName, 12 ) ) = "\cscript.exe" Then
For Each Arg In WScript.Arguments
If InStr( Arg, " " ) Then Arg = """" & Arg & """"
Str = Str & " " & Arg
Next
CreateObject( "WScript.Shell" ).Run _
"cscript //nologo """ & _
WScript.ScriptFullName & _
@ibrezm1
ibrezm1 / DAG -Log Execution Error.log
Last active September 13, 2023 05:53
Vertex AI - Airflow Dags bigquery Source
[2023-06-17T18:42:48.869+0530] {logging_mixin.py:149} INFO - Changing /mnt/d/projects/airflow/logs/dag_id=vi_create_auto_ml_tabular_training_job_dag/run_id=manual__2023-06-17T13:12:33+00:00/task_id=auto_ml_tabular_task permission to 509
[2023-06-17T18:42:48.891+0530] {logging_mixin.py:149} INFO - Changing /mnt/d/projects/airflow/logs/dag_id=vi_create_auto_ml_tabular_training_job_dag/run_id=manual__2023-06-17T13:12:33+00:00/task_id=auto_ml_tabular_task permission to 509
[2023-06-17T18:42:48.906+0530] {taskinstance.py:1103} INFO - Dependencies all met for dep_context=non-requeueable deps ti=<TaskInstance: vi_create_auto_ml_tabular_training_job_dag.auto_ml_tabular_task manual__2023-06-17T13:12:33+00:00 [queued]>
[2023-06-17T18:42:48.914+0530] {taskinstance.py:1103} INFO - Dependencies all met for dep_context=requeueable deps ti=<TaskInstance: vi_create_auto_ml_tabular_training_job_dag.auto_ml_tabular_task manual__2023-06-17T13:12:33+00:00 [queued]>
[2023-06-17T18:42:48.916+0530] {taskinstance.py:1308} INFO - Sta
@ibrezm1
ibrezm1 / id_rsa
Last active December 24, 2022 03:55
Set-neverinstall
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABCv5JnpN5
gCMM5FQHIIVlKzAAAAEAAAAAEAAAGXAAAAB3NzaC1yc2EAAAADAQABAAABgQDISb3+zwrU
dsjRtWqso6Fws1cHulG+xfwQ4J+GcHa1kCB46wkhQskyyfSDZoebfJFwpYUHdOpZzohMoc
q6fVuutwY76IezObXf3IsYDZw1my/3Qk455c6Rs7QHtWkjBd/Nhf6cITKJA4VoXGFkJ2FL
IkXacVEg4K3l6P2MjUUb6UB/OVkoxXng1E0eAyIswDbLgO1widuvXXG/yjKDC2xxfo282X
ri9dbdlU7AmcCO+GaG8SzBArFUM15ad4EE3hHbdq6oUOCij3uUUonR5esnZpsD+AUwAN7Z
y4PCTz73q3iY+KlSwC5Tehia2M22u6fWyYRdcQS3GVKHkVgQymplLUXDKSW5ZTPc1IyJzG
lplvpI9F/Hk16rk0VyKS8mt+ELystTmnmNIoEJXlP5U7u827jaE/qqyXIX/s1djEuuena4
dMkghOaAJry/Qr1xSUwMksw5OBmsK+zOHhHqvZQy470wPHDXv42MIiQISt+HfUYMMp4Srr