Skip to content

Instantly share code, notes, and snippets.

View mehdishahdoost's full-sized avatar

Mehdi Shahdoost mehdishahdoost

View GitHub Profile
sudo lsof -i :3000
kill -9 <PID>
@mehdishahdoost
mehdishahdoost / JIB.md
Last active April 24, 2023 09:53
How to configure spring boot to use JIB plugin
	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<excludes>
						<exclude>
							<groupId>org.projectlombok</groupId>
@mehdishahdoost
mehdishahdoost / docker-proxy.md
Last active April 25, 2023 19:00
Set up a http and https proxy for the docker

1- Create the directory

mkdir -p /etc/systemd/system/docker.service.d

2- Create the file

vim /etc/systemd/system/docker.service.d/http-proxy.conf
@mehdishahdoost
mehdishahdoost / kubectl.md
Created April 25, 2023 19:09
KubeCtl commands

Get info about cluster

kubectl cluster-info

Get nodes information

kubectl get nodes

Nginx features

  • Web Server
  • Load Balancer
  • Reverse Proxy
  • Monitoring and Management

HTTP Codes

@mehdishahdoost
mehdishahdoost / bash.md
Created April 25, 2023 19:12
Bash Script

List of shells on machine

cat /etc/shells

write and append to file

echo test > file.text
echo test2 >> file.txt
@mehdishahdoost
mehdishahdoost / mongodb-ref.md
Last active July 2, 2023 19:56
MongoDB Reference

Best file system for Mongodb

XFS is a great choice as a filesystem, as it can perform snapshot backups.

Document Max (best practice) Size

Respect the maximum document size of 16 MB

MongoDB JIRA Address

@mehdishahdoost
mehdishahdoost / mongodb-bulk-insertion.js
Created July 1, 2023 15:20
mongodb-bulk-insertion-scripts
db = db.getSiblingDB('dbname');
insertBulk = function() {
var bulk = db.books.initializeUnorderedBulkOp(); // or we can use db.books.initializeOrderedBulkOp();
for(loop=0;loop<1000;loop++) {
bulk.insert({name: "Moon"});
}
@mehdishahdoost
mehdishahdoost / mongodb-bulk-update.js
Created July 1, 2023 15:46
MongoDB Bulk update script
db = db.getSiblingDB('dilmachi');
insertBulk = function() {
var bulk = db.books.initializeOrderedBulkOp();
bulk.find({name: 'Moon'}).update({$set: {price: 300}});
bulk.execute();
}
insertBulk();

Create user with sudo access

sudo adduser <username>
sudo usermod -aG sudo <username>
su — <username>

Change sshd configs