Skip to content

Instantly share code, notes, and snippets.

View afilgueira's full-sized avatar
🇦🇷
Senior Engineer. University Professor. Hawaiian pizza fundamentalist

Adriano Filgueira afilgueira

🇦🇷
Senior Engineer. University Professor. Hawaiian pizza fundamentalist
View GitHub Profile
@afilgueira
afilgueira / mysql-57-ppa.sh
Last active April 10, 2023 20:02
Semaphore db install - Glotools
#!/bin/bash
####
# Description: Installs latest MySQL Server 5.7 version from MySQL PPA.
#
# Runs on: All platforms
#
# Usage:
# Add the following command to the setup of a build in the Project Settings
#
@afilgueira
afilgueira / README.md
Last active April 30, 2023 20:54
Example of an aws-sdk-cloudwatchlogs client wrapper for EB

This is a simple client wrapper for the aws-sdk-cloudwatchlogs gem. The idea here is to be able to perform certain queries to know which ips were used by a user on the last X days. This is very useful for fraud detection reasons (so if a user made requests from several ips in a short period of time or some of them are fraudulent, we can do something about it).

The cloudwatch logs flow is simple:

  • You run the query, and receive a query_id
  • You wait a bit
  • After X time you can get the partial results using the query_id
  • After Y time the query is over and you get the complete results

This example service populates a field in the user profile, in an admin panel. When the admin needs it, they click on a button to trigger a new query. Queries and their results are cached in redis for X time, so we let the admin know when the check was performed since they probably won't need to run it again for a few days. The info is presented in a "CSV friendly" format so it can be displayed in a table or even exported to