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
"""Sketch of what LabJack as joystick might look like. | |
@author: Sam Pottinger (samnsparky) | |
@license: GNU GPL v3 | |
""" | |
import time | |
import yaml |
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
function createAcceptFunc(deferred, valuesDict, setupInfo) { | |
return function (value) { | |
valuesDict.set(setupInfo.bindingClass, value); | |
deferred.resolve(); | |
}; | |
} | |
function createRejectFunc(deferred, errorDict, setupInfo) { | |
return function (value) { |
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
/** | |
* Force a redraw on the rendering engine. | |
**/ | |
function runRedraw() | |
{ | |
document.body.style.display='none'; | |
document.body.offsetHeight; // no need to store this anywhere, the reference is enough | |
document.body.style.display='block'; | |
} |
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
$scribeBaseURL = "http://ljsimpleregisterlookup.herokuapp.com/scribe_component?input="; | |
$escapedInput = urlencode('@registers(' . $view->args[0] . '):' . $view->args[1]); | |
$renderedHTML = file_get_contents($scribeBaseURL . $escapedInput); | |
print $renderedHTML; |
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
function onModuleLoad () { | |
} | |
$.ready(function () { | |
var framework = new Framework(); | |
framework.on('onModuleLoad', onModuleLoad); | |
//... |
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
SELECT_TEMPALTE = 'SELECT rowid, snapshot_id, word FROM snapshot_content WHERE word="%s" ORDER BY rowid ASC' | |
UPDATE_TEMPLATE = 'UPDATE snapshot_content SET word="%s" WHERE rowid=%d' | |
def exchange_word(cursor, source_word, replace_first_word, replace_second_word): | |
select_operation = SELECT_TEMPLATE % source_word | |
results = list(cursor.execute(select_operation)) | |
change_to_first_word_row_ids = results[::2].map(lambda x: x[0]) | |
change_to_second_word_row_ids = results[1::2].map(lambda x: x[0]) | |
for row_id in change_to_first_word_row_ids: |
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
<div id="test-section"> | |
<p>An analog input converts a voltage level into a digital value that can be stored and processed in a computer. Why would you want to measure voltages? There are a multitude of sensors available which convert things like temperature, pressure, etc. into voltages. The voltages can then be easily measured by various kinds of hardware, such as a LabJack T7, and then read into a computer. The computer can then convert the voltage value into it's original type (temperature, pressure, etc) and the value can then be stored in a file, emailed to someone, or used to control something else outside of the computer. The T7 exposes analog inputs through MODBUS registers as demonstrated below.</p> | |
<p> | |
First, information about configuration: | |
@registers(AIN Configuration Registers):AIN#(0:10)_RANGE,AIN#(0:10)_NEGATIVE_CH,AIN#(0:10)_RESOLUTION_INDEX | |
</p> | |
<p> |
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
"""Combine TRACER entries that have the exact same name. | |
A very simple script to combine entries from the TRACER political finance | |
activity database that have the exact same names. Should be run from the | |
command line with two arguments: the location of the CSV file to read entries | |
from and the location where the resulting deduplicated / sorted list should | |
be written to as CSV. | |
@author: Sam Pottinger (samnsparky, gleap.org) | |
@license: MIT |
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
import pycotracer | |
import pymongo | |
client = pymongo.MongoClient() | |
db = client['tracer-records-db-2'] | |
for year in range(2013,2014): | |
print "fetching tracer records for year",year | |
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
import pycotracer | |
import pymongo | |
client = pymongo.MongoClient() | |
db = client['tracer-records-db'] | |
for year in range(2000,2014): | |
print "fetching tracer records for year",year | |