diff --git a/databases/mysql.sh b/databases/mysql.sh index b28b272..040ffe8 100644 --- a/databases/mysql.sh +++ b/databases/mysql.sh @@ -10,3 +10,5 @@ SHOW PROCESSLIST; # Show you any queries that are currently running or in the qu GRANT ALL PRIVILEGES ON prospectwith.* TO 'power'@'localhost' WITH GRANT OPTION; # Grant all privileges on database CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password'; # Create user + +mysql -u root -pmypassword -e "MY SQL QUERY" &>> query.log & disown # Run SQL query in the background diff --git a/frontend/html5.html b/frontend/html5.html index d090db5..3d4910e 100644 --- a/frontend/html5.html +++ b/frontend/html5.html @@ -46,7 +46,7 @@
- + diff --git a/languages/bash.sh b/languages/bash.sh index ea106d6..4710b56 100644 --- a/languages/bash.sh +++ b/languages/bash.sh @@ -117,6 +117,9 @@ grep -r # search recursively for pattern in directory head -n file_name | tail +n # Print nth line from file. head -y lines.txt | tail +x # want to display all the lines from x to y. This includes the xth and yth lines. +sed 's///g' # replace pattern in file with replacement value to std output the character after s (/) is the delimeter +sed -i 's///g' # replace pattern in file with replacement value in place +echo "this" | sed 's/is/at/g' # replace pattern from input stream with replacement value ############################################################################## # DIRECTORY COMMANDS @@ -145,6 +148,9 @@ ssh -p user@host # connects to host on specified port as user ssh-copy-id user@host # adds your ssh key to host for user to enable a keyed or passwordless login whoami # returns your username +su # switch to a different user +su - # switch to root, likely needs to be sudo su - +sudo # execute command as the root user passwd # lets you change your password quota -v # shows what your disk quota is date # shows the current date and time @@ -154,6 +160,8 @@ w # displays whois online finger # displays information about user uname -a # shows kernel information man # shows the manual for specified command +info # shows another documentation system for the specific command +help # shows documentation about built-in commands and functions df # shows disk usage du # shows the disk usage of the files and directories in filename (du -s give only a total) last # lists your last logins @@ -381,7 +389,7 @@ n<&m # file descriptor n is made to be a copy of the input file descriptor <&- # closes the standard input >&- # closes the standard output n>&- # closes the ouput from file descriptor n -n<&- # closes the input from file descripor n +n<&- # closes the input from file descriptor n |tee # output command to both terminal and a file (-a to append to file) diff --git a/languages/java.md b/languages/java.md index b56f700..7c9fd6a 100644 --- a/languages/java.md +++ b/languages/java.md @@ -196,6 +196,24 @@ int c = a + b; System.out.println(i); } ``` + +>Enhanced for loop/for-each +```java +for(dataType item : array) { + ... +} + +``` +**Example:** +```java + // array of numbers + int[] numbers = {100, 200, 300, 400}; + + // for each loop + for (int number: numbers) { + System.out.println(number); +``` + > WHILE LOOP STATEMENT ```java while(condition){ //till condition will be true. diff --git a/tools/git.sh b/tools/git.sh index bbbd86b..46573a0 100644 --- a/tools/git.sh +++ b/tools/git.sh @@ -41,6 +41,7 @@ git grep --heading --line-number '' # Find lines matching the patt git log --grep='' # Search Commit log git commit -m "msg" # commit changes with a msg +git commit -m "title" -m "description" # commit changes with a title and description git commit --amend # combine staged changes with the previous commit, or edit the previous commit message without changing its snapshot git commit --amend --no-edit # amends a commit without changing its commit message git commit --amend --author='Author Name ' # Amend the author of a commit diff --git a/tools/vim.txt b/tools/vim.txt index 682e0c7..6aa912d 100644 --- a/tools/vim.txt +++ b/tools/vim.txt @@ -29,6 +29,7 @@ $ end of line move line downwards, on the first non blank character gg go to first line G go to last line +ngg go to line n nG go To line n :n go To line n ) move the cursor forward to the next sentence.