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 | |
# http://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin | |
# http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
set -o nounset -o errexit -o pipefail | |
script=`realpath $0` | |
scriptdir=`dirname $script` | |
scriptname=`basename $script` |
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 | |
# http://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin | |
# http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
set -o nounset -o errexit -o pipefail | |
# Find files modified more than 1 month ago (31 days) | |
find -mtime 31 -type f | |
# Find files accessed more than 1 month ago (31 days) |
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 | |
# http://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin | |
# http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
set -o nounset -o errexit -o pipefail | |
# Download all videos from channel | |
youtube-dl https://www.youtube.com/channel/UCVqD-Rd1nMmvbvf-AvQvgZw | |
# Download a list of videos using urls |
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 | |
# http://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin | |
# http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
set -o nounset -o errexit -o pipefail | |
# http://www.imagemagick.org/Usage/resize/#shrink | |
# Create a `-thumb.jpg` for each of .jpg, .png, and .gif in current dir | |
for orig in `ls | grep -E '\.(jpg|png|gif)$'`; do |
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 | |
# http://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin | |
# http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
set -o nounset -o errexit -o pipefail | |
# From inside of a Docker container, how do I connect to the localhost | |
# of the machine? | |
# https://stackoverflow.com/q/24319662/1478566 |
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 | |
# http://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin | |
# http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
set -o nounset -o errexit -o pipefail | |
# https://www.percona.com/blog/2017/10/01/one-million-tables-mysql-8-0/ | |
# 1 2 3 4 5 6 7 8 9 10 | |
echo {1..10} |
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
<?php | |
// https://stackoverflow.com/a/2071048/1478566 | |
set_error_handler(function ($code, $message, $filename, $lineno) { | |
throw new ErrorException($message, $code, 0, $filename, $lineno); | |
}); | |
// The above code is necessary to terminate program in all of the | |
// following cases: |
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
<?php | |
// https://stackoverflow.com/a/2071048/1478566 | |
set_error_handler(function ($code, $message, $filename, $lineno) { | |
throw new ErrorException($message, $code, 0, $filename, $lineno); | |
}); | |
$a = [1 => 'a', 2 => 'b', 3 => 'c', 'str' => 'hello']; | |
$b = [ 2 => 'x', 4 => 'y']; | |
$c = ['str' => 'welcome']; |
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 | |
# http://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin | |
# http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
set -o nounset -o errexit -o pipefail | |
# https://serverfault.com/a/72749/323502 | |
ls | awk '{print "PREFIX-" $0 "-SUFFIX"}' |
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
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/ | |
// Global_Objects/String/replace#Specifying_a_string_as_a_parameter | |
// I faced with this problem trying to insert user input into html | |
// document: | |
// | |
// template_html.replace('{{{xxx}}}', html_escape(input)) | |
// | |
// ls | grep -E '\.(jpg|png|gif)$' original | |
// ls | grep -E '\.(jpg|png|gif)$' after html escape |
OlderNewer