diff --git a/Byobu_CheatSheet.md b/Byobu_CheatSheet.md index 6961076..f9a18d3 100644 --- a/Byobu_CheatSheet.md +++ b/Byobu_CheatSheet.md @@ -33,4 +33,12 @@ Byobu/Tmux: #Kill split in focus Ctrl + F6 - + #Join all splits + Shift + F5 + + #Kill the current window + Ctrl + A + K + + #Move focus to next split + Shift + F3 + diff --git a/Elasticsearch_CheatSheet.md b/Elasticsearch_CheatSheet.md index 793575c..8c68ccd 100644 --- a/Elasticsearch_CheatSheet.md +++ b/Elasticsearch_CheatSheet.md @@ -59,3 +59,10 @@ #Check pending tasks curl -XGET http://localhost:9200/_cat/pending_tasks?v + + #Query using URL parameters + curl -X GET http://localhost:9200/samples/_search?q=school:Harvard + + #List index mapping + curl -X GET http://localhost:9200/samples + diff --git a/Flexbox_CheatSheet.md b/Flexbox_CheatSheet.md new file mode 100644 index 0000000..dafae37 --- /dev/null +++ b/Flexbox_CheatSheet.md @@ -0,0 +1,67 @@ + + + #Allow Flexbox display + display: flex; + + #Align items horizontally + justify-content: + #Options include: + flex-start; - items align to left of container + flex-end; - items align to right of container + center; - items align at center of container + space-between; - equal spacing between items, with first at start and final at end + space-around; - equal spacing around items + space-evenly; - even spacing around items with a full space at either end + + #Align items vertically + align-items: + #Options include: + flex-start; - items align to top of container + flex-end; - items align to bottom of container + center; - items align to vertical center of container + baseline; - items align to baseline of container + stretch; - items stretched to fit + + #Change direction + flex-direction: + #Options include: + row; - items placed the same as text direction + row-reverse; - items placed opposite to text direction + column; - items are placed top to bottom + column-reverse: items are placed bottom to top + + #Align specific item + align-self: + #Options include same values as 'align-items' but for a specific item + #Overrides 'align-items' + + #Wrap items + flex-wrap: + #Options include: + nowrap: every items is fit to a single line + wrap: items wrap around to additional lines + wrap-reverse: items wrap around to additional lines in reverse + + #Combination of direction and wrap + flex-flow: + #Options include: + row wrap; - sets rows and wraps them + row nowrap; + row reverse nowrap; + column reverse; + column wrap-reverse + column wrap + + #Space multiple lines a certain way + align-content: + #Options include: + flex-start; - lines packed at top of container + flex-end; - lines packed at bottom of container + center; lines packed at vertical center of container + space-between: lines display with equal spacing between them + space-around: lines display with equal spacing around them + stretch: lines are stretched to fit the container + + #Order items + order: + #Can be positive or negative. Default order value of 0. diff --git a/Git_CheatSheet.md b/Git_CheatSheet.md index e58755b..d131f27 100644 --- a/Git_CheatSheet.md +++ b/Git_CheatSheet.md @@ -178,3 +178,6 @@ #Stashing everything (including ignored files) git stash --all + + #Push code from working branch to another branch + git push origin branch1: branch2 diff --git a/InfluxDB_Cheatsheet b/InfluxDB_Cheatsheet new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/InfluxDB_Cheatsheet @@ -0,0 +1 @@ + diff --git a/JavaScript_CheatSheet.md b/JavaScript_CheatSheet.md new file mode 100644 index 0000000..a0907a2 --- /dev/null +++ b/JavaScript_CheatSheet.md @@ -0,0 +1,126 @@ +JavaScript: + + # Declare a variable using let or const. + let myVariable = 'hello'; + const myConstant = 42; + + # Log a message to the console. + console.log('Hello, world!'); + + # Alert a message to the user. + alert('Hello, user!'); + + # Prompt the user for input. + let userInput = prompt('What is your name?'); + + # Declare a function. + function myFunction(arg1, arg2) { + Function body goes here. + } + + # Call a function. + myFunction(value1, value2); + + # Declare an object. + let myObject = { + key1: 'value1', + key2: 'value2', + key3: 'value3', + }; + + # Access an object's property. + myObject.key1; + + # Declare an array. + let myArray = [1, 2, 3, 4]; + + # Access an array's element. + myArray[0]; + + # Declare a for loop. + for (let i = 0; i < myArray.length; i++) { + Loop body goes here. + } + + # Declare a while loop. + while (condition) { + Loop body goes here. + } + + # Declare an if statement. + if (condition) { + Code to execute if condition is true. + } + + # Declare an if-else statement. + if (condition) { + Code to execute if condition is true. + } else { + Code to execute if condition is false. + } + + # Declare a switch statement. + switch (expression) { + case value1: + Code to execute if expression equals value1. + break; + case value2: + Code to execute if expression equals value2. + break; + default: + Code to execute if expression doesn't match any case. + } + + # Declare a try-catch block. + try { + Code that might throw an error. + } catch (error) { + Code to handle the error. + } + + # Declare a timeout function. + setTimeout(function() { + Code to execute after a delay. + }, delay); + + # Declare an interval function. + setInterval(function() { + Code to execute repeatedly at an interval. + }, interval); + + # Declare a callback function. + function myFunction(callback) { + Code to execute before the callback. + callback(); + Code to execute after the callback. + } + + # Declare a promise. + let myPromise = new Promise(function(resolve, reject) { + Code that might resolve or reject the promise. + }); + + # Use the then method of a promise. + myPromise.then(function(result) { + Code to execute if the promise resolves successfully. + }).catch(function(error) { + Code to execute if the promise is rejected. + }); + + # Declare a class. + class MyClass { + constructor(arg1, arg2) { + Constructor code goes here. + } + myMethod(arg1, arg2) { + Method body goes here. + } + } + + # Declare a module. + export function myFunction(arg1, arg2) { + Code to export goes here. + } + + # Import a module + import { myFunction } from './my-module.js'; diff --git a/K8s_CheatSheet.md b/K8s_CheatSheet.md index 46f5a47..aac87d3 100644 --- a/K8s_CheatSheet.md +++ b/K8s_CheatSheet.md @@ -1,3 +1,6 @@ + #Get the documentation for pod manifests + kubectl explain pods + #Get total nodes in cluster kubectl get nodes @@ -10,12 +13,27 @@ #List contexts added in .kube config kubectl config list-contexts + #List the running Pods: + kubectl get pods + #Select the context to use kubectl config use-context + #Get the password for the e2e user + kubectl config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}' + #Get all pods in all namespaces and list from most resource hungry to less kubectl top pod --all-namespaces | sort --reverse --key 3 --numeric | less #Describe specific pod in deployment that is in the selected namespace with a bit more detail kubectl -n describe deployments.apps + #Delete resources + kubectl delete + + #Get a deployment's status subresource + kubectl get deployment nginx-deployment --subresource=status + + #List all services in the namespace + kubectl get services + diff --git a/Linux_CheatSheet.md b/Linux_CheatSheet.md index 6b1782c..7564b7a 100644 --- a/Linux_CheatSheet.md +++ b/Linux_CheatSheet.md @@ -39,6 +39,11 @@ Linux/Unix: #Create a new directory mkdir + + #Options include + -p if directory exists and also make parent directories as necessary + -v verbose + -m provide mode for creating directory #Print the working directory pwd @@ -218,14 +223,28 @@ Linux/Unix: #Install, build, remove and manage Debian packages apt-get + #Get current user id + id + #Creates a new user account adduser #Creates a new group groupadd - #Adds a user to a group + #Modify a user to a group usermod + + #Options + -c, --comment = add comment to user + -g, --gid = Specify the primary group for the user account + -G, --groups = Specify a comma-separated list of supplementary groups for the user account + -a, --append = add the supplementary groups to the user's current set of group + -d, --home = Specify a particular home directory for the user account + -m, --move-home = Move the user's home directory to a new location. Must be used with the -d option + -s, --shell = Specify a particular login shell for the user account + -L, --lock = Lock the user account + -U, --unlock = Unlock the user account #Remove a user from a group userdel @@ -265,9 +284,6 @@ Linux/Unix: #Determine system boot-up performance statistics systemd-analyze - - #Determine system boot-up performance statistics - systemd-analyze #Request system information / software version uname -a @@ -308,7 +324,7 @@ Linux/Unix: #Query optimisation -type = type of file - -name = matching with a filename + -name = matching with a filename #Look for a file with a giving name using query optimisation find . -type f -name @@ -375,6 +391,21 @@ Linux/Unix: #Replace old text with new text sed '-s/myOldText/myNewText' theFileBeingEdited.txt + #Shows you the disk usage of the current directory you are in + du -h + + #Change hostname of the system + hostname + + #Kill process + kill + kill -l #List all the kill signals + + Ex: kill -9 5123 #Sends kill signal to process 5123 + + #Add a user on Linux server + useradd username + #List keyboard region inputs localectl list-x11-keymap-layouts @@ -386,4 +417,10 @@ Linux/Unix: #Option include -l = for displaying line count of a file/no of lines in a text file - + + #cut command that allow you to process and filter text files + cut