Tumgik
lifelongprogrammer · 5 years
Text
Better Bash history
Via http://lifelongprogrammer.blogspot.com/2019/08/better-bash-history.html code{white-space:pre-wrap}span.smallcaps{font-variant:small-caps}span.underline{text-decoration:underline}div.column{display:inline-block;vertical-align:top;width:50%}a.sourceLine{display:inline-block;line-height:1.25}a.sourceLine{pointer-events:none;color:inherit;text-decoration:inherit}a.sourceLine:empty{height:1.2em}.sourceCode{overflow:visible}code.sourceCode{white-space:pre;position:relative}div.sourceCode{margin:1em 0}pre.sourceCode{margin:0}@media screen{div.sourceCode{overflow:auto}}@media print{code.sourceCode{white-space:pre-wrap}a.sourceLine{text-indent:-1em;padding-left:1em}}pre.numberSource a.sourceLine{position:relative;left:-4em}pre.numberSource a.sourceLine::before{content:attr(data-line-number);position:relative;left:-1em;text-align:right;vertical-align:baseline;border:none;pointer-events:all;display:inline-block;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:0 4px;width:4em;background-color:#232629;color:#7a7c7d}pre.numberSource{margin-left:3em;border-left:1px solid #7a7c7d;padding-left:4px}div.sourceCode{color:#cfcfc2;background-color:#232629}@media screen{a.sourceLine::before{text-decoration:underline}}code span.{color:#cfcfc2}code span.al{color:#95da4c}code span.an{color:#3f8058}code span.at{color:#2980b9}code span.bn{color:#f67400}code span.bu{color:#7f8c8d}code span.cf{color:#fdbc4b}code span.ch{color:#3daee9}code span.cn{color:#27aeae}code span.co{color:#7a7c7d}code span.cv{color:#7f8c8d}code span.do{color:#a43340}code span.dt{color:#2980b9}code span.dv{color:#f67400}code span.er{color:#da4453}code span.ex{color:#09f}code span.fl{color:#f67400}code span.fu{color:#8e44ad}code span.im{color:#27ae60}code span.in{color:#c45b00}code span.kw{color:#cfcfc2}code span.op{color:#cfcfc2}code span.ot{color:#27ae60}code span.pp{color:#27ae60}code span.re{color:#2980b9}code span.sc{color:#3daee9}code span.ss{color:#da4453}code span.st{color:#f44f4f}code span.va{color:#27aeae}code span.vs{color:#da4453}code span.wa{color:#da4453}
Table of Contents
Sync Bash History Between Terminals
Increase Bash History Size
Store Bash History Immediately
Use one command per line
Add Date and Time to Bash History
HISTCONTROL: how commands are saved
HISTIGNORE: Ignore Specific Commands
Others Setting about Bash History
The Complete Setting for Bash History
By default, history is stored in the file ~/.bash_history, we can change ~/.bashrc
Sync Bash History Between Terminals
shopt -s histappend: when close a session, the history will be appended to the .bash_history file rather than overwriting.
Increase Bash History Size
HISTSIZE: the number of lines or commands that are stored in memory in a history list (the default value is 500).
HISTFILESIZE: the maximum number of lines contained in the history file (the default value is 500).
HISTFILESIZE=9999999 HISTSIZE=9999999
inlineAds=true;var isMobile=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent);if(!isMobile){document.write("<script src='//ap.lijit.com/www/delivery/fpi.js?z=332935&width=728&height=90'><\/script>");} else{document.write('<script src="//ap.lijit.com/www/delivery/fpi.js?z=460172&width=320&height=480"><\/script>');}
Store Bash History Immediately
PROMPT_COMMAND='$PROMPT_COMMAND; history -a'
PROMPT_COMMAND: if set, it’s executed before the printing of each primary prompt ($PS1)
history -a: append the new history lines to the history file
Use one command per line
shopt -s cmdhist: Store multi-line commands in one history entry
Add Date and Time to Bash History
HISTTIMEFORMAT="%h %d %H:%M:%S "
HISTCONTROL: how commands are saved
HISTCONTROL=ignorespace:erasedups | | | |:———– |:—————————————————– | | ignorespace | don’t save lines which begin with a character | | ignoredups | don’t save lines matching the previous history entry | | ignoreboth | use both ‘ignorespace’ and ‘ignoredups’ | | erasedups | eliminate duplicates across the whole history |
HISTIGNORE: Ignore Specific Commands
HISTIGNORE="history"
Others Setting about Bash History
HISTFILE: change the history file name, the default value is ~/.bash_history.
The Complete Setting for Bash History
with the below setting, we save bash history across all terminals.
We can use history | grep xx to quickly search and find commands we ran before.
# append to the history file rather than overwrite it shopt -s histappend HISTFILESIZE=9999999 HISTSIZE=9999999 PROMPT_COMMAND='$PROMPT_COMMAND; history -a' shopt -s cmdhist HISTTIMEFORMAT="%h %d %H:%M:%S " HISTCONTROL=ignorespace:erasedups HISTIGNORE="history"
From lifelongprogrammer.blogspot.com
1 note · View note
lifelongprogrammer · 5 years
Link
From http://lifelongprogrammer.blogspot.com/ code{white-space:pre-wrap}span.smallcaps{font-variant:small-caps}span.underline{text-decoration:underline}div.column{display:inline-block;vertical-align:top;width:50%}a.sourceLine{display:inline-block;line-height:1.25}a.sourceLine{pointer-events:none;color:inherit;text-decoration:inherit}a.sourceLine:empty{height:1.2em}.sourceCode{overflow:visible}code.sourceCode{white-space:pre;position:relative}div.sourceCode{margin:1em 0}pre.sourceCode{margin:0}@media screen{div.sourceCode{overflow:auto}}@media print{code.sourceCode{white-space:pre-wrap}a.sourceLine{text-indent:-1em;padding-left:1em}}pre.numberSource a.sourceLine{position:relative;left:-4em}pre.numberSource a.sourceLine::before{content:attr(data-line-number);position:relative;left:-1em;text-align:right;vertical-align:baseline;border:none;pointer-events:all;display:inline-block;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:0 4px;width:4em;background-color:#232629;color:#7a7c7d}pre.numberSource{margin-left:3em;border-left:1px solid #7a7c7d;padding-left:4px}div.sourceCode{color:#cfcfc2;background-color:#232629}@media screen{a.sourceLine::before{text-decoration:underline}}code span.{color:#cfcfc2}code span.al{color:#95da4c}code span.an{color:#3f8058}code span.at{color:#2980b9}code span.bn{color:#f67400}code span.bu{color:#7f8c8d}code span.cf{color:#fdbc4b}code span.ch{color:#3daee9}code span.cn{color:#27aeae}code span.co{color:#7a7c7d}code span.cv{color:#7f8c8d}code span.do{color:#a43340}code span.dt{color:#2980b9}code span.dv{color:#f67400}code span.er{color:#da4453}code span.ex{color:#09f}code span.fl{color:#f67400}code span.fu{color:#8e44ad}code span.im{color:#27ae60}code span.in{color:#c45b00}code span.kw{color:#cfcfc2}code span.op{color:#cfcfc2}code span.ot{color:#27ae60}code span.pp{color:#27ae60}code span.re{color:#2980b9}code span.sc{color:#3daee9}code span.ss{color:#da4453}code span.st{color:#f44f4f}code span.va{color:#27aeae}code span.vs{color:#da4453}code span.wa{color:#da4453}
Table of Contents
Sync Bash History Between Terminals
Increase Bash History Size
Store Bash History Immediately
Use one command per line
Add Date and Time to Bash History
HISTCONTROL: how commands are saved
HISTIGNORE: Ignore Specific Commands
Others Setting about Bash History
The Complete Setting for Bash History
By default, history is stored in the file ~/.bash_history, we can change ~/.bashrc
Sync Bash History Between Terminals
shopt -s histappend: when close a session, the history will be appended to the .bash_history file rather than overwriting.
Increase Bash History Size
HISTSIZE: the number of lines or commands that are stored in memory in a history list (the default value is 500).
HISTFILESIZE: the maximum number of lines contained in the history file (the default value is 500).
HISTFILESIZE=9999999 HISTSIZE=9999999
inlineAds=true;var isMobile=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent);if(!isMobile){document.write("");} else{document.write('');}
Store Bash History Immediately
PROMPT_COMMAND='$PROMPT_COMMAND; history -a'
PROMPT_COMMAND: if set, it’s executed before the printing of each primary prompt ($PS1)
history -a: append the new history lines to the history file
Use one command per line
shopt -s cmdhist: Store multi-line commands in one history entry
Add Date and Time to Bash History
HISTTIMEFORMAT="%h %d %H:%M:%S "
HISTCONTROL: how commands are saved
HISTCONTROL=ignorespace:erasedups | | | |:———– |:—————————————————– | | ignorespace | don’t save lines which begin with a character | | ignoredups | don’t save lines matching the previous history entry | | ignoreboth | use both ‘ignorespace’ and ‘ignoredups’ | | erasedups | eliminate duplicates across the whole history |
HISTIGNORE: Ignore Specific Commands
HISTIGNORE="history"
Others Setting about Bash History
HISTFILE: change the history file name, the default value is ~/.bash_history.
The Complete Setting for Bash History
with the below setting, we save bash history across all terminals.
We can use history | grep xx to quickly search and find commands we ran before.
# append to the history file rather than overwrite it shopt -s histappend HISTFILESIZE=9999999 HISTSIZE=9999999 PROMPT_COMMAND='$PROMPT_COMMAND; history -a' shopt -s cmdhist HISTTIMEFORMAT="%h %d %H:%M:%S " HISTCONTROL=ignorespace:erasedups HISTIGNORE="history"
0 notes
lifelongprogrammer · 5 years
Text
Mastering IntelliJ IDEA Keyboard Shortcuts in Linux and Windows
Via http://lifelongprogrammer.blogspot.com/2019/08/mastering-intellij-idea-shortcuts-in-linux-and-windows.html code{white-space:pre-wrap}span.smallcaps{font-variant:small-caps}span.underline{text-decoration:underline}div.column{display:inline-block;vertical-align:top;width:50%}
Table of Contents
Find action
Quick Lists
Disable Linux Default Shortcuts
Customize Shortcuts
Common shortcuts
Shortcuts for Navigation
Shortcuts for Refactoring
Shortcuts for Debugging
Presentation Mode
More tips about shortcuts
Find action
Use Key Promoter X to learn shortcuts.
Find action by name: Ctrl+shift+a
Manage Projects to open recent projects
Find action by shortcut
Quick Lists
Ctrl+Alt+Shift+T for “Refactor This”
Alt+` for VCS Operations.
Create a quick list “Refactor -> Extract”, add all commands and assign “Ctrl+alt+shit+e” to it.
inlineAds=true;var isMobile=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent);if(!isMobile){document.write("<script src='//ap.lijit.com/www/delivery/fpi.js?z=332935&width=728&height=90'><\/script>");} else{document.write('<script src="//ap.lijit.com/www/delivery/fpi.js?z=460172&width=320&height=480"><\/script>');}
Disable Linux Default Shortcuts
Disable the following Linux default shortcuts in System Preferences -> Keyboard -> Shortcut tab:
Disable Ctrl+Alt+S for “Toggle shaded state” at Widnows as it conflicts with Settings.
Disable Ctrl+alt+left/right for “Switch to left/right workspace” as it conflicts with IntelliJ Navigate -> backward/forward.
Disable Ctrl+Alt+T for Launch Terminal at Launchers as it conflicts with “Surround with”
Disable Alt+F7 for Move Window at Windows -> Positioning as it conflicts with Find Usages
Disable Alt+F8 for Resize Window at Windows -> Positioning as it conflicts with Evaluate Expression.
Customize Shortcuts
Some shortcuts in IntelliJ are difficult to remember and use, change them at Settings -> Keymap:
Change reformat code from “Ctrl+alt+l” to “Ctrl+alt+shift+f”, as the previous conflicts with Linux Logout shortcut.
Assign “Editor” -> “Close tab” from “Ctrl+F4” to “Ctrl+w” and unassign it for “extend slection”
Assign “Alt-Shit-+(-)” to increase/decrease font size.
Common shortcuts
Double ShiftSearch EverywhereDouble ctrlRun AnythingOpen settingsCtrl+Alt+SAlt+1Toggle Project ViewAlt+7Toggle structure ViewAlt+2Toggle Favorite ViewAlt+6Toggle TODO ViewAlt+9Toggle Version Control ViewCtrl+shift+left/right/up/downStretch active window to ..
Alt+1 to focus on project view, then use Ctrl+shift+left(right) to move the separator.
Shortcuts for Navigation
to find directory: ctrl+shif+n for find file: then type “/the_directory_name”
Ctrl+eRecent files, press ctrl+e again to show changed files onlyCtrl+shift+eRecent locations, press again to show changed locations onlyCtrl+nFind classCtrl+Shift+NFind FileCtrl+Shift+FFind in pathCtrl+alt+shift+nFind SymbolCtrl+B, Ctrl+ClickStep Into/Show UsagesAlf+F7Find UsagesCtrl+HHierarchyCtrl+F12File Structure: OutlineCtrl(+shift)+wExtend or shrink selectionCtrl+shift+backspaceNavigate -> Previous edit locationCtrl+Shift+VPaste from five previous copiesCtrl+F4Close editorCtrl+alt+left/rightNavigate -> backward/forwardF2/Shift+F2Go to next/previous errorCtrl+GGo to line
Shortcuts for Java Source
Change reformat code from “Ctrl+alt+l” to “Ctrl+alt+shift+f”, as the previous conflicts with Linux Logout shortcut.
Documentation comment block: /** + Enter
Ctrl+F12File structure (outline)Ctrl+Alt+oOrganize import(remove unused and reorder)Ctrl+b (or Ctrl+click)Go to declarationCtrl+alt+bGo to implementationAlt+insertGenerateCtrl+spacebasic auto-completionCtrl+shift+spaceSmart Type CompletionAlt+enterShow intention actionsCtrl+Alt+Shift+InsertCreate Scratch fileCtrl+Shift+TCreate/Navigate to testCtrl+shift+enterComplete current statementCtrl(+Shift)+lAdd/remove line or block commentCtrl+y (y for yes)delete lineCtrl+pParameter infoCtrl+Shift+VPaste from five previous copiesAlt+alt+tSurround with …Ctrl+Alt+jSurround with template
Shortcuts for Refactoring
Ctrl+Alt+(v/c/f/m/p)Extract variable/constant/field/method/parameterF6Move Class (make inner from anonymous, move inner to outer)Shift+F6RenameF5Copy file
Shortcuts for Debugging
F8Step overF7Step intoShift + F7Smart step intoShift + F8Step outAlt + F9Run to cursorAlt + F8Evaluate expressionF9Resume programCtrl + F8Toggle breakpointCtrl + Shift + F8View breakpoints
Mouse Action
See type info: Ctrl and hover mouse over variable/method
Go to definition: Ctrl and click on variable/method
Presentation Mode
Alt+V > Enter Presentation Mode or use double shift or ctrl+shift+a then type “Presentation”.
To exit presentation mode: Alt+V > Exit Presentation Mode.
More tips about shortcuts
Press again for more results
type and search in a tree/list/table
From lifelongprogrammer.blogspot.com
1 note · View note
lifelongprogrammer · 5 years
Link
From http://lifelongprogrammer.blogspot.com/ code{white-space:pre-wrap}span.smallcaps{font-variant:small-caps}span.underline{text-decoration:underline}div.column{display:inline-block;vertical-align:top;width:50%}
Table of Contents
Find action
Quick Lists
Disable Linux Default Shortcuts
Customize Shortcuts
Common shortcuts
Shortcuts for Navigation
Shortcuts for Refactoring
Shortcuts for Debugging
Presentation Mode
More tips about shortcuts
Find action
Use Key Promoter X to learn shortcuts.
Find action by name: Ctrl+shift+a
Manage Projects to open recent projects
Find action by shortcut
Quick Lists
Ctrl+Alt+Shift+T for “Refactor This”
Alt+` for VCS Operations.
Create a quick list “Refactor -> Extract”, add all commands and assign “Ctrl+alt+shit+e” to it.
inlineAds=true;var isMobile=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent);if(!isMobile){document.write("");} else{document.write('');}
Disable Linux Default Shortcuts
Disable the following Linux default shortcuts in System Preferences -> Keyboard -> Shortcut tab:
Disable Ctrl+Alt+S for “Toggle shaded state” at Widnows as it conflicts with Settings.
Disable Ctrl+alt+left/right for “Switch to left/right workspace” as it conflicts with IntelliJ Navigate -> backward/forward.
Disable Ctrl+Alt+T for Launch Terminal at Launchers as it conflicts with “Surround with”
Disable Alt+F7 for Move Window at Windows -> Positioning as it conflicts with Find Usages
Disable Alt+F8 for Resize Window at Windows -> Positioning as it conflicts with Evaluate Expression.
Customize Shortcuts
Some shortcuts in IntelliJ are difficult to remember and use, change them at Settings -> Keymap:
Change reformat code from “Ctrl+alt+l” to “Ctrl+alt+shift+f”, as the previous conflicts with Linux Logout shortcut.
Assign “Editor” -> “Close tab” from “Ctrl+F4” to “Ctrl+w” and unassign it for “extend slection”
Assign “Alt-Shit-+(-)” to increase/decrease font size.
Common shortcuts
Double Shift Search Everywhere Double ctrl Run Anything Open settings Ctrl+Alt+S Alt+1 Toggle Project View Alt+7 Toggle structure View Alt+2 Toggle Favorite View Alt+6 Toggle TODO View Alt+9 Toggle Version Control View Ctrl+shift+left/right/up/down Stretch active window to ..
Alt+1 to focus on project view, then use Ctrl+shift+left(right) to move the separator.
Shortcuts for Navigation
to find directory: ctrl+shif+n for find file: then type “/the_directory_name”
Ctrl+e Recent files, press ctrl+e again to show changed files only Ctrl+shift+e Recent locations, press again to show changed locations only Ctrl+n Find class Ctrl+Shift+N Find File Ctrl+Shift+F Find in path Ctrl+alt+shift+n Find Symbol Ctrl+B, Ctrl+Click Step Into/Show Usages Alf+F7 Find Usages Ctrl+H Hierarchy Ctrl+F12 File Structure: Outline Ctrl(+shift)+w Extend or shrink selection Ctrl+shift+backspace Navigate -> Previous edit location Ctrl+Shift+V Paste from five previous copies Ctrl+F4 Close editor Ctrl+alt+left/right Navigate -> backward/forward F2/Shift+F2 Go to next/previous error Ctrl+G Go to line
Shortcuts for Java Source
Change reformat code from “Ctrl+alt+l” to “Ctrl+alt+shift+f”, as the previous conflicts with Linux Logout shortcut.
Documentation comment block: /** + Enter
Ctrl+F12 File structure (outline) Ctrl+Alt+o Organize import(remove unused and reorder) Ctrl+b (or Ctrl+click) Go to declaration Ctrl+alt+b Go to implementation Alt+insert Generate Ctrl+space basic auto-completion Ctrl+shift+space Smart Type Completion Alt+enter Show intention actions Ctrl+Alt+Shift+Insert Create Scratch file Ctrl+Shift+T Create/Navigate to test Ctrl+shift+enter Complete current statement Ctrl(+Shift)+l Add/remove line or block comment Ctrl+y (y for yes) delete line Ctrl+p Parameter info Ctrl+Shift+V Paste from five previous copies Alt+alt+t Surround with … Ctrl+Alt+j Surround with template
Shortcuts for Refactoring
Ctrl+Alt+(v/c/f/m/p) Extract variable/constant/field/method/parameter F6 Move Class (make inner from anonymous, move inner to outer) Shift+F6 Rename F5 Copy file
Shortcuts for Debugging
F8 Step over F7 Step into Shift + F7 Smart step into Shift + F8 Step out Alt + F9 Run to cursor Alt + F8 Evaluate expression F9 Resume program Ctrl + F8 Toggle breakpoint Ctrl + Shift + F8 View breakpoints
Mouse Action
See type info: Ctrl and hover mouse over variable/method
Go to definition: Ctrl and click on variable/method
Presentation Mode
Alt+V > Enter Presentation Mode or use double shift or ctrl+shift+a then type “Presentation”.
To exit presentation mode: Alt+V > Exit Presentation Mode.
More tips about shortcuts
Press again for more results
type and search in a tree/list/table
0 notes
lifelongprogrammer · 5 years
Text
Mac Settings We should Change
Via http://lifelongprogrammer.blogspot.com/2019/07/mac-settings-we-should-change.html code{white-space:pre-wrap}span.smallcaps{font-variant:small-caps}span.underline{text-decoration:underline}div.column{display:inline-block;vertical-align:top;width:50%}
Table of Contents
Tweak Trackpad
Tweak Dock
Tweak Touch Bar
Turn off iCloud Drive
Preferences > General
Turn screen corners into shortcuts
Install apps downloaded from web:
Series: Awesome Tips about Mac
Tweak Trackpad
The settings is at System Preferences -> Trackpad.
Enable “Tap to click” to make Trackpad less noisy at “Point & Click” tab.
Uncheck “Scroll direction: Natural” at “Scroll & Zoom” tab.
So when we move two figures down in the trackpad, the page goes down. <!– - Tap three fingers to look up in dictionary & data detectors.
Tap two fingers for right click: open context menu. –>
Tweak Dock
Go to System Preference -> Dock: - Enable Automatically show and hide Dock - Disable Show recent applications in Dock
Remove Apps from Dock:
We can use Spotlight(Cmd+Space) to open any application instead of moving mouse and clicking the icon in the dock to open it, so usually it’s no much use to keep apps in the dock when not used.
By default, Apples shows a lot of its apps in the Dock, remove them from the Dock: right click on the icon in the Dock, click Options -> unselect “Keep in Dock”
Move Docker on the right side
By default dock shows at the bottom, so it will auto show a lot by accident.
Go to System Preferences > Dock and choose either Left or Right for Position on Screen
inlineAds=true;var isMobile=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent);if(!isMobile){document.write("<script src='//ap.lijit.com/www/delivery/fpi.js?z=332935&width=728&height=90'><\/script>");} else{document.write('<script src="//ap.lijit.com/www/delivery/fpi.js?z=460172&width=320&height=480"><\/script>');}
Tweak Touch Bar
Go to System Preferences > Keyboard > Customize Control Strip, drag the buttons we want to to the Touch Bar below the display, drap tge buttons we don’t want upward and out of the Touch Bar.
Enable Touch ID
Preferences > Touch ID
Then we can use touch id instead of manually type password
Use Touch ID for sudo
vi nano /etc/pam.d/sudo
add “auth sufficient pam_tid.so” to the top
Remove Siri from the Touch Bar
System Preferences > Keyboard > Customize Control Strip
Highlight the Siri button, click, and drag the Siri button upward and out of the Touch Bar
Disable Siri at Preferences -> Siri
Turn off iCloud Drive
Mac backup files in desktip and Documents folder to iCloud, if we never use iCloud(for me, I use Google Drive to backup files), we can turn it off at System Preferences -> iCloud,
Also turn off “Photos” at System Preferences -> iCloud.
Preferences > General
Turn on Dark Mode at System.
Check “Automatically hide and show the menu bar”
Change “Default web browser” to Chrome.
Turn screen corners into shortcuts
Go to System Preferences -> Desktop & Screen Saver -> click on Screen Saver tab -> click on Hot Corner button at the bottom-right.
Add “Put screen into Sleep” to the top right corner: this is useful when we are playing music, but want to put display into sleep right away to save battery.
Install apps downloaded from web:
System Preferences > Security & Privacy -> at General tab, choose App Store and identified developers for Allow apps downloaded from.
From lifelongprogrammer.blogspot.com
0 notes
lifelongprogrammer · 5 years
Link
From http://lifelongprogrammer.blogspot.com/ code{white-space:pre-wrap}span.smallcaps{font-variant:small-caps}span.underline{text-decoration:underline}div.column{display:inline-block;vertical-align:top;width:50%}
Table of Contents
Tweak Trackpad
Tweak Dock
Tweak Touch Bar
Turn off iCloud Drive
Preferences > General
Turn screen corners into shortcuts
Install apps downloaded from web:
Series: Awesome Tips about Mac
Tweak Trackpad
The settings is at System Preferences -> Trackpad.
Enable “Tap to click” to make Trackpad less noisy at “Point & Click” tab.
Uncheck “Scroll direction: Natural” at “Scroll & Zoom” tab.
So when we move two figures down in the trackpad, the page goes down. <!– - Tap three fingers to look up in dictionary & data detectors.
Tap two fingers for right click: open context menu. –>
Tweak Dock
Go to System Preference -> Dock: - Enable Automatically show and hide Dock - Disable Show recent applications in Dock
Remove Apps from Dock:
We can use Spotlight(Cmd+Space) to open any application instead of moving mouse and clicking the icon in the dock to open it, so usually it’s no much use to keep apps in the dock when not used.
By default, Apples shows a lot of its apps in the Dock, remove them from the Dock: right click on the icon in the Dock, click Options -> unselect “Keep in Dock”
Move Docker on the right side
By default dock shows at the bottom, so it will auto show a lot by accident.
Go to System Preferences > Dock and choose either Left or Right for Position on Screen
inlineAds=true;var isMobile=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent);if(!isMobile){document.write("");} else{document.write('');}
Tweak Touch Bar
Go to System Preferences > Keyboard > Customize Control Strip, drag the buttons we want to to the Touch Bar below the display, drap tge buttons we don’t want upward and out of the Touch Bar.
Enable Touch ID
Preferences > Touch ID
Then we can use touch id instead of manually type password
Use Touch ID for sudo
vi nano /etc/pam.d/sudo
add “auth sufficient pam_tid.so” to the top
Remove Siri from the Touch Bar
System Preferences > Keyboard > Customize Control Strip
Highlight the Siri button, click, and drag the Siri button upward and out of the Touch Bar
Disable Siri at Preferences -> Siri
Turn off iCloud Drive
Mac backup files in desktip and Documents folder to iCloud, if we never use iCloud(for me, I use Google Drive to backup files), we can turn it off at System Preferences -> iCloud,
Also turn off “Photos” at System Preferences -> iCloud.
Preferences > General
Turn on Dark Mode at System.
Check “Automatically hide and show the menu bar”
Change “Default web browser” to Chrome.
Turn screen corners into shortcuts
Go to System Preferences -> Desktop & Screen Saver -> click on Screen Saver tab -> click on Hot Corner button at the bottom-right.
Add “Put screen into Sleep” to the top right corner: this is useful when we are playing music, but want to put display into sleep right away to save battery.
Install apps downloaded from web:
System Preferences > Security & Privacy -> at General tab, choose App Store and identified developers for Allow apps downloaded from.
0 notes
lifelongprogrammer · 5 years
Link
From http://lifelongprogrammer.blogspot.com/ code{white-space:pre-wrap}span.smallcaps{font-variant:small-caps}span.underline{text-decoration:underline}div.column{display:inline-block;vertical-align:top;width:50%}a.sourceLine{display:inline-block;line-height:1.25}a.sourceLine{pointer-events:none;color:inherit;text-decoration:inherit}a.sourceLine:empty{height:1.2em;position:absolute}.sourceCode{overflow:visible}code.sourceCode{white-space:pre;position:relative}div.sourceCode{margin:1em 0}pre.sourceCode{margin:0}@media screen{div.sourceCode{overflow:auto}}@media print{code.sourceCode{white-space:pre-wrap}a.sourceLine{text-indent:-1em;padding-left:1em}}pre.numberSource a.sourceLine{position:relative}pre.numberSource a.sourceLine:empty{position:absolute}pre.numberSource a.sourceLine::before{content:attr(data-line-number);position:absolute;left:-5em;text-align:right;vertical-align:baseline;border:none;pointer-events:all;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:0 4px;width:4em;background-color:#232629;color:#7a7c7d}pre.numberSource{margin-left:3em;border-left:1px solid #7a7c7d;padding-left:4px}div.sourceCode{color:#cfcfc2;background-color:#232629}@media screen{a.sourceLine::before{text-decoration:underline}}code span.{color:#cfcfc2}code span.al{color:#95da4c}code span.an{color:#3f8058}code span.at{color:#2980b9}code span.bn{color:#f67400}code span.bu{color:#7f8c8d}code span.cf{color:#fdbc4b}code span.ch{color:#3daee9}code span.cn{color:#27aeae}code span.co{color:#7a7c7d}code span.cv{color:#7f8c8d}code span.do{color:#a43340}code span.dt{color:#2980b9}code span.dv{color:#f67400}code span.er{color:#da4453}code span.ex{color:#09f}code span.fl{color:#f67400}code span.fu{color:#8e44ad}code span.im{color:#27ae60}code span.in{color:#c45b00}code span.kw{color:#cfcfc2}code span.op{color:#cfcfc2}code span.ot{color:#27ae60}code span.pp{color:#27ae60}code span.re{color:#2980b9}code span.sc{color:#3daee9}code span.ss{color:#da4453}code span.st{color:#f44f4f}code span.va{color:#27aeae}code span.vs{color:#da4453}code span.wa{color:#da4453}
Table of Contents
DevTools Keyboard Shortcuts
Ctrl+Shift+P to Run command
Inject CSS
Network Tab
Sources Tab
Elements tab
Console tab
Other Chrome DevTools Tips
Awesome Tips about Chrome Series
DevTools Keyboard Shortcuts
Ctrl+Option+I Open whatever panel you used last Ctrl+[(or ]) Focus the previous(next) panel Ctrl+Shift+P Run command
Ctrl+Shift+P to Run command
Capture screenshot, Capture area screenshot: useful when your company blocks Chrome screenshot extension.
inlineAds=true;var isMobile=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent);if(!isMobile){document.write("");} else{document.write('');}
Inject CSS
At console: document.head.insertAdjacentHTML('beforeend','<style></style>');
Network Tab
Search all response bodies in network tab
“Preserve log” on navigation
Copy image as data URI
Sources Tab
Ctrl+Shift+F to search source code
Pretty print {}
Find loaded content scripts at source tab
Set XHR/fetch breakpoints to check who sends the request
Add breakpoints at source code
Trigger a breakpoint when an exception occurs
Add Conditional breakpoints
Add Event breakpoints
Add debugger; in the code to trigger programmatic breakpoints
Add an expression to the watch list
Add debug snippets
Shortcuts in the Sources panel:
ctrl+o show all the files loaded by the page. ctrl+shift+o show the symbols(properties,functions,classes) in the current file. ctrl+g go to a specific line
Elements tab
Break on -> subtree modifications
Edit as HTML
Drag and Drop any HTML element
Scroll into view
Force state
ctrl-click a CSS property to find where it’s defined.
Copy XPath or selector from Elements panel
Alt+Click the arrow to expand all child nodes.
Console tab
Preserve log on navigation
At the console tab, click the settings icon on the top right:
Tumblr media
document.designMode = 'on' to change anything in the page
$0 in console refers to the currently selected node
$(css_selector): document.querySelector()
$$(css_selector): document.querySelectorAll()
$_ to reference the return value of the previous operation executed
shift+enter to span command in multiple lines
ctrl+l(cmd+k on Mac) to clear console
Other Chrome DevTools Tips
Check Enable Ctrl + 1-9 shortcut to switch panels at DevTools Settings -> Appearance
Change DevTools position
0 notes
lifelongprogrammer · 5 years
Text
Must-Know Chrome DevTools Tips and Tricks
Via http://lifelongprogrammer.blogspot.com/2019/07/must-know-chrome-devtools-tips-and-tricks.html code{white-space:pre-wrap}span.smallcaps{font-variant:small-caps}span.underline{text-decoration:underline}div.column{display:inline-block;vertical-align:top;width:50%}a.sourceLine{display:inline-block;line-height:1.25}a.sourceLine{pointer-events:none;color:inherit;text-decoration:inherit}a.sourceLine:empty{height:1.2em;position:absolute}.sourceCode{overflow:visible}code.sourceCode{white-space:pre;position:relative}div.sourceCode{margin:1em 0}pre.sourceCode{margin:0}@media screen{div.sourceCode{overflow:auto}}@media print{code.sourceCode{white-space:pre-wrap}a.sourceLine{text-indent:-1em;padding-left:1em}}pre.numberSource a.sourceLine{position:relative}pre.numberSource a.sourceLine:empty{position:absolute}pre.numberSource a.sourceLine::before{content:attr(data-line-number);position:absolute;left:-5em;text-align:right;vertical-align:baseline;border:none;pointer-events:all;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:0 4px;width:4em;background-color:#232629;color:#7a7c7d}pre.numberSource{margin-left:3em;border-left:1px solid #7a7c7d;padding-left:4px}div.sourceCode{color:#cfcfc2;background-color:#232629}@media screen{a.sourceLine::before{text-decoration:underline}}code span.{color:#cfcfc2}code span.al{color:#95da4c}code span.an{color:#3f8058}code span.at{color:#2980b9}code span.bn{color:#f67400}code span.bu{color:#7f8c8d}code span.cf{color:#fdbc4b}code span.ch{color:#3daee9}code span.cn{color:#27aeae}code span.co{color:#7a7c7d}code span.cv{color:#7f8c8d}code span.do{color:#a43340}code span.dt{color:#2980b9}code span.dv{color:#f67400}code span.er{color:#da4453}code span.ex{color:#09f}code span.fl{color:#f67400}code span.fu{color:#8e44ad}code span.im{color:#27ae60}code span.in{color:#c45b00}code span.kw{color:#cfcfc2}code span.op{color:#cfcfc2}code span.ot{color:#27ae60}code span.pp{color:#27ae60}code span.re{color:#2980b9}code span.sc{color:#3daee9}code span.ss{color:#da4453}code span.st{color:#f44f4f}code span.va{color:#27aeae}code span.vs{color:#da4453}code span.wa{color:#da4453}
Table of Contents
DevTools Keyboard Shortcuts
Ctrl+Shift+P to Run command
Inject CSS
Network Tab
Sources Tab
Elements tab
Console tab
Other Chrome DevTools Tips
Awesome Tips about Chrome Series
DevTools Keyboard Shortcuts
Ctrl+Option+IOpen whatever panel you used lastCtrl+[(or ])Focus the previous(next) panelCtrl+Shift+PRun command
Ctrl+Shift+P to Run command
Capture screenshot, Capture area screenshot: useful when your company blocks Chrome screenshot extension.
inlineAds=true;var isMobile=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent);if(!isMobile){document.write("<script src='//ap.lijit.com/www/delivery/fpi.js?z=332935&width=728&height=90'><\/script>");} else{document.write('<script src="//ap.lijit.com/www/delivery/fpi.js?z=460172&width=320&height=480"><\/script>');}
Inject CSS
At console: document.head.insertAdjacentHTML('beforeend','<style></style>');
Network Tab
Search all response bodies in network tab
“Preserve log” on navigation
Copy image as data URI
Sources Tab
Ctrl+Shift+F to search source code
Pretty print {}
Find loaded content scripts at source tab
Set XHR/fetch breakpoints to check who sends the request
Add breakpoints at source code
Trigger a breakpoint when an exception occurs
Add Conditional breakpoints
Add Event breakpoints
Add debugger; in the code to trigger programmatic breakpoints
Add an expression to the watch list
Add debug snippets
Shortcuts in the Sources panel:
ctrl+oshow all the files loaded by the page.ctrl+shift+oshow the symbols(properties,functions,classes) in the current file.ctrl+ggo to a specific line
Elements tab
Break on -> subtree modifications
Edit as HTML
Drag and Drop any HTML element
Scroll into view
Force state
ctrl-click a CSS property to find where it’s defined.
Copy XPath or selector from Elements panel
Alt+Click the arrow to expand all child nodes.
Console tab
Preserve log on navigation
At the console tab, click the settings icon on the top right:
Tumblr media
document.designMode = 'on' to change anything in the page
$0 in console refers to the currently selected node
$(css_selector): document.querySelector()
$$(css_selector): document.querySelectorAll()
$_ to reference the return value of the previous operation executed
shift+enter to span command in multiple lines
ctrl+l(cmd+k on Mac) to clear console
Other Chrome DevTools Tips
Check Enable Ctrl + 1-9 shortcut to switch panels at DevTools Settings -> Appearance
Change DevTools position
From lifelongprogrammer.blogspot.com
0 notes
lifelongprogrammer · 5 years
Link
From http://lifelongprogrammer.blogspot.com/ code{white-space:pre-wrap}span.smallcaps{font-variant:small-caps}span.underline{text-decoration:underline}div.column{display:inline-block;vertical-align:top;width:50%}a.sourceLine{display:inline-block;line-height:1.25}a.sourceLine{pointer-events:none;color:inherit;text-decoration:inherit}a.sourceLine:empty{height:1.2em;position:absolute}.sourceCode{overflow:visible}code.sourceCode{white-space:pre;position:relative}div.sourceCode{margin:1em 0}pre.sourceCode{margin:0}@media screen{div.sourceCode{overflow:auto}}@media print{code.sourceCode{white-space:pre-wrap}a.sourceLine{text-indent:-1em;padding-left:1em}}pre.numberSource a.sourceLine{position:relative}pre.numberSource a.sourceLine:empty{position:absolute}pre.numberSource a.sourceLine::before{content:attr(data-line-number);position:absolute;left:-5em;text-align:right;vertical-align:baseline;border:none;pointer-events:all;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:0 4px;width:4em;background-color:#232629;color:#7a7c7d}pre.numberSource{margin-left:3em;border-left:1px solid #7a7c7d;padding-left:4px}div.sourceCode{color:#cfcfc2;background-color:#232629}@media screen{a.sourceLine::before{text-decoration:underline}}code span.{color:#cfcfc2}code span.al{color:#95da4c}code span.an{color:#3f8058}code span.at{color:#2980b9}code span.bn{color:#f67400}code span.bu{color:#7f8c8d}code span.cf{color:#fdbc4b}code span.ch{color:#3daee9}code span.cn{color:#27aeae}code span.co{color:#7a7c7d}code span.cv{color:#7f8c8d}code span.do{color:#a43340}code span.dt{color:#2980b9}code span.dv{color:#f67400}code span.er{color:#da4453}code span.ex{color:#09f}code span.fl{color:#f67400}code span.fu{color:#8e44ad}code span.im{color:#27ae60}code span.in{color:#c45b00}code span.kw{color:#cfcfc2}code span.op{color:#cfcfc2}code span.ot{color:#27ae60}code span.pp{color:#27ae60}code span.re{color:#2980b9}code span.sc{color:#3daee9}code span.ss{color:#da4453}code span.st{color:#f44f4f}code span.va{color:#27aeae}code span.vs{color:#da4453}code span.wa{color:#da4453}
Table of Contents
Frequently accessed directories
Command Shortcuts
Compatible with commands from other OS
UNIX Command Options
Control Bash History
SSH Hosts
.bashrc vs .bash_profile
Frequently accessed directories
export blog=/usr/local/google/home/jefferyyuan/jeffery/doc/blog alias cdb="cd /usr/local/google/home/jefferyyuan/jeffery/doc/blog" alias gdrive='cd ~/Google\ Drive' alias ..='cd ..' alias ...='cd ..; cd ..' alias ....='cd ..; cd ..; cd ..' alias .4='cd ../../../../' alias .5='cd ../../../../..'
Command Shortcuts
alias open=xdg-open alias atb=atom-beta alias markdownToHtml=/home/jefferyyuan/jeffery/doc/blog/resource/script/markdownToHtml.sh alias q=exit alias c=clear alias grep='grep --color=auto' alias egrep='egrep --color=auto' alias fgrep='fgrep --color=auto' alias ping='ping -c 5' alias bashrc='atb ~/.bashrc' alias reloadbash='source ~/.bashrc' alias pserver='python -m SimpleHTTPServer 8000'
inlineAds=true
Compatible with commands from other OS
If we have scripts that were originated written for MacOS, now we want to run it in another Linux System: for example, Debian. Some commands like “pbcopy and pbpaste” are only available in Mac. We can change the code to detect which command it should use like below:
pb() { if ! type "pbcopy" > /dev/null; then pbcopy else xsel --clipboard --input fi }
Or we can just define alias in .bashrc:
function pbcopy () { xsel --clipboard --input "$@" } function pbpaste () { xsel --clipboard --output "$@" }
UNIX Command Options
# Let there be color in grep! export GREP_OPTIONS=' — color=auto' # Set Atom-Beta as the default editor export EDITOR="atom-beta --wait" # http://bashrcgenerator.com/ # only show current directory export PS1="\w \[$(tput sgr0)\]"
Control Bash History
# the number of lines or commands stored in memory in a history list while your bash session is ongoing. HISTFILESIZE=1000000 HISTSIZE=1000000 # ignorespace and ignoredups HISTCONTROL=ignoreboth # Add Date and Time to history export HISTTIMEFORMAT="%h %d %H:%M:%S " # append history instead of rewriting it shopt -s histappend # use one command per line shopt -s cmdhist # store history immediately PROMPT_COMMAND='history -a'
SSH Hosts
alias sshmycloud='ssh <insert whatever here>'
.bashrc vs .bash_profile
.bash_profile: runs when user logins in the shell
.bashrc: runs every time when user opens a new terminal
Mac OS X’s Terminal runs a login shell by default for each new terminal window
0 notes
lifelongprogrammer · 5 years
Text
The Awesome .bashrc File
Via http://lifelongprogrammer.blogspot.com/2019/07/the-awesome-bashrc-file.html code{white-space:pre-wrap}span.smallcaps{font-variant:small-caps}span.underline{text-decoration:underline}div.column{display:inline-block;vertical-align:top;width:50%}a.sourceLine{display:inline-block;line-height:1.25}a.sourceLine{pointer-events:none;color:inherit;text-decoration:inherit}a.sourceLine:empty{height:1.2em;position:absolute}.sourceCode{overflow:visible}code.sourceCode{white-space:pre;position:relative}div.sourceCode{margin:1em 0}pre.sourceCode{margin:0}@media screen{div.sourceCode{overflow:auto}}@media print{code.sourceCode{white-space:pre-wrap}a.sourceLine{text-indent:-1em;padding-left:1em}}pre.numberSource a.sourceLine{position:relative}pre.numberSource a.sourceLine:empty{position:absolute}pre.numberSource a.sourceLine::before{content:attr(data-line-number);position:absolute;left:-5em;text-align:right;vertical-align:baseline;border:none;pointer-events:all;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:0 4px;width:4em;background-color:#232629;color:#7a7c7d}pre.numberSource{margin-left:3em;border-left:1px solid #7a7c7d;padding-left:4px}div.sourceCode{color:#cfcfc2;background-color:#232629}@media screen{a.sourceLine::before{text-decoration:underline}}code span.{color:#cfcfc2}code span.al{color:#95da4c}code span.an{color:#3f8058}code span.at{color:#2980b9}code span.bn{color:#f67400}code span.bu{color:#7f8c8d}code span.cf{color:#fdbc4b}code span.ch{color:#3daee9}code span.cn{color:#27aeae}code span.co{color:#7a7c7d}code span.cv{color:#7f8c8d}code span.do{color:#a43340}code span.dt{color:#2980b9}code span.dv{color:#f67400}code span.er{color:#da4453}code span.ex{color:#09f}code span.fl{color:#f67400}code span.fu{color:#8e44ad}code span.im{color:#27ae60}code span.in{color:#c45b00}code span.kw{color:#cfcfc2}code span.op{color:#cfcfc2}code span.ot{color:#27ae60}code span.pp{color:#27ae60}code span.re{color:#2980b9}code span.sc{color:#3daee9}code span.ss{color:#da4453}code span.st{color:#f44f4f}code span.va{color:#27aeae}code span.vs{color:#da4453}code span.wa{color:#da4453}
Table of Contents
Frequently accessed directories
Command Shortcuts
Compatible with commands from other OS
UNIX Command Options
Control Bash History
SSH Hosts
.bashrc vs .bash_profile
Frequently accessed directories
export blog=/usr/local/google/home/jefferyyuan/jeffery/doc/blog alias cdb="cd /usr/local/google/home/jefferyyuan/jeffery/doc/blog" alias gdrive='cd ~/Google\ Drive' alias ..='cd ..' alias ...='cd ..; cd ..' alias ....='cd ..; cd ..; cd ..' alias .4='cd ../../../../' alias .5='cd ../../../../..'
Command Shortcuts
alias open=xdg-open alias atb=atom-beta alias markdownToHtml=/home/jefferyyuan/jeffery/doc/blog/resource/script/markdownToHtml.sh alias q=exit alias c=clear alias grep='grep --color=auto' alias egrep='egrep --color=auto' alias fgrep='fgrep --color=auto' alias ping='ping -c 5' alias bashrc='atb ~/.bashrc' alias reloadbash='source ~/.bashrc' alias pserver='python -m SimpleHTTPServer 8000'
inlineAds=true
Compatible with commands from other OS
If we have scripts that were originated written for MacOS, now we want to run it in another Linux System: for example, Debian. Some commands like “pbcopy and pbpaste” are only available in Mac. We can change the code to detect which command it should use like below:
pb() { if ! type "pbcopy" > /dev/null; then pbcopy else xsel --clipboard --input fi }
Or we can just define alias in .bashrc:
function pbcopy () { xsel --clipboard --input "$@" } function pbpaste () { xsel --clipboard --output "$@" }
UNIX Command Options
# Let there be color in grep! export GREP_OPTIONS=' — color=auto' # Set Atom-Beta as the default editor export EDITOR="atom-beta --wait" # http://bashrcgenerator.com/ # only show current directory export PS1="\w \[$(tput sgr0)\]"
Control Bash History
# the number of lines or commands stored in memory in a history list while your bash session is ongoing. HISTFILESIZE=1000000 HISTSIZE=1000000 # ignorespace and ignoredups HISTCONTROL=ignoreboth # Add Date and Time to history export HISTTIMEFORMAT="%h %d %H:%M:%S " # append history instead of rewriting it shopt -s histappend # use one command per line shopt -s cmdhist # store history immediately PROMPT_COMMAND='history -a'
SSH Hosts
alias sshmycloud='ssh <insert whatever here>'
.bashrc vs .bash_profile
.bash_profile: runs when user logins in the shell
.bashrc: runs every time when user opens a new terminal
Mac OS X’s Terminal runs a login shell by default for each new terminal window
From lifelongprogrammer.blogspot.com
0 notes
lifelongprogrammer · 5 years
Link
From http://lifelongprogrammer.blogspot.com/ code{white-space:pre-wrap}span.smallcaps{font-variant:small-caps}span.underline{text-decoration:underline}div.column{display:inline-block;vertical-align:top;width:50%}a.sourceLine{display:inline-block;line-height:1.25}a.sourceLine{pointer-events:none;color:inherit;text-decoration:inherit}a.sourceLine:empty{height:1.2em;position:absolute}.sourceCode{overflow:visible}code.sourceCode{white-space:pre;position:relative}div.sourceCode{margin:1em 0}pre.sourceCode{margin:0}@media screen{div.sourceCode{overflow:auto}}@media print{code.sourceCode{white-space:pre-wrap}a.sourceLine{text-indent:-1em;padding-left:1em}}pre.numberSource a.sourceLine{position:relative}pre.numberSource a.sourceLine:empty{position:absolute}pre.numberSource a.sourceLine::before{content:attr(data-line-number);position:absolute;left:-5em;text-align:right;vertical-align:baseline;border:none;pointer-events:all;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:0 4px;width:4em;background-color:#232629;color:#7a7c7d}pre.numberSource{margin-left:3em;border-left:1px solid #7a7c7d;padding-left:4px}div.sourceCode{color:#cfcfc2;background-color:#232629}@media screen{a.sourceLine::before{text-decoration:underline}}code span.{color:#cfcfc2}code span.al{color:#95da4c}code span.an{color:#3f8058}code span.at{color:#2980b9}code span.bn{color:#f67400}code span.bu{color:#7f8c8d}code span.cf{color:#fdbc4b}code span.ch{color:#3daee9}code span.cn{color:#27aeae}code span.co{color:#7a7c7d}code span.cv{color:#7f8c8d}code span.do{color:#a43340}code span.dt{color:#2980b9}code span.dv{color:#f67400}code span.er{color:#da4453}code span.ex{color:#09f}code span.fl{color:#f67400}code span.fu{color:#8e44ad}code span.im{color:#27ae60}code span.in{color:#c45b00}code span.kw{color:#cfcfc2}code span.op{color:#cfcfc2}code span.ot{color:#27ae60}code span.pp{color:#27ae60}code span.re{color:#2980b9}code span.sc{color:#3daee9}code span.ss{color:#da4453}code span.st{color:#f44f4f}code span.va{color:#27aeae}code span.vs{color:#da4453}code span.wa{color:#da4453}
Table of Contents
Change Mouse Scroll Speed
Swap mouse left, right buttons
Change Mouse Scroll Speed
Install imwheel: sudo apt-get install imwheel
Create ~/.imwheelrc with content:
".*" None, Up, Up, 5 None, Down, Down, 5
Start imwheel in the command line
Add imwheel into the startup applications.
Swap mouse left, right buttons
Sometimes, the mouse’s left/right buttons are swapped by accident or some program bugs, we would like to change it back.
install xinput: sudo apt-get install xinput
xinput --list to check the device id of the mouse.
xinput --set-button-map ${device_id} 3 2 1 or xinput --set-button-map ${device_id} 1 2 3 to swap left and right button.
xinput get-button-map ${device_id} to check the mapping
0 notes
lifelongprogrammer · 5 years
Text
How to Customize Mouse in Linux
Via http://lifelongprogrammer.blogspot.com/2019/07/how-to-customize-mouse-in-linux.html code{white-space:pre-wrap}span.smallcaps{font-variant:small-caps}span.underline{text-decoration:underline}div.column{display:inline-block;vertical-align:top;width:50%}a.sourceLine{display:inline-block;line-height:1.25}a.sourceLine{pointer-events:none;color:inherit;text-decoration:inherit}a.sourceLine:empty{height:1.2em;position:absolute}.sourceCode{overflow:visible}code.sourceCode{white-space:pre;position:relative}div.sourceCode{margin:1em 0}pre.sourceCode{margin:0}@media screen{div.sourceCode{overflow:auto}}@media print{code.sourceCode{white-space:pre-wrap}a.sourceLine{text-indent:-1em;padding-left:1em}}pre.numberSource a.sourceLine{position:relative}pre.numberSource a.sourceLine:empty{position:absolute}pre.numberSource a.sourceLine::before{content:attr(data-line-number);position:absolute;left:-5em;text-align:right;vertical-align:baseline;border:none;pointer-events:all;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:0 4px;width:4em;background-color:#232629;color:#7a7c7d}pre.numberSource{margin-left:3em;border-left:1px solid #7a7c7d;padding-left:4px}div.sourceCode{color:#cfcfc2;background-color:#232629}@media screen{a.sourceLine::before{text-decoration:underline}}code span.{color:#cfcfc2}code span.al{color:#95da4c}code span.an{color:#3f8058}code span.at{color:#2980b9}code span.bn{color:#f67400}code span.bu{color:#7f8c8d}code span.cf{color:#fdbc4b}code span.ch{color:#3daee9}code span.cn{color:#27aeae}code span.co{color:#7a7c7d}code span.cv{color:#7f8c8d}code span.do{color:#a43340}code span.dt{color:#2980b9}code span.dv{color:#f67400}code span.er{color:#da4453}code span.ex{color:#09f}code span.fl{color:#f67400}code span.fu{color:#8e44ad}code span.im{color:#27ae60}code span.in{color:#c45b00}code span.kw{color:#cfcfc2}code span.op{color:#cfcfc2}code span.ot{color:#27ae60}code span.pp{color:#27ae60}code span.re{color:#2980b9}code span.sc{color:#3daee9}code span.ss{color:#da4453}code span.st{color:#f44f4f}code span.va{color:#27aeae}code span.vs{color:#da4453}code span.wa{color:#da4453}
Table of Contents
Change Mouse Scroll Speed
Swap mouse left, right buttons
Change Mouse Scroll Speed
Install imwheel: sudo apt-get install imwheel
Create ~/.imwheelrc with content:
".*" None, Up, Up, 5 None, Down, Down, 5
Start imwheel in the command line
Add imwheel into the startup applications.
Swap mouse left, right buttons
Sometimes, the mouse’s left/right buttons are swapped by accident or some program bugs, we would like to change it back.
install xinput: sudo apt-get install xinput
xinput --list to check the device id of the mouse.
xinput --set-button-map ${device_id} 3 2 1 or xinput --set-button-map ${device_id} 1 2 3 to swap left and right button.
xinput get-button-map ${device_id} to check the mapping
From lifelongprogrammer.blogspot.com
0 notes
lifelongprogrammer · 5 years
Link
From http://lifelongprogrammer.blogspot.com/ code{white-space:pre-wrap}span.smallcaps{font-variant:small-caps}span.underline{text-decoration:underline}div.column{display:inline-block;vertical-align:top;width:50%}code.sourceCode>span{display:inline-block;line-height:1.25}code.sourceCode>span{color:inherit;text-decoration:inherit}code.sourceCode>span:empty{height:1.2em}.sourceCode{overflow:visible}code.sourceCode{white-space:pre;position:relative}div.sourceCode{margin:1em 0}pre.sourceCode{margin:0}@media screen{div.sourceCode{overflow:auto}}@media print{code.sourceCode{white-space:pre-wrap}code.sourceCode>span{text-indent:-5em;padding-left:5em}}pre.numberSource code{counter-reset:source-line 0}pre.numberSource code>span{position:relative;left:-4em;counter-increment:source-line}pre.numberSource code>span>a:first-child::before{content:counter(source-line);position:relative;left:-1em;text-align:right;vertical-align:baseline;border:none;display:inline-block;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:0 4px;width:4em;background-color:#232629;color:#7a7c7d}pre.numberSource{margin-left:3em;border-left:1px solid #7a7c7d;padding-left:4px}div.sourceCode{color:#cfcfc2;background-color:#232629}@media screen{code.sourceCode>span>a:first-child::before{text-decoration:underline}}code span.{color:#cfcfc2}code span.al{color:#95da4c}code span.an{color:#3f8058}code span.at{color:#2980b9}code span.bn{color:#f67400}code span.bu{color:#7f8c8d}code span.cf{color:#fdbc4b}code span.ch{color:#3daee9}code span.cn{color:#27aeae}code span.co{color:#7a7c7d}code span.cv{color:#7f8c8d}code span.do{color:#a43340}code span.dt{color:#2980b9}code span.dv{color:#f67400}code span.er{color:#da4453}code span.ex{color:#09f}code span.fl{color:#f67400}code span.fu{color:#8e44ad}code span.im{color:#27ae60}code span.in{color:#c45b00}code span.kw{color:#cfcfc2}code span.op{color:#cfcfc2}code span.ot{color:#27ae60}code span.pp{color:#27ae60}code span.re{color:#2980b9}code span.sc{color:#3daee9}code span.ss{color:#da4453}code span.st{color:#f44f4f}code span.va{color:#27aeae}code span.vs{color:#da4453}code span.wa{color:#da4453}
Table of Contents
Maximize Finder Window Size with Relaunch
Change Default Finder Window other than default “Recents”
Search Current Folder instead of “This Mac”
Customize the sidebar
Show Path Bar
Customize the Toolbar
Quick Look
Hold Option Key while Click
Everything about File or Folder Path on Mac
Show Me More Info: Filename Extension and Hidden Files
Reveal Files in Finder in Spotlight
Search, Saved Search(Smart Folder)
More Tips for Mac Finder
Finder Shortcuts We Should Know
Series: Awesome Tips about Mac
Maximize Finder Window Size with Relaunch
The default Finder window size is way too small.
Keep only one finder window: as when Finder opens a new window, it uses the last accessed window size, if there are multiple windows, it’s hard to tell which one Finder uses as the template.
Adjust the finder window size
If you keep the Dock at the bottom, don’t take the whole bottom of the screen, as it may conflict with the Docker: when we want to click “Path bar” at the bottom, it will accidentally show the Docker.
Or we can move dock to the right side: at System Preference -> Dock, look for Positions on Screen and choose right.
Relaunch Finder
Go to Apple menu -> Force Quit: (or Command+Option+Esc) to kill finder, Mac will relaunch Finder automatically.
or click Alt(Option) key first then right click on the Finder in the docker, then click “Relaunch”
Change Default Finder Window other than default “Recents”
When we open a new finder, it opens “Recents” smart folder, but in most cases, we want to go to some folder, don’t really care about recently added files. We can change the default folder to our frequently accessed folder at the General pane of Finder -> Preferences: for example the home folder, or the master folder that we hold all our files in work.
inlineAds=true
Search Current Folder instead of “This Mac”
At Preference -> Advanced tab, find “When performing a search:” at the bottom and choose Search the Current Folder.
Customize the sidebar
At Preference -> Sidebar tab, choose what to show and hide in sidebar.
Command+Ctrl+T(or drag) to add frequently accessed folders to the sidebar.
Show Path Bar
Show the Current Path the the bottom: Go to View menu > check Show Path Bar When we right click on any folder in the path bar, then for any folder, we can Copy xx as Pathname, “Open in new Tab”, “Show in Enclosing Folder”(go to that folder in current tab), “Get info”.
Customize the Toolbar
Go fo Finder -> View -> choose “Customize the toolbar”, we can add “Get info”, “New Folder” buttons.
Quick Look
Select one or more items then press the Space bar, use left, right to go to previous or next.
Press Option key when press space to quick look in full-size.
Hold Option Key while Click
In the right context menu, press Option key would: - Change “Copy xxx” to “Copy xxx as Pathname” - Change “Open with” to “Always Open with” - Change “Quick Look x items” to “Slideshow x items”
Everything about File or Folder Path on Mac
Check here for how to quickly copy file path or use shortcut to open (parent) folder in iTerm2(or Terminal)
Show Me More Info: Filename Extension and Hidden Files
Check “Show all filename extension” at Advanced tab from Finder’s Preference.
Show hidden files
Run defaults write com.apple.finder AppleShowAllFiles -bool YES && killall Finder at Terminal.
Reveal Files in Finder in Spotlight
When search in Spotlight, use the arrow keys to select file: - hold Command key(⌘) would show the file path - hold Command key(⌘) while press enter would show the file in Finder
Search, Saved Search(Smart Folder)
During search, we can specify conditions like: kind, file extension, created date, modified date, last opened date, and much more. We can directly delete files in search result. We can save the search as smart folder and add them into side bar for easy access.
More Tips for Mac Finder
We can lock a file by right clicking a file -> Get info -> select Locked.
Command+delete to delete files
Actions on multiple files
After select multiple files, we can copy, rename, quick look, slideshow, compress them, put them into new folder.
Cmd-C then Opt-Cmd-V to Cut a File
It only works for files, not folder.
Finder Shortcuts We Should Know
Command + N(T) New Finder Window(tab) Shift + Command + N New folder Command + Delete Move selected item to trash Command + D Duplicate selected files Control + Command + T Add selected item to sidebar Command + O Open selected item Command + Down Arrow In list view, opens the selected folder Command + Up Arrow Go to enclosing folder Command + 1(2,3,4) View as icons(list, column, cover flow) Command + Right(left) Arrow In list view, expands(collapses) the highlighted folder Command + [(]) Go back(forward) to previous location Command+Shift+G Go To Folder
0 notes
lifelongprogrammer · 5 years
Text
Mac Finder Tips and Tricks
Via http://lifelongprogrammer.blogspot.com/2019/07/mac-finder-tips-and-tricks.html code{white-space:pre-wrap}span.smallcaps{font-variant:small-caps}span.underline{text-decoration:underline}div.column{display:inline-block;vertical-align:top;width:50%}code.sourceCode>span{display:inline-block;line-height:1.25}code.sourceCode>span{color:inherit;text-decoration:inherit}code.sourceCode>span:empty{height:1.2em}.sourceCode{overflow:visible}code.sourceCode{white-space:pre;position:relative}div.sourceCode{margin:1em 0}pre.sourceCode{margin:0}@media screen{div.sourceCode{overflow:auto}}@media print{code.sourceCode{white-space:pre-wrap}code.sourceCode>span{text-indent:-5em;padding-left:5em}}pre.numberSource code{counter-reset:source-line 0}pre.numberSource code>span{position:relative;left:-4em;counter-increment:source-line}pre.numberSource code>span>a:first-child::before{content:counter(source-line);position:relative;left:-1em;text-align:right;vertical-align:baseline;border:none;display:inline-block;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:0 4px;width:4em;background-color:#232629;color:#7a7c7d}pre.numberSource{margin-left:3em;border-left:1px solid #7a7c7d;padding-left:4px}div.sourceCode{color:#cfcfc2;background-color:#232629}@media screen{code.sourceCode>span>a:first-child::before{text-decoration:underline}}code span.{color:#cfcfc2}code span.al{color:#95da4c}code span.an{color:#3f8058}code span.at{color:#2980b9}code span.bn{color:#f67400}code span.bu{color:#7f8c8d}code span.cf{color:#fdbc4b}code span.ch{color:#3daee9}code span.cn{color:#27aeae}code span.co{color:#7a7c7d}code span.cv{color:#7f8c8d}code span.do{color:#a43340}code span.dt{color:#2980b9}code span.dv{color:#f67400}code span.er{color:#da4453}code span.ex{color:#09f}code span.fl{color:#f67400}code span.fu{color:#8e44ad}code span.im{color:#27ae60}code span.in{color:#c45b00}code span.kw{color:#cfcfc2}code span.op{color:#cfcfc2}code span.ot{color:#27ae60}code span.pp{color:#27ae60}code span.re{color:#2980b9}code span.sc{color:#3daee9}code span.ss{color:#da4453}code span.st{color:#f44f4f}code span.va{color:#27aeae}code span.vs{color:#da4453}code span.wa{color:#da4453}
Table of Contents
Maximize Finder Window Size with Relaunch
Change Default Finder Window other than default “Recents”
Search Current Folder instead of “This Mac”
Customize the sidebar
Show Path Bar
Customize the Toolbar
Quick Look
Hold Option Key while Click
Everything about File or Folder Path on Mac
Show Me More Info: Filename Extension and Hidden Files
Reveal Files in Finder in Spotlight
Search, Saved Search(Smart Folder)
More Tips for Mac Finder
Finder Shortcuts We Should Know
Series: Awesome Tips about Mac
Maximize Finder Window Size with Relaunch
The default Finder window size is way too small.
Keep only one finder window: as when Finder opens a new window, it uses the last accessed window size, if there are multiple windows, it’s hard to tell which one Finder uses as the template.
Adjust the finder window size
If you keep the Dock at the bottom, don’t take the whole bottom of the screen, as it may conflict with the Docker: when we want to click “Path bar” at the bottom, it will accidentally show the Docker.
Or we can move dock to the right side: at System Preference -> Dock, look for Positions on Screen and choose right.
Relaunch Finder
Go to Apple menu -> Force Quit: (or Command+Option+Esc) to kill finder, Mac will relaunch Finder automatically.
or click Alt(Option) key first then right click on the Finder in the docker, then click “Relaunch”
Change Default Finder Window other than default “Recents”
When we open a new finder, it opens “Recents” smart folder, but in most cases, we want to go to some folder, don’t really care about recently added files. We can change the default folder to our frequently accessed folder at the General pane of Finder -> Preferences: for example the home folder, or the master folder that we hold all our files in work.
inlineAds=true
Search Current Folder instead of “This Mac”
At Preference -> Advanced tab, find “When performing a search:” at the bottom and choose Search the Current Folder.
Customize the sidebar
At Preference -> Sidebar tab, choose what to show and hide in sidebar.
Command+Ctrl+T(or drag) to add frequently accessed folders to the sidebar.
Show Path Bar
Show the Current Path the the bottom: Go to View menu > check Show Path Bar When we right click on any folder in the path bar, then for any folder, we can Copy xx as Pathname, “Open in new Tab”, “Show in Enclosing Folder”(go to that folder in current tab), “Get info”.
Customize the Toolbar
Go fo Finder -> View -> choose “Customize the toolbar”, we can add “Get info”, “New Folder” buttons.
Quick Look
Select one or more items then press the Space bar, use left, right to go to previous or next.
Press Option key when press space to quick look in full-size.
Hold Option Key while Click
In the right context menu, press Option key would: - Change “Copy xxx” to “Copy xxx as Pathname” - Change “Open with” to “Always Open with” - Change “Quick Look x items” to “Slideshow x items”
Everything about File or Folder Path on Mac
Check here for how to quickly copy file path or use shortcut to open (parent) folder in iTerm2(or Terminal)
Show Me More Info: Filename Extension and Hidden Files
Check “Show all filename extension” at Advanced tab from Finder’s Preference.
Show hidden files
Run defaults write com.apple.finder AppleShowAllFiles -bool YES && killall Finder at Terminal.
Reveal Files in Finder in Spotlight
When search in Spotlight, use the arrow keys to select file: - hold Command key(⌘) would show the file path - hold Command key(⌘) while press enter would show the file in Finder
Search, Saved Search(Smart Folder)
During search, we can specify conditions like: kind, file extension, created date, modified date, last opened date, and much more. We can directly delete files in search result. We can save the search as smart folder and add them into side bar for easy access.
More Tips for Mac Finder
We can lock a file by right clicking a file -> Get info -> select Locked.
Command+delete to delete files
Actions on multiple files
After select multiple files, we can copy, rename, quick look, slideshow, compress them, put them into new folder.
Cmd-C then Opt-Cmd-V to Cut a File
It only works for files, not folder.
Finder Shortcuts We Should Know
Command + N(T)New Finder Window(tab)Shift + Command + NNew folderCommand + DeleteMove selected item to trashCommand + DDuplicate selected filesControl + Command + TAdd selected item to sidebarCommand + OOpen selected itemCommand + Down ArrowIn list view, opens the selected folderCommand + Up ArrowGo to enclosing folderCommand + 1(2,3,4)View as icons(list, column, cover flow)Command + Right(left) ArrowIn list view, expands(collapses) the highlighted folderCommand + [(])Go back(forward) to previous locationCommand+Shift+GGo To Folder
From lifelongprogrammer.blogspot.com
0 notes
lifelongprogrammer · 5 years
Link
From http://lifelongprogrammer.blogspot.com/ code{white-space:pre-wrap}span.smallcaps{font-variant:small-caps}span.underline{text-decoration:underline}div.column{display:inline-block;vertical-align:top;width:50%}code.sourceCode>span{display:inline-block;line-height:1.25}code.sourceCode>span{color:inherit;text-decoration:inherit}code.sourceCode>span:empty{height:1.2em}.sourceCode{overflow:visible}code.sourceCode{white-space:pre;position:relative}div.sourceCode{margin:1em 0}pre.sourceCode{margin:0}@media screen{div.sourceCode{overflow:auto}}@media print{code.sourceCode{white-space:pre-wrap}code.sourceCode>span{text-indent:-5em;padding-left:5em}}pre.numberSource code{counter-reset:source-line 0}pre.numberSource code>span{position:relative;left:-4em;counter-increment:source-line}pre.numberSource code>span>a:first-child::before{content:counter(source-line);position:relative;left:-1em;text-align:right;vertical-align:baseline;border:none;display:inline-block;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:0 4px;width:4em;background-color:#232629;color:#7a7c7d}pre.numberSource{margin-left:3em;border-left:1px solid #7a7c7d;padding-left:4px}div.sourceCode{color:#cfcfc2;background-color:#232629}@media screen{code.sourceCode>span>a:first-child::before{text-decoration:underline}}code span.{color:#cfcfc2}code span.al{color:#95da4c}code span.an{color:#3f8058}code span.at{color:#2980b9}code span.bn{color:#f67400}code span.bu{color:#7f8c8d}code span.cf{color:#fdbc4b}code span.ch{color:#3daee9}code span.cn{color:#27aeae}code span.co{color:#7a7c7d}code span.cv{color:#7f8c8d}code span.do{color:#a43340}code span.dt{color:#2980b9}code span.dv{color:#f67400}code span.er{color:#da4453}code span.ex{color:#09f}code span.fl{color:#f67400}code span.fu{color:#8e44ad}code span.im{color:#27ae60}code span.in{color:#c45b00}code span.kw{color:#cfcfc2}code span.op{color:#cfcfc2}code span.ot{color:#27ae60}code span.pp{color:#27ae60}code span.re{color:#2980b9}code span.sc{color:#3daee9}code span.ss{color:#da4453}code span.st{color:#f44f4f}code span.va{color:#27aeae}code span.vs{color:#da4453}code span.wa{color:#da4453}
Table of Contents
Copy a File or Folder Path from Context Menu
Copy a File or Folder Path at Path Bar
Get File or Folder Path at iTerm2(or Terminal)
Go to the Parent Folder (of a File or Folder) at Iterm2(or Terminal)
“New iTerm2 Tab” in Finder
Assign Keyboard Shortcut to “New iTerm2 Tab” at Finder
Series: Awesome Tips about Mac
Copy a File or Folder Path from Context Menu
Right click on a file to show the context menu, hold Option(⌥) key, “Copy xxx” will be changed to “Copy xx as Pathname”.
Copy a File or Folder Path at Path Bar
First go to Finder -> open View menu, check “Show Path Bar”, then right click at the path bar at the bottom, choose “Copy xx as Pathname”.
inlineAds=true
Get File or Folder Path at iTerm2(or Terminal)
If we want to get the file or folder path in Terminal, “Ctrl+C” to copy the file or folder in Finder, then paste it into the Terminal: it will paste the full path (all special characters are already escaped, so no need to add " ").
Go to the Parent Folder (of a File or Folder) at Iterm2(or Terminal)
To go to the parent folder of a folder or especially for a file:
First let’s define the following pcd command in ~/.bash_profile which will go to the parent folder of the file; then source ~/.bash_profile
function pcd () { cd "$(dirname "$1")" ; pwd; }
Then “Ctrl+C” at the selected file in Finder, then in Terminal type pcd, space, then paste the file.
“New iTerm2 Tab” in Finder
I use iTerm2 as my default Terminal, but the approaches for iTerm2 would also work for the default Terminal.
After select a file, choose New iTerm2 Tab in the context menu, it will create a new tab and cd to the enclosing folder.
After select a folder, choose “Services - > New iTerm2 Tab”.
Assign Keyboard Shortcut to “New iTerm2 Tab” at Finder
Go to System “Preferences -> Keyboard -> Shortcuts”, choose “Services” in the left panel, find “New iTerm2 Tab” and assign a shortcut like: Ctrl+Option+i.
To check whether the shortcut assignment works, we can go to Finder menu, Finder -> Services, check whether the new shortcut is shown for the “New iTerm2 Tab” menu item.
If the shortcut is not there and doesn’t work, it’s often because the shortcut we choose conflicts with other existing shortcuts.
Now we can Ctrl+Option+i to open a new tab for any file at Finder.
0 notes
lifelongprogrammer · 5 years
Text
Everything about File or Folder Path on Mac
Via http://lifelongprogrammer.blogspot.com/2019/07/everything-about-file-or-folder-path-on-mac.html code{white-space:pre-wrap}span.smallcaps{font-variant:small-caps}span.underline{text-decoration:underline}div.column{display:inline-block;vertical-align:top;width:50%}code.sourceCode>span{display:inline-block;line-height:1.25}code.sourceCode>span{color:inherit;text-decoration:inherit}code.sourceCode>span:empty{height:1.2em}.sourceCode{overflow:visible}code.sourceCode{white-space:pre;position:relative}div.sourceCode{margin:1em 0}pre.sourceCode{margin:0}@media screen{div.sourceCode{overflow:auto}}@media print{code.sourceCode{white-space:pre-wrap}code.sourceCode>span{text-indent:-5em;padding-left:5em}}pre.numberSource code{counter-reset:source-line 0}pre.numberSource code>span{position:relative;left:-4em;counter-increment:source-line}pre.numberSource code>span>a:first-child::before{content:counter(source-line);position:relative;left:-1em;text-align:right;vertical-align:baseline;border:none;display:inline-block;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:0 4px;width:4em;background-color:#232629;color:#7a7c7d}pre.numberSource{margin-left:3em;border-left:1px solid #7a7c7d;padding-left:4px}div.sourceCode{color:#cfcfc2;background-color:#232629}@media screen{code.sourceCode>span>a:first-child::before{text-decoration:underline}}code span.{color:#cfcfc2}code span.al{color:#95da4c}code span.an{color:#3f8058}code span.at{color:#2980b9}code span.bn{color:#f67400}code span.bu{color:#7f8c8d}code span.cf{color:#fdbc4b}code span.ch{color:#3daee9}code span.cn{color:#27aeae}code span.co{color:#7a7c7d}code span.cv{color:#7f8c8d}code span.do{color:#a43340}code span.dt{color:#2980b9}code span.dv{color:#f67400}code span.er{color:#da4453}code span.ex{color:#09f}code span.fl{color:#f67400}code span.fu{color:#8e44ad}code span.im{color:#27ae60}code span.in{color:#c45b00}code span.kw{color:#cfcfc2}code span.op{color:#cfcfc2}code span.ot{color:#27ae60}code span.pp{color:#27ae60}code span.re{color:#2980b9}code span.sc{color:#3daee9}code span.ss{color:#da4453}code span.st{color:#f44f4f}code span.va{color:#27aeae}code span.vs{color:#da4453}code span.wa{color:#da4453}
Table of Contents
Copy a File or Folder Path from Context Menu
Copy a File or Folder Path at Path Bar
Get File or Folder Path at iTerm2(or Terminal)
Go to the Parent Folder (of a File or Folder) at Iterm2(or Terminal)
“New iTerm2 Tab” in Finder
Assign Keyboard Shortcut to “New iTerm2 Tab” at Finder
Series: Awesome Tips about Mac
Copy a File or Folder Path from Context Menu
Right click on a file to show the context menu, hold Option(⌥) key, “Copy xxx” will be changed to “Copy xx as Pathname”.
Copy a File or Folder Path at Path Bar
First go to Finder -> open View menu, check “Show Path Bar”, then right click at the path bar at the bottom, choose “Copy xx as Pathname”.
inlineAds=true
Get File or Folder Path at iTerm2(or Terminal)
If we want to get the file or folder path in Terminal, “Ctrl+C” to copy the file or folder in Finder, then paste it into the Terminal: it will paste the full path (all special characters are already escaped, so no need to add " ").
Go to the Parent Folder (of a File or Folder) at Iterm2(or Terminal)
To go to the parent folder of a folder or especially for a file:
First let’s define the following pcd command in ~/.bash_profile which will go to the parent folder of the file; then source ~/.bash_profile
function pcd () { cd "$(dirname "$1")" ; pwd; }
Then “Ctrl+C” at the selected file in Finder, then in Terminal type pcd, space, then paste the file.
“New iTerm2 Tab” in Finder
I use iTerm2 as my default Terminal, but the approaches for iTerm2 would also work for the default Terminal.
After select a file, choose New iTerm2 Tab in the context menu, it will create a new tab and cd to the enclosing folder.
After select a folder, choose “Services - > New iTerm2 Tab”.
Assign Keyboard Shortcut to “New iTerm2 Tab” at Finder
Go to System “Preferences -> Keyboard -> Shortcuts”, choose “Services” in the left panel, find “New iTerm2 Tab” and assign a shortcut like: Ctrl+Option+i.
To check whether the shortcut assignment works, we can go to Finder menu, Finder -> Services, check whether the new shortcut is shown for the “New iTerm2 Tab” menu item.
If the shortcut is not there and doesn’t work, it’s often because the shortcut we choose conflicts with other existing shortcuts.
Now we can Ctrl+Option+i to open a new tab for any file at Finder.
From lifelongprogrammer.blogspot.com
0 notes
lifelongprogrammer · 5 years
Link
From http://lifelongprogrammer.blogspot.com/ code{white-space:pre-wrap}span.smallcaps{font-variant:small-caps}span.underline{text-decoration:underline}div.column{display:inline-block;vertical-align:top;width:50%}code.sourceCode>span{display:inline-block;line-height:1.25}code.sourceCode>span{color:inherit;text-decoration:inherit}code.sourceCode>span:empty{height:1.2em}.sourceCode{overflow:visible}code.sourceCode{white-space:pre;position:relative}div.sourceCode{margin:1em 0}pre.sourceCode{margin:0}@media screen{div.sourceCode{overflow:auto}}@media print{code.sourceCode{white-space:pre-wrap}code.sourceCode>span{text-indent:-5em;padding-left:5em}}pre.numberSource code{counter-reset:source-line 0}pre.numberSource code>span{position:relative;left:-4em;counter-increment:source-line}pre.numberSource code>span>a:first-child::before{content:counter(source-line);position:relative;left:-1em;text-align:right;vertical-align:baseline;border:none;display:inline-block;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:0 4px;width:4em;background-color:#232629;color:#7a7c7d}pre.numberSource{margin-left:3em;border-left:1px solid #7a7c7d;padding-left:4px}div.sourceCode{color:#cfcfc2;background-color:#232629}@media screen{code.sourceCode>span>a:first-child::before{text-decoration:underline}}code span.{color:#cfcfc2}code span.al{color:#95da4c}code span.an{color:#3f8058}code span.at{color:#2980b9}code span.bn{color:#f67400}code span.bu{color:#7f8c8d}code span.cf{color:#fdbc4b}code span.ch{color:#3daee9}code span.cn{color:#27aeae}code span.co{color:#7a7c7d}code span.cv{color:#7f8c8d}code span.do{color:#a43340}code span.dt{color:#2980b9}code span.dv{color:#f67400}code span.er{color:#da4453}code span.ex{color:#09f}code span.fl{color:#f67400}code span.fu{color:#8e44ad}code span.im{color:#27ae60}code span.in{color:#c45b00}code span.kw{color:#cfcfc2}code span.op{color:#cfcfc2}code span.ot{color:#27ae60}code span.pp{color:#27ae60}code span.re{color:#2980b9}code span.sc{color:#3daee9}code span.ss{color:#da4453}code span.st{color:#f44f4f}code span.va{color:#27aeae}code span.vs{color:#da4453}code span.wa{color:#da4453}
Table of Contents
Keyboard shortcuts for Google Drive
Search Tips and Tricks for Google Drive
Manage Storage: Use Less Space to Store More Files
Organize Files/Folders
Share Files on the Web
More Tips about Google Drive
Awesome Tips about Chrome Series
Keyboard shortcuts for Google Drive
Use keyboard shortcuts, we can avoid to use right click menu or trackpad, check here for why and how to use more keyboard, use less trackpad
Display keyboard shortcuts list Command+/ Search your Drive / Rename selected item n Move selected items to new folder z Add selected items to an additional folder Shift + z Share selected item Period Star or unstar selected items s Delete selected items # More actions(right click context) menu a Current folder actions menu f Open Create menu c Show or hide details pane d Show or hide activity pane i Select or deselect item x
Search Tips and Tricks for Google Drive
More Search Tools
Type “/” to go to search bar, you can find “More search tools” at the bottom. You can specify file type, owner, location, date modified, etc.
Search Syntax
Common search syntax: OR, AND, -, “phrase”
title: - search only the documents that include that specific keyword in their title
is:trashed - find files in trash folder
Search by Owner
find files owned by this user: type user’s email first(Google Drive can auto autocomplete the gmail name), then add “owner:” prefix.
owner:me: files owned by me
-owner:me: files shared with me, owner not me.
Find shared files
to: find all the files shared with that
with: show files shared by that user
Search by Type
type:pdf, spreadsheet, presentation, image, video, audio
For other types, we need use MIME types:
type:application/msword, type:application/vnd.ms-excel, type:application/zip, type:image/jpeg
before:YYYY-MM-DD after:YYYY-MM-DD
Search in a folder
Search and go to that folder, then click the folder at the top(or type f for show folder action menus), then click “Search with the folder_name”.
inlineAds=true
Manage Storage: Use Less Space to Store More Files
Open settings(shortcut: t), click the View items taking up storage to find out what files are using most spaces.
or access drive.google.com/drive/quota directly
Caveat: the files in trash would not shown in the here.
Delete Files from Trash Folder
When we delete a file in Google Drive, it will be put into trash folder and thus still take your space.
When you are out of space, you can try to delete files from trash or empty trash folder. Be sure to know what you you are doing, as if we delete them from trash folder, they would be gone forever.
Check Whether a File Use Storage or Not
Google Drive may or may not use storage limit for files like videos: if we backup them with high quality option, it will not use storage.
To check whether a file uses storage or not, open the details vide by shortcut: ‘d’ or click More Actions at the top menu bar and choose View Details,
Backup Files using Backup and Sync App with High Quality
If you don’t mind the reduced quality, when backup, choose “High Quality” for Free unlimited storage for videos and photos.
This “High Quality” option only works for backup, NOT sync: it means videos, photos you synced using the App would still use original quality and thus use storage.
Files you upload to drive would still use original format, thus use storage limit. Don’t upload big video or images files directly using the web to drive, use the Backup and Sync App
To keep files with original quality, we can zip these files and store them into another Google drive account.
We can add the files in backup to other folders: go to Computers side bar in Drive, choose the file then click Add to My Drive in the context menu.
Transfer Files to Others
Files that shared with you would not count as against your quota. You can transfer these big files into another account.
We can only transfer ownership of Google files like Google Docs/Sheets/Slides etc.
To transfer videos to another account
Share the file with another account
Collaborator makes a copy of the file and share it with the original account
In the original account, delete the original file permanently and move the shared file into appropriate folder.
Sync folders using Backup and Sync App
We can specify what Folders in Google Drive would be synced to local laptop.
Organize Files/Folders
Raw Files in Root Folder
Be aware that files(like pdf, videos) including those created in future in the root(/) folder would be also synced into local laptop.
Google should improve this
Google should improve this: as usually we save files into root folder, then we move it to right folder. But Google Drive already synced files to local laptop then delete it locally. Kind of waste computation resource.
For example when we save to Google drive at the print dialog, we can’t set the destination folder. Though we can change the file name at the advanced settings.
Google Drive can fix this by simply create a default “GoogleDriveDownload” folders, all files are stored in this folders by default.
Put files into right folders
Be sure to rename the file to a better name and put it into right folder.
We may not be able to put files in the right folder when we are saving it to Google Drive for example during print. But be sure to go to Drive to rename and move it: the newly added files will be shown at Quick Access section or check the recent tab at right side.
Share Files on the Web
Embedding a PDF From Drive into a Blog
<iframe src="https://docs.google.com/viewer?srcid=[file id]&pid=explorer&efh=false&a=v &chrome=false&embedded=true" width="580px" height="480px"></iframe>
[Embedding a DPF from internet into a Blog]
<iframe src="https://drive.google.com/viewerng/viewer?url=the_url&embedded=true" allowfullscreen="" frameborder="0" scrolling="no"></iframe>
Embed Images from Google Drive into Website
Get a shareable link from the image in Google drive and replace the id https://drive.google.com/uc?export=view&id={fileId}
This link seems to be subject to quotas. So not ideal for public/massive sharing.
![](http://drive.google.com/uc?export=view&id=1HfeI-lL69kP9gexkV3VoajLLWDp_riCu)
More Tips about Google Drive
Pull out text from images by opening it with google docs
Use Grammarly in Google Docs for fixing spelling and grammar error.
Ctrl+Shift+F to toggle compact mode in Google Docs.
Whoops! There was a problem playing this video
You can try to open it in another window.
Try to open it in incognito mode or another browser. - This may happen if you open more than one account in Chrome, and the account you signed in Chrome doesn’t have access to your videos.
0 notes