Skip to content

Instantly share code, notes, and snippets.

View uilian's full-sized avatar
🏠
Working from home

Uilian Souza uilian

🏠
Working from home
View GitHub Profile
@uilian
uilian / maven
Created February 21, 2024 20:38
Maven useful commands
# show options available
mvn help:help
# Interactive shell to evaluate maven expressions like ${project.groupId}
mvn help:evaluate
# shows information about the plugin
mvn help:describe -Dplugin=org.apache.maven.plugins:maven-shade-plugin -Ddetail
@uilian
uilian / McIlroy
Created February 12, 2024 23:56
McIlroy solution for printing the most common words in a text file in the inverse order of the count of their occurrences
tr -cs A-Za-z '\n' |
tr A-Z a-z |
sort |
uniq -c |
sort -rn |
sed ${1}q
@uilian
uilian / kubectl-commands.md
Created February 9, 2024 19:34 — forked from DStorck/kubectl-commands.md
kubectl commands

filter kubernetes response with kubectl

make file with all results , then filter into new file

kubectl get nodes > all_nodes.txt

cat all_nodes.txt | while read line ; do if [[ $line == *"sobusy"* ]]; then echo $line; fi; done > filtered_nodes.txt

filter results by search criteria

kubectl logs <pod> <search_criteria> > some_file.txt

@uilian
uilian / git_fetch_pull_all_subfolders.sh
Created December 11, 2023 15:30 — forked from mnem/git_fetch_pull_all_subfolders.sh
Simple bash script for fetching and pulling all repos in the executed folder to the latest of the branch they are on
#!/bin/bash
################
# Uncomment if you want the script to always use the scripts
# directory as the folder to look through
#REPOSITORIES="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
REPOSITORIES=`pwd`
IFS=$'\n'
# list installed packages
rpm -qa
# list files installed by a package
rpm -ql [rpm file name]
@uilian
uilian / gist:57cd6a7256526ae6a82348afc16a8053
Created May 17, 2023 19:20
Finding a class inside a list of JAR files
$ find . -name "*.jar" -print0 | xargs -0 -n1 unzip -l | grep Exception
@uilian
uilian / gist:8f3d582938e8927f09e7353025004c11
Created May 17, 2023 19:19
Show environment variables for process
# lists the env vars for the process
$ cat /proc/28818/environ | tr '\0' '\n'
# lists more details about the process, including the env vars
$ ps e -ww -p 28818
$ mvn spring-boot:run \
-P '!default' \ # setting a profile, in this case, excluding it by prefixing it with '!'
-Dspring-boot.run.jvmArguments="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8000" # debug settings
@uilian
uilian / remove_dups_zsh_history.sh
Created October 18, 2022 18:46
Remove duplicates from zsh_history
# Remove duplicates from zsh_history:
$ cat -n .zsh_history | sort -t ';' -uk2 | sort -nk1 | cut -f2- > .zsh_no_duplicates_history
$ mv .zsh_no_duplicates_history .zsh_history
# In case of failure (i.e, `sort: Illegal byte sequence`), debug
# replacing the command above with `head`:
$ head -n 10000 .zsh_history | sort -t ';' -uk2 | sort -nk1 | cut -f2-
@uilian
uilian / git-commands.sh
Last active February 23, 2023 16:59
Git Utils
# find string accross all git revisions
git grep "string/regexp" $(git rev-list --all)
# diff file between two different branches or tags
git diff master 21.5.5.1 src/files/example.txt
# show file history
git log --stat src/customProperties.json
git log --graph src/customProperties.json