Skip to content

Instantly share code, notes, and snippets.

View bacnd's full-sized avatar
✔️

Nguyễn Đình Bắc bacnd

✔️
View GitHub Profile
@bacnd
bacnd / debug.log
Created January 6, 2024 19:21 — forked from khoipro/debug.log
Sample function delete related attachments (created by ACF) when deleting a post
[06-Jan-2024 16:29:06 UTC] INFO: Delete product 188: delete gallery attachment id 189
[06-Jan-2024 16:29:06 UTC] INFO: Delete product 188: delete gallery attachment id 190
[06-Jan-2024 16:29:06 UTC] INFO: Delete product 188: delete gallery attachment id 191
[06-Jan-2024 16:29:06 UTC] INFO: Delete product 188: delete gallery attachment id 192
[06-Jan-2024 16:29:06 UTC] INFO: Delete product 188: delete gallery attachment id 193
[06-Jan-2024 16:29:06 UTC] INFO: Delete product 188: delete gallery attachment id 194
[06-Jan-2024 16:29:06 UTC] INFO: Delete product 188: delete gallery attachment id 195
[06-Jan-2024 16:29:06 UTC] INFO: Delete product 188: delete gallery attachment id 196
[06-Jan-2024 16:29:06 UTC] INFO: Delete product 188: delete gallery attachment id 197
[06-Jan-2024 16:29:06 UTC] INFO: Delete product 188: delete video attachment id 235
@bacnd
bacnd / commands.sh
Created December 24, 2023 17:41 — forked from khoipro/commands.sh
Useful commands for interacting with Ubuntu/*nix OS
# import db .sql to site
# tutorial: https://fullstack-tutorials.com/mysql/mysql-import-database-from-sql-file-in-linux
gunzip < dump.sql.gz | mysql -u username -p database
# extract db to .sql.gz
# tutorial: https://fullstack-tutorials.com/mysql/mysql-export-database-to-gzip-file-in-linux
mysqldump -u username -p database_name | gzip > dump.sql.gz
@bacnd
bacnd / ca.md
Created December 24, 2023 17:10 — forked from soarez/ca.md
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@bacnd
bacnd / client.js
Created October 16, 2023 09:57 — forked from georgestephanis/client.js
This is an example client app to integrate with the WordPress 5.6 Application Passwords system. It walks the user through authenticating, and then queries and enumerates all users on the site.
(function($){
const $root = $( '#root' );
const $stage1 = $( '.stage-1', $root );
const $stage2 = $( '.stage-2', $root );
// If there's no GET string, then no credentials have been passed back. Let's get them.
if ( ! window.location.href.includes('?') ) {
// Stage 1: Get the WordPress Site URL, Validate the REST API, and Send to the Authentication Flow
const $urlInput = $( 'input[type=url]', $stage1 );
<!-- Đặt mục lục vào vị trí bạn muốn hiển thị nó trong bài viết -->
<div class="table-of-content-webantam">
<span class='muc-luc'> Mục lục</span>
<ol id="toc-list">
<!-- Mục lục tự động sẽ được tạo ở đây -->
</ol>
</div>
<!-- Đặt nội dung bài viết vào phần tử có ID "article-content" -->
<div id="article-content">
@bacnd
bacnd / functions.php
Created July 29, 2023 17:07 — forked from khoipro/functions.php
Fix Rankmath pro - product category schema
<?php
add_filter('rank_math/json_ld', 'codetot_product_rich_snippet_schema', 100);
/**
* Fix RankMath missing `AggregateRating` on product category schema
*
* @author codetot
*/
function codetot_product_rich_snippet_schema( $data ) {
@bacnd
bacnd / install_lamp_ubuntu.sh
Created May 9, 2023 09:54 — forked from ankurk91/install_lamp_ubuntu.sh
Ubuntu 22 - PHP development (php 7.4 / 8.2, apache 2.4)
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# Ubuntu 20/22 dev Server
# Run like (without sudo) - bash install_lamp.sh
# Script should auto terminate on errors
export DEBIAN_FRONTEND=noninteractive
@bacnd
bacnd / guide.txt
Created April 6, 2023 15:47 — forked from tuongpgjz/guide.txt
SIze guide button - WCPA addons custom
/*
Tạo element paragraph trước element size, đặt class là `float-position-element` trong mục Advanced của element.
Thay thế block UX id `lightbox-sizechart` bằng block chứa size-chart của bạn.
Nội dung element: <a href="#lightboxsizechart" target="_self" class="button secondary is-xsmall custom-sizeguide"><span>Size Guide</span></a>[lightbox width="800px" id="lightboxsizechart"][block id="lightbox-sizechart"][/lightbox]
Demo: https://greencity.woocodex.com/product/jesus-is-my-god-all-over-printed-shirts-221220/
*/
@bacnd
bacnd / example-virtual-host.ssl.test.conf
Created September 15, 2022 04:08 — forked from ankurk91/example-virtual-host.ssl.test.conf
Sample virtual host .conf file for Apache2 on Ubuntu
# This to be used when you need to implement SSL
# Make sure that apache mod_ssl is on
# You can generate self signed certificates for development
# http://www.selfsignedcertificate.com/
<VirtualHost *:443>
ServerName yourapp.test
#ServerAlias www.yourapp.test
@bacnd
bacnd / multisend.sol
Created April 13, 2022 15:32 — forked from maiiz/multisend.sol
multisend erc20 token
pragma solidity ^0.4.11;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;