text:
" width="0.127" layer="51"/>
<wire x1="1" y1="-0.625" x2="1" y2="0.625" width="0.127" layer="51"/>
<wire x1="-1" y1="0.625" x2="-0.5" y2="0.625" width="0.127" layer="51"/>
<wire x1="-1" y1="-0.625" x2="-0.5" y2="-0.625" width="0.127" layer="51"/>
<wire x1="0.5" y1="-0.625" x2="1" y2="-0.625" width="0.127" layer="51"/>
<wire x1="0.5" y1="0.625" x2="1" y2="0.625" width="0.127" layer="51"/>
<wire x1="-1.65" y1="0.9" x2="1.65" y2="0.9" width="0.127" layer="39"/>
<wire x1="1.65" y1="0.9" x2="1.65" y2="-0.9" width="0.127" layer="39"/>
<wire x1="-1.65" y1="-0.9" x2="-1.65" y2="0.9" width="0.127" layer="39"/>
<text x="-1.5" y="1.4" size="0.4064" layer="25">>NAME</text>
<text x="-1.5" y="-1.8" size="0.4064" layer="27">>VALUE</text>
<wire x1="-0.5" y1="0.625" x2="0.5" y2="0.625" width="0.127" layer="21"/>
<wire x1="-1.65" y1="-0.9" x2="1.65" y2="-0.9" width="0.127" layer="39"/>
<wire x1="-0.5" y1="-0.625" x2="0.5" y2="-0.625" width="0.127" layer="21"/>
</package>
</packages>
</library>
<library name="60312202111527_Eagle_WR-SMA_rev19a">
<description>
Wurth Elektronik - Connectors - Coaxial Connectors - WR-SMA

      &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;

      -----

      -----

      -----

      -----

      -----

      ---------------------------

WE

      ---------------------------
Würth Elektronik

      ---------O---

      ----O--------

      ---------O---

      ----O--------

      ---------O---

      &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;

    &nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;More than you expect

Würth Elektronik eiSos GmbH & Co. KG

EMC & Inductive Solutions

Max-Eyth-Str.1

D-74638 Waldenburg

Tel: +49 (0)7942-945-0

Fax:+49 (0)7942-945-5000

www.we-online.com/eagle

libraries@we-online.com

Neither Autodesk nor Würth Elektronik eiSos does warrant that this library is error-free or

that it meets your specific requirements.

Please contact us for more information.

Eagle Version 9, Library Revision 2019a, 2019-11-07

Copyright: Würth Elektronik</description>
<packages>
<package name="60312202114509">
<description>WR-SMA PCB End Launch Jack Round Post 1.6 mm</description>
<smd name="2" x="-4.125" y="0" dx="5.6" dy="1.65" layer="1" rot="R90"/>
<smd name="1" x="0" y="0" dx="5.6" dy="0.9" layer="1" rot="R90"/>
<smd name="3" x="4.125" y="0" dx="5.6" dy="1.65" layer="1" rot="R90"/>
<smd name="4" x="-4.125" y="0" dx="5.6" dy="1.65" layer="16" rot="R90"/>
<smd name="5" x="4.125" y="0" dx="5.6" dy="1.65" layer="16" rot="R90"/>
<wire x1="-4.76" y1="2.58" x2="4.76" y2="2.58" width="0.1" layer="51"/>
<wire x1="4.76" y1="2.58" x2="4.76" y2="-2.8" width="0.1" layer="51"/>
<wire x1="4.76" y1="-2.8" x2="4.76" y2="-4.07" width="0.1" layer="51" style="shortdash"/>
<wire x1="3.175" y1="-11.69" x2="-3.175" y2="-11.69" width="0.1" layer="51" style="shortdash"/>
<wire x1="-4.76" y1="-4.07" x2="-4.76" y2="-2.8" width="0.1" layer="51" style="shortdash"/>
<wire x1="-4.76" y1="-2.8" x2="-4.76" y2="2.58" width="0.1" layer="51"/>
<wire x1="-4.76" y1="-2.8" x2="4.76" y2="-2.8" width="0.1" layer="51"/>
<wire x1="-4.76" y1="-4.07" x2="-3.175" y2="-4.07" width="0.1" layer="51" style="shortdash"/>
<wire x1="3.175" y1="-4.07" x2="4.76" y2="-4.07" width="0.1" layer="51" style="shortdash"/>
<wire x1="-3.175" y1="-4.07" x2="-3.175" y2="-11.69" width="0.1" layer="51" style="shortdash"/>
<wire x1="3.175" y1="-4.07" x2="3.175" y2="-11.69" width="0.1" layer="51" style="shortdash"/>
<wire x1="-1.4" y1="-3.4" x2="-1.4" y2="-2.9" width="0.05" layer="48" style="shortdash"/>
<wire x1="-1.4" y1="-2.9" x2="-1.6" y2="-3.1" width="0.05" layer="48" style="shortdash"/>
<wire x1="-1.4" y1="-2.9" x2="-1.2" y2="-3.1" width="0.05" layer="48" style="shortdash"/>
<text x="6.3" y="0" size="1.27" layer="27">>VALUE</text>
<text x="0" y="4" size="1.27" layer="25" align="bottom-center">>NAME</text>
<text x="-2.3" y="-4.3" size="0.8128" layer="48">PCB End</text>
<text x="-2.1" y="-4.9" size="0.3048" layer="48">PCB Thincness 1.6mm</text>
<polygon width="0.1" layer="39">
<vertex x="-5.2" y="3.1"/>
<vertex x="5.2" y="3.1"/>
<vertex x="5.2" y="-3.1"/>
<vertex x="-5.2" y="-3.1"/>
</polygon>
</package>
</packages>
</library>
</libraries>
<attributes>
</attributes>
<variantdefs>
</variantdefs>
<classes>
<class number="0" name="default" width="0" drill="0">
</class>
</classes>
<designrules name="default *">
<description language="de">EAGLE Design Rules

Die Standard-Design-Rules sind so gewählt, dass sie für
die meisten Anwendungen passen. Sollte ihre Platine
besondere Anforderungen haben, treffen Sie die erforderlichen
Einstellungen hier und speichern die Design Rules unter
einem neuen Namen ab.</description>
<description language="en">EAGLE Design Rules

