Skip to content

Instantly share code, notes, and snippets.

View Beagon's full-sized avatar
🧙‍♂️

Robin Rijkeboer Beagon

🧙‍♂️
View GitHub Profile
@Beagon
Beagon / jellyfin-media-path.sql
Created November 25, 2024 20:04
Change media path for Jellyfin
-- This is executed on library.db
-- I merged disk1 and disk2 into one. This meant remove disk1 and disk2/media.
UPDATE TypedBaseItems SET Path = replace(Path, 'disk1/', '');
UPDATE TypedBaseItems SET Path = replace(Path, 'disk2/media/', '');
UPDATE TypedBaseItems SET Images = replace(Images, 'disk1/', '');
UPDATE TypedBaseItems SET Images = replace(Images, 'disk2/media/', '');
UPDATE TypedBaseItems SET data = replace(data, 'disk1/', '');
UPDATE TypedBaseItems SET data = replace(data, 'disk2/media/', '');
UPDATE mediastreams SET Path = replace(Path, 'disk1/', '');
UPDATE mediastreams SET Path = replace(Path, 'disk2/media/', '');
@Beagon
Beagon / MAGETWO-96908.patch
Created May 24, 2019 08:46
MAGETWO-96908: Fix MySQL Syntax error on indexing of category flat
From dd98dde8e8ceaedc6afca34edb6f2a4c5b5fe931 Mon Sep 17 00:00:00 2001
From: Dmytro Horytskyi <horytsky@adobe.com>
Date: Wed, 5 Dec 2018 16:52:03 +0200
Subject: [PATCH 1/3] MAGETWO-96908: [2.3] Wrong attribute value in flat table
---
.../Model/Indexer/Product/Flat/FlatTableBuilder.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Model/Indexer/Product/Flat/FlatTableBuilder.php b/Model/Indexer/Product/Flat/FlatTableBuilder.php
@Beagon
Beagon / OSRS_Wiki_Redirect.user.js
Last active February 9, 2019 16:31
[TamperMonkey] Fandom OSRS wiki to Jagex OSRS wiki
// ==UserScript==
// @name Fandom OSRS Wiki to Jagex OSRS Wiki Converter
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Automatically redirects to the new RuneScape wiki when going to a link of the old one.
// @author Beagon
// @match https://oldschoolrunescape.fandom.com/wiki/*
// @grant none
// @run-at document-start
// ==/UserScript==
@Beagon
Beagon / deleteProducts.php
Created November 7, 2018 09:05
Magento 1, delete products between ID X and ID Y
<?php
// Put this in your Magento 1 root, replace the variables with your ID's
// Useful for deleting products when making an importer and starting from scratch.
$idStart = 50000;
$idEnd = 99999;
require_once('app/Mage.php');
umask(0);
Mage::app('admin');
@Beagon
Beagon / cron.conf
Last active October 17, 2018 00:36
J-Mose/CommandSchedulerBundle with EasyAdmin [TESTED ON EasyAdmin 1.7 with jmose/command-scheduler-bundle 2.0]
# Please just review the changes instead of replacing your easy_admin config :)
easy_admin:
# Every other configuration
entities:
# All your other entities
Cron:
label: 'Command Scheduler'
class: JMose\CommandSchedulerBundle\Entity\ScheduledCommand
list:
title: "Command CRON Scheduler"
#!/bin/bash
WEBSITE_DIRECTORY="/var/www/"
APACHE2_DIRECTORY="/etc/apache2/"
MYSQL_USER="root"
MYSQL_PASSWORD=""
#DON'T EDIT ANYTHING UNDERNEATH HERE UNLESS YOU KNOW WHAT YOU ARE DOING!
checkWebsiteDirectoryConfig()
@Beagon
Beagon / gist:15e27040a7a29b88b751
Created November 23, 2015 15:13
[BASH][NGINX][V1.0] Create Project
#!/bin/bash
WEBSITE_DIRECTORY="/var/www/"
NGINX_DIRECTORY="/etc/nginx/"
MYSQL_USER="root"
MYSQL_PASSWORD=""
#DON'T EDIT ANYTHING UNDERNEATH HERE UNLESS YOU KNOW WHAT YOU ARE DOING!
checkWebsiteDirectoryConfig()
@Beagon
Beagon / readtime.php
Created August 25, 2015 11:15
Calculates the time a person needs to read a text.
<?php
$text = "Yes hello, my name is hans.";
$content = $text;
//Defaults
$wordsPerMinute = (isset($wordsPerMinute) ? $wordsPerMinute : 180); //The average adult reads prose text at 250 to 300 words per minute. While proofreading materials, people are able to read at 200 wpm on paper, and 180 wpm on a monitor.
$charsPerWord = (isset($charsPerWord) ? $charsPerWord : 5); //Characters per minute (CPM) are WPM times five, so that 20 WPM are 100 CPM.
//Calculated
$charsPerMinute = $wordsPerMinute * $charsPerWord;
@Beagon
Beagon / TV2JSON.php
Last active August 29, 2015 14:11
[MODX] Converts an array of TV options to a JSON &where string, for use in snippets such as Rowboat or getResources.
<?php
/**
* TV2JSON
*
* Generates a JSON sting to be used in snippets like Rowboat and getResources
*
* Author: Robin Rijkeboer <Robin@qaraqter.nl>
*
* PROPERTIES:
*
@Beagon
Beagon / Create Apache2 Project
Last active August 29, 2015 14:07
addApache2Project.sh
#!/usr/bin/env bash
WEBSITE_DIRECTORY="/var/www/"
getVhostName()
{
read -p "Please enter a project name: " vhostName
if [ -z "${vhostName}" ]
then
echo "Please fill in a project name!"