Skip to content

Instantly share code, notes, and snippets.

View pa-0's full-sized avatar

Peter Abbasi pa-0

View GitHub Profile
@pa-0
pa-0 / ansi2html.sh
Created May 29, 2025 01:48 — forked from regstuff/ansi2html.sh
Convert a colored terminal output in linux into a html file that preserves the color.
#!/bin/sh
# Convert ANSI (terminal) colours and attributes to HTML
# Licence: LGPLv2
# Author:
# http://www.pixelbeat.org/docs/terminal_colours/
# Examples:
# ls -l --color=always | ansi2html.sh > ls.html
# git show --color | ansi2html.sh > last_change.html
@pa-0
pa-0 / Test-IsWindowsTerminal.ps1
Created May 28, 2025 05:39 — forked from jdhitsolutions/Test-IsWindowsTerminal.ps1
Test if PowerShell is running in WindowsTerminal
#requires -version 5.1
Function Test-IsWindowsTerminal {
[cmdletbinding()]
[Outputtype([Boolean])]
Param()
Write-Verbose "Testing processid $pid"
@pa-0
pa-0 / CustomTitleBar.ahk
Created May 25, 2025 09:18 — forked from Lexikos/CustomTitleBar.ahk
Creating a GUI with custom titlebar in AutoHotkey v2.0
#Requires AutoHotkey v2.0
OnMessage( 0xF, PaintTitle)
OnMessage( 0x14, EraseBkgnd)
OnMessage( 0x83, NcCalcSize)
OnMessage( 0x84, NcHitTest)
OnMessage( 0xA4, NcRButtonDown)
OnMessage( 0x2A2, NcMouseLeave)
@pa-0
pa-0 / CommentsAuthor.bas
Created May 22, 2025 01:09 — forked from wyfinger/CommentsAuthor.bas
Edit comments author at selection in Word
Sub EditComment()
If ActiveDocument.Comments.Count = 0 Then Exit Sub
For i = 1 To ActiveDocument.Comments.Count
If (Selection.Start >= ActiveDocument.Comments(i).Scope.Start) And _
(Selection.Start <= ActiveDocument.Comments(i).Scope.End) Then
ActiveDocument.Comments(i).Author = InputBox(ActiveDocument.Comments(i).Author _
& vbCrLf & vbCrLf & ActiveDocument.Comments(i).Range.Text, "Author", ActiveDocument.Comments(i).Author)
End If
Next
End Sub
@pa-0
pa-0 / DocumentProperties.bas
Created May 22, 2025 01:07 — forked from ghanique/DocumentProperties.bas
VBA Macro for exporting and importing Word Document Properties
Option Explicit
Private fileName As String
Public Sub ExportProperties()
On Error GoTo ErrorHandler
Let fileName = InputBox("Export properties to ...", "Export", fileName)
Open fileName For Output As #1
@pa-0
pa-0 / backup_daily.bat
Created May 22, 2025 01:06 — forked from wyfinger/backup_daily.bat
My BAT code to everday backup my files with RAR
@ECHO OFF
rem Работаем с Rar5, если это не нужно удалить ключи -ma
ECHO ┌─────────────────────────────────────────────────┐
ECHO │ Бекап шаблонов Word/Excel/Outlook │
ECHO └─────────────────────────────────────────────────┘
"C:\Program Files\WinRAR\rar.exe" a -ma -pbak -ed -ep -dh -m5 -s -idcd -agYYYY-MM-DD -r "F:\Backups\VBA.bak\" "%userprofile%\AppData\Roaming\Microsoft\Шаблоны\Normal.dotm" "%userprofile%\AppData\Roaming\Microsoft\Excel\XLSTART\PERSONAL.XLSB"
ECHO.
@pa-0
pa-0 / accept-alltcbutdeletes.vba
Created May 22, 2025 01:04 — forked from masanobuimai/macro1.vba
Accept All Non-Deletion Changes
Sub Macro1()
' 挿入/変更/削除以外の変更履歴を一括承諾する
' https://docs.microsoft.com/ja-jp/office/vba/api/word.wdrevisiontype
For Each myRev In ActiveDocument.Revisions
myType = myRev.Type
Select Case myType
Case _
wdRevisionDisplayField, _
wdRevisionParagraphNumber, _
wdRevisionParagraphProperty, _
@pa-0
pa-0 / VBA-change-comment-author.txt
Created May 22, 2025 01:00 — forked from rubenalmaguer/VBA-change-comment-author.txt
VBA - Change comment author's name
'https://learn.microsoft.com/en-us/office/vba/api/word.comment
Sub ChangeCommentAuthor()
Dim Comment
For Each Comment In ActiveDocument.Comments
If Comment.Author = "KIM Jingu" Then
Comment.Author = "Pulito"
End If
Next
End Sub
@pa-0
pa-0 / Track2Formatting.bas
Created May 22, 2025 00:57 — forked from githubyouser/Track2Formatting.bas
Convert Tracked Changes in MS Word to Formatted Text
'Source: https://answers.microsoft.com/en-us/msoffice/forum/all/word-2013-is-there-a-way-to-replace-tracked/adc5f04e-34d5-4423-b0ac-84d5548246be
Sub ConvertTrackedChangesToFormatting()
'Add undo function - https://docs.microsoft.com/en-us/office/vba/word/Concepts/Working-with-Word/working-with-the-undorecord-object
Dim objUndo As UndoRecord
Set objUndo = Application.UndoRecord
'Begin the custom undo record and provide a name for the record
objUndo.StartCustomRecord ("Convert Tracked Ch. to Formatting")
@pa-0
pa-0 / Placeholders.bas
Created May 22, 2025 00:57 — forked from kemitchell/Placeholders.bas
Word Placeholder Replacement Macro
Attribute VB_Name = "Placeholders"
Function ValidateInput(value As String) As Boolean
ValidateInput = Len(Trim(value)) > 0
End Function
' Replace {Placeholders} with text entered by the user
Public Sub ReplacePlaceholders()
' VBA Collection does not have .Exists()
Dim dictionary
Set dictionary = CreateObject("Scripting.Dictionary")