Skip to content

Instantly share code, notes, and snippets.

@claws
claws / 2012-03-03-demo.md
Created March 3, 2012 07:45
A simple excerpt filter for use with Jekyll. Perhaps there are better ways but I couldn't find anything suitable. It extracts post content in between "<!-- excerpt start -->" and "<!-- excerpt end -->". Change the excerpt delimiters to suit your needs.
layout title
post
Test Post

This is a test post.

This content comes after the excerpt.

@claws
claws / 2012-03-03-demo.md
Created March 3, 2012 13:10
Generate excerpt content in Jekyll for use on Gihub pages. This extracts the post content within the '<!-- excerpt start -->' and '<!-- excerpt end -->' comment tags.
layout title
post
Jekyll Excerpts

This text becomes the excerpt text displayed on the main page

@claws
claws / weather_station.py
Created April 22, 2012 12:55
A Python Twisted friendly pywws Weather Station
#!/usr/bin/env python
"""
This module represents a twist-ification of the pywws Weather Station.
There was nothing wrong with the original pywws version. I just wanted a
version that would integrate consistently with my other Twisted based
software.
"""
@claws
claws / weather_report.py
Created May 28, 2012 13:52
Create Your Own Weather Report Audio Track Using Current BOM Data
"""
This script retrieves weather forecast and observation
data from the Australian Bureau of Meteorology (BOM)
and converts them into a spoken word weather report
audio file.
This script was written to generate the first track for
my morning alarm clock playlist.
@claws
claws / pyzmq_last_endpoint_test.py
Created January 12, 2013 23:06
pyzmq problem using LAST_ENDPOINT sockopt
'''
I am trying to use a wildcard port in an effort to let the OS assign
an ephemeral port. I then try to ascertain the actual endpoint by
using the LAST_ENDPOINT socket option.
This is along the lines of the suggestion here: http://lists.zeromq.org/pipermail/zeromq-dev/2012-October/018915.html
However, this does not work for me. The output below is what I get
when I run this script:
@claws
claws / projection_01.c
Last active December 14, 2015 08:19
Avro schema projection test 01
/*
* Build using:
* gcc -Wall -std=c99 projection_01.c -o projection_01_test -I/usr/include -I$AVRO_INCLUDE_DIR -L$AVRO_LIB_DIR -lavro
*/
#include <stdlib.h>
#include <stdio.h>
#include <avro.h>
@claws
claws / projection_02.c
Created February 28, 2013 13:16
Avro schema projection test 02
/*
* Build using:
* gcc -Wall -std=c99 projection_02.c -o projection_02_test -I/usr/include -I$AVRO_INCLUDE_DIR -L$AVRO_LIB_DIR -lavro
*/
#include <stdlib.h>
#include <stdio.h>
#include <avro.h>
@claws
claws / resolved-writer-modified.c
Created March 2, 2013 01:50
Avro C resolving issue
// This example shows how to write data into an Avro container file, and how to
// read data from a file, both with and without schema resolution. The source
// of this example can be found [on GitHub][gh].
//
// [gh]: https://github.com/dcreager/avro-examples/tree/master/resolved-writer
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@claws
claws / bomau_publisher.py
Last active April 22, 2016 18:13
Publish Australian weather observations to MQTT
#!/usr/bin/env python
'''
Chris Laws 2013
Publish Australian weather observations over MQTT.
This script periodically retrieves weather observations from the
Australia Bureau of Meteorology. The source data comes from a file
@claws
claws / threads-example-fixed.c
Last active December 22, 2015 01:18
These simple code examples were used as a code reference for a question to the zeromq mailing list about "Context was terminated" printed to stdout. The -fixed versions appear to resolve the issue.
// This simple code example was used as a code reference for a
// question to the zeromq mailing list.
//
// gcc -o threads-example.o -c threads-example.c -Wall -Wimplicit -Wextra -I/usr/local/include
// gcc -o threads-example threads-example.o -L/usr/local/lib -lzmq -lczmq
//
#include "czmq.h"