Skip to content

Instantly share code, notes, and snippets.

View jamesmontalvo3's full-sized avatar

James Montalvo jamesmontalvo3

View GitHub Profile
@jamesmontalvo3
jamesmontalvo3 / HTML_format.php
Last active August 29, 2015 14:17
PHP implementation for returning JSON and HTML via JSONP
<?php
// set content type to javascript (else it'll think it's HTML)
header( 'Content-Type: application/javascript; charset=utf-8' );
// allow the requester to specify a callback function
$callback = isset( $_GET['callback'] ) ? $_GET['callback'] : 'callback';
// retrieve the contents of the current event's HTML file
$configHtmlText = file_get_contents( __DIR__ . '/Event1069.html' );
@jamesmontalvo3
jamesmontalvo3 / non-root.txt
Created July 10, 2015 04:33
non-root user Meza1 install.sh output
This file has been truncated, but you can view the full file.
[james@Meza1-2015-07-09 ~]$ cat install.sh
#!/bin/bash
#
# Setup the entire Meza1 platform
if [ "$(whoami)" != "root" ]; then
echo "Try running this script with sudo: \"sudo bash install.sh\""
exit 1
fi
@jamesmontalvo3
jamesmontalvo3 / user-unify.php
Created December 11, 2015 15:09
A possibly not-yet-ready script to merge user tables across multiple wikis
<?php
$host = 'hostname';
$user = 'your-username';
$pass = 'your-password';
$primeWiki = 'wiki_meta';
$wikiDBnames = array(
'wiki_a',
"wiki_b",
"wiki_c",
@jamesmontalvo3
jamesmontalvo3 / Split.js
Created March 3, 2016 01:09
Split a file every 20000 lines
fs = require('fs');
path = require('path');
var log = path.join( path.dirname( fs.realpathSync(__filename) ), 'meza-dev.log' );
fs.readFile( log, 'utf8', function(err,data){
if (err) {
return console.log(err);
}
@jamesmontalvo3
jamesmontalvo3 / simple-load-test.js
Last active January 18, 2017 20:23
Very simple load tester for MediaWiki
window.data = {};
window.lastUid = null;
window.cooldown = 0;
window.pending = {};
function requestPage ( interval, loadTestEnd ) {
// var milliseconds = Date.now();
@jamesmontalvo3
jamesmontalvo3 / simpler-load-test.js
Last active January 18, 2017 23:21
Even simpler load testing script
// A very simple load-testing script
// Fires off requests to MediaWiki random page, fires another after receiving response
// Optionally multi-threaded.
var help = "Commands: \n"
+ "showData(): Display data in tab-delimited format\n"
+ "start(): Start sending requests\n"
+ "stop(): Stop sending requests\n"
+ "doForSeconds(seconds): Send requests for specified number of seconds\n"
+ "doForMinutes(minutes): Same as above, but for minutes\n"
@jamesmontalvo3
jamesmontalvo3 / importing.md
Created April 19, 2017 14:06
Importing a wiki with `meza deploy`

There is no import script anymore in the latest version of meza. Instead users should do sudo meza deploy monolith --overwrite with the appropriate backup files in place. Unfortunately this is not documented well in meza yet. This gist is intended as temporary documentation. It would be great if someone created a pull request into meza with this (cleaned up and verified) as official documentation.

There's more than one way this could be done, but this is one way. From the ground up in VirtualBox, get your VM configured. Skip this if you already have a running meza installation.

sudo ifup enp0s3
curl -L getmeza.org > doit
sudo bash doit
sudo meza setup dev-networking
@jamesmontalvo3
jamesmontalvo3 / Comparison-of-Main-Page.md
Last active June 13, 2017 20:22
Meza 2-app-server config

Multi-app server loading [[Main Page]]

Request # Request time (microseconds) server request
1 2567734 App2 /demo/index.php/Main_Page
2 430673 App1 /demo/load.php?debug=false&lang=en&modules=ext.collapsiblevector.collapsibleNav%7Cext.headertabs%7Cext.uls.pt%7Cext.visualEditor.targetLoader%7Cjquery.checkboxShiftClick%2CgetAttrs%2ChighlightText%2CmakeCollapsible%2Cmw-jump%2Cplaceholder%2Csuggestions%7Cmediawiki.page.ready%7Cmediawiki.searchSuggest%7Csite&skin=vector&version=43da68dba780
3 2691265 App2 /demo/load.php?debug=false&lang=en&modules=ext.jquery.async%2Cqtip%7Cext.smw%7Cext.smw.tooltip%2Ctooltips%7Cext.smw.tooltip.styles&skin=vector&version=0ab62dfb598f
4 434904 App1 /demo/load.php?debug=false&lang=en&modules=ext.meetingminutes.template%7Cext.uls.init%2Cinterface%2Cpreferences%2Cwebfonts%7Cext.visualEditor.desktopArticleTarget.init%7Cext.visualEditor.supportCheck%2Ctrack%2Cve%7
@jamesmontalvo3
jamesmontalvo3 / phpunit.meza.mw1.30.md
Last active April 13, 2018 20:52
PHP unit test logs for meza
  1. MediaWiki\Auth\AuthPluginPrimaryAuthenticationProviderTest::testOnUserGroupsChanged
Missing argument 4 for EchoHooks::onUserGroupsChanged()

/opt/htdocs/mediawiki/extensions/Echo/Hooks.php:704
/opt/htdocs/mediawiki/includes/Hooks.php:177
/opt/htdocs/mediawiki/includes/Hooks.php:205
/opt/htdocs/mediawiki/tests/phpunit/includes/auth/AuthPluginPrimaryAuthenticationProviderTest.php:76
@jamesmontalvo3
jamesmontalvo3 / composer.md
Created June 26, 2019 23:03
Composer issue

Getting a weird error due to Composer installs right now.

[Wed Jun 26 16:16:18.364715 2019] [php7:warn] [pid 12304] [client my.ip.add.ress:46156] PHP Warning:  require(/opt/htdocs/mediawiki/vendor/composer/../jetbrains/phpstorm-stubs/PhpStormStubsMap.php): failed to open stream: No such file or directory in /opt/htdocs/mediawiki/vendor/composer/autoload_real.php on line 70, referer: https://example.com/
[Wed Jun 26 16:16:18.364896 2019] [php7:error] [pid 12304] [client my.ip.add.ress:46156] PHP Fatal error:  require(): Failed opening required '/opt/htdocs/mediawiki/vendor/composer/../jetbrains/phpstorm-stubs/PhpStormStubsMap.php' (include_path='/opt/htdocs/mediawiki/vendor/pear/console_getopt:/opt/htdocs/mediawiki/vendor/pear/mail:/opt/htdocs/mediawiki/vendor/pear/mail_mime:/opt/htdocs/mediawiki/vendor/pear/mail_mime-decode:/opt/htdocs/mediawiki/vendor/pear/net_smtp:/opt/htdocs/mediawiki/vendor/pear/net_socket:/opt/htdocs/mediawiki/vendor/pear/pear-core-minimal/src:/opt/htdocs/mediawiki/vendor/pear/pear_