https://drive.google.com/file/d/1hBpWBO5H0-vHBZdiXpRDzEZRPYJk1j9I/view?usp=drivesdk
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
import requests | |
from bs4 import BeautifulSoup | |
import os | |
from PyPDF2 import PdfReader, PdfWriter | |
from rich.progress import track | |
def merge_pdfs(folder_path, output_filename): | |
pdf_writer = PdfWriter() | |
pdfs = [item for item in os.listdir(folder_path) if item.endswith('.pdf')] | |
for item in track(pdfs, description="Merging..."): |
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
delete from wkf_workitem where id in (select min(wkd.id) from wkf_workitem wkd where wkd.inst_id in (select | |
inst_id | |
from | |
wkf_workitem wki | |
JOIN wkf_instance ins ON ins.id = wki.inst_id | |
group by | |
inst_id, ins.res_id, ins.res_type, ins.uid | |
having | |
count(*) > 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
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
%matplotlib inline | |
df = pd.read_excel('/home/ecarreras/Desktop/l.xls') | |
table = pd.pivot_table( | |
df, index=['empresa', 'producto'], values=['price_subtotal'], aggfunc=[np.sum], fill_value=0 | |
) | |
table_tots = table.groupby(level='empresa').sum() |
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 PyQt4.QtGui import QApplication, QMainWindow, QDialog, QHBoxLayout | |
from PyQt4.QtCore import SIGNAL | |
from Koo.Rpc import Rpc | |
from Koo.Common import Api | |
from Koo.Common import Localization | |
Localization.initializeTranslations() | |
from Koo.Dialogs import WindowService | |
x = Rpc.session.login('http://admin:admin@localhost:8069', 'test_1522167327') |
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 redis import StrictRedis | |
from rq.job import Job | |
from rq import push_connection, get_failed_queue | |
from collections import Counter | |
from tqdm import tqdm | |
stats = {'queue': Counter(), 'status': Counter()} | |
conn = StrictRedis.from_url() | |
push_connection(conn) |
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 flask import Flask, request | |
import time | |
app = Flask(__name__) | |
@app.route('/ARequest', methods=['POST']) | |
def arquest(): | |
print "Writing a post!" | |
with open('post-{}'.format(time.time()), 'w') as f: |
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
#!/bin/bash | |
if [ "x$VIRTUAL_ENV" == "x" ]; then | |
echo "Se debe activar el entorno virtual" | |
else | |
for lib in cairo gi glib gobject gtk-2.0 pygtk.pth pygtk.py; do | |
echo "Linking $lib..."; | |
ln -s /usr/lib/python2.7/dist-packages/$lib $VIRTUAL_ENV/lib/python2.7/site-packages/$lib; | |
done | |
fi |
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 babel.messages import catalog, pofile | |
SPLITS = 10 | |
catalogs = [catalog.Catalog(locale='es_ES') for _ in range(0, SPLITS)] | |
with open('locales/es_ES/LC_MESSAGES/messages.po', 'r') as f: | |
po = pofile.read_po(f) | |
untranslated = [s.id for s in po if not s.string] | |
for idx, string in enumerate(untranslated): | |
c_idx = idx % SPLITS |
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 datetime import datetime | |
import calendar | |
def canvi_hora(year, month): | |
for d in range(calendar.monthrange(year, month)[1], 1, -1): | |
if datetime(year, month, d).weekday() == calendar.SUNDAY: | |
return d | |
def get_canvis_hora(year): |
NewerOlder