Initialize a new Git repository.
git init
Clone an existing remote repository.
git clone https://github.com/user/repository.git
Check the status of the repository.
git status
Stage all modified and new files for commit.
git add .
Commit staged changes with a message.
git commit -m "Your commit message"
Fetch and merge the latest changes from the remote repository.
git pull origin main
Push committed changes to the remote repository.
git push origin main
Create a new branch named "feature-branch".
git branch feature-branch
Switch to the "feature-branch".
git checkout feature-branch
Merge "feature-branch" into the current branch.
git merge feature-branch
GIT global setup
git config --global user.name "john"
git config --global user.email "john@example.si"
Create a new repository
git clone git@git01.example.si:john/test.git
cd test
git switch --create master
touch README.md
git add README.md
git commit -m "add README"
git push --set-upstream origin master
Push an existing folder
cd existing_folder
git init --initial-branch=master
git remote add origin git@git01.example.si:john/test.git
git add .
git commit -m "Initial commit"
git push --set-upstream origin master
Push an existing Git repository
cd existing_repo
git remote rename origin old-origin
git remote add origin git@git01.example.si:john/test.git
git push --set-upstream origin --all
git push --set-upstream origin --tags
.ssh/config
Host git01.example.si
Hostname git01.example.si
User git
Port 2222
// optional
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yes
Check system information
system_profiler SPHardwareDataType
List all files, including hidden ones
ls -la
Show current working directory
pwd
Create a new directory
mkdir new_folder
Delete a file
rm filename.txt
Delete a directory and its contents
rm -r directory_name
Copy a file
cp source.txt destination.txt
Move or rename a file
mv oldname.txt newname.txt
Find a file in a directory
find /Users -name filename.txt
Check disk usage
df -h
Check memory usage
vm_stat
Check CPU usage
top -o cpu
Show active network connections
netstat -an
Flush DNS cache
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Shut down the Mac
sudo shutdown -h now
SFTP, SSH & Large File Transfer Commands
SSH Connection
Connect to a remote server
ssh user@remote-server.com
Connect using a specific port
ssh -p 2222 user@remote-server.com
Copy SSH key to server for passwordless login
ssh-copy-id user@remote-server.com
SFTP (Secure File Transfer Protocol)
Connect to an SFTP server
sftp user@remote-server.com
List files in the remote SFTP directory
ls
Download a file from an SFTP server
get remote-file.txt
Upload a file to an SFTP server
put local-file.txt
Download an entire directory from an SFTP server
get -r remote-folder/ local-folder/
Upload an entire directory to an SFTP server
put -r local-folder/ remote-folder/
Large File Transfers
Copy a file to a remote server using SCP
scp file.zip user@remote-server.com:/path/to/destination/
Copy a directory to a remote server using SCP
scp -r folder user@remote-server.com:/path/to/destination/
Transfer a file using rsync (fast & resumable)
rsync -avz file.zip user@remote-server.com:/path/to/destination/
Resume a large file transfer with rsync
rsync -avz --partial --progress file.zip user@remote-server.com:/path/to/destination/
Compress & send a large folder using tar + SSH
tar czf - folder | ssh user@remote-server.com "tar xzf - -C /path/to/destination/"
Print text to the screen
echo "Hello, World!";
Print a variable's contents
print_r($array);
Dump detailed variable information
var_dump($variable);
Check if a variable is set
isset($variable);
Check if a variable is empty
empty($variable);
Get the length of a string
strlen("Hello");
Replace part of a string
str_replace("old", "new", $string);
Convert a string to lowercase
strtolower("HELLO");
Convert a string to uppercase
strtoupper("hello");
Get the current timestamp
time();
Format a date
date("Y-m-d H:i:s");
Create an array
$array = array("Apple", "Banana", "Cherry");
Get the number of elements in an array
count($array);
Check if a key exists in an array
array_key_exists("key", $array);
Sort an array
sort($array);
Create a SwiftUI Text View
Text("Hello, SwiftUI!")
Create a SwiftUI Button
Button("Click Me") { print("Button tapped") }
Create a SwiftUI Image
Image(systemName: "star.fill")
Create a VStack (Vertical Stack)
VStack { Text("Line 1") Text("Line 2") }
Create an HStack (Horizontal Stack)
HStack { Text("Left") Text("Right") }
Create a ZStack (Layered Views)
ZStack { Text("Back") Text("Front").foregroundColor(.white) }
Create a SwiftUI Navigation View
NavigationView { Text("Home Screen") }
Create a SwiftUI List
List { Text("Item 1") Text("Item 2") }
Use a State Variable in SwiftUI
@State private var count = 0
Use a SwiftUI Toggle (Switch)
Toggle("Enable Feature", isOn: $isEnabled)
Print to console
println("Hello, Kotlin!")
Define a variable (immutable)
val name = "John"
Define a variable (mutable)
var age = 25
Define a function
fun greet() { println("Hello!") }
Function with parameters
fun sum(a: Int, b: Int): Int { return a + b }
Define a class
class Person(val name: String, val age: Int)
Create an instance of a class
val person = Person("Alice", 30)
Loop through a list
for (item in listOf("A", "B", "C")) { println(item) }
Check for null safety
val str: String? = null
Elvis operator for default value
val length = str?.length ?: 0
JavaScript Commands
Log output to the console
console.log("Hello, JavaScript!");
Select an element by ID
document.getElementById("myElement");
Select all elements by class
document.getElementsByClassName("myClass");
Change an element's text
document.getElementById("myElement").innerText = "New Text";
Add an event listener
document.getElementById("btn").addEventListener("click", function() { alert("Clicked!"); });
Set a timeout
setTimeout(() => { console.log("Delayed Message"); }, 2000);
Loop through an array
let array = ["A", "B", "C"]; array.forEach(item => console.log(item));
Fetch data from an API
fetch('https://api.example.com/data').then(response => response.json()).then(data => console.log(data));
jQuery Commands
Select an element with jQuery
$("#myElement");
Change text of an element
$("#myElement").text("New Text");
Hide an element
$("#myElement").hide();
Show an element
$("#myElement").show();
Toggle an element's visibility
$("#myElement").toggle();
Perform an AJAX request
$.get("https://api.example.com/data", function(data) { console.log(data); });
Animate an element
$("#box").animate({ width: "300px" }, 1000);