Skip to content

Instantly share code, notes, and snippets.

View pigeonflight's full-sized avatar

David Bain pigeonflight

View GitHub Profile
@pigeonflight
pigeonflight / README.md
Last active June 13, 2018 17:44
plu: Plone ulility, a little experimental wrapper, written in bash for managing theme uploads through an ssh tunnel

Currently this only provides plu-up, a small utility, written in bash, for managing the upload of themes to a Plone site. It depends on plonetheme-upload. The goal is to make it as easy as possible to update a theme on a plone site from the commandline.

Using the prefix "plu-", provides a short, and hopefully inituitive, namespace for "plone command-line utilties". I hope that the plu- namespace can be used for other utilities. This could also be thought of as a proving ground. If a plu- utility makes sense, we'd try to eventually roll it into the plone-cli project.

I needed to integrate some ssh-tunnelling "magic" (documented here: https://stackoverflow.com/questions/2241063/bash-script-to-setup-a-temporary-ssh-tunnel). Hopefully this is useful to others.

Installation

Install the dependency (we assume you know how to work with npm):

@pigeonflight
pigeonflight / setTheme.py
Last active June 4, 2018 12:48
Programmatically set the theme for your plone site using this commandline utility
import os
import sys
import transaction
from plone import api
from zope.component.hooks import setSite
"""
This is a very simple approach which uses positional arguments passed to a script
the first argument is the id of your plone site.
the second argument is the name of your theme
@pigeonflight
pigeonflight / install-python-2.7.14.sh
Created May 22, 2018 11:19
Install Python 2.7.14 on Ubuntu 14.04
# usage
# bash install-python-2.7.14.sh
sudo apt-get update
sudo apt-get install build-essential checkinstall -y
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev -y
cd /usr/src
sudo wget https://www.python.org/ftp/python/2.7.14/Python-2.7.14.tgz
sudo tar xzf Python-2.7.14.tgz
cd Python-2.7.14
sudo ./configure --enable-optimizations
@pigeonflight
pigeonflight / learn_about_images.py
Created February 15, 2018 12:31
Use this Plone commandline script to learn more about working with images in Plone
################################
#
# run this script using
# bin/instance -OPlone run {scriptname}
# assumptions:
# we assume that you have a working zope server with an instance
# of plone located at the root named "Plone"
# we also assume that you have an image named "
#
##################################################
@pigeonflight
pigeonflight / errors
Created January 9, 2018 14:14
errors from dev.verbol.com
jquery-1.7.2.min.js:4 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
send @ jquery-1.7.2.min.js:4
VerbolLogger.js:287 09:10:42.120: VerbolEvents [VerbolEvents.js:425] Connecting to server at //dev2.verbol.com:7443/http-bind/
VerbolLogger.js:287 09:10:42.125: VerbolEvents [VerbolEvents.js:450] Connecting to server (3 retries left)
play-pause.png Failed to load resource: net::ERR_NAME_NOT_RESOLVED
Join-In.png Failed to load resource: net::ERR_NAME_NOT_RESOLVED
:7443/http-bind/ Failed to load resource: net::ERR_CONNECTION_REFUSED
VerbolLogger.js:287 09:10:42.404: Strophe [VerbolEvents.js:409] request id 1.1 error 0 happened
VerbolLogger.log @ VerbolLogger.js:287
VerbolLogger.js:287 09:10:42.404: Strophe [VerbolEvents.js:409] request errored, status: 0, number of errors: 1
@pigeonflight
pigeonflight / README.md
Created December 22, 2017 00:30
Variation of getssl script which installs a certificate for openfire (works for me, way too many assumptions)

This script is a tiny fork of https://github.com/srvrco/getssl It works in conjunction with a script called install-openfire-cert also shipped with this distribution It adds a bit of code at line 2168 which will trigger the installation of a certificate for openfire.

Assumptions

  • There is a script called install-openfire-cert located at /root/getssl
  • The openfire security folder is located at /opt/openfire/resources/security/

The servername to be used is stored in an environment variable $SERVERNAME The storepass ($STOREPASS) is a special variable used to set a password for the certificate associated with openfire

@pigeonflight
pigeonflight / README.md
Last active November 29, 2017 12:47
Fullwidth for plone.app.mosaic

This assumes that you're using collective.themesitesetup. I don't recommend that you use this fullwidth implementation on pages where side portlets are enabled, it tends to look "wonky".

  • Include the fullwidth-for-mosaic.less file with your theme, it needs to be included as part of one of the files that gets compiled to css.
  • Create a folder in your theme and name it install then place the registry.xml in the install folder.
  • Add the line below to your manifest.cfg file
[theme:genericsetup]
install = install
@pigeonflight
pigeonflight / README.md
Last active November 20, 2017 13:05
Plone Mosaic Full Width Grid Registry entry

With collective.themesitesetup

Use with collective.themesitesetup and place in a folder of your theme called "install" The contents of custom.css is needed to ensure that the fullwidth works as expected.

Import directly with Plone 5.1.x or higher

With Plone 5.1.x you can import the registry.xml file directly at {yoursite}/portal_registry

@pigeonflight
pigeonflight / video-placeholder.svg
Created November 20, 2017 12:36
Video Tile Fragment for Plone, Mosaic + Theme Fragments
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pigeonflight
pigeonflight / cleanup-querystrings.py
Created October 22, 2017 10:39
remove query strings on static resources downloaded with wget
"""
Often after performing a wget -p -k http://example.com
The resulting files will include static resources with query strings appended.
For example:
wp-content/themes/salient/css/fonts/fontawesome-webfont.woff?v=4.2
etc..
This script strips away the query strings so that you can serve the site statically.
This is the first step in porting a theme from another CMS to a Diazo based Plone theme
"""
import os