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
module Enumerable | |
def with_progress(msg, resolution=1, &blk) | |
return enum_for(:with_progress, msg) unless block_given? # Sparkling magic! | |
Logger.indentStart(msg) | |
pb = VlcProgressBar.new(msg, size.to_i) | |
each_with_index { |elem, i| | |
yield(elem) | |
pb.full_increment if i%resolution == 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
jetski@ams:~/shared/log$ grep 243244 show_this_to_nkpart.log | tail -n 50 | head -n 30 | |
SQL (2.4ms) UPDATE "report_results" SET "status" = 'Queued' WHERE "report_results"."id" = 243244 | |
2015-07-16 11:49:50 +0000 ReportResultQueue -> Running ReportResult 243244/96595 [Sydney -> Queued], API gave accepted | |
SQL (2.2ms) UPDATE "report_results" SET "status" = 'Running' WHERE "report_results"."id" = 243244 | |
SQL (2.0ms) UPDATE "report_results" SET "status" = 'Failure' WHERE "report_results"."id" = 243244 | |
2015-07-16 11:49:58 +0000 ReportResultQueue -> Kahuna Inconsistency for ReportResult 243244/96595 [Sydney -> Failure] - marking as failed | |
2015-07-16 11:49:58 +0000 ReportResultQueue -> ReportResult 243244/96595 [Sydney -> Failure] was marked as failed, lets try the next one | |
2015-07-16 11:50:09 +0000 ReportResultQueue -> Requeuing ReportResult 243244/96595 [Sydney -> Failure] | |
SQL (10.8ms) UPDATE "report_results" SET "status" = 'Queued' WHERE "report_results"."id" = 243244 | |
2015-07-16 11:50:13 +0000 ReportRes |
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
" Ruby | |
autocmd FileType ruby noremap <leader>r :w<cr>:!ruby % <cr> | |
" Functional tests | |
autocmd FileType scala noremap <leader>t :w<cr>:!sbt test<cr> | |
autocmd FileType haskell noremap <leader>r :w<cr>:!ghc % -o run_me<cr>:!./run_me<cr> | |
autocmd FileType haskell noremap <leader>t :w<cr>:!doctest %<cr> | |
autocmd FileType haskell noremap <buffer> <F2> :GhcModType<CR> | |
autocmd FileType haskell noremap <buffer> <silent> <F3> :GhcModTypeClear<CR> | |
autocmd FileType haskell noremap <leader>T :w<CR>:GhcModTypeInsert<CR> |
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 ruby | |
require 'date' | |
warn,crit=30.0,35.0 | |
while a = ARGV.shift | |
if a == "-w" | |
warn = ARGV.shift.to_f | |
elsif a == "-c" | |
crit = ARGV.shift.to_f | |
end | |
end |
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
changes = {# Authorised Kahuna Data Kahuna_valid Archived | |
Selection.status_pending => [SiteAuthorisation::ALTERED, true, false, false], | |
Selection.status_null_no_data_ => [SiteAuthorisation::AUTHORISED, false, false, false], | |
Selection.status_reject_new_ => [SiteAuthorisation::REJECTED, false, false, false], | |
Selection.status_reject_change_ => [SiteAuthorisation::REJECTED, true, false, false], | |
Selection.status_current => [SiteAuthorisation::AUTHORISED, true, true, false], | |
Selection.status_archived_has_data_ => [SiteAuthorisation::AUTHORISED, true, true, true], | |
Selection.status_archived_no_data_ => [SiteAuthorisation::ALTERED, false, false, true], | |
Selection.status_new => [SiteAuthorisation::ALTERED, false, false, false], | |
Selection.status_altered => [SiteAuthorisation::ALTERED, false, false, false], |
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
# Note that if any data required to determine the type of person is missing then person type = :missing | |
if [study_type, employment_status, other_activity].all? { |e| e == :missing } | |
:missing | |
elsif study_type == :primary_school | |
:primary_school | |
elsif study_type == :secondary_school | |
:secondary_school | |
elsif employment_status == :full_time | |
if study_type == :no_study || study_type == :missing | |
white_or_blue == :white ? :full_time_white_collar_worker : :full_time_blue_collar_worker |
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
ULONG_MAX = 4294967295 | |
zones = (1..5).to_a | |
times = [1212, 1213, 1214, 1215, | |
1312, 1313, 1314, 1315, | |
1412, 1413, 1414, 1415, | |
1512, 1513, 1514, 1515] | |
purposes = (1001..1060).to_a | |
num_cars = [0,1,2,3] |
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
require 'utils/gis/link_to_polygon_converter' | |
require 'utils/gis/tab_file_writer' | |
def kml_output | |
links_to_export = get_links_to_export('LinkType', [15,16,17,19]) # [linknr1, linknr2, ...] | |
links = OtSpatialReader.new.readLinks.reject { |linknr, _| !links_to_export.include?(linknr) } | |
polygons_by_linknr = links.map_values { |line| LinkToPolygonConverter.translate(line, $Ot.project.city) } | |
polygons_by_linknr_dirn = polygons_by_linknr.each_with_object({}) { |(linknr, (poly1,poly2)), memo| | |
memo[[linknr, 1]] = poly1 |
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
def get_link_loads(data_hash, pmturis) | |
Logger.showProgress('Getting link loads', data_hash){|(linknr, direction), _| | |
pmturis.each{|pmturi| | |
load = $Ot.network.get_load(pmturi, linknr, direction) | |
data_hash[[linknr, direction]][pmturi] = load | |
} | |
} | |
data_hash | |
end |
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
for (int col = 0; col < numCentroids; ++col) | |
{ | |
float skim_value = skim_row[col]; | |
if (attractions.at(col) == 0 || skim_value == 99999) | |
{ | |
utilities.at(col) = 99999; | |
continue; | |
} |