Skip to content

Instantly share code, notes, and snippets.

View jresendiz27's full-sized avatar

Juan Alberto Reséndiz Arteaga jresendiz27

View GitHub Profile
def xmlContent = new File("your-sat-xml-file.xml").getText()
def xml = new XmlSlurper().parseText(xmlContent).declareNamespace(
cfdi:"http://www.sat.gob.mx/cfd/3",
xsi:"http://www.w3.org/2001/XMLSchema-instance")}}
//Getting xml information.
//this will work for other xml files with other namespaces if needed
//@ for reading xml attributes, if there's no attribute just . operator will be fine
println xml.'cfdi:Receptor'.@rfc
@jresendiz27
jresendiz27 / GmailAndGroovy.groovy
Created November 7, 2014 20:56
Using Groovy to read mails from GMail. Just for development purposes, GMail will not allow login in first time, so I enabled the option to log from non secure apps SSL it's necessary Another good tutorial coudl be find here using SSL: http://agileice.blogspot.mx/2008/10/using-groovy-to-connect-to-gmail.html
/*
Using Groovy to read email form GMail.
Just for development purposes, GMail will not allow in first time the login, so I enabled the option to log from non secure apps
SSL it's necessary
Another good tutorial coudl be find here using SSL:
http://agileice.blogspot.mx/2008/10/using-groovy-to-connect-to-gmail.html
@jresendiz27
jresendiz27 / Snowball.js
Last active August 29, 2015 14:13
WebScrapping_PhantomJs
/**
* Created by alberto on 1/24/15.
*/
/*!
* Snowball JavaScript Library v0.3
* http://code.google.com/p/urim/
* http://snowball.tartarus.org/
*
* Copyright 2010, Oleg Mazko
* http://www.mozilla.org/MPL/
@jresendiz27
jresendiz27 / kruskal.js
Last active August 31, 2021 05:58 — forked from n8agrin/kruskal.js
// See http://en.wikipedia.org/wiki/Kruskal's_algorithm
// and http://programmingpraxis.com/2010/04/06/minimum-spanning-tree-kruskals-algorithm/
var _ = require('underscore');
var nodes = ["A", "B", "C", "D", "E", "F", "G"];
var edges = [
["A", "B", 7], ["A", "D", 5],
@jresendiz27
jresendiz27 / The Technical Interview Cheat Sheet.md
Last active November 27, 2017 04:51 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

Array

Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@jresendiz27
jresendiz27 / k8s_learning_path.md
Last active April 23, 2020 04:34
k8s_learning_path.md

Learning Kubernetes

Description

Using the current resources (Linkedin Learning), We've choosen some courses for getting started and ready to start working with k8s and some useful resources about Microservices and Cloud Native Ecosystem.

Path

These are the recommended courses:

  • Devops Foundation: Going Cloud Native *
  • Devops Foundation: Microservices *
@jresendiz27
jresendiz27 / oos_proposal.md
Created February 28, 2020 03:24
oss_proposal.md

Getting started with OSS.

OSS it's one of the most important assets for innovation inside the software industry; many projets are the foundations of huge enterprises, banks, startups and freelancers accross the world. For our organization it's a huge value to bring back knowledge to the community; sharing with them part of our implementations and solutions making them open source.

We've considered a few questions to be considered before making an open source project.

  • What is the problem that we solved (or we're trying to solve)? Did we consider OSS solutions outside? Why they didn't fit and how our solution can help the final user?
@jresendiz27
jresendiz27 / collect_metrics_from_several_servers.py
Created May 1, 2020 21:34
collect_metrics_from_several_servers.py
import asyncio
import csv
import logging
import os
import aiohttp
MEMORY_COMMAND = 'head -n 1 /proc/meminfo | awk \'{print $2}\''
PROCESS_INFORMATION = 'ps -o pid,uid,%mem,command ax'
SSH_COMMAND_TO_RETRIEVE = "ssh " \
@jresendiz27
jresendiz27 / adding_metrics_to_prometheus.md
Last active May 1, 2020 22:09
adding_metrics_to_prometheus.md

Answers

Question 1 (script)

Requirements

  • Python 3.7
  • Pipenv (or plain pip)
  • Docker

How to run it?

Create a csv file located in the same place of the gist, the csv should follow a format like this one.