text:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE eagle SYSTEM "eagle.dtd">
<eagle version="6.3">
<drawing>
<settings>
<setting alwaysvectorfont="yes"/>
<setting verticaltext="up"/>
</settings>
<grid distance="0.01" unitdist="inch" unit="inch" style="lines" multiple="1" display="no" altdistance="0.025" altunitdist="inch" altunit="inch"/>
<layers>
<layer number="1" name="Top" color="4" fill="1" visible="yes" active="yes"/>
<layer number="16" name="Bottom" color="1" fill="1" visible="yes" active="yes"/>
<layer number="17" name="Pads" color="2" fill="1" visible="yes" active="yes"/>
<layer number="18" name="Vias" color="2" fill="1" visible="yes" active="yes"/>
<layer number="19" name="Unrouted" color="6" fill="1" visible="yes" active="yes"/>
<layer number="20" name="Dimension" color="15" fill="1" visible="yes" active="yes"/>
<layer number="21" name="tPlace" color="7" fill="1" visible="yes" active="yes"/>
<layer number="22" name="bPlace" color="7" fill="1" visible="yes" active="yes"/>
<layer number="23" name="tOrigins" color="15" fill="1" visible="yes" active="yes"/>
<layer number="24" name="bOrigins" color="15" fill="1" visible="yes" active="yes"/>
<layer number="25" name="tNames" color="7" fill="1" visible="yes" active="yes"/>
<layer number="26" name="bNames" color="7" fill="1" visible="yes" active="yes"/>
<layer number="27" name="tValues" color="7" fill="1" visible="yes" active="yes"/>
<layer number="28" name="bValues" color="7" fill="1" visible="yes" active="yes"/>
<layer number="29" name="tStop" color="7" fill="3" visible="no" active="yes"/>
<layer number="30" name="bStop" color="7" fill="6" visible="no" active="yes"/>
<layer number="31" name="tCream" color="7" fill="4" visible="no" active="yes"/>
<layer number="32" name="bCream" color="7" fill="5" visible="no" active="yes"/>
<layer number="33" name="tFinish" color="6" fill="3" visible="no" active="yes"/>
<layer number="34" name="bFinish" color="6" fill="6" visible="no" active="yes"/>
<layer number="35" name="tGlue" color="7" fill="4" visible="no" active="yes"/>
<layer number="36" name="bGlue" color="7" fill="5" visible="no" active="yes"/>
<layer number="37" name="tTest" color="7" fill="1" visible="no" active="yes"/>
<layer number="38" name="bTest" color="7" fill="1" visible="no" active="yes"/>
<layer number="39" name="tKeepout" color="4" fill="11" visible="no" active="yes"/>
<layer number="40" name="bKeepout" color="1" fill="11" visible="no" active="yes"/>
<layer number="41" name="tRestrict" color="4" fill="10" visible="no" active="yes"/>
<layer number="42" name="bRestrict" color="1" fill="10" visible="no" active="yes"/>
<layer number="43" name="vRestrict" color="2" fill="10" visible="no" active="yes"/>
<layer number="44" name="Drills" color="7" fill="1" visible="yes" active="yes"/>
<layer number="45" name="Holes" color="7" fill="1" visible="yes" active="yes"/>
<layer number="46" name="Milling" color="3" fill="1" visible="yes" active="yes"/>
<layer number="47" name="Measures" color="7" fill="1" visible="yes" active="yes"/>
<layer number="48" name="Document" color="7" fill="1" visible="yes" active="yes"/>
<layer number="49" name="Reference" color="7" fill="1" visible="yes" active="yes"/>
<layer number="50" name="dxf" color="7" fill="1" visible="no" active="no"/>
<layer number="51" name="tDocu" color="7" fill="1" visible="yes" active="yes"/>
<layer number="52" name="bDocu" color="7" fill="1" visible="yes" active="yes"/>
<layer number="53" name="tGND_GNDA" color="7" fill="9" visible="no" active="no"/>
<layer number="54" name="bGND_GNDA" color="1" fill="9" visible="no" active="no"/>
<layer number="56" name="wert" color="7" fill="1" visible="no" active="no"/>
<layer number="91" name="Nets" color="2" fill="1" visible="no" active="no"/>
<layer number="92" name="Busses" color="1" fill="1" visible="no" active="no"/>
<layer number="93" name="Pins" color="2" fill="1" visible="no" active="no"/>
<layer number="94" name="Symbols" color="4" fill="1" visible="no" active="no"/>
<layer number="95" name="Names" color="7" fill="1" visible="no" active="no"/>
<layer number="96" name="Values" color="7" fill="1" visible="no" active="no"/>
<layer number="97" name="Info" color="7" fill="1" visible="no" active="no"/>
<layer number="98" name="Guide" color="6" fill="1" visible="no" active="no"/>
<layer number="100" name="Muster" color="7" fill="1" visible="no" active="no"/>
<layer number="101" name="Patch_Top" color="12" fill="4" visible="no" active="yes"/>
<layer number="102" name="Vscore" color="7" fill="1" visible="no" active="yes"/>
<layer number="103" name="tMap" color="7" fill="1" visible="no" active="yes"/>
<layer number="104" name="Name" color="16" fill="1" visible="no" active="yes"/>
<layer number="105" name="tPlate" color="7" fill="1" visible="no" active="yes"/>
<layer number="106" name="bPlate" color="7" fill="1" visible="no" active="yes"/>
<layer number="107" name="Crop" color="7" fill="1" visible="no" active="yes"/>
<layer number="116" name="Patch_BOT" color="9" fill="4" visible="no" active="yes"/>
<layer number="121" name="_tsilk" color="7" fill="1" visible="no" active="yes"/>
<layer number="122" name="_bsilk" color="7" fill="1" visible="no" active="yes"/>
<layer number="125" name="_tNames" color="7" fill="1" visible="no" active="yes"/>
<layer number="144" name="Drill_legend" color="7" fill="1" visible="no" active="yes"/>
<layer number="151" name="HeatSink" color="7" fill="1" visible="no" active="yes"/>
<layer number="199" name="Contour" color="7" fill="1" visible="no" active="yes"/>
<layer number="200" name="200bmp" color="1" fill="10" visible="no" active="yes"/>
<layer number="201" name="201bmp" color="2" fill="10" visible="no" active="yes"/>
<layer number="202" name="202bmp" color="3" fill="10" visible="no" active="yes"/>
<layer number="203" name="203bmp" color="4" fill="10" visible="no" active="yes"/>
<layer number="204" name="204bmp" color="5" fill="10" visible="no" active="yes"/>
<layer number="205" name="205bmp" color="6" fill="10" visible="no" active="yes"/>
<layer number="206" name="206bmp" color="7" fill="10" visible="no" active="yes"/>
<layer number="207" name="207bmp" color="8" fill="10" visible="no" active="yes"/>
<layer number="208" name="208bmp" color="9" fill="10" visible="no" active="yes"/>
<layer number="209" name="209bmp" color="7" fill="1" visible="no" active="yes"/>
<layer number="210" name="210bmp" color="7" fill="1" visible="no" active="yes"/>
<layer number="211" name="211bmp" color="7" fill="1" visible="no" active="yes"/>
<layer number="212" name="212bmp" color="7" fill="1" visible="no" active="yes"/>
<layer number="213" name="213bmp" color="7" fill="1" visible="no" active="yes"/>
<layer number="214" name="214bmp" color="7" fill="1" visible="no" active="yes"/>
<layer number="215" name="215bmp" color="7" fill="1" visible="no" active="yes"/>
<layer number="216" name="216bmp" color="7" fill="1" visible="no" active="yes"/>
<layer number="217" name="217bmp" color="18" fill="1" visible="no" active="no"/>
<layer number="218" name="218bmp" color="19" fill="1" visible="no" active="no"/>
<layer number="219" name="219bmp" color="20" fill="1" visible="no" active="no"/>
<layer number="220" name="220bmp" color="21" fill="1" visible="no" active="no"/>
<layer number="221" name="221bmp" color="22" fill="1" visible="no" active="no"/>
<layer number="222" name="222bmp" color="23" fill="1" visible="no" active="no"/>
<layer number="223" name="223bmp" color="24" fill="1" visible="no" active="no"/>
<layer number="224" name="224bmp" color="25" fill="1" visible="no" active="no"/>
<layer number="250" name="Descript" color="3" fill="1" visible="no" active="no"/>
<layer number="251" name="SMDround" color="12" fill="11" visible="no" active="no"/>
<layer number="254" name="cooling" color="7" fill="1" visible="no" active="yes"/>
</layers>
<board>
<plain>
<wire x1="0" y1="0" x2="63.5" y2="0" width="0" layer="20"/>
<wire x1="63.5" y1="0" x2="63.5" y2="19.05" width="0" layer="20"/>
<wire x1="63.5" y1="19.05" x2="0" y2="19.05" width="0" layer="20"/>
<wire x1="0" y1="19.05" x2="0" y2="0" width="0" layer="20"/>
<text x="59.436" y="2.667" size="0.8128" layer="21" distance="215" align="bottom-right">vcc
gnd
xlat
blank
sclk
sout</text>
<text x="3.937" y="2.667" size="0.8128" layer="21" distance="215">vcc
gnd
xlat
blank
sclk
sin</text>
<text x="19.431" y="8.509" size="0.6096" layer="22" distance="230" rot="MR0" align="bottom-right">GND  VDD</text>
<text x="62.865" y="1.524" size="0.8128" layer="21" distance="213" align="top-right">v1.2</text>
<text x="7.112" y="5.842" size="0.6096" layer="25" distance="215">0, 1, 2</text>
<text x="13.462" y="5.842" size="0.6096" layer="25" distance="215">3, 4, 5</text>
<text x="19.812" y="5.842" size="0.6096" layer="25" distance="215">6, 7, 8</text>
<text x="25.654" y="5.842" size="0.6096" layer="25" distance="215">9, 10, 11</text>
<text x="33.02" y="5.842" size="0.6096" layer="25" distance="215">12, 13, 14</text>
<text x="39.37" y="5.842" size="0.6096" layer="25" distance="215">15, 16, 17</text>
<text x="45.72" y="5.842" size="0.6096" layer="25" distance="215">18, 19, 20</text>
<text x="52.07" y="5.842" size="0.6096" layer="25" distance="215">21, 22, 23</text>
</plain>
<libraries>
<library name="SparkFun-DigitalIC">
<description>
SparkFun Electronics' preferred foot prints

In this library you'll find all manner of digital ICs- microcontrollers, memory chips, logic chips, FPGAs, etc.

We've spent an enormous amount of time creating and checking these footprints and parts, but it is the end user's responsibility to ensure correctness and suitablity for a given componet or application. If you enjoy using this library, please buy one of our products at www.sparkfun.com.

Licensing: CC v3.0 Share-Alike You are welcome to use this library for commercial purposes. For attribution, we ask that when you begin to sell your device using our footprint, you email us with a link to the product being sold. We want bragging rights that we helped (in a very small part) to create your 8th world wonder. We would like the opportunity to feature your device on our homepage.</description>
<packages>
<package name="DAP">
<smd name="GND" x="0" y="0" dx="4.36" dy="4.11" layer="1"/>
<smd name="1" x="-4.875" y="-3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="2" x="-4.225" y="-3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="3" x="-3.575" y="-3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="4" x="-2.925" y="-3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="5" x="-2.275" y="-3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="6" x="-1.625" y="-3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="7" x="-0.975" y="-3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="8" x="-0.325" y="-3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="9" x="0.325" y="-3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="11" x="1.625" y="-3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="10" x="0.975" y="-3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="12" x="2.275" y="-3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="13" x="2.925" y="-3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="14" x="3.575" y="-3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="15" x="4.225" y="-3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="16" x="4.875" y="-3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="32" x="-4.875" y="3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="31" x="-4.225" y="3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="30" x="-3.575" y="3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="29" x="-2.925" y="3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="28" x="-2.275" y="3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="27" x="-1.625" y="3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="26" x="-0.975" y="3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="25" x="-0.325" y="3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="24" x="0.325" y="3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="22" x="1.625" y="3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="23" x="0.975" y="3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="21" x="2.275" y="3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="20" x="2.925" y="3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="19" x="3.575" y="3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="18" x="4.225" y="3.7" dx="0.3" dy="1.8" layer="1"/>
<smd name="17" x="4.875" y="3.7" dx="0.3" dy="1.8" layer="1"/>
<wire x1="-5.5" y1="3.05" x2="-5.5" y2="-3.05" width="0.127" layer="21"/>
<wire x1="-5.5" y1="-3.05" x2="5.5" y2="-3.05" width="0.127" layer="21"/>
<wire x1="5.5" y1="-3.05" x2="5.5" y2="3.05" width="0.127" layer="21"/>
<wire x1="-5.5" y1="3.05" x2="5.5" y2="3.05" width="0.127" layer="21"/>
<circle x="-4.55" y="-1.95" radius="0.65" width="0.127" layer="21"/>
<text x="-5.58" y="5.61" size="1.27" layer="25">>NAME</text>
</package>
</packages>
</library>
<library name="SparkFun-Capacitors">
<description>
SparkFun Electronics' preferred foot prints

