Skip to content

Instantly share code, notes, and snippets.

@thet
thet / fix_image_scales.py
Created December 8, 2015 12:35
fix image scales from archetypes scales to dx scales, old scale names to new scale names
# -*- coding: utf-8 -*-
from Products.CMFCore.utils import getToolByName
from plone.app.textfield.value import RichTextValue
from zope.component.hooks import getSite
import logging
log = logging.getLogger(__name__)
@mauritsvanrees
mauritsvanrees / grabversions.py
Last active November 13, 2015 20:18
Grab version files from dist.plone.org for each Plone version.
"""Grab version files from dist.plone.org for each Plone version.
Original location:
https://gist.github.com/mauritsvanrees/99cb4a25b622479e7dc3
Goal: grep through these files to see which version of a package is
used in which Plone version.
Usage:
$ virtualenv-2.7 .
@hofmannsven
hofmannsven / README.md
Last active May 18, 2020 13:33
Notes on working with SVG on the web
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*) https://%1$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^mysubdomain\.mysite\.com
RewriteRule ^/(.*)$ http://127.0.0.1:9090/VirtualHostBase/https/%{SERVER_NAME}:%{SERVER_PORT}/subdomain/VirtualHostRoot/$1 [L,P]
@hofmannsven
hofmannsven / README.md
Last active December 8, 2025 16:31
Git CLI Cheatsheet
@eleddy
eleddy / inheritance.py
Created June 26, 2013 04:15
Noisebridge class - add your favorite game
#!/usr/bin/python
class Toy(object):
inventory = 0
def __init__(self, price, name, quantity):
self.price = price
self.name = name
self.quantity = quantity
"""
Use with
bin/instance run export_skin_folder.py
This script will extract the portal_skins folder
named in SKINFODLER_NAME to the DEST directory
"""
import os
import sys
PLONE_PORTAL = 'Plone'
@dwayne
dwayne / 00-install-on-64-bit-ubuntu-14.04.md
Last active January 12, 2024 17:48
Installing node and npm on Ubuntu 12.04 LTS and 64-bit Ubuntu 14.04 LTS.
  1. Navigate to http://nodejs.org/download/ and on the Linux Binaries (.tar.gz) row click to download the 64-bit version of the current latest release.

  2. Say you've downloaded node-v0.10.7-linux-x64.tar.gz into the Downloads directory. Then, open the terminal and type the following:

$ cd ~/Downloads
$ mkdir -p ~/local/node
$ tar xzf node-v0.10.7-linux-x64.tar.gz -C ~/local/node --strip-components=1
$ echo '# Node Enviroment Setup' >> ~/.bashrc
$ echo 'export PATH=$HOME/local/node/bin:$PATH' >> ~/.bashrc
@bortzmeyer
bortzmeyer / gist:1284249
Created October 13, 2011 13:42
The only simple way to do SSH in Python today is to use subprocess + OpenSSH...
#!/usr/bin/python
# All SSH libraries for Python are junk (2011-10-13).
# Too low-level (libssh2), too buggy (paramiko), too complicated
# (both), too poor in features (no use of the agent, for instance)
# Here is the right solution today:
import subprocess
import sys