Skip to content

Instantly share code, notes, and snippets.

View zupo's full-sized avatar

Neyts Zupan zupo

View GitHub Profile
"""Showcasing Pyramid's Function Decorators.
Usage:
1. Install Pyramid: http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/install.html
2. Put this code into example.py
3. Run with ``$VENV/bin/python example.py``.
You can showcase with your browser or using curl:
$ curl http://localhost:8080/
"""Showcasing Pyramid's View Predicates.
Usage:
1. Install Pyramid: http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/install.html
2. Put this code into ``example.py``.
3. Run with ``$VENV/bin/python example.py``.
4. Showcase with your browser or using curl:
$ curl http://localhost:8080/
Welcome!
"""Showcasing Pyramid's Renderers.
Usage:
1. Install Pyramid: http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/install.html
2. Put this code into example.py
3. Run with ``$VENV/bin/python example.py``.
You can showcase with your browser or using curl:
$ curl http://localhost:8080/
@zupo
zupo / modifieds.py
Created March 8, 2017 07:50
Migrate modified timestamps between Plone instances
# Run the following inside bin/instance debug to get list of paths + dates
# print ''.join(['{}|{}\n'.format(b.getURL(), b.modified)
# for b in app.office.portal_catalog.unrestrictedSearchResults()])
# Put the list in the MODIFIEDS variable below. Then run the script inside
# bin/instance debug on new server
MODIFIEDS = [
'events',
'news',
<form method="POST" action="http://formspree.io/[email protected]">
<textarea name="message" placeholder="Your message"></textarea>
<button type="submit">Send</button>
</form>
@zupo
zupo / export.py
Last active April 21, 2019 06:06
Export Plone site into a directory tree of PDFs.
# spin up a local instance
# portal_workflows, allow everything for Anonymous, click update portal security
# bin/instance debug
# >>> for brain in app.Plone.portal_catalog():
# >>> print brain.getURL().split('http://nohost/Plone/')[1]
# Paste paths into paths.txt
# More info on https://blog.niteo.co/export-plone-to-pdfs/
from subprocess import check_output
import os.path
@zupo
zupo / Readme.md
Last active May 29, 2019 14:08
5 hacks to improve your code in 5 minutes
@zupo
zupo / ib_to_edavki.py
Last active April 7, 2023 14:50
Prepare Interactive Brokers report for entry into edavki.furs.si
### THIS IS DEPRECATED ###
# Use https://github.com/jamsix/ib-edavki instead
from collections import OrderedDict
from dataclasses import dataclass
from dataclasses import field
from decimal import Decimal
import xml.etree.ElementTree as ET
from datetime import date
from datetime import datetime
7e9b0dff974c89e070da1ad85713ff3c20b0ca97 1622410071 1622503301
# Python 3.10
from enum import Enum
class Direction(Enum):
up = "up"
down = "donw"
assert "up" == Direction.up.value
# Python 3.11