In this library you'll find resistors, capacitors, inductors, test points, jumper pads, etc.

We've spent an enormous amount of time creating and checking these footprints and parts, but it is the end user's responsibility to ensure correctness and suitablity for a given componet or application. If you enjoy using this library, please buy one of our products at www.sparkfun.com.

Licensing: CC v3.0 Share-Alike You are welcome to use this library for commercial purposes. For attribution, we ask that when you begin to sell your device using our footprint, you email us with a link to the product being sold. We want bragging rights that we helped (in a very small part) to create your 8th world wonder. We would like the opportunity to feature your device on our homepage.</description>
<packages>
<package name="0603-CAP">
<wire x1="-1.473" y1="0.983" x2="1.473" y2="0.983" width="0.0508" layer="39"/>
<wire x1="1.473" y1="0.983" x2="1.473" y2="-0.983" width="0.0508" layer="39"/>
<wire x1="1.473" y1="-0.983" x2="-1.473" y2="-0.983" width="0.0508" layer="39"/>
<wire x1="-1.473" y1="-0.983" x2="-1.473" y2="0.983" width="0.0508" layer="39"/>
<wire x1="-0.356" y1="0.432" x2="0.356" y2="0.432" width="0.1016" layer="51"/>
<wire x1="-0.356" y1="-0.419" x2="0.356" y2="-0.419" width="0.1016" layer="51"/>
<wire x1="0" y1="0.0305" x2="0" y2="-0.0305" width="0.5588" layer="21"/>
<smd name="1" x="-0.85" y="0" dx="1.1" dy="1" layer="1"/>
<smd name="2" x="0.85" y="0" dx="1.1" dy="1" layer="1"/>
<text x="-0.889" y="0.762" size="0.4064" layer="25" font="vector">>NAME</text>
<text x="-1.016" y="-1.143" size="0.4064" layer="27" font="vector">>VALUE</text>
<rectangle x1="-0.8382" y1="-0.4699" x2="-0.3381" y2="0.4801" layer="51"/>
<rectangle x1="0.3302" y1="-0.4699" x2="0.8303" y2="0.4801" layer="51"/>
<rectangle x1="-0.1999" y1="-0.3" x2="0.1999" y2="0.3" layer="35"/>
</package>
</packages>
</library>
<library name="SparkFun-Resistors">
<description>
SparkFun Electronics' preferred foot prints

In this library you'll find resistors, capacitors, inductors, test points, jumper pads, etc.

We've spent an enormous amount of time creating and checking these footprints and parts, but it is the end user's responsibility to ensure correctness and suitablity for a given componet or application. If you enjoy using this library, please buy one of our products at www.sparkfun.com.

Licensing: CC v3.0 Share-Alike You are welcome to use this library for commercial purposes. For attribution, we ask that when you begin to sell your device using our footprint, you email us with a link to the product being sold. We want bragging rights that we helped (in a very small part) to create your 8th world wonder. We would like the opportunity to feature your device on our homepage.</description>
<packages>
<package name="0603-RES">
<wire x1="-1.473" y1="0.983" x2="1.473" y2="0.983" width="0.0508" layer="39"/>
<wire x1="1.473" y1="0.983" x2="1.473" y2="-0.983" width="0.0508" layer="39"/>
<wire x1="1.473" y1="-0.983" x2="-1.473" y2="-0.983" width="0.0508" layer="39"/>
<wire x1="-1.473" y1="-0.983" x2="-1.473" y2="0.983" width="0.0508" layer="39"/>
<wire x1="-0.356" y1="0.432" x2="0.356" y2="0.432" width="0.1016" layer="51"/>
<wire x1="-0.356" y1="-0.419" x2="0.356" y2="-0.419" width="0.1016" layer="51"/>
<smd name="1" x="-0.85" y="0" dx="1.1" dy="1" layer="1"/>
<smd name="2" x="0.85" y="0" dx="1.1" dy="1" layer="1"/>
<text x="-0.889" y="0.762" size="0.4064" layer="25" font="vector">>NAME</text>
<text x="-1.016" y="-1.143" size="0.4064" layer="27" font="vector">>VALUE</text>
<rectangle x1="-0.8382" y1="-0.4699" x2="-0.3381" y2="0.4801" layer="51"/>
<rectangle x1="0.3302" y1="-0.4699" x2="0.8303" y2="0.4801" layer="51"/>
<rectangle x1="-0.1999" y1="-0.3" x2="0.1999" y2="0.3" layer="35"/>
<rectangle x1="-0.2286" y1="-0.381" x2="0.2286" y2="0.381" layer="21"/>
</package>
</packages>
</library>
<library name="SparkFun-Connectors">
<description>
SparkFun Electronics' preferred foot prints

In this library you'll find connectors and sockets- basically anything that can be plugged into or onto.

We've spent an enormous amount of time creating and checking these footprints and parts, but it is the end user's responsibility to ensure correctness and suitablity for a given componet or application. If you enjoy using this library, please buy one of our products at www.sparkfun.com.

Licensing: CC v3.0 Share-Alike You are welcome to use this library for commercial purposes. For attribution, we ask that when you begin to sell your device using our footprint, you email us with a link to the product being sold. We want bragging rights that we helped (in a very small part) to create your 8th world wonder. We would like the opportunity to feature your device on our homepage.</description>
<packages>
<package name="JST-2-SMD">
<description>2mm SMD side-entry connector. tDocu layer indicates the actual physical plastic housing. +/- indicate SparkFun standard batteries and wiring.</description>
<wire x1="-4" y1="-1" x2="-4" y2="-4.5" width="0.2032" layer="21"/>
<wire x1="-4" y1="-4.5" x2="-3.2" y2="-4.5" width="0.2032" layer="21"/>
<wire x1="-3.2" y1="-4.5" x2="-3.2" y2="-2" width="0.2032" layer="21"/>
<wire x1="-3.2" y1="-2" x2="-2" y2="-2" width="0.2032" layer="21"/>
<wire x1="2" y1="-2" x2="3.2" y2="-2" width="0.2032" layer="21"/>
<wire x1="3.2" y1="-2" x2="3.2" y2="-4.5" width="0.2032" layer="21"/>
<wire x1="3.2" y1="-4.5" x2="4" y2="-4.5" width="0.2032" layer="21"/>
<wire x1="4" y1="-4.5" x2="4" y2="-1" width="0.2032" layer="21"/>
<wire x1="2" y1="3" x2="-2" y2="3" width="0.2032" layer="21"/>
<smd name="1" x="-1" y="-3.7" dx="1" dy="4.6" layer="1"/>
<smd name="2" x="1" y="-3.7" dx="1" dy="4.6" layer="1"/>
<smd name="NC1" x="-3.4" y="1.5" dx="3.4" dy="1.6" layer="1" rot="R90"/>
<smd name="NC2" x="3.4" y="1.5" dx="3.4" dy="1.6" layer="1" rot="R90"/>
<text x="-1.27" y="1.27" size="0.4064" layer="25">>Name</text>
<text x="-1.27" y="0" size="0.4064" layer="27">>Value</text>
<text x="2.159" y="-4.445" size="1.27" layer="51">+</text>
<text x="-2.921" y="-4.445" size="1.27" layer="51">-</text>
</package>
<package name="SWR204">
<wire x1="-2.94" y1="-2.54" x2="-2.94" y2="2.46" width="0.127" layer="21"/>
<wire x1="-2.94" y1="2.46" x2="2.96" y2="2.46" width="0.127" layer="21"/>
<wire x1="2.96" y1="2.46" x2="2.96" y2="-2.54" width="0.127" layer="21"/>
<wire x1="2.96" y1="-2.54" x2="-2.94" y2="-2.54" width="0.127" layer="21"/>
<pad name="P$1" x="-0.99" y="0.96" drill="0.7"/>
<pad name="P$2" x="-0.99" y="-1.04" drill="0.7"/>
<pad name="P$3" x="1.01" y="-1.04" drill="0.7"/>
<pad name="P$4" x="1.01" y="0.96" drill="0.7"/>
</package>
<package name="1X06_LOCK">
<description>This footprint was designed to help hold the alignment of a through-hole component (i.e.  6-pin header) while soldering it into place.
You may notice that each hole has been shifted either up or down by 0.005 of an inch from it's more standard position (which is a perfectly straight line).
This slight alteration caused the pins (the squares in the middle) to touch the edges of the holes.  Because they are alternating, it causes a "brace"
to hold the component in place.  0.005 has proven to be the perfect amount of "off-center" position when using our standard breakaway headers.
Although looks a little odd when you look at the bare footprint, once you have a header in there, the alteration is very hard to notice.  Also,
if you push a header all the way into place, it is covered up entirely on the bottom side.  This idea of altering the position of holes to aid alignment
will be further integrated into the Sparkfun Library for other footprints.  It can help hold any component with 3 or more connection pins.</description>
<wire x1="-1.27" y1="0.508" x2="-0.635" y2="1.143" width="0.2032" layer="21"/>
<wire x1="-0.635" y1="1.143" x2="0.635" y2="1.143" width="0.2032" layer="21"/>
<wire x1="0.635" y1="1.143" x2="1.27" y2="0.508" width="0.2032" layer="21"/>
<wire x1="1.27" y1="0.508" x2="1.905" y2="1.143" width="0.2032" layer="21"/>
<wire x1="1.905" y1="1.143" x2="3.175" y2="1.143" width="0.2032" layer="21"/>
<wire x1="3.175" y1="1.143" x2="3.81" y2="0.508" width="0.2032" layer="21"/>
<wire x1="3.81" y1="0.508" x2="4.445" y2="1.143" width="0.2032" layer="21"/>
<wire x1="4.445" y1="1.143" x2="5.715" y2="1.143" width="0.2032" layer="21"/>
<wire x1="5.715" y1="1.143" x2="6.35" y2="0.508" width="0.2032" layer="21"/>
<wire x1="6.35" y1="0.508" x2="6.985" y2="1.143" width="0.2032" layer="21"/>
<wire x1="6.985" y1="1.143" x2="8.255" y2="1.143" width="0.2032" layer="21"/>
<wire x1="8.255" y1="1.143" x2="8.89" y2="0.508" width="0.2032" layer="21"/>
<wire x1="8.89" y1="0.508" x2="9.525" y2="1.143" width="0.2032" layer="21"/>
<wire x1="9.525" y1="1.143" x2="10.795" y2="1.143" width="0.2032" layer="21"/>
<wire x1="10.795" y1="1.143" x2="11.43" y2="0.508" width="0.2032" layer="21"/>
<wire x1="11.43" y1="0.508" x2="12.065" y2="1.143" width="0.2032" layer="21"/>
<wire x1="12.065" y1="1.143" x2="13.335" y2="1.143" width="0.2032" layer="21"/>
<wire x1="13.335" y1="1.143" x2="13.97" y2="0.508" width="0.2032" layer="21"/>
<wire x1="13.97" y1="0.508" x2="13.97" y2="-0.762" width="0.2032" layer="21"/>
<wire x1="13.97" y1="-0.762" x2="13.335" y2="-1.397" width="0.2032" layer="21"/>
<wire x1="13.335" y1="-1.397" x2="12.065" y2="-1.397" width="0.2032" layer="21"/>
<wire x1="12.065" y1="-1.397" x2="11.43" y2="-0.762" width="0.2032" layer="21"/>
<wire x1="11.43" y1="-0.762" x2="10.795" y2="-1.397" width="0.2032" layer="21"/>
<wire x1="10.795" y1="-1.397" x2="9.525" y2="-1.397" width="0.2032" layer="21"/>
<wire x1="9.525" y1="-1.397" x2="8.89" y2="-0.762" width="0.2032" layer="21"/>
<wire x1="8.89" y1="-0.762" x2="8.255" y2="-1.397" width="0.2032" layer="21"/>
<wire x1="8.255" y1="-1.397" x2="6.985" y2="-1.397" width="0.2032" layer="21"/>
<wire x1="6.985" y1="-1.397" x2="6.35" y2="-0.762" width="0.2032" layer="21"/>
<wire x1="6.35" y1="-0.762" x2="5.715" y2="-1.397" width="0.2032" layer="21"/>
<wire x1="5.715" y1="-1.397" x2="4.445" y2="-1.397" width="0.2032" layer="21"/>
<wire x1="4.445" y1="-1.397" x2="3.81" y2="-0.762" width="0.2032" layer="21"/>
<wire x1="3.81" y1="-0.762" x2="3.175" y2="-1.397" width="0.2032" layer="21"/>
<wire x1="3.175" y1="-1.397" x2="1.905" y2="-1.397" width="0.2032" layer="21"/>
<wire x1="1.905" y1="-1.397" x2="1.27" y2="-0.762" width="0.2032" layer="21"/>
<wire x1="1.27" y1="-0.762" x2="0.635" y2="-1.397" width="0.2032" layer="21"/>
<wire x1="0.635" y1="-1.397" x2="-0.635" y2="-1.397" width="0.2032" layer="21"/>
<wire x1="-0.635" y1="-1.397" x2="-1.27" y2="-0.762" width="0.2032" layer="21"/>
<wire x1="-1.27" y1="-0.762" x2="-1.27" y2="0.508" width="0.2032" layer="21"/>
<wire x1="1.27" y1="0.508" x2="1.27" y2="-0.762" width="0.2032" layer="21"/>
<wire x1="3.81" y1="0.508" x2="3.81" y2="-0.762" width="0.2032" layer="21"/>
<wire x1="6.35" y1="0.508" x2="6.35" y2="-0.762" width="0.2032" layer="21"/>
<wire x1="8.89" y1="0.508" x2="8.89" y2="-0.762" width="0.2032" layer="21"/>
<wire x1="11.43" y1="0.508" x2="11.43" y2="-0.762" width="0.2032" layer="21"/>
<pad name="1" x="0" y="0" drill="1.016" diameter="1.8796"/>
<pad name="2" x="2.54" y="-0.254" drill="1.016" diameter="1.8796"/>
<pad name="3" x="5.08" y="0" drill="1.016" diameter="1.8796"/>
<pad name="4" x="7.62" y="-0.254" drill="1.016" diameter="1.8796"/>
<pad name="5" x="10.16" y="0" drill="1.016" diameter="1.8796"/>
<pad name="6" x="12.7" y="-0.254" drill="1.016" diameter="1.8796"/>
<text x="-1.27" y="1.778" size="1.27" layer="25" font="vector">>NAME</text>
<text x="-1.27" y="-3.302" size="1.27" layer="27" font="vector">>VALUE</text>
<rectangle x1="-0.2921" y1="-0.4191" x2="0.2921" y2="0.1651" layer="51"/>
<rectangle x1="2.2479" y1="-0.4191" x2="2.8321" y2="0.1651" layer="51"/>
<rectangle x1="4.7879" y1="-0.4191" x2="5.3721" y2="0.1651" layer="51"/>
<rectangle x1="7.3279" y1="-0.4191" x2="7.9121" y2="0.1651" layer="51"/>
<rectangle x1="9.8679" y1="-0.4191" x2="10.4521" y2="0.1651" layer="51"/>
<rectangle x1="12.4079" y1="-0.4191" x2="12.9921" y2="0.1651" layer="51"/>
</package>
</packages>
</library>
<library name="SparkFun-Electromechanical">
<description>
SparkFun Electronics' preferred foot prints

