Skip to main content

Posts

UDEMY free courses on Linux

  The below courses are free courses available on UDEMY.      1. Intro to Linux https://www.udemy.com/course/intro-to-linux/ 2. Intro to Linux Shell Scripting (Free course) https://www.udemy.com/course/linux-shell-scripting-free/ 3. Linux for Beginners: Crash Course https://www.udemy.com/course/linux-for-beginners-crash-course/ 4. Learn The Linux Command Line: Basic Commands https://www.udemy.com/course/command-line/ 5. Linux Network Troubleshooting Commands (CCNA/DevOps) https://www.udemy.com/course/linux-network-troubleshooting-commands-devops/ 6. Superb Linux Bootcamp – Become Certified Linux Professional https://www.udemy.com/course/superb-linux-bootcamp-become-certified-linux-professional/ 7. Linux Command Line for Beginners https://www.udemy.com/course/linux-command-line-basics/ 8. Introduction to Linux : crash course – 2025 https://www.udemy.com/course/introduction-to-linux-crash-course/ 9. Linux Tutorials and Projects (Free) https://www.udemy.com/course/linux...

How to disable or disconnect ADB over WiFi

ADB over Wi-Fi leaves your device open to remote connections, which can be a security risk on untrusted networks. Disabling it restores the traditional USB debugging mode and ensures that your device remains secure. 1 Revert to USB Debugging           Connect via USB: If your device is currently connected over Wi-Fi, reattach the USB cable. This initial connection is essential to safely switch debugging modes.              Open Terminal/Command Prompt:  Launch your terminal or command prompt on your computer.              Switch Back to USB Mode: Enter the following command                          adb usb          2. Disconnect the Wireless Session             If you’re still in a Wi-Fi debugging session, you can explicitly disconnect by run...

How to set up and use ADB over Wi-Fi

Android Debug Bridge (ADB) is a versatile tool that allows developers to communicate with Android devices for debugging and other tasks. Traditionally, ADB connections require a USB cable, but it's possible to establish a connection over Wi-Fi, offering greater flexibility. This guide provides step-by-step instructions to set up ADB over Wi-Fi and outlines common issues you might encounter. Prerequisites Android Device : Ensure your device is running Android 11 or later. Toxigon Computer : A PC with ADB installed. You can download the latest version of the Android SDK Platform Tools from the official Android developer website . USB Cable : Required for the initial setup. Wi-Fi Network : Both your Android device and computer must be connected to the same Wi-Fi network. Steps to set up ADB over Wi-Fi Enable Developer Options on Your Android Device : Navigate to Settings > About phone . Tap on Build number seven times until you see a message confirming that Developer Options are e...

How to create unique mach-o binaries with different file hash on mac

Sometimes you wonder you might want to create several Mach-O executable files on macOS for any fun or test purpose where each Mach-O has different hash such as ( MD5, SHA1, or SHA256 ) from one another. The following script will help you in achieving that. Pre-requisites: 1. Command-line tools for macOS need to be installed on mac prior to executing the below script. How to Run: 1. Copy the following code snippet to a file and save it with the name randomMachoGenerator.sh. 2. Run the bash script as sh randomMachoGenerator.sh in Terminal. 3. The following script will compile and execute unique Mach-O binaries inside the directory. #!/usr/bin/env bash START=1 END=10 echo 'Generating random Mach-O binaries' for ((n=$START; n<=$END; n++)) do  #Generating 12 letter random string      STATEMENT=$(dd if=/dev/urandom count=1 2> /dev/null | uuencode -m - | sed -ne 2p | cut -c-12)     cat > randomMach...

How to use proxy setting with pip to install packages?

If you see error messages like below when you try to install packages in a restricted environment where it is mandated to use proxy settings to download packages - "Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError( , 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/wxpython/ " we need to supply proxy server setting to pip while installing the python packages , Example sudo pip install --proxy=https://proxy.example.com:port -U wxPython

Why my 500GB Hard disk shows less size when formatted on the system ?

