Skip to content

Instantly share code, notes, and snippets.

View mpampols's full-sized avatar

Marc Pàmpols mpampols

View GitHub Profile
#!/bin/sh
# This script deletes an entire Django database, calls syncdb, and imports data tables
# Drop all tables in cascade
psql tablename << EOF
DROP SCHEMA public CASCADE;
CREATE SCHEMA "public" AUTHORIZATION "postgres";
EOF
# Syncdb
@mpampols
mpampols / imageevent.py
Created February 4, 2014 11:24
This is a sample extended content type for Plone that uses the Event Schema adding some new fields (Image, Categories and Location). Categories field is using a NamedVocabulariy and Location field uses a TTGoogleMapMarker
"""Definition of the imageevent content type
"""
from zope.interface import implements
from Products.Archetypes import atapi
from Products.ATContentTypes.content import base
from Products.ATContentTypes.content import schemata
# -*- Message Factory Imported Here -*-
@mpampols
mpampols / banner.py
Created February 4, 2014 11:35
A Plone content type used for baners with a string URL and a Reference Field to any other content type
"""Definition of the banner content type
"""
from zope.interface import implements
from Products.Archetypes import atapi
from Products.ATContentTypes.content import base
from Products.ATContentTypes.content import schemata
# -*- Message Factory Imported Here -*-
@mpampols
mpampols / minisite.py
Created February 4, 2014 11:42
A Plone content type that creates a "minisite", this also creates new folders and contents to this new folderish content.
# -*- coding: utf-8 -*-
"""Definition of the minisite content type
"""
from zope.interface import implements
from Products.Archetypes import atapi
from Products.ATContentTypes.content import folder
from Products.ATContentTypes.content import schemata
@mpampols
mpampols / encode_videos.sh
Created February 4, 2014 11:48
Bash that checks a folder for .mp4 files without STREAMING string and reencodes them using ffmpeg to move the moov atom at the beginning of the file in order to enable web streaming.
#!/bin/bash
for file in /opt/web/streaming/*.mp4
do
echo "Check if file ${file% STREAMING.mp4} STREAMING.mp4 exists"
if [ ! -f "${file% STREAMING.mp4} STREAMING.mp4" ]; then
echo "-- New afile detected:"
echo "-- Running: ffmpeg -i "$file" -c:a copy -c:v copy -movflags faststart "${file%.mp4} STREAMING".mp4"
ffmpeg -i "$file" -c:a copy -c:v copy -movflags faststart "${file%.mp4} STREAMING".mp4
mv "$file" /opt/videos-originals
@mpampols
mpampols / gist:8806061
Created February 4, 2014 15:40
Error when adding any content type after uninstalling collective.hootsuite
Traceback (innermost last):
• Module ZPublisher.Publish, line 60, in publish
• Module ZPublisher.mapply, line 77, in mapply
• Module ZPublisher.Publish, line 46, in call_object
• Module Products.CMFPlone.FactoryTool, line 458, in __call__
• Module Products.CMFPlone.FactoryTool, line 207, in __getitem__
• Module Products.CMFPlone.FactoryTool, line 68, in _createObjectByType
• Module Products.CMFCore.TypesTool, line 559, in _constructInstance
• Module zope.event, line 31, in notify
• Module zope.component.event, line 24, in dispatch
### Keybase proof
I hereby claim:
* I am mpampols on github.
* I am mpampols (https://keybase.io/mpampols) on keybase.
* I have a public key whose fingerprint is 6D34 CEC3 9A36 99B1 01D2 6784 6FE6 A8BF 35BD 10A7
To claim this, I am signing this object:
@mpampols
mpampols / racc.mobileconfig
Created July 18, 2014 22:38
Cellular payload mobileconfig for RACCtel compatible with iOS 8 beta
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>APNs</key>
<array>
<dict>
server {
listen 80;
server_name www.marcpampols.com marcpampols.com;
return 301 https://www.marcpampols.com$request_uri;
}
server {
listen 443;
ssl on;
@mpampols
mpampols / jquery.slidify.js
Created January 26, 2015 10:52
jQuery Slidify Menu Plugin
/**
* jQuery Slidify Menu Plugin by Marc Pampols <mpampols@gmail.com>
*
* Example usage:
* $(".portlet-pensando-en-ti .portletItem").slidify({
* slideInSpeed: 200,
* slideOutSpeed: 400
* });
**/