Skip to content

Instantly share code, notes, and snippets.

View ychevarrias's full-sized avatar

Yelson Chevarrias ychevarrias

  • Lurin, Lima - Perú
  • 19:25 (UTC -05:00)
View GitHub Profile
@ychevarrias
ychevarrias / index-bulma.html
Created May 10, 2024 00:31
Bulma CSS layout
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Layout con Bulma CSS</title>
<!-- Enlace al archivo CSS de Bulma -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css">
</head>
<body>
@ychevarrias
ychevarrias / script.sh
Created February 6, 2024 15:22
Amazon Linux 2023 - Let's Encrypt - install commands
sudo dnf install -y augeas-libs
sudo python3 -m venv /opt/certbot/
sudo /opt/certbot/bin/pip install --upgrade pip
sudo /opt/certbot/bin/pip install certbot certbot-apache
sudo ln -s /opt/certbot/bin/certbot /usr/bin/certbot
sudo certbot -d example.pro --nginx
@ychevarrias
ychevarrias / trace_2022-04-05-1704.log
Created April 5, 2022 22:35
Pyenv install error debug trace
+(/home/ubuntu/.pyenv/bin/pyenv:23): enable -f /home/ubuntu/.pyenv/bin/../libexec/pyenv-realpath.dylib realpath
+(/home/ubuntu/.pyenv/bin/pyenv:30): '[' -z '' ']'
++(/home/ubuntu/.pyenv/bin/pyenv:32): type -P greadlink readlink
++(/home/ubuntu/.pyenv/bin/pyenv:32): head -1
+(/home/ubuntu/.pyenv/bin/pyenv:32): READLINK=/usr/bin/readlink
+(/home/ubuntu/.pyenv/bin/pyenv:33): '[' -n /usr/bin/readlink ']'
+(/home/ubuntu/.pyenv/bin/pyenv:58): '[' -z /home/ubuntu/.pyenv ']'
+(/home/ubuntu/.pyenv/bin/pyenv:61): PYENV_ROOT=/home/ubuntu/.pyenv
+(/home/ubuntu/.pyenv/bin/pyenv:63): export PYENV_ROOT
+(/home/ubuntu/.pyenv/bin/pyenv:65): '[' -z '' ']'
@ychevarrias
ychevarrias / match_requirements.py
Last active March 13, 2022 08:44
Match requirement.txt with pip freeze stdout
import subprocess
result = subprocess.run(['pip', 'freeze'], stdout=subprocess.PIPE)
rq_file = open("requirements.txt", "r")
rq_file_versioned = open("requirements_versioned.txt", "w")
rq_versioned = list()
versioned_lines = result.stdout.decode("utf-8").split("\n")[:-1]
rq_lines = rq_file.readlines()
rq_file.close()
def match(dependency):
@ychevarrias
ychevarrias / install-docker.sh
Created January 6, 2021 07:38 — forked from p3jitnath/install-docker.sh
Docker and Nvidia Docker installation in Ubuntu 20.04 LTS
# WARNING : This gist in the current form is a collection of command examples. Please exercise caution where mentioned.
# Docker
sudo apt-get update
sudo apt-get remove docker docker-engine docker.io
sudo apt install docker.io
sudo systemctl start docker
sudo systemctl enable docker
docker --version
@ychevarrias
ychevarrias / py_brench.py
Last active October 25, 2020 04:54
Py brench
from uuid import uuid4
import time
def get_bin_str(_bytes):
return " ".join(
["{0:08b}".format(bit) for bit in _bytes]
)
@ychevarrias
ychevarrias / comb_permut.py
Created September 19, 2019 01:30
Combinaciones y permutaciones
prmt = lambda x, y: math.factorial(x)/math.factorial(x-y)
comb = lambda x, y: prmt(x, y)*(math.factorial(y)**-1)
# 6 personas en 4 lugares respetando sus posiciones dan 360 escenarios
assert prmt(6, 4) == 360
# 6 personas en 4 lugares sin importar posiciones dan 15 escenarios
assert comb(6, 4) == 15
@ychevarrias
ychevarrias / image_rezizer.js
Created August 1, 2019 04:06
Redimensión de imágenes con javascript | Canvas crop, scale image
compress_async = (e) => {
return new Promise((resolve, reject) => {
const width = 1080;
const height = 1080;
const fileName = e.target.files[0].name;
const reader = new FileReader();
var file = null;
reader.readAsDataURL(e.target.files[0]);
const img = new Image();
@ychevarrias
ychevarrias / curl_result_format.txt
Created July 10, 2019 23:38
Curl Result format
echo "
http_code: %{http_code}\n\
http_version: %{http_version}\n\
num_connects: %{num_connects}\n\
remote_ip: %{remote_ip}\n\
size_download: %{size_download}\n\
size_header: %{size_header}\n\
size_request: %{size_request}\n\
speed_download: %{speed_download}\n\
time_namelookup: %{time_namelookup}\n\
@ychevarrias
ychevarrias / conda--enviroments-commands.txt
Created September 28, 2018 02:44
Codigos para manejo de Ananconda
conda create -n myenv python=3.5.5 # Crea entornos
conda create --no-default-packages -n myenv python # Crea entornos sin paquetes
conda info --envs # Lista entornos
conda env list # Lista entornos en MiniConda
conda list -n myenv # lista paquetes de un entorno especifico
conda list # Lista paquetes del entorno actual
conda install -n myenv pip # instalando pip en el entorno