Skip to content

Commit

Permalink
Merge branch 'master' into branch1
Browse files Browse the repository at this point in the history
  • Loading branch information
Jahenr authored Mar 24, 2024
2 parents 7abb97e + c4afbde commit 099a68f
Show file tree
Hide file tree
Showing 18 changed files with 561 additions and 16 deletions.
10 changes: 9 additions & 1 deletion Byobu_CheatSheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

7 changes: 7 additions & 0 deletions Elasticsearch_CheatSheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

67 changes: 67 additions & 0 deletions Flexbox_CheatSheet.md
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 3 additions & 0 deletions Git_CheatSheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions InfluxDB_Cheatsheet
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

126 changes: 126 additions & 0 deletions JavaScript_CheatSheet.md
Original file line number Diff line number Diff line change
@@ -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';
18 changes: 18 additions & 0 deletions K8s_CheatSheet.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#Get the documentation for pod manifests
kubectl explain pods
#Get total nodes in cluster
kubectl get nodes
Expand All @@ -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 <context name>

#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 <namespace> describe deployments.apps <pod name>
#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

53 changes: 48 additions & 5 deletions Linux_CheatSheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ Linux/Unix:

#Create a new directory
mkdir <directory name to be created>

#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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 <filename>
Expand Down Expand Up @@ -375,3 +391,30 @@ 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 <new hostname>

#Kill process
kill <process id>
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
#Set keyboard input
localectl set-keymap <language region>

#cut command that allow you to process and filter text files
cut <option> <filename>
#option include
-f = used for specifying a field, a set of fields, or a range of fields.
-d = Specify a delimiter that will be used, for ex: "," or " " or "-" or any single character delimiter. Default is "tab".
14 changes: 14 additions & 0 deletions MYSQL_Cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,17 @@ MYSQL

#Deletes multiple views.
DROP VIEW VIEW1,VIEW2…;
#Truncate a table
TRUNCATE [TABLE] table_name;
#Rename a table
RENAME TABLE table_name TO table_name;

#return the number of rows
SELECT COUNT(*) FROM TABLENAME

#Use of IN operator with WHERE clause
SELECT <field_list> FROM <table_name> WHERE <expression|column_1> IN (value1, value2, …)


11 changes: 9 additions & 2 deletions NPM_CheatSheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,13 @@ NPM / Node Package Manager
# Show npm version
npm --version

#Install a project with a clean slate and run tests
npm install-ci-test
# Display prefix
npm prefix

# Check for outdated packages
npm outdated

Expand Down Expand Up @@ -274,4 +280,5 @@ NPM / Node Package Manager
# This runs a predefined command specified in the "stop" property of a package's "scripts" object.
npm stop

Loading

0 comments on commit 099a68f

Please sign in to comment.