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
package main | |
import ( | |
"log" | |
"encoding/json" | |
"fmt" | |
"os" | |
"math/rand" |
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
package main | |
import ( | |
"log" | |
"encoding/json" | |
"fmt" | |
"os" | |
"math/rand" |
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
var db = connect('localhost:27020/dev'); | |
// timed queries | |
var numQueries = 1000, start = Date.now(), res; | |
for (var i = numQueries; i--;) { | |
res = db.scan.aggregate([ | |
{ $match: { client_id: ObjectId("58b19c4872d797313163b8f4"), country: {$in: ["ITA", "FRA", "ES"]} } }, | |
{ $group: { _id: "$summary_id", status: { $min: "$status"}, score: { $max: "$score"}}}, | |
{ $sort: { created_at: 1} }, |
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
Marc Cobos | |
====== | |
To execute the modbus master you have to do the following commands: | |
javac -classpath jamod-1.2-SNAPSHOT.jar:opencsv-3.1.jar modbus_client.java | |
java -cp jamod-1.2-SNAPSHOT.jar:opencsv-3.1.jar:. modbus_client | |
====== | |
This code use the jamod and opencsv libraries |
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 | |
# Author: Marc Cobos | |
FILE=test.access.log | |
types=(GET PUT DELETE HEAD POST TRACE OPTIONS CONNECT PATCH); | |
for i in ${!types[*]} | |
do | |
COUNT=`grep ${types[$i]} $FILE |wc -l`; | |
echo "$COUNT: ${types[$i]}"; |
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 | |
# Author: Marc Cobos | |
FILE=test.access.log | |
for ip in `cat $FILE |cut -d ' ' -f 1 |sort |uniq`; | |
do | |
COUNT=`grep ^$ip $FILE |wc -l`; | |
echo $COUNT ' : ' $ip | |
done | sort -rn -k1 | head -5 |