Skip to content

Instantly share code, notes, and snippets.

View vjvelascorios's full-sized avatar
🎯

vjvelascorios vjvelascorios

🎯
View GitHub Profile
#!/bin/bash
# Actualizar índices de paquetes
sudo apt update -qq
# Instalar paquetes auxiliares
sudo apt install --no-install-recommends software-properties-common dirmngr -y
# Agregar clave de firma para repositorios de R
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
@vjvelascorios
vjvelascorios / startup.jl
Created February 4, 2025 05:12
quasi pacman in julia
# /home/vjvelascorios/.julia/config/startup.jl
using Pkg
function ensure_package_installed(pkg::Symbol)
pkg_str = String(pkg)
if !haskey(Pkg.dependencies(), pkg_str)
println("Installing $pkg_str...")
Pkg.add(pkg_str)
end
end
import requests
from bs4 import BeautifulSoup
import os
from urllib.parse import urljoin
print("Script location:", os.getcwd())
print("Downloads folder:", os.path.join(os.getcwd(), "downloads"))
# Create downloads folder
download_folder = "C:/Users/vjvelascorios/Downloads/downloads"
@vjvelascorios
vjvelascorios / scraping_imss_datasets.py
Created July 14, 2024 03:56
scraping imss datasets
#old
#@title Código final old (1997-2024)
import re
import requests
from bs4 import BeautifulSoup
from urllib.parse import urljoin
import pandas as pd
# Lista para almacenar todos los enlaces de descarga
all_download_links = []
@vjvelascorios
vjvelascorios / banxico_lib_updates.py
Created May 9, 2024 05:07
Download Banxico's Library monthly updates
import os
import requests
from bs4 import BeautifulSoup
from urllib.parse import urljoin
from datetime import datetime
# URL
url = "https://www.banxico.org.mx/servicios/boletin-mensual-de-la-biblioteca-del-banco-de-mexi/boletin-mensual-biblioteca-pu.html"
# Carpeta local donde se guardarán los archivos PDF
@vjvelascorios
vjvelascorios / weekly cran automation.ps1
Last active April 27, 2024 07:11
basic task programming execution and push
# Running Rscript
$fecha = Get-Date -Format "yyyy-MM-dd"
Start-Process "Rscript.exe" -ArgumentList "C:\Users\vjvelascorios\Documents\weekly-cran-packages\code\CRAN Package Tables WindowsVersion.R" -NoNewWindow -Wait
# repo update
cd "C:\\Users\\vjvelascorios\\Documents\\weekly-cran-packages"
git add .
git commit -m "Weekly update - $fecha" #not tested with "fecha" legend
git push
#!/bin/bash
script_path=$(realpath "${BASH_SOURCE[0]}")
cd "$(dirname "$script_path")"
shopt -s extglob
find . -maxdepth 1 -type f ! -name "*.pdf" ! -name "*.md" ! -name "*.tex" ! -name "$(basename "$script_path" | tr -d '[:space:]')" -exec rm {} +
@vjvelascorios
vjvelascorios / chol_decomp.jl
Created April 16, 2024 01:35
cholesky decomp
# Paso 1: Matriz simétrica y definida positiva
A = [4.0 2.0 -1.0;
2.0 5.0 3.0;
-1.0 3.0 6.0]
# Paso 2: Vector de términos constantes
b = [1.0, 2.0, 3.0]
# Paso 3: descomposición de Cholesky
L = cholesky(A).L
mkdir="~/localsites"
base_dir="/home/vjvelascorios/localsites"
for url in "$@"
do
sitio=$(echo "$url" | awk -F[/:] '{print $4}')
mkdir -p "$base_dir/$sitio"
httrack "$url" -O "$base_dir/$sitio"
done
# Get date (YYYY-MM-DD)
$fecha = Get-Date -Format "yyyy-MM-dd"
# URL
$url = "https://www.elfinanciero.com.mx/graficos/edicion-impresa/download.php?file=edicion-digital.pdf"
# Download folder
$carpeta_descargas = "C:\Users\vjvelascorios\Desktop\El Financiero"
# Filename