Skip to content

Instantly share code, notes, and snippets.

View clementlefevre's full-sized avatar

clementlefevre clementlefevre

View GitHub Profile
import requests
import pandas as pd
from lxml import etree
r = requests.get("https://en.wikipedia.org/wiki/List_of_photovoltaic_power_stations")
main_page = etree.HTML(r.content)
list_title = main_page.xpath('.//table[contains(@class,"wikitable")]/tbody/tr/td/a/text()')
list_geo = main_page.xpath('.//table[contains(@class,"wikitable")]/tbody/tr//span[contains(@class,"geo-dec")]/text()')
zipped_list = list(zip(list_title,list_geo))
df = pd.DataFrame(zipped_list)
df.columns = ["name", "geo_raw"]
# Add Logo
img = openpyxl.drawing.image.Image('logo.jpg')
p2e = pixels_to_EMU
h, w = img.height, img.width
size = XDRPositiveSize2D(p2e(w), p2e(h))
# Set image position on the top right of the Worksheet:
column = 8 # last column index (!!!starts from 0)
row = 0 # first row index (!!!starts from 0)
coloffset = -p2e(w) # we align the image with the right limit of the worksheet
@clementlefevre
clementlefevre / fetch_news.sh
Created April 5, 2018 19:39 — forked from rogeliodh/fetch_news.sh
[Bash] Script to fetch news with calibre
#!/bin/bash
# This is free and unencumbered shell script released into the public domain.
#
####################### Begin Customization Section #############################
#
# Name of the recipe to fetch. You can run:
# ebook-convert --list-recipes
# to look for the correct name. Do not forget the .recipe suffix
RECIPE="La Jornada (Mexico).recipe"
@clementlefevre
clementlefevre / drop_dupes.py
Last active December 25, 2017 15:37
Remove duplicates in folder
#!/usr/bin/python
import sys
import os
import hashlib
import pandas as pd
import pickle
def chunk_reader(fobj, chunk_size=1024):