Skip to content

Instantly share code, notes, and snippets.

View philipn's full-sized avatar

Philip Neustrom philipn

View GitHub Profile
@philipn
philipn / gist:20f24bea0b58575f7668
Created May 15, 2014 00:51
Test (doesn't work any longer) export to static html from LocalWiki
import slumber
import requests
import os
import lxml.html
import urllib
from urlparse import urljoin
from utils import all, quote_fs
SITE = 'https://trianglewiki.org'
@philipn
philipn / gist:004396d336bc2bece97f
Created August 14, 2014 08:51
localwiki varnish config
# This is a basic VCL configuration file for varnish. See the vcl(7)
# man page for details on VCL syntax and semantics.
#
# Default backend definition. Set this to point to your content
# server.
#
backend cloudmade {
# cloudmade tiles
#.host = "c.tile.cloudmade.com";
.host = "54.230.151.226";
diff --git a/addart/components/addart.js b/addart/components/addart.js
index 6e1a596..fe5563d 100755
--- a/addart/components/addart.js
+++ b/addart/components/addart.js
@@ -106,11 +106,23 @@ org.eyebeam.addArt.component = {
init: function() {
// Retrieve ABP component
var abp = null;
- try {
- abp = Components.classes["@mozilla.org/adblockplus;1"].createInstance();
@philipn
philipn / basepath for ckeditor
Created September 30, 2011 07:58
basepath for ckeditor
diff --git a/sapling/ckeditor/templates/ckeditor/ckeditor_script.html b/sapling/ckeditor/templates/ckeditor/ckeditor_script.html
index 7e3f404..6f536be 100644
--- a/sapling/ckeditor/templates/ckeditor/ckeditor_script.html
+++ b/sapling/ckeditor/templates/ckeditor/ckeditor_script.html
@@ -1,5 +1,6 @@
<script type="text/javascript">
<!--
+CKEDITOR.basePath = '{{ STATIC_URL }}js/ckeditor/';
CKEDITOR.replace('id_{{ name }}'{% if config %}, {{ config|safe }}{% endif %});
-->
== Updating to 0.2 ==
1. Move your current localsettings.py out of the sapling directory and rename it:
$ mv sapling/localsettings.py sapling/../localsettings.py.bak
2. Activate your virtualenv:
$ source env/bin/activate
@philipn
philipn / create_template_postgis-debian.sh
Created November 30, 2011 06:27
create_template_postgis-debian.sh WORKS ON 11.10
#!/bin/bash
# For Ubuntu 8.x and 9.x releases.
if [ -d "/usr/share/postgresql-8.3-postgis" ]
then
POSTGIS_SQL_PATH=/usr/share/postgresql-8.3-postgis
POSTGIS_SQL=lwpostgis.sql
fi
# For Ubuntu 10.04
from django.middleware.cache import UpdateCacheMiddleware
from django.utils.cache import learn_cache_key, get_max_age
class UpdateCacheMiddlewareNoHeaders(UpdateCacheMiddleware):
"""
Just like UpdateCacheMiddleware but we don't set cache headers in the
HTTP response.
"""
Run:
localwiki-manage shell
then enter this, afer editing the `ago` value:
import datetime
now = datetime.datetime.now()
###############
@philipn
philipn / DavisWiki blackout page
Created January 18, 2012 04:41
daviswiki blackout HTML
<html lang="en">
<head>
<title>Day of Protest</title>
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<style type="text/css">
@philipn
philipn / request.py diff for SOPA PIPA
Created January 18, 2012 08:56
request.py diff for SOPA and PIPA
wikispot@leo:~/Sycamore$ diff request.py.old request.py
34a35,172
> MAX_POST_PER_MINUTE = 40
>
> DO_SOPA = True
> SOPA_HTML = """<html lang="en">
> <head>
> <title>Davis Wiki - Day of Protest</title>
>
> <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>