Skip to content

Instantly share code, notes, and snippets.

View l34marr's full-sized avatar

TsungWei Hu l34marr

View GitHub Profile
@l34marr
l34marr / etc_nginx_nginx.conf
Created March 28, 2014 02:55
Ubuntu 12.04 nginx-common 1.1.19-1ubuntu0.6
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
@l34marr
l34marr / mobile.css
Last active August 29, 2015 14:01
drchen.ploud.com
/* For devices with narrow screens, phones, tablets, etc. */
#portal-column-one,
#portal-column-two,
#portal-column-content,
#portal-column { /* updated */
clear: both;
width: 97.75%;
margin-left: -98.875%;
}
@l34marr
l34marr / plone-builddev.sh
Created June 25, 2014 07:30
Scripts for running a custom Plone install on Codio
#!/bin/sh
# This assumes you installed Plone on Nitrous.io using these instructions
# http://blog.dbain.com/2013/07/plone-quickstart-on-cloud-in-less-than.html
# download this file and run it with the following command
# sh plone-builddev.sh
echo "running buildout with default buildout.cfg"
~/plone433/zinstance/bin/buildout -c ~/plone433/zinstance/develop.cfg
@l34marr
l34marr / plone-on-codio-installer.sh
Created June 25, 2014 07:34
Plone Installer for Codio
# spinner borrowed from http://fitnr.com/showing-a-bash-spinner.html
spinner()
{
local pid=$1
local delay=0.75
local spinstr='|/-\'
while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do
local temp=${spinstr#?}
printf " [%c] " "$spinstr"
@l34marr
l34marr / getMember.py
Last active August 29, 2015 14:03
Add Plone Members Programmatically, Tested on Plone 4.3.3. Prepare Your Own member.csv, and Run bin/plonectl run regBatch.py
from Products.CMFCore.utils import getToolByName
membership = getToolByName(app.mysite, 'portal_membership')
for member in membership.listMembers():
print member.getProperty('id'), member.getProperty('fullname'), member.getProperty('email')
@l34marr
l34marr / updateAddress.py
Last active August 29, 2015 14:04
Check and Update Address from PostgreSQL to ZODB
from Testing import makerequest
root = makerequest.makerequest(app)
site = root.mysite
admin = root.acl_users.getUserById('admin')
admin = admin.__of__(site.acl_users)
from AccessControl.SecurityManagement import newSecurityManager
newSecurityManager(None, admin)
from zope.site.hooks import setHooks
@l34marr
l34marr / aggregate_view.pt
Last active August 29, 2015 14:04
Aggregate View
<html lang="en"
xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
metal:use-macro="here/main_template/macros/master"
i18n:domain="my.content">
<body>
@l34marr
l34marr / multilingual_import.py
Created October 7, 2014 15:00
script for creating plone.app.multilingual items from csv file
from Testing import makerequest
root = makerequest.makerequest(app)
site = root.mysite
admin = root.acl_users.getUserById('admin')
admin = admin.__of__(site.acl_users)
from AccessControl.SecurityManagement import newSecurityManager
newSecurityManager(None, admin)
@l34marr
l34marr / index.html
Last active August 29, 2015 14:11
HTML and CSS Tutorial
<html>
<head>
<title>Simplest HTML Page</title>
</head>
<body>
<h1 style="color: Red">My First HTML Page</h1>
<p>English Paragraph Goes Here. So You Can Learn That:
<ol>
<li style="color: Red">h1 Means Heading One</li>
<li>p Means Paragraph</li>
@l34marr
l34marr / update-geo.py
Created February 5, 2015 06:15
Setting Geo Data with Plone Maps collective.geo.*
from Testing import makerequest
from AccessControl.SecurityManagement import newSecurityManager
from Products.CMFCore.utils import getToolByName
root = makerequest.makerequest(app)
site = root.mysite
admin = root.acl_users.getUserById('admin')
admin = admin.__of__(site.acl_users)
newSecurityManager(None, admin)