Skip to content

Instantly share code, notes, and snippets.

View esalaza's full-sized avatar
🎯
Focusing

Esteban Salazar esalaza

🎯
Focusing
View GitHub Profile
@esalaza
esalaza / Dockerfile.lambda.graphicsmagick
Last active June 18, 2025 08:00
Dockerfile to generate a GraphicsMagick AWS Lambda layer (can be used with `pdfpic`)
# Dockerfile to build a Lambda Layer for GraphicsMagick, dependency for `pdf2pic`, the PDF to image converter.
#
# On ARM64:
# - Build with: docker build --platform linux/amd64 -t gm-layer-x86 .
# - Run with: docker run --platform linux/amd64 --rm -v $(pwd):/workspace gm-layer-x86
FROM amazonlinux:2
ENV GM_VERSION=1.3.45
ENV GS_VERSION=9.54.0
@esalaza
esalaza / Dockerfile.windows.rtools
Created October 21, 2023 01:40
RTools in Windows
FROM mcr.microsoft.com/windows/servercore:ltsc2022 as r-base
RUN curl.exe -o R-4.0.3-win.exe https://cran.r-project.org/bin/windows/base/old/4.0.3/R-4.0.3-win.exe
# COPY extras/windows/installers/R-4.0.3-win.exe R-4.0.3-win.exe
RUN R-4.0.3-win.exe /VERYSILENT /DIR="C:\R\"
RUN curl.exe -o Rtools.exe https://cran.r-project.org/bin/windows/Rtools/rtools40-x86_64.exe
# COPY extras/windows/installers/rtools40-x86_64.exe Rtools.exe
@esalaza
esalaza / Dockerfile.windows.MSVC
Last active October 22, 2023 02:27
Docker: Windows Server Core 2022 with Visual Studio Build Tools and Windows SDL
FROM mcr.microsoft.com/windows/servercore:ltsc2022
RUN powershell -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
RUN choco install -y visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64"
RUN choco install -y windows-sdk-11-version-22H2-all
# Visual Studio Build Tools
# Bin
  • Crop picture in Preview: Select area, + K
@esalaza
esalaza / 0192721658_1562696767_blogversion_samlapi_formauth_python3_mfa.py
Last active February 16, 2022 05:49
Federated API/CLI Access Using SAML 2.0 with SMS MFA (MicroSoft)(q&d)
#!/usr/bin/python3
# Some quick and dirty changes on the
# 0192721658_1562696775_blogversion_samlapi_formauth_adfsv3mod_python3.py
# (https://awsiammedia.s3.amazonaws.com/public/sample/SAMLAPICLIADFS/0192721658_1562696775_blogversion_samlapi_formauth_adfsv3mod_python3.py)
# script provided in "How to Implement a General Solution for Federated API/CLI Access Using SAML 2.0"
# (https://aws.amazon.com/blogs/security/how-to-implement-a-general-solution-for-federated-apicli-access-using-saml-2-0/)
# to support SMS MFA authentication on a Microsoft-based (AD) scenario.
import sys
# Template for a load-balanced ECS Fargate Web service (only plain HTTP currently) deployed from
# an ECR image which will be published from CI/CD. The ECS Fargate service will also be updated
# from CI/CD. Env vars are supplied to the Web Service via S3 env files. Permissions are added to
# the supplied CI/CD user to be able to use ECR/ECS.
#
# Based on https://github.com/1Strategy/fargate-cloudformation-example/blob/master/fargate.yaml
#
# Pre-requisites:
# - VPC with 2 public subnets
# - User which will push to ECR and update the ECS service (through CI/CD, 'buildkite-dev' by
@esalaza
esalaza / Awesome tools.md
Last active June 17, 2022 02:04
Awesome tools

Awesome tools

HTTP

Tool Description
mockpy Small CLI tool to super quicly mock HTTP endpoints
mitmproxy Free and open source interactive HTTPS proxy

SMTP

@esalaza
esalaza / mp3-renamer.py
Last active June 27, 2020 04:45
Rename MP3 file names from metadata (quick and dirty)
# First pip3 install eyeD
import eyed3
import logging
import os
import sys
import string
import traceback
logging.basicConfig(filename='mp3-renamer.log',level=logging.DEBUG)

.NET Core Notes

Console output in dotnet test

dotnet test --logger:"console;verbosity=detailed"

Also, ITestOutputHelper

Random Notes

Download MP4 audio from YouTube video

  1. Make sure ffmpeg is installed: brew install ffmpeg
  2. Install youtube-dl: brew install youtube-dl
  3. List available formats for video: youtube-dl -F