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
View madlibish.py
print("hello world")
# Strings
my_string = "a string is here"
# Lists
my_list = ['2',1,5,"hello"]
# Dictionaries
my_dictionary = {"name":"David",
"age":120}
print(my_dictionary)
@pigeonflight
pigeonflight / Installing Java8 with Brew.md
Created Sep 13, 2019
Installing Java8 on Mac with Homebrew
View Installing Java8 with Brew.md

If you installed java with the Oracle installer, get rid of it:

sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin  
sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefPane  
sudo rm -rf /Library/Application\ Support/Oracle/Java/ 
sudo rm -rf /Library/Java/JavaVirtualMachines 

If you installed java with brew, remove previously brew installed version of java

brew cask uninstall java
@pigeonflight
pigeonflight / setup-postgresql-for-current-user.md
Created Aug 31, 2019
When working with postgresql on local machine, you don't need a password
View setup-postgresql-for-current-user.md

Install postgresql and create a user and database. The trick is to give the database and user the same name as the current user

sudo apt-get install postgresql
sudo su - postgres -c "psql  -c \"create user $USER;\""
sudo su - postgres -c "createdb $USER"

Now as the current user you have your own personal database which doesn't require a password. Great for development.

@pigeonflight
pigeonflight / pic-list.pt
Last active Jul 20, 2019
example themefragment for Plone collective.themefragments (iteration over folder of images using @@contentlisting)
View pic-list.pt
<div class="wrapper" tal:define="portal context/@@plone_portal_state/portal; image_scale portal/@@image_scale">
<tal:block tal:repeat="item context/@@contentlisting">
<tal:block tal:define="url item/getURL; portal_type item/portal_type">
<a href="${url}" tal:condition="python:portal_type == 'Image'" class="item-${item/portal_type}">
<img src="${url}/@@images/image/large" />
<p tal:content="item/title" class="title">1st item</p>
</a>
</tal:block>
</tal:block>
</div>
@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:

You can’t perform that action at this time.