This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.SimpleDateFormat | |
buildscript { | |
ext.kotlin_version = '1.3.11' | |
ext.spek_version = '1.0.9' | |
ext.junit_runner_version = '1.0.0-M3' | |
repositories { | |
mavenCentral() | |
maven { url "https://plugins.gradle.org/m2/" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
JSON=`mongo --quiet -u root -p pass --authenticationDatabase admin --eval "JSON.stringify(db.getReplicationInfo())" database.com.br:27017/local` | |
TIMEDIFF=`echo $JSON | jq '.timeDiffHours'` | |
echo $TIMEDIFF | |
aws cloudwatch put-metric-data --region sa-east-1 --metric-name MongoTimeDiffHours --namespace Midas --value "`echo $TIMEDIFF`" --timestamp `date -u "+%Y-%m-%dT%H:%M:%SZ"` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('com.hazelcast:hazelcast:3.7.4') | |
@Grab('com.hazelcast:hazelcast-aws:2.1.0') | |
import com.hazelcast.config.* | |
import com.hazelcast.core.Hazelcast | |
import com.hazelcast.spi.discovery.impl.* | |
import com.hazelcast.aws.* | |
import com.hazelcast.core.ILock | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Node is defined as | |
class Node { | |
int data; | |
Node next; | |
} | |
*/ | |
Node RemoveDuplicates(Node head) { | |
Node current = head; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun reportServices(stores: List<Store>, start: LocalDate, end: LocalDate, pageable: Pageable): Pair<List<java.util.HashMap<*, *>>, Int> { | |
val pipeline = """ | |
[ | |
{#match: { | |
'processed.accountingCodePrimary': {#ne: null}, | |
'processed.specialization': {#ne: 'NONE'}, | |
'processed.authorizer.#id': {#eq: 'WK'}, | |
'processed.transactionCodeConsult': {#ne: 'YES'} | |
}}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val dictionary = mapOf<Int,String>( | |
1 to "one", | |
2 to "two", | |
3 to "three", | |
4 to "four", | |
5 to "five", | |
6 to "six", | |
7 to "seven", | |
8 to "eight", | |
9 to "nine", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Installs sdkman | |
curl -s "https://get.sdkman.io" | bash | |
#Installs python | |
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash | |
#Installs ruby | |
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB | |
curl -sSL https://get.rvm.io | bash -s stable --ruby |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo mkdir -p /var/mongodb/mongodb-1 /var/mongodb/mongodb-2 /var/mongodb/mongodb-3 | |
sudo docker run -d -it -p 27018:27017 -v /var/mongodb/mongodb-1:/data/db -v /var/config:/var/config --name mongodb-1 -d mongo mongod --replSet midas --bind_ip 0.0.0.0 | |
sudo docker run -d -it -p 27019:27017 -v /var/mongodb/mongodb-2:/data/db -v /var/config:/var/config --name mongodb-2 -d mongo mongod --replSet midas --bind_ip 0.0.0.0 | |
sudo docker run -d -it -p 27020:27017 -v /var/mongodb/mongodb-3:/data/db -v /var/config:/var/config --name mongodb-3 -d mongo mongod --replSet midas --bind_ip 0.0.0.0 | |
mongo 127.0.0.1:27018 <<<"rs.initiate({_id: 'midas', members: [ {_id: 0, host:'10.224.28.131:27018'}, {_id: 1, host:'10.224.28.131:27019'}, {_id: 2, host:'10.224.28.131:27020'}]})" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# curl -s https://gist.githubusercontent.com/xymor/4cf2bd593d89f4722d0a4d69654ac762/raw/6feaef84c7906be7b4a48f1ce9691442a378471c/docker-ubuntu.sh | bash | |
# curl -sL https://git.io/vyQoI | sudo bash | |
apt-get remove docker docker-engine | |
apt-get install \ | |
linux-image-extra-$(uname -r) \ | |
linux-image-extra-virtual -y | |
apt-get install \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Expects Ubuntu 16.06 (xenial) and kernel 4.x. | |
# Based upon a blog post by Zach at http://zachzimm.com/blog/?p=191 | |
set -eux | |
# Have the user call sudo early so the credentials is valid later on | |
sudo whoami | |
sudo apt-get install libssl-dev -y |
NewerOlder