Skip to content

Instantly share code, notes, and snippets.

View mesaglio's full-sized avatar
🎯
Focusing

Juan Mesaglio mesaglio

🎯
Focusing
View GitHub Profile
@mesaglio
mesaglio / socket_server.py
Created February 19, 2021 23:21
Python http socket server
import socket
import threading
import json
import datetime
class Server:
def __init__(self, port: int, multi_threading=True):
self.port = port
self.threads = multi_threading
@mesaglio
mesaglio / profile.py
Created January 30, 2021 15:23
profile decorator cProfile - Python 3.9
import cProfile, pstats, io
def profile(fun):
"""
print file-function call, number of calls, cumtime, percall(second percall)
How to use:
@profile
def function_to_analize():
...
@mesaglio
mesaglio / README.md
Last active November 13, 2020 13:01
CMVN - Create mvn project from console

CMVN

  1. Download or copy the script content un home directory.

  2. Create tarminal alias, like in ~/.bashrc alias cmvn='/c/Users/juan\ mesaglio/deploy-scripts/create-maven-project.sh'.

  3. Enjoy.

@mesaglio
mesaglio / Jenkinsfile
Last active April 22, 2021 03:56
Jenkinsfile - Test - Package - Sonar - Quality Gate - Artifactory
pipeline {
agent any
tools {
maven 'Maven_3.6.2'
jdk 'Java_1.8u161'
}
environment {
GIT_VERSION = sh (returnStdout: true, script: 'git rev-parse HEAD | cut -c 1-10').trim()
@mesaglio
mesaglio / docker-compose.yml
Created July 28, 2020 14:27
Kibana - Elasticsearch - Logstash
version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.8.1
ports:
- 9200:9200
- 9300:9300
environment:
- discovery.type=single-node
logstash:
/target/
/bin/
.classpath
.project
/.apt_generated/
/.settings/
.factorypath
*.iml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>GROUP</groupId>
<artifactId>ARTIFACT</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
const echoPostRequest = {
url: pm.environment.get('baseUrl') + '/login',
method: 'POST',
header: 'Content-Type:application/json',
body: {
mode: 'application/json',
raw: JSON.stringify(
{
"mail": "asd@amazon.com",
"password": "HXtaSUzh"
var Sequelize = require('sequelize');
var pool;
module.exports = {
getPool: function() {
if (pool) {
console.log('pool viejo '); //+ pool);
return pool;
}
pool = new Sequelize('mysql://root:root@localhost:3306/pdep', {
@mesaglio
mesaglio / registry-ui.yaml
Last active August 7, 2020 17:45
Docker registry + registry ui
version: '3.1'
services:
registry:
image: registry:2
ports:
- "5000:5000"
environment:
- REGISTRY_STORAGE_DELETE_ENABLED:"true"
volumes:
- ./data:/var/lib/registry