This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var SerialPort = require('serialport').SerialPort; | |
| var xbee_api = require('xbee-api'); | |
| var C = xbee_api.constants; | |
| var Q = require('q'); | |
| // following settings work for me on my Raspberry pi, your config may differ! | |
| var xbeeAPI = new xbee_api.XBeeAPI({ | |
| api_mode: 1 | |
| }); | |
| var serialport = new SerialPort("/dev/ttyAMA0", { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import sys, csv, os, shutil | |
| pattern = "Vol09-%04d.jpg" | |
| original_filename = sys.argv[1] | |
| output_path = sys.argv[2] | |
| output_csv = os.path.join(output_path, "original_filenames.csv") | |
| next_index = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // add this javascript to your Zendesk Help Center pages | |
| (function($) { | |
| $(function() { | |
| // for all attachment links whose URLs end with .pdf (case sensitive)... | |
| var pdfs = $('.attachments a[href$=".pdf"]'); | |
| var eleBody = $('div.article-body'); | |
| if (pdfs.length > 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| javascript:(function(){var where=document.location.toString();if(where.indexOf('envisage-system.co.uk')>=0){document.location=where.replace('envisage-system.co.uk','envisage-staging.co.uk');}if(where.indexOf('envisage-staging.co.uk')>=0){document.location=where.replace('envisage-staging.co.uk','envisage-system.co.uk');}})() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Use sed to replace '==x.y' with '<x.y.999' | |
| # and save results to a file | |
| sed -r -e "s/==([0-9]+\.[0-9]+)(\..+)?/<\1.999/" requirements.txt > /tmp/requirements2.txt | |
| # It works by transforming the file like this: | |
| # Django==1.4.8 >> Django<1.4.999 | |
| # Jinja2==2.5 >> Jinja2<2.5.999 | |
| # M2Crypto==0.19.1 >> M2Crypto<0.19.999 | |
| # MySQL-python==1.2.5 >> MySQL-python<1.2.999 | |
| # Pillow==2.5.1 >> Pillow<2.5.999 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en" dir="ltr"> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
| <title>Owlstone - Chemical Detection and Chemical Sensing</title> | |
| <link href="https://plus.google.com/103452364153605968626" rel="publisher" /> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
| <meta http-equiv="x-dns-prefetch-control" content="on" /> | |
| <link rel="dns-prefetch" href="//www.owlstone.net" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import tornado.ioloop | |
| import tornado.web | |
| import pprint | |
| class MyDumpHandler(tornado.web.RequestHandler): | |
| def post(self): | |
| pprint.pprint("Request") | |
| pprint.pprint(self.request) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Put this at <yourapp>/management/commands/runserver.py. | |
| # Override the value of the constant coded into django... | |
| import django.core.management.commands.runserver as runserver | |
| runserver.DEFAULT_PORT="8197" | |
| # ...and then just import its standard Command class. | |
| # Then manage.py runserver behaves normally in all other regards. | |
| from django.core.management.commands.runserver import Command |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| localhost ansible_connection=local |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # A VERY simple (naive?) web server. | |
| # Listens for requests (on a socket) and responds with HTML responses. | |
| # There are some obvious problems with this (it's really very basic). For instance, | |
| # it responds to ALL requests with 200 OK and HTML. | |
| # Code based on http://code.activestate.com/recipes/576541-very-simple-http-web-server/ | |
| from socket import * | |
| HOST = '' # Can put '127.0.0.1' - meaning the local host | |
| PORT = 5000 # Arbitrary non-privileged port |