# Download phpbrew
cd ~/.local/bin
curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew
chmod +x phpbrew
# Install PHP build dependencies
sudo apt install libssl-dev libbz2-dev libcurl4-openssl-dev
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 | |
function cleanup() { | |
# Your cleanup code here | |
} | |
trap cleanup EXIT | |
# See http://redsymbol.net/articles/bash-exit-traps/ |
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 | |
if [[ "$(id -u)" -ne 0 ]]; then | |
sudo "$0" "$@" | |
exit $? | |
fi |
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
# which package owns a file | |
dpkg-query -S /path/to/file | |
# list files in an installed package | |
dpkg-query -L $PACKAGE | |
# list files in a deb file | |
dpkg-deb -c <package_name.deb> | |
# see also apt-file(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 | |
# "Bash strict mode" (see http://redsymbol.net/articles/unofficial-bash-strict-mode/) | |
set -euo pipefail | |
IFS=$'\n\t' | |
# Improved "strict mode" (see https://olivergondza.github.io/2019/10/01/bash-strict-mode.html) | |
trap 's=$?; echo >&2 "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR | |
debug() { | |
echo "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $*" >&2 |
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 the owner of an AWS access key | |
# https://stackoverflow.com/a/31275655 | |
for user in $(aws iam list-users --output text | awk '{print $NF}'); do | |
aws iam list-access-keys --user $user --output text | |
done | |
# alternative that uses jq(1) insteaed of awk(1) | |
for user in $(aws iam list-users --query 'Users[*].UserName' --output text); 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
# Parse date | |
# $ pip install python-dateutil | |
from dateutil import parser | |
begin = parser.parse("Aug 28 1999 12:00AM") | |
end = parser.parse("2013-09-11") | |
# Print duration | |
delta = end - begin | |
print str(delta) |
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://github.com/isaacs/github/issues/514#issuecomment-408216389 | |
Array.from(document.getElementsByClassName('js-details-target')).forEach(function(element){element.click()}) |
How do I dropdown?
This is how you dropdown.
<details> <summary>How do I dropdown?</summary> <br> This is how you dropdown.