The default Design Rules have been set to cover
a wide range of applications. Your particular design
may have different requirements, so please make the
necessary adjustments and save your customized
design rules under a new name.</description>
<param name="layerSetup" value="(1*16)"/>
<param name="mtCopper" value="0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm"/>
<param name="mtIsolate" value="1.5mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm"/>
<param name="mdWireWire" value="0.15mm"/>
<param name="mdWirePad" value="0.15mm"/>
<param name="mdWireVia" value="0.15mm"/>
<param name="mdPadPad" value="0.15mm"/>
<param name="mdPadVia" value="0.15mm"/>
<param name="mdViaVia" value="0.15mm"/>
<param name="mdSmdPad" value="0.15mm"/>
<param name="mdSmdVia" value="0.15mm"/>
<param name="mdSmdSmd" value="0.15mm"/>
<param name="mdViaViaSameLayer" value="8mil"/>
<param name="mnLayersViaInSmd" value="2"/>
<param name="mdCopperDimension" value="0.6mm"/>
<param name="mdDrill" value="8mil"/>
<param name="mdSmdStop" value="0mil"/>
<param name="msWidth" value="0.2mm"/>
<param name="msDrill" value="0.3mm"/>
<param name="msMicroVia" value="9.99mm"/>
<param name="msBlindViaRatio" value="0.5"/>
<param name="rvPadTop" value="0.25"/>
<param name="rvPadInner" value="0.25"/>
<param name="rvPadBottom" value="0.25"/>
<param name="rvViaOuter" value="0.25"/>
<param name="rvViaInner" value="0.25"/>
<param name="rvMicroViaOuter" value="0.25"/>
<param name="rvMicroViaInner" value="0.25"/>
<param name="rlMinPadTop" value="10mil"/>
<param name="rlMaxPadTop" value="20mil"/>
<param name="rlMinPadInner" value="10mil"/>
<param name="rlMaxPadInner" value="20mil"/>
<param name="rlMinPadBottom" value="10mil"/>
<param name="rlMaxPadBottom" value="20mil"/>
<param name="rlMinViaOuter" value="8mil"/>
<param name="rlMaxViaOuter" value="20mil"/>
<param name="rlMinViaInner" value="8mil"/>
<param name="rlMaxViaInner" value="20mil"/>
<param name="rlMinMicroViaOuter" value="4mil"/>
<param name="rlMaxMicroViaOuter" value="20mil"/>
<param name="rlMinMicroViaInner" value="4mil"/>
<param name="rlMaxMicroViaInner" value="20mil"/>
<param name="psTop" value="-1"/>
<param name="psBottom" value="-1"/>
<param name="psFirst" value="-1"/>
<param name="psElongationLong" value="100"/>
<param name="psElongationOffset" value="100"/>
<param name="mvStopFrame" value="1"/>
<param name="mvCreamFrame" value="0"/>
<param name="mlMinStopFrame" value="4mil"/>
<param name="mlMaxStopFrame" value="4mil"/>
<param name="mlMinCreamFrame" value="0mil"/>
<param name="mlMaxCreamFrame" value="0mil"/>
<param name="mlViaStopLimit" value="0mil"/>
<param name="srRoundness" value="0"/>
<param name="srMinRoundness" value="0mil"/>
<param name="srMaxRoundness" value="0mil"/>
<param name="slThermalIsolate" value="10mil"/>
<param name="slThermalsForVias" value="0"/>
<param name="dpMaxLengthDifference" value="10mm"/>
<param name="dpGapFactor" value="2.5"/>
<param name="checkGrid" value="0"/>
<param name="checkAngle" value="0"/>
<param name="checkFont" value="1"/>
<param name="checkRestrict" value="1"/>
<param name="useDiameter" value="13"/>
<param name="maxErrors" value="50"/>
</designrules>
<autorouter>
<pass name="Default">
<param name="RoutingGrid" value="50mil"/>
<param name="tpViaShape" value="round"/>
<param name="PrefDir.1" value="|"/>
<param name="PrefDir.2" value="0"/>
<param name="PrefDir.3" value="0"/>
<param name="PrefDir.4" value="0"/>
<param name="PrefDir.5" value="0"/>
<param name="PrefDir.6" value="0"/>
<param name="PrefDir.7" value="0"/>
<param name="PrefDir.8" value="0"/>
<param name="PrefDir.9" value="0"/>
<param name="PrefDir.10" value="0"/>
<param name="PrefDir.11" value="0"/>
<param name="PrefDir.12" value="0"/>
<param name="PrefDir.13" value="0"/>
<param name="PrefDir.14" value="0"/>
<param name="PrefDir.15" value="0"/>
<param name="PrefDir.16" value="-"/>
<param name="cfVia" value="8"/>
<param name="cfNonPref" value="5"/>
<param name="cfChangeDir" value="2"/>
<param name="cfOrthStep" value="2"/>
<param name="cfDiagStep" value="3"/>
<param name="cfExtdStep" value="0"/>
<param name="cfBonusStep" value="1"/>
<param name="cfMalusStep" value="1"/>
<param name="cfPadImpact" value="4"/>
<param name="cfSmdImpact" value="4"/>
<param name="cfBusImpact" value="0"/>
<param name="cfHugging" value="3"/>
<param name="cfAvoid" value="4"/>
<param name="cfPolygon" value="10"/>
<param name="cfBase.1" value="0"/>
<param name="cfBase.2" value="1"/>
<param name="cfBase.3" value="1"/>
<param name="cfBase.4" value="1"/>
<param name="cfBase.5" value="1"/>
<param name="cfBase.6" value="1"/>
<param name="cfBase.7" value="1"/>
<param name="cfBase.8" value="1"/>
<param name="cfBase.9" value="1"/>
<param name="cfBase.10" value="1"/>
<param name="cfBase.11" value="1"/>
<param name="cfBase.12" value="1"/>
<param name="cfBase.13" value="1"/>
<param name="cfBase.14" value="1"/>
<param name="cfBase.15" value="1"/>
<param name="cfBase.16" value="0"/>
<param name="mnVias" value="20"/>
<param name="mnSegments" value="9999"/>
<param name="mnExtdSteps" value="9999"/>
<param name="mnRipupLevel" value="10"/>
<param name="mnRipupSteps" value="100"/>
<param name="mnRipupTotal" value="100"/>
</pass>
<pass name="Follow-me" refer="Default" active="yes">
</pass>
<pass name="Busses" refer="Default" active="yes">
<param name="cfNonPref" value="4"/>
<param name="cfBusImpact" value="4"/>
<param name="cfHugging" value="0"/>
<param name="mnVias" value="0"/>
</pass>
<pass name="Route" refer="Default" active="yes">
</pass>
<pass name="Optimize1" refer="Default" active="yes">
<param name="cfVia" value="99"/>
<param name="cfExtdStep" value="10"/>
<param name="cfHugging" value="1"/>
<param name="mnExtdSteps" value="1"/>
<param name="mnRipupLevel" value="0"/>
</pass>
<pass name="Optimize2" refer="Optimize1" active="yes">
<param name="cfNonPref" value="0"/>
<param name="cfChangeDir" value="6"/>
<param name="cfExtdStep" value="0"/>
<param name="cfBonusStep" value="2"/>
<param name="cfMalusStep" value="2"/>
<param name="cfPadImpact" value="2"/>
<param name="cfSmdImpact" value="2"/>
<param name="cfHugging" value="0"/>
</pass>
<pass name="Optimize3" refer="Optimize2" active="yes">
<param name="cfChangeDir" value="8"/>
<param name="cfPadImpact" value="0"/>
<param name="cfSmdImpact" value="0"/>
</pass>
<pass name="Optimize4" refer="Optimize3" active="yes">
<param name="cfChangeDir" value="25"/>
</pass>
</autorouter>
<elements>
<element name="TP1" library="testpad" package="B2,54" value="TPB2,54" x="13.91" y="17.16" smashed="yes">
<attribute name="TP_SIGNAL_NAME" value="" x="12.64" y="13.985" size="1" layer="37"/>
<attribute name="VALUE" x="12.64" y="15.763" size="0.0254" layer="27"/>
</element>
<element name="C11" library="Eagle_Wurth_Elektronik_Passive_Capacitors_rev15a" package="WCAP-CSGP_0805_REFLOW" value="1N4148" x="81.67" y="16.09" smashed="yes" rot="R90">
<attribute name="VALUE" x="83.47" y="14.59" size="0.4064" layer="27" rot="R90"/>
</element>
<element name="C13" library="Eagle_Wurth_Elektronik_Passive_Capacitors_rev15a" package="WCAP-CSGP_0805_REFLOW" value="1N4148" x="83.335" y="14.025" smashed="yes" rot="R90">
<attribute name="VALUE" x="85.135" y="12.525" size="0.4064" layer="27" rot="R90"/>
</element>
<element name="J1" library="60312202111527_Eagle_WR-SMA_rev19a" package="60312202114509" value="" x="88.005" y="15.105" smashed="yes" rot="R90">
<attribute name="GENDER" value="Jack" x="88.005" y="15.105" size="1.778" layer="27" rot="R90" display="off"/>
<attribute name="MOUNT" value="End Launch" x="88.005" y="15.105" size="1.778" layer="27" rot="R90" display="off"/>
<attribute name="PART-NUMBER" value="60312202114509" x="88.005" y="15.105" size="1.778" layer="27" rot="R90" display="off"/>
<attribute name="Z" value="50Ohm" x="88.005" y="15.105" size="1.778" layer="27" rot="R90" display="off"/>
<attribute name="ORIENTATION-TYPE" value="Straight" x="88.005" y="15.105" size="1.778" layer="27" rot="R90" display="off"/>
<attribute name="INTERFACE" value="MIL-STD-348" x="88.005" y="15.105" size="1.778" layer="27" rot="R90" display="off"/>
<attribute name="DATASHEET-URL" value="https://katalog.we-online.com/em/datasheet/60312202114509.pdf" x="88.005" y="15.105" size="1.778" layer="27" rot="R90" display="off"/>
<attribute name="VALUE" x="88.005" y="21.405" size="1.27" layer="27" rot="R90"/>
</element>
</elements>
<signals>
<signal name="GND">
<polygon width="0.4064" layer="1" isolate="0.3">
<vertex x="10" y="35"/>
<vertex x="10" y="-2"/>
<vertex x="90.555" y="-1.86"/>
<vertex x="90.465" y="35.24"/>
</polygon>
<polygon width="0.4064" layer="16" isolate="0.3">
<vertex x="10" y="35"/>
<vertex x="10" y="-2"/>
<vertex x="91.01" y="-2.11"/>
<vertex x="90.51" y="32.39"/>
<vertex x="90.18" y="35.18"/>
</polygon>
<contactref element="TP1" pad="TP"/>
<wire x1="84.27" y1="14.995" x2="74.3" y2="15" width="1.27" layer="1"/>
<wire x1="74.3" y1="15" x2="40.5" y2="15" width="1.27" layer="1"/>
<wire x1="40.5" y1="15" x2="26.55" y2="1.85" width="1.27" layer="1" curve="-92"/>
<wire x1="26.55" y1="1.85" x2="14" y2="17" width="1.27" layer="1" curve="-96"/>
<wire x1="14" y1="17" x2="13.91" y2="17" width="0.4064" layer="1"/>
<wire x1="13.91" y1="17" x2="13.91" y2="17.16" width="0.4064" layer="1"/>
<via x="12.2" y="13.9" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="12.4" y="12.2" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="12.8" y="10.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="13.3" y="9.1" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="14" y="7.7" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="14.9" y="6.4" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="16" y="5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="17.3" y="3.8" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="18.7" y="2.7" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="20.1" y="1.9" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="21.6" y="1.2" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="23.1" y="0.7" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="24.6" y="0.4" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="26.2" y="0.2" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="27.8" y="0.2" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="29.6" y="0.4" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="31.4" y="0.8" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="32.9" y="1.3" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="34.5" y="2" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="35.9" y="2.9" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="37.2" y="3.9" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="15.5" y="13.9" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="15.8" y="12.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="16.2" y="10.9" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="17" y="9.4" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="18" y="7.9" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="19.1" y="6.7" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="20.3" y="5.7" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="21.6" y="4.8" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="23.1" y="4.2" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="24.5" y="3.7" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="26" y="3.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="27.7" y="3.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="29.3" y="3.7" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="30.9" y="4.1" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="32.5" y="4.8" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="34" y="5.8" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="35.4" y="7" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="38.5" y="5.2" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="36.5" y="8.4" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="39.6" y="6.8" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="37.4" y="9.9" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="40.5" y="8.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="38.1" y="11.6" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="38.5" y="13.4" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="38.7" y="15.3" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="38.6" y="17.4" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="41.5" y="10.3" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="42.1" y="11.9" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="42.4" y="13.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="15.6" y="16.2" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="15.8" y="17.4" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="15.8" y="18.7" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="14.5" y="19.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="12.7" y="19.3" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="12" y="16.2" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="12.2" y="17.7" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="40.3" y="17" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="42.3" y="16.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="41.5" y="19" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="37.9" y="19.3" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="37" y="20.9" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="41.1" y="20.6" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="35.9" y="22.4" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="34.7" y="23.7" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="33.2" y="24.8" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="31.7" y="25.7" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="30.1" y="26.3" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="28.5" y="26.6" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="26.7" y="26.7" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="25" y="26.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="23.4" y="26.1" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="21.9" y="25.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="20.5" y="24.6" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="19.1" y="23.7" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="18" y="22.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="17" y="21.1" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="16.4" y="19.9" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="13.3" y="20.7" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="14" y="22.2" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="14.8" y="23.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="15.6" y="24.7" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="16.6" y="25.8" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="17.8" y="26.8" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="19" y="27.7" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="20.5" y="28.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="22" y="29.2" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="23.6" y="29.7" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="25.3" y="30" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="26.8" y="30.2" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="28.3" y="30.1" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="29.8" y="29.9" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="31.3" y="29.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="32.8" y="29" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="34.1" y="28.4" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="35.4" y="27.7" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="36.5" y="26.9" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="37.6" y="25.9" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="38.6" y="24.8" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="39.5" y="23.6" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="40.3" y="22.4" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="44" y="13.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="45.7" y="13.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="47.4" y="13.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="49.2" y="13.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="51.1" y="13.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="52.7" y="13.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="54.4" y="13.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="56.1" y="13.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="57.8" y="13.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="52.9" y="16.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="44.1" y="16.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="45.9" y="16.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="47.6" y="16.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="49.5" y="16.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="51.3" y="16.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="54.6" y="16.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="59.4" y="13.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="61" y="13.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="62.6" y="13.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="64.3" y="13.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="66" y="13.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="67.7" y="13.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="69.4" y="13.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="71.1" y="13.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="72.7" y="13.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="74.185" y="13.515" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="75.67" y="13.485" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="56.2" y="16.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="57.8" y="16.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="59.5" y="16.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="61.2" y="16.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="63" y="16.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="64.9" y="16.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="66.5" y="16.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="68.2" y="16.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="69.9" y="16.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="71.455" y="16.495" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="73.095" y="16.505" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="74.8" y="16.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="76.4" y="16.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="83.38" y="16.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="85.12" y="16.52" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="85.18" y="13.515" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="79.555" y="16.5" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="77.93" y="16.51" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="83.335" y="11.84" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="79.93" y="13.505" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="81.4" y="13.52" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="81.71" y="18.23" extent="1-16" drill="0.4" diameter="0.4064"/>
<via x="78.51" y="13.47" extent="1-16" drill="0.4" diameter="0.4064"/>
<wire x1="13.9" y1="17.2" x2="15.5" y2="17.2" width="0.8" layer="1"/>
<wire x1="13.9" y1="17.2" x2="13.9" y2="18.9" width="0.8" layer="1"/>
<wire x1="13.9" y1="17.2" x2="12.2" y2="17.2" width="0.8" layer="1"/>
<wire x1="13.91" y1="17.16" x2="13.91" y2="17.19" width="0.4064" layer="1"/>
<wire x1="13.91" y1="17.19" x2="13.9" y2="17.2" width="0.4064" layer="1"/>
<contactref element="C11" pad="1"/>
<contactref element="C13" pad="2"/>
<contactref element="C11" pad="2"/>
<contactref element="C13" pad="1"/>
<wire x1="81.67" y1="15.14" x2="83.335" y2="14.975" width="0.3048" layer="1"/>
<wire x1="83.335" y1="14.975" x2="74.25" y2="15.05" width="0.3048" layer="1"/>
<wire x1="74.25" y1="15.05" x2="74.3" y2="15" width="0.3048" layer="1"/>
<contactref element="J1" pad="5" route="any" routetag="2"/>
<contactref element="J1" pad="4" route="any" routetag="2"/>
<contactref element="J1" pad="2" route="any" routetag="2"/>
<contactref element="J1" pad="3" route="any" routetag="2"/>
<contactref element="J1" pad="1"/>
<via x="77.11" y="13.485" extent="1-16" drill="0.4" diameter="0.4064"/>
<wire x1="85.12" y1="16.52" x2="88.005" y2="15.105" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="N$1">
<wire x1="84.3" y1="15.42" x2="86.22" y2="15.33" width="0.4064" layer="1"/>
<wire x1="84.165" y1="15.105" x2="86.025" y2="14.91" width="0.4064" layer="1"/>
<wire x1="84.165" y1="15.105" x2="84.3" y2="15.105" width="0.4064" layer="1"/>
<wire x1="84.3" y1="15.105" x2="84.3" y2="15.42" width="0.4064" layer="1"/>
</signal>
<signal name="N$2">
<wire x1="84.3" y1="14.58" x2="86.145" y2="14.88" width="0.4064" layer="1"/>
</signal>
</signals>
</board>
</drawing>
</eagle>


