Skip to content

Instantly share code, notes, and snippets.

View pigeonflight's full-sized avatar

David Bain pigeonflight

View GitHub Profile
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 September 13, 2019 18:47
Installing Java8 on Mac with Homebrew

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 August 31, 2019 20:41
When working with postgresql on local machine, you don't need a password

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 July 20, 2019 22:57
example themefragment for Plone collective.themefragments (iteration over folder of images using @@contentlisting)
<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 July 11, 2019 12:55
AWS CLI simple cluster management scripts

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 March 5, 2019 12:19
Plone: convert one content type with leadimage to another content type

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 February 9, 2019 13:32
Hover Menu Fix for Mobile Devices - disable menu hover on touch devices (Vanilla JS implementation)

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 April 22, 2021 05:40
Python script to remove unused images from a web project folder, works for webflow projects but should work in other circumstances as well

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

@pigeonflight
pigeonflight / apublickey.pub
Created November 3, 2018 14:06
A public key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQ7QPiOKscb1NtO7XUSg8YqyboQqMGoMYK61Gc4wHFsAZmiUhE+t5P2J38iFcfUaorbuAC3irtsaCOPKLRHumBHmW0aY0HdzoJQ43pzKyjmUVsgtmy2F/xU8Al4nRQ2Yp2EmAqS9YOcdrFLIDkUtP4zQ7qaziEe5TVQrd/r4ISSZr33xiIAgCQacUUSR7B2oeoISAnfPqMy/211Sjo8Y26gHY7RVfkOnyGfxaxCsgIC3hQHjD3cnIvreIYJLwIV8QBYm+tMeNXOxQ3PjFOlQmLAT910U1tX0xInUr+Sau4gYmpFH7ZGZV9sfyHE8d4hy0c2W9WZpXLaGt/gLZDn+nh root@Debian-60-squeeze-64-minimal
@pigeonflight
pigeonflight / readme.md
Last active July 1, 2018 02:44 — forked from jdjuan/ngcolombia-speaker.md
WebCraftConf Speaker Guidelines

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: