Skip to content

Instantly share code, notes, and snippets.

View dertin's full-sized avatar

Guillermo Céspedes Tabárez dertin

View GitHub Profile
@dertin
dertin / Cargo.toml
Last active July 23, 2023 20:34
Efficient Connection Pooling in ODBC-MSSQL (odbc-api) - unixODBC 2.3.12pre
[package]
name = "rust-pooldb"
version = "0.1.0"
edition = "2021"
[dependencies]
tokio = { version = "1.29.1", features = ["full"] }
odbc-sys = "0.21.4"
odbc-api = "0.57.0"
#!/bin/bash
# This script makes it easier to maintain security groups that allow SSH access
# from a computer with a dynamic IP, such as a computer on a home network or ISP.
#
# Using the script will allow you to SSH to an EC2 without having to allow
# access to the whole world (0.0.0.0/0). If you run this script whenever your IP
# changes then the security groups in your account specified by your AWS profile
# will be updated.
#
execve("./_UNIT", ["./_UNIT"], 0x7fff31efacf0 /* 68 vars */) = 0
brk(NULL) = 0x55c328184000
arch_prctl(0x3001 /* ARCH_??? */, 0x7ffce5e52560) = -1 EINVAL (Invalid argument)
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=116268, ...}) = 0
mmap(NULL, 116268, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc68b59c000
close(3) = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\3405\0\0\0\0\0\0"..., 832) = 832
// This code is just a proof of concept of the code I need to generate in Rust, having as input a yaml file with process definitions of the style (bpmn)
// Look at the process diagram: https://gist.github.com/dertin/d11c50e957c41325131d3c45cee28f66#gistcomment-3605790
#[allow(unused_variables)]
#[macro_use]
extern crate lazy_static;
use std::collections::HashMap;
@dertin
dertin / php-pools.md
Last active July 1, 2019 19:32 — forked from holmberd/php-pools.md
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php7-fpm.log
@dertin
dertin / git-deploy-aws.md
Last active January 17, 2024 12:40
Setup git deploy for AWS ec2 Ubuntu instance
#!/bin/bash
# Usage:
# bash s3BackUp.sh YOUR_BACKUP_DIRECTORY BACKUP_NAME YOUR_BUCKET MAIL_FROM MAIL_TO (OPTIONAL: S3_FOLDER PROFILE)
# bash s3BackUp.sh /var/www/webdisk/example.com/ example my_bucket info@example.com soporte@example.com backup default
# Arguments:
readonly BACKUP_PATH_NO_REMOVE=$1
readonly BACKUP_NAME=$2
readonly S3_BUCKET_NAME=$3
#!/usr/bin/env python3
# Author: Guillermo Cespedes <dev.dertin@gmail.com>
# pip install requests http itertools
import requests
import json
import http.cookies
import itertools
import os.path
#!/usr/bin/env python
# Author: Guillermo Cespedes <dev.dertin@gmail.com>
# pip install requests http barnum
import requests
import http.cookies
import json
from barnum import gen_data