Skip to content

Instantly share code, notes, and snippets.

View maesoser's full-sized avatar
:shipit:

Sergio maesoser

:shipit:
View GitHub Profile
@maesoser
maesoser / dsync
Created February 29, 2016 09:09
Dropbox script to start your dropbox, sync your folders and close the dropbox client.
dropbox start
output=$(dropbox status)
while [ "$output" != "Actualizado" ]; do
echo "$output"
sleep 2
output=$(dropbox status)
done
echo "$output"
dropbox autostart n
dropbox stop
@maesoser
maesoser / getAirQuality.py
Created November 4, 2016 09:36
Tiny script to get the Air quality measurements from the sensors deployed on Madrid.
import json
import requests
class Station:
name = ""
uid = 0
lat = ""
lon = ""
quality = ""
@maesoser
maesoser / fss.py
Created February 19, 2017 18:48
Find files that could contain interesting information to perform a forensic analysis
import sys
import re
class Rule:
def __init__(self, line):
line = line.split(",")
self.part = line[0]
self.application = line[1].replace(" ","")
self.pattern = line[2].replace(" ","")
self.title = line[3]
@maesoser
maesoser / bccanvas.pde
Created November 3, 2017 22:23
Processing script which paints a sql database containing bitcoin transactions.
class Transaction{
String addr;
double amount;
String timestamp;
Transaction(String addr, double amount,String ts){
this.addr = addr;
this.amount = amount;
this.timestamp = ts;
}
@maesoser
maesoser / gmailAutoarchive .gs
Last active October 16, 2018 14:31
Auto archive old threads that have not unreaded emails
/*
Este script mantiene limpia mi bandeja de entrada, archivando correos antiguos
*/
function gmailAutoArchive() {
gmailAutoarchiveHelper("Informes",3);
gmailAutoarchiveHelper("Sistemas",3);
gmailAutoarchiveHelper("Diseños",3);
gmailAutoarchiveHelper("inbox",7);
}
@maesoser
maesoser / randomize-mac-addresses
Last active October 9, 2018 08:47
Configure every saved WiFi connection in NetworkManager with a spoofed MAC # address, seeded from the UUID of the connection and the date
#!/bin/sh
# /etc/NetworkManager/dispatcher.d/pre-up.d/randomize-mac-addresses
# Configure every saved WiFi connection in NetworkManager with a spoofed MAC
# address, seeded from the UUID of the connection and the date plus the hour eg:
# 'c31bbcc4-d6ad-11e7-9a5a-e7e1491a7e20-2017-11-20-09'
# This makes your MAC difficult to track across WiFi providers, and
# for one provider to track across days.
@maesoser
maesoser / far-scp.fish
Created October 16, 2018 13:59
far-ssh and far-scp, when you need to access or copy files through a server acting as a proxy.
function far-scp
if count $argv > /dev/null
echo Connecting through $argv[1]
echo Source: $argv[2]
echo Dest: $argv[3]
scp -oProxyJump=$argv[1] $argv[2] $argv[3]
else
echo " usage: far-scp [proxy-addr] [src] [dst]"
end
end
@maesoser
maesoser / doorwatch.go
Created November 10, 2018 01:09
Door sensor code, both server and client.
package main
import (
"encoding/json"
"fmt"
tb "gopkg.in/tucnak/telebot.v2"
"io/ioutil"
"log"
"math/rand"
"net"
@maesoser
maesoser / ssh_alias.sh
Last active May 27, 2019 14:29
Now it's recommended to use .ssh/config file instead of the old alias approach, but that does not mean that you've to loss the benefits of the aliases like autocompletion.
# copy this code to .bashrc
# This loop generates aliases for the hosts you've configured on ./ssh/config.
for x in $(grep '^Host' ~/.ssh/*config 2>/dev/null | grep -v '[?*]' | cut -d ' ' -f 2-); do
alias "$x"="ssh $x"
done
@maesoser
maesoser / pscheck.sh
Created January 4, 2019 08:40
Quick and dirty process monitor, something like Monit
#!/usr/bin/env bash
FAIL='\033[0;31m'
OK='\033[0;32m'
END='\033[0m' # No Color
declare -a arr=("rsyslogd" "crond" "noelement")
## now loop through the above array
for i in "${arr[@]}"