Skip to content

Instantly share code, notes, and snippets.

@thinkingcap
thinkingcap / gist:f59d3357f9080bcc714a88d6c5d80069
Last active April 27, 2024 07:58
Laravel php8.3 extensions
sudo apt install php8.3 php8.3-bcmath php8.3-bz2 php8.3-cli php8.3-common php8.3-curl php8.3-dev php8.3-gd php8.3-igbinary php8.3-imagick php8.3-intl php8.3-mbstring php8.3-msgpack php8.3-mysql php8.3-opcache php8.3-pgsql php8.3-readline php8.3-redis php8.3-ssh2 php8.3-tidy php8.3-xml php8.3-xmlrpc php8.3-zip php8.3-sqlite3
@thinkingcap
thinkingcap / gist:7b12cb00165ebf74b368968b9e6657d3
Created March 16, 2024 00:38
VirtIO drivers manual install
# Define the paths to the MSI files
$virtioWinMSI = "D:\virtio-win-gt-x64.msi"
$guestAgentMSI = "D:\guest-agent\qemu-ga-x86_64.msi"
# Install Virtio-Win MSI
Start-Process msiexec.exe -ArgumentList "/i `"$virtioWinMSI`" /qn" -Wait
# Add the Root CA for the drivers to the TrustedPublisher and the Root CA store
@thinkingcap
thinkingcap / query.sql
Created March 25, 2022 06:03 — forked from mikejolley/query.sql
WooCommerce - SQL to Delete users with no orders or posts
DELETE from wp_users where wp_users.ID not in (
SELECT meta_value FROM wp_postmeta WHERE meta_key = '_customer_user'
) AND wp_users.ID not in (
select distinct(post_author) from wp_posts
);
delete from wp_usermeta where wp_usermeta.user_id not in (select ID from wp_users);

Looking to create a Software RAID 1 setup for your 2-disk server on Ubuntu Server 20.04?

Screen Shot 2020-06-05 at 20 55 31

Let's start with the basics: the official guide by Ubuntu (https://ubuntu.com/server/docs/install/storage) is outdated/wrong. And as of March 2021 it's possible that there's a bug as well with how the bios_grub partitions are created when using multiple disks.

Now on to the solution:

  • Select "Custom storage layout" when you reach the storage configuration step of the installer.
  • If the disks have existing partitions, click on each disk under AVAILABLE DEVICES and then select REFORMAT. This will (temporarily) wipe out the partitions.
{
/**
* Better Defaults
**/
"editor.copyWithSyntaxHighlighting": false,
"diffEditor.ignoreTrimWhitespace": false,
"editor.emptySelectionClipboard": false,
"workbench.editor.enablePreview": false,
"window.newWindowDimensions": "inherit",
"editor.multiCursorModifier": "ctrlCmd",
@thinkingcap
thinkingcap / my.cnf
Created April 29, 2016 13:55 — forked from fevangelou/my.cnf
Optimized MySQL configuration
# Optimized MySQL configuration by Fotis Evangelou - Updated Jan 2016
#
# The settings provided below are a starting point for a 4GB-8GB RAM server with 4 CPU cores.
# If you have less or more resources available you MUST adjust accordingly to save CPU, RAM and disk I/O usage.
# To fine tune these settings for your system, use MySQL DB diagnostics tools like:
# https://launchpad.net/mysql-tuning-primer
# or
# http://blog.mysqltuner.com/download/
# Note that if there is no comment beside a setting, then you don't need to adjust it.
########## Privacy Settings ##########
# Privacy: Let apps use my advertising ID: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 0
# To Restore:
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 1
# Privacy: SmartScreen Filter for Store Apps: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost -Name EnableWebContentEvaluation -Type DWord -Value 0
# To Restore:
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost -Name EnableWebContentEvaluation -Type DWord -Value 1
Import-Module $env:SyncroModule -WarningAction SilentlyContinue
# TODO:
# Cleanup commands after upgrade:
# C:\Windows10Upgrade\Windows10UpgraderApp.exe /ForceUninstall
# Del C:\Windows\UpdateAssistant\*.* /F /Q
#================================================================================
# Configuration
#================================================================================
@thinkingcap
thinkingcap / woocommerce-upsells-shortcode.php
Created July 14, 2019 00:55 — forked from bekarice/woocommerce-upsells-shortcode.php
WooCommerce Upsells Shortcode: outputs product upsells when the [woocommerce_product_upsells] shortcode is used
<?php
/**
* Plugin Name: WooCommerce Upsells Shortcode
* Plugin URI: http://skyver.ge/51
* Description: Adds a shortcode to output WooCommerce product upsells; removes them from the original location when used
* Author: SkyVerge
* Author URI: https://www.skyverge.com/
* Version: 1.0.0
*
* Copyright: (c) 2016 SkyVerge, Inc. (info@skyverge.com)
@thinkingcap
thinkingcap / node-eslint-setup.sh
Last active July 4, 2018 11:35
Node & eslint
# Node & npm
touch ~/.bashrc
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
nvm install 8
npm install -g npm@latest
# ESLint
npm install -g eslint eslint-plugin-html eslint-plugin-markdown eslint-config-airbnb eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-import