text:
#
# This recipe imports a docker container image to the xenguest image
# Notes:
# - Users should add docker in the local.conf of their target with
# DISTRO_FEATURES += " docker" to make sure docker is installed.
# - The CONTAINER_IMAGE_FILE variable defines the docker
# container image to be imported and should be set in local.conf.
# - The CONTAINER_IMAGE_FILE_KEEP variable defines the
# behaviour that if the container image file is kept after import.
# Setting this variable to 1 means keep the container image file after
# import. This variable can be set in local.conf.
# - The CONTAINER_IMAGE_NAME_AND_TAG variable defines the name and
# tag of the imported image. The value of this variable should follow
# the format of `NAME:TAG`. This variable can be set in local.conf.
#

DESCRIPTION = "Import a docker image to xenguest"
LICENSE = "MIT"

LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

CONTAINER_IMAGE_FILE ??= ""
CONTAINER_IMAGE_FILE_KEEP ??= ""
CONTAINER_IMAGE_NAME_AND_TAG ??= "local:local"

inherit features_check
REQUIRED_DISTRO_FEATURES = "docker"

python __anonymous() {
    # Check if `CONTAINER_IMAGE_FILE` is empty.
    container_image_file = d.getVar('CONTAINER_IMAGE_FILE')
    if not container_image_file:
        raise bb.parse.SkipRecipe("CONTAINER_IMAGE_FILE is empty")

    # In case we have a symlink we need to convert the link to its realpath.
    if os.path.islink(container_image_file):
        container_image_file = os.path.realpath(container_image_file)
        bb.warn("Given CONTAINER_IMAGE_FILE: %s is a symlink, "
                "convert the link to its realpath: %s" %
                (d.getVar('CONTAINER_IMAGE_FILE'), container_image_file))
        d.setVar('CONTAINER_IMAGE_FILE', container_image_file)

    # Check if the container image file exists.
    # The container image file here is either the real file or the symlink target.
    if not os.path.exists(container_image_file):
        raise bb.parse.SkipRecipe("CONTAINER_IMAGE_FILE: %s does not exist." %
                                  container_image_file)

    # Here we can ensure that the CONTAINER_IMAGE_FILE exists and is valid.
    # Therefore we can append this file to SRC_URI.
    d.appendVar('SRC_URI',  ' file://' + container_image_file + ';unpack=0')
}

S = "${WORKDIR}"
SRC_URI = "file://import_container.sh"

inherit update-rc.d
INITSCRIPT_PARAMS = "start 30 2 3 4 5 ."
INITSCRIPT_NAME = "import_container.sh"

do_install() {
    install -d ${D}${sysconfdir}/init.d
    install -d -m 755 ${D}${datadir}/docker/images

    install -m 777 ${CONTAINER_IMAGE_FILE} ${D}${datadir}/docker/images/.
    install -m 755 import_container.sh ${D}${sysconfdir}/init.d

    BASENAME_CONTAINER_IMAGE_FILE=$(basename "${CONTAINER_IMAGE_FILE}")

    sed -i "s,###CONTAINER_IMAGE_FILE###,${BASENAME_CONTAINER_IMAGE_FILE}," \
           ${D}${sysconfdir}/init.d/import_container.sh
    sed -i "s,###CONTAINER_IMAGE_NAME_AND_TAG###,${CONTAINER_IMAGE_NAME_AND_TAG}," \
           ${D}${sysconfdir}/init.d/import_container.sh
    sed -i "s,###CONTAINER_IMAGE_FILE_KEEP###,${CONTAINER_IMAGE_FILE_KEEP}," \
           ${D}${sysconfdir}/init.d/import_container.sh
}

FILES_${PN} += "${datadir}/docker/images"
RDEPENDS_${PN} = "packagegroup-docker-runtime-minimal"

license: MIT

repository: akavoukis/meta-arm

license_type: permissive

repo_name: akavoukis/meta-arm

branch_name: refs/heads/master

extension: bb


text:
package main

import (
	"testing"

	"github.com/jgramoll/terraform-provider-jenkins/client"

	// "github.com/jgramoll/terraform-provider-jenkins/provider"
	"github.com/sergi/go-diff/diffmatchpatch"
)

