Skip to content

Instantly share code, notes, and snippets.

View quangbahoa's full-sized avatar
🎯
Focusing

Le Duy Quang quangbahoa

🎯
Focusing
View GitHub Profile

Run from Terminal:

python3 odoo-bin shell -d mydb --addons-path=/your/addons/path

Run from python console:

self.env['ir.module.module'].search([('name', '=', 'crm')]).button_immediate_uninstall()

AES-256 encryption and decryption in PHP and C#

Update: There is a more secure version available. Details

PHP

<?php

$plaintext = 'My secret message 1234';
@quangbahoa
quangbahoa / Commands
Created November 13, 2023 08:13 — forked from lukecav/Commands
Bulk update all product posts in WooCommerce with a post status of publish or draft using a WP-CLI command
# Bulk update all product posts with a post status of publish to draft
wp post list --field=ID --post_type=product --posts_per_page=500 --post_status=publish | xargs wp post update --post_status=draft
# Bulk update all product posts with a post status of draft to publish
wp post list --field=ID --post_type=product --posts_per_page=500 --post_status=draft | xargs wp post update --post_status=publish
@quangbahoa
quangbahoa / font.css
Created November 25, 2022 04:23 — forked from angusjune/font.css
Better Helvetica Font Family
body {
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
}
@quangbahoa
quangbahoa / functions.php
Created July 8, 2012 22:33
Buddypress Favorite Post
## functions.php
/*
--------------------------------------------------------------------------------
Favorites button applied to individual posts
Based on: http://www.dnxpert.com/2010/06/11/mark-blog-post-as-favorite-in-buddypress/
--------------------------------------------------------------------------------
*/
function my_bp_activity_is_favorite($activity_id) {
@quangbahoa
quangbahoa / wordpress.vcl
Last active June 19, 2021 01:32 — forked from matthewjackowski/wordpress.vcl
Varnish 4 VCL configuration for WordPress. Also allows purging
# A heavily customized VCL to support WordPress
# Some items of note:
# Supports https
# Supports admin cookies for wp-admin
# Caches everything
# Support for custom error html page
vcl 4.0;
import directors;
import std;
@quangbahoa
quangbahoa / gist:65c8c0a8773aa4788a2acaac46763368
Last active December 8, 2020 06:57 — forked from vicnicius/gist:8685678
Script for optimizing all .jpg images inside a folder, using jpegoptim

Install first

find -type f -name "*.jpg" -exec jpegoptim --strip-all {} \;

For PNG apt-get install optipng

find -name '*.png' -print0 | xargs -0 optipng -o7

For JPG

@quangbahoa
quangbahoa / default.vcl_PREFACE.md
Created December 6, 2020 08:52 — forked from fevangelou/default.vcl_PREFACE.md
The perfect Varnish configuration for Joomla, WordPress & other CMS based websites

The perfect Varnish configuration for Joomla, WordPress & other CMS based websites

IMPORTANT: Read this before implementing one of the configuration files below (for either Varnish 3.x or 4.x+).

USE: Replace the contents of the main Varnish configuration file located in /etc/varnish/default.vcl (root server access required - obviously) with the contents of the configuration you'll use (depending on your Varnish version) from the 2 examples provided below.

IMPORTANT: The following setup assumes a 180 sec (3 minute) cache time for cacheable content that does not have the correct cache-control HTTP headers. You can safely increase this to 300 sec (or more) for less busier sites or drop it to 60 sec or even 30 sec for high traffic sites.

This configuration requires an HTTP Header and a user cookie to identify if a user is logged in a site, in order to bypass caching overall (see how it's done for Joomla & WordPress). If your CMS provides a way to add these two requirements, then you can use this configurati

@quangbahoa
quangbahoa / enable-gpf-render-cache.php
Last active November 9, 2020 11:52 — forked from leewillis77/enable-gpf-render-cache.php
Enable WooCommerce Google Product Feed extension feed item cache.
<?php
/*
Plugin Name: Product Feed Cache Fixed
Plugin URI: vncase.com
Description: Enables feed item caching in the Google Product Feed extension.
Version: 1.0
Author: Le
Author URI: https://cleon.vn
*/
<!doctype html>
<html>
<head>
<title>"PHP Encode v1.0 by zeura.com" decoder =))</title>
<meta charset="utf-8">
</head>
<body>
<form method="POST">
<h1>Decode tool for <a href="http://www.phpencode.org">http://www.phpencode.org</a></h1>
<textarea name="code" rows="10" style="width: 100%" placeholder="Paste code here"></textarea><br />