Skip to content

Instantly share code, notes, and snippets.

David Bain pigeonflight

Block or report user

Report or block pigeonflight

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pigeonflight
pigeonflight / README.md
Last active Jul 11, 2019
AWS CLI simple cluster management scripts
View README.md

Installation

Download these scripts.

wget https://gist.github.com/pigeonflight/ebdae7cb1835608598205ae2c503729b/archive/cdca2598c2a664c765dc08f8befd14890b872289.zip

Setup

You will need to install awscli and jq and setup aws your credentials

sudo apt-get install jq
pip3 install awscli --user
@pigeonflight
pigeonflight / README.md
Last active Mar 5, 2019
Plone: convert one content type with leadimage to another content type
View README.md

In this example we have a Folder which has lead image behaviour applied to it. We want a special folderish type called category to replace the folders in a specific location of the site.

This script is invoked with the zope controller for your Zope/Plone site.

   bin/instance -OPlone run {scriptname}

or in your site is not at the root of your Zope application server then the full path to the site

  bin/instance -O'full/path/to/plone' run {scriptname}
@pigeonflight
pigeonflight / README.md
Last active Feb 9, 2019
Hover Menu Fix for Mobile Devices - disable menu hover on touch devices (Vanilla JS implementation)
View README.md

I wanted a solution that was implemented in vanilla js and disabled hovers on the mobile devices. You will need to change the selector to match that of the target you have in mind.

@pigeonflight
pigeonflight / README.md
Last active Nov 13, 2018
Python script to remove unused images from a web project folder, works for webflow projects but should work in other circumstances as well
View README.md

Background

This is a horribly ugly (and lazy) implementation. The goal is to remove images that are not referenced by either the css or html files of a web project.

Additionally it converts large png files (Large png is bigger than 250000 bytes) into jpg files since these are most often photographs. It then goes into each file and replaces the reference to the png with the reference to the jpg file. Finally, it removes the old png files to reduce the overall site folder size. It also skips externally stored images.

The script includes a 'sed-like' function based on something found at stackoverflow (https://stackoverflow.com/questions/12714415/python-equivalent-to-sed/40843600#40843600)

Assumption

View apublickey.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQ7QPiOKscb1NtO7XUSg8YqyboQqMGoMYK61Gc4wHFsAZmiUhE+t5P2J38iFcfUaorbuAC3irtsaCOPKLRHumBHmW0aY0HdzoJQ43pzKyjmUVsgtmy2F/xU8Al4nRQ2Yp2EmAqS9YOcdrFLIDkUtP4zQ7qaziEe5TVQrd/r4ISSZr33xiIAgCQacUUSR7B2oeoISAnfPqMy/211Sjo8Y26gHY7RVfkOnyGfxaxCsgIC3hQHjD3cnIvreIYJLwIV8QBYm+tMeNXOxQ3PjFOlQmLAT910U1tX0xInUr+Sau4gYmpFH7ZGZV9sfyHE8d4hy0c2W9WZpXLaGt/gLZDn+nh root@Debian-60-squeeze-64-minimal
@pigeonflight
pigeonflight / readme.md
Last active Jul 1, 2018 — forked from jdjuan/ngcolombia-speaker.md
WebCraftConf Speaker Guidelines
View readme.md

WebCraftConf Speaker Guidelines

Forked from https://gist.github.com/jdjuan/9201987241225d4eabd0c955df217280

We wish all our talks to be "fire" 🔥. We're confident that you know what you're talking about and have spent lots of time researching. We don't want anything to distract from you shining on the day. Here are our guidelines to help you get there! Read them carefully:

1. Accessibility

First, we want everyone to be able to enjoy your talk fully:

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

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 Jun 4, 2018
Programmatically set the theme for your plone site using this commandline utility
View setTheme.py
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
Install Python 2.7.14 on Ubuntu 14.04
View install-python-2.7.14.sh
# 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 Feb 15, 2018
Use this Plone commandline script to learn more about working with images in Plone
View learn_about_images.py
################################
#
# 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 "
#
##################################################
You can’t perform that action at this time.