Skip to content

Instantly share code, notes, and snippets.

View gayanvirajith's full-sized avatar
:octocat:

Gayan Virajith gayanvirajith

:octocat:
View GitHub Profile
@gayanvirajith
gayanvirajith / elasticsearch-bulk-insert.md
Last active September 25, 2020 18:41
elasticsearch bulk insert example

Mapping

PUT /orders
{
  "mappings": {
    "properties": {
      "lines": {
        "type": "nested",
        "properties": {
@gayanvirajith
gayanvirajith / codedeploy-agent-setup.sh
Last active August 31, 2020 18:29
Code Deploy Agent Install
#!/bin/bash
####
# Note: bucket name and the region can be changed
# Reffer below links for more details:
# https://docs.aws.amazon.com/codedeploy/latest/userguide/resource-kit.html#resource-kit-bucket-names
# https://docs.aws.amazon.com/codedeploy/latest/userguide/codedeploy-agent-operations-install-linux.html
####
CODE_DEPLOY_BUCKET_NAME=aws-codedeploy-us-east-1
REGION=us-east-1
@gayanvirajith
gayanvirajith / create-virtual-env.sh
Created August 1, 2020 17:55
Create Python 3 virtual environment using bash script
#!/bin/bash
##########
# Create python3 virtual environment
# eg: ./create-virtual-env.sh /Users/Admin/python-envrontments/my-new-project-env
# It will create new python3 virtual environment on specified path
# So later you can activate the environment by having `source /Users/Admin/python-envrontments/my-new-project-env/bin/activate`
##########
if (( $# == 0))
@gayanvirajith
gayanvirajith / make-directory-and-change-into.md
Created July 25, 2020 04:55
shortcut to create directory and change into the created directory

linux make direactory and change direactory (cd) into the folder

mkdir hello
cd !$
@gayanvirajith
gayanvirajith / install-docker_amazon_linux.sh
Last active October 23, 2021 11:17
Install docker cli in amazon linux
#
# Install docker in amazon linux ec2 instance
#
### Docker
sudo amazon-linux-extras install docker -y
sudo yum install docker -y
@gayanvirajith
gayanvirajith / redis.md
Created June 30, 2020 07:59
Docker redis

Run redis on docker

docker run --name redis -d -p 6379:6379 --net mynet redis 
@gayanvirajith
gayanvirajith / neo4j.md
Created June 18, 2020 03:39
Neo4J Help

How to run neo4j using docker

docker run \
    --publish=7474:7474 --publish=7687:7687 \
    --volume=$HOME/neo4j/data:/data \
    neo4j
@gayanvirajith
gayanvirajith / mongo-connection.js
Created May 20, 2020 04:50
Node js Mongo db connection
# Credit: https://medium.com/swlh/how-to-connect-to-mongodb-using-a-promise-on-node-js-59dd6c4d44a7
const config = require('config');
const MongoClient = require('mongodb').MongoClient;
var _connection;
var _db;
const closeConnection = () => {
_connection.close();
}
@gayanvirajith
gayanvirajith / create-pem.md
Last active March 17, 2021 12:03
create pem for mongo db | robot3t

Create pem for ssh

ssh-keygen -m PEM -t rsa
ssh-keygen -m PEM -t rsa -C "your_email@example.com"
eval "$(ssh-agent -s)"
@gayanvirajith
gayanvirajith / grafana-run.md
Last active May 14, 2020 06:06
grafana docker run

Grafana - Setting up on local environment using docker

docker run -d -p 3000:3000 -e "GF_SECURITY_ADMIN_PASSWORD=admin" --name grafana -v grafana-storage:/var/lib/grafana --net mynet grafana/grafana

References

Create read-only MySQL user