Skip to content

Instantly share code, notes, and snippets.

View jramnai's full-sized avatar
🇮🇳

JayRam Nai jramnai

🇮🇳
View GitHub Profile
@jramnai
jramnai / tutor_openedx_commands.md
Last active April 29, 2024 00:50
Useful command of Tutor Open edX

Tutor Open edX useful commands

Tutor Installation

Requirements

  • Docker: v18.06.0+
  • Docker Compose: v1.22.0+
  • Ports 80 and 443 should be open
  • Hardware:
  • Minimum configuration: 4 GB RAM, 2 CPU, 8 GB disk space
import requests
def get_access_token_detail():
"""
This return the access token
"""
api_url = "https://lms.com/oauth2/access_token"
data = {
'grant_type': "client_credentials",
@jramnai
jramnai / direnv_setup.md
Last active September 23, 2022 21:47
Setup direnv on Ubuntu system to set your environment variable

direnv setup on Ubuntu

direnv is an extension for your shell. It augments existing shells with a new feature that can load and unload environment variables depending on the current directory.

Use cases

  • Load 12factor apps environment variables
  • Create per-project isolated development environments
  • Load secrets for deployment

Installation and how to use

Grade Download issue on Native Installation of Open edX

Create symlink to actual CSV file location

ln -s /tmp/edx-s3/grades /edx/var/edxapp/media

Update location blocks in Nginx file of lms (/edx/app/nginx/sites-avaliable/lms)

  • Locate following block in the file
@jramnai
jramnai / commands.md
Last active March 12, 2024 21:04
Useful commands in Open edX

Useful commands in Open edX

Change access permission of pem file

sudo chmod 400 my_private_key.pem  

SSH into your server

ssh -i my_private_key.pem ubuntu@ 
@jramnai
jramnai / add_robots.md
Last active February 22, 2022 14:31
This Gist describes that how one can add robots.txt file in Open edX project.

How to add robots.txt file in Open edX?

What is the robots.txt file?

The robots.txt file is a standard text file that tells search engine crawlers which pages they can access, scrape, and ultimately list in their search engine results.

The file is listed on the root URL of your site, https://domain.com/robots.txt, and can easily be added to your Django project.

Be sure to use the correct casing and spelling for anything added to the robots.txt file or it will not work correctly.

A simple robots.txt file

from django.contrib.auth.models import User
from student.views import compose_and_send_activation_email
user = User.objects.get(email='test@example.com')
compose_and_send_activation_email(user, user.profile)
@jramnai
jramnai / get_course.py
Created July 24, 2020 04:46
Get open edX course from modulestore
from xmodule.modulestore.django import modulestore
from opaque_keys.edx.keys import CourseKey
course_id = 'course-v1:edX+DemoX+Demo_Course'
course = modulestore().get_course(CourseKey.from_string(course_id))