func testJobPipelineTriggersProperties() *[]client.JobProperty {
	gerritBranch := client.NewJobGerritTriggerBranch()
	gerritBranch.CompareType = client.CompareTypeRegExp
	gerritBranch.Pattern = "my-branch"
	gerritFilePath := client.NewJobGerritTriggerFilePath()
	gerritFilePath.CompareType = client.CompareTypeRegExp
	gerritFilePath.Pattern = "my-file-path"
	gerritProject := client.NewJobGerritTriggerProject()
	gerritProject.CompareType = client.CompareTypePlain
	gerritProject.Pattern = "my-project"
	gerritProject.Branches = gerritProject.Branches.Append(gerritBranch)
	gerritProject.FilePaths = gerritProject.FilePaths.Append(gerritFilePath)
	gerritTrigger := client.NewJobGerritTrigger()
	gerritTrigger.Plugin = "gerrit-trigger@2.29.0"
	gerritTrigger.Projects = gerritTrigger.Projects.Append(gerritProject)
	gerritTriggerChangeMergedEvent := client.NewJobGerritTriggerPluginChangeMergedEvent()
	gerritTrigger.TriggerOnEvents = gerritTrigger.TriggerOnEvents.Append(gerritTriggerChangeMergedEvent)
	gerritTriggerPatchsetEvent := client.NewJobGerritTriggerPluginPatchsetCreatedEvent()
	gerritTrigger.TriggerOnEvents = gerritTrigger.TriggerOnEvents.Append(gerritTriggerPatchsetEvent)
	gerritTriggerDraftEvent := client.NewJobGerritTriggerPluginDraftPublishedEvent()
	gerritTrigger.TriggerOnEvents = gerritTrigger.TriggerOnEvents.Append(gerritTriggerDraftEvent)

	triggerJobProperty := client.NewJobPipelineTriggersProperty()
	triggerJobProperty.Triggers = triggerJobProperty.Triggers.Append(gerritTrigger)

	triggerJobProperty2 := client.NewJobPipelineTriggersProperty()
	gerritTrigger2 := client.NewJobGerritTrigger()
	triggerJobProperty2.Triggers = triggerJobProperty2.Triggers.Append(gerritTrigger2)
	return &[]client.JobProperty{triggerJobProperty, triggerJobProperty2}
}

func TestJobGerritTriggerCode(t *testing.T) {
	job := client.NewJob()
	job.Properties.Items = testJobPipelineTriggersProperties()

	result := jobCode(job)
	expected := `resource "jenkins_job" "main" {
  name     = ""
  plugin   = ""
  disabled = false

  property {
    type = "PipelineTriggersJobProperty"

    trigger {
      type   = "GerritTrigger"
      plugin = "gerrit-trigger@2.29.0"

      server_name       = "__ANY__"
      silent_mode       = false
      silent_start_mode = false
      escape_quotes     = true

      name_and_email_parameter_mode = "PLAIN"
      commit_message_parameter_mode = "BASE64"
      change_subject_parameter_mode = "PLAIN"
      comment_text_parameter_mode   = "BASE64"
      dynamic_trigger_configuration = false

      skip_vote {
        on_successful = false
        on_failed     = false
        on_unstable   = false
        on_not_built  = false
      }

      trigger_on_event {
        type = "PluginChangeMergedEvent"
      }

      trigger_on_event {
        type = "PluginPatchsetCreatedEvent"

        exclude_drafts         = false
        exclude_trivial_rebase = false
        exclude_no_code_change = false
        exclude_private_state  = false
        exclude_wip_state      = false
      }

      trigger_on_event {
        type = "PluginDraftPublishedEvent"
      }

      gerrit_project {
        compare_type = "PLAIN"
        pattern      = "my-project"

        branch {
          compare_type = "REG_EXP"
          pattern      = "my-branch"
        }

        file_path {
          compare_type = "REG_EXP"
          pattern      = "my-file-path"
        }
      }
    }
  }

  property {
    type = "PipelineTriggersJobProperty"

    trigger {
      type   = "GerritTrigger"
      plugin = ""

      server_name       = "__ANY__"
      silent_mode       = false
      silent_start_mode = false
      escape_quotes     = true

      name_and_email_parameter_mode = "PLAIN"
      commit_message_parameter_mode = "BASE64"
      change_subject_parameter_mode = "PLAIN"
      comment_text_parameter_mode   = "BASE64"
      dynamic_trigger_configuration = false

      skip_vote {
        on_successful = false
        on_failed     = false
        on_unstable   = false
        on_not_built  = false
      }
    }
  }
}
`
	if result != expected {
		dmp := diffmatchpatch.New()
		diffs := dmp.DiffMain(expected, result, false)
		t.Fatalf("job terraform code not as expected: %s", dmp.DiffPrettyText(diffs))
	}
}

repository: jgramoll/terraform-provider-jenkins

repo_name: jgramoll/terraform-provider-jenkins

gha_license_id: MIT

gha_language: Go

extension: go


text:
package app

import (
	"context"
	"encoding/json"
	"fmt"
	"time"

	"github.com/gin-gonic/gin"
	"github.com/pkg/errors"
	"github.com/robfig/cron/v3"
	"github.com/sirupsen/logrus"

	"github.com/dashotv/flame/nzbget"
	"github.com/dashotv/flame/qbt"
	"github.com/dashotv/mercury"
)

var ctx = context.Background()

type Server struct {
	Router *gin.Engine
	Log    *logrus.Entry
	App    *Application
	Config *Config

	merc       *mercury.Mercury
	qbtChannel chan *qbt.Response
	nzbChannel chan *nzbget.GroupResponse
}

func New() (*Server, error) {
	var err error
	s := &Server{
		Log:    App().Log,
		Router: App().Router,
		Config: ConfigInstance(),
	}

	s.merc, err = mercury.New("flame", s.Config.Nats.URL)
	if err != nil {
		return nil, errors.Wrap(err, "creating mercury")
	}

	s.qbtChannel = make(chan *qbt.Response, 5)
	if err := s.merc.Sender("flame.qbittorrents", s.qbtChannel); err != nil {
		return nil, errors.Wrap(err, "mercury sender")
	}

	s.nzbChannel = make(chan *nzbget.GroupResponse, 5)
	if err := s.merc.Sender("flame.nzbs", s.nzbChannel); err != nil {
		return nil, errors.Wrap(err, "mercury sender")
	}

	return s, nil
}

func (s *Server) Start() error {
	s.Log.Info("starting flame...")

	if s.Config.Cron {
		c := cron.New(cron.WithSeconds())

		// every second SendQbittorrents
		if _, err := c.AddFunc("* * * * * *", s.SendQbittorrents); err != nil {
			return errors.Wrap(err, "adding send qbts cron function")
		}
		// every second SendQbittorrents
		if _, err := c.AddFunc("* * * * * *", s.SendNzbs); err != nil {
			return errors.Wrap(err, "adding send nzbs cron function")
		}
		// every 10 minutes check disk space
		if _, err := c.AddFunc("0 */1 * * * *", s.CheckDisk); err != nil {
			return errors.Wrap(err, "adding check disk cron function")
		}

		go func() {
			s.Log.Info("starting cron...")
			c.Start()
		}()
	}

	s.Routes()

	s.Log.Info("starting web...")
	if err := s.Router.Run(fmt.Sprintf(":%d", s.Config.Port)); err != nil {
		return errors.Wrap(err, "starting router")
	}

	return nil
}

func (s *Server) SendQbittorrents() {
	resp, err := App().Qbittorrent.List()
	if err != nil {
		s.Log.Errorf("couldn't get torrent list: %s", err)
		return
	}

	b, err := json.Marshal(&resp)
	if err != nil {
		s.Log.Errorf("couldn't marshal torrents: %s", err)
		return
	}

	status := App().Cache.Set(ctx, "flame-qbittorrents", string(b), time.Minute)
	if status.Err() != nil {
		s.Log.Errorf("sendqbts: set cache failed: %s", status.Err())
	}
	s.qbtChannel <- resp
}

func (s *Server) SendNzbs() {
	resp, err := App().Nzbget.List()
	if err != nil {
		s.Log.Errorf("couldn't get nzb list: %s", err)
		return
	}

	b, err := json.Marshal(&resp)
	if err != nil {
		s.Log.Errorf("couldn't marshal nzbs: %s", err)
		return
	}

	status := App().Cache.Set(ctx, "flame-nzbs", string(b), time.Minute)
	if status.Err() != nil {
		s.Log.Errorf("sendnzbs: set cache failed: %s", status.Err())
	}
	s.nzbChannel <- resp
}

func (s *Server) CheckDisk() {
	//s.Log.Infof("checkdisk: checking free disk space")
	resp, err := App().Nzbget.List()
	if err != nil {
		s.Log.Errorf("couldn't get nzb list: %s", err)
		return
	}

	//s.Log.Infof("checkdisk: checking free disk space: %d MB", resp.Status.FreeDiskSpaceMB)
	if resp.Status.FreeDiskSpaceMB < 25000 {
		s.Log.Warnf("checkdisk: free disk space low")
		err := App().Qbittorrent.PauseAll()
		if err != nil {
			s.Log.Errorf("checkdisk: failed to pause all qbts: %s", err)
		}
	}
}

repository: dashotv/flame

repo_name: dashotv/flame

branch_name: refs/heads/main


text:
import { ApiError, UserSwapState } from '@radar/redshift-types';
import nock from 'nock';
import sha256 from 'simple-sha256';
import { HttpClient } from '../src';
import { RedshiftApiUrl } from '../src/constants';
import { expect, fixtures } from './lib';

