Skip to content

Instantly share code, notes, and snippets.

View wtfcarlos's full-sized avatar
🍀
Fortunatissimo per verità

Carlos Rey wtfcarlos

🍀
Fortunatissimo per verità
View GitHub Profile
@wtfcarlos
wtfcarlos / compress.py
Created September 22, 2023 23:04
Carlos PDF Compressor
import PyPDF2
def compress_pdf(input_path, output_path):
with open(input_path, 'rb') as input_pdf:
reader = PyPDF2.PdfReader(input_pdf)
writer = PyPDF2.PdfWriter()
for page_num in range(len(reader.pages)):
page = reader.pages[page_num]
writer.add_page(page)
nums_1_19_1 = [
None,
"One",
"Two",
"Three",
"Four",
"Five",
"Six",
"Seven",
"Eight",
@wtfcarlos
wtfcarlos / food.md
Last active August 19, 2019 13:24
Places to Eat in Mexico City

Places to eat in Mexico City

We eat lunch late, around 2 to 3pm General rule is that most street places that have a lot of people around them are good, so dont be afraid to experiment.

Condesa

Tacos

  • El Tizoncito ($$)
  • El Califa ($$)
{
"ResultCode":"Success",
"DocCode":"INV001",
"DocDate":"2015-07-15",
"Timestamp":"2015-07-22T22:59:22.4794018Z",
"TotalAmount":"195",
"TotalDiscount":"0",
"TotalExemption":"0",
"TotalTaxable":"195",
"TotalTax":"14.63",
#!/usr/local/bin/python
from __future__ import unicode_literals, with_statement
import sys
import os
import json
from datetime import datetime, timedelta
ZERO_STATE = {
'last_downloaded_month': None,
@wtfcarlos
wtfcarlos / 3.5.py
Created April 8, 2015 21:01
MyQueueClass Python
#!/usr/bin/python
# 3.5 implement a MyQueueClass using two stacks.
class MyQueueClass(object):
def __init__(self):
self.s1 = []
self.s2 = []
self.current_stack = self.s1
(fn [d ks] (loop [result {}, remaining ks, default d]
(if (not (empty? remaining))
(recur (conj result {(first remaining) default})
(rest remaining)
d)
result)))
@wtfcarlos
wtfcarlos / myvcs.py
Created April 4, 2015 01:40
Simple VCS Implementation (Incomplete WIP)
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
from __future__ import with_statement
import os
import json
import docopt
from shutil import rmtree, copytree
VCS_DIR_NAME = '.myvcs'
@wtfcarlos
wtfcarlos / helloworld.py
Last active August 29, 2015 14:18
python_intro
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, division
my_things = {
'hello': 34,
'a': True,
'b': 56.874
}
@wtfcarlos
wtfcarlos / dbserver.py
Last active August 29, 2015 14:16
Database Server
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import with_statement
import SocketServer
from BaseHTTPServer import BaseHTTPRequestHandler
from urlparse import parse_qs
from urllib import unquote
import re