Skip to content

Instantly share code, notes, and snippets.

@ivanhub
ivanhub / thumbnails_generator_image_resizer_c#.cs
Created December 16, 2022 05:40
Auto thumbnail generator and image resizer - C#
using System;
using System.Collections.Generic;
using System.Web;
using System.IO;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Security.Principal;
using System.Drawing;
@ivanhub
ivanhub / exif_converter.sh
Created December 15, 2022 11:55
EXIF CONVERT FOR JPG
exifautotran *.jpg
#or
magick mogrify -auto-orient imagefile.jpg
@ivanhub
ivanhub / Search_&_replace_in_DOCX.ps1
Last active December 6, 2022 05:04
Search&repace text in all *.docx files
#1
$petya = 0
foreach ($file in Get-ChildItem .\ -Filter *.docx) {
Move-Item $file $($file.BaseName + '_xxx.zip')
expand-Archive -literalPath $($file.BaseName + '_xxx.zip') -destinationpath $($file.BaseName) -Force
if (-Not (Test-Path $($file.BaseName + '\*'))) {
Move-Item $($file.BaseName + '_xxx.zip') $($file.BaseName + '.docx') -Force
Remove-Item -Path $($file.BaseName) -Force
$petya++
@ivanhub
ivanhub / Searh&replace.DOC.ps1
Last active December 6, 2022 05:04
Search & repace text in all *.doc files in directory
#1
foreach ($file in Get-ChildItem .\"*.doc") {
Start-Process 'C:\Program Files\Microsoft Office\Office15\Wordconv.exe' -ArgumentList '-oice -nme', $($file.BaseName + '.doc'), $($file.BaseName + '_xxx.docx') -Wait
if (Test-Path -Path $($file.BaseName + '_xxx.docx')) {
Move-Item $($file.BaseName + '_xxx.docx') $($file.BaseName + '_xxx.zip')
#expand-7zip $($file.BaseName +'.zip') $($file.BaseName)
expand-Archive -literalPath $($file.BaseName + '_xxx.zip') -destinationpath $($file.BaseName) -Force
}
}
@ivanhub
ivanhub / copy_files_by_extensions_with_subfolders_recursively.ps1
Created December 5, 2022 10:44
Copy files filtered by extensionsand all subfolders
Copy-Item .\ C:\to where\ -Filter *.doc* -Recurse
@ivanhub
ivanhub / copy_to_all_subfolders.ps1
Last active December 5, 2022 10:09
Copy file to all subfolders PS
$folders = Get-ChildItem .\ -Directory
foreach ($folder in $folders.name){
Copy-Item -Path "FileName" -Destination ".\$folder" -Recurse -Force
}
@ivanhub
ivanhub / search_and_replace.sql
Last active December 2, 2022 10:03
Search and Replace (SQL)
use dbname
Update TableName
SET ColumnName = REPLACE(ColumnName, 'what', 'towhat');
@ivanhub
ivanhub / Search_in_all_tables.sql
Created December 2, 2022 10:01
Search in all tables
use DATABASENAME
DECLARE @SearchStr nvarchar(100) = 'TEXT TO SEARCH'
DECLARE @Results TABLE (ColumnName nvarchar(370), ColumnValue nvarchar(3630))
SET NOCOUNT ON
DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110)
SET @TableName = ''
SET @SearchStr2 = QUOTENAME('%' + @SearchStr + '%','''')
@ivanhub
ivanhub / increase_selected_items.js
Created October 11, 2022 09:06
INCREASE selected items in LIST (SHAREPOINT)
function waitFor(variable, callback) {
var interval = setInterval(function() {
if (window[variable]) {
clearInterval(interval);
callback();
}
}, 200);
}
$(document).ready(function() {
waitFor('g_MaximumSelectedItemsAllowed', function() {
Test-path $profile
New-item -path $profile -type file -force
#function prompt {"PS [$env:computername] >"}
$Shell = $Host.UI.RawUI
$size = $Shell.WindowSize
# $size.width=70
# $size.height=25
$Shell.WindowSize = $size