Skip to content

Instantly share code, notes, and snippets.

View sreekanth1990's full-sized avatar

sreekanth1990

View GitHub Profile
@sreekanth1990
sreekanth1990 / github-merge.sh
Created April 20, 2018 10:15
Script to merge github pull requests remotely, while inspecting & signing them.
#!/bin/bash
# This script will locally construct a merge commit for a pull request on a
# github repository, inspect it, sign it and optionally push it.
# The following temporary branches are created/overwritten and deleted:
# * pull/$PULL/base (the current master we're merging onto)
# * pull/$PULL/head (the current state of the remote pull request)
# * pull/$PULL/merge (github's merge)
# * pull/$PULL/local-merge (our merge)
@sreekanth1990
sreekanth1990 / deploy.sh
Created April 27, 2018 07:57 — forked from kcabading/deploy.sh
Bash script for deploying Wordpress using Jenkins and Bitbucket.
#!/bin/bash
# PLACEHOLDERS
# [STAGING_FOLDER] - staging directory in your server
# [STAGING_URL] - staging url
# [STAGING_USER] - staging user in the server
# [STAGING_MYSQLUSER] - staging mysql user
# [STAGING_MYSQLPASSWORD] - staging mysql password
# [ROOTUSER] - Mysql root user
# [ROOTPASSWORD] - Mysql root password
@sreekanth1990
sreekanth1990 / Jenkinsfile
Created May 2, 2018 10:07
Jenkins Pipeline example for Email-ext plugin
node {
stage('git'){
git 'https://github.com/allure-examples/allure-testng-example.git'
}
stage('test'){
def mvnHome = tool 'Maven 3.x'
def mvn = "${mvnHome}/bin/mvn"
sh "${mvn} test"
}
@sreekanth1990
sreekanth1990 / mongodb-s3-backup.sh
Created May 7, 2018 03:59 — forked from eladnava/mongodb-s3-backup.sh
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
#!/bin/sh
# Make sure to:
# 1) Name this file `backup.sh` and place it in /home/ubuntu
# 2) Run sudo apt-get install awscli to install the AWSCLI
# 3) Run aws configure (enter s3-authorized IAM user and specify region)
# 4) Fill in DB host + name
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket)
# 6) Run chmod +x backup.sh
# 7) Test it out via ./backup.sh
@sreekanth1990
sreekanth1990 / backup-mongodb-to-s3.sh
Created May 7, 2018 04:00 — forked from caraboides/backup-mongodb-to-s3.sh
Simple script to backup MongoDB to S3, without waste diskspace for temp files. And a way to restore from the latest snapshot.
#!/bin/sh
set -e
HOST=localhost
DB=test-entd-products
COL=asimproducts
S3PATH="s3://mongodb-backups-test1-entd/$DB/$COL/"
S3BACKUP=$S3PATH`date +"%Y%m%d_%H%M%S"`.dump.gz
S3LATEST=$S3PATH"latest".dump.gz
/usr/bin/aws s3 mb $S3PATH
@sreekanth1990
sreekanth1990 / Ubuntu1604py36Dockerfile
Created May 10, 2018 09:49 — forked from monkut/Ubuntu1604py36Dockerfile
Base Docker image for ubuntu-16.04 & Python3.6
# docker build -t ubuntu1604py36
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install -y software-properties-common vim
RUN add-apt-repository ppa:jonathonf/python-3.6
RUN apt-get update
RUN apt-get install -y build-essential python3.6 python3.6-dev python3-pip python3.6-venv
RUN apt-get install -y git
@sreekanth1990
sreekanth1990 / read-access.sql
Created May 11, 2018 08:46 — forked from oinopion/read-access.sql
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;