text:
package main

var carytown = `
{
    "meta": {
        "ver": "3.0"
    },
    "cols": [
        {
            "name": "id"
        },
        {
            "name": "ahu"
        },
        {
            "name": "air"
        },
        {
            "name": "area"
        },
        {
            "name": "cmd"
        },
        {
            "name": "cool"
        },
        {
            "name": "costPerHour"
        },
        {
            "name": "cur"
        },
        {
            "name": "curStatus"
        },
        {
            "name": "curVal"
        },
        {
            "name": "damper"
        },
        {
            "name": "dis"
        },
        {
            "name": "disMacro"
        },
        {
            "name": "discharge"
        },
        {
            "name": "effective"
        },
        {
            "name": "elec"
        },
        {
            "name": "elecCost"
        },
        {
            "name": "elecMeterLoad"
        },
        {
            "name": "energy"
        },
        {
            "name": "enum"
        },
        {
            "name": "equip"
        },
        {
            "name": "equipRef"
        },
        {
            "name": "fan"
        },
        {
            "name": "geoAddr"
        },
        {
            "name": "geoCity"
        },
        {
            "name": "geoCoord"
        },
        {
            "name": "geoCountry"
        },
        {
            "name": "geoPostalCode"
        },
        {
            "name": "geoState"
        },
        {
            "name": "geoStreet"
        },
        {
            "name": "heat"
        },
        {
            "name": "his"
        },
        {
            "name": "hisEnd"
        },
        {
            "name": "hisFunc"
        },
        {
            "name": "hisInterval"
        },
        {
            "name": "hisMode"
        },
        {
            "name": "hisRollupFunc"
        },
        {
            "name": "hisSize"
        },
        {
            "name": "hisStart"
        },
        {
            "name": "hvac"
        },
        {
            "name": "kind"
        },
        {
            "name": "kwSite"
        },
        {
            "name": "lights"
        },
        {
            "name": "lightsGroup"
        },
        {
            "name": "meter"
        },
        {
            "name": "metro"
        },
        {
            "name": "navName"
        },
        {
            "name": "occupied"
        },
        {
            "name": "occupiedEnd"
        },
        {
            "name": "occupiedStart"
        },
        {
            "name": "outside"
        },
        {
            "name": "phone"
        },
        {
            "name": "point"
        },
        {
            "name": "power"
        },
        {
            "name": "pressure"
        },
        {
            "name": "primaryFunction"
        },
        {
            "name": "regionRef"
        },
        {
            "name": "return"
        },
        {
            "name": "rooftop"
        },
        {
            "name": "sensor"
        },
        {
            "name": "site"
        },
        {
            "name": "siteMeter"
        },
        {
            "name": "sitePoint"
        },
        {
            "name": "siteRef"
        },
        {
            "name": "sp"
        },
        {
            "name": "stage"
        },
        {
            "name": "store"
        },
        {
            "name": "storeNum"
        },
        {
            "name": "summary"
        },
        {
            "name": "tariffHis"
        },
        {
            "name": "temp"
        },
        {
            "name": "tz"
        },
        {
            "name": "unit"
        },
        {
            "name": "weatherRef"
        },
        {
            "name": "yearBuilt"
        },
        {
            "name": "zone"
        },
        {
            "name": "mod"
        }
    ],
    "rows": [
        {
            "id": "r:p:demo:r:23a44701-a89a6c66 Carytown",
            "area": "n:3149 ft\u00b2",
            "dis": "Carytown",
            "geoAddr": "3504 W Cary St, Richmond, VA",
            "geoCity": "Richmond",
            "geoCoord": "c:37.555385,-77.486903",
            "geoCountry": "US",
            "geoPostalCode": "23221",
            "geoState": "VA",
            "geoStreet": "3504 W Cary St",
            "metro": "Richmond",
            "occupiedEnd": "h:20:00:00",
            "occupiedStart": "h:10:00:00",
            "phone": "804.552.2222",
            "primaryFunction": "Retail Store",
            "regionRef": "r:p:demo:r:23a44701-67faf4db Richmond",
            "site": "m:",
            "store": "m:",
            "storeNum": "n:1",
            "tz": "America/New_York",
            "weatherRef": "r:p:demo:r:23a44701-1af1bca9 Richmond, VA",
            "yearBuilt": "n:1996",
            "mod": "t:2018-12-12T22:24:01.714Z UTC"
        },
        {
            "id": "r:p:demo:r:23a44701-bbc36976 Tariff His",
            "dis": "Tariff His",
            "equipRef": "r:p:demo:r:23a44701-092f16fa Carytown ElecMeter-Main",
            "his": "m:",
            "hisEnd": "t:2019-03-01T00:00:00-05:00 America/New_York",
            "hisSize": "n:27",
            "hisStart": "t:2017-01-01T00:00:00-05:00 America/New_York",
            "kind": "Str",
            "point": "m:",
            "siteRef": "r:p:demo:r:23a44701-a89a6c66 Carytown",
            "sp": "m:",
            "tariffHis": "m:",
            "tz": "America/New_York",
            "mod": "t:2018-12-12T22:24:01.849Z UTC"
        },
        {
            "id": "r:p:demo:r:23a44701-4ea35663 Carytown RTU-1 ZoneTempSp",
            "air": "m:",
            "cur": "m:",
            "curStatus": "ok",
            "curVal": "n:73 \u00b0F",
            "disMacro": "$equipRef $navName",
            "effective": "m:",
            "equipRef": "r:p:demo:r:23a44701-7265b064 Carytown RTU-1",
            "his": "m:",
            "hisEnd": "t:2019-03-12T23:45:00-04:00 America/New_York",
            "hisMode": "cov",
            "hisSize": "n:76884",
            "hisStart": "t:2017-01-01T00:00:00-05:00 America/New_York",
            "kind": "Number",
            "navName": "ZoneTempSp",
            "point": "m:",
            "regionRef": "r:p:demo:r:23a44701-67faf4db Richmond",
            "siteRef": "r:p:demo:r:23a44701-a89a6c66 Carytown",
            "sp": "m:",
            "temp": "m:",
            "tz": "America/New_York",
            "unit": "\u00b0F",
            "zone": "m:",
            "mod": "t:2018-12-12T22:24:01.724Z UTC"
        },
        {
            "id": "r:p:demo:r:23a44701-3940e690 Carytown ElecMeter-Main kW",
            "cur": "m:",
            "curStatus": "ok",
            "curVal": "n:840.5367088075697 kW",
            "disMacro": "$equipRef $navName",
            "equipRef": "r:p:demo:r:23a44701-092f16fa Carytown ElecMeter-Main",
            "his": "m:",
            "hisEnd": "t:2019-03-12T23:45:00-04:00 America/New_York",
            "hisInterval": "n:15 min",
            "hisMode": "sampled",
            "hisSize": "n:76884",
            "hisStart": "t:2017-01-01T00:00:00-05:00 America/New_York",
            "kind": "Number",
            "kwSite": "m:",
            "navName": "kW",
            "point": "m:",
            "power": "m:",
            "regionRef": "r:p:demo:r:23a44701-67faf4db Richmond",
            "sensor": "m:",
            "siteMeter": "m:",
            "siteRef": "r:p:demo:r:23a44701-a89a6c66 Carytown",
            "tz": "America/New_York",
            "unit": "kW",
            "mod": "t:2018-12-12T22:24:01.718Z UTC"
        },
        {
            "id": "r:p:demo:r:23a44701-27a8a001 Carytown RTU-1 ZoneTemp",
            "air": "m:",
            "cur": "m:",
            "curStatus": "ok",
            "curVal": "n:68.67304021434077 \u00b0F",
            "disMacro": "$equipRef $navName",
            "equipRef": "r:p:demo:r:23a44701-7265b064 Carytown RTU-1",
            "his": "m:",
            "hisEnd": "t:2019-03-12T23:45:00-04:00 America/New_York",
            "hisMode": "sampled",
            "hisSize": "n:76884",
            "hisStart": "t:2017-01-01T00:00:00-05:00 America/New_York",
            "kind": "Number",
            "navName": "ZoneTemp",
            "point": "m:",
            "regionRef": "r:p:demo:r:23a44701-67faf4db Richmond",
            "sensor": "m:",
            "siteRef": "r:p:demo:r:23a44701-a89a6c66 Carytown",
            "summary": "m:",
            "temp": "m:",
            "tz": "America/New_York",
            "unit": "\u00b0F",
            "zone": "m:",
            "mod": "t:2018-12-12T22:24:01.725Z UTC"
        },
        {
            "id": "r:p:demo:r:23a44701-3624929f Carytown Misc",
            "disMacro": "$siteRef $navName",
            "equip": "m:",
            "navName": "Misc",
            "regionRef": "r:p:demo:r:23a44701-67faf4db Richmond",
            "sitePoint": "m:",
            "siteRef": "r:p:demo:r:23a44701-a89a6c66 Carytown",
            "mod": "t:2018-12-12T22:24:01.715Z UTC"
        },
        {
            "id": "r:p:demo:r:23a44701-423ebf02 Carytown RTU-1 DischargeTemp",
            "air": "m:",
            "cur": "m:",
            "curStatus": "ok",
            "curVal": "n:56.951406229993474 \u00b0F",
            "disMacro": "$equipRef $navName",
            "discharge": "m:",
            "equipRef": "r:p:demo:r:23a44701-7265b064 Carytown RTU-1",
            "his": "m:",
            "hisEnd": "t:2019-03-12T23:45:00-04:00 America/New_York",
            "hisMode": "sampled",
            "hisSize": "n:76884",
            "hisStart": "t:2017-01-01T00:00:00-05:00 America/New_York",
            "kind": "Number",
            "navName": "DischargeTemp",
            "point": "m:",
            "regionRef": "r:p:demo:r:23a44701-67faf4db Richmond",
            "sensor": "m:",
            "siteRef": "r:p:demo:r:23a44701-a89a6c66 Carytown",
            "temp": "m:",
            "tz": "America/New_York",
            "unit": "\u00b0F",
            "mod": "t:2018-12-12T22:24:01.732Z UTC"
        },
        {
            "id": "r:p:demo:r:23a44701-3a62fd7a Carytown RTU-1 Heat-2",
            "cmd": "m:",
            "cur": "m:",
            "curStatus": "ok",
            "curVal": false,
            "disMacro": "$equipRef $navName",
            "elecMeterLoad": "r:p:demo:r:23a44701-092f16fa Carytown ElecMeter-Main",
            "enum": "off,on",
            "equipRef": "r:p:demo:r:23a44701-7265b064 Carytown RTU-1",
            "heat": "m:",
            "his": "m:",
            "hisEnd": "t:2019-03-12T20:15:00-04:00 America/New_York",
            "hisMode": "cov",
            "hisSize": "n:1711",
            "hisStart": "t:2017-01-01T00:00:00-05:00 America/New_York",
            "kind": "Bool",
            "navName": "Heat-2",
            "point": "m:",
            "regionRef": "r:p:demo:r:23a44701-67faf4db Richmond",
            "siteRef": "r:p:demo:r:23a44701-a89a6c66 Carytown",
            "stage": "n:2",
            "summary": "m:",
            "tz": "America/New_York",
            "mod": "t:2018-12-12T22:24:01.73Z UTC"
        },
        {
            "id": "r:p:demo:r:23a44701-18bbbd7e Carytown RTU-1 Heat-1",
            "cmd": "m:",
            "cur": "m:",
            "curStatus": "ok",
            "curVal": false,
            "disMacro": "$equipRef $navName",
            "elecMeterLoad": "r:p:demo:r:23a44701-092f16fa Carytown ElecMeter-Main",
            "enum": "off,on",
            "equipRef": "r:p:demo:r:23a44701-7265b064 Carytown RTU-1",
            "heat": "m:",
            "his": "m:",
            "hisEnd": "t:2019-03-12T00:00:00-04:00 America/New_York",
            "hisMode": "cov",
            "hisSize": "n:1641",
            "hisStart": "t:2017-01-01T00:00:00-05:00 America/New_York",
            "kind": "Bool",
            "navName": "Heat-1",
            "point": "m:",
            "regionRef": "r:p:demo:r:23a44701-67faf4db Richmond",
            "siteRef": "r:p:demo:r:23a44701-a89a6c66 Carytown",
            "stage": "n:1",
            "summary": "m:",
            "tz": "America/New_York",
            "mod": "t:2018-12-12T22:24:01.729Z UTC"
        },
        {
            "id": "r:p:demo:r:23a44701-f299239f Carytown ElecMeter-Main Cost",
            "cur": "m:",
            "curStatus": "ok",
            "curVal": "n:0.15499669792019688 $",
            "disMacro": "$equipRef $navName",
            "elecCost": "m:",
            "equipRef": "r:p:demo:r:23a44701-092f16fa Carytown ElecMeter-Main",
            "his": "m:",
            "hisFunc": "tariffCostToHis",
            "hisMode": "sampled",
            "hisRollupFunc": "sum",
            "kind": "Number",
            "navName": "Cost",
            "point": "m:",
            "regionRef": "r:p:demo:r:23a44701-67faf4db Richmond",
            "sensor": "m:",
            "siteMeter": "m:",
            "siteRef": "r:p:demo:r:23a44701-a89a6c66 Carytown",
            "tz": "America/New_York",
            "unit": "$",
            "mod": "t:2018-12-12T22:24:01.72Z UTC"
        },
        {
            "id": "r:p:demo:r:23a44701-0144bdd8 Carytown RTU-1 DischargePressure",
            "air": "m:",
            "cur": "m:",
            "curStatus": "ok",
            "curVal": "n:0.9663769527788633 inH\u2082O",
            "disMacro": "$equipRef $navName",
            "discharge": "m:",
            "equipRef": "r:p:demo:r:23a44701-7265b064 Carytown RTU-1",
            "his": "m:",
            "hisEnd": "t:2019-03-12T23:45:00-04:00 America/New_York",
            "hisMode": "sampled",
            "hisSize": "n:76884",
            "hisStart": "t:2017-01-01T00:00:00-05:00 America/New_York",
            "kind": "Number",
            "navName": "DischargePressure",
            "point": "m:",
            "pressure": "m:",
            "regionRef": "r:p:demo:r:23a44701-67faf4db Richmond",
            "sensor": "m:",
            "siteRef": "r:p:demo:r:23a44701-a89a6c66 Carytown",
            "tz": "America/New_York",
            "unit": "inH\u2082O",
            "mod": "t:2018-12-12T22:24:01.734Z UTC"
        },
        {
            "id": "r:p:demo:r:23a44701-092f16fa Carytown ElecMeter-Main",
            "disMacro": "$siteRef $navName",
            "elec": "m:",
            "equip": "m:",
            "meter": "m:",
            "navName": "ElecMeter-Main",
            "regionRef": "r:p:demo:r:23a44701-67faf4db Richmond",
            "siteMeter": "m:",
            "siteRef": "r:p:demo:r:23a44701-a89a6c66 Carytown",
            "mod": "t:2018-12-12T22:24:01.717Z UTC"
        },
        {
            "id": "r:p:demo:r:23a44701-e0edb850 Carytown RTU-1 Cool-2",
            "cmd": "m:",
            "cool": "m:",
            "cur": "m:",
            "curStatus": "ok",
            "curVal": false,
            "disMacro": "$equipRef $navName",
            "elecMeterLoad": "r:p:demo:r:23a44701-092f16fa Carytown ElecMeter-Main",
            "enum": "off,on",
            "equipRef": "r:p:demo:r:23a44701-7265b064 Carytown RTU-1",
            "his": "m:",
            "hisEnd": "t:2019-03-12T00:00:00-04:00 America/New_York",
            "hisMode": "cov",
            "hisSize": "n:1881",
            "hisStart": "t:2017-01-01T00:00:00-05:00 America/New_York",
            "kind": "Bool",
            "navName": "Cool-2",
            "point": "m:",
            "regionRef": "r:p:demo:r:23a44701-67faf4db Richmond",
            "siteRef": "r:p:demo:r:23a44701-a89a6c66 Carytown",
            "stage": "n:2",
            "summary": "m:",
            "tz": "America/New_York",
            "mod": "t:2018-12-12T22:24:01.728Z UTC"
        },
        {
            "id": "r:p:demo:r:23a44701-5c6fd964 Carytown Misc Occupancy",
            "cur": "m:",
            "curStatus": "ok",
            "curVal": true,
            "disMacro": "$equipRef $navName",
            "enum": "unocc,occ",
            "equipRef": "r:p:demo:r:23a44701-3624929f Carytown Misc",
            "his": "m:",
            "hisEnd": "t:2019-03-12T20:15:00-04:00 America/New_York",
            "hisMode": "cov",
            "hisSize": "n:2403",
            "hisStart": "t:2017-01-01T00:00:00-05:00 America/New_York",
            "kind": "Bool",
            "navName": "Occupancy",
            "occupied": "m:",
            "point": "m:",
            "regionRef": "r:p:demo:r:23a44701-67faf4db Richmond",
            "sitePoint": "m:",
            "siteRef": "r:p:demo:r:23a44701-a89a6c66 Carytown",
            "sp": "m:",
            "tz": "America/New_York",
            "mod": "t:2018-12-12T22:24:01.716Z UTC"
        },
        {
            "id": "r:p:demo:r:23a44701-51b0b0ff Carytown ElecMeter-Main kWh",
            "cur": "m:",
            "curStatus": "ok",
            "curVal": "n:660.4029914145925 kWh",
            "disMacro": "$equipRef $navName",
            "energy": "m:",
            "equipRef": "r:p:demo:r:23a44701-092f16fa Carytown ElecMeter-Main",
            "his": "m:",
            "hisFunc": "elecKwToKwhHis",
            "hisInterval": "n:15 min",
            "hisMode": "sampled",
            "kind": "Number",
            "navName": "kWh",
            "point": "m:",
            "regionRef": "r:p:demo:r:23a44701-67faf4db Richmond",
            "sensor": "m:",
            "siteMeter": "m:",
            "siteRef": "r:p:demo:r:23a44701-a89a6c66 Carytown",
            "tz": "America/New_York",
            "unit": "kWh",
            "mod": "t:2018-12-12T22:24:01.719Z UTC"
        },
        {
            "id": "r:p:demo:r:23a44701-81534688 Carytown RTU-1 Cool-1",
            "cmd": "m:",
            "cool": "m:",
            "cur": "m:",
            "curStatus": "ok",
            "curVal": false,
            "disMacro": "$equipRef $navName",
            "elecMeterLoad": "r:p:demo:r:23a44701-092f16fa Carytown ElecMeter-Main",
            "enum": "off,on",
            "equipRef": "r:p:demo:r:23a44701-7265b064 Carytown RTU-1",
            "his": "m:",
            "hisEnd": "t:2019-03-12T00:00:00-04:00 America/New_York",
            "hisMode": "cov",
            "hisSize": "n:1787",
            "hisStart": "t:2017-01-01T00:00:00-05:00 America/New_York",
            "kind": "Bool",
            "navName": "Cool-1",
            "point": "m:",
            "regionRef": "r:p:demo:r:23a44701-67faf4db Richmond",
            "siteRef": "r:p:demo:r:23a44701-a89a6c66 Carytown",
            "stage": "n:1",
            "summary": "m:",
            "tz": "America/New_York",
            "mod": "t:2018-12-12T22:24:01.727Z UTC"
        },
        {
            "id": "r:p:demo:r:23a44701-cb53b843 Carytown Main Lights Status",
            "cmd": "m:",
            "costPerHour": "n:2.4 $",
            "cur": "m:",
            "curStatus": "ok",
            "curVal": true,
            "disMacro": "$equipRef $navName",
            "elecMeterLoad": "r:p:demo:r:23a44701-092f16fa Carytown ElecMeter-Main",
            "enum": "off,on",
            "equipRef": "r:p:demo:r:23a44701-cef6cd79 Carytown Main Lights",
            "his": "m:",
            "hisEnd": "t:2019-03-12T20:30:00-04:00 America/New_York",
            "hisMode": "cov",
            "hisSize": "n:2129",
            "hisStart": "t:2017-01-01T00:00:00-05:00 America/New_York",
            "kind": "Bool",
            "lights": "m:",
            "navName": "Status",
            "point": "m:",
            "regionRef": "r:p:demo:r:23a44701-67faf4db Richmond",
            "siteRef": "r:p:demo:r:23a44701-a89a6c66 Carytown",
            "tz": "America/New_York",
            "mod": "t:2018-12-12T22:24:01.722Z UTC"
        },
        {
            "id": "r:p:demo:r:23a44701-f8856742 Carytown RTU-1 Fan",
            "air": "m:",
            "cmd": "m:",
            "cur": "m:",
            "curStatus": "ok",
            "curVal": true,
            "disMacro": "$equipRef $navName",
            "discharge": "m:",
            "elecMeterLoad": "r:p:demo:r:23a44701-092f16fa Carytown ElecMeter-Main",
            "enum": "off,on",
            "equipRef": "r:p:demo:r:23a44701-7265b064 Carytown RTU-1",
            "fan": "m:",
            "his": "m:",
            "hisEnd": "t:2019-03-12T00:00:00-04:00 America/New_York",
            "hisMode": "cov",
            "hisSize": "n:2349",
            "hisStart": "t:2017-01-01T00:00:00-05:00 America/New_York",
            "kind": "Bool",
            "navName": "Fan",
            "point": "m:",
            "regionRef": "r:p:demo:r:23a44701-67faf4db Richmond",
            "siteRef": "r:p:demo:r:23a44701-a89a6c66 Carytown",
            "tz": "America/New_York",
            "mod": "t:2018-12-12T22:24:01.733Z UTC"
        },
        {
            "id": "r:p:demo:r:23a44701-7265b064 Carytown RTU-1",
            "ahu": "m:",
            "disMacro": "$siteRef $navName",
            "elecMeterLoad": "r:p:demo:r:23a44701-092f16fa Carytown ElecMeter-Main",
            "equip": "m:",
            "hvac": "m:",
            "navName": "RTU-1",
            "regionRef": "r:p:demo:r:23a44701-67faf4db Richmond",
            "rooftop": "m:",
            "siteRef": "r:p:demo:r:23a44701-a89a6c66 Carytown",
            "mod": "t:2018-12-12T22:24:01.723Z UTC"
        },
        {
            "id": "r:p:demo:r:23a44701-d83664ec Carytown RTU-1 OutsideDamper",
            "air": "m:",
            "cmd": "m:",
            "cur": "m:",
            "curStatus": "ok",
            "curVal": "n:3.543799363281579 %",
            "damper": "m:",
            "disMacro": "$equipRef $navName",
            "equipRef": "r:p:demo:r:23a44701-7265b064 Carytown RTU-1",
            "his": "m:",
            "hisEnd": "t:2019-03-12T23:45:00-04:00 America/New_York",
            "hisMode": "cov",
            "hisSize": "n:76884",
            "hisStart": "t:2017-01-01T00:00:00-05:00 America/New_York",
            "kind": "Number",
            "navName": "OutsideDamper",
            "outside": "m:",
            "point": "m:",
            "regionRef": "r:p:demo:r:23a44701-67faf4db Richmond",
            "siteRef": "r:p:demo:r:23a44701-a89a6c66 Carytown",
            "tz": "America/New_York",
            "unit": "%",
            "mod": "t:2018-12-12T22:24:01.726Z UTC"
        },
        {
            "id": "r:p:demo:r:23a44701-3f2eb151 Carytown RTU-1 ReturnTemp",
            "air": "m:",
            "cur": "m:",
            "curStatus": "ok",
            "curVal": "n:55.7279433164445 \u00b0F",
            "disMacro": "$equipRef $navName",
            "equipRef": "r:p:demo:r:23a44701-7265b064 Carytown RTU-1",
            "his": "m:",
            "hisEnd": "t:2019-03-12T23:45:00-04:00 America/New_York",
            "hisMode": "sampled",
            "hisSize": "n:76884",
            "hisStart": "t:2017-01-01T00:00:00-05:00 America/New_York",
            "kind": "Number",
            "navName": "ReturnTemp",
            "point": "m:",
            "regionRef": "r:p:demo:r:23a44701-67faf4db Richmond",
            "return": "m:",
            "sensor": "m:",
            "siteRef": "r:p:demo:r:23a44701-a89a6c66 Carytown",
            "temp": "m:",
            "tz": "America/New_York",
            "unit": "\u00b0F",
            "mod": "t:2018-12-12T22:24:01.731Z UTC"
        },
        {
            "id": "r:p:demo:r:23a44701-cef6cd79 Carytown Main Lights",
            "disMacro": "$siteRef $navName",
            "elecMeterLoad": "r:p:demo:r:23a44701-092f16fa Carytown ElecMeter-Main",
            "equip": "m:",
            "lightsGroup": "m:",
            "navName": "Main Lights",
            "regionRef": "r:p:demo:r:23a44701-67faf4db Richmond",
            "siteRef": "r:p:demo:r:23a44701-a89a6c66 Carytown",
            "mod": "t:2018-12-12T22:24:01.721Z UTC"
        }
    ]
}
`

