This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
qfind () { | |
find . -not -path "*/node_modules*" -not -path "*/.git/*" -not -path "*/build/*" -not -path "*/*.egg-info*" -not -path "*/.pytest_cache*" -not -path "*/.idea*" -not -path "*/__pycache__*" -not -path "*/.vscode*/" -not -path "*/app/libs/*" -name $1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Example: | |
# SOURCE_PATH=/var/lib/docker/ | |
# DEST_PATH=/mnt/docker/ | |
rsync -aPHSx --remove-source-files ${SOURCE_PATH} ${DEST_PATH} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
ASDF_VERSION=v0.7.1 | |
PYTHON3_VERSION372=3.7.2 | |
if [ ! -d "$HOME/.asdf" ] ; then | |
git clone https://github.com/asdf-vm/asdf.git $HOME/.asdf --branch $ASDF_VERSION | |
fi | |
source $HOME/.asdf/asdf.sh | |
source $HOME/.asdf/completions/asdf.bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myip() { | |
echo "local ip: " | |
ipconfig getifaddr en0 | |
echo "external ip: " | |
curl ipecho.net/plain ; echo | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Taken from https://ppolyzos.com/2020/10/09/swap-places-between-tilde-and-section-sign-%C2%A7-key-in-your-macbook-keyboard/ | |
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000035,"HIDKeyboardModifierMappingDst":0x700000064},{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000035}]}' | |
sudo /usr/bin/env bash -c "cat > /Library/LaunchAgents/org.custom.tilde-switch.plist" << EOF | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find ${JENKINS_HOME_PATH} -maxdepth 2 -type d -print0 -name "builds" | while read -d '' -r dir; do | |
files=("$dir"/*) | |
if [ "${#files[@]}" -gt 30 ]; then | |
if [[ "$dir" =~ .*"builds_"$ ]]; then | |
echo "removing $dir" | |
rm -rf $dir | |
else | |
printf "%5d files in directory %s\n" "${#files[@]}" "$dir" | |
rm -rf "${dir}_" | |
mv "${dir}" "${dir}_" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lsof -i -u mongod | grep "ESTABLISHED" | awk {'print $9 '} | cut -d":" -f 2| sort | uniq -c | sort -n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assuming "application" is the connection env var to group by connections by. | |
db.currentOp(true).inprog.reduce( | |
(accumulator, connection) => { | |
application = connection.clientMetadata && connection.clientMetadata.application ? | |
connection.clientMetadata.application.name : "Internal"; | |
accumulator[application] = (accumulator[application] || 0) + 1; | |
accumulator["TOTAL_CONNECTION_COUNT"]++; | |
return accumulator; | |
}, | |
{ TOTAL_CONNECTION_COUNT: 0 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSTANCE_NAME=$1 | |
ips=$(aws ec2 describe-instances --filters="Name=tag:Name,Values=${INSTANCE_NAME}" --query="Reservations[*].Instances[*].PrivateIpAddress" --output=text) | |
for i in $(cat ips | tr '\t\n' ',' | tr ',' '\n'); do echo $i; ssh $i -q -t "hostname"; done |
OlderNewer