Skip to content

Instantly share code, notes, and snippets.

Avatar

Philip Neustrom philipn

View GitHub Profile
@philipn
philipn / gist:20f24bea0b58575f7668
Created May 15, 2014
Test (doesn't work any longer) export to static html from LocalWiki
View gist:20f24bea0b58575f7668
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 Aug 14, 2014
localwiki varnish config
View gist:004396d336bc2bece97f
# 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";
View abp add-art fix?
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 Sep 30, 2011
basepath for ckeditor
View 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 %});
-->
View gist:1394669
== 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 Nov 30, 2011
create_template_postgis-debian.sh WORKS ON 11.10
View create_template_postgis-debian.sh
#!/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
View gist:1569228
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.
"""
View gist:1572501
Run:
localwiki-manage shell
then enter this, afer editing the `ago` value:
import datetime
now = datetime.datetime.now()
###############
@philipn
philipn / DavisWiki blackout page
Created Jan 18, 2012
daviswiki blackout HTML
View DavisWiki blackout page
<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 Jan 18, 2012
request.py diff for SOPA and PIPA
View request.py diff for SOPA 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'>