Skip to content

Instantly share code, notes, and snippets.

View horacioibrahim's full-sized avatar

Horacio Ibrahim horacioibrahim

View GitHub Profile
@horacioibrahim
horacioibrahim / jwt_token_document.java
Last active December 18, 2024 15:00
AgnosticData + Elastic Insights: JWT introspected
String token = null;
// Primeiro, verificar em params._source['utm_case']['token']
if (params._source.containsKey('utm_case') && params._source['utm_case'] != null) {
if (params._source['utm_case'].containsKey('token')) {
token = params._source['utm_case']['token'];
// Processar o JWT se o token for encontrado
int firstDot = token.indexOf(".");
@horacioibrahim
horacioibrahim / POST_Elastic_Click__Aceitar.json
Last active November 1, 2024 19:33
Get user_id from Click from Elastic "Aceitar"
// POST /events_new-dedicated-01_click/_search
{
"sort": [
{
"inserted_date": {
"order": "desc",
"format": "strict_date_optional_time",
"unmapped_type": "boolean"
}
}
@horacioibrahim
horacioibrahim / POST_Elastic_Click__Cancelar_protesto.json
Last active November 1, 2024 19:33
Get user_id from Click from Elastic "Cancelar protesta"
// POST /events_new-dedicated-01_click/_search
{
"sort": [
{
"inserted_date": {
"order": "desc",
"format": "strict_date_optional_time",
"unmapped_type": "boolean"
}
}
@horacioibrahim
horacioibrahim / POST_Elastic_Click__Detalhes.json
Last active November 1, 2024 19:33
Get user_id from Click from Elastic "Detalhes"
// POST /events_new-dedicated-01_click/_search
{
"sort": [
{
"inserted_date": {
"order": "desc",
"format": "strict_date_optional_time",
"unmapped_type": "boolean"
}
}
const fs = require('fs');
const axios = require('axios');
const { Parser } = require('json2csv');
// Função para "achatar" o JSON
function flattenObject(obj, prefix = '') {
return Object.keys(obj).reduce((acc, k) => {
const pre = prefix.length ? `${prefix}_${k}` : k;
if (typeof obj[k] === 'object' && obj[k] !== null && !Array.isArray(obj[k])) {
Object.assign(acc, flattenObject(obj[k], pre));
/* `googleAppScriptAutoBackup.js` creates copy of files
* when is opened. This script check if file already exists
* so creates the backup file.
*/
var prefixBackupName = "MyFileXYZ"; // we're gonna to use as MyFileXYZ-
var folderId = "hashFolderIdFoundInURL"; // backup folder: where file to be placed it
var principalFileId = "hashFileIdFoundInURL" // principal file that it'll be copied
var workDir = DriveApp.getFolderById(folderId);
var myGMT = "GMT-3:00"
@horacioibrahim
horacioibrahim / calendar2sheet.js
Last active September 13, 2021 14:12
App Script to get events from Calendar API and insert to Spreadsheet
// Reference: https://www.youtube.com/watch?v=YDhln3ukH7Y&t=3s
function getEvents() {
var calId = "[email protected]"; // this is a Google Calendar Id
var startDate = "9/1/2021 12:00 AM" // Month/Day/Year
var endDate = "9/13/2021 11:59 PM" // Month/Day/Year
var nameOfSheet = "getEventsSheet" // You must have Filename and Sheet names (your tabs inner doc)
// spreadsheet
var ss = SpreadsheetApp.getActiveSpreadsheet();
@horacioibrahim
horacioibrahim / discovery_highlights
Last active August 1, 2020 17:26
Discovery highlights
to harness
increasingly
affordable
advancing
rapidly
significant costs
delays
constrain*
time
spent
@horacioibrahim
horacioibrahim / data_driven_highlight
Created August 1, 2020 02:24
Words to data-driven highlights
$?? billion
$?? trillion
?0
?1??
?2??
?3??
?4??
?5??
?6??
?7??
@horacioibrahim
horacioibrahim / data_driven_highlight
Created August 1, 2020 02:24
Words to data-driven highlights
$?? billion
$?? trillion
?0
?1??
?2??
?3??
?4??
?5??
?6??
?7??