repository: keigodasu/gohaystack

repo_name: keigodasu/gohaystack


text:
// Copyright 2021 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package health

import (
	"bytes"
	"context"
	"regexp"
	"strings"
	"time"

	"chromiumos/tast/common/testexec"
	"chromiumos/tast/errors"
	"chromiumos/tast/testing"
)

func init() {
	testing.AddTest(&testing.Test{
		Func:         MonitorThunderboltEvent,
		LacrosStatus: testing.LacrosVariantUnneeded,
		Desc:         "Monitors the Thunderbolt event detected properly or not",
		Contacts: []string{"pathan.jilani@intel.com",
			"cros-tdm-tpe-eng@google.com",
			"intel-chrome-system-automation-team@intel.com"},
		Attr:         []string{"group:mainline"},
		SoftwareDeps: []string{"chrome", "diagnostics"},
		Fixture:      "crosHealthdRunning",
	})
}

func MonitorThunderboltEvent(ctx context.Context, s *testing.State) {
	// Checking whether device supports thunderbolt or not.
	outFiles, err := testexec.CommandContext(ctx, "ls", "/sys/bus/thunderbolt/devices").Output()
	if err != nil {
		s.Log("Failed to execute ls /sys/bus/thunderbolt/devices/ command: ", err)
	}
	isThunderboltSupport := false
	requiredFiles := []string{"0-0", "1-0", "domain0", "domain1"}
	for _, file := range requiredFiles {
		if strings.Contains(string(outFiles), file) {
			isThunderboltSupport = true
		}
	}
	// Run monitor command in background.
	var stdoutBuf, stderrBuf bytes.Buffer
	monitorCmd := testexec.CommandContext(ctx, "cros-health-tool", "event", "--category=thunderbolt", "--length_seconds=10")
	monitorCmd.Stdout = &stdoutBuf
	monitorCmd.Stderr = &stderrBuf

	if err := monitorCmd.Start(); err != nil {
		s.Fatal("Failed to run healthd monitor command: ", err)
	}

	// Trigger Thunderbolt event.
	udevadmToggle := func(udevAction string) (string, error) {
		var stdout string
		if err := testing.Poll(ctx, func(ctx context.Context) error {
			if err := testexec.CommandContext(ctx, "udevadm", "trigger", "-s", "thunderbolt", "-c", udevAction).Run(); err != nil {
				return errors.Wrap(err, "failed to trigger thunderbolt add event")
			}
			stderr := string(stderrBuf.Bytes())
			if stderr != "" {
				return errors.New("failed to detect thunderbolt event, stderr")
			}

			stdout = string(stdoutBuf.Bytes())
			if !strings.Contains(stdout, udevAction) {
				return errors.New("failed to get command output")
			}
			return nil
		}, &testing.PollOptions{Timeout: 10 * time.Second}); err != nil {
			return "", errors.Wrapf(err, "failed to verify thunderbolt devices after %s", udevAction)
		}
		return stdout, nil
	}

	deviceAddedPattern := regexp.MustCompile("Device added")
	stdOut, err := udevadmToggle("add")
	if isThunderboltSupport {
		if !deviceAddedPattern.MatchString(stdOut) {
			s.Fatal("Failed to detect thunderbolt event, event output: ", err)
		}
	} else {
		if deviceAddedPattern.MatchString(stdOut) {
			s.Fatalf("Failed , thunderbolt event deteceted for non supported thunderbolt devices: %s ", stdOut)
		}
	}

	monitorCmd.Wait()
}