There are two ways to define a gigabyte.   One is vendor way and another one is the computer's  binary powers of two definition  method. When you buy a "500 Gigabyte" hard drive, the vendor defines it using the  decimal  powers of ten definition  of the "Giga" prefix. 500 * 10 9 bytes = 500,000,000,000 = 500 Gigabytes But the computers operating system determines the size of the drive using the computer's  binary powers of two definitions  of the "Giga" prefix: 465 * 2 30 bytes = 499,289,948,160 = 465 Gigabytes/ Gibibytes If you're wondering where 35 Gigabytes of your 500 Gigabyte drive just disappeared too, you're not alone. It's  an old trick by hard drive makers  -- they intentionally use  the official SI definitions  of the Giga prefix so they can inflate the sizes of their hard drives, at least on paper.  Ideally, we should refer to binary prefix when calculating sizes of storage devices as this makes mo...

What are the useful nvram settings in macOS ?

The OS X boot arguments are useful for troubleshooting problems with system startup and how the system behaves when running. sudo nvram boot-args="-v" :  This command will set the system to always boot to verbose mode, so we do not need to hold Command + V at system startup. sudo nvram boot-args="-x" :  This will set the system to always boot into Safe Mode. sudo nvram boot-args="-s" :  This command will boot the system into single user mode without needing to hold Command-S at system startup. sudo nvram boot-args="iog=0x0"  :   when you close the display but connect the system to an external monitor and keyboard the system will stay awake. After running this command, when connecting an external monitor, the internal display will be disabled, which can be beneficial in some situations such as those where you are mirroring your desktop but wish to run the external display at a higher resolution than your laptop can run. sudo nvram b...

How to check user and group associations on macOS

Sometimes we might have to know the list of users, groups and ids such as userid and groupid on macOS system. There are several ways to find this information.  dsacacheutil: The command  dscacheutil -q group   will output all groups with their name, ID numbers, and list of members. The command    dscacheutil -q user will output name,uid, gid, dir, shell, gecos details. Note:   The above command will output all the groups and user details , including built-in system ones mortals were never meant to see. Check user and group association: We can run below command to check user and group associations to know whether a user belongs to a group or not. dsmemberutil checkmembership -u 501 -g 1 user is not a member of the group Or dsmemberutil checkmembership -U user -G staff The user user cannot be found There was an unknown error. User not found Alternative methods to find group and user ...

How to enable 64 bit testing mode in macOS Mojave 10.14

One can use 64-bit testing mode in macOS 10.14 to test software for 64-bit compatibility. To enable the 64-bit testing mode: Boot to Recovery OS by restarting your machine and holding down the Command and R keys at startup. Launch Terminal Execute the following command: nvram boot-args="-no32exec" Restart the machine      Note:  The 64-bit testing mode prevents 32-bit processes from launching. Launching an app that depends on 32-bit software results in a notification that the application can't be opened.  To disable the 64-bit testing mode: Boot to Recovery OS by restarting your machine and holding down the Command and R keys at startup. Launch Terminal Execute the following command: nvram boot-args="" Restart the machine 

How to get a certificate fingerprint as SHA-256, SHA-1 or MD5 using OpenSSL on mac

