This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package workflow | |
import ( | |
"encoding/json" | |
"errors" | |
"fmt" | |
"time" | |
) | |
const ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.8" | |
services: | |
mongo: | |
image: mongo:5.0.11 | |
container_name: "mongo" | |
command: --replSet rs | |
volumes: | |
- mongo-data:/data/db | |
ports: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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":{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Problem: Implement an algorithim to compress strins such as | |
aaaabbccccccccdddedaaa | |
4a2b8c3d1e1d3a | |
Fernando's solution: pseudocode | |
compress(s string) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 ); |
NewerOlder