Skip to content

Instantly share code, notes, and snippets.

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