Skip to content

Instantly share code, notes, and snippets.

View mpampols's full-sized avatar

Marc Pàmpols mpampols

View GitHub Profile
<script>
window.CookieConsent.init({
modalMainTextMoreLink: null,
barTimeout: 1000,
theme: {
barColor: "#ea3546",
barTextColor: "#FFF",
barMainButtonColor: "#FFF",
barMainButtonTextColor: "#ea3546",
modalMainButtonColor: "#ea3546",
@mpampols
mpampols / download_docx.py
Created May 3, 2020 22:06
download_docx.py
# Save document to memory and download to the user's browser
document_data = io.BytesIO()
document.save(document_data)
document_data.seek(0)
response = HttpResponse(
document_data.getvalue(),
content_type="application/vnd.openxmlformats-officedocument.wordprocessingml.document",
)
response["Content-Disposition"] = 'attachment; filename = "Carta de Presentación.docx"'
@mpampols
mpampols / views.py
Created May 3, 2020 22:03
views.py
def coverletter_export(request):
document = Document()
# Get the user's fullname
if request.user.get_full_name():
document_data_full_name = request.user.get_full_name()
else:
document_data_full_name = "[NOMBRE] [APELLIDOS]"
# Print the user's name
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Wed Apr 01 10:38:40 +0000 2020 ullsverds
Wed Apr 01 10:33:13 +0000 2020 cuacat
Wed Apr 01 10:31:46 +0000 2020 Eloierc
Wed Apr 01 10:29:06 +0000 2020 Azo0ka
Wed Apr 01 10:19:00 +0000 2020 Anna83_
Wed Apr 01 10:02:30 +0000 2020 pedrobelio
Wed Apr 01 10:02:05 +0000 2020 arnau_vilar
Wed Apr 01 10:01:02 +0000 2020 Jcorominasvidal
Wed Apr 01 09:53:30 +0000 2020 eloi_gp
Wed Apr 01 09:53:15 +0000 2020 Kilauea22
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
created_at user__name user__screen_name
Wed Apr 01 10:38:40 +0000 2020 pàjara a la parra ❤ ullsverds
Wed Apr 01 10:33:13 +0000 2020 David ||*|| DUI cuacat
Wed Apr 01 10:31:46 +0000 2020 Eloi Eloierc
Wed Apr 01 10:29:06 +0000 2020 ||*|| 🎗️ Andrea Sediciosa ⚧ 🏳️‍🌈 Azo0ka
Wed Apr 01 10:19:00 +0000 2020 Anna Candela Anna83_
Wed Apr 01 10:02:30 +0000 2020 Pedro pedrobelio
Wed Apr 01 10:02:05 +0000 2020 Arnau González Vilar arnau_vilar
Wed Apr 01 10:01:02 +0000 2020 Joan Corominas Vidal Jcorominasvidal
Wed Apr 01 09:53:30 +0000 2020 eloi eloi_gp
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tu_app.settings.local')
try:
from django.core.management import execute_from_command_line
@mpampols
mpampols / hackeps-2017-challenge-4.py
Created November 19, 2017 21:29
Solución al reto 4 de la Semic Challenge del grupo "josep_pon" en la HackEPS 2017
import heapq
import fileinput
class Node:
def __init__(self, state, parent=None, action=None, cost=0):
self.state = state
self.parent = parent
self.action = action
@mpampols
mpampols / hackeps-2017-challenge-3.cpp
Created November 19, 2017 21:27
Solución al reto 3 de la Semic Challenge del grupo "atsuky" en la HackEPS 2017
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
using namespace std;
struct lletra {
int x, y, cops;
char digit;
@mpampols
mpampols / hackeps-2017-challenge-2.cpp
Created November 19, 2017 21:17
Solución al reto 2 de la Semic Challenge del grupo "josep_pon" en la HackEPS 2017
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
#include <gmp.h>
using namespace std;
void print_nums(unsigned int a1, unsigned int b1, int contador)
@mpampols
mpampols / hackeps-2017-challenge-1.cpp
Created November 19, 2017 21:14
Solución del grupo "josep_pon" de la Semic Challenge de la HackEPS 2017
#include <algorithm>
#include <iostream>
#include <fstream>
#include <string>
const unsigned MAX_NUM = 1000000;
const unsigned char NOT_KNOWN = 0;
const unsigned char KNOWN_GOOD = 1;
const unsigned char KNOWN_BAD = 2;