Skip to content

Instantly share code, notes, and snippets.

View AlessandroVaccarino's full-sized avatar

Alessandro Vaccarino AlessandroVaccarino

View GitHub Profile
@AlessandroVaccarino
AlessandroVaccarino / loom_downloader.py
Created June 28, 2024 07:14
Simple Python scripts that, starting from a Loom video link, downloads it locally
#!/usr/bin/python3
import requests
url="https://www.loom.com/share/..."
def extract_id_from_url(url):
urlRet = url.split("/")[-1]
if '?' in urlRet:
urlRet = urlRet.split("?")[0]
@AlessandroVaccarino
AlessandroVaccarino / sede_queryCleaner.py
Created November 2, 2022 13:27
Stack Exchange Data Explorer query (1664532) output cleaner for Tags Taxonomy
#Original Stack query:
#https://data.stackexchange.com/stackoverflow/query/1664532/tags-taxonomy
import pandas as pd
import csv
dataset = pd.read_csv('<Path>/QueryResults.csv', sep=',',quoting=csv.QUOTE_ALL)
dedup_dataset = dataset.drop_duplicates()
dedup_dataset.drop('WikiBody', axis=1, inplace=True)
dedup_dataset['ExcerptBody'] = dedup_dataset['ExcerptBody'].replace(r'\s+|\\n', ' ', regex=True)
@AlessandroVaccarino
AlessandroVaccarino / docker_apachesuperset.sh
Created July 17, 2022 10:02
A simple shell to run Apache Superset docker container
#!/bin/bash
# Ref: https://hub.docker.com/r/apache/superset
docker run -d -p 8080:8088 --name superset apache/superset
docker exec -it superset superset fab create-admin \
--username admin \
--firstname Superset \
--lastname Admin \
--email [email protected] \
@AlessandroVaccarino
AlessandroVaccarino / slideshare_downloader.py
Created June 13, 2020 21:37
A simple script to download SlideShare slides (as images)
import requests
import scrapy
import os.path
presentationLink = '...'
presentationId = presentationLink.split("/")[-1]
userAgent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36'
presentationResponse = requests.get(presentationLink, headers = {'User-agent': userAgent})
@AlessandroVaccarino
AlessandroVaccarino / airprint_rpi_setup.sh
Created March 19, 2020 09:45
A script that installs and configures AirPrint on a Raspberry PI. Tested on Raspbian
# System setup
sudo apt-get update
sudo apt-get -y upgrade
# Software setup
sudo apt-get -y install cups
sudo apt-get -y install python-cups
sudo apt-get -y install avahi-daemon
sudo apt-get -y install system-config-printer
# Software configuration
sudo usermod -aG lpadmin $USER
@AlessandroVaccarino
AlessandroVaccarino / AmazonDashButton_monitoring.py
Created July 30, 2019 21:25
Fast Python code, aimed to detect Amazon Dush button pressings. Please note: needs to be run as root
from scapy.layers.dhcp import DHCP
from scapy.layers.l2 import Ether
from scapy.sendrecv import sniff
MAC_ADDRESS_BTN1 = "xx:xx:xx:xx:xx:xx"
def detect_button(pkt):
if pkt.haslayer(DHCP):
if pkt[Ether].src.upper() == MAC_ADDRESS_BTN1.upper():
print("Plasmon button pressed! What to do, now?")
@AlessandroVaccarino
AlessandroVaccarino / MongoEnterprise_install_ubuntu.sh
Created May 9, 2019 13:24
A simple shell to install the last version of Ubuntu Enterprise on Ubuntu
# Install MongoDB Enterprise on Ubuntu
# https://docs.mongodb.com/manual/tutorial/install-mongodb-enterprise-on-ubuntu/#install-mongodb-enterprise-on-ubuntu
# Specify MongoDB version (leave blank for latest version)
export MONGODB_VERSION=""
# Get OS Version
. /etc/os-release
echo "----> $PRETTY_NAME ($ID - $VERSION)"
@AlessandroVaccarino
AlessandroVaccarino / docker_jupyter.sh
Created December 13, 2018 09:37
A simple shell to run Jupyter datascience notebook docker image
docker run \
--detach \
--restart always \
--publish 8888:8888 \
--volume=/srv/jupyter:/home/jovyan/work \
--env=GEN_CERT=yes \
--env=JUPYTER_ENABLE_LAB=yes \
--name jupyter \
jupyter/datascience-notebook start-notebook.sh
@AlessandroVaccarino
AlessandroVaccarino / docker_neo4j.sh
Last active March 19, 2019 08:26
A simple shell to run Neo4j docker image
docker create \
--restart always \
--publish=7473:7473 \
--publish=7474:7474 \
--publish=7687:7687 \
--volume=/srv/neo4j/data:/data \
--volume=/srv/neo4j/logs:/logs \
--volume=/srv/neo4j/conf:/var/lib/neo4j/conf \
--env=NEO4J_AUTH=none \
--env=NEO4J_dbms_memory_pagecache_size=8G \
@AlessandroVaccarino
AlessandroVaccarino / docker_elastickibanastack.sh
Last active March 28, 2021 09:27
A simple shell to run ElasticSearch and Kibana docker images
#!/bin/bash
#Some variables
ELASTICSEARCH_VERSION="6.5.3"
KIBANA_VERSION="6.5.3"
ELASTICSEARCH_PWD="secret"
#Define a "wait for service" function
WaitForService () {
while (true);