This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import requests | |
| from bs4 import BeautifulSoup | |
| from time import sleep | |
| from datetime import datetime | |
| import shutil | |
| import argparse | |
| def download_file(name, url): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "net/http" | |
| "log" | |
| "time" | |
| "flag" | |
| "os" | |
| "strings" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function diario { | |
| DATESTR=$(date +%d%m%Y) | |
| FILENAME="/Users/maesoser/diario/entry_$DATESTR.txt" | |
| if [[ -f "$FILENAME" ]]; then | |
| nano $FILENAME | |
| else | |
| touch $FILENAME | |
| echo -e "------------------------------------------------\n" >> $FILENAME | |
| echo " Entrada $(date '+%A %d-%B, %Y')" >> $FILENAME | |
| echo -e "\n------------------------------------------------\n" >> $FILENAME |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Adafruit_NeoPixel.h> | |
| #include <ESP8266WiFi.h> | |
| #include <ESP8266WebServer.h> | |
| #include <Wire.h> | |
| #include <Adafruit_Sensor.h> | |
| #include <Adafruit_BME280.h> | |
| #include <ESP8266mDNS.h> | |
| #include <ArduinoJson.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Sergio Maeso Jimenez | |
| * semaesoj@it.uc3m.es | |
| * 03.08.2016 | |
| * | |
| * coap code which simulates a temperature sensor | |
| * based on https://github.com/nikosft/libcoap/blob/master/piggybacked/server.c | |
| * | |
| *. gcc -Wall -I /usr/local/include/coap -L /usr/local/lib termo.c -o termo -lcoap-1 -DWITH_POSIX | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "bufio" | |
| "fmt" | |
| "io" | |
| "net" | |
| "os" | |
| "strings" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pysnmp import hlapi | |
| import argparse | |
| def construct_object_types(list_of_oids): | |
| object_types = [] | |
| for oid in list_of_oids: | |
| object_types.append(hlapi.ObjectType(hlapi.ObjectIdentity(oid))) | |
| return object_types | |
| def construct_value_pairs(list_of_pairs): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| function myecho() { | |
| mytime=$( date -u +"%y-%m-%dT%H:%M:%SZ" ) | |
| echo "$mytime $1" |tee -a $logpath | |
| } | |
| target="8.8.8.8" | |
| size="1" | |
| interval="1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| do_ping () { | |
| local EXPORT_FILE="/tmp/ping_$1.prom" | |
| local OUT=$(ping -nq -c $2 $1) | |
| local ICMP_SENT=$(echo "$OUT" | grep "packets" | awk '{print $1}') | |
| local ICMP_RECV=$(echo "$OUT" | grep "packets" | awk '{print $4}') | |
| local ICMP_MIN=$(echo "$OUT" | grep "avg" | awk '{print $4}' | cut -d/ -f1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| EXPORT_FILE="/tmp/pihole.prom" | |
| OUT=$(curl -s http://127.0.0.1/admin/api.php?summaryRaw | sed -e 's/\"//g') | |
| DNS_DOMAINS_BEING_BLOCKED=$(echo "$OUT" | cut -d, -f1 | cut -d: -f2) | |
| DNS_TOTAL=$(echo "$OUT" | cut -d, -f2 | cut -d: -f2) | |
| DNS_BLOCKED=$(echo "$OUT" | cut -d, -f3 | cut -d: -f2) | |
| DNS_ADS_PCNT=$(echo "$OUT" | cut -d, -f4 | cut -d: -f2) |