Skip to content

Instantly share code, notes, and snippets.

View joaoqalves's full-sized avatar

João Alves joaoqalves

View GitHub Profile
@joaoqalves
joaoqalves / tramos.js
Created February 7, 2021 10:34
Tramos IRPF
// Fuente: https://cincodias.elpais.com/herramientas/calculadora-irpf/
var datos = {
// (*) ESTATAL
'E':[
[0, 12450, 9.5],
[12450, 20200, 12],
[20200, 35200, 15],
[35200, 60000, 18.5],
[60000, 999999999999, 22.5],
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls,
System.ImageList, Vcl.ImgList, Vcl.Imaging.pngimage;
type
@joaoqalves
joaoqalves / advent02.py
Created December 3, 2019 19:39
AoC 2019 #2
def add(lst, idx):
lst[lst[3 + idx]] = lst[lst[1 + idx]] + lst[lst[2 + idx]]
return -1
def multiply(lst, idx):
lst[lst[3 + idx]] = lst[lst[1 + idx]] * lst[lst[2 + idx]]
return -1
@joaoqalves
joaoqalves / advent03.py
Created December 3, 2019 19:38
AoC 2019 #3
def parse(val, starting_point):
int_value = int(val[1:])
command = val[0]
gen_points = []
for v in range(1, int_value + 1):
if command == 'R':
new_point = (starting_point[0] + 1, starting_point[1])
elif command == 'L':
@joaoqalves
joaoqalves / advent.01.py
Created December 3, 2019 19:31
AoC 2019 #1
def fuel_req(mass):
fuel = (mass // 3) - 2
if fuel <= 0:
return 0
else:
return fuel + fuel_req(fuel)
total = 0
with open('/Users/joaoqalves/Desktop/puzzle.txt', 'r') as puzzle:
for line in puzzle.readlines():
@joaoqalves
joaoqalves / error.log
Created November 25, 2018 20:26
Error libxmljs
 ~/j/uber-cities    master  npm install  INT(-2) ↵  jeffrey   21:25:07
> libxmljs@0.19.0 install /Users/joaoqalves/j/uber-cities/node_modules/libxmljs
> node-pre-gyp install --fallback-to-build --loglevel http
node-pre-gyp http GET https://github.com/libxmljs/libxmljs/releases/download/v0.19.0/node-v67-darwin-x64.tar.gz
node-pre-gyp http 404 https://github.com/libxmljs/libxmljs/releases/download/v0.19.0/node-v67-darwin-x64.tar.gz
node-pre-gyp ERR! Tried to download(404): https://github.com/libxmljs/libxmljs/releases/download/v0.19.0/node-v67-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for libxmljs@0.19.0 and node@11.2.0 (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp http 404 status code downloading tarball https://github.com/libxmljs/libxmljs/releases/download/v0.19.0/node-v67-darwin-x64.tar.gz
@joaoqalves
joaoqalves / InMemoryBatchConfigurer.java
Created August 30, 2018 10:33
In Memory Batch Configurer
import javax.sql.DataSource;
import org.springframework.batch.core.configuration.annotation.DefaultBatchConfigurer;
public class InMemoryBatchConfigurer extends DefaultBatchConfigurer {
public void setDataSource(DataSource dataSource) {
// This is intentionally left blank
}
}
@joaoqalves
joaoqalves / genesis_public_key
Created February 24, 2018 19:22
genesis_public_key
0499012070ecc4497830b7608b3f3c56f7a197cb532000309f9a1fdda91218dca6609ec7b6d4fe4fd5530e4656f7b2128afcd4f22cf0086afcb7a5826a79443edf
@joaoqalves
joaoqalves / curry.py
Created November 22, 2017 16:32
Currying functions in Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from functools import partial
def curried(n):
def curry(fn):
def _inner(*args):
if len(args) < n:
I may be a bit outdated about GCP but if I am I guess you’ll correct me :) I’m no infrastructure expert though. My knowledge comes from a small comparison that we did in my previous company [biased ‘cause we had a AWS certified guy :)]:
Feature-wise, AWS has a fine-grained user management that may be important for large companies. Same for network topologies [again, big companies]. More flexibility when choosing an instance in AWS (~30 vs ~20 instance types). AWS is more powerful when it comes to handle hybrid cloud solutions. AWS' ElastiCache has no equivalent in GCP, I think. RDS is years ahead of Google SQL engine.
About tooling: a lot of open-source _CLI_s and open-source tools that leverage AWS. A certification program, etc etc… all of this increases AWS value for a client. And that’s why they can charge more and that’s why comparing only prices is not fair. Even comparing services would be “risky” [from a business perspective], due to the stability and proven success of AWS over the last 10 years. I