Skip to content

Instantly share code, notes, and snippets.

Northon Torga ntorga

Block or report user

Report or block ntorga

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ntorga
ntorga / convert-base64-images.sh
Created Apr 4, 2019
Decode base64 images into media files and replace the original file with WordPress upload folder. You need to upload the images into /wp-content/uploads/ after finishing.
View convert-base64-images.sh
#!/bin/bash
file=${1}
for extension in png jpeg jpg gif bmp; do
for image in `grep -ho "data:image/${extension};base64,[A-Za-z0-9+/=]*" ${file}`; do
image_signature=$(echo ${image} | md5sum | awk '{print $1}')
echo ${image} > ${image_signature}.hash
rm -f to-replace.script
echo "s|$(cat ${image_signature}.hash)|/wp-content/uploads/${image_signature}.${extension}|g" > to-replace.script
sed -i -f to-replace.script ${file}
sed -i "s|data:image/${extension};base64,||g" ${image_signature}.hash
@ntorga
ntorga / CSP Header for Fixing Mix Content Issues
Last active Aug 29, 2018
Works great on modern browsers, not on IE tho.
View CSP Header for Fixing Mix Content Issues
<ifModule mod_headers.c>
Header always set Content-Security-Policy "upgrade-insecure-requests;"
</IfModule>
View non-www to www with https
# BEGIN REDIRECT TO HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-DELIVERED-BY} !^8CDN
RewriteCond %{HTTP_HOST} ^seudominio.com.br [OR]
RewriteCond %{HTTP_HOST} ^www.seudominio.com.br [NC]
RewriteRule ^(.*)$ https://www.seudominio.com.br/$1 [L,R=301]
RewriteEngine On
View nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/
gpgcheck=0
enabled=1
View xubuntu-install.sh
#!/bin/bash
#
# The script will perform most of the steps, however, you must edit a few settings manually AFTER running the script:
#
# 1) a) Menu Whisker (the Start Menu) -> Properties => 90% opacity // Icon -> All Icons - Search "view-list-icons";
# b) Panel -> Panel Preferences => Row Size 48px;
# c) Windows Buttons -> Unmark "Show button labels";
# NOTE: I use 48px icons cause my screen is 4K.
#
# 2) a) Appearance => MacBuntu-Sierra-dark;
View How to fix Awstats cPanel 404 Error
/usr/local/cpanel/scripts/update_local_rpm_versions --edit target_settings.awstats installed
/scripts/check_cpanel_rpms --fix
wget https://git.io/vS0G8 -O /usr/local/cpanel/base/frontend/paper_lantern/stats/awstats_landing.html.tt
wget https://git.io/vS0HQ -O /usr/local/cpanel/base/frontend/paper_lantern/stats/bandwidth.html.tt
View timezone-htaccess
php_value date.timezone 'America/Sao_Paulo'
View Mautic New Admin - SQL Query
INSERT INTO `users` (`id`, `role_id`, `is_published`, `date_added`, `created_by`, `created_by_user`, `date_modified`, `modified_by`, `modified_by_user`, `checked_out`, `checked_out_by`, `checked_out_by_user`, `username`, `password`, `first_name`, `last_name`, `email`, `position`, `timezone`, `locale`, `last_login`, `last_active`, `online_status`, `preferences`)
VALUES
(2, 1, 1, '2015-04-01 15:15:07', 1, 'Nobody', NULL, NULL, NULL, NULL, NULL, NULL, 'madmin', '$2y$13$VkE7UjFetqAM13oT4v/VYOfRCGrJ4hbr0zuwRZo6KVfDnNb16WFwy', 'Administrator', 'Uuser', 'user@local.host', NULL, NULL, NULL, NULL, NULL, 'offline', 'N;');
View Increase WordPress Memory Limit
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' );
You can’t perform that action at this time.