Skip to content

Instantly share code, notes, and snippets.

View M-Razavi's full-sized avatar
🏹
Focusing

Mahdi Razavi M-Razavi

🏹
Focusing
View GitHub Profile
@M-Razavi
M-Razavi / Docker cleanup.md
Created February 7, 2025 14:53
Docker cleanup.md

Prune unused Docker objects

Imagges

clean up unused images

docker image prune

To remove all images which aren't used by existing containers

!! be very careful with these !! you may end up deleting what you don't want to

remove untracked

git clean -f -d

CAUTION: as above but removes ignored files like config.

git clean -f -x -d

CAUTION: as above, but cleans untracked and ignored files through the entire repo (without :/, the operation affects only the current directory)

git clean -fxd :/

@M-Razavi
M-Razavi / create-a-chrome-git-hub-search-shortcut.md
Last active March 16, 2023 14:11
Create a Chrome GitHub Search Shortcut

Create a Chrome search shortcut for your GitHub

If you only want to search in a specific repository, follow the Instruction-1 that David tweeted Winterbottom. For searching in whole repositories of organiation/user follow the Instruction-2

Instructions-1: search in a specific repository

  1. Open Chrome > Settings
  2. Search "manage search engines" and click into it
@M-Razavi
M-Razavi / Search in multiline (REGEX)
Created December 10, 2021 17:12
Search in multiline (REGEX)
\bWORDA[\s\S]*?WORDB
\bWORDA[\s\S]*?WORDB(?=[\r\n])
mvn clean install -DskipITs=true -DskipTests=true
@M-Razavi
M-Razavi / init.sh
Last active July 6, 2021 13:28 — forked from ocindev/init.sh
Convenient script to setup a WSL dev environment with Docker, sdkman.io, Maven, AdoptOpenJDK 1.8, NPM and Node.js
# Replace with your windows username
win_user=<replace>
# Update the apt package list.
sudo apt-get update -y
# Install Docker's package dependencies.
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
UBUNTU:
SSD:
sudo apt install nvme-cli
sudo nvme smart-log /dev/nvme0
# check percentage_used %
Memory:
1-Turn On or Restart the system
2-Hold down Shift to bring up the GRUB menu.
3-Use the arrow keys to move to the entry labeled Ubuntu, memtest86+
@M-Razavi
M-Razavi / getCompileTime.java
Created July 10, 2019 05:45
Java print time of last compilation
private static final Date buildDate = getClassBuildTime();
/**
* Handles files, jar entries, and deployed jar entries in a zip file (EAR).
* @return The date if it can be determined, or null if not.
*/
private static Date getClassBuildTime() {
Date d = null;
Class<?> currentClass = new Object() {}.getClass().getEnclosingClass();
URL resource = currentClass.getResource(currentClass.getSimpleName() + ".class");
; commands separated by a ; are executed sequentially. The shell waits for each command to terminate in turn.
&& command after && is executed if, and only if, command before && returns an exit status of zero. You can think of it as AND operator.
| a pipe. In expression command1 | command2 The standard output of command1 is connected via a pipe to the standard input of command2.
There are more similar control operators, worth to mention:
@M-Razavi
M-Razavi / sbt-utilities
Created June 24, 2019 13:30 — forked from joesan/sbt-utilities
Ignore Tests when Running SBT
sbt 'set test in Test := {}' clean assembly