Tuesday, December 10, 2019

Remap “Home” and “End” to beginning and end of line

The default shortcuts for moving to beginning or end of (wrapped) lines are  and  and  or A and E move to the beginning or end of unwrapped lines (or paragraphs).  and  move backwards/forward by words, and all of these are compatible with holding Shift to select during the corresponding moves.
You could remap home and end by creating ~/Library/KeyBindings/ and saving a property list like this as DefaultKeyBinding.dict:
{
    "\UF729"  = moveToBeginningOfLine:; // home
    "\UF72B"  = moveToEndOfLine:; // end
    "$\UF729" = moveToBeginningOfLineAndModifySelection:; // shift-home
    "$\UF72B" = moveToEndOfLineAndModifySelection:; // shift-end
}
Most of the keybindings for editing text in OS X are defined in /System/Library/Frameworks/AppKit.framework/Resources/StandardKeyBinding.dict.
Applying changes requires reopening applications. DefaultKeyBinding.dict is ignored by some old versions of Xcode (works with latest version 6.3.1), Terminal, and many cross-platform applications.
See Cocoa Text System and my website for more information about the customizable keybindings.
Terminal's keybindings can be customized in Preferences > Settings > Keyboard. \033OH moves to the beginning of a line and \033OF to the end of a line.
In Eclipse, key bindings should be modified in Preferences > General > Keys. You need to modify default bindings for commands Line Start and Line End (replace ⌘← by ↖ and ⌘→ by ↘). For selection to work, also modify Select Line Start and Select Line End.
PS: You may need to logout and login again for the ~/Library/KeyBindings/DefaultKeyBinding.dict change to take effect.
Answer has been take from here.
More functionality can be found here.

Monday, August 5, 2019

Delete node_modules folder recursively from a specified path using command line.

Answers from StackOverflow. Click here for the whole discussion thread.
Print out a list of directories to be deleted:
find . -name 'node_modules' -type d -prune
Delete directories from the current working directory:
find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +

Alternatively, you can use trash (brew install trash) for staged deletion:
find . -name node_modules -type d -prune -exec trash {} +


Another answer from StackOverflow,
find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +
I found that the command would run a very long time to fetch all folders and then run a delete command, to make the command resumable I'd suggest using \; and to see progress of the command being run use -print to see the directory being deleted.
Note: You must first cd into the root directory and then run the command or instead of find . use find {project_directory}
To delete folders one by one
find . -name 'node_modules' -type d -prune -exec rm -rf '{}' \;
To delete folders one by one and printing the folder being deleted
find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' \;

Friday, February 22, 2019

Uninstall MySql on a Mac OS X

Summary

To completely uninstall MySql OS X it is neccessary to remove numerous files.

Symptom

You unable to install an older version of MySql even though you thought you have removed everything.

Resolution

To uninstall MySQL and completely remove it (including all databases) from your Mac do the following:
  • Open a terminal window
  • Use mysqldump to backup your databases to text files!
  • Stop the database server
  • sudo rm /usr/local/mysql
  • sudo rm -rf /usr/local/mysql*
  • sudo rm -rf /Library/StartupItems/MySQLCOM
  • sudo rm -rf /Library/PreferencePanes/My*
  • edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
  • rm -rf ~/Library/PreferencePanes/My*
  • sudo rm -rf /Library/Receipts/mysql*
  • sudo rm -rf /Library/Receipts/MySQL*
  • sudo rm -rf /private/var/db/receipts/*mysql*
The last three lines are particularly important as otherwise, you can't install an older version of MySQL even though you think that you've completely deleted the newer version!

Taken from: https://community.jaspersoft.com/wiki/uninstall-mysql-mac-os-x

Installing Heidisql on macOS

1. First, install wine:

brew cask install java xquartz
brew install wine

2. Now, install winetricks:

brew install winetricks


3. Now, install Microsoft Data Access Components

winetricks dlls mdac28

4. Download Heidisql.
http://www.heidisql.com/download.php

5. Install Heidisql with wine command:
wine HeidiSQL_10.1.0.5464_Setup.exe

6. Start the application from from:
"/usr/local/bin/wine ~/.wine/drive_c/Program\\ Files/HeidiSQL/heidisql.exe"

or create an icon for your docker with the apple script editor

tell application "Terminal"
do script "/usr/local/bin/wine ~/.wine/drive_c/Program\\ Files/HeidiSQL/heidisql.exe"
end tell

Open up the Script Editor. You should see a window with a large area you can type in near the top: this is where you write your AppleScript. In that area, type the following text:

tell application "Terminal"
    do script "/usr/local/bin/wine ~/.wine/drive_c/Program\\ Files/$PATH_TO_PROGRAM.exe"
end tell

You'll need to replace $PATH_TO_PROGRAM with the path from the Program Files directory to your program executable. You can see that you're simply telling the AppleScript to run a line of code in the Terminal: the same line of code that you could run to start your Windows program.

Next, press the Compile button at the top of the window. The text should become colored to indicate that Script Editor understands what you wrote. You can also try pressing the Run button to run your script: it should open the Windows program successfully.

Lastly, save your script. You can give it whatever name you'd like, but be sure to select File Format: Application in the save options, and leave Startup Screen unchecked.

Open up the Finder, go to where you saved your script, and drag that file to your Dock. It should stay there, just like a real application -- because it is a real application! However, all it does is run that launcher command for you, so you can move the application around, rename it, or even delete it, and it won't affect the Windows program that you're running.

More details: https://www.davidbaumgold.com/tutorials/wine-mac/


Taken from: https://myridia.com/dev_posts/view/1620

Monday, January 7, 2019

Google Keyboard Shortcuts for Google Hangouts/Meet Chrome extension or app


I wanted to find out the keyboard shortcuts for Hangouts and Meet which can give me the liberty to mute, unmute, turn on/off the camera.

I found below shortcuts from Google's support page.



Controls

ShortcutKeyboard keys
Turn on or off camera⌘ + e
Mute or unmute your microphone⌘ + d

Accessibility

ShortcutKeyboard keys
Announce who is currently speakingShift + ⌘ + Alt + a then s
Announce current information about the roomShift + ⌘ + Alt + a then i



Controls

ShortcutKeyboard keys
Turn on or off cameraCtrl + e
Mute or unmute your microphoneCtrl + d

Accessibility

ShortcutKeyboard keys
Announce who is currently speakingShift + Ctrl + Alt + a then s
Announce current information about the roomShift + Ctrl + Alt + a then i