Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python3
#
# Author: Jordan Tomkinson <jordan.tomkinson@ethinkeducation.com>
#
# This script automates editing and saving contentbank items to fix a bug in tool_migratehvp2h5p
# Requirements: sudo pip3 install mechanize
# Generate the csv by running this sql:
'''
select a.course_context_id, a.instance
from (
@durzo
durzo / patch.diff
Created April 30, 2020 15:31
moodle-fileconverter_librelambda IAM Role support
diff --git a/classes/converter.php b/classes/converter.php
index c2addfe..33c0826 100644
--- a/classes/converter.php
+++ b/classes/converter.php
@@ -97,11 +97,14 @@ class converter implements \core_files\converter_interface {
public function create_client($handler=null) {
$connectionoptions = array(
'version' => 'latest',
- 'region' => $this->config->api_region,
- 'credentials' => [
@durzo
durzo / gist:3511aaa274e35187a0e0584a32d60b72
Created April 4, 2020 11:07
KeyDB vs Amazon Elasticache Redis
Elasticache node is a single r5.large in non-clustered mode
KeyDB node is a single r5.large using 2 server-threads with saves disabled
Memtier test node is a single c5n.4xlarge
r5.large has 16GB memory and 2 vCPU
c5n.4xlarge 42GB memory and 16 vCPU
KeyDB is 10.1.8.245
Elasticache is devredis.larpr9.0001.use2.cache.amazonaws.com
@durzo
durzo / usr_local_pnp4nagios_share_index.php
Created January 8, 2020 12:59
pnp4nagios authenticate with Icinga
<?php
namespace Icinga;
class User extends \stdClass {
public $localUsername;
public $groups;
}
function icinga_login() {
header("Location: /authentication/login");
@durzo
durzo / patch.diff
Created December 16, 2019 18:58
icingaweb2 pdfexport fix
diff --git a/library/Pdfexport/HeadlessChrome.php b/library/Pdfexport/HeadlessChrome.php
index 4342cc4..e034805 100644
--- a/library/Pdfexport/HeadlessChrome.php
+++ b/library/Pdfexport/HeadlessChrome.php
@@ -192,15 +192,17 @@ class HeadlessChrome
$path = $storage->resolvePath($path, true);
- $chrome = new Process(join(' ', [
+ $env = ['HOME'=>'/tmp'];
$regex = "'blblbl'"
if [[ "$OSTYPE" == "linux-gnu" ]]; then
# Linux
$shasum = "/usr/bin/sha1sum"
$strbin = "sed -e$regex"
elif [[ "$OSTYPE" == "darwin"* ]]; then
# Mac OSX
$shasum = "/usr/bin/shasum"
$strbin = "sed -e $regex"
elif [[ "$OSTYPE" == "cygwin" ]]; then