Skip to content

Instantly share code, notes, and snippets.

View luandro's full-sized avatar

luandro luandro

View GitHub Profile
@luandro
luandro / download_files_from_email_eml_file.sh
Last active August 31, 2023 15:20
Downloads Google Drive attachments from a EML file.
#!/bin/bash
# Check if an argument has been provided
if [ $# -eq 0 ]; then
echo "No argument provided. Please enter the .eml file path:"
read file_path
else
file_path=$1
fi
@luandro
luandro / generate-defaults.sh
Last active August 8, 2023 00:19
Generates a Mapeo config defaults.json based on the items within the presets folder and their geometry fields. Execute from the Mapeo configuration project's folder root.
#!/bin/bash
# Path to the presets folder
presetsFolder="./presets"
# Path to defaults.json
defaultsPath="./defaults.json"
# Temp file for jq output
tempFile=$(mktemp)
@luandro
luandro / computer_gateway.sh
Created August 7, 2023 23:42
This bash script is used to set up and tear down a simple internet gateway. It uses the ip, iptables, ufw, and dnsmasq utilities to configure network interfaces, set up NAT (Network Address Translation), configure a firewall, and set up a DHCP server.
#!/bin/bash
# Check if script is run as root
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
# Check if required utilities are installed
for util in ip iptables ufw dnsmasq; do
@luandro
luandro / cpe_borda.md
Last active October 19, 2022 12:18
CPE 210 na borda

/etc/config/network:

config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
@luandro
luandro / configure_local_balena.sh
Created October 5, 2021 19:36
Installing Balena OS on Digital Ocean server
# Install Balena cli: https://github.com/balena-io/balena-cli/blob/master/INSTALL.md
echo "balenaUrl: 'balena.coolab.org'" >> ~/.balenarc.yml
export NODE_EXTRA_CA_CERTS='/etc/ssl/private/ca.crt'
balena login
@luandro
luandro / control_irrigation.sh
Last active July 25, 2021 11:15
OpenWRT ESP relay control
#!/bin/sh
# /usb/bin/control_irrigation.sh
# Don't forget to: chmod +x /usb/bin/control_irrigation.sh
command=$1
channel=$2
IP=$(cat /tmp/dhcp.leases | grep ESP |cut -d " " -f 3| awk '{print $1}')
echo $1 on channel $2 on IP $IP
if [ $1 == 'start' ]
@luandro
luandro / esp8622_autonomous_water_sensor_comurede.ino
Last active January 9, 2020 14:38
comuREDE firmware for esp8622
//MESH-UP Trabalho Final
//IFRJ Niterói - Turma ARDUINO (manha) - Professor Luiz Felipe
//Grupo: Bruno Souza, Felipe Monteiro e Filipe Rimes
//Fontes:
//#Programa: NodeMCU e MQTT - Controle e Monitoramento IoT
//#Autor: Pedro Bertoleti
//code write by Moz for YouTube changel LogMaker360, 7-10-2015
//code belongs to this video: https://www.youtube.com/watch?v=jTj1oMyJF_c
//KY018 Photo resistor module
@luandro
luandro / experiment_1.sh
Created November 21, 2019 20:35
Community Server Experiment
#Set user
useradd -ou 0 -g 0 admin
passwd admin
# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
@luandro
luandro / gist:bf776e16f25d9f063651865bef82709a
Created June 26, 2019 12:41
sodium-native build error with nodejs-mobile-react-native
checking whether make supports the include directive... yes (GNU style)
checking for gcc... /Users/Sites/ssbcmobile/android/build/standalone-toolchains/arm-linux-androideabi/bin/arm-linux-androideabi-clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... Modulesarmeabi-v7a
checking whether we are cross compiling... configure: error: in `/Users/Sites/ssbcmobile/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-armeabi-v7a/nodejs-project/node_modules/sodium-native/libsodium':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
/Users/Sites/ssbcmobile/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-armeabi-v7a/nodejs-project/node_modules/sodium-native/preinstall.js:119

Keybase proof

I hereby claim:

  • I am luandro on github.
  • I am luandro (https://keybase.io/luandro) on keybase.
  • I have a public key ASBlmjz9hgLC9cXN00ij-HDYTRteGxUXiIs8DfF84Wuvogo

To claim this, I am signing this object: