Skip to content

Instantly share code, notes, and snippets.

View LuisCusihuaman's full-sized avatar
🛸
refactorin' code

edu LuisCusihuaman

🛸
refactorin' code
View GitHub Profile
#include <stdio.h>
#define max_long 3
/*void pedir_vector(int coord_ector[]);*/
void imprimir_vector(int vector[]);
void sumar_vector(int vector_suma_a[], int vector_suma_b[], int vector_sumado[]);
int main(){
int vector_a[max_long] = {1,2,3}
@LuisCusihuaman
LuisCusihuaman / app.js
Created July 6, 2020 23:55 — forked from minhchu/app.js
Nginx and Express Morgan configurations for logging in production
'use strict';
const app = express();
...
app.set('trust proxy', true);
if (process.env.ENVIRONMENT == 'development') {
app.use(logger('dev'));
} else {
import sys
from datetime import timedelta
total_time = sys.argv[1].split('.') # 2.35 is 2hr 35min
delta = timedelta(hours=int(total_time[0]), minutes=int(total_time[1]))
minutes = delta.total_seconds() / 60
total_pomodoros = round(minutes / 25)
print(f'🕒{total_pomodoros} Pomodoros')
@LuisCusihuaman
LuisCusihuaman / deploy.yml
Last active February 22, 2021 18:28
AWS Cloudformation template for S3 Static Website bucket
#.github/workflows/deploy.yaml
name: CD Stage
on:
push:
branches:
- QA
- '!master'
jobs:
deploy:
runs-on: ubuntu-20.04
@LuisCusihuaman
LuisCusihuaman / rabbitmq.py
Last active January 6, 2022 15:26
RABBITMQ CLIENT CONNECTION PYTHON TEST
import pika
from bottle import run, Bottle
EXCHANGE_NAME = "domain"
QUEUE_NAME = "domain"
ROUTING_EX_KEY = "domain-key"
def main():
rabbitmq_uri_app = "amqp://user:[email protected]:5672/target-vhost"
asyncapi: 2.4.0
info:
title: Account Service
version: 1.0.0
description: This service is in charge of processing user signups
channels:
user-signedup:
description: A user has signed up for our service
publish:
message:
import { CognitoIdentityProviderClient, GetIdCommand, GetCredentialsForIdentityCommand } from '@aws-sdk/client-cognito-identity';
import { S3Client } from '@aws-sdk/client-s3';
// Configuration
const REGION = 'us-east-1';
const userPoolId = import.meta.env.VITE_USER_POOL_ID;
const identityPoolId = import.meta.env.VITE_IDENTITY_POOL_ID;
// Initialize S3Client without specific credentials
export const s3Client = new S3Client({ region: REGION });
@LuisCusihuaman
LuisCusihuaman / merge_subtitles_with_video.py
Created June 10, 2024 05:46
Merge subtitles with video
import os
import sys
import logging
import subprocess
import codecs
# Configure logging
logging.basicConfig(level=logging.INFO, format='%(message)s')
logger = logging.getLogger()
// src/main/java/com/edu/uba/projects/config/AppConfig.java
package com.edu.uba.projects.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.web.SecurityFilterChain;
@LuisCusihuaman
LuisCusihuaman / Dockerfile
Created July 12, 2024 13:57
Java Dockerfile
# Builder stage
FROM eclipse-temurin:21-jdk-jammy as builder
WORKDIR /opt/app
# Copy only the necessary files to download dependencies first and leverage caching
COPY gradlew build.gradle settings.gradle ./
COPY gradle ./gradle
RUN ./gradlew dependencies --no-daemon || return 0
# Copy the rest of the source files and build the project