Skip to content

Instantly share code, notes, and snippets.

View ztraboo's full-sized avatar

Zachary Trabookis ztraboo

View GitHub Profile
@ztraboo
ztraboo / chunk_large_log_by_date.py
Last active October 9, 2023 13:28
Separate Open edX CMS/LMS Large `tracking.log` file events by date.
"""
Author: Zachary Trabookis
Date: October 05, 2023
Description:
Separates a larger Open edX `tracking.log` file into chunks by the number of threads defined, then goes through the
thread chunked files in order and sorts the log information into new files by date. Going in order
allows the events to be ordered as they occured.
This replicates what a logrotate would do by day. You would want to run this if you have a large
@ztraboo
ztraboo / views.py
Created October 28, 2022 12:12
Updated `edx-platform/lms/djangoapps/mfe_config_api/views.py` to account for HTTP_REFERRER to be able to use one endpoint for all MFE frontends.
"""
MFE API Views for useful information related to mfes.
"""
import json
import logging
import re
from django.conf import settings
from django.http import HttpResponseNotFound, JsonResponse
@ztraboo
ztraboo / Run In Terminal
Last active June 14, 2021 16:23
Koa Docker Network Alias Fixes
docker network disconnect devstack-koamaster_default edx.devstack-koa.master.chrome
docker network connect --alias edx.devstack.chrome devstack-koamaster_default edx.devstack-koa.master.chrome
docker network disconnect devstack-koamaster_default edx.devstack-koa.master.devpi
docker network connect --alias edx.devstack.devpi devstack-koamaster_default edx.devstack-koa.master.devpi
docker network disconnect devstack-koamaster_default edx.devstack-koa.master.elasticsearch
docker network connect --alias edx.devstack.elasticsearch devstack-koamaster_default edx.devstack-koa.master.elasticsearch
docker network disconnect devstack-koamaster_default edx.devstack-koa.master.elasticsearch-5
@ztraboo
ztraboo / clean_control_names.py
Last active April 27, 2021 16:39
OneDrive Syncing Issues – Renaming Directories and Files by Removing Control Characters
import os
import re
import unicodedata
def clean_name(name, replace_space_with=None):
"""
Remove invalid file name chars from the specified name
:param name: the file name
:param replace_space_with: if not none replace space with this string
(edx_ansible) edx-ansible@lms:~/edx_ansible/playbooks$ ansible-playbook --become-user=$(whoami) -vvv -c local -i 'localhost,' --tags edxapp_cfg_test ./edxapp_test_env.yml -e common_web_group=$(whoami)
/edx/app/edx_ansible/venvs/edx_ansible/local/lib/python2.7/site-packages/cryptography/__init__.py:39: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.
CryptographyDeprecationWarning,
ansible-playbook 2.7.18
config file = /edx/app/edx_ansible/edx_ansible/playbooks/ansible.cfg
configured module search path = [u'/edx/app/edx_ansible/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /edx/app/edx_ansible/venvs/edx_ansible/local/lib/python2.7/site-packages/ansible
executable location = /edx/app/edx_ansible/venvs/edx_ansible/bin/ansible-playbook
python version = 2.7.12 (default, Jul 21 2020, 15:19:50) [GCC 5.4.0 20160609]
Using /
(venv)ztraboo@ztraboo-macbookpro devstack % make dev.provision
./repo.sh clone_ssh
The [course-discovery] repo is already checked out. Checking for updates.
From https://github.com/edx/course-discovery
* branch open-release/juniper.master -> FETCH_HEAD
Already up to date.
The [credentials] repo is already checked out. Checking for updates.
From https://github.com/edx/credentials
* branch open-release/juniper.master -> FETCH_HEAD
Already up to date.
@ztraboo
ztraboo / lti-path.js
Last active August 3, 2018 03:24
Open edX (pdfbook link) - LTI Integration
/*
Author: Zachary Trabookis
Date: 2018-08-02
Description: Update the relative course paths according to LTI usage or not.
*/
function getCoursePathLTI(dataLink) {
var isInIframe = (window.location != window.parent.location) ? true : false;
console.log("In LTI = " + isInIframe);
@ztraboo
ztraboo / dashboard.patch
Created June 17, 2016 07:03 — forked from mulby/dashboard.patch
edX Analytics Conference Workshop 2016
From add560e7e139e2671f6f3eb9bda5038e69114d69 Mon Sep 17 00:00:00 2001
From: Dennis Jen <djen@edx.org>
Date: Mon, 13 Jun 2016 22:28:28 -0400
Subject: [PATCH] WIP: workshop demo of course views
---
.../courses/presenters/engagement.py | 3 ++
.../templates/courses/engagement_content.html | 24 +++++++++++++++
analytics_dashboard/courses/views/engagement.py | 3 ++
.../learner_analytics_api/v0/views.py | 12 ++++----