Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Argus Duong tdtgit

🏠
Working from home
View GitHub Profile
View domain.json
[
"https://datuan.dev",
"https://google.com"
]
View huge-sitemap.xml
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="//datuan.dev/main-sitemap.xsl"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.google.com/schemas/sitemap-image/1.1 http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://datuan.dev/</loc>
</url>
<url>
<loc>https://datuan.dev/backlog/thang-12-kubernetes-azdigi-lvh/</loc>
<lastmod>2021-12-06T22:10:46+07:00</lastmod>
View lazyload-datuan.js
if ('loading' in document.createElement('img')) {
document.querySelectorAll('[loading="lazy"]').forEach(elem => {
if (elem.dataset.src) {
elem.src = elem.dataset.src;
}
if (elem.dataset.srcset) {
elem.srcset = elem.dataset.srcset;
}
})
} else {
View warmupv3.sh
#!/bin/bash
DOMAIN=$1
scan_sitemap () {
[ -z "$1" ] && URL="https://$DOMAIN/sitemap.xml" || URL=$1
curl -L --compressed $URL 2>/dev/null | grep -Eo "http(s?):\/\/$DOMAIN[^ \"\'()\<>]+" | while read line; do
if [[ $line = *.xml ]]
then
echo "👉 Sitemap $line"
View Dockerfile-WordPressPDO
FROM php:5.6-apache
RUN a2enmod rewrite
# install the PHP extensions we need
RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev && rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-install gd
RUN docker-php-ext-install mysqli
RUN docker-php-ext-install pdo php_pdo
View xiaomi_to_youtube.sh
#!/bin/bash
# Your DDNS hostname or static IP
HOSTNAME="xxx.xxx.xxx.xxx"
# Username on source server
USER="root"
# Your camera MAC address
CAMERA_MAC="7811DCCCXXXX"
DATE=`/bin/date +%Y%m%d%H`
View functions.php
if ( is_category( array(1, 2, 3) ) ) {
// Do something
} else {
// Do something else
}
View warmup.sh
#!/bin/bash
#
# Written by AC - 2015 <al@terraltech.com> - sys0dm1n.com
#
URL=$1
wget --quiet http://$URL/sitemap.xml --no-cache --output-document - | egrep -o "http(s?)://$URL[^ \"\'()\<>]+" | while read line; do
if [[ $line == *.xml ]]
then
newURL=$line
@tdtgit
tdtgit / functions.php
Last active Feb 4, 2022
HTTP/2 Push CSS/JS with Autoptimize WordPress's plugin
View functions.php
<?php
add_filter('autoptimize_filter_cache_getname', 'pushAOFiles');
function pushAOFiles($in) {
$pushType = substr($in, strrpos($in, ".") + 1) === "js" ? "script" : "style";
// Do not push CSS files if it is already inline.
if ($pushType == "style" && ((bool)get_option("autoptimize_css_inline", true))) return;
View functions.php
/**
* Disable zxcvbn.min.js on WordPress loading
*/
function deregister_or_dequeue_scripts() {
wp_dequeue_script('wc-password-strength-meter');
}
add_action('wp_print_scripts', 'deregister_or_dequeue_scripts', 20);