Skip to content

Instantly share code, notes, and snippets.

View renato04's full-sized avatar

Renato Ramos Nascimento renato04

  • Globant
  • São Paulo - Brazil
View GitHub Profile
@toryano0820
toryano0820 / wsl2-ubuntu-map-win-localhost.sh
Last active May 11, 2024 03:32
For WSL2: Fixes "Connection Refused" issue when accessing Windows localhost services. Run with "sudo sh wsl2-ubuntu-map-win-localhost.sh" !!! Remember to backup "/etc/hosts" just in case !!!
nameserver=$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}') # find nameserver
[ -n "$nameserver" ] || "unable to find nameserver" || exit 1 # exit immediately if nameserver was not found
echo "##### nameserver found: '$nameserver'"
localhost_entry=$(grep -v "127.0.0.1" /etc/hosts | grep "\slocalhost$") # find localhost entry excluding 127.0.0.1
if [ -n "$localhost_entry" ]; then # if localhost entry was found
echo "##### localhost entry found: '$localhost_entry'"
sed -i "s/$localhost_entry/$nameserver localhost/g" /etc/hosts # then update localhost entry with the new $nameserver
else # else if entry was not found
echo "##### localhost entry not found"
echo "$nameserver localhost" >> /etc/hosts # then append $nameserver mapping to localhost
@LetticiaNicoli
LetticiaNicoli / samplesAndSimulators.R
Last active May 29, 2019 22:45
R - Amostras e Simulações
#Amostras e Simulações
#Distribuição uniforme
runif(n=2, min = 1, max = 10)
#Avalia probabilidade
dunif(x= 8, min = 1, max = 10)
#número máximo nao é sorteado
#Avalia probabilidade acumulaa
@jgoux
jgoux / app.js
Created April 15, 2014 14:53
Ionic / AngularJS service wrapper for Web SQL API / SQLite-Cordova-Plugin
angular.module('myApp', ['ionic', 'myApp.services', 'myApp.controllers'])
.run(function(DB) {
DB.init();
});