This file contains 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 | |
# | |
# Copyright 2012 by Jeff Laughlin Consulting LLC | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
This file contains 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 | |
from pprint import pprint | |
from ctypes import CDLL, create_string_buffer, string_at | |
from ctypes import c_bool, c_char, c_wchar, c_byte, c_ubyte, c_short, c_ushort | |
from ctypes import c_int, c_uint, c_long, c_ulong, c_longlong, c_ulonglong | |
from ctypes import c_float, c_double, c_longdouble, c_char_p, c_wchar_p | |
from ctypes import c_void_p, POINTER, pointer, byref | |
__all__ = ['orbreap_timeout'] |
This file contains 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
def render(self, request): | |
# Encapsulate the function call we wish to make into a partial object. | |
# Now if we change the function name or arguments we only change them | |
# in ONE place, instead of the two places this function is called from. | |
f = functools.partial(self.dlstatus.stn_to_json, self.id) | |
try: | |
request.setHeader("content-type", "application/json") | |
if request.args.has_key('callback'): | |
request.setHeader("content-type", "application/javascript") | |
return request.args['callback'][0] + '(' + |
This file contains 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
lass DataObject(object): | |
def to_html(self, updated_station): | |
self.html = "whatever" | |
self.on_html_update.callback(self.html) | |
def update(self, updated_stations): | |
self.json = self.to_json(updated_stations) | |
self.on_json_update.callback(self.json) | |
This file contains 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
import math | |
from qgis.core import * | |
from processing.core.VectorWriter import VectorWriter | |
##degspacing=number 30 | |
##distance=number 5000000 | |
##numrings=number 4 | |
##centerx=number 0.0 | |
##centery=number 0.0 |
This file contains 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
#!/bin/bash | |
FILES=`git ls-tree --name-only HEAD .` | |
MAXLEN=0 | |
IFS=$(echo -en "\n\b") | |
for f in $FILES; do | |
if [ ${#f} -gt $MAXLEN ]; then | |
MAXLEN=${#f} | |
fi | |
done |
This file contains 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
from celery import Celery | |
app = Celery('tasks', broker='amqp://guest@localhost//') | |
@app.task | |
def add(x, y): | |
return x + y |
This file contains 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
TC5->COUNT16.CTRLA.reg &= ~TC_CTRLA_ENABLE; | |
while (TC5->COUNT16.STATUS.bit.SYNCBUSY); | |
TC5->COUNT16.CTRLA.reg = TC_CTRLA_SWRST; | |
while (TC5->COUNT16.STATUS.bit.SYNCBUSY); |
This file contains 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
/* | |
WiFi Web Server | |
A simple web server that shows the value of the analog input pins. | |
using a WiFi shield. | |
This example is written for a network using WPA encryption. For | |
WEP or WPA, change the WiFi.begin() call accordingly. | |
Circuit: |
This file contains 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 bash | |
wget http://mything.com/mything.tgz | |
tar xzf mything.tgz | |
cd mything | |
make all; make test; sudo make install | |
echo -e '#!/usr/bin/env bash\ninsmod mything.so' > /etc/rc.local |
OlderNewer