In this library you'll find anything that moves- switches, relays, buttons, potentiometers. Also, anything that goes on a board but isn't electrical in nature- screws, standoffs, etc.

We've spent an enormous amount of time creating and checking these footprints and parts, but it is the end user's responsibility to ensure correctness and suitablity for a given componet or application. If you enjoy using this library, please buy one of our products at www.sparkfun.com.

Licensing: CC v3.0 Share-Alike You are welcome to use this library for commercial purposes. For attribution, we ask that when you begin to sell your device using our footprint, you email us with a link to the product being sold. We want bragging rights that we helped (in a very small part) to create your 8th world wonder. We would like the opportunity to feature your device on our homepage.</description>
<packages>
<package name="STAND-OFF">
<description>Stand Off

This is the mechanical footprint for a #4 phillips button head screw. Use the keepout ring to avoid running the screw head into surrounding components. SKU : PRT-00447</description>
<wire x1="0" y1="1.8542" x2="0" y2="-1.8542" width="0.2032" layer="41" curve="-180"/>
<wire x1="0" y1="-1.8542" x2="0" y2="1.8542" width="0.2032" layer="41" curve="-180"/>
<wire x1="0" y1="-1.8542" x2="0" y2="1.8542" width="0.2032" layer="42" curve="180"/>
<wire x1="0" y1="-1.8542" x2="0" y2="1.8542" width="0.2032" layer="42" curve="-180"/>
<circle x="0" y="0" radius="2.794" width="0.127" layer="39"/>
<hole x="0" y="0" drill="3.302"/>
</package>
</packages>
</library>
</libraries>
<attributes>
</attributes>
<variantdefs>
</variantdefs>
<classes>
<class number="0" name="default" width="0" drill="0">
</class>
</classes>
<designrules name="LaenPCBOrder *">
<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">Laen's PCB Order Design Rules

