This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --Create a new user | |
| CREATE USER 'usrname'@'localhost' IDENTIFIED BY 'password'; | |
| --Make sure your user is on here | |
| select user from MySQl.user; | |
| --Grand privillages | |
| GRANT ALL PRIVILEGES ON * . * TO 'usrname'@'localhost'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # move to a different directory | |
| cd <yourDirectory> | |
| # show what's in the current directory | |
| ls | |
| # show what's in the current directory with more details | |
| ls -l | |
| # show what's in the current directory with more details - pretty much the same as above but show hidden files | |
| ls -al | |
| # make a new directory | |
| mkdir <newDirectoryName> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ps -o etime= -p "your_pid" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Waits for the process with the specified pid to exit. Once the the process exits, the assertion is also released. | |
| # man caffeinate | |
| caffeinate -w your_pid & |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # do this when you're normal mode. | |
| # dd -> delete 1 current line | |
| # 10dd -> delete 10 from the current line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| :w # save | |
| :wq # save and exit | |
| :q! # exit | |
| :u # undo | |
| :noh # delete highlights | |
| :10,50s/^/# # comment out 10 - 50 lines | |
| :10,50s/^# # uncomment 10 - 50 lines | |
| :n or :next # go to next file that's open | |
| :prev or :N # go to the previous file | |
| :wn or :wnext # save the current go to next |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git rm -rf --cached . | |
| git add . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " vi ~/.vimrc | |
| filetype plugin indent on | |
| " show existing tab with 4 spaces width | |
| set tabstop=4 | |
| " when indenting with '>', use 4 spaces width | |
| set shiftwidth=4 | |
| " On pressing tab, insert 4 spaces | |
| set expandtab |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def clean_astring(self, string): | |
| """return a lower-cased string without any space""" | |
| return string.strip().replace(' ', '').lower() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Python accepts a comma at the end of your list/dict | |
| # This is helpful when you define a list/dict vertically, helps you not forget to add a comma when adding a value | |
| arr =[1, | |
| 2, | |
| 3,] | |
| d = {1: 'a', | |
| 2: 'b', | |
| 3: 'c',} |