describe('HTTP Client', () => {
  let client: HttpClient;
  before(() => {
    client = new HttpClient();
  });

  describe('getMarkets', () => {
    before(() => {
      nock(`${RedshiftApiUrl.MAINNET}/api`)
        .get('/markets')
        .reply(200, fixtures.valid.markets.response);
    });

    it('should return the active markets', async () => {
      const markets = await client.getMarkets();
      expect(markets).to.deep.equal(fixtures.valid.markets.response);
    });
  });

  describe('getMarketRequirements', () => {
    before(async () => {
      //  All market requirements
      nock(`${RedshiftApiUrl.MAINNET}/api`)
        .get(`/markets/requirements`)
        .reply(200, fixtures.valid.allMarketRequirements.response);

      //  Single market requirements
      nock(`${RedshiftApiUrl.MAINNET}/api`)
        .get(`/markets/${fixtures.valid.market}/requirements`)
        .reply(200, fixtures.valid.singleMarketRequirements.response);
    });

    it('should return an error if the market is invalid', async () => {
      await expect(
        client.getMarketRequirements(fixtures.invalid.market),
      ).to.be.rejectedWith(Error, ApiError.INVALID_MARKET);
    });

    it('should return requirements for a single market if the market is valid', async () => {
      const requirements = await client.getMarketRequirements(
        fixtures.valid.market,
      );
      expect(requirements).to.deep.equal(
        fixtures.valid.singleMarketRequirements.response,
      );
    });

    it('should return requirements for all markets', async () => {
      const requirements = await client.getMarketRequirements();
      expect(requirements).to.deep.equal(
        fixtures.valid.allMarketRequirements.response,
      );
    });
  });

  describe('getOrders', () => {
    before(async () => {
      nock(`${RedshiftApiUrl.MAINNET}/api`)
        .get('/orders')
        .query({ invoiceHash: await sha256(fixtures.valid.invoice) })
        .reply(200, fixtures.valid.orders.response);
    });

    it('should return an error if the invoice is invalid', async () => {
      await expect(
        client.getOrders(fixtures.invalid.invoice),
      ).to.be.rejectedWith(Error, ApiError.INVALID_INVOICE);
    });

    it('should return orders if the invoice is valid', async () => {
      const orders = await client.getOrders(fixtures.valid.invoice);
      expect(orders).to.deep.equal(fixtures.valid.orders.response);
    });
  });

  describe('getOrder', () => {
    before(async () => {
      nock(`${RedshiftApiUrl.MAINNET}/api`)
        .get(`/orders/${fixtures.valid.orderId}`)
        .reply(200, fixtures.valid.order.response);
    });

    it('should return an error if the order id is invalid', async () => {
      await expect(
        client.getOrder(fixtures.invalid.orderId),
      ).to.be.rejectedWith(Error, ApiError.INVALID_ORDER_ID);
    });

    it('should return an order if the order id is valid', async () => {
      const order = await client.getOrder(fixtures.valid.orderId);
      expect(order).to.deep.equal(fixtures.valid.order.response);
    });
  });

  describe('getOrderState', () => {
    before(async () => {
      nock(`${RedshiftApiUrl.MAINNET}/api`)
        .get(`/orders/${fixtures.valid.orderId}/state`)
        .reply(200, fixtures.valid.orderState.response);
    });

    it('should return an error if the order id is invalid', async () => {
      await expect(
        client.getOrderState(fixtures.invalid.orderId),
      ).to.be.rejectedWith(Error, ApiError.INVALID_ORDER_ID);
    });

    it('should return an orders state if the order id is valid', async () => {
      const state = await client.getOrderState(fixtures.valid.orderId);
      expect(state).to.equal(UserSwapState.COMPLETE);
    });
  });

  describe('getOrderFundDetails', () => {
    before(async () => {
      nock(`${RedshiftApiUrl.MAINNET}/api`)
        .get(`/orders/${fixtures.valid.orderId}/fundDetails`)
        .reply(200, fixtures.valid.orderFundDetails.response);
    });

    it('should return an error if the order id is invalid', async () => {
      await expect(
        client.getOrderFundDetails(fixtures.invalid.orderId),
      ).to.be.rejectedWith(Error, ApiError.INVALID_ORDER_ID);
    });

    it('should return an orders fund details if the order id is valid', async () => {
      const details = await client.getOrderFundDetails(fixtures.valid.orderId);
      expect(details).to.deep.equal(fixtures.valid.orderFundDetails.response);
    });
  });

  describe('getOrderTransactions', () => {
    before(async () => {
      nock(`${RedshiftApiUrl.MAINNET}/api`)
        .get(`/orders/${fixtures.valid.orderId}/transactions`)
        .reply(200, fixtures.valid.orderTransactions.response);
    });

    it('should return an error if the order id is invalid', async () => {
      await expect(
        client.getOrderTransactions(fixtures.invalid.orderId),
      ).to.be.rejectedWith(Error, ApiError.INVALID_ORDER_ID);
    });

    it('should return an orders transactions if the order id is valid', async () => {
      const details = await client.getOrderTransactions(fixtures.valid.orderId);
      expect(details).to.deep.equal(fixtures.valid.orderTransactions.response);
    });
  });

  describe('getOrderRefundDetails', () => {
    before(async () => {
      nock(`${RedshiftApiUrl.MAINNET}/api`)
        .get(`/orders/${fixtures.valid.orderId}/refund`)
        .reply(200, fixtures.valid.orderRefund.response);
    });

    it('should return an error if the order id is invalid', async () => {
      await expect(
        client.getOrderRefundDetails(fixtures.invalid.orderId),
      ).to.be.rejectedWith(Error, ApiError.INVALID_ORDER_ID);
    });

    it('should return an orders refund details if the id is valid', async () => {
      const details = await client.getOrderRefundDetails(
        fixtures.valid.orderId,
      );
      expect(details).to.deep.equal(fixtures.valid.orderRefund.response);
    });
  });
});

extension: ts


text:
import * as reducers from './reducers';
import user from '@ussu/common/src/libs/user';
import { createStore, combineReducers, compose, applyMiddleware } from 'redux';
import { appMountMiddleware } from './middleware/appMount';
import { rootTransitionMiddleware } from './middleware/rootTransition';
import { ROUTER_INITIAL } from '../ducks/router';
import { sideMenuMiddleware } from './middleware/sideMenu';

const composeEnhancers =
  (typeof (window as any) !== 'undefined' ? window : ({} as any))
    .__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

const store = createStore(
  combineReducers(reducers) as any, // fix me
  {},
  composeEnhancers(
    applyMiddleware(
      appMountMiddleware,
      rootTransitionMiddleware,
      sideMenuMiddleware,
    ),
  ),
);

const createSanguineStore = () =>
  createStore(
    combineReducers(reducers) as any, // fix me
    {},
    compose(
      applyMiddleware(
        appMountMiddleware,
        rootTransitionMiddleware,
        sideMenuMiddleware,
      ),
    ),
  );

store.dispatch({
  type: ROUTER_INITIAL,
});

if (user?.auth) {
  store.dispatch({
    type: 'PAGE_HYDRATION',
    payload: user,
  });
}

export { store, createSanguineStore };

repository: sussexstudent/website

repo_name: sussexstudent/website

gha_language: TypeScript