Please make sure your boards conform to these design rules.</description>
<param name="layerSetup" value="(1*16)"/>
<param name="mtCopper" value="0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm 0.0356mm"/>
<param name="mtIsolate" value="1.5011mm 0.1499mm 0.2007mm 0.1499mm 0.2007mm 0.1499mm 0.2007mm 0.1499mm 0.2007mm 0.1499mm 0.2007mm 0.1499mm 0.2007mm 0.1499mm 0.2007mm"/>
<param name="mdWireWire" value="10mil"/>
<param name="mdWirePad" value="6mil"/>
<param name="mdWireVia" value="6mil"/>
<param name="mdPadPad" value="6mil"/>
<param name="mdPadVia" value="6mil"/>
<param name="mdViaVia" value="6mil"/>
<param name="mdSmdPad" value="6mil"/>
<param name="mdSmdVia" value="6mil"/>
<param name="mdSmdSmd" value="6mil"/>
<param name="mdViaViaSameLayer" value="8mil"/>
<param name="mnLayersViaInSmd" value="2"/>
<param name="mdCopperDimension" value="15mil"/>
<param name="mdDrill" value="6mil"/>
<param name="mdSmdStop" value="0mil"/>
<param name="msWidth" value="6mil"/>
<param name="msDrill" value="13mil"/>
<param name="msMicroVia" value="13mil"/>
<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="7mil"/>
<param name="rlMaxPadTop" value="20mil"/>
<param name="rlMinPadInner" value="7mil"/>
<param name="rlMaxPadInner" value="20mil"/>
<param name="rlMinPadBottom" value="7mil"/>
<param name="rlMaxPadBottom" value="20mil"/>
<param name="rlMinViaOuter" value="7mil"/>
<param name="rlMaxViaOuter" value="20mil"/>
<param name="rlMinViaInner" value="7mil"/>
<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="TLC5947" library="SparkFun-DigitalIC" package="DAP" value="TLC5947DAP" x="31.75" y="11.43" smashed="yes" rot="R270">
<attribute name="NAME" x="29.867" y="7.612" size="0.6096" layer="25"/>
</element>
<element name="C1" library="SparkFun-Capacitors" package="0603-CAP" value=".1uF" x="41.021" y="16.891" rot="R270"/>
<element name="R1" library="SparkFun-Resistors" package="0603-RES" value="1.8k" x="38.481" y="16.002" rot="R180"/>
<element name="JP1" library="SparkFun-Connectors" package="JST-2-SMD" value="" x="21.844" y="15.24" smashed="yes" rot="MR0">
<attribute name="VALUE" x="23.114" y="11.938" size="1.27" layer="28" font="vector" rot="MR0"/>
<attribute name="PROD_ID" value="CONN-08352" x="21.844" y="15.24" size="1.778" layer="28" rot="MR0" display="off"/>
</element>
<element name="U$1" library="SparkFun-Connectors" package="SWR204" value="SWR204-D02" x="8.89" y="3.048" rot="R180"/>
<element name="U$3" library="SparkFun-Connectors" package="SWR204" value="SWR204-D02" x="15.24" y="3.048" rot="R180"/>
<element name="U$2" library="SparkFun-Connectors" package="SWR204" value="SWR204-D02" x="21.59" y="3.048" rot="R180"/>
<element name="U$4" library="SparkFun-Connectors" package="SWR204" value="SWR204-D02" x="27.94" y="3.048" rot="R180"/>
<element name="U$5" library="SparkFun-Connectors" package="SWR204" value="SWR204-D02" x="35.56" y="3.048" rot="R180"/>
<element name="U$6" library="SparkFun-Connectors" package="SWR204" value="SWR204-D02" x="41.91" y="3.048" rot="R180"/>
<element name="U$7" library="SparkFun-Connectors" package="SWR204" value="SWR204-D02" x="48.26" y="3.048" rot="R180"/>
<element name="U$8" library="SparkFun-Connectors" package="SWR204" value="SWR204-D02" x="54.61" y="3.048" rot="R180"/>
<element name="STANDOFF2" library="SparkFun-Electromechanical" package="STAND-OFF" value="STAND-OFF" x="8.128" y="14.478"/>
<element name="STANDOFF3" library="SparkFun-Electromechanical" package="STAND-OFF" value="STAND-OFF" x="54.864" y="12.446"/>
<element name="JP5" library="SparkFun-Connectors" package="1X06_LOCK" value="" x="60.96" y="15.748" smashed="yes" rot="R270">
<attribute name="VALUE" x="57.658" y="17.018" size="1.27" layer="27" font="vector" rot="R270"/>
</element>
<element name="JP2" library="SparkFun-Connectors" package="1X06_LOCK" value="" x="2.54" y="15.748" smashed="yes" rot="R270">
<attribute name="VALUE" x="-0.762" y="17.018" size="1.27" layer="27" font="vector" rot="R270"/>
</element>
</elements>
<signals>
<signal name="GND">
<contactref element="TLC5947" pad="1"/>
<contactref element="C1" pad="2"/>
<contactref element="R1" pad="1"/>
<polygon width="0.254" layer="16" spacing="10.16">
<vertex x="0" y="0"/>
<vertex x="0" y="19.05"/>
<vertex x="63.5" y="19.05"/>
<vertex x="63.5" y="0"/>
</polygon>
<contactref element="JP1" pad="1"/>
<via x="31.75" y="11.43" extent="1-16" drill="1.27"/>
<contactref element="TLC5947" pad="GND"/>
<contactref element="JP2" pad="2"/>
<contactref element="JP5" pad="2"/>
<wire x1="28.05" y1="16.305" x2="30.431" y2="16.305" width="0.3048" layer="1"/>
<wire x1="30.431" y1="16.305" x2="31.75" y2="14.986" width="0.3048" layer="1"/>
<wire x1="31.75" y1="14.986" x2="31.75" y2="11.43" width="0.3048" layer="1"/>
<via x="42.418" y="16.002" extent="1-16" drill="0.6" shape="octagon"/>
<wire x1="39.331" y1="16.002" x2="40.982" y2="16.002" width="0.3048" layer="1"/>
<wire x1="40.982" y1="16.002" x2="41.021" y2="16.041" width="0.3048" layer="1"/>
<wire x1="41.021" y1="16.041" x2="42.379" y2="16.041" width="0.3048" layer="1"/>
<wire x1="42.379" y1="16.041" x2="42.418" y2="16.002" width="0.3048" layer="1"/>
</signal>
<signal name="VCC">
<contactref element="TLC5947" pad="32"/>
<contactref element="C1" pad="1"/>
<contactref element="JP2" pad="1"/>
<contactref element="JP5" pad="1"/>
<wire x1="2.54" y1="15.748" x2="2.54" y2="16.002" width="0.6096" layer="1"/>
<wire x1="2.54" y1="16.002" x2="4.318" y2="17.78" width="0.6096" layer="1"/>
<wire x1="4.318" y1="17.78" x2="35.56" y2="17.78" width="0.6096" layer="1"/>
<wire x1="35.56" y1="17.78" x2="40.982" y2="17.78" width="0.6096" layer="1"/>
<wire x1="40.982" y1="17.78" x2="41.021" y2="17.741" width="0.6096" layer="1"/>
<wire x1="41.021" y1="17.741" x2="58.967" y2="17.741" width="0.6096" layer="1"/>
<wire x1="58.967" y1="17.741" x2="60.96" y2="15.748" width="0.6096" layer="1"/>
<wire x1="35.45" y1="16.305" x2="35.45" y2="17.67" width="0.3048" layer="1"/>
<wire x1="35.45" y1="17.67" x2="35.56" y2="17.78" width="0.3048" layer="1"/>
</signal>
<signal name="N$1">
<contactref element="TLC5947" pad="31"/>
<contactref element="R1" pad="2"/>
<wire x1="35.45" y1="15.655" x2="37.284" y2="15.655" width="0.3048" layer="1"/>
<wire x1="37.284" y1="15.655" x2="37.631" y2="16.002" width="0.3048" layer="1"/>
</signal>
<signal name="SIN">
<contactref element="TLC5947" pad="4"/>
<contactref element="JP2" pad="6"/>
<wire x1="28.05" y1="14.355" x2="15.625" y2="14.355" width="0.3048" layer="1"/>
<wire x1="15.625" y1="14.355" x2="4.318" y2="3.048" width="0.3048" layer="1"/>
<wire x1="4.318" y1="3.048" x2="2.286" y2="3.048" width="0.3048" layer="1"/>
</signal>
<signal name="XLAT">
<contactref element="TLC5947" pad="30"/>
<contactref element="JP5" pad="3"/>
<contactref element="JP2" pad="3"/>
<wire x1="35.45" y1="15.005" x2="56.623" y2="15.005" width="0.3048" layer="1"/>
<wire x1="56.623" y1="15.005" x2="60.96" y2="10.668" width="0.3048" layer="1"/>
<wire x1="2.54" y1="10.668" x2="4.826" y2="8.382" width="0.6096" layer="16"/>
<wire x1="4.826" y1="8.382" x2="58.674" y2="8.382" width="0.6096" layer="16"/>
<wire x1="58.674" y1="8.382" x2="60.96" y2="10.668" width="0.6096" layer="16"/>
</signal>
<signal name="BLANK">
<contactref element="TLC5947" pad="2"/>
<contactref element="JP5" pad="4"/>
<contactref element="JP2" pad="4"/>
<wire x1="2.286" y1="8.128" x2="3.302" y2="7.112" width="0.6096" layer="16"/>
<wire x1="3.302" y1="7.112" x2="59.69" y2="7.112" width="0.6096" layer="16"/>
<wire x1="59.69" y1="7.112" x2="60.706" y2="8.128" width="0.6096" layer="16"/>
<wire x1="28.05" y1="15.655" x2="12.861" y2="15.655" width="0.3048" layer="1"/>
<wire x1="12.861" y1="15.655" x2="5.334" y2="8.128" width="0.3048" layer="1"/>
<wire x1="5.334" y1="8.128" x2="2.286" y2="8.128" width="0.3048" layer="1"/>
</signal>
<signal name="OUT0">
<contactref element="TLC5947" pad="5"/>
<contactref element="U$1" pad="P$3"/>
<wire x1="28.05" y1="13.705" x2="17.497" y2="13.705" width="0.3048" layer="1"/>
<wire x1="17.497" y1="13.705" x2="7.88" y2="4.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT1">
<contactref element="TLC5947" pad="6"/>
<contactref element="U$1" pad="P$2"/>
<wire x1="28.05" y1="13.055" x2="17.881" y2="13.055" width="0.3048" layer="1"/>
<wire x1="17.881" y1="13.055" x2="9.906" y2="5.08" width="0.3048" layer="1"/>
<wire x1="9.906" y1="5.08" x2="9.906" y2="4.114" width="0.3048" layer="1"/>
<wire x1="9.906" y1="4.114" x2="9.88" y2="4.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT2">
<contactref element="TLC5947" pad="7"/>
<contactref element="U$1" pad="P$1"/>
<wire x1="28.05" y1="12.405" x2="18.755" y2="12.405" width="0.3048" layer="1"/>
<wire x1="18.755" y1="12.405" x2="10.922" y2="4.572" width="0.3048" layer="1"/>
<wire x1="10.922" y1="4.572" x2="10.922" y2="3.13" width="0.3048" layer="1"/>
<wire x1="10.922" y1="3.13" x2="9.88" y2="2.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT3">
<contactref element="TLC5947" pad="8"/>
<contactref element="U$3" pad="P$3"/>
<wire x1="28.05" y1="11.755" x2="21.897" y2="11.755" width="0.3048" layer="1"/>
<wire x1="21.897" y1="11.755" x2="14.23" y2="4.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT4">
<contactref element="TLC5947" pad="9"/>
<contactref element="U$3" pad="P$2"/>
<wire x1="28.05" y1="11.105" x2="23.247" y2="11.105" width="0.3048" layer="1"/>
<wire x1="23.247" y1="11.105" x2="16.23" y2="4.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT5">
<contactref element="TLC5947" pad="10"/>
<contactref element="U$3" pad="P$1"/>
<wire x1="28.05" y1="10.455" x2="24.597" y2="10.455" width="0.3048" layer="1"/>
<wire x1="24.597" y1="10.455" x2="16.23" y2="2.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT6">
<contactref element="TLC5947" pad="11"/>
<contactref element="U$2" pad="P$3"/>
<wire x1="28.05" y1="9.805" x2="25.299" y2="9.805" width="0.3048" layer="1"/>
<wire x1="25.299" y1="9.805" x2="20.574" y2="5.08" width="0.3048" layer="1"/>
<wire x1="20.574" y1="5.08" x2="20.574" y2="4.094" width="0.3048" layer="1"/>
<wire x1="20.574" y1="4.094" x2="20.58" y2="4.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT7">
<contactref element="TLC5947" pad="12"/>
<contactref element="U$2" pad="P$2"/>
<wire x1="28.05" y1="9.155" x2="25.919" y2="9.155" width="0.3048" layer="1"/>
<wire x1="25.919" y1="9.155" x2="22.606" y2="5.842" width="0.3048" layer="1"/>
<wire x1="22.606" y1="5.842" x2="22.606" y2="4.114" width="0.3048" layer="1"/>
<wire x1="22.606" y1="4.114" x2="22.58" y2="4.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT8">
<contactref element="TLC5947" pad="13"/>
<contactref element="U$2" pad="P$1"/>
<wire x1="28.05" y1="8.505" x2="26.285" y2="8.505" width="0.3048" layer="1"/>
<wire x1="26.285" y1="8.505" x2="24.13" y2="6.35" width="0.3048" layer="1"/>
<wire x1="24.13" y1="6.35" x2="24.13" y2="3.638" width="0.3048" layer="1"/>
<wire x1="24.13" y1="3.638" x2="22.58" y2="2.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT9">
<contactref element="TLC5947" pad="14"/>
<wire x1="28.05" y1="7.855" x2="26.524" y2="7.855" width="0.3048" layer="1"/>
<wire x1="26.524" y1="7.855" x2="25.4" y2="6.731" width="0.3048" layer="1"/>
<contactref element="U$4" pad="P$3"/>
<wire x1="25.4" y1="6.731" x2="25.4" y2="5.618" width="0.3048" layer="1"/>
<wire x1="25.4" y1="5.618" x2="26.93" y2="4.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT10">
<contactref element="TLC5947" pad="15"/>
<contactref element="U$4" pad="P$2"/>
<wire x1="28.05" y1="7.205" x2="26.763" y2="7.205" width="0.3048" layer="1"/>
<wire x1="26.763" y1="7.205" x2="26.416" y2="6.858" width="0.3048" layer="1"/>
<wire x1="26.416" y1="6.858" x2="26.416" y2="6.35" width="0.3048" layer="1"/>
<wire x1="26.416" y1="6.35" x2="27.432" y2="5.334" width="0.3048" layer="1"/>
<wire x1="27.432" y1="5.334" x2="28.448" y2="5.334" width="0.3048" layer="1"/>
<wire x1="28.448" y1="5.334" x2="28.956" y2="4.826" width="0.3048" layer="1"/>
<wire x1="28.956" y1="4.826" x2="28.956" y2="4.114" width="0.3048" layer="1"/>
<wire x1="28.956" y1="4.114" x2="28.93" y2="4.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT11">
<contactref element="TLC5947" pad="16"/>
<contactref element="U$4" pad="P$1"/>
<wire x1="28.05" y1="6.555" x2="29.513" y2="6.555" width="0.3048" layer="1"/>
<wire x1="29.513" y1="6.555" x2="30.988" y2="5.08" width="0.3048" layer="1"/>
<wire x1="30.988" y1="5.08" x2="30.988" y2="3.302" width="0.3048" layer="1"/>
<wire x1="30.988" y1="3.302" x2="29.718" y2="2.032" width="0.3048" layer="1"/>
<wire x1="29.718" y1="2.032" x2="28.986" y2="2.032" width="0.3048" layer="1"/>
<wire x1="28.986" y1="2.032" x2="28.93" y2="2.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT12">
<contactref element="TLC5947" pad="17"/>
<contactref element="U$5" pad="P$3"/>
<wire x1="35.45" y1="6.555" x2="34.749" y2="6.555" width="0.3048" layer="1"/>
<wire x1="34.749" y1="6.555" x2="34.544" y2="6.35" width="0.3048" layer="1"/>
<wire x1="34.544" y1="6.35" x2="34.544" y2="4.094" width="0.3048" layer="1"/>
<wire x1="34.544" y1="4.094" x2="34.55" y2="4.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT13">
<contactref element="TLC5947" pad="18"/>
<wire x1="35.45" y1="7.205" x2="36.61" y2="7.205" width="0.3048" layer="1"/>
<wire x1="36.61" y1="7.205" x2="37.084" y2="6.731" width="0.3048" layer="1"/>
<contactref element="U$5" pad="P$2"/>
<wire x1="37.084" y1="6.731" x2="37.084" y2="4.622" width="0.3048" layer="1"/>
<wire x1="37.084" y1="4.622" x2="36.55" y2="4.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT14">
<contactref element="TLC5947" pad="19"/>
<wire x1="35.45" y1="7.855" x2="36.976" y2="7.855" width="0.3048" layer="1"/>
<wire x1="36.976" y1="7.855" x2="38.1" y2="6.731" width="0.3048" layer="1"/>
<contactref element="U$5" pad="P$1"/>
<wire x1="38.1" y1="6.731" x2="38.1" y2="3.638" width="0.3048" layer="1"/>
<wire x1="38.1" y1="3.638" x2="36.55" y2="2.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT15">
<contactref element="TLC5947" pad="20"/>
<contactref element="U$6" pad="P$3"/>
<wire x1="35.45" y1="8.505" x2="37.469" y2="8.505" width="0.3048" layer="1"/>
<wire x1="37.469" y1="8.505" x2="40.894" y2="5.08" width="0.3048" layer="1"/>
<wire x1="40.894" y1="5.08" x2="40.894" y2="4.094" width="0.3048" layer="1"/>
<wire x1="40.894" y1="4.094" x2="40.9" y2="4.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT16">
<contactref element="TLC5947" pad="21"/>
<contactref element="U$6" pad="P$2"/>
<wire x1="35.45" y1="9.155" x2="37.833" y2="9.155" width="0.3048" layer="1"/>
<wire x1="37.833" y1="9.155" x2="42.9" y2="4.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT17">
<contactref element="TLC5947" pad="22"/>
<contactref element="U$6" pad="P$1"/>
<wire x1="35.45" y1="9.805" x2="39.217" y2="9.805" width="0.3048" layer="1"/>
<wire x1="39.217" y1="9.805" x2="43.942" y2="5.08" width="0.3048" layer="1"/>
<wire x1="43.942" y1="5.08" x2="43.942" y2="3.13" width="0.3048" layer="1"/>
<wire x1="43.942" y1="3.13" x2="42.9" y2="2.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT18">
<contactref element="TLC5947" pad="23"/>
<contactref element="U$7" pad="P$3"/>
<wire x1="35.45" y1="10.455" x2="40.883" y2="10.455" width="0.3048" layer="1"/>
<wire x1="40.883" y1="10.455" x2="47.25" y2="4.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT19">
<contactref element="TLC5947" pad="24"/>
<contactref element="U$7" pad="P$2"/>
<wire x1="35.45" y1="11.105" x2="42.233" y2="11.105" width="0.3048" layer="1"/>
<wire x1="42.233" y1="11.105" x2="49.25" y2="4.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT20">
<contactref element="TLC5947" pad="25"/>
<contactref element="U$7" pad="P$1"/>
<wire x1="35.45" y1="11.755" x2="43.617" y2="11.755" width="0.3048" layer="1"/>
<wire x1="43.617" y1="11.755" x2="50.292" y2="5.08" width="0.3048" layer="1"/>
<wire x1="50.292" y1="5.08" x2="50.292" y2="3.13" width="0.3048" layer="1"/>
<wire x1="50.292" y1="3.13" x2="49.25" y2="2.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT21">
<contactref element="TLC5947" pad="26"/>
<contactref element="U$8" pad="P$3"/>
<wire x1="35.45" y1="12.405" x2="45.283" y2="12.405" width="0.3048" layer="1"/>
<wire x1="45.283" y1="12.405" x2="53.6" y2="4.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT22">
<contactref element="TLC5947" pad="27"/>
<contactref element="U$8" pad="P$2"/>
<wire x1="35.45" y1="13.055" x2="46.633" y2="13.055" width="0.3048" layer="1"/>
<wire x1="46.633" y1="13.055" x2="55.6" y2="4.088" width="0.3048" layer="1"/>
</signal>
<signal name="OUT23">
<contactref element="TLC5947" pad="28"/>
<contactref element="U$8" pad="P$1"/>
<wire x1="35.45" y1="13.705" x2="48.017" y2="13.705" width="0.3048" layer="1"/>
<wire x1="48.017" y1="13.705" x2="56.642" y2="5.08" width="0.3048" layer="1"/>
<wire x1="56.642" y1="5.08" x2="56.642" y2="3.13" width="0.3048" layer="1"/>
<wire x1="56.642" y1="3.13" x2="55.6" y2="2.088" width="0.3048" layer="1"/>
</signal>
<signal name="SOUT">
<contactref element="TLC5947" pad="29"/>
<contactref element="JP5" pad="6"/>
<wire x1="35.45" y1="14.355" x2="49.399" y2="14.355" width="0.3048" layer="1"/>
<wire x1="49.399" y1="14.355" x2="60.706" y2="3.048" width="0.3048" layer="1"/>
</signal>
<signal name="SCLK">
<contactref element="TLC5947" pad="3"/>
<contactref element="JP5" pad="5"/>
<contactref element="JP2" pad="5"/>
<wire x1="2.54" y1="5.588" x2="2.794" y2="5.588" width="0.6096" layer="16"/>
<wire x1="2.794" y1="5.588" x2="3.302" y2="6.096" width="0.6096" layer="16"/>
<wire x1="3.302" y1="6.096" x2="60.452" y2="6.096" width="0.6096" layer="16"/>
<wire x1="60.452" y1="6.096" x2="60.96" y2="5.588" width="0.6096" layer="16"/>
<wire x1="28.05" y1="15.005" x2="13.989" y2="15.005" width="0.3048" layer="1"/>
<wire x1="13.989" y1="15.005" x2="4.572" y2="5.588" width="0.3048" layer="1"/>
<wire x1="4.572" y1="5.588" x2="2.54" y2="5.588" width="0.3048" layer="1"/>
</signal>
<signal name="VDD">
<contactref element="JP1" pad="2"/>
<contactref element="U$3" pad="P$4"/>
<contactref element="U$1" pad="P$4"/>
<contactref element="U$2" pad="P$4"/>
<contactref element="U$6" pad="P$4"/>
<contactref element="U$4" pad="P$4"/>
<contactref element="U$5" pad="P$4"/>
<contactref element="U$7" pad="P$4"/>
<contactref element="U$8" pad="P$4"/>
<wire x1="53.594" y1="0.762" x2="49.784" y2="0.762" width="0.6096" layer="1"/>
<wire x1="49.784" y1="0.762" x2="47.244" y2="0.762" width="0.6096" layer="1"/>
<wire x1="47.244" y1="0.762" x2="42.164" y2="0.762" width="0.6096" layer="1"/>
<wire x1="42.164" y1="0.762" x2="40.894" y2="0.762" width="0.6096" layer="1"/>
<wire x1="40.894" y1="0.762" x2="34.798" y2="0.762" width="0.6096" layer="1"/>
<wire x1="34.798" y1="0.762" x2="26.924" y2="0.762" width="0.6096" layer="1"/>
<wire x1="26.924" y1="0.762" x2="20.574" y2="0.762" width="0.6096" layer="1"/>
<wire x1="20.574" y1="0.762" x2="19.304" y2="0.762" width="0.6096" layer="1"/>
<wire x1="19.304" y1="0.762" x2="14.224" y2="0.762" width="0.6096" layer="1"/>
<wire x1="14.224" y1="0.762" x2="12.192" y2="0.762" width="0.6096" layer="1"/>
<wire x1="12.192" y1="0.762" x2="11.684" y2="0.762" width="0.6096" layer="1"/>
<wire x1="11.684" y1="0.762" x2="7.874" y2="0.762" width="0.6096" layer="1"/>
<wire x1="11.69" y1="0.768" x2="11.684" y2="0.762" width="0.6096" layer="1"/>
<wire x1="19.31" y1="0.768" x2="19.304" y2="0.762" width="0.6096" layer="1"/>
<wire x1="34.55" y1="1.01" x2="34.798" y2="0.762" width="0.6096" layer="1"/>
<wire x1="42.17" y1="0.768" x2="42.164" y2="0.762" width="0.6096" layer="1"/>
<wire x1="49.79" y1="0.768" x2="49.784" y2="0.762" width="0.6096" layer="1"/>
<wire x1="53.6" y1="2.088" x2="53.6" y2="0.768" width="0.6096" layer="1"/>
<wire x1="53.6" y1="0.768" x2="53.594" y2="0.762" width="0.6096" layer="1"/>
<wire x1="47.25" y1="2.088" x2="47.25" y2="0.768" width="0.6096" layer="1"/>
<wire x1="47.25" y1="0.768" x2="47.244" y2="0.762" width="0.6096" layer="1"/>
<wire x1="40.9" y1="2.088" x2="40.9" y2="0.768" width="0.6096" layer="1"/>
<wire x1="40.9" y1="0.768" x2="40.894" y2="0.762" width="0.6096" layer="1"/>
<wire x1="34.55" y1="2.088" x2="34.55" y2="1.01" width="0.6096" layer="1"/>
<wire x1="26.93" y1="2.088" x2="26.93" y2="0.768" width="0.6096" layer="1"/>
<wire x1="26.93" y1="0.768" x2="26.924" y2="0.762" width="0.6096" layer="1"/>
<wire x1="20.58" y1="2.088" x2="20.58" y2="0.768" width="0.6096" layer="1"/>
<wire x1="20.58" y1="0.768" x2="20.574" y2="0.762" width="0.6096" layer="1"/>
<wire x1="14.23" y1="2.088" x2="14.23" y2="0.768" width="0.6096" layer="1"/>
<wire x1="14.23" y1="0.768" x2="14.224" y2="0.762" width="0.6096" layer="1"/>
<wire x1="7.88" y1="2.088" x2="7.88" y2="0.768" width="0.6096" layer="1"/>
<wire x1="7.88" y1="0.768" x2="7.874" y2="0.762" width="0.6096" layer="1"/>
<via x="18.034" y="9.906" extent="1-16" drill="0.6" shape="octagon"/>
<wire x1="18.034" y1="9.906" x2="17.78" y2="9.906" width="0.6096" layer="1"/>
<wire x1="17.78" y1="9.906" x2="12.446" y2="4.572" width="0.6096" layer="1"/>
<wire x1="12.446" y1="4.572" x2="12.446" y2="1.016" width="0.6096" layer="1"/>
<wire x1="12.446" y1="1.016" x2="12.192" y2="0.762" width="0.6096" layer="1"/>
<wire x1="20.844" y1="11.54" x2="19.668" y2="11.54" width="0.6096" layer="16"/>
<wire x1="19.668" y1="11.54" x2="18.034" y2="9.906" width="0.6096" layer="16"/>
</signal>
</signals>
</board>
</drawing>
<compatibility>
<note version="6.3" minversion="6.2.2" severity="warning">
Since Version 6.2.2 text objects can contain more than one line,
which will not be processed correctly with this version.
</note>
</compatibility>
</eagle>

