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
sentence.replace(/(a|u|e|o)/gi, (letter) => letter.toLowerCase() === letter ? 'i' : 'I') |
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
ffmpeg -i input.flv -c:v h264_nvenc -c:a copy -rc constqp -qp 28 output.mp4 |
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
[client] | |
user=root | |
password=root | |
host=localhost | |
port=3306 |
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
#!/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 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
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 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
mount -o remount,size=10G /tmp/ |
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 . -type f -regextype posix-extended -regex '.*(css|js)$' -exec brotli -fZ {} \; |
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
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 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
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 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
#!/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 |