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
#!/usr/bin/env bash | |
root="$(git rev-parse --show-toplevel)" # Full file path to the directory where this git repo sits | |
cd "$root" # Required to make the relative file paths to eslint and stylelint work | |
for file in $(git diff --name-only --cached) # List of staged files | |
do | |
filename="${file##*/}" # Remove all except the characters after the last '/' | |
extension="${filename##*.}" # Remove all except the characters after the last '.' |
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
#!/usr/bin/env bash | |
cat /dev/urandom | gzip --best >> /dev/null & |
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
# December 2021 update: this gist is not maintained. | |
# View the latest version of this function in my module: https://github.com/ardislu/ArdisUtilities | |
Param( | |
[string]$Value = '', | |
[string]$Algorithm = 'SHA1' | |
) | |
$stream = [System.IO.MemoryStream]::new([byte[]][char[]]$Value) |
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
#!/usr/bin/env bash | |
sudo env PATH=$PATH pm2 start "ipfs daemon --enable-gc" --name "ipfs" --max-memory-restart 256M |
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
#!/usr/bin/env bash | |
# NOTE: These are legacy agents that are replaced by the Ops Agent | |
# https://cloud.google.com/stackdriver/docs/solutions/agents/ops-agent/installation | |
# Download monitoring agent script, install it, and start the agent | |
curl -sSO https://dl.google.com/cloudagents/add-monitoring-agent-repo.sh | |
sudo bash add-monitoring-agent-repo.sh --also-install | |
sudo service stackdriver-agent start |
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
#!/usr/bin/env bash | |
# Download ops agent script, install it, and check that the agent is running | |
curl -sSO https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.sh | |
sudo bash add-google-cloud-ops-agent-repo.sh --also-install | |
sudo systemctl status google-cloud-ops-agent"*" |
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
# Run /home/username/example.sh every 15 minutes | |
*/15 * * * * /bin/sh /home/username/example.sh |
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
[System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($args[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
const uuid = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; | |
uuid.replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, '$1-$2-$3-$4-$5'); | |
// 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' |
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
#!/usr/bin/env bash | |
sudo grep 'Invalid user' /var/log/auth.log | less -N |
OlderNewer