Skip to content

Instantly share code, notes, and snippets.

Avatar

Jude Mwenda jmwenda

View GitHub Profile
@jmwenda
jmwenda / geonode-backup
Created Oct 27, 2011
GeoNode mirror scripts.
View geonode-backup
#!/bin/bash
# Backup script, meant to me run at the geonode mirror.
# Make sure to enable passwordless access from the mirror to the original site.
# Authors: Jude Mwenda, Ariel Nunez
# http://github.com/GFDRR
#NOTE: This tool requires pgsql_schema_diff.py to be installed first
# cd /usr/bin
# https://raw.github.com/gist/380278/140b133ea52e55e63ea2bfae9630e14f22c80ac9/pgsql_schema_diff.py
@jmwenda
jmwenda / geonode-bckup
Created Nov 7, 2011
GeoNode Script to Back up directory and files
View geonode-bckup
#!/bin/bash
# Backup script, meant to me run at the geonode mirror.
# Make sure to enable passwordless access from the mirror to the original site.
# Authors: Jude Mwenda, Ariel Nunez
# http://github.com/GFDRR
#NOTE: This tool requires pgsql_schema_diff.py to be installed first
# cd /usr/bin
# https://raw.github.com/gist/380278/140b133ea52e55e63ea2bfae9630e14f22c80ac9/pgsql_schema_diff.py
View gist:1784834
from django.contrib.auth.models import User
from django.shortcuts import render_to_response
from django.utils.encoding import force_unicode
from tastypie.resources import ModelResource,ALL
from tastypie import fields
from tastypie.serializers import Serializer
import pickle
#we deal with stuff related with content
from masomo.models import Content,Subject,Topic,Chapter,Page
#we now deal with stuff related with setup and devices
View gist:1784845
#have to add subject here because of the import
class Subject(models.Model):
name = models.CharField("Subject", max_length=45)
description = models.TextField("Description", max_length=255)
def __unicode__(self):
return self.name
@models.permalink
def get_absolute_url(self):
return ('curricula',(),{})
View gist:1786953
<?xml version='1.0' encoding='utf-8'?>
<response><objects type="list"><object><description>theee</description><value>ewqqe</value><subject><name>Science</name><chapters type="list"><object><title>Weather and Solar System</title><topics type="list"><object><id>1</id><title>The Sky</title><pages type="list"><object><pagelabel>Page One</pagelabel><id>1</id><resource_uri>/api/masomo/page/1/</resource_uri></object></pages><resource_uri>/api/masomo/topic/1/</resource_uri></object></topics><resource_uri>/api/masomo/chapter/1/</resource_uri><description>wetho</description><id>1</id></object><object><title>Human Anatomy</title><topics type="list"/><resource_uri>/api/masomo/chapter/2/</resource_uri><description>humo</description><id>2</id></object></chapters><description>scio</description></subject></object></objects><meta type="hash"><next type="null"/><total_count type="integer">1</total_count><previous type="null"/><limit type="integer">20</limit><offset type="integer">0</offset></meta></response>
View gist:2008550
import mapnik
import cairo
m = mapnik.Map(15000, 15000, "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs") # end result: OpenStreetMap projection
m.background = mapnik.Color(0, 0, 0, 0)
bbox = mapnik.Envelope(-10000000, 2000000, -4000000, -19000000) # must be adjusted
m.zoom_to_box(bbox)
s = mapnik.Style()
View gist:4145991
<% content_for(:page_title) do %>
<%= current_user.username %> |
<% end %>
<%= content_for(:js) do %>
<%= headjs_include_tag "plugins/jquery.min", "admin/show/helpers", "plugins/file_uploader", "admin/index/dashboard", "plugins/jquery.color", "plugins/jquery.cookie", "admin/index/import" %>
<%
# Get the user space to set the uploader max file size
if @quota && @database_size
View gist:4145995
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Nation Maps - <%= @table.name %> map</title>
<style type="text/css">
html, body {height: 100%; margin: 0; padding: 0;}
#map_canvas {height: 100%;}
View bootstrap.css
@import url(https://fonts.googleapis.com/css?family=Telex);
/*!
* Bootstrap v2.2.1
*
* Copyright 2012 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world @twitter by @mdo and @fat.
*/
View front_layout.html.erb
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<title>Nation Data | Login</title>
You can’t perform that action at this time.