Skip to content

Instantly share code, notes, and snippets.

@beastycoding
beastycoding / remove-old-bucket-indexes.sh
Created January 17, 2024 16:43
Ceph RADOS Gateway - Remove bucket indexes
#!/bin/bash
for bucket in $(radosgw-admin bucket list | jq -r .[]); do
bucket_id=$(radosgw-admin metadata get bucket:${bucket} | jq -r .data.bucket.bucket_id)
marker=$(radosgw-admin metadata get bucket:${bucket} | jq -r .data.bucket.marker)
for instance in $(radosgw-admin metadata list bucket.instance | jq -r .[] | grep "^${bucket}:" | grep -v ${bucket_id} | grep -v ${marker}| cut -f2 -d':'); do
echo "${bucket}: ${instance}"
radosgw-admin bi purge --bucket=${bucket} --bucket-id=${instance}
radosgw-admin metadata rm bucket.instance:${bucket}:${instance}
done
@beastycoding
beastycoding / functions.php
Created September 23, 2023 06:22 — forked from cliffordp/functions.php
Automatically login a single WordPress user upon arrival to a specific page.
<?php
/**
* Automatically login a single WordPress user upon arrival to a specific page.
*
* Redirect to home page once logged in and prevent viewing of the login page.
* Compatible with WordPress 3.9.1+
* Updated 2014-07-18 to resolve WP_DEBUG notice: "get_userdatabylogin is deprecated since version 3.3! Use get_user_by('login') instead."
* Updated 2019-07-09 to reformat code, pass 2nd parameter to `do_action()`, and hook into priority 1.
*
@beastycoding
beastycoding / wordpress-display-query-variables.php
Created September 9, 2023 10:51 — forked from deepak-rajpal/wordpress-display-query-variables.php
WordPress display all wp_query and query variables (post information etc)
<?php
global $wp_query;
echo "<pre>";
var_dump($wp_query->query_vars);
var_dump($wp_query);
echo "</pre>";
?>
@beastycoding
beastycoding / link_post_translation.php
Created September 5, 2023 12:15 — forked from djoo/link_post_translation.php
WPML Custom end point link 2 existing translation
<?php
/**
* Link the FR translation and the EN translation
* Called by API https://domain.com/wp-json/link_translation/post/
*/
function custom_rest_link_translation($data) {
//Source https://wpml.org/wpml-hook/wpml_set_element_language_details/
@beastycoding
beastycoding / install.sh
Created August 16, 2023 10:58 — forked from ikr4-m/install.sh
Hyper-V Enhanced Session for Debian
#!/bin/sh
# This script based on linux-vm-tools for Ubuntu 22.02.
# Thanks to https://github.com/Hinara/linux-vm-tools/ to script
# This script is for Ubuntu 22.04 Jammy Jellyfish to download and install XRDP+XORGXRDP via
# source.
#
# Major thanks to: http://c-nergy.be/blog/?p=11336 for the tips.
#
@beastycoding
beastycoding / cdn-jquery.php
Created April 6, 2023 10:52 — forked from Shelob9/cdn-jquery.php
Replace WordPress' jQuery with CDN jQuery of the right version
add_action( 'init', function(){
if ( ! is_admin()) {
if( is_ssl() ){
$protocol = 'https';
}else {
$protocol = 'http';
}
/** @var WP_Scripts $wp_scripts */
global $wp_scripts;
@beastycoding
beastycoding / move-storage.sh
Created April 1, 2023 14:51 — forked from mrl22/move-storage.sh
Bash script to move storage of all Proxmox Virtual Machines to different storage
#!/bin/sh
movefrom='micronssd'
moveto='wdredpro'
for vm in $(qm list | awk '{print $1}' | grep -Eo '[0-9]{1,3}');
do
for storage in $(qm config $vm | grep $movefrom: | awk '{print $1}' | grep -Eo '[a-z0-9]+');
do
echo Moving VM$vm Storage $storage
@beastycoding
beastycoding / docker-compose.yaml
Created March 29, 2023 08:12 — forked from natcl/docker-compose.yaml
docker-compose static IP example
version: '3'
networks:
mynetwork:
ipam:
config:
- subnet: 172.20.0.0/24
services:
nodered1:
image: nodered/node-red-docker
ports:
@beastycoding
beastycoding / Ubuntu_on_Hyper-V.md
Created January 26, 2023 05:43 — forked from deoren/Ubuntu_on_Hyper-V.md
Ubuntu on Hyper-V

Enabling full Hyper-V support for Ubuntu

Install packages

Short version: See docs.microsoft.com link below.

Ubuntu 17.04 and later

  1. sudo apt-get update
  2. sudo apt-get install linux-image-virtual linux-tools-virtual linux-cloud-tools-virtual
@beastycoding
beastycoding / debian-fullscreen-in-hyperv.md
Created January 25, 2023 18:55 — forked from robert-claypool/debian-fullscreen-in-hyperv.md
How To Make Debian Linux Fullscreen in Hyper-V