repository: buffswinger/diodberg

repo_name: buffswinger/diodberg


text:
SUMMARY = "Firmware packages for the SM8350-HDK (aka HDK888) board"

inherit packagegroup

RRECOMMENDS:${PN} += " \
    ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'linux-firmware-qcom-adreno-a660', '', d)} \
    ${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'linux-firmware-qca', '', d)} \
    ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'linux-firmware-ath11k', '', d)} \
    firmware-qcom-sm8350-hdk \
    linux-firmware-qcom-sm8350-audio \
    linux-firmware-qcom-sm8350-compute \
    linux-firmware-qcom-sm8350-modem \
    linux-firmware-qcom-sm8350-sensors \
    linux-firmware-qcom-vpu-2.0 \
"

license: MIT

license_type: permissive

branch_name: refs/heads/master

extension: bb


text:
# - Find PNGOUT program
#
#   PNGOUT_EXECUTABLE - Path to the PNGOUT executable
#   PNGOUT_FOUND      - True if PNGOUT executable found

include(FindPackageHandleStandardArgs)

find_program(PNGOUT_EXECUTABLE NAMES pngout)
find_package_handle_standard_args(PNGOUT DEFAULT_MSG PNGOUT_EXECUTABLE)

mark_as_advanced(PNGOUT_EXECUTABLE)

license: ISC

repository: pweisenburger/ComicSight

repo_name: pweisenburger/ComicSight

extension: cmake


text:
package utils

import "encoding/json"

func MustAny2Map(i interface{}) (ret map[string]interface{}) {
	t, err := json.Marshal(i)
	if err != nil {
		panic(err)
	}
	err = json.Unmarshal(t, &ret)
	if err != nil {
		panic(err)
	}
	return
}

repository: moiot/gravity

repo_name: moiot/gravity

gha_language: Go

extension: go


text:
package db

import (
	"errors"
	"time"

	aes "github.com/Bit-Nation/panthalassa/crypto/aes"
	keyManager "github.com/Bit-Nation/panthalassa/keyManager"
	x3dh "github.com/Bit-Nation/x3dh"
	storm "github.com/asdine/storm"
	sq "github.com/asdine/storm/q"
)

const (
	SignedPreKeyValidTimeFrame = time.Hour * 24 * 60
)

type SignedPreKeyStorage interface {
	// persist the signed pre key
	// @todo don't forget to give the option to register a listener in the put function
	// @todo publish signed pre key to backend
	Put(signedPreKey x3dh.KeyPair) error
	Get(publicKey x3dh.PublicKey) (*x3dh.PrivateKey, error)
	All() ([]*x3dh.KeyPair, error)
}

type SignedPreKey struct {
	ValidTill           int64 `storm:"index"`
	EncryptedPrivateKey aes.CipherText
	privateKey          x3dh.PrivateKey
	PublicKey           x3dh.PublicKey `storm:"index,id"`
	Version             uint
}

func (s *SignedPreKey) PrivateKey() x3dh.PrivateKey {
	return s.privateKey
}

type BoltSignedPreKeyStorage struct {
	db storm.Node
	km *keyManager.KeyManager
}

func NewBoltSignedPreKeyStorage(db storm.Node, km *keyManager.KeyManager) *BoltSignedPreKeyStorage {
	return &BoltSignedPreKeyStorage{
		db: db,
		km: km,
	}
}

func (s *BoltSignedPreKeyStorage) Put(signedPreKey x3dh.KeyPair) error {

	privKeyCT, err := s.km.AESEncrypt(signedPreKey.PrivateKey[:])
	if err != nil {
		return err
	}

	return s.db.Save(&SignedPreKey{
		ValidTill:           time.Now().Add(SignedPreKeyValidTimeFrame).Unix(),
		EncryptedPrivateKey: privKeyCT,
		PublicKey:           signedPreKey.PublicKey,
		Version:             1,
	})
}

func (s *BoltSignedPreKeyStorage) Get(publicKey x3dh.PublicKey) (*x3dh.PrivateKey, error) {

	// check if signed pre key exist
	q := s.db.Select(sq.Eq("PublicKey", publicKey))
	amount, err := q.Count(&SignedPreKey{})
	if err != nil {
		return nil, err
	}
	if amount == 0 {
		return nil, nil
	}

	var spk SignedPreKey
	if err := q.First(&spk); err != nil {
		return nil, err
	}
	plainPrivKey, err := s.km.AESDecrypt(spk.EncryptedPrivateKey)
	if len(plainPrivKey) != 32 {
		return nil, errors.New("received invalid private key (len != 32)")
	}
	if err != nil {
		return nil, err
	}
	privKey := &x3dh.PrivateKey{}
	copy(privKey[:], plainPrivKey)

	return privKey, nil
}

func (s *BoltSignedPreKeyStorage) All() ([]*x3dh.KeyPair, error) {

	signedPreKeys := []*x3dh.KeyPair{}

	var persistedSignedPreKeys []SignedPreKey
	if err := s.db.All(&persistedSignedPreKeys); err != nil {
		return nil, err
	}

	for _, signedPreKey := range persistedSignedPreKeys {
		priv, err := s.Get(signedPreKey.PublicKey)
		if err != nil {
			return nil, err
		}
		signedPreKeys = append(signedPreKeys, &x3dh.KeyPair{
			PublicKey:  signedPreKey.PublicKey,
			PrivateKey: *priv,
		})
	}

	return signedPreKeys, nil

}

repository: Bit-Nation/panthalassa

repo_name: Bit-Nation/panthalassa

branch_name: refs/heads/develop

gha_license_id: MIT


text:
namespace DetectiveInvestigations.Katas
{
    /// <summary>
    /// https://www.codewars.com/kata/bit-calculator
    /// </summary>
    public static class BitCalculator
    {
        public static int Calculate(string num1, string num2)
        {
            return BinToDec(num1) + BinToDec(num2);
        }

        private static int BinToDec(string num)
        {
            int retval = 0;
            for (int i = 0; i < num.Length; i++)
                retval += (num[i] - '0') * pow(2, num.Length - i - 1);

            return retval;
        }

        private static int pow(int num, int power)
        {
            int retval = 1;
            for (int i = 0; i < power; i++)
                retval *= num;

            return retval;
        }
    }
}

extension: cs