As per my old post ( http://anandmpandit.blogspot.in/2016/11/how-to-extract-signing-certificates.html ) , we can extract the binary signing certificates on mac using codesign tool. If you needed to get fingerprint details of the certificate in MD5, SHA1 or SHA256 format then you have run below steps on the extracted certificate file on macOS. SHA256: SHA256 Fingerprint=D3:0A:32:6C:77:77:93:B5:45:20:AC:C0:D4:7E:3A:84:34:50:96:54:08:7F:7D:63:4C:3E:06:3B:E8:1F:C1:90 SHA1: SHA1 Fingerprint=BF:2C:93:1F:BD:88:E5:4C:96:D8:86:D5:F1:E6:9B:B7:DE:76:51:62 MD5: MD5 Fingerprint=3C:A3:3B:76:6D:AE:3F:4B:4E:B2:AA:66:97:55:B8:76

How to boot into recovery mode on mac without holding Command + R Key on keyboard ?

Generally well known method to boot the mac into recovery mode is by holding the Command + R on keyboard while mac is turned on. However you can force the mac to boot into recovery mode upon next reboot by changing the nvram setting. To do that, Run below command.   sudo nvram "recovery-boot-mode=unused" sudo reboot

How to enable specific part of System Integrity Protection(SIP) while keeping few sections of it disabled.

macOS SIP supports a set of hidden options to disable few sections of SIP by passing hidden options to csrutil tool.   Each of these can be selectively disabled by running one of the following commands while booted into Recovery mode: csrutil enable --no-internal csrutil enable --without kext csrutil  enable  --without fs csrutil  enable  --without debug csrutil  enable  --without dtrace csrutil  enable  --without nvram You can disable two or more components by structuring the command as follows: csrutil enable --without kext  --without debug How to disable /enable to SIP , refer to  http://anandmpandit.blogspot.in/2015/11/how-to-disable-system-integrity.html .  Note : These options are tested on macOS ElCapitan , on higher version of macOS some or all of them may not work.

How to rename filenames to their corresponding md5 hash on mac ?

The following command in terminal app renames the files located in directory to their corresponding md5 hash on macOS.  Steps: 1. Open Terminal.app and go to the directory containing files. 2. Run following command in terminal to rename files by MD5 on macOS. macOS-system$ for F in *.*; do mv $F "$(md5 "$F" | cut -d' ' -f4).${F##*.}"; done The above shell command renames all files in the current directory to their md5.

How to make java point to right version of java on your Mac ?

A usual problem on mac where the even after upgrading or installing the latest version of Java, when queried in command line for java version it still refers to the old version of java. something like below : $ java -version java version "1.7.0_79" Java(TM) SE Runtime Environment (build 1.7.0_79-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode) This is because the /usr/bin/java is pointing to   /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java on the system.    $ ls -la `which java` /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java This is because  Oracle's installer puts java inside the   /Library/Internet Plug-Ins/JavaAppletPlugin.plugin . And it doesn't overwrite  /usr/bin/java. So to fix this we have remove the existing soft link to old java and point it to new java binary. which can be done by performing following steps. ...

How to fix broken python module easy_install on mac ?

           Easy Install is a python module ( easy_install ) bundled with  setuptools  that lets you automatically download, build, install, and manage Python packages. Sometimes due wrong installations easy_install might get corrupted and fail to install any package afterwords. You might see errors like below when you try to install any modules Traceback (most recent call last):   File "/usr/local/bin/easy_install", line 7, in     from setuptools.command.easy_install import main   File "/Library/Python/2.7/site-packages/setuptools/__init__.py", line 12, in     import setuptools.version   File "/Library/Python/2.7/site-packages/setuptools/version.py", line 1, in     import pkg_resources   File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 72, in     import packaging.requirements   File "/Library/Python/2.7/site-packages/packaging/requireme...

Calculating hash(md5, sha1...) of a hex string in Python

To calculate hash of hex string in python: In [ 1 ]: import hashlib In [ 2 ]: import binascii In [ 3 ]: hex_string = '3082010a0282010100c3dfee03290fb01e3a4887c5ce0630dcdd8495bfb568b1f61cb8fa8294545b74f06facd215933c53babdd4d066dcb2a713740b9a018c8e0d5fbe1c2a7c793d317c69590c6a34cb1758fd1ff00f36d757c97371d08e9e9efcad1bf6fc8a0c03972296870ad825fa81000fee7aa79c2bcfab0e92d67d3d429d9a25cd6087e3139b17ce1809a6bf83d5ef40ff8e4532412adc15c63eff4eadd264860cb61b381e4f0e8a9e19cf7e39fefdfe9904b1aafe54f12289b930e341dd12b5a41eca1ae9d3556e6c7860a162652a31e256a7fa5720b4cbeb32fa65b67eb0610c6857dfe775d71de5aeb041d7ea0a7c5f335d678280b30dd014e16b37290c4c56d20df737850203010001' In [ 4 ]: hashlib.md5(binascii.unhexlify(hex_string)).hexdigest() Out[ 4 ]: '0c6f3dd3d5d896e0f3f49dfae0437ba1' In [ 6 ]: hashlib.sha1(binascii.unhexlify(hex_string)).hexdigest() Out[ 6 ]: 'fc6d7e7925e18c5bed6314ea112a230948cfde75' In [ 7 ]: hashlib.sha256(...