This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Used this to get things up and running in proxmox / ubuntu vm | |
# Update package lists | |
sudo apt-get update | |
# Install required packages | |
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common | |
# Add Docker’s official GPG key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
#include <SPI.h> | |
#include <Adafruit_Sensor.h> | |
#include <Adafruit_BME280.h> | |
// Define I2C pins for ESP32 | |
#define SDA_PIN 11 | |
#define SCL_PIN 12 | |
// BME280 object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
:: Get current user's session ID | |
for /f "tokens=1,2,3 delims= " %%i in ('query session ^| findstr "%USERNAME%"') do set SessionId=%%k | |
:: Reconnect the session to the console | |
Tscon %SessionId% /Dest:console | |
:: Restart Windows Explorer | |
taskkill /f /im explorer.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Plex duplicate finder for PowerShell written by Sean W. https://cybersholt.com | |
# Copyright (c) 2023 Sean W. <cybersholt@gmail.com> All rights reserved. | |
# Use of this source code is governed by a BSD-style | |
# license that can be found in the LICENSE file. | |
# SPDX-License-Identifier: BSD-3-Clause | |
# Function to test connectivity to the Plex server | |
Function Test-PlexConnectivity { | |
param( | |
[string]$server, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# need to have bsdtar installed to get it on raspberry pi | |
# sudo apt install libarchive-tools | |
# Use \033 if you need OS X compatibility | |
# e.g. RED='\033[0;31m' && echo -e ${RED}"My red text"... | |
# Reset | |
Color_Off='\e[0m' # Text Reset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Software { | |
[string]$Name | |
[string]$Id | |
[string]$Version | |
[string]$AvailableVersion | |
} | |
# This fixes the character encoding issue | |
[System.Console]::OutputEncoding = [System.Text.UTF8Encoding]::new() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT wpp.post_title, wpp.ID, wpp.post_date, mt1.meta_value as focus_keyword, | |
REPLACE( REPLACE( REPLACE( REPLACE( wpo.option_value, '%year%', DATE_FORMAT(wpp.post_date,'%Y') ), '%monthnum%', DATE_FORMAT(wpp.post_date, '%m') ), '%day%', DATE_FORMAT(wpp.post_date, '%d') ), '%postname%', wpp.post_name ) AS permalink | |
FROM wp_posts wpp | |
LEFT JOIN wp_postmeta AS mt1 ON (wpp.ID = mt1.post_id AND mt1.meta_key='_yoast_wpseo_focuskw') | |
JOIN wp_options wpo | |
ON wpo.option_name = 'permalink_structure' | |
WHERE wpp.post_type = 'post' | |
AND wpp.post_status = 'publish' | |
ORDER BY wpp.post_date DESC; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'elementor_pro/forms/validation', function ( $record, $ajax_handler ) { | |
$email = $record->get_field( [ 'id' => 'email' ] ); | |
if ( $email ) { | |
if ( ! filter_var( $email['email']['value'], FILTER_VALIDATE_EMAIL ) ) { | |
$ajax_handler->add_error( $email['email']['id'], 'The email address is invalid.' ); | |
} | |
} | |
}, 10, 2 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function s3Ranger($key) | |
{ | |
// inspired by https://stackoverflow.com/a/4635991/2320760 | |
$s3 = new S3Client( | |
array( | |
'version' => 'latest', | |
'region' => 'us-east-1', | |
'credentials' => [ | |
'key' => $key, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Original @ https://stackoverflow.com/questions/14559371/symfony2-video-streaming | |
use SplFileInfo; | |
use RuntimeException; | |
// Symfony >= 2.1 | |
use Symfony\Component\HttpFoundation\StreamedResponse; | |
public function streamAction($fileName) { |
NewerOlder