text:
import { BREADCRUMBS_COLLAPSED } from "@blueprintjs/core/lib/esm/common/classes";
import { ifError } from "assert";
import { forInRight, fromPairs } from "lodash";
import {Octave, ThirdOctave} from "../compute/acoustics/bands";
import {directivityData} from "../objects/source";

export class CLFParser{

    // TODO:
    // - add support for comma decimal seperator
    // - fix vertical symmetry (not getting caught in switch statement)
    // - add support for rotation
    // - add support for phase data (CLF2 v2)

    private fileContents: string;
    private clfData: string[][];
    private clfVersion: number;

    private phi: number[];
    private theta: number[];
    private frequencies: number[];
    private angleres: number;

    private radiation: string;

    private minband: number;
    private maxband: number;

    constructor(fileContents: string){

        // get array of raw data
        this.fileContents = fileContents;
        this.clfData = this.getCLFArray(this.fileContents);

        // check that file is valid
        //if(!this.isvalid()){
            //console.error("Invalid CLF file")
        //}

        //get CLF version
        this.clfVersion = parseInt(this.clfData[0][0].substring(4,5));

        //get min band, max band, radiation type
        this.minband = this.parseProperty("<MINBAND>").result;
        this.maxband = this.parseProperty("<MAXBAND>").result;
        this.radiation = this.parseProperty("<RADIATION>").result;

        // define frequencies and angle resolution based on clf version (1 or 2)
        switch (this.clfVersion){
            case 1:
                this.frequencies = Octave(this.minband, this.maxband);
                this.angleres = 10;
                break;
            case 2:
                this.frequencies = ThirdOctave(this.minband, this.maxband);
                this.angleres = 5;
                break;
            default:
                console.error("Unsupported CLF version or not a CLF file");
                this.frequencies = [];
                this.angleres = 0;
        }

        // create theta list based on radiation type
        if(this.radiation == "<halfsphere>"){
            this.theta = this.createAngleList(0,this.angleres,90);
        }else{
            this.theta = this.createAngleList(0,this.angleres,180);
        }

        // create phi list
        this.phi = this.createAngleList(0,this.angleres,360-this.angleres);
    }

    public parse(): CLFResult {

        let result: CLFResult = {
            clfversion: this.clfVersion,

            speakerName: "",
            speakerDescription: "",
            speakerType: "",

            symmetry: "",
            arcorder: "",
            sign: "",
            reference: "",

            measurementDistance: 0,

            phi: this.phi,
            theta: this.theta,
            frequencies: this.frequencies,
            minband: this.frequencies[0],
            maxband: this.frequencies[this.frequencies.length-1],
            angleres: this.angleres,

            sensitivity: [],
            impedance: [],
            axialspectrum: [],

            directivity: [],
        }

        // read speaker name, description, type
        result.speakerName = this.parseProperty("<MODELNAME>").result;
        result.speakerDescription = this.parseProperty("<DESCRIPTION>").result;
        result.speakerType = this.parseProperty("<TYPE>").result;

        // read symmetry, arcorder, sign, reference
        result.symmetry = this.parseProperty("<BALLOON-SYMMETRY>").result;
        result.arcorder = this.parseProperty("<BALLOON-ARC-ORDER>").result;
        result.sign = this.parseProperty("<SIGN>").result;
        result.reference = this.parseProperty("<BALLOON-REF>").result;

        // read measurement distance
        result.measurementDistance = this.parseProperty("<MEASUREMENT-DISTANCE>").result;

        // read sensitivity, impedance, axial spectrum
        result.sensitivity = this.parseProperty("<SENSITIVITY>").result;
        result.impedance = this.parseProperty("<IMPEDANCE>").result;
        result.axialspectrum = this.parseProperty("<AXIAL-SPECTRUM>").result;

        // get directivity data at each frequency, apply symmetry (if specified), reverse (if specified)
        for(let i:number = 0; i<this.frequencies.length; i++){

            let sym = String(result.symmetry);
            result.directivity[i] = this.applySymmetry(sym, this.parseDirectivity(this.frequencies[i]));

            if(result.arcorder == "<reversed>"){
                result.directivity[i].directivity.reverse();
            }
        }

        return result;

    };

    public parseProperty(property: string, rowStartIndex: number = 0): parsePropertyResult{
        // returns value of a property in the CLF file specified as "property" (including '<' and '>')
        // starts searching in the CLF file at optional value 'rowStartIndex'

        let result: any = [];
        let property_re = new RegExp(property);

        //for every row in clfData
        for(let i:number = rowStartIndex; i<this.clfData.length;i++){

            // for every column in row
            for(let j = 0; j<this.clfData[i].length;j++){

                // if the array item passes the RegExp test() method (matching strings)
                if(property_re.test(this.clfData[i][j])){

                    // for each column in the row after the tag
                    for(let k = j+1; k<this.clfData[i].length;k++){

                        //try to convert value to number
                        const floatConversion = parseFloat(this.clfData[i][k]);
                        if(!isNaN(floatConversion)){
                            //result is a number
                            result.push(floatConversion);
                        }else{
                            //result is a string

                            const comment_re = /(#\w+)/; // regexp defining the beginning of a comment
                            const empty_re = /^(?![\s\S])/; // regexp defining an empty character
                            const newtag_re = /(<[A-Z]+>)/; //regexp defining the beginning of a tag (starting/ending with <> and all caps)
                            const nodata_re = /<nodata>/; //regexp to match nodata tags

                            let stringData = this.clfData[i][k];

                            // string checking
                            if(comment_re.test(stringData)){
                                // data is a comment. skip the rest of the line
                                break;
                            }else if(newtag_re.test(stringData)){
                                // data is a tag. skip the rest of the line
                                break;
                            }else if(stringData=="" || stringData =="\n" || stringData =="\t" || stringData =="\r"){
                                // data is empty. skip this element
                                continue;
                            }else if(nodata_re.test(stringData)){
                                // data is <nodata>. push a 0 for now.
                                result.push(0);
                                continue;
                            }else{
                                // everything passed, push data to result.
                                result.push(stringData);
                            }
                        }
                    }

                    let pr: parsePropertyResult = {
                        result: result,
                        nextIndex: i+1,
                    };

                    if (pr.result.length == 1){
                        pr.result = result[0];
                        return pr;
                    }else{
                        return pr;
                    }
                }
            }
        }

        //catch
        let pr: parsePropertyResult = {
            result: "",
            nextIndex: 0,
        };
       return pr;
    }

    public parseDirectivity(band: number): directivityData{
        // get the directivity data of an octave band in a CLF file

        let dirData: directivityData = {
            frequency: band,
            directivity: [],
        };

        // check that frequency is valid
        if(!this.frequencies.includes(band)){
            console.error("Invalid Frequency Band!")
            return dirData;
        }

        let search: boolean = true;
        let searchStart: number = 0;

        let dir: number[][];
        dir = Array(Array());

        while(search){
            let parseResult = this.parseProperty("<BAND>",searchStart)
            searchStart = parseResult.nextIndex;

            if(typeof parseResult.result === "number" && band == parseResult.result){
                let parsing: boolean = true;
                let nextBandIndex: number;

                nextBandIndex = this.parseProperty("<BAND>", searchStart).nextIndex;

                let j = 0;
                for(let i = parseResult.nextIndex; i<nextBandIndex-1; i++){
                    dir[j] = this.parseRowAsNumber(i);
                    j++;
                }

                dirData.directivity = dir;
                search = false;
            }
        }
        return dirData;
    }

    private parseRowAsNumber(rowNumber: number): number[]{
        let row: string[] = this.clfData[rowNumber];
        let rowAsNum: number[] = Array();

        for(let i = 0; i<row.length; i++){
            rowAsNum.push(parseFloat(row[i]));
        }

        return rowAsNum;
    }

    private applySymmetry(symmetryType: string, baseDirData: directivityData): directivityData{
        //apply specified symmetry to a single directivityData interface

        let resultDir: number[][] = Array(Array());

        let copyBlock: number[][] = Array(Array());
        let copyBlockRev: number[][];

        switch (symmetryType.trim()){
            // see CLF Specification pdf for more info re: symmetry types

            case "<full>":
                //radial symmetry about front of speaker (Q1 given)

                copyBlock = baseDirData.directivity.slice(0,(this.phi.length/4)+1);
                copyBlockRev = (copyBlock.slice(0,(this.phi.length/4))).reverse();

                resultDir = copyBlock.concat(copyBlockRev);

                let horzTemp: directivityData = {
                    frequency: baseDirData.frequency,
                    directivity: resultDir,
                };

                let horzAppliedDirData = this.applySymmetry("<horizontal>", horzTemp);
                resultDir = horzAppliedDirData.directivity;

                break;

            case "<horizontal>":
                //left/right symmetry (Q1 and Q2 given)
                copyBlock = baseDirData.directivity.slice(0,(this.phi.length/2)+1);
                copyBlockRev = (copyBlock.slice(1,(this.phi.length/2))).reverse();
                resultDir = copyBlock.concat(copyBlockRev);

                break;

            case "<vertical>":
                //top/bottom symmetry (Q4 and Q1 given)

                let Q4: number[][] = baseDirData.directivity.slice(0,this.phi.length/4);
                let Q1: number[][] = baseDirData.directivity.slice(this.phi.length/4, this.phi.length/2);

                let Q1Q2_temp: directivityData = {
                    frequency: baseDirData.frequency,
                    directivity: Q1,
                }

                let Q3Q4_temp: directivityData = {
                    frequency: baseDirData.frequency,
                    directivity: Q4,
                }

                let Q1Q2 = this.applySymmetry("<Full>", Q1Q2_temp).directivity.slice(0,this.phi.length/2);
                let Q3Q4 = this.applySymmetry("<Full>", Q3Q4_temp).directivity.slice(0,this.phi.length/2);

                resultDir = Q1Q2.concat(Q3Q4.reverse());

                break;

            case "<rotational>":
                //copy first slice over entire balloon
                copyBlock[0] = baseDirData.directivity[0];

                for(let i = 0; i<this.phi.length; i++){
                    resultDir[i] = copyBlock[0];
                }

                break;

            default:
                //no symmetry or type not recognized. return unmodified directivity array
                resultDir = baseDirData.directivity;
                break;
        }

        baseDirData.directivity = resultDir;
        return baseDirData;
    }

    private isvalid(): boolean{
        //check if a CLF file is valid based on the "<CLFn>" tag that should come first

        if (this.clfData[0][0] == "<CLF1>" || this.clfData[0][0] == "<CLF2>"){
            return true;
        }
        else{
            return false;
        }
    }

    private getCLFArray(contents: string): string[][]{
        //get array of raw CLF data

        let clfArray =  contents.split('\n').map(function(ln){
            return ln.split('\t');
        });
        return clfArray;
    }

    private createAngleList(min: number, increment: number, max: number): number[]{
        // create a list of angles based on min, max, and increment

        let numangles: number = (max-min)/increment;
        let angle: number  = min;

        let list: number[] = Array(numangles);

        for(let i = 0; i <= numangles; i++){
            list[i] = angle;
            angle = angle+increment;
        }

        return list
    }

}

interface parsePropertyResult{
    result: any;
    nextIndex: number;
}

export interface CLFResult {
    clfversion: number;

    speakerName: string;
    speakerDescription: string;
    speakerType: string;

    symmetry: string;
    arcorder: string;
    sign: string;
    reference: string;

    measurementDistance: number;

    phi: number[];
    theta: number[];
    frequencies: number[];
    minband: number;
    maxband: number;
    angleres: number;

    sensitivity: number[];
    impedance: number[];
    axialspectrum: number[];

    directivity: directivityData[];
}

repository: gregzanch/cram

repo_name: gregzanch/cram

gha_language: TypeScript

extension: ts


text:
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using NICE.Identity.Authorisation.WebAPI.Services;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Web;

namespace NICE.Identity.Authorisation.WebAPI.Controllers
{
	[Route("api/[controller]")]
	[ApiController]
	[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
	public class ClaimsController : ControllerBase
	{
		private readonly IClaimsService _claimsService;
		private readonly ILogger<ClaimsController> _logger;

		public ClaimsController(IClaimsService claimsService, ILogger<ClaimsController> logger)
	    {
		    _claimsService = claimsService ?? throw new ArgumentNullException(nameof(claimsService));
		    _logger = logger ?? throw new ArgumentNullException(nameof(logger));
		}

		// GET api/claims/someuserid
	    [HttpGet("{authenticationProviderUserId}")]
	    public async Task<ActionResult<IEnumerable<ApiModels.Claim[]>>> Get(string authenticationProviderUserId)
	    {
	        try
	        {
	            var result = _claimsService.GetClaims(HttpUtility.UrlDecode(authenticationProviderUserId));

	            if (result == null)
	            {
	                return StatusCode(404, "User not found");
	            }

	            return Ok(result);
	        }
	        catch (Exception e)
	        {
	            return StatusCode(503, e.Message);
	        }
	    }
	}
}

repository: nice-digital/identity

repo_name: nice-digital/identity

gha_language: C#


text:
#ifndef SRC_CONTAINERS_ARRAY1DBOOL_HPP_
#define SRC_CONTAINERS_ARRAY1DBOOL_HPP_

#include "../Logger/Logger.h"

namespace Containers{

