Skip to content

Instantly share code, notes, and snippets.

💻
42

Phellipe Andrade phellipeandrade

💻
42
Block or report user

Report or block phellipeandrade

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
@phellipeandrade
phellipeandrade / [FEDORA] gitkraken
Created Jul 21, 2018 — forked from aelkz/[FEDORA] gitkraken
How to install gitkraken on Fedora [25,26,27] + launcher icon
View [FEDORA] gitkraken
#!/bin/bash
# Download GitKraken
wget https://release.gitkraken.com/linux/gitkraken-amd64.tar.gz
# copy the downloaded file into /opt directory
cp gitkraken-amd64.tar.gz /opt/
cd /opt
@phellipeandrade
phellipeandrade / install-rabbitmq.sh
Created Jun 18, 2018 — forked from yetanotherchris/install-rabbitmq.sh
RabbitMQ on Docker with admin UI
View install-rabbitmq.sh
# AWS specific install of Docker
sudo yum update -y
sudo yum install -y docker
sudo service docker start
sudo usermod -a -G docker ec2-user
# exit the SSH session, login again
# Docker
docker run -d --hostname my-rabbit --name some-rabbit -p 4369:4369 -p 5671:5671 -p 5672:5672 -p 15672:15672 rabbitmq
View gist:895718ea5679532ac2195d687a6b1421
var mongoObjectId = function () {
var timestamp = (new Date().getTime() / 1000 | 0).toString(16);
return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function() {
return (Math.random() * 16 | 0).toString(16);
}).toLowerCase();
};
@phellipeandrade
phellipeandrade / ultimate-ut-cheat-sheet.md
Created Feb 27, 2018 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai and Sinon
View ultimate-ut-cheat-sheet.md

The Ultimate Unit Testing Cheat-sheet

For Mocha, Chai and Sinon

using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies


@phellipeandrade
phellipeandrade / async-foreach.js
Created Feb 25, 2018 — forked from Atinux/async-foreach.js
JavaScript: async/await with forEach()
View async-foreach.js
const waitFor = (ms) => new Promise(r => setTimeout(r, ms))
const asyncForEach = (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
const start = async () => {
await asyncForEach([1, 2, 3], async (num) => {
await waitFor(50)
@phellipeandrade
phellipeandrade / repo-reset.md
Created Feb 6, 2018 — forked from heiswayi/repo-reset.md
GitHub - Delete commits history with git commands
View repo-reset.md

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@phellipeandrade
phellipeandrade / mongodb-s3-backup.sh
Created Jan 12, 2018 — forked from eladnava/mongodb-s3-backup.sh
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
View mongodb-s3-backup.sh
#!/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
@phellipeandrade
phellipeandrade / docker-cleanup-resources.md
Created Dec 20, 2017 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks
View docker-cleanup-resources.md

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
View Docker_ElasticSearch_Kibana.txt
https://github.com/docker-library/kibana/issues/65
Correct, your host can access elasticsearch via localhost since you forwarded the ports with -p 9200:9200 -p 9300:9300, but kibana has its own network interface and localhost in the kibana container is just kibana, not your host.
You need to either give the ip of your elasticsearch container to kibana:
$ docker run -d -v "$PWD/esdata":/usr/share/elasticsearch/data -p 9200:9200 -p 9300:9300 --name elastic elasticsearch
$ ip="$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' elastic)"
$ docker run -e ELASTICSEARCH_URL="http://$ip:9200" -p 5601:5601 -d --name kib kibana
or use linking dns so that kibana can resolve a name to elasticsearch:
You can’t perform that action at this time.