Skip to content

Instantly share code, notes, and snippets.


Gayan Virajith gayanvirajith

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 /
Last active Jul 18, 2019
Run mongo db in docker

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 /
Created Jul 2, 2019
Install Docker on an Amazon EC2 instance
sudo yum update -y && sudo amazon-linux-extras install docker && sudo service docker start && sudo usermod -a -G docker ec2-user && docker info
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:
gayanvirajith /
Last active Jan 6, 2020
How to use mysql docker container with docker volume

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 --net mynet --name mysqld -p 3306:3306 mysql:5.6.43

If you want to go with no password:

gayanvirajith /
Created Feb 21, 2019
How to use mysql docker container with docker volume

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 /
Last active Feb 8, 2019
The figlet command makes turns ordinary terminal text into big fancy letters


sudo apt-get install figlet


figlet gayan


gayanvirajith /
Created Aug 27, 2018
Laravel php storm regex search and replace

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 / 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);
gayanvirajith /
Last active Sep 6, 2018
Docker self reference

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 / RestTrait.php
Last active Aug 31, 2017
Laravel is API call trait
View RestTrait.php
namespace App\Traits;
use Illuminate\Http\Request;
trait RestTrait
You can’t perform that action at this time.