Skip to content

Instantly share code, notes, and snippets.

View alsargent's full-sized avatar

Al Sargent alsargent

View GitHub Profile
/*
Find all suspicious long loops of transactions
Show the graph and json results
Scroll to bottom of graph results and click "GraphViewer" to see results in Graph Viewer */
WITH transaction, account
FOR suspicous_account IN account
FOR acct, tx, path IN 5..10 OUTBOUND suspicous_account._id GRAPH 'fraud-detection' PRUNE tx._to == suspicous_account._id
FILTER tx._to == suspicous_account._id
RETURN path
// Import Flux date package: https://docs.influxdata.com/influxdb/v2.0/reference/flux/stdlib/date/
import "date"
// Import Flux dictionary package: https://docs.influxdata.com/influxdb/v2.0/reference/flux/stdlib/dict/
import "dict"
bucket = "mybucket"
// Work with data collected in the past 5 minutes
start = -5m
stop = now()
// subDuration explained at: https://docs.influxdata.com/influxdb/v2.0/reference/flux/stdlib/experimental/subduration/
// date.truncate explained at: https://docs.influxdata.com/influxdb/v2.0/reference/flux/stdlib/date/truncate/
import "date"
import "csv"
import "experimental"
csvData = "
#datatype,string,long,dateTime:RFC3339,string,string,double
#group,false,false,false,false,false,false
#default,,,,,,
snmp_trap,mib=NET-SNMP-AGENT-MIB,name=nsNotifyShutdown,oid=.1.3.6.1.4.1.8072.4.0.2,source=192.168.122.102,version=2c sysUpTimeInstance=26410i,snmpTrapEnterprise.0="netSnmpNotificationPrefix" 1578509036440568977
snmp_trap,agent_address=192.168.122.102,mib=NET-SNMP-AGENT-MIB,name=nsNotifyShutdown,oid=.1.3.6.1.4.1.8072.4.0.2,source=192.168.122.102,version=1 sysUpTimeInstance=26410i 1578509036256357640
snmp_trap,mib=SNMPv2-MIB,name=coldStart,oid=.1.3.6.1.6.3.1.1.5.1,source=192.168.122.102,version=2c sysUpTimeInstance=1i,snmpTrapEnterprise.0="linux" 1578509037022973807
snmp_trap,agent_address=192.168.122.102,mib=SNMPv2-MIB,name=coldStart,oid=.1.3.6.1.6.3.1.1.5.1,source=192.168.122.102,version=1 sysUpTimeInstance=1i 1578509036875841715
@alsargent
alsargent / functional-testing-selenium-visual-ai.java
Last active October 7, 2019 21:19
Functional testing with Visual AI
@Test
public void loginTest() {
//Open browser
driver.get("http://localhost:8000/loginBefore.html");
//Click on the Login button
driver.findElement(By.id("log-in")).click();
//Start the test
eyes.open(driver, "Login App", "Login Page Test", new RectangleSize(800, 800));
//Take a screenshot so AI can analyze (and ignore large displacements)
eyes.checkWindow("Login Window");
@alsargent
alsargent / functional-testing-selenium.java
Last active October 7, 2019 21:20
Functional testing without Visual AI
@Test
public void loginLegacyTest() {
//Open browser
driver.get("http://localhost:8000/loginBefore.html");
//Click on the Login button
driver.findElement(By.id("log-in")).click();
//Assert the error text
assertEquals("Please enter username and password",driver.findElement(By.id("alert")).getText());
//Assert if username field exists
assertTrue((driver.findElement(By.id("username")) instanceof WebElement));
@alsargent
alsargent / telegraf-synthetic-aws.conf
Created September 17, 2019 23:54
Sample configuration file for Telegraf to monitor AWS API endpoints and send to InfluxDB Cloud
# Telegraf Configuration
#
# Telegraf is entirely plugin driven. All metrics are gathered from the
# declared inputs, and sent to the declared outputs.
#
# Plugins must be declared in here to be active.
# To deactivate a plugin, comment out the name and any variables.
#
# Use 'telegraf -config telegraf.conf -test' to see what metrics a config
# file would generate.