Skip to content

Instantly share code, notes, and snippets.

View .moodleenv_docker.md

This will create the base environment which is required to run moodle.

codebase root

data root

docker run -it /bin/bash --hostname d01 --name d01 -d -p 8081:80 --volume=:/var/www/html/app --volume=:/var/www/data lms/d01

@developerck
developerck / lambda_run_command.py
Last active Jan 1, 2022
aws lambda for executing run command using python
View lambda_run_command.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import boto3
import botocore
import time
import json
from pprint import pprint
from botocore.exceptions import ClientError
from boto3.dynamodb.conditions import Key
@developerck
developerck / README.md
Last active Apr 1, 2022
Bitbucket API implementation to validate the changefiles in a Pull Request
View README.md

bit bucket pipeline for and code validation and change pull request status with comment.

  • Replace < BITBUCKET REPO URL > with your bitbucket repo URL in lib.php and pull-build.php
  • This is also validating coding standard as per PHPCS, please change the path accordingly in lib.php
  • pull-build.php get the changelogs and lib.php have the function to accept/decline/post comment on PR
  • PHPCS is optional and maintained with a repository variable, and also some of the variables needed   $BB_USERNAME $BB_PASSWORD $BB_PHPCS $BB_DECLINE
  • Make a user in bitbucket, create an app password and use that username and password for this. that user must have access to the repo and shoudl be able to read and write to accept and decline the Pull request   
View aws resize ec2 through lambda
import boto3
import json
import os
import logging
region = ''
region = os.environ['region'];
if not region :
logger.error('Missing region');
raise
@developerck
developerck / AWS ec2 start using lambda
Last active Aug 30, 2021
AWS ec2 start using lambda
View AWS ec2 start using lambda
import boto3
import json
import os
import logging
region = ''
region = os.environ['region'];
if not region :
logger.error('Missing region');
raise
@developerck
developerck / nginx for moodle 2.7 with caching and ssl and differnet caching pattern for different media
Last active Aug 30, 2021
nginx for moodle 2.7 with caching and ssl and differnet caching pattern for different media
View nginx for moodle 2.7 with caching and ssl and differnet caching pattern for different media
server {
listen 443 ssl;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
// ssl cert
ssl_certificate /etc/ssl/certs/nginx/client_ssl.chained.crt;
ssl_certificate_key /etc/ssl/certs/nginx/client_ssl.key;
server_name client.com; // servername
@developerck
developerck / show the disk usage
Last active Aug 30, 2021
show the disk usage
View show the disk usage
#!/bin/sh
df -Ph | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5,$1 }' | while read output;
do
max=40%
echo $output
used=$(echo $output | awk '{print $1}')
partition=$(echo $output | awk '{print $2}')
if [ ${used%?} -ge ${max%?} ]; then
echo "The partition \"$partition\" on $(hostname) has used $used at $(date)"
fi