Skip to content

Instantly share code, notes, and snippets.

View brunifrancesco's full-sized avatar

Francesco Bruni brunifrancesco

  • http://www.planetek.it/
  • Andria, Italy
View GitHub Profile
@brunifrancesco
brunifrancesco / process_html.py
Created January 12, 2016 16:07
Process and parse HTML files to get them complied with the Angular "translate" filter. The scripts create also the final json file which will contain all the needed translations.
#! /usr/bin/env python
"""
Process some HTML files to add translation features.
The script replaces simple strings (avoiding parsing special chars, comments, Angular based variables, HTML entities)
and any other Angular related stuff with the same string followed by the 'translate' filter as stated in
https://angular-translate.github.io/ .
To be translated labels got memorized in the final json file, where translations values will be present.
File by file, processed content is stored in a new file letting the original one intact.
Install required deps
# -*- coding: utf-8 -*-
"""
Get Paris attractions data scraping the BASE_URL site.
Wrap those data into a json structure.
Deps:
- BeautifulSoup
- requests
- fn
@brunifrancesco
brunifrancesco / tms.py
Created April 16, 2019 11:02
Ingest and visualize landsat data
import rasterio
import geopyspark as gps
import numpy as np
import matplotlib
import matplotlib.cm as cm
from pyspark import SparkContext
conf = gps.geopyspark_conf(master="local[*]", appName="ingest-example", )
conf.set(key='spark.kryoserializer.buffer.max', value='256m')
@brunifrancesco
brunifrancesco / modulations.py
Last active November 22, 2020 12:31
Signal and wave modelling
from abc import abstractmethod
from signals_wave import WaveM
class Modulation:
@abstractmethod
def modulate(self, signal_wave: WaveM, carrier_wave: WaveM) -> WaveM:
raise NotImplementedError("You need to implement this method before calling it!")
@abstractmethod