Skip to content

Instantly share code, notes, and snippets.

View adamcharnock's full-sized avatar

Adam Charnock adamcharnock

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<!-- Only the settings with values not equal to defaults are in this file. If you want to see the
full list of available settings, check the amstock_settings.xml file in the amstock folder. -->
<settings>
<margins>0</margins>
<!-- <max_series>10</max_series> -->
<redraw>true</redraw>
<max_grid_count>30</max_grid_count>
<equal_spacing>false</equal_spacing>
DROP TEMPORARY TABLE IF EXISTS siteswith30days;
CREATE TEMPORARY TABLE siteswith30days SELECT r2.siteid, COUNT(*) as totalrows FROM rawdata AS r2 GROUP BY siteid HAVING totalrows > 6*24*30;
SELECT
r.*,
(r.winddirection % 1024) * (360/1024) AS winddirectiondegrees,
0.8669 * (r.windpulsecount/600) + 0.32 AS windspeed,
s.postcode,
s.anemometerheight
FROM
rawdata AS r
import re
# http://atomboy.isa-geek.com/plone/Members/acoil/programing/double-metaphone
from metaphone import dm as double_metaphone
# get the Redis connection
from jellybean.core import redis
import models
# Words which should not be indexed
#!/bin/bash
if [[ ! -n "$1" || ! -n "$2" ]]
then
echo "Usage: `basename $0` environment port"
exit 1
fi
declare -i date
declare -i lastsave

We have been covering some fairly complex Redis topics here so far, so I thought it would be nice to do a good ol’ getting started guide. This should get you on your feet with Python and Redis on Ubuntu Linux. So, fire up a terminal window and get going!

Getting Redis installed & running

This guide uses Redis 2.0.3, but you can see if there is a newer version at redis.io:

apt-get install build-essential

wget http://redis.googlecode.com/files/redis-2.0.3.tar.gz
tar -zxf redis-2.0.3.tar.gz
@adamcharnock
adamcharnock / gist:1073858
Created July 9, 2011 19:18
Initial work on a Ruby/Rails setup script for https://continuous.io
#!/bin/bash -e
# The following variables are available to you
# (values are examples only)
#
# TIMEZONE="UTC" # The timezone this server should be given
# CI_USER="ci" # The user to setup and run the tests as
# # (although you are free to ignore this)
#
# GIT_URI="git://github.com/andymccurdy/redis-py.git" # The Git URL for this project
#!/bin/bash -ex
# Setup node-jshint and run it
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
curl http://npmjs.org/install.sh | sudo clean=no sh
<?xml version="1.0" ?>
<!DOCTYPE coverage
SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-03.dtd'>
<coverage branch-rate="0" line-rate="0.8934" timestamp="1310992801111" version="3.4">
<!-- Generated by coverage.py: http://nedbatchelder.com/code/coverage -->
<packages>
<package branch-rate="0" complexity="0" line-rate="0.9635" name="ci">
<classes>
<class branch-rate="0" complexity="0" filename="ci/__init__.py" line-rate="1" name="__init__">
<methods/>
{"hero":{"id":26,"secret_identity":"georgie","firstname":"George","full_name":"George Smith","enemy_id":1,"thing_1":"drink more beer","thing_2":"watch more TV","resilience_score":0}}
@adamcharnock
adamcharnock / post-checkout
Created April 22, 2014 11:28
.git/hooks/post-checkout
#!/bin/bash
echo "Cleaning up .pyc files and empty directories"
REPO_ROOT=./$(git rev-parse --show-cdup)
# Delete .pyc files and empty directories.
find $REPO_ROOT -name "*.pyc" -delete
find $REPO_ROOT -type d -empty -delete