text:
/*
Copyright 2019 Gravitational, Inc.

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 phases

import (
	"context"
	"fmt"
	"strconv"

	"github.com/gravitational/gravity/lib/constants"
	"github.com/gravitational/gravity/lib/defaults"
	libfsm "github.com/gravitational/gravity/lib/fsm"
	"github.com/gravitational/gravity/lib/ops"
	"github.com/gravitational/gravity/lib/storage"
	"github.com/gravitational/gravity/lib/utils"

	"github.com/gravitational/trace"
	"github.com/sirupsen/logrus"
)

// NewElections implements the phase to manage election changes in cluster
// to support failover as the environment variables are updated
func NewElections(params libfsm.ExecutorParams, operator LocalClusterGetter, logger logrus.FieldLogger) (libfsm.PhaseExecutor, error) {
	if params.Phase.Data == nil || params.Phase.Data.ElectionChange == nil {
		return nil, trace.BadParameter("no election status specified for phase %q", params.Phase.ID)
	}

	return &elections{
		FieldLogger:    logger,
		Server:         *params.Phase.Data.Server,
		ElectionChange: *params.Phase.Data.ElectionChange,
		progress:       params.Progress,
		clusterName:    params.Plan.ClusterName,
		dnsAddr:        params.Plan.DNSConfig.Addr(),
	}, nil
}

func (r *elections) waitForMasterMigration(rollback bool) error {
	r.progress.NextStep("Waiting for new leader election")
	r.Info("Wait for new leader election.")
	err := utils.Retry(defaults.RetryInterval, defaults.RetryAttempts, func() error {
		leaderAddr, err := utils.ResolveAddr(constants.APIServerDomainName, r.dnsAddr)
		if err != nil {
			return trace.Wrap(err, "resolving current leader IP")
		}

		servers := r.ElectionChange.DisableServers
		if rollback {
			servers = r.ElectionChange.EnableServers
		}

		if len(servers) == 0 {
			return nil
		}

		// If we disabled a server and it was leader, wait for another server to get elected
		for _, server := range servers {
			if leaderAddr == server.AdvertiseIP {
				return utils.Continue("waiting for %q to step down as k8s leader", leaderAddr)
			}
		}
		return nil
	})
	return trace.Wrap(err)
}

func (r *elections) setElectionStatus(server storage.Server, enable bool) error {
	if enable {
		r.progress.NextStep("Enable leader elections on %v", server.Hostname)
	} else {
		r.progress.NextStep("Disable leader elections on %v", server.Hostname)
	}
	key := fmt.Sprintf("/planet/cluster/%s/election/%s", r.clusterName, server.AdvertiseIP)

	out, err := libfsm.RunCommand(utils.PlanetCommandArgs(defaults.EtcdCtlBin,
		"set", key, strconv.FormatBool(enable)))
	return trace.Wrap(err, "setting leader election on %q to %v: %s", server.AdvertiseIP, enable, out)
}

// PreCheck is no-op for this phase
func (r *elections) PreCheck(ctx context.Context) error {
	return nil
}

// PostCheck is no-op for this phase
func (r *elections) PostCheck(context.Context) error {
	return nil
}

// Execute performs election change on this node
func (r *elections) Execute(context.Context) error {
	return trace.Wrap(r.updateElectionStatus(false))
}

// Rollback reverses election change performed by Execute
func (r *elections) Rollback(ctx context.Context) error {
	return trace.Wrap(r.updateElectionStatus(true))
}

func (r *elections) updateElectionStatus(rollback bool) error {
	for _, server := range r.ElectionChange.DisableServers {
		err := r.setElectionStatus(server, rollback)
		if err != nil {
			return trace.Wrap(err)
		}
	}

	for _, server := range r.ElectionChange.EnableServers {
		err := r.setElectionStatus(server, !rollback)
		if err != nil {
			return trace.Wrap(err)
		}
	}

	return trace.Wrap(r.waitForMasterMigration(rollback))
}

// elections is the phase that manages leader elections in cluster
type elections struct {
	// FieldLogger specifies the logger for the phase
	logrus.FieldLogger
	// Server is the server currently being updated
	storage.Server
	// ElectionChange represents changes to make to the cluster elections
	storage.ElectionChange
	progress utils.Progress
	// clusterName is the name of the local cluster
	clusterName string
	dnsAddr     string
}

// LocalClusterGetter fetches data on local cluster
type LocalClusterGetter interface {
	// GetLocalSite returns the data record for the local cluster
	GetLocalSite(context.Context) (*ops.Site, error)
}

repository: ipwnosx/gravity

repo_name: ipwnosx/gravity


text:
DESCRIPTION = "Lsof is a Unix-specific diagnostic tool. \
Its name stands for LiSt Open Files, and it does just that."
SECTION = "devel"
LICENSE = "BSD"

PR = "r2"

SRC_URI = "ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_${PV}.tar.bz2;name=lsof483tarbz2"
SRC_URI[lsof483tarbz2.md5sum] = "8f731a6251b8c0143d585df0d5ca779e"
SRC_URI[lsof483tarbz2.sha256sum] = "b89f930bbe36b970e3cd070b9860ee701d8c7285ffedf2fbcec0e5fa3cb1f544"

LOCALSRC = "${WORKDIR}/lsof_${PV}/lsof_${PV}_src.tar"
S = "${WORKDIR}/lsof_${PV}_src"

# The tar.bz2 file contains another tar.
do_unpackpost() {
	tar x --no-same-owner -f ${LOCALSRC} -C ${WORKDIR}
}
addtask unpackpost before do_patch after do_unpack

export LSOF_OS = "${TARGET_OS}"
LSOF_OS_libc-uclibc = "linux"
LSOF_OS_libc-glibc = "linux"
export LSOF_INCLUDE = "${STAGING_INCDIR}"

do_configure () {
	yes | ./Configure ${LSOF_OS}
}

export I = "${STAGING_INCDIR}"
export L = "${STAGING_INCDIR}"
export EXTRA_OEMAKE = ""

do_compile () {
	oe_runmake 'CC=${CC}' 'CFGL=${LDFLAGS} -L./lib -llsof' 'DEBUG=' 'INCL=${CFLAGS}' \
	'RANLIB=${RANLIB} liblsof.a'
}

do_install () {
	install -d ${D}${sbindir} ${D}${mandir}/man8
	install -m 4755 lsof ${D}${sbindir}/lsof
	install -m 0644 lsof.8 ${D}${mandir}/man8/lsof.8
}

repository: overo/overo-oe-natty

repo_name: overo/overo-oe-natty

branch_name: HEAD


text:
@INPROCEEDINGS{tarver2020ldpc,
  author={Tarver, Chance and Tonnemacher, Matthew and Chen, Hao and Zhang, Jianzhong Charlie and Cavallaro, Joseph R.},
  booktitle={2020 IEEE International Symposium on Circuits and Systems (ISCAS)},
  title={{GPU-Based LDPC Decoding for vRAN Systems in 5G and Beyond}},
  year={2020},
  volume={},
  number={},
  pages={1-5},
  doi={10.1109/ISCAS45731.2020.9181064}}

extension: bib


text:
#include<armadillo>
#include<csv.h>
#include<cstdio>

#if !defined(DATA_H_)
#define DATA_H_

class Data {

        public:
        bool discreteInput;
        bool discreteOutput;

        private:
        bool getDiscreteInput();
        bool getDiscreteOutput();
        void setDiscreteInput(bool);
        void setDiscreteOutput(bool);
        arma::vec convertData(FILE*);
};

#endif // DATA_H_

repository: NicolasMakaroff/MLMVN

repo_name: NicolasMakaroff/MLMVN

extension: h


text:
/* the following function is not changed to make compatible with NRC. by PHC, Jan 3, 2004*/

void crank(unsigned long n, float w[], float *s)
{
	unsigned long j=1,ji,jt;
	float t,rank;

	*s=0.0;
	while (j < n) {
		if (w[j+1] != w[j]) {
			w[j]=j;
			++j;
		} else {
			for (jt=j+1;jt<=n && w[jt]==w[j];jt++);
			rank=0.5*(j+jt-1);
			for (ji=j;ji<=(jt-1);ji++) w[ji]=rank;
			t=jt-j;
			*s += t*t*t-t;
			j=jt;
		}
	}
	if (j == n) w[n]=n;
}
/* (C) Copr. 1986-92 Numerical Recipes Software . */

extension: cpp


text:
package middleware

import (
	"encoding/json"
	"errors"
	"github.com/golang-jwt/jwt"
	"net/http"
)

//Jwks is a collection of JSONWebKeys obtained from Config.HttpServerConfig.AuthKeysLocation
type Jwks struct {
	Keys []JSONWebKeys `json:"keys"`
}

//JSONWebKeys is a representation of a Jason Web Key
type JSONWebKeys struct {
	Kty string   `json:"kty"`
	Kid string   `json:"kid"`
	Use string   `json:"use"`
	N   string   `json:"n"`
	E   string   `json:"e"`
	X5c []string `json:"x5c"`
}

//NewJwtMiddleware creates new middleware to verify the JWT token sent via Authorization header
func NewJwtMiddleware(issuer string, audience string, keysLocation string) (*JWTMiddleware, error) {

	keys, err := getPemKeys(keysLocation)
	if err != nil {
		return nil, err
	}

	return New(Options{
		ValidationKeyGetter: func(token *jwt.Token) (interface{}, error) {
			// Verify 'aud' claim
			checkAud := token.Claims.(jwt.MapClaims).VerifyAudience(audience, false)
			if !checkAud {
				return token, errors.New("invalid audience")
			}
			// Verify 'issuer' claim
			checkIss := token.Claims.(jwt.MapClaims).VerifyIssuer(issuer, false)
			if !checkIss {
				return token, errors.New("invalid issuer")
			}

			cert, err := getPemCert(token, keys)
			if err != nil {
				panic(err.Error())
			}

			result, _ := jwt.ParseRSAPublicKeyFromPEM([]byte(cert))
			return result, nil
		},
		SigningMethod:       jwt.SigningMethodRS256,
		EnableAuthOnOptions: false,
	}), nil
}

func getPemKeys(keysLocation string) (*Jwks, error) {
	resp, err := http.Get(keysLocation)

	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	var jwks = &Jwks{}
	err = json.NewDecoder(resp.Body).Decode(jwks)

	if err != nil {
		return jwks, err
	}

	return jwks, err
}

func getPemCert(token *jwt.Token, jwks *Jwks) (string, error) {
	cert := ""

	for k := range jwks.Keys {
		if token.Header["kid"] == jwks.Keys[k].Kid {
			cert = "-----BEGIN CERTIFICATE-----\n" + jwks.Keys[k].X5c[0] + "\n-----END CERTIFICATE-----"
		}
	}

	if cert == "" {
		err := errors.New("unable to find appropriate key")
		return cert, err
	}

	return cert, nil
}


text:
DESCRIPTION = "Extra udev rules"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"

inherit allarch

PR = "r3"

SRC_URI = " \
       file://50-mali.rules \
       file://70-qtouchscreen.rules \
"

do_install() {
	install -d ${D}${sysconfdir}/udev/rules.d

	install -m 0644 ${WORKDIR}/50-mali.rules      ${D}${sysconfdir}/udev/rules.d/50-mali.rules
	install -m 0644 ${WORKDIR}/70-qtouchscreen.rules      ${D}${sysconfdir}/udev/rules.d/70-qtouchscreen.rules
}

FILES_${PN} = "${sysconfdir}/udev"
RDEPENDS_${PN} = "udev"


