Skip to content

Instantly share code, notes, and snippets.

View ferromir's full-sized avatar

Fernando Romero ferromir

View GitHub Profile
@ferromir
ferromir / lidex.rs
Created April 2, 2025 20:44
Lides transalated to Rust by Claude 3.7
use std::collections::HashMap;
use std::future::Future;
use std::pin::Pin;
use std::sync::Arc;
use std::time::{Duration, Instant, SystemTime};
use async_trait::async_trait;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use tokio::time::sleep;
use anyhow::{Result, anyhow};
@ferromir
ferromir / lidex.scala
Created April 2, 2025 20:30
Lidex translated to Scala by Claude 3.7
import scala.concurrent.{Future, Promise, ExecutionContext}
import scala.concurrent.duration._
import scala.util.{Success, Failure, Try}
import java.time.{Instant, Duration => JDuration}
import scala.collection.mutable.Map
object Workflow {
val DEFAULT_MAX_FAILURES = 3
val DEFAULT_TIMEOUT_MS = 60000 // 1m
val DEFAULT_POLL_MS = 1000 // 1s
@ferromir
ferromir / lidex.py
Created April 2, 2025 20:21
Lidex translated to Python using Claude 3.7
from typing import Dict, List, Callable, Any, TypeVar, Optional, Union, Mapping
from enum import Enum
from datetime import datetime, timedelta
import json
import asyncio
import time
DEFAULT_MAX_FAILURES = 3
DEFAULT_TIMEOUT_MS = 60_000 # 1m
DEFAULT_POLL_MS = 1_000 # 1s
@ferromir
ferromir / lidex.go
Created April 2, 2025 20:17
Lidex translated to Go using Claude 3.7
package workflow
import (
"encoding/json"
"errors"
"fmt"
"time"
)
const (
@ferromir
ferromir / mongors.yml
Created February 20, 2024 12:53
Docker compose for single node MongoDB replica set
version: "3.8"
services:
mongo:
image: mongo:5.0.11
container_name: "mongo"
command: --replSet rs
volumes:
- mongo-data:/data/db
ports:
{
"meta": {
"theme": "macchiato"
},
"basics":{
"name":"Fernando Romero",
"label":"Software Engineer/Architect",
"url":"https://www.linkedin.com/in/fernando-romero-miranda/",
"summary":"Software Engineer/Architect with more than 16 years of experience in the industry in a wide range of programming languages, frameworks and technologies. Specialized in design, development and delivery of scalable, reliable and maintainable systems.",
"location":{
@ferromir
ferromir / interview_lookout.txt
Created January 20, 2016 22:37
Interview with Christope Verbinnen from Lookout
Problem: Implement an algorithim to compress strins such as
aaaabbccccccccdddedaaa
4a2b8c3d1e1d3a
Fernando's solution: pseudocode
compress(s string) {
@ferromir
ferromir / mongodb_playbook.yml
Created October 24, 2015 04:31
Ansible Playbook to setup MongoDB on Ubuntu 14.04 (ubuntu/trusty64)
---
- hosts: all
sudo: true
vars:
mongodb_version: 3.0.7
tasks:
- name: MongoDB | Import the public key used by the package management system
apt_key: keyserver=keyserver.ubuntu.com id=7F0CEB10
- name: MongoDB | Create a list file
lineinfile: dest=/etc/apt/sources.list.d/mongodb-org-3.0.list line="deb http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.0 multiverse" state=present create=yes
@ferromir
ferromir / gist:9c1a3fd2bc59220492ab
Created March 20, 2015 06:09
ACR - Java - Release resources
// Bad
public int processFile(String fileName)
throws IOException, FileNotFoundException {
FileInputStream stream = new FileInputStream(fileName);
BufferedReader bufRead =
new BufferedReader(new InputStreamReader(stream));
String line;
while ((line = bufRead.readLine()) != null) {
sendLine(line);
@ferromir
ferromir / gist:757c30d1d6d524a002d6
Created March 20, 2015 06:01
ACR - Java - SQL Injection
// Insecure code
String query = "SELECT account_balance FROM user_data WHERE user_name = " + request.getParameter("customerName");
ResultSet results = statement.executeQuery( query );
// Defense using prepared statements
String custname = request.getParameter("customerName"); // This should REALLY be validated too
// perform input validation to detect attacks
String query = "SELECT account_balance FROM user_data WHERE user_name = ? ";
PreparedStatement pstmt = connection.prepareStatement( query );