Skip to content

Instantly share code, notes, and snippets.

View harshadyeola's full-sized avatar

Harshad Yeola harshadyeola

View GitHub Profile
@harshadyeola
harshadyeola / main.go
Created June 13, 2020 13:48 — forked from julz/main.go
containersched minicontainer
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
func main() {
@harshadyeola
harshadyeola / self-signed-ssl-mongo.sh
Created July 20, 2019 19:40 — forked from exAspArk/self-signed-ssl-mongo.sh
Self-signed SSL Certificate with OpenSSL on MacOS | MongoDB
openssl genrsa -out CAroot.key 2048
openssl req -new -key CAroot.key -out CAroot.csr # CN should be different from the certificates below
openssl req -x509 -days 1825 -key CAroot.key -in CAroot.csr -out CAroot.crt
cat CAroot.crt CAroot.key > CAroot.pem
openssl genrsa -out mongod.key 2048
openssl req -new -key mongod.key -out mongod.csr
openssl x509 -req -days 1825 -in mongod.csr -CA CAroot.pem -CAkey CAroot.key -CAcreateserial -out mongod.crt
cat mongod.crt mongod.key > mongod.pem
.deploy_job: &deploy_job
before_script:
# Install ssh-agent if not already installed, it is required by Docker.
# (change apt-get to yum if you use a CentOS-based image)
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y ) || (apk update && apk add openssh-client)'
# Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
# Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
@harshadyeola
harshadyeola / README.md
Created April 24, 2018 06:13 — forked from rantav/README.md
Find slow queries in mongo DB

A few show tricks to find slow queries in mongodb

Enable profiling

First, you have to enable profiling

> db.setProfilingLevel(1)

Now let it run for a while. It collects the slow queries ( > 100ms) into a capped collections, so queries go in and if it's full, old queries go out, so don't be surprised that it's a moving target...

@harshadyeola
harshadyeola / check_docker_container.sh
Created March 14, 2017 12:49 — forked from ekristen/check_docker_container.sh
Bash Script for Nagios to Check Status of Docker Container
#!/bin/bash
# Author: Erik Kristensen
# Email: erik@erikkristensen.com
# License: MIT
# Nagios Usage: check_nrpe!check_docker_container!_container_id_
# Usage: ./check_docker_container.sh _container_id_
#
# The script checks if a container is running.
# OK - running
@harshadyeola
harshadyeola / save-sqs-queue.py
Created February 10, 2017 13:15 — forked from kern/save-sqs-queue.py
Saves all messages from an AWS SQS queue into a folder
import argparse
import boto.sqs
import json
import os
parser = argparse.ArgumentParser(description='Saves all messages from an AWS SQS queue into a folder.')
parser.add_argument(
'-q', '--queue', dest='queue', type=str, required=True,
help='The name of the AWS SQS queue to save.')
@harshadyeola
harshadyeola / Dockerfile
Created December 2, 2016 13:15 — forked from yefim/Dockerrun.aws.json
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
# Example Dockerfile
FROM hello-world
@harshadyeola
harshadyeola / instance-provision-with-docker.sh
Last active December 28, 2016 08:52
instance provision with docker and docker compose
sudo apt-get update && \
sudo apt-get install -y apt-transport-https ca-certificates && \
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D && \
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list && \
sudo apt-get update && \
sudo apt-get install -y docker-engine && \
sudo service docker start && \
curl -L "https://github.com/docker/compose/releases/download/1.8.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && \
chmod +x /usr/local/bin/docker-compose && \
docker-compose —-version
@harshadyeola
harshadyeola / byte-sizetuts.md
Created November 11, 2016 15:12 — forked from honkskillet/byte-sizetuts.md
A series of golang tutorials with youtube videos.
@harshadyeola
harshadyeola / RELK.sh
Created October 5, 2016 11:52 — forked from adionditsak/RELK.sh
Install the ELK stack (with Redis) with one script for the central log server (CentOS 6.5).
#/bin/bash
##########################################################
### INTRODUCTION
##########################################################
: '
Install and configure R (Redis) + ELK server from scratch on CentOS 6.5.
* Logstash version 1.4.2
* Elasticsearch version 1.3.2