Skip to content

Instantly share code, notes, and snippets.

View b4oshany's full-sized avatar

Oshane Bailey b4oshany

View GitHub Profile
@b4oshany
b4oshany / Regex.txt
Created January 7, 2017 10:37
Regex to dict
>>> import re
>>> data = """1foo bar
... 2bing baz
... 3spam eggs
... nomatch
... """
>>> pattern = r"(.)(\w+)\s(\w+)"
>>> {x[0]: x[1] for x in (m.group(3, 2) for m in (re.search(pattern, line) for line in data.splitlines()) if m)}
{'baz': 'bing', 'eggs': 'spam', 'bar': 'foo'}
share improve t
@b4oshany
b4oshany / instalGuillotinal.sh
Created October 19, 2017 13:54
Install script for Guillotina
#!/bin/bash
# Adding postgres and python 3 to our package sources
sudo su -c "echo \"deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main 9.6\" > /etc/apt/sources.list.d/postgresql.list"
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo add-apt-repository ppa:jonathonf/python-3.6 -y
sudo apt-get update -y
# Install python 3.6 dependencies
@b4oshany
b4oshany / base.cfg
Last active January 31, 2018 10:14
Plone versions.cfg from Docker
######################################################
# Base Configuration; this provides sane defaults
# for commonly used parts.
# ---------------------------------------------------
#
# Buildout instructions in this file are
# usually only changed by experienced developers.
#
# Beyond here there be dragons!
@b4oshany
b4oshany / install-python.sh
Last active January 20, 2019 22:44
Installing python 2.7 or above
# First, install some dependencies:
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
# Then download using the following command:
version=$1
if [ -z "$1" ]
then
version=2.7.14
fi
@b4oshany
b4oshany / install-plone-dependencies.py
Last active April 16, 2019 12:59
Plone dependencies
curl -s https://gist.githubusercontent.com/b4oshany/ed5cbd74a6ae19571b3d1ca3e4e13e69/raw/777c678360a37db505f974071413f28b9bec60b0/install-python2.7-apt.sh | bash
sudo apt-get update -y
sudo apt-get install python-pip -y
sudo pip install virtualenv
sudo apt-get install python-pil -y
sudo apt install python2.7 python2.7-dev python-setuptools python-dev build-essential libssl-dev libxml2-dev libxslt1-dev libbz2-dev libjpeg62-dev -y
sudo apt install libreadline-dev wv poppler-utils -y
sudo pip install bcrypt
sudo apt-get install libffi-dev -y
sudo apt-get install libpcre3-dev -y
@b4oshany
b4oshany / install-node-bower.sh
Last active May 1, 2018 12:35
Install node js, npm and bower on Ubuntu
#!/bin/bash
sudo apt-get update
if [ -z $(which node) ]; then
# curl -sL https://deb.nodesource.com/setup | bash -
sudo apt-get install -y nodejs
fi
if [ -z $(which npm) ]; then
@b4oshany
b4oshany / accordion.css
Created May 21, 2018 06:05
Accordion static files
/** Accordion styles **/
.accordions {
background: white;
padding: 16px 8px;
}
.accordion {
background-color: white;
color: #444;
cursor: pointer;
@b4oshany
b4oshany / chrome.robot
Created May 26, 2018 02:21
Python Robot Framework with Headless Chrome Setup and Robot Files
*** Keywords ***
Open Chrome
[Arguments] ${url}
${chrome_options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
Call Method ${chrome_options} add_argument --disable-extensions
Call Method ${chrome_options} add_argument --headless
Call Method ${chrome_options} add_argument --disable-gpu
Call Method ${chrome_options} add_argument --no-sandbox
Create Webdriver Chrome chrome_options=${chrome_options}
@b4oshany
b4oshany / mosaic-bootstrap-rules.xml
Created September 4, 2018 20:53
Diazo recipe make the Plone Mosaic editor compatible with Bootstrap CSS grid.
<?xml version="1.0" encoding="UTF-8"?>
<rules
xmlns="http://namespaces.plone.org/diazo"
xmlns:css="http://namespaces.plone.org/diazo/css"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:xi="http://www.w3.org/2001/XInclude">
<!-- Transform Mosaic Grid to Bootstrap Grid -->
<rules css:content="body.mosaic-grid.template-layout">
<replace css:content=".mosaic-grid-row">
@b4oshany
b4oshany / plone.nginx.conf
Created September 9, 2018 18:05
Plone nginx.conf
upstream plone {
server 127.0.0.1:12030;
server 127.0.0.1:12031;
}
server {
server_name <<<Site>>>;
access_log /var/log/nginx/<<<Site>>>.access.log;
error_log /var/log/nginx/<<<Site>>>.error.log;
set $vh_protocol "https";