Last active
May 6, 2022 11:21
-
-
Save aidvu/eb3253186b0e9f073021c97dc59e57ee to your computer and use it in GitHub Desktop.
Shell commands
This file contains hidden or 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
# Remove deleted or moved files from `svn`: | |
svn status --ignore-externals | grep ! | tr -s ' ' | cut -d ' ' -f2 | xargs svn rm | |
# Get contents of file from line 5 to line 13: | |
sed -n -e 5,13p [FILE] | |
# Find all .php files and search/replace string | |
find -name "*.php" -not -path ".svn" -print | xargs grep -l "require_lib( 'old' )" | xargs -I X sed -i -e "s|require_lib( 'old' )|require_lib( 'new' )|g" X | |
# Execute a command in every folder in current directory | |
find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd {} && pwd" \; | |
# OpenWRT cron for switching changing LED color if pinging 8.8.8.8 fails | |
ping -q -c 5 8.8.8.8 && { echo 0 > /sys/devices/platform/gpio-leds/leds/inet:orange/brightness; echo 255 > /sys/devices/platform/gpio-leds/leds/inet:blue/brightness; } || { echo 255 > /sys/devices/platform/gpio-leds/leds/inet:orange/brightness; echo 0 > /sys/devices/platform/gpio-leds/leds/inet:blue/brightness; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment