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
# Base64 string 20 char legth | |
openssl rand -base64 20 |
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
# This script is used to send a slack notification to the channel configured in the webhook url | |
# See this page for creating a webhook in slack https://slack.com/help/articles/115005265063-Incoming-webhooks-for-Slack | |
# To use this script, change the fallback values for the params below | |
# Update the path to the package.json or set the $VERSION variable before calling this script | |
# Usage afte updating the script just execute it to send the message ./slack-bot.sh | |
FALLBACK="${TITLE:-:rocket: Deployed app}" | |
PRETEXT="${TITLE:-:rocket: Deployed app}" | |
COLOR="${COLOR:-#36a64f}" | |
AUTHOR_NAME="${AUTHOR_NAME:-Custom Slack Bot}" |
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
xip -x file.xip | |
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
git remote prune origin prunes tracking branches not on the remote. | |
git branch --merged lists branches that have been merged into the current branch. | |
xargs git branch -d deletes branches listed on standard input. | |
Be careful deleting branches listed by git branch --merged. The list could include master or other branches you'd prefer not to delete. | |
To give yourself the opportunity to edit the list before deleting branches, you could do the following in one line: |
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
# basic usage | |
diskutil eraseDisk FILE_SYSTEM DISK_NAME DISK_IDENTIFIER | |
#Formatting a Disk to Mac OS Extended Journaled (JHFS+) from Terminal in Mac OS X | |
diskutil eraseDisk JHFS+ DiskName /dev/DiskNodeID | |
#Formatting a Disk to Mac OS Extended (HFS+) from Terminal in Mac OS X | |
diskutil eraseDisk HFS+ DiskName /dev/DiskNodeID | |
#Formatting a Disk to MS-DOS fat32 from the Command Line in Mac OS X | |
diskutil eraseDisk FAT32 DiskName /dev/DiskNodeID | |
#Formatting a Disk to ExFAT from the Command Line in Mac OS X | |
diskutil eraseDisk ExFAT DiskName /dev/DiskNodeID |
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
macbook$ sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache |
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 all docker images matching pattern | |
docker images -a | grep "pattern" | awk '{print $3}' | xargs docker rmi | |
# Force remove all docker images matching pattern | |
docker images -a | grep "pattern" | awk '{print $3}' | xargs docker rmi -f | |
# List all images | |
docker images -a | |
# Remove all imaages | |
docker rmi $(docker images -a -q) |
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
// Intersection | |
let intersection = arr1.filter(x => arr2.includes(x)); | |
// For [1,2,3] [2,3] it will yield [2,3]. On the other hand, for [1,2,3] [2,3,5] will return the same thing. | |
// Difference | |
let difference = arr1.filter(x => !arr2.includes(x)); | |
// For [1,2,3] [2,3] it will yield [1]. On the other hand, for [1,2,3] [2,3,5] will return the same thing. | |
// For a symmetric difference, you can do: | |
let difference = arr1 |
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
# Find the repo | |
sudo add-apt-repository ppa:certbot/certbot | |
sudo apt-get update | |
# Get cert bot | |
sudo apt-get install python-certbot-apache | |
# The certbot Let’s Encrypt client is now ready to use. | |
# Setup cert for one domain |
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
# Note the current urls to later be used in DB update | |
# use the flag --allow-root if only have a root user | |
wp option get siteurl | |
wp option get home --allow-root | |
wp option update home 'https://example.com' | |
wp option update siteurl 'https://example.com' | |
# Search and replace all the old urls to reference the new one | |
wp search-replace 'http://example.test' 'http://example.com' |
NewerOlder