Skip to content

Instantly share code, notes, and snippets.

:octocat:

Gayan Virajith gayanvirajith

:octocat:
Block or report user

Report or block gayanvirajith

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gayanvirajith
gayanvirajith / docker-mongodb.md
Last active Jul 18, 2019
Run mongo db in docker
View docker-mongodb.md

Pull docker image

docker pull mongo

Run mongo db container

docker run --name mongod -d -v mongo-data:/data/db -p 27017:27017 mongo

@gayanvirajith
gayanvirajith / amazon-linux-docker-install.sh
Created Jul 2, 2019
Install Docker on an Amazon EC2 instance
View amazon-linux-docker-install.sh
#!/bin/bash
sudo yum update -y && sudo amazon-linux-extras install docker && sudo service docker start && sudo usermod -a -G docker ec2-user && docker info
@gayanvirajith
gayanvirajith / logstash,md
Last active Mar 7, 2019
Log stash demo with cars dataset
View logstash,md
`sudo -u logstash /usr/share/logstash/bin/logstash -f /home/gayan/Downloads/log-stash-demo/logstash-cars.config`
Setting up on ubuntu 16 thanks to below link:
https://www.digitalocean.com/community/tutorials/how-to-install-elasticsearch-logstash-and-kibana-elastic-stack-on-ubuntu-16-04
@gayanvirajith
gayanvirajith / mysql-docker.md
Last active May 3, 2019
How to use mysql docker container with docker volume
View mysql-docker.md

Get MySQL from docker registry

docker pull mysql:5.6.43

Run docker image

docker run -d -e MYSQL_ROOT_PASSWORD=123123 -v mysql-data:/var/lib/mysql --name mysqld -p 3306:3306 mysql:5.6.43

If you want to go with no password:

@gayanvirajith
gayanvirajith / mysql-docker.md
Created Feb 21, 2019
How to use mysql docker container with docker volume
View mysql-docker.md

docker pull mysql

docker pull mysql:latest

Run docker image

docker run -d -e MYSQL_ROOT_PASSWORD=123123 -v mysql-data:/var/lib/mysql --name mysqld -p 3308:3306 mysql

@gayanvirajith
gayanvirajith / figlet.md
Last active Feb 8, 2019
The figlet command makes turns ordinary terminal text into big fancy letters
View figlet.md

Install

sudo apt-get install figlet

Usage

figlet gayan

Output:

@gayanvirajith
gayanvirajith / phpstorm-replace.md
Created Aug 27, 2018
Laravel php storm regex search and replace
View phpstorm-replace.md

When we upgrade our laravel version from 5.1 to 5.2 We must replace out $request parameter accsss with a different method, we need replace our current access method eg: $request->id to something new like $request->input('id). So we used to it using phpStorm reqular expression search/replace feature. We have tried following way:

text to replace : (\$request)(\->)([\w]+)

replacement : $1\->input(\'$3\'\)

@gayanvirajith
gayanvirajith / average.js
Created Jul 9, 2018
Node js average from command line argument
View average.js
#!/usr/bin/env node
var sum = 0;
var count = 0;
process.argv.forEach(function (val, index, array) {
if (index > 1) {
sum += parseInt(val);
count++;
}
@gayanvirajith
gayanvirajith / docker-help.md
Last active Sep 6, 2018
Docker self reference
View docker-help.md

Self Learning Docker Reference

Run docker oreilly http application from docker

docker run -p 4567:4567 -d rickfast/hello-oreilly-http

Run a docker container in foreground (it will exit when you hit CTRL+C)

docker run -p 4567:4567 rickfast/hello-oreilly-http

@gayanvirajith
gayanvirajith / RestTrait.php
Last active Aug 31, 2017
Laravel is API call trait
View RestTrait.php
<?php
namespace App\Traits;
use Illuminate\Http\Request;
trait RestTrait
{
/**
You can’t perform that action at this time.