Author: Arpit Mandliya
- 15 April
Convert Hex to String in Python
1. Introduction The representation of data in Hexadecimal is commonly used in computer programming. It is used to represent binary data in a human-readable form, as understanding the machine language (i.e., Binary) is difficult for humans. Hexadecimal notation is used in networking protocols, e.g., IPv6 and cryptography, and widely used in graphics, e.g. to represent […]
- 15 April
PowerShell Get Ad User Account Expiration Date
Using Get-AdUser Cmdlet with Select-object cmtlet Use the Get-AdUser with Select-object to get the ad user account expiration date in PowerShell. [crayon-6768e66e59366344267585/] [crayon-6768e66e5936c235100122/] Here, the PowerShell cmdlet Get-ADUser was used to retrieve the information about the users of the Active Directory as it is a centralized system. Now, what is Active Directory? Microsoft provides directory […]
- 14 April
PowerShell Convert Word to PDF
Using Microsoft Word COM Object To convert the given Microsoft Word document to PDF: Create a COM object using the New-Object cmdlet. Use the Open() method to open the MS Word file. Use the SaveAs() method to save the PDF file. Use the Close() method to close the Word document. Use the Quit() method to […]
- 14 April
PowerShell Check If File Contains String
Using Select-String Cmdlet Use the Select-String cmdlet to check if the specified file contains the given string in PowerShell. [crayon-6768e66e5966d737536679/] [crayon-6768e66e59671890170340/] First, we declared and initialized a variable named $path containing the location of the file1.txt file. Then, we created another variable called $string and set its value with "customers"; this is the value we […]
- 14 April
Batch Get Script Directory
To use any of the following ways, you must know how to create and run the batch files and PowerShell script files. For this article, we have prepared the following PowerShell script and saved it in the testPS.ps1 file to run batch file: [crayon-6768e66e599d9457526693/] Remember, you may have to update the path of the .bat […]
- 14 April
Bash Echo to stderr
Using >&2 Operator Use the >&2 operator to redirect the echo output to stderr in bash. [crayon-6768e66e59b9b875559962/] [crayon-6768e66e59b9f635923507/] As shown above, an error message is an output to the stderr stream using the echo command with the >&2 operator. Here, stderr stands for standard error. It is one of the three standard streams. In Bash, […]
- 14 April
NameError: Name xrange Is Not Defined in Python
This NameError: Name 'xrange' Is Not Defined in Python is one of the errors which can occur while using Python. Our objective is to identify the underlying cause of the error and then provide ways to resolve it. Using xrange() Method to Reproduce NameError Use the xrange() method to reproduce NameError in Python 3.x. [crayon-6768e66e59d75395331392/] […]
- 14 April
Call Python Script from Bash with Arguments
Python is a high-level language famous for its simplicity, flexibility, and readability. At the same time, Bash is a Unix shell and command language used primarily on Unix and Linux systems. Data analysis, machine learning, web development, and scientific computing tasks are widely performed using python language. On the contrary, the bash is used for […]
- 14 April
PowerShell Convert Epoch Time to DateTime
Before moving towards various solutions to convert the Epoch time to Datetime, it is essential to know the Epoch time. Epoch time, POSIX time or Unix time is the system for denoting a point in time to a single number. This single number is the number of seconds (not counting leap seconds) that have elapsed […]