license_type: permissive

branch_name: refs/heads/main

extension: go


text:
# This example cover Object Oriented principles of BigBang such as objects,
# object extensions and constructors.

# Raw object.
let point = object
  public
  ref x
  ref y
end

# Other raw object.
let color = object
  public
  ref red
  ref green
  ref blue
end

# Object that composes both raw objects.
let coloredPoint = object
  include
    point
    color
end

# Same thing with classes.
class Point
  public
  ref x
  ref y

  fun constructor(x, y) =
    self.x = x
    self.y = y
  end
end

class Color
  public
  ref red
  ref blue
  ref green

  fun constructor(red, blue, green) =
    self.red   = red
    self.blue  = blue
    self.green = green
  end
end

class ColoredPoint
  public
  include Point
  include Color
end

let pointFromClass = Point:new(x = 2, y = 3)
pointFromClass:x # => 2
pointFromClass:y # => 3
pointFromClass:x = 4 # Updates field x to 4.

repository: JHU-PL-Lab/big-bang

repo_name: JHU-PL-Lab/big-bang

branch_name: refs/heads/master

gha_language: OCaml

extension: bb


text:
inherit allarch

DESCRIPTION = "NI Theme Set"
SECTION = "themes"
HOMEPAGE = "https://github.com/neutrino-images/ni-neutrino"
MAINTAINER = "NI-Team"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
"

SRC_URI = "git://github.com/neutrino-images/ni-neutrino.git;protocol=https"

PR = "r1"
SRCREV = "${AUTOREV}"
PV = "3.60-git-${SRCPV}"

S = "${WORKDIR}/git"

do_install () {
	install -d ${D}/var/tuxbox/themes
	install -m 644 ${S}/data/themes/Material*.theme ${D}/var/tuxbox/themes
	install -m 644 ${S}/data/themes/Adult*.theme ${D}/var/tuxbox/themes
	install -m 644 ${S}/data/themes/Dark*.theme ${D}/var/tuxbox/themes
}

repository: neutrino-hd/meta-neutrino

repo_name: neutrino-hd/meta-neutrino

branch_name: refs/heads/dunfell

gha_language: BitBake


text:
@article{yu2016market,
  title={Market dynamics and indirect network effects in electric vehicle diffusion},
  author={Yu, Zhe and Li, Shanjun and Tong, Lang},
  journal={Transportation Research Part D: Transport and Environment},
  volume={47},
  pages={336--356},
  year={2016},
  publisher={Elsevier}
}

license: MIT

extension: bib


text:
require nodejs4.inc

INC_PR = "r1"

LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=48a6cd99f7ddc587ef4da244477452dd"

SRC_URI[src.md5sum] = "97b2a3ff97a18745a402ba9fdd5da33d"
SRC_URI[src.sha256sum] = "febec3703a3fea9b64c46100a7b6a4408250027aa8259a2a815fd2275d502c49"

repository: billyjbryant/ops-build

repo_name: billyjbryant/ops-build

gha_license_id: NOASSERTION

gha_language: Python


text:
package ast

import (
	"io"

	"github.com/sirkon/protoast/ast/internal/liner"
	"github.com/sirkon/protoast/internal/errors"
)

var _ Node = &File{}

// File представление для файла
type File struct {
	unique

	Name    string
	Package string
	Syntax  string

	Imports    []*Import
	Types      []Type
	Extensions []*Extension
	Services   []*Service
	Options    []*Option

	GoPath string
	GoPkg  string
}

// Type поиск типа по имени.
func (f *File) Type(name string) Type {
	for _, typ := range f.Types {
		switch v := typ.(type) {
		case *Message:
			if v.Name == name {
				return v
			}
		case *Enum:
			if v.Name == name {
				return v
			}
		}
	}

	return nil
}