	template <size_t _size>
	class Array1D<bool, _size>{
	public:
		class BoolProxy;
		Array1D(bool initialValues = false);
		~Array1D(){}
		BoolProxy at(size_t offset);
		bool at(size_t offset) const;
		BoolProxy operator[](size_t offset);
		bool operator[](size_t offset) const;
		size_t size(){return _size;}
	private:
		uint16_t m_rawContainer[_size/16 +1];
	};

	template <size_t _size>
	class Array1D<bool, _size>::BoolProxy{
	public:
		BoolProxy(size_t offset, uint16_t (&rawContainer)[_size/16+1]):
			m_offset(offset), m_rawContainer(rawContainer){};
		operator bool()const;
		void operator=(bool newValue);

	private:
		const size_t m_offset;
		uint16_t (&m_rawContainer)[_size/16+1];
	};

	template<size_t _size>
	Array1D<bool, _size>::Array1D(bool initialValues){
		LOG_DETAILED("");
		for(size_t currentIdx=0; currentIdx<(_size/16+1); ++currentIdx){
			m_rawContainer[currentIdx] = initialValues ? 0xFFFF : 0x0000;
		}
	}

	template<size_t _size>
	typename Array1D<bool, _size>::BoolProxy Array1D<bool, _size>::at(size_t offset){
		LOG_DETAILED("");
		return BoolProxy(offset, m_rawContainer);
	}

	template<size_t _size>
	bool Array1D<bool, _size>::at(size_t offset) const{
		LOG_DETAILED("");
		size_t containerOffset = offset/_size;
		size_t containerOffsetMod = offset%_size;
		return m_rawContainer[containerOffset] & (1<<containerOffsetMod);
	}

	template<size_t _size>
	typename Array1D<bool, _size>::BoolProxy Array1D<bool, _size>::operator[](size_t offset){
		LOG_DETAILED("");
		return BoolProxy(offset, m_rawContainer);
	}

	template<size_t _size>
	bool Array1D<bool, _size>::operator[](size_t offset) const{
		LOG_DETAILED("");
		size_t containerOffset = offset/_size;
		size_t containerOffsetMod = offset%_size;
		return m_rawContainer[containerOffset] & (1<<containerOffsetMod);
	}

	template<size_t _size>
	Array1D<bool, _size>::BoolProxy::operator bool() const {
		LOG_DETAILED("");
		size_t containerOffset = m_offset/_size;
		size_t containerOffsetMod = m_offset%_size;
		return m_rawContainer[containerOffset] & (1<<containerOffsetMod);
	}

	template <size_t _size>
	void Array1D<bool, _size>::BoolProxy::operator=(bool newValue){
		LOG_DETAILED("");
		size_t containerOffset = m_offset/_size;
		size_t containerOffsetMod = m_offset%_size;
		if(newValue)
			m_rawContainer[containerOffset] |= 1<<containerOffsetMod;
		else
			m_rawContainer[containerOffset] &= ~(1<<containerOffsetMod);
	}

}

#endif /* SRC_CONTAINERS_ARRAY1DBOOL_HPP_ */

repository: DawidPi/gameForTMS

repo_name: DawidPi/gameForTMS

extension: hpp


text:
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See the LICENSE.md file in the project root for more information.

using System;

namespace Microsoft.VisualStudio.ProjectSystem.Tools.BuildLogging.Model
{
    [Flags]
    public enum BuildType
    {
        None = 0x0,
        Build = 0x1,
        DesignTimeBuild = 0x2,
        Evaluation = 0x4,
        Roslyn = 0x8,
        All = Build | DesignTimeBuild | Evaluation | Roslyn
    }
}

repository: dotnet/project-system-tools

repo_name: dotnet/project-system-tools

branch_name: refs/heads/main


text:
package service

import (
	"bytes"
	"context"
	"encoding/json"
	"fmt"
	"github.com/Azure/azure-sdk-for-go/profiles/2019-03-01/authorization/mgmt/authorization"
	"github.com/Azure/azure-sdk-for-go/profiles/latest/graphrbac/graphrbac"
	"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-06-01/network"
	"github.com/Azure/go-autorest/autorest"
	"github.com/Azure/go-autorest/autorest/adal"
	"github.com/Azure/go-autorest/autorest/azure"
	"github.com/Azure/go-autorest/autorest/azure/auth"
	"github.com/Azure/go-autorest/autorest/to"
	"github.com/google/uuid"
	"github.com/hazelcast/hazelcast-cloud-cli/util"
	hazelcastcloud "github.com/hazelcast/hazelcast-cloud-sdk-go"
	"github.com/hazelcast/hazelcast-cloud-sdk-go/models"
	"net/http"
	"strings"
	"time"
)

type AzurePeeringService struct {
	client                         *hazelcastcloud.Client
	customerPeeringProperties      *AzureCustomerPeeringProperties
	hazelcastPeeringProperties     *models.AzurePeeringProperties
	hazelcastVnetPeeringClient     network.VirtualNetworkPeeringsClient
	customerVnetPeeringClient      network.VirtualNetworkPeeringsClient
	customerServicePrincipalClient graphrbac.ServicePrincipalsClient
	customerRoleAssignmentClient   authorization.RoleAssignmentsClient
	servicePrincipal               graphrbac.ServicePrincipal
	customerVnetPeering            network.VirtualNetworkPeering
	hazelcastVnetPeering           network.VirtualNetworkPeering
}

type AzureCustomerPeeringProperties struct {
	ClusterId         string
	VnetName          string
	SubscriptionId    string
	TenantId          string
	ResourceGroupName string
}

func NewAzurePeeringService(client *hazelcastcloud.Client, customerProperties *AzureCustomerPeeringProperties) AzurePeeringService {
	return AzurePeeringService{
		client:                    client,
		customerPeeringProperties: customerProperties,
	}
}

func (s *AzurePeeringService) Create(indicator *util.LoadingIndicator) error {
	indicator.SetStep("Peering Properties collecting...", 10)
	initHazelcastPeeringPropertiesErr := s.initHazelcastPeeringProperties()
	if initHazelcastPeeringPropertiesErr != nil {
		return initHazelcastPeeringPropertiesErr
	}
	indicator.SetStep("Clients initializing...", 20)
	initClientErr := s.initClients()
	if initClientErr != nil {
		return initClientErr
	}
	indicator.SetStep("Service Principal creating...", 30)
	initServicePrincipalErr := s.createServicePrincipal()
	if initServicePrincipalErr != nil {
		return initServicePrincipalErr
	}
	indicator.SetStep("Role Assignment creating...", 45)
	initRoleAssignmentsErr := s.createRoleAssignment()
	if initRoleAssignmentsErr != nil {
		return initRoleAssignmentsErr
	}
	indicator.SetStep("Orphan Peerings deleting...", 55)
	deleteOrphanPeeringsErr := s.deleteOrphanPeerings()
	if deleteOrphanPeeringsErr != nil {
		return deleteOrphanPeeringsErr
	}
	indicator.SetStep("Customer Peering creating...", 65)
	initCustomerPeeringErr := s.createCustomerPeering()
	if initCustomerPeeringErr != nil {
		return initCustomerPeeringErr
	}
	indicator.SetStep("Hazelcast Peering creating...", 80)
	initHazelcastPeeringErr := s.createHazelcastPeering()
	if initHazelcastPeeringErr != nil {
		return initHazelcastPeeringErr
	}
	indicator.SetStep("Peering notifying...", 95)
	notifyPeeringErr := s.notifyPeering()
	if notifyPeeringErr != nil {
		return notifyPeeringErr
	}
	return nil
}

func (s *AzurePeeringService) notifyPeering() error {
	jsonObject, _ := json.Marshal(struct {
		ClusterId           string `json:"clusterId"`
		PeeringConnectionId string `json:"peeringConnectionId"`
		VnetId              string `json:"vpcId"`
		VnetCidr            string `json:"vpcCidr"`
	}{
		s.customerPeeringProperties.ClusterId,
		*s.hazelcastVnetPeering.Name,
		s.customerPeeringProperties.VnetName,
		(*s.hazelcastVnetPeering.RemoteAddressSpace.AddressPrefixes)[0],
	})
	request, requestErr := http.NewRequest("POST", fmt.Sprintf("https://%s/peerings", s.client.BaseURL.Host), bytes.NewBuffer(jsonObject))
	if requestErr != nil {
		return requestErr
	}
	request.Header.Add("Content-Type", "application/json")
	request.Header.Add("Accept", "application/json")
	request.Header.Add("User-Agent", "hazelcast-cloud-sdk-go")
	request.Header.Set("Authorization", fmt.Sprintf("Bearer %s", s.client.Token))
	client := &http.Client{}
	_, respErr := client.Do(request)
	if respErr != nil {
		return respErr
	}
	return nil
}

func (s *AzurePeeringService) createHazelcastPeering() error {
	hazelcastPeeringName :=  s.generatePeeringName()
	createHazelcastPeering, createHazelcastPeeringErr := s.hazelcastVnetPeeringClient.CreateOrUpdate(context.Background(),
		s.hazelcastPeeringProperties.ResourceGroupName, s.hazelcastPeeringProperties.VnetName, hazelcastPeeringName,
		network.VirtualNetworkPeering{VirtualNetworkPeeringPropertiesFormat: &network.VirtualNetworkPeeringPropertiesFormat{
			AllowVirtualNetworkAccess: to.BoolPtr(true),
			AllowForwardedTraffic:     to.BoolPtr(true),
			RemoteVirtualNetwork: &network.SubResource{
				ID: to.StringPtr(s.getCustomerVnetId()),
			},
		}})
	if createHazelcastPeeringErr != nil {
		return createHazelcastPeeringErr
	}
	_ = createHazelcastPeering.WaitForCompletionRef(context.Background(), s.hazelcastVnetPeeringClient.Client)
	hazelcastPeering, hazelcastPeeringErr := s.hazelcastVnetPeeringClient.Get(context.Background(),
		s.hazelcastPeeringProperties.ResourceGroupName, s.hazelcastPeeringProperties.VnetName, hazelcastPeeringName)
	if hazelcastPeeringErr != nil {
		return hazelcastPeeringErr
	}
	s.hazelcastVnetPeering = hazelcastPeering
	return nil
}

func (s *AzurePeeringService) createCustomerPeering() error {
	customerPeeringName := s.generatePeeringName()
	createCustomerPeering, createCustomerPeeringErr := s.customerVnetPeeringClient.CreateOrUpdate(context.Background(),
		s.customerPeeringProperties.ResourceGroupName, s.customerPeeringProperties.VnetName, customerPeeringName,
		network.VirtualNetworkPeering{VirtualNetworkPeeringPropertiesFormat: &network.VirtualNetworkPeeringPropertiesFormat{
			AllowVirtualNetworkAccess: to.BoolPtr(true),
			AllowForwardedTraffic:     to.BoolPtr(true),
			RemoteVirtualNetwork: &network.SubResource{
				ID: to.StringPtr(s.getHazelcastVnetId()),
			},
		}})
	if createCustomerPeeringErr != nil {
		return createCustomerPeeringErr
	}
	_ = createCustomerPeering.WaitForCompletionRef(context.Background(), s.customerVnetPeeringClient.Client)
	customerPeering, customerPeeringErr := s.customerVnetPeeringClient.Get(context.Background(),
		s.customerPeeringProperties.ResourceGroupName, s.customerPeeringProperties.VnetName, customerPeeringName)
	if customerPeeringErr != nil {
		return customerPeeringErr
	}
	s.customerVnetPeering = customerPeering
	return nil
}

func (s *AzurePeeringService) deleteOrphanPeerings() error {
	customerPeeringList, customerPeeringListErr := s.customerVnetPeeringClient.List(context.Background(),
		s.customerPeeringProperties.ResourceGroupName, s.customerPeeringProperties.VnetName)
	if customerPeeringListErr != nil {
		return customerPeeringListErr
	}
	for _,customerPeer := range customerPeeringList.Values() {
		if  *customerPeer.RemoteVirtualNetwork.ID == s.getHazelcastVnetId() {
			if customerPeer.PeeringState != network.VirtualNetworkPeeringStateConnected {
				deleteCustomerPeering, deleteCustomerPeeringErr := s.customerVnetPeeringClient.Delete(context.Background(),
					s.customerPeeringProperties.ResourceGroupName, s.customerPeeringProperties.VnetName, *customerPeer.Name)
				if deleteCustomerPeeringErr != nil {
					return deleteCustomerPeeringErr
				}
				_ = deleteCustomerPeering.WaitForCompletionRef(context.Background(), s.customerVnetPeeringClient.Client)
			} else {
				return fmt.Errorf("you already have one connected peering connection named %s", *customerPeer.Name)
			}
		}
	}
	return nil
}

func (s *AzurePeeringService) createRoleAssignment() error {
	networkContributorRoleId := fmt.Sprintf("/subscriptions/%s/providers/Microsoft.Authorization/roleDefinitions/4d97b98b-1d4f-4787-a291-c67834d212e7",
		s.customerPeeringProperties.SubscriptionId)
	_, roleAssignmentErr := s.customerRoleAssignmentClient.Create(context.Background(), s.getCustomerVnetId(),
		uuid.New().String(), authorization.RoleAssignmentCreateParameters{
			Properties: &authorization.RoleAssignmentProperties{
				RoleDefinitionID: &networkContributorRoleId,
				PrincipalID:      s.servicePrincipal.ObjectID,
			},
		})
	if roleAssignmentErr != nil {
		if roleAssignmentErr.(autorest.DetailedError).StatusCode != 409 {
			return roleAssignmentErr
		} else {
			return nil
		}
	}
	time.Sleep(20 * time.Second)
	return nil
}

func (s *AzurePeeringService) createServicePrincipal() error {
	servicePrincipal, createServicePrincipalErr := s.customerServicePrincipalClient.Create(context.Background(),
		graphrbac.ServicePrincipalCreateParameters{
			AppID:          &s.hazelcastPeeringProperties.AppRegistrationId,
			AccountEnabled: to.BoolPtr(true),
		})
	if createServicePrincipalErr != nil {
		if createServicePrincipalErr.(autorest.DetailedError).StatusCode != 409 {
			return createServicePrincipalErr
		}
		servicePrincipalList, servicePrincipalListErr := s.customerServicePrincipalClient.List(
			context.Background(), fmt.Sprintf("appId eq '%s'", s.hazelcastPeeringProperties.AppRegistrationId))
		if servicePrincipalListErr != nil {
			return servicePrincipalListErr
		}
		s.servicePrincipal = servicePrincipalList.Values()[0]
		return nil
	}
	time.Sleep(60 * time.Second)
	s.servicePrincipal = servicePrincipal
	return nil
}

func (s *AzurePeeringService) initHazelcastPeeringProperties() error {
	hazelcastPeeringProperties, _, hazelcastPeeringPropertiesErr := s.client.AzurePeering.GetProperties(context.Background(), &models.GetAzurePeeringPropertiesInput{
		ClusterId: s.customerPeeringProperties.ClusterId,
	})
	if hazelcastPeeringPropertiesErr != nil {
		return hazelcastPeeringPropertiesErr
	}
	s.hazelcastPeeringProperties = hazelcastPeeringProperties
	return nil
}

func (s *AzurePeeringService) initClients() error {
	env, envErr := azure.EnvironmentFromName("AzurePublicCloud")
	if envErr != nil {
		return envErr
	}

	hazelcastOauthConfig, hazelcastOauthConfigErr := adal.NewMultiTenantOAuthConfig(env.ActiveDirectoryEndpoint,
		s.hazelcastPeeringProperties.TenantId, []string{s.customerPeeringProperties.TenantId}, adal.OAuthOptions{})
	if hazelcastOauthConfigErr != nil {
		return hazelcastOauthConfigErr
	}

	hazelcastToken, hazelcastTokenErr := adal.NewMultiTenantServicePrincipalToken(hazelcastOauthConfig,
		s.hazelcastPeeringProperties.AppRegistrationId, s.hazelcastPeeringProperties.AppRegistrationKey, env.ResourceManagerEndpoint)
	if hazelcastTokenErr != nil {
		return hazelcastOauthConfigErr
	}

	customerOauthConfig, customerOauthConfigErr := adal.NewMultiTenantOAuthConfig(env.ActiveDirectoryEndpoint,
		s.customerPeeringProperties.TenantId, []string{s.hazelcastPeeringProperties.TenantId}, adal.OAuthOptions{})
	if customerOauthConfigErr != nil {
		return customerOauthConfigErr
	}

	customerToken, customerTokenErr := adal.NewMultiTenantServicePrincipalToken(customerOauthConfig,
		s.hazelcastPeeringProperties.AppRegistrationId, s.hazelcastPeeringProperties.AppRegistrationKey, env.ResourceManagerEndpoint)
	if customerTokenErr != nil {
		return customerTokenErr
	}

	customerAuthorizer, customerAuthorizerErr := auth.NewAuthorizerFromCLI()
	if customerAuthorizerErr != nil {
		return fmt.Errorf("you need to have Azure CLI installed and execute `az login` command successfully. For more information https://docs.cloud.hazelcast.com/docs/azure-vnet-peering . Azure Error:%s", customerAuthorizerErr)
	}

	customerGraphAuthorizer, customerGraphAuthorizerErr := auth.NewAuthorizerFromCLIWithResource(env.GraphEndpoint)
	if customerGraphAuthorizerErr != nil {
		return fmt.Errorf("you need to have Azure CLI installed and execute `az login` command successfully. For more information https://docs.cloud.hazelcast.com/docs/azure-vnet-peering . Azure Error:%s", customerGraphAuthorizerErr)
	}

	s.hazelcastVnetPeeringClient = network.NewVirtualNetworkPeeringsClient(s.hazelcastPeeringProperties.SubscriptionId)
	s.hazelcastVnetPeeringClient.Authorizer = autorest.NewMultiTenantBearerAuthorizer(hazelcastToken)
	s.customerVnetPeeringClient = network.NewVirtualNetworkPeeringsClient(s.customerPeeringProperties.SubscriptionId)
	s.customerVnetPeeringClient.Authorizer = autorest.NewMultiTenantBearerAuthorizer(customerToken)
	s.customerServicePrincipalClient = graphrbac.NewServicePrincipalsClient(s.customerPeeringProperties.TenantId)
	s.customerServicePrincipalClient.Authorizer = customerGraphAuthorizer
	s.customerRoleAssignmentClient = authorization.NewRoleAssignmentsClient(s.customerPeeringProperties.SubscriptionId)
	s.customerRoleAssignmentClient.Authorizer = customerAuthorizer

	return nil
}

func (s *AzurePeeringService) getCustomerVnetId() string {
	return fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/virtualNetworks/%s",
		s.customerPeeringProperties.SubscriptionId, s.customerPeeringProperties.ResourceGroupName, s.customerPeeringProperties.VnetName)
}

func (s *AzurePeeringService) getHazelcastVnetId() string {
	return fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/virtualNetworks/%s",
		s.hazelcastPeeringProperties.SubscriptionId, s.hazelcastPeeringProperties.ResourceGroupName, s.hazelcastPeeringProperties.VnetName)
}

