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
function Json2List(json) { | |
var output = ''; | |
for (var k in json) { | |
if (json.hasOwnProperty(k)) { | |
if (typeof(json[k]) == 'object') { | |
output = output + '<dl>' + '<dt>' + k + '</dt>' + '<dd>' + Json2List(json[k]) + '</dd>' + '</dl>'; | |
} else { | |
output = output + '<b>' + k + '</b>' + ' : ' + json[k] + '<br/>'; | |
} | |
} |
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
find what: #(\w+_)*(\w+)- | |
replace with: #$1$2_ |
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
start = time.time() | |
for pv_name in pv_list: | |
pv = PV(pv_name) | |
if pv.wait_for_connection(timeout=1.0): | |
result[pv_name] = pv.get(use_monitor=False) | |
else: | |
result[pv_name] = 'not connected' | |
duration = time.time() - start | |
print int(round(duration * 1000)) |
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
start = time.time() | |
for pv_name in pv_list: | |
ch = ca.create_channel(pv_name, connect=False, auto_cb=False) | |
result[pv_name] = [ch, None, None] | |
for pv_name, data in result.items(): | |
result[pv_name][1] = ca.connect_channel(data[0], timeout=1.0) | |
ca.poll() | |
for pv_name, data in result.items(): | |
if result[pv_name][1]: | |
ca.get(data[0], wait=False) |
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 multiprocessing import Process, Manager | |
def get(d, pv_name, size, start, pid): | |
pv = PV(pv_name) | |
if pv.wait_for_connection(timeout=1.0): | |
d[pv_name] = pv.get(use_monitor=False) | |
else: | |
d[pv_name] = 'not connected' | |
if len(d) == size: |
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 get(d, pv_name, size, start, pid): | |
ch = ca.create_channel(pv_name, connect=False, auto_cb=False) | |
if ca.connect_channel(ch, timeout=1.0): | |
d[pv_name] = ca.get(ch, wait=True) | |
else: | |
d[pv_name] = 'not connected' | |
if len(d) == size: | |
print int(round((time.time() - start) * 1000)) | |
os.kill(pid, signal.SIGTERM) |
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
start = Date.now(); | |
size = pv_list.length; | |
pv_list.forEach(function(pv) { | |
ca.exec('caget', pv, function(err, result) { | |
complete = complete + 1; | |
if (err) { | |
results[pv] = { | |
name: pv, | |
value: 'unavailable' |
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
function average(array) { | |
return array.reduce(function(p, c, i, a) { | |
return (p * i + c) / (i + 1); | |
}); | |
} |
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
/** | |
* @fileOverview a middleware for express deployment behind a reverse proxy | |
* @param {string} proxy - the known reverse proxy host | |
* @param {string} proxied_service - the url assigned by proxy | |
* @return {function} the middleware | |
* / | |
function proxied (proxy, proxied_service) { | |
return function (req, res, next) { | |
req.proxied = false; | |
req.proxied_prefix = ''; |
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
mixin progress(id) | |
.bar-wrap | |
.progress.no-extra-space(id=id) | |
.progress-marker(style='right:25%') | |
.progress-marker(style='right:50%') | |
.progress-marker(style='right:75%') | |
mixin time-axis | |
.time-axis | |
.time-spot-end now | |
.time-spot.text-center 6 hours ago |
OlderNewer