View rgbaToRgb.ts
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
interface RGBAtoRGBOptions { | |
toColorRGBA: string; | |
backgroundColorRGB?: string; | |
} | |
function rgbaToRgb({ toColorRGBA, backgroundColorRGB = 'rgb(255,255,255)' }: RGBAtoRGBOptions) { | |
const [r, g, b, a] = toColorRGBA | |
.replace(/rgba|\(|\)/g, '') | |
.split(',') | |
.map((str) => parseInt(str, 2)); |
View mysql-backup.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
#!/bin/bash | |
USER=root | |
PASSWORD=root | |
DATE_NOW="`date '+%Y-%m-%d_%H-%M-%S'`" | |
DIR=/var/local/backup | |
DATABASES=`mysql -u$USER -p$PASSWORD -e "SHOW DATABASES;" | tr -d "| " | grep -v Database` | |
echo "Databases found: $DATABASES" |
View mysql-backup-tar-gz.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
#!/bin/bash | |
MYSQL_USER=root | |
MYSQL_PASS=root | |
MYSQL_DB=test | |
BACKUP_DIR=/var/local/backup | |
LOGS_DIR=/var/log | |
# Equals to 3 last days |
View khasky.com-reverse-proxy.conf
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
<IfModule mod_ssl.c> | |
<VirtualHost *:443> | |
# ...config | |
# NodeJS server start | |
ProxyRequests Off | |
ProxyPreserveHost On | |
ProxyVia Full | |
<Proxy *> |
View khasky.com-le-ssl.conf
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
<IfModule mod_ssl.c> | |
<VirtualHost *:443> | |
ServerAdmin hello@khasky.com | |
ServerName khasky.com | |
ServerAlias www.khasky.com | |
DocumentRoot /var/www/khasky.com/public_html | |
ErrorLog ${APACHE_LOG_DIR}/error.log | |
CustomLog ${APACHE_LOG_DIR}/access.log combined | |
Include /etc/letsencrypt/options-ssl-apache.conf | |
SSLCertificateFile /etc/letsencrypt/live/khasky.com/fullchain.pem |
View khasky.com.conf
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
<VirtualHost *:80> | |
ServerAdmin hello@khasky.com | |
ServerName khasky.com | |
ServerAlias www.khasky.com | |
DocumentRoot /var/www/khasky.com/public_html | |
ErrorLog ${APACHE_LOG_DIR}/error.log | |
CustomLog ${APACHE_LOG_DIR}/access.log combined | |
RewriteEngine on | |
RewriteCond %{SERVER_NAME} =khasky.com [OR] |