func (s *AzurePeeringService) generatePeeringName() string {
	return strings.Replace(strings.ToLower(uuid.New().String()), "-", "", -1)[0:8]
}

repository: hazelcast/hazelcast-cloud-cli

repo_name: hazelcast/hazelcast-cloud-cli


text:
import { Module } from '@nestjs/common';
import InternalService from './internal.service';
import { SlackApiModule } from './slack-api/slack.api.module';
import { ClickhouseModule } from './clickhouse/clickhouse.module';

@Module({
  imports: [SlackApiModule, ClickhouseModule],
  providers: [InternalService],
  exports: [SlackApiModule, ClickhouseModule],
})
export class InternalModule {}

repository: DrNorton/slack-bot

repo_name: DrNorton/slack-bot


text:
package iotdb

import (
	"github.com/apache/iotdb-client-go/client"
)

// Client represents a client for an IoTDB server instance.
type Client struct {
	Host        string
	Port        string
	Username    string
	Password    string
	TimeoutInMs int
}

// CountStorageGroups returns the storage groups count from a IoTDB instance.
func (c Client) CountStorageGroups() (int, error) {
	session, err := c.newSession()

	if err != nil {
		return -1, err
	}

	defer session.Close()

	resp, err := session.ExecuteQueryStatement("SHOW STORAGE GROUP")
	if err != nil {
		return -1, err
	}

	var count = 0
	for {
		hasNext, err := resp.Next()
		if err != nil {
			return -1, err
		}

		if !hasNext {
			return count, nil
		}

		count++
	}

	return -1, nil
}

// CountTimeSeries returns the time series count from a IoTDB instance.
func (c Client) CountTimeSeries() (int32, error) {
	session, err := c.newSession()

	if err != nil {
		return -1, err
	}

	defer session.Close()

	resp, err := session.ExecuteQueryStatement("COUNT TIMESERIES")
	if err != nil {
		return -1, err
	}

	hasNext, err := resp.Next()
	if err != nil {
		return -1, err
	}

	var count int32
	if !hasNext {
		return count, nil
	}

	if err := resp.Scan(&count); err != nil {
		return -1, err
	}

	return count, nil
}

// GetWriteAheadLogFileSize returns the write ahead log file size (in bytes) from a IoTDB instance.
func (c Client) GetWriteAheadLogFileSize() (int64, error) {
	session, err := c.newSession()

	if err != nil {
		return -1, err
	}

	defer session.Close()

	resp, err := session.ExecuteQueryStatement("SELECT LAST_VALUE(WAL) FROM root.stats.file_size")
	if err != nil {
		return -1, err
	}

	hasNext, err := resp.Next()
	if err != nil {
		return -1, err
	}

	var count int64
	if !hasNext {
		return count, nil
	}

	if err := resp.Scan(&count); err != nil {
		return -1, err
	}

	return count, nil
}

// GetSystemFileSize returns the system file size (in bytes) from a IoTDB instance.
func (c Client) GetSystemFileSize() (int64, error) {
	session, err := c.newSession()

	if err != nil {
		return -1, err
	}

	defer session.Close()

	resp, err := session.ExecuteQueryStatement("SELECT LAST_VALUE(SYS) FROM root.stats.file_size")
	if err != nil {
		return -1, err
	}

	hasNext, err := resp.Next()
	if err != nil {
		return -1, err
	}

	var count int64
	if !hasNext {
		return count, nil
	}

	if err := resp.Scan(&count); err != nil {
		return -1, err
	}

	return count, nil
}

// CountUsers returns the users count from a IoTDB instance.
func (c Client) CountUsers() (int, error) {
	session, err := c.newSession()

	if err != nil {
		return -1, err
	}

	defer session.Close()

	resp, err := session.ExecuteQueryStatement("LIST USER")
	if err != nil {
		return -1, err
	}

	var count = 0
	for {
		hasNext, err := resp.Next()
		if err != nil {
			return -1, err
		}

		if !hasNext {
			return count, nil
		}

		count++
	}

	return -1, nil
}

// PingServer pings a IoTDB instance to know if the server is running or not.
func (c Client) PingServer() error {
	session, err := c.newSession()

	if err != nil {
		return err
	}

	defer session.Close()

	return nil
}

func (c Client) newSession() (*client.Session, error) {
	session := client.NewSession(&client.Config{
		Host:     c.Host,
		Port:     c.Port,
		UserName: c.Username,
		Password: c.Password,
	})

	err := session.Open(false, c.TimeoutInMs)
	if err != nil {
		return nil, err
	}

	return session, nil
}

// NewClient instantiates a new client for an IoTDB server instance.
func NewClient(host string, port string, username string, password string, timeoutInMs int) Client {
	return Client{
		Host:        host,
		Port:        port,
		Username:    username,
		Password:    password,
		TimeoutInMs: timeoutInMs,
	}
}


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

#include "ash/glanceables/glanceables_view.h"

#include <memory>

#include "ash/glanceables/glanceables_weather_view.h"
#include "ash/glanceables/glanceables_welcome_label.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/view_class_properties.h"

namespace ash {

GlanceablesView::GlanceablesView() {
  // Inside border insets are set in OnBoundsChanged() when this view is added
  // to the widget.
  layout_ = SetLayoutManager(std::make_unique<views::BoxLayout>(
      views::BoxLayout::Orientation::kVertical));

  welcome_label_ = AddChildView(std::make_unique<GlanceablesWelcomeLabel>());

  weather_view_ = AddChildView(std::make_unique<GlanceablesWeatherView>());
  weather_view_->SetProperty(views::kMarginsKey, gfx::Insets::TLBR(8, 0, 0, 0));
}

GlanceablesView::~GlanceablesView() = default;

void GlanceablesView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
  gfx::Rect local_bounds = GetLocalBounds();
  // This view fills the screen, so the margins are a fraction of the screen
  // height and width.
  const int vertical_margin = local_bounds.height() / 6;
  const int horizontal_margin = local_bounds.width() / 6;
  layout_->set_inside_border_insets(
      gfx::Insets::VH(vertical_margin, horizontal_margin));
}

}  // namespace ash

repository: chromium/chromium

repo_name: chromium/chromium

extension: cc