// Message поиск структуры по имени.
// Возвращает ошибку ErrorTypeNotFound если такой тип с таким именем не найден.
func (f *File) Message(name string) (*Message, error) {
	typ := f.Type(name)
	if typ == nil {
		return nil, ErrorTypeNotFound(name)
	}

	switch v := typ.(type) {
	case *Message:
		return v, nil
	default:
		return nil, unexpectedType(typ, &Message{})
	}
}

// Enum поиск перечисления по имени
// Возвращает ошибку ErrorTypeNotFound если такой тип с таким именем не найден.
func (f *File) Enum(name string) (*Enum, error) {
	typ := f.Type(name)
	if typ == nil {
		return nil, ErrorTypeNotFound(name)
	}

	switch v := typ.(type) {
	case *Enum:
		return v, nil
	default:
		return nil, unexpectedType(typ, &Enum{})
	}
}

// ScanTypes пробежка по типам данного пакета
func (f *File) ScanTypes(inspector func(typ Type) bool) {
	for _, typ := range f.Types {
		switch v := typ.(type) {
		case *Message:
			v.ScanTypes(inspector)
		default:
			inspector(typ)
		}
	}
}

// Service поиск сервиса по имени
func (f *File) Service(name string) *Service {
	for _, service := range f.Services {
		if service.Name == name {
			return service
		}
	}

	return nil
}

func (*File) node() {}

func (f *File) print(dest io.Writer, printer *Printer) error {
	l := liner.New(dest)
	l.Line(`syntax = "$"`, f.Syntax)
	l.Newl()
	l.Line("package $", f.Package)
	l.Newl()

	for _, imp := range f.Imports {
		printer.Plan(imp.File)
		l.Line(`import "$";`, imp.Path)
	}

	l.Newl()

	return nil
}

func unexpectedType(typ Type, expected Type) error {
	return errors.Newf("type is %T, not %T", typ, expected)
}

repository: sirkon/protoast

repo_name: sirkon/protoast

gha_license_id: MIT

gha_language: Go


text:
//! @file     winShell.cpp
//! @author   LiCode
//! @version  1.1.0.621
//! @date     2011/01/17
//! Copyright 2009-2010 LiCode's Union.

#include "EGEEngine.h"

//----------------------------------------------------------------------------
// winShellTaskbar Implementation
//----------------------------------------------------------------------------

winShellTaskbar::winShellTaskbar( )
{
	EGE_INIT( mData );
}

winShellTaskbar::~winShellTaskbar( )
{
	// Delete the tray icon
	if ( mData.hIcon != _null )
		::Shell_NotifyIconW( NIM_DELETE, &mData );
}

_ubool winShellTaskbar::AddIcon( IApplication* application, _dword item_id, _dword item_icon, WStringPtr tip_message )
{
	if ( application == _null )
		return _false;

	// We have already created it
	if ( mData.hIcon != _null )
		return _false;

	// Initialize the tray notification data
	mData.cbSize			= sizeof( NOTIFYICONDATAW );
	mData.uID				= item_id;
	mData.uFlags			= NIF_ICON | NIF_MESSAGE | NIF_TIP;
	mData.hIcon				= ::LoadIconW( ::GetModuleHandleA( _null ), MAKEINTRESOURCEW( item_icon ) );
	mData.hWnd				= (HWND) application->GetApplicationHandle( );
	mData.uCallbackMessage	= _EVENT_TRAY;
	SafeCopyString( mData.szTip, tip_message.Str( ) );

	// Add the tray icon
	if ( !::Shell_NotifyIconW( NIM_ADD, &mData ) )
		return _false;

	return _true;
}

//----------------------------------------------------------------------------
// winShell Implementation
//----------------------------------------------------------------------------

winShell::winShell( )
{
}

winShell::~winShell( )
{
}

_ubool winShell::Initialize( )
{
	return _true;
}

IShellTaskbar* winShell::GetTaskbar( )
{
	return &mTaskbar;
}

_ubool winShell::CreateFileLink( WStringPtr linktarget, WStringPtr workdir, WStringPtr linkpath, WStringPtr linkdesc, WStringPtr cmdline )
{
	//!	The shell link and persist file interface
	RefPtr< IShellLinkW >	shell_link;
	RefPtr< IPersistFile >	persist_file;

	// Get a pointer to the IShellLink interface
	if ( FAILED( ::CoCreateInstance( __uuidof( ShellLink ), _null, CLSCTX_INPROC_SERVER, __uuidof( ::IShellLink ), (_void**) &shell_link.GetRawRef( ) ) ) )
		return _false;

	// Query IShellLink for the IPersistFile interface
	if ( FAILED( shell_link->QueryInterface( __uuidof( IPersistFile ), (_void**) &persist_file.GetRawRef( ) ) ) )
		return _false;

	// Set the path to the shortcut target
	if ( FAILED( shell_link->SetPath( linktarget.Str( ) ) ) )
		return _false;

	// Set the command line of the shortcut target and add the description
	if ( FAILED( shell_link->SetArguments( cmdline.Str( ) ) ) )
		return _false;

	// Set the description of the shortcut target
	if ( FAILED( shell_link->SetDescription( linkdesc.Str( ) ) ) )
		return _false;

	// Set the working directory of the shortcut target
	if ( FAILED( shell_link->SetWorkingDirectory( workdir.Str( ) ) ) )
		return _false;

	// Save the file link
	if ( FAILED( persist_file->Save( linkpath.Str( ), _true ) ) )
		return _false;

	return _true;
}

repository: blockspacer/EasyGameEngine

repo_name: blockspacer/EasyGameEngine

extension: cpp


text:
#include <tastefulserver/HttpHeader.h>

#include <QStringList>
#include <QTextStream>

namespace tastefulserver {

NameValuePair::NameValuePair()
{
}

NameValuePair::NameValuePair(const QString & name, const QString & value)
    : m_name(name)
    , m_value(value)
{
}

const QString & NameValuePair::getName() const
{
    return m_name;
}

const QString & NameValuePair::getValue() const
{
    return m_value;
}

HttpHeaderElementParameter::HttpHeaderElementParameter()
{
}

HttpHeaderElementParameter::HttpHeaderElementParameter(const QString & name, const QString & value)
    : NameValuePair(name, value)
{
}

QString HttpHeaderElementParameter::toString() const
{
    QString string;
    QTextStream stream(&string);

    stream << m_name;
    if (!m_value.isEmpty())
    {
        stream << "=" << m_value;
    }

    return string;
}

HttpHeaderElementParameter HttpHeaderElementParameter::fromString(const QString & param)
{
    HttpHeaderElementParameter parameter;

    parameter.parse(param);

    return parameter;
}

void HttpHeaderElementParameter::parse(const QString & param)
{
    int pos = param.indexOf('=');

    if (pos<0)
    {
        m_name = param;
    }
    else
    {
        m_name = param.left(pos);
        m_value = stripQuotes(param.mid(pos + 1));
    }
}

QString HttpHeaderElementParameter::stripQuotes(const QString & string)
{
    if (string.startsWith('"') && string.endsWith('"'))
    {
        return string.mid(1, string.size() - 2);
    }

    return string;
}

HttpHeaderElement::HttpHeaderElement()
    : NameValuePair()
{
}

HttpHeaderElement::HttpHeaderElement(const QString & name, const QString & value)
    : NameValuePair(name, value)
{
}

HttpHeaderElement HttpHeaderElement::fromString(const QString & elementString)
{
    HttpHeaderElement element;

    element.parse(elementString);

    return element;
}

void HttpHeaderElement::parse(const QString & elementString)
{
    QStringList parts = elementString.split(';');
    HttpHeaderElementParameter me = HttpHeaderElementParameter::fromString(parts[0].trimmed());

    m_name = me.getName();
    m_value = me.getValue();
    for (int i = 1;i<parts.size();++i)
    {
        HttpHeaderElementParameter param = HttpHeaderElementParameter::fromString(parts[i].trimmed());
        m_parameters.insert(param.getName(), param);
    }
}

bool HttpHeaderElement::isSet(const QString & paramName) const
{
    return m_parameters.contains(paramName);
}

QString HttpHeaderElement::getParameter(const QString & paramName) const
{
    return m_parameters[paramName].getValue();
}

QList<HttpHeaderElementParameter> HttpHeaderElement::getParameters() const
{
    return m_parameters.values();
}

QString HttpHeaderElement::toString() const
{
    QString string;
    QTextStream stream(&string);

    stream << m_name;
    if (!m_value.isEmpty())
    {
        stream << "=" << m_value;
    }
    for (const HttpHeaderElementParameter & param : m_parameters)
    {
        stream << "; " << param.toString();
    }

    return string;
}

HttpHeaderValue::HttpHeaderValue()
    : m_modified(false)
{
}

HttpHeaderValue::HttpHeaderValue(const QString & value)
    : m_value(value)
    , m_modified(false)
{
}

HttpHeaderElement HttpHeaderValue::getElement() const
{
    parseElementsIfNecessary();

    return m_elements.first();
}

QList<HttpHeaderElement> HttpHeaderValue::getElements() const
{
    parseElementsIfNecessary();

    return m_elements;
}

bool HttpHeaderValue::isValid() const
{
    return !toString().isEmpty();
}

void HttpHeaderValue::merge(const QList<HttpHeaderElement> & newElements)
{
    parseElementsIfNecessary();
    if (!newElements.isEmpty())
    {
        m_elements.append(newElements);
        m_modified = true;
    }
}

QString HttpHeaderValue::toString() const
{
    if (m_modified)
    {
        QString string;
        QTextStream stream(&string);

        for (int i = 0;i<m_elements.size();++i)
        {
            if (i>0)
            {
                stream << ", ";
            }
            stream << m_elements[i].toString();
        }

        return string;
    }

    return m_value;
}

void HttpHeaderValue::parseElementsIfNecessary() const
{
    if (m_elements.isEmpty())
    {
        QStringList parts = m_value.split(',');
        for (QString & part : parts)
        {
            m_elements << HttpHeaderElement::fromString(part);
        }
    }
}

HttpHeader::HttpHeader()
{
}

HttpHeader::HttpHeader(const QString & name, const QString & value)
    : m_name(name)
    , m_value(value)
{
}

QString HttpHeader::getName() const
{
    return m_name;
}

QString HttpHeader::getValue() const
{
    return m_value.toString();
}

void HttpHeader::setValue(const QString & value)
{
    m_value = value;
}

bool HttpHeader::isValid() const
{
    return !m_name.isEmpty() && m_value.isValid();
}

bool HttpHeader::merge(const HttpHeader & header)
{
    if (m_name!=header.getName())
    {
        return false;
    }
    m_value.merge(header.getElements());

    return true;
}

HttpHeaderElement HttpHeader::getElement() const
{
    return m_value.getElement();
}

QList<HttpHeaderElement> HttpHeader::getElements() const
{
    return m_value.getElements();
}

QString HttpHeader::toString() const
{
    QString string;
    QTextStream stream(&string);

    stream << m_name << ": " << m_value.toString();

    return string;
}

HttpHeader HttpHeader::forName(const QString & name)
{
    return HttpHeader(name, QString());
}

HttpHeader HttpHeader::fromString(const QString & headerString)
{
    HttpHeader header;

    header.parse(headerString);

    return header;
}

void HttpHeader::parse(const QString & headerString)
{
    int pos = headerString.indexOf(':');

    if (pos<0)
    {
        return;
    }
    m_name = headerString.left(pos);
    m_value = headerString.mid(pos + 1).trimmed();
}

} // namespace tastefulserver

