Skip to content

Instantly share code, notes, and snippets.

View stroehleina's full-sized avatar

Andreas Stroehlein stroehleina

  • Berlin, Germany
View GitHub Profile
@stroehleina
stroehleina / kill_app_by_pid.sh
Created November 29, 2023 09:07
Find processes by name and SIGTERM kill them all (when an application is hung up and cannot be closed)
# Usage: kill_app_by_pid.sh <name_of_application>
# https://docs.oracle.com/cd/E19253-01/817-0403/eoizf/index.html
# WARNING: The –9 signal should not be used to kill certain processes, such as a database process, or an LDAP server process.
# The result is that data might be lost.
ps -u $USER -eaf | grep -i $1 | awk '{print $2}' | while read line; do kill -9 $line; done
@stroehleina
stroehleina / conda-find.sh
Created April 12, 2021 06:20
Function that can be added as an alias to your ~/.bashrc to find all conda environments that contain a particular package (and optionally version)
#Usage: conda-find.sh my-lost-package my-version
conda info --envs |
grep -v "#" |
sed 's/\s\+/\t/' |
cut -f2 |
sed '/^$/d' |
sed 's/^\*\s\+//' |
while read line; do
conda list -p $line |