Skip to content

Instantly share code, notes, and snippets.

View gtrabanco's full-sized avatar
:octocat:

Gabriel Trabanco gtrabanco

:octocat:
  • Spain
View GitHub Profile
@gtrabanco
gtrabanco / vacuum-es.yaml
Last active January 7, 2022 12:08
Configuración extendida para robot aspiradores de Valetudo
# Vacuum-extended-config
# Versión: 1.0.0
# Autor: Gabriel Trabanco Llano <[email protected]>
# https://github.com/gtrabanco https://keybase.io/gtrabanco
# LICENCIA: SIN LICENCIA. Haz lo que quieras pero la atribución es bien recibida
# por mi ego.
#
# There is a english version here: https://gist.github.com/gtrabanco/87320443dcd30ac10990f87b0c423e19
# Puedes agregar este archivo por partes incrustandolo en tu configuración por partes o
@gtrabanco
gtrabanco / subflow.json
Created December 31, 2021 19:17
Subflow limpieza condicional
[{"id":"6d1ab575c8ee62e1","type":"subflow","name":"Conditional Clean Segments","info":"Requirements:\n- [Extra configuration for the vacuum](https://gist.github.com/gtrabanco/87320443dcd30ac10990f87b0c423e19)","category":"","in":[{"x":60,"y":260,"wires":[{"id":"291669f61c673f20"}]}],"out":[{"x":1780,"y":180,"wires":[{"id":"fd8a618a491d08a4","port":0}]},{"x":1780,"y":260,"wires":[{"id":"fd8a618a491d08a4","port":1}]}],"env":[{"name":"has_map_sensor","type":"str","value":"binary_sensor.vacuum_has_pending_map","ui":{"label":{"en-US":"Entity of binary sensor for pending map"},"type":"input","opts":{"types":["str"]}}},{"name":"segments","type":"json","value":"[]","ui":{"label":{"en-US":"Array of segments to be cleaned ("},"type":"input","opts":{"types":["num","json"]}}},{"name":"segments_sensor","type":"str","value":"sensor.map_segments","ui":{"label":{"en-US":"Sensor that has the segments"},"type":"input","opts":{"types":["str"]}}},{"name":"mqtt_prefix","type":"str","value":"valetudo","ui":{"label":{"en-US":"MQTT
@gtrabanco
gtrabanco / Cecotec-map-backup.md
Last active December 31, 2021 16:41
Workaround Cecotec Congas map backup

Required files to have a sucessfully backup

carto_slam.data
customer_map_list_path.plan
first_hardware_unbunding_flag.ini
resume_data.info
scheme_data.info1640869826
unfinished_carto_slam.data
unfinished_data.info
@gtrabanco
gtrabanco / vacuum.yaml
Last active January 9, 2022 15:53
Vacuum Configuration for Home Assistant
# Vacuum-extended-config
# Version: 1.0.0
# Author: Gabriel Trabanco Llano <[email protected]>
# https://github.com/gtrabanco https://keybase.io/gtrabanco
# LICENSE: UNLICENSED. Do whatever you want with this stuff but attribution will be
# very welcome from my ego.
# Versión en español: https://gist.github.com/gtrabanco/476bc119448319a1db510f6948361f47
# You can add this file entirely but need to change <valetudo_or_ha_ip> and <valetudo_port> manually.
@gtrabanco
gtrabanco / networking.sh
Last active August 29, 2021 11:31
Netmask to bits & bits to netmask
#!/usr/bin/env bash
#shellcheck disable=SC2206,SC2207
ipv4_netmask() {
local IFS='.' netmask=() rest_bits tmp_netmask=0
local -r bits="${1:-0}"
if [[ $bits -lt 0 || $bits -gt 32 ]]; then
echo "Error: IPv4 netmask should be between 0 and 32" 1>&2
return 1
@gtrabanco
gtrabanco / syno-wildcard.sh
Created July 18, 2021 10:49
Synology acme.sh wildcard cert creation
#!/usr/bin/env bash
# DOMAINS
DOMAINS="example.com,*.example.com"
# DNS Provider
CERT_DNS="dns_namecheap" # For more: https://github.com/acmesh-official/acme.sh/wiki/dnsapi
NAMECHEAP_API_KEY=''
NAMECHEAP_USERNAME=''
NAMECHEAP_SOURCEIP=''
@gtrabanco
gtrabanco / telegram-ping.sh
Last active July 10, 2021 12:59
Ping to HOST and if it fails return a message through Telegram
#!/usr/bin/env bash
#shellcheck disable=SC2034
#
# CONFIG
#
# IP or HOSTNAME to ping
# IP o host al que hacer ping
# HOST="192.168.33.1"
@gtrabanco
gtrabanco / keybase-gpg.sh
Last active October 14, 2023 21:27
Import existing GPG keys from Keybase wizard and configure it for GIT
#!/usr/bin/env bash
#shellcheck disable=SC2016
set -euo pipefail
if [[ -z "${DOTLY_PATH:-}" ]] || ! output::empty_line > /dev/null 2>&1; then
red='\033[0;31m'
green='\033[0;32m'
bold_blue='\033[1m\033[34m'
normal='\033[0m'
@gtrabanco
gtrabanco / deno-github-open-prs.ts
Last active May 3, 2021 01:01
Get using deno the number of Pull Request that are open in a GitHub repository
#!/usr/bin/env -S deno run --allow-env --allow-net
import { parse } from "https://deno.land/[email protected]/flags/mod.ts";
import { red, green } from "https://deno.land/[email protected]/fmt/colors.ts";
const enum PullRequestState {
open = "open",
close = "close"
}
const enum HttpMethod {
@gtrabanco
gtrabanco / IndexSignature.ts
Last active May 2, 2021 22:49
Solving Index Signature in Typescript for dynamic object property names
/**
* In this case this function convert an objest to url query params
*/
const object2UrlParameters = (objectValues:object): string => {
let returnedParams:string = ''
Object.getOwnPropertyNames(objectValues).forEach((paramName) => {
let key = paramName as keyof object //Avoiding Index Signature
let value = objectValues[key]
returnedParams = `${returnedParams}&${paramName}=${value}`