View my_send_mail.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import smtplib | |
import getpass | |
import base64 | |
import os | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
from email.MIMEBase import MIMEBase |
View screenoff.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script will lock the screen and turn the | |
# display in to standby mode (switch off the screen). | |
# | |
# Thilina Piyasundara | |
# 2013-08-31 | |
# last updated on : 2013-10-13 | |
# lock the gnome screen |
View apachesslgen.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script will generate self-signed SSL certificates for a apache webhost. | |
# Use only for testinsg purpos and not recommend for production use. | |
# | |
# Thilina Piyasundara | |
# 2013-08-08 | |
echo "Enter the fqdn : " | |
read fqdn |
View ontime-go.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// Run a `vault server -dev` to test. | |
// set HOSTNAME, PREFIX, VAULT_ADDR and VAULT_TOKEN environment variable and others as needed. | |
// curl -XPOST http://localhost:8080/add -d "message=This is my secet message to you." | |
import ( | |
"os" | |
"fmt" | |
"log" | |
"net/http" |
View mongo-statefulset.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Generate a key | |
# openssl rand -base64 741 > mongodb-keyfile | |
## Create k8s secrets | |
# kubectl create secret generic mongo-key --from-file=mongodb-keyfile | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: mongo | |
labels: |
View nginx-ingress-controller.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: Namespace | |
metadata: | |
name: ingress-nginx | |
--- | |
apiVersion: extensions/v1beta1 | |
kind: Deployment | |
metadata: | |
name: default-http-backend |
View setup_k8s.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check for root | |
if [ `id -u` != 0 ] ; then | |
print_error "Need root access.\nRun the script as 'root'" | |
exit 10 | |
fi | |
print_usage(){ | |
echo "Usage" |
View stop-start-aurora.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
ClusterID = "db-cluster" | |
session = boto3.Session( | |
region_name='ap-southeast-2', | |
aws_access_key_id='', | |
aws_secret_access_key='', | |
) | |
rds = session.client('rds') |
View isanka.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python | |
# python3.6 filename | |
def solution(A): | |
out_of_order_count = 0 | |
existing_hights = A | |
sorted_hights = sorted(A) | |
i = 0 | |
j = 0 |
OlderNewer