This file contains 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 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 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 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
//acessar 192.168.25.1/save_rg_conf.cgi | |
var objts = {}; | |
$.xmo.getValuesTree("Device/IP/Interfaces/Interface[@uid='1']/MaxMTUSize"); | |
$.xmo.getValuesTree("Device/IP/Interfaces/Interface[@uid='1']/LowerLayers"); | |
$.xmo.getValuesTree("Device/IP/Interfaces/Interface[@uid='2']/MaxMTUSize"); | |
$.xmo.getValuesTree("Device/IP/Interfaces/Interface[@uid='2']/LowerLayers"); |
This file contains 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
Our architecture uses an Ec2:Instance to define a master, | |
such instance doesn't have the automatic management of elb attachment | |
provided by the AWS::AutoScaling::AutoScalingGroup to slaves so | |
this script roughly replicates it by attaching an instance | |
upon boot and releasing it during shutdown. |
This file contains 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 javax.crypto.spec.SecretKeySpec | |
import javax.crypto.Cipher | |
import org.apache.commons.codec.binary.Base64 | |
def encrypt(encrypt,en_key) { | |
if(encrypt.size() % 8 != 0){ //not a multiple of 8 | |
byte[] padded = new byte[encrypt.length + 8 - (encrypt.length % 8)]; | |
//copy the old array into it |
This file contains 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 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 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 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 |
NewerOlder