repository: halybang/tastefulserver

repo_name: halybang/tastefulserver


text:
#include "outputcommand.h"

#include <hemeradevelopermodeapplicationoutput.h>
#include <hemeradevelopermodeemulator.h>
#include <hemeradevelopermodedevice.h>
#include <hemeradevelopermodetargetmanager.h>

#include <QtCore/QDebug>
#include <QtCore/QJsonObject>
#include <QtCore/QTimer>

#include <iostream>

OutputCommand::OutputCommand(QObject *parent)
    : BaseCommand(parent)
    , m_emulatorOption(QStringList() << "e" << "emulator", tr("Choose a specific emulator"), "emulator")
    , m_deviceOption(QStringList() << "d" << "device", tr("Choose a specific Hemera Device."), "device")
{
}

QString OutputCommand::briefDescription()
{
    return tr("Print output of a running Hemera application.");
}

QString OutputCommand::longDescription()
{
    return tr("Print output of a running Hemera application.");
}

QString OutputCommand::name()
{
    return "output";
}

bool OutputCommand::parseAndExecute(QCommandLineParser *parser, const QStringList &arguments)
{
    QStringList positionalArguments = parser->positionalArguments();
    if (positionalArguments.size() < 1) {
        printErrorAndExit("Missing required parameters. Use --help flag for usage info.");
        return false;
    }
    if (positionalArguments.size() > 1) {
        printErrorAndExit("Too much parameters. Use --help flag for usage info.");
        return false;
    }

    QString applicationId = positionalArguments.at(0);

    // Load the target
    Hemera::DeveloperMode::Target::Ptr target = loadTarget(parser, m_emulatorOption, m_deviceOption, true);

    if (target.isNull()) {
        return false;
    }

    // FIXME HACK WTF: Without this, either the server or the client gets the same fd and goes totally nuts.
    QEventLoop e;
    QTimer::singleShot(200, &e, SLOT(quit()));
    e.exec();

    // Application output!
    Hemera::DeveloperMode::ApplicationOutput *applicationOutput = new Hemera::DeveloperMode::ApplicationOutput(target, applicationId, this);
    connect(applicationOutput, &Hemera::DeveloperMode::ApplicationOutput::newMessage, [this] (const QDateTime &timestamp, const QJsonObject &message) {
        std::cout << "[" << timestamp.toString().toStdString() << "] " << message.value(QStringLiteral("message")).toString().toStdString() << std::endl;
    });

    return true;
}

void OutputCommand::setupParser(QCommandLineParser* parser, const QStringList& arguments)
{
    Q_UNUSED(arguments);

    parser->addOption(m_deviceOption);
    parser->addOption(m_emulatorOption);
    parser->addPositionalArgument("application_id", tr("ID of the Application to monitor."));
}

repository: hemeraos/hemera-developer-mode-client

repo_name: hemeraos/hemera-developer-mode-client