text:
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Text;
using BenchmarkDotNet.Attributes;
using JsonLab;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace MyBenchmarks
{
    [CoreJob, ClrJob]
    [RankColumn]
    [MemoryDiagnoser]
    public class StandardVsCustomSerializer
    {
        public enum CollectionFlavour
        {
            Array,
            List,
            ROList,
            ROArray,
            Enumerable,
        }

        private object[] Data;

        // [Params(20)]
        public int ArraysCount = 20;

        // [Params(true, false)]
        public bool Minify = true;

        [Params(CollectionFlavour.Array, CollectionFlavour.List, CollectionFlavour.ROArray, CollectionFlavour.ROList, CollectionFlavour.Enumerable)]
        public CollectionFlavour Kind;

        private long[] TheLongs = new[] { 0, 1L, 12L, 123L, 1234L, 12345678987654321L, -1L, -12L, -123L, -1234L, -12345678987654321L };

        private static readonly DefaultContractResolver TheContractResolver = new DefaultContractResolver
        {
            NamingStrategy = new CamelCaseNamingStrategy
            {
                OverrideSpecifiedNames = false,
                ProcessDictionaryKeys = true,
            }
        };

        [GlobalSetup]
        public void Setup()
        {
            List<object> list = new List<object>();
            for (int i = 0; i < ArraysCount; i++)
            {
                var item = TheLongs.Concat(Enumerable.Range(0, 61).Select(x => 42L));
                if (Kind == CollectionFlavour.List) list.Add(item.ToList());
                else if (Kind == CollectionFlavour.Array) list.Add(item.ToArray());
                else if (Kind == CollectionFlavour.ROList) list.Add(item.ToList().ToImmutableList());
                else if (Kind == CollectionFlavour.ROArray) list.Add(item.ToList().ToImmutableArray());
                else if (Kind == CollectionFlavour.Enumerable) list.Add(AsEnumerable(item.ToArray()));
                else throw new InvalidOperationException($"Unknown flavour: {Kind}");
            }

            Data = list.ToArray();
        }

        [Benchmark]
        public StringBuilder Optimized()
        {
            return Serialize(optionalConverter: LongArrayConverter.Instance);
        }

        [Benchmark(Baseline = true)]
        public StringBuilder Default()
        {
            return Serialize();
        }

        private StringBuilder Serialize(JsonConverter optionalConverter = null)
        {
            JsonSerializer ser = new JsonSerializer()
            {
                Formatting = !Minify ? Formatting.Indented : Formatting.None,
            };

            if (optionalConverter != null) ser.Converters.Add(optionalConverter);
            ser.ContractResolver = TheContractResolver;

            StringBuilder json = new StringBuilder();
            StringWriter jwr = new StringWriter(json);
            ser.Serialize(jwr, Data);
            jwr.Flush();

            return json;
        }

        static IEnumerable<long> AsEnumerable(IEnumerable<long> arg)
        {
            foreach (var l in arg)
            {
                yield return l;
            }
        }

    }
}

repository: devizer/KernelManagementLab

repo_name: devizer/KernelManagementLab

gha_language: C#

extension: cs


text:
// Copyright (c) 2020 IoTeX Foundation
// This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability
// or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed.
// This source code is governed by Apache License 2.0 that can be found in the LICENSE file.

package action

import (
	"encoding/hex"
	"math/big"
	"testing"

	"github.com/pkg/errors"
	"github.com/stretchr/testify/require"
	"google.golang.org/protobuf/proto"

	"github.com/iotexproject/go-pkgs/crypto"

	"github.com/iotexproject/iotex-core/pkg/unit"
	"github.com/iotexproject/iotex-core/test/identityset"
)

var stakeCreateTestParams = []struct {
	SenderKey    crypto.PrivateKey
	Nonce        uint64
	CanAddress   string
	AmountStr    string
	Duration     uint32
	AutoStake    bool
	Payload      []byte
	GasLimit     uint64
	GasPrice     *big.Int
	Serialize    string
	IntrinsicGas uint64
	Cost         string
	ElpHash      string
	Sign         string
	SelpHash     string
	Expected     error
	SanityCheck  error
}{
	// valid test
	{
		identityset.PrivateKey(27), uint64(10), "test", "100", uint32(10000), true, []byte("payload"), uint64(1000000), big.NewInt(10), "0a0474657374120331303018904e20012a077061796c6f6164", uint64(10700), "107100", "18d76ff9f3cfed0fe84f3fd4831f11379edc5b3d689d646187520b3fe74ab44c", "0a26080118c0843d22023130c202190a0474657374120331303018904e20012a077061796c6f6164124104755ce6d8903f6b3793bddb4ea5d3589d637de2d209ae0ea930815c82db564ee8cc448886f639e8a0c7e94e99a5c1335b583c0bc76ef30dd6a1038ed9da8daf331a41563785be9d7e2d796a8aaca41dbe1a53a0bce3614ede09718e72c75cb40cdb48355964b69156008f2319e20db4a4023730c3a1664ac35dfc10a7ceff26be8ebe00", "ebb26b08e824e18cb6d38918411749351c065198603e4626bbdc10b900dde270", nil, nil,
	},
	// invalid test
	{
		identityset.PrivateKey(27), uint64(10), "test", "ae-10", uint32(10000), false, []byte("payload"), uint64(1000000), big.NewInt(1000), "", uint64(10700), "", "", "", "", ErrInvalidAmount, nil,
	},
	{
		identityset.PrivateKey(27), uint64(10), "test", "-10", uint32(10000), false, []byte("payload"), uint64(1000000), big.NewInt(1000), "", uint64(10700), "", "", "", "", nil, ErrInvalidAmount,
	},
	{
		identityset.PrivateKey(27), uint64(10), "test", "0", uint32(10000), false, []byte("payload"), uint64(1000000), big.NewInt(1000), "", uint64(10700), "", "", "", "", nil, ErrInvalidAmount,
	},
	{
		identityset.PrivateKey(27), uint64(10), "test", "100", uint32(10000), true, []byte("payload"), uint64(1000000), big.NewInt(-unit.Qev), "0a0474657374120331303018904e20012a077061796c6f6164", uint64(10700), "107100", "18d76ff9f3cfed0fe84f3fd4831f11379edc5b3d689d646187520b3fe74ab44c", "0a26080118c0843d22023130c202190a0474657374120331303018904e20012a077061796c6f6164124104755ce6d8903f6b3793bddb4ea5d3589d637de2d209ae0ea930815c82db564ee8cc448886f639e8a0c7e94e99a5c1335b583c0bc76ef30dd6a1038ed9da8daf331a41563785be9d7e2d796a8aaca41dbe1a53a0bce3614ede09718e72c75cb40cdb48355964b69156008f2319e20db4a4023730c3a1664ac35dfc10a7ceff26be8ebe00", "ebb26b08e824e18cb6d38918411749351c065198603e4626bbdc10b900dde270", nil, ErrNegativeValue,
	},
}

func TestCreateStake(t *testing.T) {
	require := require.New(t)
	for _, test := range stakeCreateTestParams {
		stake, err := NewCreateStake(test.Nonce, test.CanAddress, test.AmountStr, test.Duration, test.AutoStake, test.Payload, test.GasLimit, test.GasPrice)
		require.Equal(test.Expected, errors.Cause(err))
		if err != nil {
			continue
		}
		err = stake.SanityCheck()
		require.Equal(test.SanityCheck, errors.Cause(err))
		if err != nil {
			continue
		}

		ser := stake.Serialize()
		require.Equal(test.Serialize, hex.EncodeToString(ser))

		require.NoError(err)
		require.Equal(test.GasLimit, stake.GasLimit())
		require.Equal(test.GasPrice, stake.GasPrice())
		require.Equal(test.Nonce, stake.Nonce())

		require.Equal(test.AmountStr, stake.Amount().String())
		require.Equal(test.Payload, stake.Payload())
		require.Equal(test.CanAddress, stake.Candidate())
		require.Equal(test.Duration, stake.Duration())
		require.True(stake.AutoStake())

		gas, err := stake.IntrinsicGas()
		require.NoError(err)
		require.Equal(test.IntrinsicGas, gas)
		cost, err := stake.Cost()
		require.NoError(err)
		require.Equal(test.Cost, cost.Text(10))

		cs2 := &CreateStake{}
		require.NoError(cs2.LoadProto(stake.Proto()))
		require.Equal(test.AmountStr, cs2.Amount().String())
		require.Equal(test.Payload, cs2.Payload())
		require.Equal(test.CanAddress, cs2.Candidate())
		require.Equal(test.Duration, cs2.Duration())
		require.True(cs2.AutoStake())

		// verify sign
		bd := &EnvelopeBuilder{}
		elp := bd.SetGasLimit(test.GasLimit).
			SetGasPrice(test.GasPrice).
			SetAction(stake).Build()
		// sign
		selp, err := Sign(elp, test.SenderKey)
		require.NoError(err)
		require.NotNil(selp)
		ser, err = proto.Marshal(selp.Proto())
		require.NoError(err)
		require.Equal(test.Sign, hex.EncodeToString(ser))
		hash, err := selp.Hash()
		require.NoError(err)
		require.Equal(test.SelpHash, hex.EncodeToString(hash[:]))
		// verify signature
		require.NoError(selp.VerifySignature())
	}

}

func TestCreateStakeABIEncodeAndDecode(t *testing.T) {
	require := require.New(t)
	test := stakeCreateTestParams[0]
	stake, err := NewCreateStake(test.Nonce, test.CanAddress, test.AmountStr, test.Duration, test.AutoStake, test.Payload, test.GasLimit, test.GasPrice)
	require.NoError(err)

	data, err := stake.EncodeABIBinary()
	require.NoError(err)
	stake, err = NewCreateStakeFromABIBinary(data)
	require.NoError(err)
	require.Equal(test.CanAddress, stake.candName)
	require.Equal(test.AmountStr, stake.amount.String())
	require.Equal(test.Duration, stake.duration)
	require.Equal(test.AutoStake, stake.autoStake)
	require.Equal(test.Payload, stake.payload)
}

repository: iotexproject/iotex-core

repo_name: iotexproject/iotex-core


text:
package ship

import (
	"github.com/bububa/opentaobao/core"
	"github.com/bububa/opentaobao/model/ship"
)

