Skip to content

Instantly share code, notes, and snippets.

@thilinapiy
thilinapiy / my_send_mail.py
Created June 15, 2012 17:20
My Python e-mail script
#!/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
@thilinapiy
thilinapiy / screenoff.sh
Created October 13, 2013 04:37
This script will lock the screen and turn the display in to standby mode (switch off the screen). Tested on ubuntu 13.04 and will work on gnome environment.
#!/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
@thilinapiy
thilinapiy / apachesslgen.sh
Created October 13, 2013 04:44
Self-signed SSL key generation script for apache webhost.
#!/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
@thilinapiy
thilinapiy / mystatusmenu.py
Created May 6, 2014 13:16
This is a sample status menu (appindicator) python 3 script. Via this script you can switch off the screen and open Facebook via google chrome.
#!/usr/bin/env python3
# Copyright 2014 H. Thilina C. Piyasundara
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@thilinapiy
thilinapiy / ontime-go.go
Last active September 29, 2017 00:47
Create a onetime password sharing link using vault as secret store
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"
#!/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"
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')
#!/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
@thilinapiy
thilinapiy / nginx-ingress-controller.yaml
Created November 16, 2017 07:05
Complete nginx-ingress-controller yaml file.
---
apiVersion: v1
kind: Namespace
metadata:
name: ingress-nginx
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: default-http-backend

Keybase proof

I hereby claim:

  • I am thilinapiy on github.
  • I am thilinapiy (https://keybase.io/thilinapiy) on keybase.
  • I have a public key whose fingerprint is 478E 258E F454 3443 36F9 B241 69FD CF7F E0C0 A1A3

To claim this, I am signing this object: