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 | |
#add swap | |
SWAP_SIZE="2G" | |
SWAP_MOUNT_NAME='/swapfile' | |
SWAP_EXISTS=`swapon -s` | |
SWAP_ON_STARTUP="$SWAP_MOUNT_NAME swap swap sw 0 0" | |
if [[ -z $SWAP_EXISTS ]] && [[ ! -f $SWAP_MOUNT_NAME ]] ; then | |
fallocate -l $SWAP_SIZE ${SWAP_MOUNT_NAME} |
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/sh | |
HOST="localhost" | |
USER="root" | |
PASSWORD="root" | |
DB="--all-databases" | |
DATE=`date +%Y-%m-%d.%H.%M.%S` | |
NAME="mysql.backup.${DB}.${DATE}.sql.gz" | |
COMMAND="mysqldump -h ${HOST} -u ${USER} -p$PASSWORD ${DB} | gzip -c > ${NAME}" | |
SCP_COMMAND="scp ${NAME} user@backup-server:/path/to/backup/folder/" |
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' | |
GREEN="\e[92m" | |
RED="\e[91m" | |
NC="\033[0m" | |
printf "${GREEN}Mailgun send email CLI${NC}\n" | |
function required { | |
while [[ true ]]; do | |
local _name=$1 | |
local _label=$2 | |
local _multiline=$3 |
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 net = require('net'); | |
const server = net.createServer( socket => { | |
socket.on('data', (data) => { | |
let message = data.toString('utf-8').trim(); | |
console.log('incoming data ', message); | |
if (message === 'exit') { | |
let connectionName = socket.address().port + socket.address().address; | |
console.log('closing connection to ', connectionName); | |
socket.write('exiting...'); | |
socket.destroy(); |
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 amqp = require('amqplib'); | |
const connect = amqp.connect('amqp://localhost'); | |
let queue1 = 'queue1', queue2 = 'queue2'; | |
connect.then( conn => { | |
return conn.createChannel(); | |
}) | |
.then(ch => { | |
return Promise.all([ch.assertQueue(queue1), ch.assertQueue(queue2)]).then((ok1,ok2) => { | |
return Promise.resolve(ch); |
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 . -type f -regextype posix-extended -regex '.*(css|js)$' -exec brotli -fZ {} \; |
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
mount -o remount,size=10G /tmp/ |
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 api = require('wpapi'); | |
const wp = new api({ | |
endpoint: 'https://wordpress.domain/wp-json', | |
username: 'admin', | |
password: 'admin' | |
}); | |
var tags = ['a','b','c']; | |
var getOrCreateTags = tags.map(tag => { | |
return wp.tags().slug(tag) |
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/sh | |
LOCAL_BACKUP_FOLDER="/home/user/backup" | |
S3_BACKUP_FOLDER="s3://bucket-name/backup_folder/" | |
WEBSITE_PATH="/var/www" | |
WEBSITE_BACKUP_NAME="mywebsites.tar.gz" | |
printf "\nCREATING BACKUP ARCHIVE FROM ${WEBSITE_PATH}\n\n" | |
tar -czf "${LOCAL_BACKUP_FOLDER}/${WEBSITE_BACKUP_NAME}" -C "${WEBSITE_PATH}" . | |
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
[client] | |
user=root | |
password=root | |
host=localhost | |
port=3306 |
OlderNewer