Skip to content

Instantly share code, notes, and snippets.

@dmonllao
dmonllao / setup_preprocessing_dataproc_workflow_template.sh
Created November 12, 2019 02:20
Dataproc workflow template with a 'managed cluster' in Google Cloud for serverless data pre-processing using pyspark
#!/bin/bash
##
# Dataproc workflow template with a 'managed cluster' in Google Cloud for serverless data pre-processing using pyspark.
#
# Based on this guide: https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows
#
# Pre-requisites:
# - https://hub.docker.com/r/google/cloud-sdk/ installed and set up on the machine running this script.
# - The pre-processing file in Google Cloud Storage
@dmonllao
dmonllao / static_acceleration_returns_references_to_obj.php
Created August 26, 2019 01:10
static_acceleration_returns_references_to_obj.php
<?php
define('CLI_SCRIPT', true);
require_once(__DIR__ . '/config.php');
$options = [
'simpledata' => true,
'staticacceleration' => true
];
$cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_myplugin', 'mycache', [], $options);
#!/bin/bash
set -e
# Interval in seconds.
INTERVAL="1"
TIMEFORMAT="%d-%m-%y,%H:%M:%S"
echo "Monitor the memory usage of a running docker container (memory in MBs)"
<?php
// Not tested but it should be something like that. New file in $CFG->dirroot.
require_once(__DIR__ . '/config.php');
// For students at-risk model. Feel free to change.
$MODELID = 1;
$COURSEID = 123;
diff --cc theme/boost/templates/core/filemanager_modal_generallayout.mustache
index 3e31b35,5741947..0000000
--- a/theme/boost/templates/core/filemanager_modal_generallayout.mustache
+++ b/theme/boost/templates/core/filemanager_modal_generallayout.mustache
@@@ -1,9 -1,9 +1,8 @@@
- <div tabindex="0" class="file-picker fp-generallayout container-fluid row" role="dialog" aria-live="assertive">
- <div class="fp-repo-area col-md-3 nav nav-pills nav-stacked" role="tablist">
+ <div tabindex="0" class="file-picker fp-generallayout row" role="dialog" aria-live="assertive">
- <div class="fp-repo-area col-md-3 nav nav-pills flex-column">
- <div class="fp-repo nav-item">
+ <TABLE NAME="tool_dataprivacy_ctxexpired" COMMENT="Default comment for the table, please edit me">
+ <FIELDS>
+ <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
+ <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
+ <FIELD NAME="status" TYPE="int" LENGTH="2" DEFAULT="0" NOTNULL="true" SEQUENCE="false"/>
+ <FIELD NAME="timeexpired" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
+ <FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
+ <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
+ <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
+ </FIELDS>
<?php
define('CLI_SCRIPT', true);
require_once(__DIR__ . '/config.php');
$latest = $DB->get_records_select('files', "component = 'analytics' AND filename = 'evaluation.csv' AND filepath LIKE '/timesplitting/%'", array(), 'timecreated DESC', '*', 0, 1);
$id = key($latest);
$fs = get_file_storage();
$f = $fs->get_file_by_id($id);
@dmonllao
dmonllao / gist:a938c77d6230ccdf6285d84615223e1f
Last active April 19, 2017 06:42
php-ml linear classifier performance (partial training vs full training in 1 batch) (https://github.com/php-ai/php-ml/pull/78)
RESULTS:
➜ php-ml git:(partial-train) ✗ clear ; php partial-vs-full.php
Classifier perceptron full train memory usage:
Usage from before data reading to end of training: 231704
Classifier adaline full train memory usage:
Usage from before data reading to end of training: 265160
Classifier logistic full train memory usage:
Usage from before data reading to end of training: 248408
Classifier perceptron partial train memory usage:
Usage from before data reading to end of training: 9176
RESULTS:
➜ php-ml-fork git:(partial-train) ✗ php memory-usage.php
string(18) "perceptron: 522368"
string(15) "adaline: 490576"
string(16) "logistic: 484832"
➜ php-ml-fork git:(cost-values-key) ✗ php memory-usage.php
string(17) "perceptron: 77312"
string(14) "adaline: 45520"
string(15) "logistic: 32864"
#!/bin/bash
set -e
gnome-terminal --maximize &> /dev/null &
/opt/google/chrome/google-chrome --profile-directory=Default https://mail.google.com https://tracker.moodle.org &> /dev/null &
pidgin &> /dev/null &
/home/davidm/Telegram/Telegram &> /dev/null &