text:
@article{gurriet2019stabilization,
  title={Stabilization of Exoskeletons through Active Ankle Compensation},
  author={Gurriet, Thomas and Tucker, Maegan and Kann, Claudia and Boeris, Guilhem and Ames, Aaron D},
  journal={arXiv preprint arXiv:1909.11848},
  year={2019},
  pdf={https://arxiv.org/pdf/1909.11848.pdf},
  arxiv={1909.11848},
  bibtex_show=true,
  preview={ankle-stabilization.gif},
  video={https://vimeo.com/320903442},
  category={Locomotion}
}

@article{gurriet2019towards,
  title={Towards variable assistance for lower body exoskeletons},
  author={Gurriet, Thomas and Tucker, Maegan and Duburcq, Alexis and Boeris, Guilhem and Ames, Aaron D},
  journal={IEEE Robotics and Automation Letters},
  volume={5},
  number={1},
  pages={266--273},
  year={2019},
  publisher={IEEE},
  pdf={https://arxiv.org/abs/1909.11188},
  arXiv={1909.11188},
  bibtex_show=true,
  video={https://www.youtube.com/watch?v=UJC5j4BFxyo},
  preview={variable-assistance.gif},
  category={Rehab.}
}

@inproceedings{tucker2020human,
  title={Human preference-based learning for high-dimensional optimization of exoskeleton walking gaits},
  author={Tucker, Maegan and Cheng, Myra and Novoseller, Ellen and Cheng, Richard and Yue, Yisong and Burdick, Joel W and Ames, Aaron D},
  booktitle={2020 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS)},
  pages={3423--3430},
  year={2020},
  organization={IEEE},
  pdf={https://arxiv.org/pdf/2003.06495},
  arXiv={2003.06495},
  bibtex_show=true,
  code={https://github.com/myracheng/linecospar},
  video={https://youtu.be/c6a0kXMyML0},
  preview={pbl-highdim.gif},
  category={HRI}
}

@inproceedings{li2021roial,
  title={{ROIAL}: Region of interest active learning for characterizing exoskeleton gait preference landscapes},
  author={Li, Kejun and Tucker, Maegan and B{\i}y{\i}k, Erdem and Novoseller, Ellen and Burdick, Joel W and Sui, Yanan and Sadigh, Dorsa and Yue, Yisong and Ames, Aaron D},
  booktitle={2021 IEEE International Conference on Robotics and Automation (ICRA)},
  pages={3212--3218},
  year={2021},
  organization={IEEE},
  pdf={https://arxiv.org/pdf/2011.04812},
  arXiv={2011.04812},
  bibtex_show=true,
  video={https://youtu.be/04lMJmKmZrQ},
  preview={roial.gif},
  category={HRI}
}

@inproceedings{tucker2021preference,
  title={Preference-based learning for user-guided {HZD} gait generation on bipedal walking robots},
  author={Tucker, Maegan and Csomay-Shanklin, Noel and Ma, Wen-Loong and Ames, Aaron D},
  booktitle={2021 IEEE International Conference on Robotics and Automation (ICRA)},
  pages={2804--2810},
  year={2021},
  organization={IEEE},
  pdf={https://arxiv.org/pdf/2011.05424},
  arXiv={2011.05424},
  bibtex_show=true,
  code={https://github.com/maegant/ICRA2021-LearningHZD},
  video={https://youtu.be/rLJ-m65F6C4yo},
  preview={pbl-hzd.gif},
  selected={true},
  category={HRI}
}

@inproceedings{tucker2020preference,
  title={Preference-based learning for exoskeleton gait optimization},
  author={Tucker, Maegan and Novoseller, Ellen and Kann, Claudia and Sui, Yanan and Yue, Yisong and Burdick, Joel W and Ames, Aaron D},
  booktitle={2020 IEEE international conference on robotics and automation (ICRA)},
  pages={2351--2357},
  year={2020},
  organization={IEEE},
  pdf={https://arxiv.org/abs/1909.12316},
  arXiv={1909.12316},
  bibtex_show=true,
  code={https://github.com/ernovoseller/CoSpar},
  video={https://www.youtube.com/watch?v=-27sHXsvONE&t=4s},
  preview={pbl1.gif},
  selected={true},
  category={HRI}
}

@misc{tucker2021real,
  title={Real-time feedback module for assistive gait training, improved proprioception, and fall prevention},
  author={Tucker, Maegan and Ames, Aaron D},
  year={2021},
  month=jan # "~28",
  note={US Patent App. 16/938,654},
  pdf={https://patentimages.storage.googleapis.com/fe/3a/8e/4df97ac4847b4f/US20210027877A1.pdf},
  preview={tilt-gif.gif},
  category={Rehab.}
}

@inproceedings{csomay2022learning,
  title={Learning controller gains on bipedal walking robots via user preferences},
  author={Csomay-Shanklin, Noel and Tucker, Maegan and Dai, Min and Reher, Jenna and Ames, Aaron D},
  booktitle={2022 International Conference on Robotics and Automation (ICRA)},
  pages={10405--10411},
  year={2022},
  organization={IEEE},
  pdf={https://arxiv.org/pdf/2102.13201},
  arXiv={2102.13201},
  bibtex_show=true,
  video={https://youtu.be/jMX5a_6Xcuw},
  preview={learning-cassie.gif},
  category={Locomotion}
}

@article{kerdraon2021evaluation,
  title={Evaluation of safety and performance of the self balancing walking system Atalante in patients with complete motor spinal cord injury},
  author={Kerdraon, Jacques and Previnaire, Jean Gabriel and Tucker, Maegan and Coignard, Pauline and Allegre, Willy and Knappen, Emmanuel and Ames, Aaron},
  journal={Spinal Cord Series and Cases},
  volume={7},
  number={1},
  pages={1--8},
  year={2021},
  publisher={Nature Publishing Group},
  pdf={https://rdcu.be/cr3Lc},
  bibtex_show=true,
  preview={spinal-crop.png},
  category={Rehab.}
}

@article{li2022natural,
  title={Natural Multicontact Walking for Robotic Assistive Devices via Musculoskeletal Models and Hybrid Zero Dynamics},
  author={Li, Kejun and Tucker, Maegan and Gehlhar, Rachel and Yue, Yisong and Ames, Aaron D},
  journal={IEEE Robotics and Automation Letters},
  volume={7},
  number={2},
  pages={4283--4290},
  year={2022},
  publisher={IEEE},
  pdf={https://arxiv.org/pdf/2109.05113},
  arXiv={2109.05113},
  bibtex_show=true,
  video={https://youtu.be/gOhZlTypNIs},
  preview={muscle-model.gif},
  category={Locomotion}
}

@inproceedings{cosner2022safety,
  title={Safety-Aware Preference-Based Learning for Safety-Critical Control},
  author={Cosner, Ryan and Tucker, Maegan and Taylor, Andrew and Li, Kejun and Molnar, Tamas and Ubelacker, Wyatt and Alan, Anil and Orosz, G{\'a}bor and Yue, Yisong and Ames, Aaron},
  booktitle={Learning for Dynamics and Control Conference},
  pages={1020--1033},
  year={2022},
  organization={PMLR},
  pdf={https://arxiv.org/pdf/2112.08516},
  arXiv={2112.08516},
  bibtex_show=true,
  video={https://youtu.be/QEuwRDTG7TE},
  preview={learning-safety.gif},
  category={HRI}
}

@article{tucker2022robust,
  title={Robust Locomotion: Leveraging Saltation Matrices for Gait Optimization},
  author={Tucker, Maegan and Csomay-Shanklin, Noel and Ames, Aaron D},
  journal={arXiv preprint arXiv:2209.10452},
  year={2022},
  pdf={https://arxiv.org/pdf/2209.10452},
  arXiv={2209.10452},
  bibtex_show=true,
  video={https://youtu.be/BZu-9UStG2E},
  preview={robust-saltation.gif},
  selected={true},
  category={Locomotion}
}

gha_language: HTML


text:
@article{chib1995understanding,
  title={Understanding the metropolis-hastings algorithm},
  author={Chib, Siddhartha and Greenberg, Edward},
  journal={The american statistician},
  volume={49},
  number={4},
  pages={327--335},
  year={1995},
  publisher={Taylor \& Francis Group},
  doi={10.1080/00031305.1995.10476177}
}

@article{javid2018physical,
  title={Physical modelling of galaxy clusters detected by the Planck satellite},
  author={Javid, Kamran and Olamaie, Malak and Perrott, Yvette C and Carvalho, Pedro and Grainge, Keith JB and Hobson, Michael P and Rumsey, Clare and Saunders, Richard DE},
  journal={Monthly Notices of the Royal Astronomical Society},
  volume={483},
  number={3},
  pages={3529--3544},
  year={2018},
  publisher={Oxford University Press},
  doi={10.1093/mnras/sty3115}
}

@article{javid2018comparison,
  title={Comparison of physical and observational galaxy cluster modelling},
  author={Javid, Kamran and Perrott, Yvette C and Hobson, Michael P and Olamaie, Malak and Rumsey, Clare and Saunders, Richard DE},
  journal={arXiv preprint arXiv:1805.01968},
  year={2018},
  doi={10.17863/CAM.38865}
}

@article{perrott2019sunyaev,
  title={Sunyaev--Zel’dovich profile fitting with joint AMI-Planck analysis},
  author={Perrott, Yvette C and Javid, Kamran and Carvalho, Pedro and Elwood, Patrick J and Hobson, Michael P and Lasenby, Anthony N and Olamaie, Malak and Saunders, Richard DE},
  journal={Monthly Notices of the Royal Astronomical Society},
  volume={486},
  number={2},
  pages={2116--2128},
  year={2019},
  publisher={Oxford University Press},
  doi={10.1093/mnras/stz826}
}

@article{javid2019nested,
  title={Nested sampling on non-trivial geometries},
  author={Javid, Kamran},
  journal={arXiv preprint arXiv:1905.09110},
  year={2019},
  doi={10.5281/zenodo.3627542}
}

@phdthesis{javid2019physical,
  title={Physical modelling of galaxy clusters and Bayesian inference in astrophysics},
  author={Javid, Kamran},
  year={2019},
  school={University of Cambridge},
  doi={10.17863/CAM.40616}
}

@article{javid2019physical2,
  title={Physical modelling of galaxy cluster Sunyaev--Zel’dovich data using Einasto dark matter profiles},
  author={Javid, Kamran and Perrott, Yvette C and Rumsey, Clare and Saunders, Richard DE},
  journal={Monthly Notices of the Royal Astronomical Society},
  volume={489},
  number={3},
  pages={3135--3148},
  year={2019},
  publisher={Oxford University Press},
  doi={10.1093/mnras/stz2341}
}

@article{feroz2009bayesian,
  title={Bayesian modelling of clusters of galaxies from multifrequency-pointed Sunyaev--Zel'dovich observations},
  author={Feroz, Farhan and Hobson, Michael P and Zwart, Jonathan TL and Saunders, Richard DE and Grainge, Keith JB},
  journal={Monthly Notices of the Royal Astronomical Society},
  volume={398},
  number={4},
  pages={2049--2060},
  year={2009},
  publisher={Blackwell Publishing Ltd Oxford, UK},
  doi={10.1111/j.1365-2966.2009.15247.x}
}

@article{feroz2009multinest,
  title={MultiNest: an efficient and robust Bayesian inference tool for cosmology and particle physics},
  author={Feroz, F and Hobson, MP and Bridges, M},
  journal={Monthly Notices of the Royal Astronomical Society},
  volume={398},
  number={4},
  pages={1601--1614},
  year={2009},
  publisher={Blackwell Publishing Ltd Oxford, UK},
  doi={10.1111/j.1365-2966.2009.14548.x}
}

@article{skilling2006nested,
  title={Nested sampling for general Bayesian computation},
  author={Skilling, John and others},
  journal={Bayesian analysis},
  volume={1},
  number={4},
  pages={833--859},
  year={2006},
  publisher={International Society for Bayesian Analysis},
  doi={10.1214/06-BA127}
}

@article{handley2015polychord,
  title={POLYCHORD: next-generation nested sampling},
  author={Handley, WJ and Hobson, MP and Lasenby, AN},
  journal={Monthly Notices of the Royal Astronomical Society},
  volume={453},
  number={4},
  pages={4384--4398},
  year={2015},
  publisher={Oxford University Press},
  doi={10.1093/mnras/stv1911}
}

@article{handley2015polychord,
  title={PolyChord: nested sampling for cosmology},
  author={Handley, WJ and Hobson, MP and Lasenby, AN},
  journal={Monthly Notices of the Royal Astronomical Society: Letters},
  volume={450},
  number={1},
  pages={L61--L65},
  year={2015},
  publisher={Oxford University Press},
  doi={10.1093/mnrasl/slv047}
}

@article{feroz2008multimodal,
  title={Multimodal nested sampling: an efficient and robust alternative to Markov Chain Monte Carlo methods for astronomical data analyses},
  author={Feroz, Farhan and Hobson, Mike P},
  journal={Monthly Notices of the Royal Astronomical Society},
  volume={384},
  number={2},
  pages={449--463},
  year={2008},
  publisher={Blackwell Publishing Ltd Oxford, UK},
  doi={10.1111/j.1365-2966.2007.12353.x}
}
@article{hickish2018digital,
  title={A digital correlator upgrade for the Arcminute MicroKelvin Imager},
  author={Hickish, Jack and Razavi-Ghods, Nima and Perrott, Yvette C and Titterington, David J and Carey, Steve H and Scott, Paul F and Grainge, Keith JB and Scaife, Anna MM and Alexander, Paul and Saunders, Richard DE and others},
  journal={Monthly Notices of the Royal Astronomical Society},
  volume={475},
  number={4},
  pages={5677--5687},
  year={2018},
  publisher={Oxford University Press},
  doi={10.1093/mnras/sty074}
}


text:
// Copyright 2016-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"). You may
// not use this file except in compliance with the License. A copy of the
// License is located at
//
//     http://aws.amazon.com/apache2.0/
//
// or in the "license" file accompanying this file. This file is distributed
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
// express or implied. See the License for the specific language governing
// permissions and limitations under the License.

package spotitn_test

import (
	"net/http"
	"net/http/httptest"
	"strings"
	"testing"

	"github.com/aws/aws-node-termination-handler/pkg/ec2metadata"
	"github.com/aws/aws-node-termination-handler/pkg/monitor"
	"github.com/aws/aws-node-termination-handler/pkg/monitor/spotitn"
	h "github.com/aws/aws-node-termination-handler/pkg/test"
)

const (
	startTime        = "2017-09-18T08:22:00Z"
	expFormattedTime = "2017-09-18 08:22:00 +0000 UTC"
	imdsV2TokenPath  = "/latest/api/token"
	nodeName         = "test-node"
)

var instanceActionResponse = []byte(`{
	"action": "terminate",
	"time":"` + startTime + `"
}`)

func TestMonitor_Success(t *testing.T) {
	var requestPath string = ec2metadata.SpotInstanceActionPath

	server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
		if imdsV2TokenPath == req.URL.String() {
			rw.WriteHeader(403)
			return
		}
		h.Equals(t, req.URL.String(), requestPath)
		_, err := rw.Write(instanceActionResponse)
		h.Ok(t, err)
	}))
	defer server.Close()

	drainChan := make(chan monitor.InterruptionEvent)
	cancelChan := make(chan monitor.InterruptionEvent)
	imds := ec2metadata.New(server.URL, 1)

	go func() {
		result := <-drainChan
		h.Equals(t, monitor.SpotITNKind, result.Kind)
		h.Equals(t, spotitn.SpotITNMonitorKind, result.Monitor)
		h.Equals(t, expFormattedTime, result.StartTime.String())
		h.Assert(t, strings.Contains(result.Description, startTime),
			"Expected description to contain: "+startTime+" but is actually: "+result.Description)
	}()

	spotITNMonitor := spotitn.NewSpotInterruptionMonitor(imds, drainChan, cancelChan, nodeName)
	err := spotITNMonitor.Monitor()
	h.Ok(t, err)
}

func TestMonitor_MetadataParseFailure(t *testing.T) {
	server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
		if imdsV2TokenPath == req.URL.String() {
			rw.WriteHeader(403)
			return
		}
	}))
	defer server.Close()

	drainChan := make(chan monitor.InterruptionEvent)
	cancelChan := make(chan monitor.InterruptionEvent)
	imds := ec2metadata.New(server.URL, 1)
	nodeName := "test-node"

	spotITNMonitor := spotitn.NewSpotInterruptionMonitor(imds, drainChan, cancelChan, nodeName)
	err := spotITNMonitor.Monitor()
	h.Assert(t, err != nil, "Failed to return error metadata parse fails")
}

func TestMonitor_404Response(t *testing.T) {
	var requestPath string = ec2metadata.SpotInstanceActionPath

	server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
		if imdsV2TokenPath == req.URL.String() {
			rw.WriteHeader(403)
			return
		}
		h.Equals(t, req.URL.String(), requestPath)
		http.Error(rw, "error", http.StatusNotFound)
	}))
	defer server.Close()

	drainChan := make(chan monitor.InterruptionEvent)
	cancelChan := make(chan monitor.InterruptionEvent)
	imds := ec2metadata.New(server.URL, 1)
	nodeName := "test-node"

	spotITNMonitor := spotitn.NewSpotInterruptionMonitor(imds, drainChan, cancelChan, nodeName)
	err := spotITNMonitor.Monitor()
	h.Ok(t, err)
}

func TestMonitor_500Response(t *testing.T) {
	var requestPath string = ec2metadata.SpotInstanceActionPath

	server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
		if imdsV2TokenPath == req.URL.String() {
			rw.WriteHeader(403)
			return
		}
		h.Equals(t, req.URL.String(), requestPath)
		http.Error(rw, "error", http.StatusInternalServerError)
	}))
	defer server.Close()

	drainChan := make(chan monitor.InterruptionEvent)
	cancelChan := make(chan monitor.InterruptionEvent)
	imds := ec2metadata.New(server.URL, 1)
	nodeName := "test-node"

	spotITNMonitor := spotitn.NewSpotInterruptionMonitor(imds, drainChan, cancelChan, nodeName)
	err := spotITNMonitor.Monitor()
	h.Assert(t, err != nil, "Failed to return error when 500 response")
}

func TestMonitor_InstanceActionDecodeFailure(t *testing.T) {
	var requestPath string = ec2metadata.SpotInstanceActionPath

	server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
		if imdsV2TokenPath == req.URL.String() {
			rw.WriteHeader(403)
			return
		}
		h.Equals(t, req.URL.String(), requestPath)
		_, err := rw.Write([]byte{0x7f})
		h.Ok(t, err)
	}))
	defer server.Close()

	drainChan := make(chan monitor.InterruptionEvent)
	cancelChan := make(chan monitor.InterruptionEvent)
	imds := ec2metadata.New(server.URL, 1)
	nodeName := "test-node"

	spotITNMonitor := spotitn.NewSpotInterruptionMonitor(imds, drainChan, cancelChan, nodeName)
	err := spotITNMonitor.Monitor()
	h.Assert(t, err != nil, "Failed to return error when failed to decode instance action")
}

func TestMonitor_TimeParseFailure(t *testing.T) {
	var requestPath string = ec2metadata.SpotInstanceActionPath

	server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
		if imdsV2TokenPath == req.URL.String() {
			rw.WriteHeader(403)
			return
		}
		h.Equals(t, req.URL.String(), requestPath)
		_, err := rw.Write([]byte(`{"time": ""}`))
		h.Ok(t, err)
	}))
	defer server.Close()

	drainChan := make(chan monitor.InterruptionEvent)
	cancelChan := make(chan monitor.InterruptionEvent)
	imds := ec2metadata.New(server.URL, 1)
	nodeName := "test-node"

	spotITNMonitor := spotitn.NewSpotInterruptionMonitor(imds, drainChan, cancelChan, nodeName)
	err := spotITNMonitor.Monitor()
	h.Assert(t, err != nil, "Failed to return error when failed to parse time")
}

repository: aws/aws-node-termination-handler

repo_name: aws/aws-node-termination-handler


text:
% This is the bibliography file
% See	 http://en.wikibooks.org/wiki/LaTeX/Bibliography_Management#BibTeX

% Google Scholar has a very handy 'Import into BibTeX' link.
% Just find the paper you want on Google Scholar, then click 'Cite'

@unpublished{lectureslides,
    author    = "Abbas Edalat",
    title     = "Hopfield Networks",
    year     = "2012",
    note     = "Part of Complex Systems course at Imperial College London",
}
,
@article{storkey1999basins,
  title={The basins of attraction of a new {Hopfield} learning rule},
  author={Storkey, A.J. and Valabregue, R.},
  journal={Neural Networks},
  volume={12},
  number={6},
  pages={869--876},
  year={1999},
  publisher={Elsevier}
}
,
@article{net_model_neuroses,
  title={Generalized memory associativity in a network model for the neuroses},
  author={Wedemann, R.S. and Donangelo, R. and de Carvalho, L.A.V.},
  journal={Chaos: An Interdisciplinary Journal of Nonlinear Science},
  volume={19},
  number={1},
  pages={015116--015116},
  year={2009},
  publisher={American Institute of Physics}
}
,
@misc{website:attachment_theory_wiki,
  author = "Wikipedia",
  title = "Attachment Theory",
  url = "http://en.wikipedia.org/wiki/Attachment_theory"
}
,
@misc{website:attachment_patterns_wiki,
  author = "Wikipedia",
  title = "Attachment Patterns",
  url = "http://en.wikipedia.org/wiki/Attachment_theory#Attachment_patterns"
}
,
@article{nets_parkinsons,
  title={Diagnosing parkinson by using artificial neural networks and support vector machines},
  author={Gil, D. and Manuel, D.J.},
  journal={Global Journal of Computer Science and Technology},
  volume={9},
  number={4},
  year={2009}
}
,
@article{hopfield_laferriere,
  title="Hopfield Network",
  author="Alice Julien Lafferiere"
}
,
@article{speech_nets,
  title={Context-Dependent Pre-Trained Deep Neural Networks for Large-Vocabulary Speech Recognition},
  author={Dahl, G.E. and Yu, D. and Deng, L. and Acero, A.},
  journal={Audio, Speech, and Language Processing, IEEE Transactions on},
  volume={20},
  number={1},
  pages={30--42},
  year={2012},
  publisher={IEEE}
}
,
@article{hopfield_wiki,
  title ="Hopfield Network",
  author ="Wikipedia",
  url = "http://en.wikipedia.org/wiki/Hopfield_network"
}
,
@article{hebb_wiki,
  title ="Hebbian Theory",
  author ="Wikipedia",
  url = "http://en.wikipedia.org/wiki/Hebbian_theory"
}
,
@article{storkey1997increasing,
  title={Increasing the capacity of a Hopfield network without sacrificing functionality},
  author={Storkey, A.},
  journal={Artificial Neural Networks—ICANN'97},
  pages={451--456},
  year={1997},
  publisher={Springer}
}
,
@unpublished{federico,
  title={Modelling Attachment Types with Hopfield Neural Network},
  author={Federico Mancinelli},
  year={2012},
  note={Master Thesys for Computing, Imperial College}
}
,
@article{louradour2011classification,
  title={Classification of sets using restricted Boltzmann machines},
  author={Louradour, J. and Larochelle, H.},
  journal={arXiv preprint arXiv:1103.4896},
  year={2011}
}
,
@article{teh2001rate,
  title={Rate-coded restricted Boltzmann machines for face recognition},
  author={Teh, Y.W. and Hinton, G.E.},
  journal={Advances in neural information processing systems},
  pages={908--914},
  year={2001},
  publisher={MIT; 1998}
}
,
@inproceedings{nair2010rectified,
  title={Rectified linear units improve restricted boltzmann machines},
  author={Nair, V. and Hinton, G.E.},
  booktitle={Proc. 27th International Conference on Machine Learning},
  pages={807--814},
  year={2010},
  organization={Omnipress Madison, WI}
}
,
@inproceedings{larochelle2008classification,
  title={Classification using discriminative restricted Boltzmann machines},
  author={Larochelle, H. and Bengio, Y.},
  booktitle={Proceedings of the 25th international conference on Machine learning},
  pages={536--543},
  year={2008},
  organization={ACM}
}
,
@article{hinton2010practical,
  title={A practical guide to training restricted Boltzmann machines},
  author={Hinton, G.},
  journal={Momentum},
  volume={9},
  pages={1},
  year={2010}
}

repository: imperialhopfield/hopfield

repo_name: imperialhopfield/hopfield


text:
# Copyright (c) 2020, Perseus authors
#
# 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:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
# Author: Sergey Sharybin (sergey.vfx@gmail.com)

# Remove all given compiler flags from all flavors of settings: including both
# C and C++ languages and all configurations.
macro(remove_cc_flags flags)
  foreach(flag ${ARGV})
    string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
    string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
    string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
    string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}")
    string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")

    string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
    string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
    string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
    string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}")
    string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
  endforeach()
  unset(flag)
endmacro()

# Add single compiler flag to corresponding language.
macro(add_c_flag flag)
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
endmacro()
macro(add_cxx_flag flag)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
endmacro()

# Add single compiler flag to all languages.
macro(add_cc_flag flag)
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
endmacro()

# Remove all strict flags which are desired for own codebase but which generates
# a lot of warnings (possible treated as errors) in third party source code.
macro(remove_strict_flags)
  if(CMAKE_COMPILER_IS_GNUCC)
    remove_cc_flags(
      "-Wdouble-promotion"
      "-Wstrict-prototypes"
      "-Wmissing-prototypes"
      "-Wmissing-declarations"
      "-Wmissing-format-attribute"
      "-Wunused-local-typedefs"
      "-Wunused-macros"
      "-Wunused-parameter"
      "-Wunused-function"
      "-Wwrite-strings"
      "-Wredundant-decls"
      "-Wundef"
      "-Wshadow"
      "-Wdouble-promotion"
      "-Wold-style-definition"
      "-Wdeprecated"
      "-Werror=[^ ]+"
      "-Werror"
    )
    # Negate flags implied by '-Wall'.
    add_cc_flag("${CC_CANCEL_STRICT_FLAGS}")
    add_cxx_flag("${CXX_CANCEL_STRICT_FLAGS}")
  elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
    remove_cc_flags(
      "-Wmissing-prototypes"
      "-Wmissing-declarations"
      "-Wdouble-promotion"
      "-Wunused-parameter"
      "-Wunused-variable"
      "-Wimplicit-fallthrough"
      "-Wdeprecated"
      "-Werror=[^ ]+"
      "-Werror"
      "-Wundef"
    )
    # Negate flags implied by '-Wall'.
    add_cc_flag("${CC_CANCEL_STRICT_FLAGS}")
    add_cxx_flag("${CXX_CANCEL_STRICT_FLAGS}")
  elseif(MSVC)
    remove_cc_flags(
      # Remove both since it's unsafe to only remove /WX as it would leave
      # dangling "-" if there is "/WX-".
      # Rely on the default which does not treat warnings as errors.
      "/WX-"
      "/WX"

      "/W1"
      "/W2"
      "/W3"
      "/W4"
      "/Wall"
    )

    # Collect all flags in a single list.
    set(_extra_msvc_flags
      # Warning C4312: 'operation' : conversion from 'type1' to 'type2'
      #                of greater size.
      /wd4312
    )
    add_cc_flag("${_extra_msvc_flags}")
    unset(_extra_msvc_flags)
  endif()
endmacro()

function(add_c_flag_if_supported
    C_FLAGS_VAR
    FLAG_TO_ADD_IF_SUPPORTED)
  include(CheckCCompilerFlag)
  # Use of whitespace or '-' in variable names (used by CheckCSourceCompiles
  # as #defines) will trigger errors.
  string(STRIP "${FLAG_TO_ADD_IF_SUPPORTED}" FLAG_TO_ADD_IF_SUPPORTED)
  # Build an informatively named test result variable so that it will be evident
  # which tests were performed/succeeded in the CMake output, e.g for -Wall:
  #
  # -- Performing Test CHECK_C_FLAG_Wall - Success
  #
  # NOTE: This variable is also used to cache test result.
  string(REPLACE "-" "_" CHECK_C_FLAG "CHECK_C_FLAG${FLAG_TO_ADD_IF_SUPPORTED}")
  check_c_compiler_flag(${FLAG_TO_ADD_IF_SUPPORTED} ${CHECK_C_FLAG})
  if(${CHECK_C_FLAG})
    set(${C_FLAGS_VAR}
      "${${C_FLAGS_VAR}} ${FLAG_TO_ADD_IF_SUPPORTED}" PARENT_SCOPE)
  endif()
endfunction()

function(add_cxx_flag_if_supported
    CXX_FLAGS_VAR
    FLAG_TO_ADD_IF_SUPPORTED)
  include(CheckCXXCompilerFlag)
  # Use of whitespace or '-' in variable names (used by CheckCXXSourceCompiles
  # as #defines) will trigger errors.
  string(STRIP "${FLAG_TO_ADD_IF_SUPPORTED}" FLAG_TO_ADD_IF_SUPPORTED)
  # Build an informatively named test result variable so that it will be evident
  # which tests were performed/succeeded in the CMake output, e.g for -Wall:
  #
  # -- Performing Test CHECK_CXX_FLAG_Wall - Success
  #
  # NOTE: This variable is also used to cache test result.
  string(REPLACE "-" "_" CHECK_CXX_FLAG
    "CHECK_CXX_FLAG${FLAG_TO_ADD_IF_SUPPORTED}")
  check_cxx_compiler_flag(${FLAG_TO_ADD_IF_SUPPORTED} ${CHECK_CXX_FLAG})
  if(${CHECK_CXX_FLAG})
    set(${CXX_FLAGS_VAR}
      "${${CXX_FLAGS_VAR}} ${FLAG_TO_ADD_IF_SUPPORTED}" PARENT_SCOPE)
  endif()
endfunction()

# Backup of compiler flags is used to temporarily override these flags and then
# restore to theit previous state. This is used to discard strict compiler
# flags when dealing with find_package() with an external code, which might do
# try_compile() and geenrate warnings during test compile.
#
# NOTE: Nested backup is not supported.

macro(backup_compiler_flags)
  set(__CMAKE_C_FLAGS_BACKUP "${CMAKE_C_FLAGS}")
  set(__CMAKE_CXX_FLAGS_BACKUP "${CMAKE_CXX_FLAGS}")
endmacro()

macro(restore_compiler_flags)
  set(CMAKE_C_FLAGS "${__CMAKE_C_FLAGS_BACKUP}")
  set(CMAKE_CXX_FLAGS "${__CMAKE_CXX_FLAGS_BACKUP}")
  unset(__CMAKE_C_FLAGS_BACKUP)
  unset(__CMAKE_CXX_FLAGS_BACKUP)
endmacro()

repository: sergeyvfx/GPSDOMonitor

repo_name: sergeyvfx/GPSDOMonitor

extension: cmake


text:
/*
Copyright 2017 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package preflight

import (
	"testing"

	"github.com/pkg/errors"

	utilsexec "k8s.io/utils/exec"
	fakeexec "k8s.io/utils/exec/testing"
)

func TestGetKubeletVersion(t *testing.T) {
	cases := []struct {
		output   string
		expected string
		err      error
		valid    bool
	}{
		{"Kubernetes v1.7.0", "1.7.0", nil, true},
		{"Kubernetes v1.8.0-alpha.2.1231+afabd012389d53a", "1.8.0-alpha.2.1231+afabd012389d53a", nil, true},
		{"Kubernetes v1.8.0-alpha.2.1231+afabd012389d53a ", "1.8.0-alpha.2.1231+afabd012389d53a", nil, true},
		{" Kubernetes v1.8.0-alpha.2.1231+afabd012389d53a", "1.8.0-alpha.2.1231+afabd012389d53a", nil, true},
		{"Kubernetes  v1.8.0-alpha.2.1231+afabd012389d53a", "", nil, false},
		{"something-invalid", "", nil, false},
		{"command not found", "", errors.New("kubelet not found"), false},
		{"", "", nil, false},
	}

	for _, tc := range cases {
		t.Run(tc.output, func(t *testing.T) {
			fcmd := fakeexec.FakeCmd{
				OutputScript: []fakeexec.FakeAction{
					func() ([]byte, []byte, error) { return []byte(tc.output), nil, tc.err },
				},
			}
			fexec := &fakeexec.FakeExec{
				CommandScript: []fakeexec.FakeCommandAction{
					func(cmd string, args ...string) utilsexec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) },
				},
			}
			ver, err := GetKubeletVersion(fexec)
			switch {
			case err != nil && tc.valid:
				t.Errorf("GetKubeletVersion: unexpected error for %q. Error: %v", tc.output, err)
			case err == nil && !tc.valid:
				t.Errorf("GetKubeletVersion: error expected for key %q, but result is %q", tc.output, ver)
			case ver != nil && ver.String() != tc.expected:
				t.Errorf("GetKubeletVersion: unexpected version result for key %q. Expected: %q Actual: %q", tc.output, tc.expected, ver)
			}
		})
	}
}

repository: kubernetes/kubernetes

repo_name: kubernetes/kubernetes


text:
// Copyright 2021 - 2022 Matrix Origin
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//	http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package plan

import (
	"context"
	"github.com/matrixorigin/matrixone/pkg/sql/parsers"
	"github.com/matrixorigin/matrixone/pkg/sql/parsers/dialect"
	"github.com/matrixorigin/matrixone/pkg/sql/parsers/tree"
	"github.com/stretchr/testify/require"
	"testing"
)

func TestSplitRecursiveMember(t *testing.T) {
	sql := "with recursive c as (select a from t1 union all select a+1 from c where a < 3 union all select a+1 from c where a < 4) select * from c"
	stmts, err := parsers.Parse(context.TODO(), dialect.MYSQL, sql, 1)
	if err != nil {
		t.Errorf("Parse(%q) err: %v", sql, err)
		return
	}
	c := stmts[0].(*tree.Select).With.CTEs[0]
	name := string(c.Name.Alias)
	stmt := c.Stmt.(*tree.Select).Select
	b := &QueryBuilder{}

	var ss []tree.SelectStatement
	left, err := b.splitRecursiveMember(&stmt, name, &ss)
	if err != nil {
		t.Errorf("splitRecursiveMember err: %v", err)
		return
	}

	require.Equal(t, 2, len(ss))
	require.Equal(t, true, left != nil)
}

repository: matrixorigin/matrixone

repo_name: matrixorigin/matrixone


text:
SUMMARRY = "Snappy"
DESCRIPTION = "Snappy, a fast compressor/decompressor."

SRC_URI = "git://github.com/google/snappy.git"
SRCREV = "2d99bd14d471664758e4dfdf81b44f413a7353fd"

LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://${S}/COPYING;md5=f62f3080324a97b3159a7a7e61812d0c"

S = "${WORKDIR}/git"

inherit autotools pkgconfig

repository: gustavsl/meta-opencl

repo_name: gustavsl/meta-opencl


text:
// Copyright 2021 Antrea Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Code generated by client-gen. DO NOT EDIT.

package fake

import (
	"context"

	v1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1"
	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	labels "k8s.io/apimachinery/pkg/labels"
	schema "k8s.io/apimachinery/pkg/runtime/schema"
	types "k8s.io/apimachinery/pkg/types"
	watch "k8s.io/apimachinery/pkg/watch"
	testing "k8s.io/client-go/testing"
)

// FakeClusterInfoImports implements ClusterInfoImportInterface
type FakeClusterInfoImports struct {
	Fake *FakeMulticlusterV1alpha1
	ns   string
}

var clusterinfoimportsResource = schema.GroupVersionResource{Group: "multicluster.crd.antrea.io", Version: "v1alpha1", Resource: "clusterinfoimports"}

var clusterinfoimportsKind = schema.GroupVersionKind{Group: "multicluster.crd.antrea.io", Version: "v1alpha1", Kind: "ClusterInfoImport"}

// Get takes name of the clusterInfoImport, and returns the corresponding clusterInfoImport object, and an error if there is any.
func (c *FakeClusterInfoImports) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterInfoImport, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewGetAction(clusterinfoimportsResource, c.ns, name), &v1alpha1.ClusterInfoImport{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha1.ClusterInfoImport), err
}

// List takes label and field selectors, and returns the list of ClusterInfoImports that match those selectors.
func (c *FakeClusterInfoImports) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterInfoImportList, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewListAction(clusterinfoimportsResource, clusterinfoimportsKind, c.ns, opts), &v1alpha1.ClusterInfoImportList{})

	if obj == nil {
		return nil, err
	}

	label, _, _ := testing.ExtractFromListOptions(opts)
	if label == nil {
		label = labels.Everything()
	}
	list := &v1alpha1.ClusterInfoImportList{ListMeta: obj.(*v1alpha1.ClusterInfoImportList).ListMeta}
	for _, item := range obj.(*v1alpha1.ClusterInfoImportList).Items {
		if label.Matches(labels.Set(item.Labels)) {
			list.Items = append(list.Items, item)
		}
	}
	return list, err
}

// Watch returns a watch.Interface that watches the requested clusterInfoImports.
func (c *FakeClusterInfoImports) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
	return c.Fake.
		InvokesWatch(testing.NewWatchAction(clusterinfoimportsResource, c.ns, opts))

}

// Create takes the representation of a clusterInfoImport and creates it.  Returns the server's representation of the clusterInfoImport, and an error, if there is any.
func (c *FakeClusterInfoImports) Create(ctx context.Context, clusterInfoImport *v1alpha1.ClusterInfoImport, opts v1.CreateOptions) (result *v1alpha1.ClusterInfoImport, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewCreateAction(clusterinfoimportsResource, c.ns, clusterInfoImport), &v1alpha1.ClusterInfoImport{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha1.ClusterInfoImport), err
}

// Update takes the representation of a clusterInfoImport and updates it. Returns the server's representation of the clusterInfoImport, and an error, if there is any.
func (c *FakeClusterInfoImports) Update(ctx context.Context, clusterInfoImport *v1alpha1.ClusterInfoImport, opts v1.UpdateOptions) (result *v1alpha1.ClusterInfoImport, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewUpdateAction(clusterinfoimportsResource, c.ns, clusterInfoImport), &v1alpha1.ClusterInfoImport{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha1.ClusterInfoImport), err
}

// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeClusterInfoImports) UpdateStatus(ctx context.Context, clusterInfoImport *v1alpha1.ClusterInfoImport, opts v1.UpdateOptions) (*v1alpha1.ClusterInfoImport, error) {
	obj, err := c.Fake.
		Invokes(testing.NewUpdateSubresourceAction(clusterinfoimportsResource, "status", c.ns, clusterInfoImport), &v1alpha1.ClusterInfoImport{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha1.ClusterInfoImport), err
}

// Delete takes name of the clusterInfoImport and deletes it. Returns an error if one occurs.
func (c *FakeClusterInfoImports) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewDeleteActionWithOptions(clusterinfoimportsResource, c.ns, name, opts), &v1alpha1.ClusterInfoImport{})

	return err
}

// DeleteCollection deletes a collection of objects.
func (c *FakeClusterInfoImports) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
	action := testing.NewDeleteCollectionAction(clusterinfoimportsResource, c.ns, listOpts)

	_, err := c.Fake.Invokes(action, &v1alpha1.ClusterInfoImportList{})
	return err
}

// Patch applies the patch and returns the patched clusterInfoImport.
func (c *FakeClusterInfoImports) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterInfoImport, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewPatchSubresourceAction(clusterinfoimportsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ClusterInfoImport{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha1.ClusterInfoImport), err
}

repository: tnqn/antrea

repo_name: tnqn/antrea