Skip to content

Instantly share code, notes, and snippets.

View cosmo058's full-sized avatar
🥓
Coding from home

Angel Sanchez cosmo058

🥓
Coding from home
View GitHub Profile
@cosmo058
cosmo058 / 2019-https-localhost.md
Created March 12, 2024 00:36 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@cosmo058
cosmo058 / port-forward-wsl2.ps1
Created April 12, 2022 16:44
PowerShell script to forward WSL ports to host ports.
#source: https://github.com/microsoft/WSL/issues/4150
$remoteport = bash.exe -c "ip addr | grep -Ee 'inet.*eth0'"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteport = $matches[0];
} else{
echo "The Script Exited, the ip address of WSL 2 cannot be found";
exit;
}
@cosmo058
cosmo058 / docker-logs-localtime
Created March 23, 2022 16:27 — forked from popstas/docker-logs-localtime
docker-logs-localtime - Replace all UTC dates in docker logs output to local dates in pipe
#!/usr/bin/env node
// replace all UTC dates to local dates in pipe
// usage: docker logs -t container_name | docker-logs-localtime
// install:
// curl https://gist.githubusercontent.com/popstas/ffcf282492fd78389d1df2ab7f31052a/raw/505cdf97c6a1edbb10c3b2b64e1836e0627b87a0/docker-logs-localtime > /usr/local/bin/docker-logs-localtime && chmod +x /usr/local/bin/docker-logs-localtime
// alternative: https://github.com/HuangYingNing/docker-logs-localtime
const pad = d => (d > 9 ? d : '0' + d);