This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
find . -maxdepth 1 -mindepth 1 -exec du -sh {} \; 2>/dev/null | sort -h | sed 's|\./||' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/henno/refreshdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enhanced PowerShell Script for MySQL/MariaDB Database Dump and Restore | |
# | |
# This script automates dumping and restoring databases using mysqldump and mysql, with support for configuration | |
# detection and fallbacks. It checks for database configuration in 'config.php' or 'wp-config.php' files, or uses | |
# the current directory name if no database name is provided. Users can customize behavior through command-line | |
# arguments for various parameters. | |
# | |
# Usage Examples: | |
# | |
# 1. Dumping a Database: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
powershell | |
—--------- | |
Invoke-WebRequest -Uri 'https://ninite.com/7zip-chrome-teamviewer15-vscode-zoom/ninite.exe' -OutFile 'C:\Users\admin\Downloads\ninite.exe' | |
C:\Users\admin\Downloads\ninite.exe | |
#$ServiceManager = New-Object -ComObject "Microsoft.Update.ServiceManager" | |
#$ServiceManager.ClientApplicationID = "My App" | |
#$NewService = $ServiceManager.AddService2("7971f918-a847-4430-9279-4a52d1efe18d",7,"") | |
#add-computer -domainname hummuli.sise -Credential HUMMULI\henno.taht | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First type notepad $profile in powershell | |
# Then paste the following code in the notepad and save it | |
# Then restart the powershell or type . $profile in powershell | |
# Then type ll in powershell to see the linux style directory listing | |
function Get-LinuxStyleChildItem { | |
Get-ChildItem -Force | ForEach-Object { | |
$item = $_ | |
$size = if ($item.Length -ge 1GB) { | |
"{0:N2} GB" -f ($item.Length / 1GB) | |
} elseif ($item.Length -ge 1MB) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-ChildItem -Recurse | Where-Object { $_.PSIsContainer } | ForEach-Object { | |
if (Test-Path $_.FullName) { | |
try { | |
Set-Location -LiteralPath $_.FullName | |
$files = Get-ChildItem -Path ./* -include *.jpg | Where-Object { $_.Length -gt 0 } | |
if ($files.Count -gt 1) { | |
$groups = $files | Group-Object { $_.Length } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set the desired quality for image compression | |
$quality = 75 | |
# Set the maximum dimensions for resizing while preserving the aspect ratio | |
$maxDimension = "1920x1920>" | |
# Set the minimum file size for resizing and compression (500KB) | |
$minFileSizeForResize = 500 * 1024 | |
# Function to get the date taken from the image's EXIF data | |
function Get-DateTaken { | |
param([string]$imagePath) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach i in=[interface ether find] do={interface bridge port add interface=$i bridge=bridge1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Create mymessage.txt: | |
Subject: Test Email | |
This is a test email sent from the command line using curl and STARTTLS. | |
# 2. Execute this CURL (https://curl.se/windows/) command: | |
curl --url "smtp://csmtp.telia.ee:587" --mail-from "[email protected]" --mail-rcpt "[email protected]" --upload-file mymessage.txt --user "[email protected]:U5ER1P455WORD" --ssl-reqd --tlsv1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.use((err, req, res, next) => { | |
const statusCode = err.statusCode || 500; | |
console.error(err.message, err.stack); | |
res.status(statusCode).json({message: err.message }); | |
return; | |
}); |