// AlitripShipReturnNotify 船票退票退款回填接口
// alitrip.ship.return.notify
//
// 此接口为接入商调用飞猪接口回填退票状态，飞猪平台给用户进行退票退款。飞猪平台保证数据幂等。
func AlitripShipReturnNotify(clt *core.SDKClient, req *ship.AlitripShipReturnNotifyAPIRequest, session string) (*ship.AlitripShipReturnNotifyAPIResponse, error) {
	var resp ship.AlitripShipReturnNotifyAPIResponse
	err := clt.Post(req, &resp, session)
	if err != nil {
		return nil, err
	}
	return &resp, nil
}

repository: bububa/opentaobao

repo_name: bububa/opentaobao


text:
package rtsp

import (
	"bufio"
	"context"
	"crypto/md5"
	"fmt"
	"log"
	"net"
	"strconv"
	"strings"

	"github.com/jonas-koeritz/actioncam/libipcamera"
)

// Server implements the RTSP protocol to serve a H.264 stream
type Server struct {
	localIP       string
	localPort     int
	listener      net.Listener
	remoteRTPPort int
	remoteIP      string
	rtpRelay      *libipcamera.RTPRelay
	camera        *libipcamera.Camera
	sdp           string
	context       context.Context
}

// CreateServer creates a new Server instance
func CreateServer(ctx context.Context, localIP string, port int, camera *libipcamera.Camera) *Server {
	server := &Server{
		localIP:       localIP,
		localPort:     port,
		camera:        camera,
		remoteRTPPort: 0,
		remoteIP:      "",
		sdp:           "v=0\r\ns=ActionCamera\r\nm=video 0 RTP/AVP 99\r\na=rtpmap:99 H264/90000",
		context:       ctx,
	}
	return server
}

// ListenAndServe starts listening for connections and handles them
func (s *Server) ListenAndServe() error {
	log.Printf("%+v\n", *s)
	listener, err := net.Listen("tcp4", fmt.Sprintf("%s:%d", s.localIP, s.localPort))
	if err != nil {
		return err
	}
	s.listener = listener

	log.Printf("RTSP Server waiting for connections on %s:%d\n", s.localIP, s.localPort)

	for {
		select {
		case <-s.context.Done():
			listener.Close()
			break
		default:
			conn, err := listener.Accept()
			if err != nil {
				log.Printf("ERROR accepting connection: %s\n", err)
			}

			log.Printf("Accepted new RTSP Client %s\n", conn.RemoteAddr().String())

			go s.handleClient(conn)
		}
	}
}

func (s *Server) handleClient(conn net.Conn) error {
	packet := make([]string, 0)
	scanner := bufio.NewScanner(conn)
	for scanner.Scan() {
		line := scanner.Text()
		if len(line) > 0 {
			packet = append(packet, line)
		} else {
			s.handleRequest(packet, conn)
			packet = make([]string, 0)
		}
	}
	return nil
}

func (s *Server) handleRequest(packet []string, conn net.Conn) {
	fmt.Printf("C->S:\n%s\n", packet)

	request := strings.Split(packet[0], " ")
	if len(request) != 3 {
		log.Printf("Received invalid request")
		return
	}

	method := request[0]
	headers := make(map[string]string, 0)
	for _, header := range packet[1:] {
		parts := strings.Split(header, ":")
		if len(parts) >= 2 {
			headers[parts[0]] = strings.TrimSpace(strings.Join(parts[1:], ":"))
		}
	}

	session := fmt.Sprintf("%X", md5.Sum([]byte(conn.RemoteAddr().String())))

	switch method {
	case "OPTIONS":
		writeStatus(conn, 200, "OK")
		replyCSeq(conn, headers)
		conn.Write([]byte("Public: DESCRIBE, SETUP, PLAY, PAUSE, RECORD\r\n\r\n"))
	case "DESCRIBE":
		writeStatus(conn, 200, "OK")
		replyCSeq(conn, headers)
		writeHeader(conn, "Content-Type", "application/sdp")
		writeHeader(conn, "Content-Length", fmt.Sprintf("%d", len(s.sdp)))
		conn.Write([]byte(fmt.Sprintf("\r\n%s", s.sdp)))
	case "SETUP":
		transportDescription := strings.Split(headers["Transport"], ";")
		rtpDescription := transportDescription[len(transportDescription)-1]
		remoteRTPPort, err := strconv.ParseInt(strings.Split(strings.Split(rtpDescription, "=")[1], "-")[0], 10, 32)
		if err != nil {
			log.Printf("ERROR Parsing RTP description: %s\n", err)
			return
		}
		s.remoteRTPPort = int(remoteRTPPort)
		s.remoteIP = (conn.RemoteAddr().(*net.TCPAddr)).IP.String()

		log.Printf("Preparing to Stream to %s:%d\n", s.remoteIP, s.remoteRTPPort)

		writeStatus(conn, 200, "OK")
		replyCSeq(conn, headers)
		writeHeader(conn, "Transport", headers["Transport"]+";ssrc=0")
		writeHeader(conn, "Session", session)
		conn.Write([]byte("\r\n"))

	case "PLAY":
		s.rtpRelay = libipcamera.CreateRTPRelay(s.context, net.ParseIP(s.remoteIP), s.remoteRTPPort)
		s.camera.StartPreviewStream()

		writeStatus(conn, 200, "OK")
		replyCSeq(conn, headers)
		writeHeader(conn, "Session", session)
		writeHeader(conn, "RTP-Info", "url="+request[1]+";seq=10;rtptime=10")
		conn.Write([]byte("\r\n"))
	case "TEARDOWN":
		s.rtpRelay.Stop()
		writeStatus(conn, 200, "OK")
		replyCSeq(conn, headers)
		conn.Write([]byte("\r\n"))
	case "RECORD":
		s.camera.StartRecording()

		writeStatus(conn, 200, "OK")
		replyCSeq(conn, headers)
		writeHeader(conn, "Session", session)
		conn.Write([]byte("\r\n"))

	default:
		return
	}
}

func writeStatus(conn net.Conn, status int, statusWord string) {
	conn.Write([]byte(fmt.Sprintf("RTSP/1.0 %d %s\r\n", status, statusWord)))
}

func replyCSeq(conn net.Conn, headers map[string]string) {
	writeHeader(conn, "CSeq", headers["CSeq"])
}

func writeHeader(conn net.Conn, key, value string) {
	conn.Write([]byte(fmt.Sprintf("%s: %s\r\n", key, value)))
}

// Stop stops listening for connections
func (s *Server) Stop() {
	s.listener.Close()
}

repository: fildaw/actioncam

repo_name: fildaw/actioncam


text:
using System;

using Nucleo.Views;

namespace Nucleo.Presentation.Discovery
{
	/// <summary>
	/// Represents the options used to discover presenters.
	/// </summary>
	public class PresenterDiscoveryOptions
	{
		/// <summary>
		/// Gets or sets the view used to discover presenters.
		/// </summary>
		public IView View
		{
			get;
			set;
		}
	}
}


text:
DESCRIPTION = "Vexed clone"
SECTION = "opie/games"
PRIORITY = "optional"
MAINTAINER = "Marcin Juszkiewicz <openembedded@hrw.one.pl>"
LICENSE = "GPL"
AUTHOR = "Alexander Hausner <Alexander.Hausner@web.de>"
HOMEPAGE = "http://wwwcip.informatik.uni-erlangen.de/~sialhaus/qpe-vexed.html"
DEPENDS = "qpe-vexed-levels"
RDEPENDS = "qpe-vexed-levels"
APPNAME = "qpe-vexed"
APPTYPE = "binary"
APPDESKTOP = "${S}"
PR = "r3"

SRC_URI = "http://wwwcip.informatik.uni-erlangen.de/~sialhaus/qpe-vexed_1.3_src.tar.gz \
           file://vit.patch;patch=1"

S = "${WORKDIR}/qpe-vexed_arm/"

inherit opie

do_install () {
	install -d ${D}${palmtopdir}/pics/${APPNAME}/ \
		   ${D}${palmtopdir}/apps/Games/ \
		   ${D}${palmtopdir}/bin/

	install -m 0644 ${S}/pkg/opt/QtPalmtop/pics/qpe-vexed.png ${D}${palmtopdir}/pics/
	install -m 0644 ${S}/pkg/opt/QtPalmtop/pics/qpe-vexed/*.png ${D}${palmtopdir}/pics/${APPNAME}/
	install -m 0644 ${S}/pkg/opt/QtPalmtop/pics/qpe-vexed/*.bmp ${D}${palmtopdir}/pics/${APPNAME}/
}

repository: Terentyev/familiar-linux

repo_name: Terentyev/familiar-linux


text:
require gypsy.inc

PR = "r2"

LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
                    file://COPYING.lib;md5=7fbc338309ac38fefcd64b04bb903e34 \
                    file://src/main.c;beginline=1;endline=25;md5=3fe64e27e61b289b77383a54a982cbdd \
                    file://gypsy/gypsy-time.h;beginline=1;endline=24;md5=06432ea19a7b6607428d04d9dadc37fd"

SRC_URI += "http://gypsy.freedesktop.org/releases/gypsy-${PV}.tar.gz \
           file://0001-g_type_init-is-deprecated-for-glib-2.35.0.patch \
          "

SRC_URI[md5sum] = "e2d186df9c2cc3b70a027043e22acf1a"
SRC_URI[sha256sum] = "14e1cbe17351f408538e033ca370b4bf51ccf9c88744e236ddfb271904f154d6"

branch_name: refs/heads/fido

gha_language: BitBake