Skip to content

Instantly share code, notes, and snippets.

View chriskyfung's full-sized avatar

Chris K.Y. FUNG chriskyfung

View GitHub Profile
@chriskyfung
chriskyfung / Optimize-vEthernet-for-BluestacksNxt.ps1
Last active June 11, 2025 17:11
PowerShell Script to Optimize Virtual Ethernet Adapter Performance for BlueStacks with Hyper-V Enabled
#Requires -RunAsAdministrator
Try {
# Disable all Virtual Ethernet Adapters except the Virtual Ethernet Adapter for BlueStacks
Get-NetAdapter -Name "vEthernet *" | where Name -inotmatch ‘BluestacksNxt’ | Disable-NetAdapter -Confirm:$false
# Ensure the Virtual Ethernet Adapter for BlueStacks is active
Enable-NetAdapter -Name "vEthernet (BluestacksNxt)"
# Disable Large Send Offload (LSO) for all Virtual Ethernet Adapters. Learn more: https://learn.microsoft.com/en-us/windows-hardware/drivers/network/performance-in-network-adapters#supporting-large-send-offload-lso
@chriskyfung
chriskyfung / Code-Snippets-for-WordPress-with-WP-Search-with-Algolia-Plugin.md
Last active August 14, 2024 11:44
Custom Code Snippets for WordPress with WP Search with Algolia Plugin

Files

  1. custom-HTML-for-rendering-Algolia-search-results.html

  2. Exclude-specific-pages-from-Indexing-by-WP-Search-with-Algolia.php

  3. Rewrite-URLs-for-WP-Search-with-Algolia.php

@chriskyfung
chriskyfung / Add-additional-URLs-to-wp2static-crawl-list.php
Last active May 4, 2024 03:37
Custom PHP Snippets for WordPress with WP2Static Plugin
<?php
// Function to add additional URLs to the URL queue
function add_additional_urls( $url_queue ) {
// Array of additional URLs to add
$additional_urls = array(
'/ads.txt',
'/_redirects',
// Add your URL paths below:
// '/en/category/category1/page/2/',
// '/en/category/category1/page/3/',
@chriskyfung
chriskyfung / wordpress-docker-compose.yml
Last active July 12, 2024 09:55
Run WordPress locally using Docker // wp-mysql-minimal
version: '3.9'
services:
wordpress:
image: 'wordpress:latest' # Use the latest WordPress image
depends_on:
- "db" # Ensures that the db service is started before WordPress
env_file: .env # Load environment variables from an external file
environment:
WORDPRESS_DB_HOST: db # Database host, uses the service name 'db'
WORDPRESS_DB_NAME: '${MYSQL_DATABASE}' # Database name, loaded from environment
@chriskyfung
chriskyfung / FbPage2WordPressXMLImport.py
Last active July 25, 2021 21:13
Get Posts from Facebook Pages and Convert them to WordPress XML Import File using Python with Facebook Scraper
# source file: https://gist.github.com/chriskyfung/e4c863699223206c23a05eebb89faa13
# last update at 2021-07-17T19:36:05+00:00
from datetime import datetime
from facebook_scraper import get_posts
import urllib
# Parameters
FBPAGE_ID = 'medium' # e.g. The name of target facebook page
NUMOFPAGES = 3 # How many posts to scrape
@chriskyfung
chriskyfung / Calendar_Inspector_for_Todoist_Log.gs
Last active July 10, 2021 03:38
Google Apps Script for the Google Sheet scan and compare the events on Google Calendar with the Todoist records available from IFTTT log file.
/*
This file is the Google Apps Script for the Google Sheet called "Calendar_Inspector_for_Todoist_Log".
The main usage is to scan and compare the events on Google Calendar with the Todoist records
available from IFTTT log file.
*/
// Create menu items in the Google Sheet UI
function onOpen() {
var ui = SpreadsheetApp.getUi();
@chriskyfung
chriskyfung / 00a_mount_drive.py
Last active July 6, 2021 11:00
如何在Colab存取Google Drive上的檔案
# 導入 google.colab 的 drive 模組,在虛擬機中掛載 Google Drive 為路徑 '/gdrive'。
from google.colab import drive
drive.mount('/gdrive')
# 將當前目錄更改為雲端硬碟的根目錄
%cd /gdrive/My Drive/
# 卸載 Google Drive 實例
drive.flush_and_unmount()
@chriskyfung
chriskyfung / upload_to_trello.py
Created June 21, 2021 08:04
Simple python script to upload a file to Trello.
"""
Simple python script to upload a file to Trello.
This script is a demo - done to show how to do it - it doesn't have
much practical purpose as it requires the use of a number of tokens
and identifiers which you can only get programmatically or by visiting
the website (in which case you may as well upload the attachment directly.)
You should read the Trello API docs prior to using this:
https://trello.com/docs/gettingstarted/index.html
@chriskyfung
chriskyfung / gulp-build.sh
Created June 2, 2021 08:16
This script will run GULP build if the gulpfile.js or any .js files are commited to change.
#!/bin/sh
#title :gulp-build.sh
#description :This script will run GULP build if the gulpfile.js or any .js files are commited to change.
#author :@chriskyfung
#date :2021-06-02
#version :1.0
#usage :Run this script with Git Bash on Windows or Bash shell on Unix/Linux
#prerequisite :Installed NVM with Node.js 10.13.1
#==============================================================================
@chriskyfung
chriskyfung / notion-favorite-template-highlighter.user.js
Last active March 26, 2021 09:01
Highlight my favorite items on the Notion Template Gallery
// ==UserScript==
// @name My Favorite Notion Template Highlighter
// @namespace https://chriskyfung.github.io/
// @version 0.1
// @description Highlight my favorite items on the Notion Template Gallery
// @author @chriskyfung
// @match https://www.notion.so/Notion-Template-Gallery-*
// @grant none
// ==/UserScript==