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 / Virtual Box Host Only Static IP.md
Created October 13, 2018 20:19 — forked from pjdietz/Virtual Box Host Only Static IP.md
VirtualBox Host-Only Adapter with Static IP

VirtualBox Host-Only Static IP

My typical setup for a development box in VirtualBox uses two NICs. The first uses NAT to allow the box to communicate with the outside world through my host computer’s network connection. (NAT is the default, so shouldn't require any setup.) The second is a "host-only" connection that allows my host and guest to interact.

To create a host-only connection in VirtualBox, start by opening the preferences in VirtualBox. Go to the "Network" tab, and addd a Host-only Network. Modify the host-only network, and disable DHCP. Make a note of the IP address. (Feel free to set the IP address as well, if you like.)

Next, assign this host-only adapter to the virtual machine. Select the VM and press "Settings". Go to the "Network" tab, and select "Adpater 2". Enable the adapter, set it to a "Host-only Adapter", and select the adpater you created above.

Temporary

#!/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
#!/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
#!/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
@dertin
dertin / git-deploy-aws.md
Last active January 17, 2024 12:40
Setup git deploy for AWS ec2 Ubuntu instance
@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
// 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;
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
#!/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.
#