Skip to content

Instantly share code, notes, and snippets.

@ahelord
ahelord / index.php
Last active February 24, 2022 06:41
Php connect postgres
<?php
$ip = $_SERVER['REMOTE_ADDR'];
// display it back
echo "<h1>Internal Load Balancing Lab</h1>";
echo "<h2>Client IP</h2>";
echo "Your IP address : " . $ip;
echo "<h2>Hostname</h2>";
echo "Server Hostname: " . php_uname("n"). "<br>";
echo "Region and Zone: " . "region-here". "<br>";
@ahelord
ahelord / kill-transaction-postgres.sql
Created December 21, 2021 02:51
Kill transaction postgres
SELECT * FROM pg_stat_activity WHERE state = 'active';
SELECT pg_terminate_backend(pid)
FROM pg_stat_activity
WHERE -- don't kill my own connection!
pid <> pg_backend_pid() -- don't kill the connections to other databases
AND datname = 'postgres'
commit
@ahelord
ahelord / delete-versions-of-aws-lambdas.py
Created December 21, 2021 02:47
Delete the versions of the calls except the last 4
from __future__ import absolute_import, print_function, unicode_literals
import boto3
def clean_old_lambda_versions():
client = boto3.client('lambda')
functions = client.list_functions()['Functions']
print("Quantity of functions" + str(len(functions)))
for function in functions:
print(function['Version'])
//Versión original del problema de refactor de Rappi en HackerRanks
<?php
class Controller {
public function post_confirm() {
$id = Input::get('service_id');
$servicio = Service::find($id);
//dd($servicio);
if ($servicio != NULL) {
@ahelord
ahelord / https-instance.config
Created September 11, 2020 07:26
AWS elastic beanstalk docker renew https certbot
Resources:
sslSecurityGroupIngress:
Type: AWS::EC2::SecurityGroupIngress
Properties:
GroupId: {"Fn::GetAtt" : ["AWSEBSecurityGroup", "GroupId"]}
IpProtocol: tcp
ToPort: 443
FromPort: 443
CidrIp: 0.0.0.0/0
@ahelord
ahelord / 01-no-silver-bullet-es.md
Created September 2, 2020 01:00 — forked from esparta/01-no-silver-bullet-es.md
No hay balas de plata

No hay balas de plata: Lo esencial y lo accidental en la Ingeniería del Software

by Frederick P. Brooks, Jr.

De todos los monstruos que pueblan nuestras pesadillas, ninguno es tan terrorífico como el hombre lobo, porque pasa repentinamente de lo familiar al horror. Por eso, todos buscamos balas de plata que puedan acabar con ellos magicamente.

El familiar proyecto de software, al menos tal como lo ve un gestor no técnico, tiene algo de ese caracter: suele ser inocente y sencillo, pero es capaz de convertirse en un monstruo de plazos incumplidos, objetivos fallados y productos defectuosos. Por eso escuchamos lamentos clamando por una bala de plata -- algo que haga que los costes del software caigan tan rapidamente como lo han hecho los del hardware.

Pero no se ve en ningún lugar una bala de plata. No hay ningún desarrollo, ni en tecnología ni en técnicas de gestión, que por si sólo prometa ni siquiera una mejora en un orden de magnigud en productividad, en fiabilidad, en simplicidad. En este artículo,

@ahelord
ahelord / Instalaciones-React.md
Created August 15, 2020 00:34 — forked from Klerith/Instalaciones-React.md
Instalaciones recomendadas para mi curso de React de cero a experto
@ahelord
ahelord / sequelize-schema-file-generator.js
Last active September 14, 2021 13:40 — forked from manuelbieh/sequelize-schema-file-generator.js
Automatically generates migration files from your sequelize models
'use strict';
//////////////////////////////////
// How to use?
// 1. Create `sequelize-schema-file-generator.js` in your app root
// 2. Make sure you've ran the `sequelize init` before (It should create `config`,`seeders`,`migrations` folders).
// 3. Update `DATABASE_DSN` below to match your connection string (works with any database adapter that Sequelize supports)
// 4. Run it with `node sequelize-schema-file-generator.js`
// 5. Review the generated migrations inside of the `migrations` folder.
//////////////////////////////////