content
stringlengths
4
1.04M
lang
stringclasses
358 values
score
int64
0
5
repo_name
stringlengths
5
114
repo_path
stringlengths
4
229
repo_licenses
listlengths
1
8
layout 'layout.tpl', title:'Messages : View', content: contents { div(class:'container') { if (globalMessage) { div (class:'alert alert-success', globalMessage) } div(class:'pull-right') { a(href:'/', 'Messages') } dl { dt 'ID' dd(id:'id', message.id) dt 'Date' dd(id:'created', "${message.created}") dt 'Summary' dd(id:'summary', message.summary) dt 'Message' dd(id:'text', message.text) } } }
Smarty
4
Martin-real/spring-boot-2.1.0.RELEASE
spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/resources/templates/messages/view.tpl
[ "Apache-2.0" ]
package jadx.tests.integration.enums; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import jadx.tests.api.IntegrationTest; import static jadx.tests.api.utils.assertj.JadxAssertions.assertThat; public class TestEnums6 extends IntegrationTest { public static class TestCls { public enum Numbers { ZERO, ONE(1); private final int n; Numbers() { this(0); } Numbers(int n) { this.n = n; } public int getN() { return n; } } public void check() { Assertions.assertThat(TestCls.Numbers.ZERO.getN()).isEqualTo(0); Assertions.assertThat(TestCls.Numbers.ONE.getN()).isEqualTo(1); } } @Test public void test() { assertThat(getClassNode(TestCls.class)) .code() .containsOne("ZERO,") .containsOne("Numbers() {") .containsOne("ONE(1);"); } }
Java
5
Dev-kishan1999/jadx
jadx-core/src/test/java/jadx/tests/integration/enums/TestEnums6.java
[ "Apache-2.0" ]
V ← ⍳ 28 A ← 5 7 ⍴ ⍳ 35 A3 ← 5 4 3 ⍴ ⍳ 60 X ← ⍳ 2 Y ← 1 4 2 V1 ← V[5] ⎕ ← V1 ⍝ → [](5) V2 ← V[5 2] ⎕ ← V2 ⍝ → [2](5,2) B1 ← A[1;] ⎕ ← B1 ⍝ → [7](1,2,3,4,5,6,7) B2 ← A[2;] ⎕ ← B2 ⍝ → [7](8,9,10,11,12,13,14) B2_ ← A[;2] ⎕ ← B2_ ⍝ → [5](2,9,16,23,30) ⍝ C ← A[1 1;] ⍝ ⎕ ← C ⍝ → 1 2 3 4 5 6 7 ⍝ 1 2 3 4 5 6 7 Z ← A[2; 3 2 3] ⎕ ← Z ⍝ → [3](10,9,10) ⍝ D ← A[1 0;3 2] ⍝ E ← A[;X] ⍝ F ← A[Y;X] ⍝ G ← A[Y;] ⍝ H ← A3[;;2 2] ⍝ I ← A3[;2 2;] ⍝ J ← A3[X;;] J1_2 ← A3[2;;] ⎕ ← J1_2 J2_2 ← A3[;2;] ⎕ ← 1 ↓ J2_2 J3_2 ← A3[;;2] ⎕ ← 1 ↓ J3_2 0
APL
4
melsman/apltail
tests/idx.apl
[ "MIT" ]
;;; lang/data/config.el -*- lexical-binding: t; -*- (use-package! nxml-mode :mode "\\.p\\(?:list\\|om\\)\\'" ; plist, pom :mode "\\.xs\\(?:d\\|lt\\)\\'" ; xslt, xsd :mode "\\.rss\\'" :config (setq nxml-slash-auto-complete-flag t nxml-auto-insert-xml-declaration-flag t) (set-company-backend! 'nxml-mode '(company-nxml company-yasnippet)) (setq-hook! 'nxml-mode-hook tab-width nxml-child-indent)) ;;;###package csv-mode (map! :after csv-mode :localleader :map csv-mode-map "a" #'csv-align-fields "u" #'csv-unalign-fields "s" #'csv-sort-fields "S" #'csv-sort-numeric-fields "k" #'csv-kill-fields "t" #'csv-transpose)
Emacs Lisp
4
leezu/doom-emacs
modules/lang/data/config.el
[ "MIT" ]
<!doctype html> <html> <head> <title>Baeldung Spring Security SAML: Home</title> </head> <body> <h3><Strong>Welcome!</strong><br/>You are successfully logged in!</h3> <p>You are logged as <span class="badge badge-dark" th:text="${username}">null</span>.</p> <small> <a th:href="@{/logout}">Logout</a> </small> </body> </html>
HTML
3
DBatOWL/tutorials
spring-security-modules/spring-security-saml/src/main/resources/templates/home.html
[ "MIT" ]
@import url("/static/cached/styles.css"); @import url("/static/styles_root.css"); body { background: #d3d6d8 url(/static/cached/img/relative.png); }
CSS
3
jpmallarino/django
tests/staticfiles_tests/project/documents/cached/absolute.css
[ "BSD-3-Clause", "0BSD" ]
0 reg32_t "dword" 1 code_t "proc*" 2 num32_t "int" 3 uint32_t "size_t" 4 ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(struct(0:num32_t,4:ptr(reg8_t),8:ptr(reg8_t),12:ptr(reg8_t),16:ptr(reg8_t),20:ptr(reg8_t),24:ptr(reg8_t),28:ptr(reg8_t),32:ptr(reg8_t),36:ptr(reg8_t),40:ptr(reg8_t),44:ptr(reg8_t),48:ptr(TOP),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),8:num32_t)),52:ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(TOP),8:num32_t)),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))) "FILE*" 5 ptr(num8_t) "char*" 6 ptr(TOP) "void*" 2 num32_t "__pid_t" 7 ptr(ptr(num8_t)) "char**" 8 ptr(array(reg8_t,16)) "unknown_128*" 9 ptr(array(reg8_t,56)) "unknown_448*" 10 ptr(array(reg8_t,146)) "unknown_1168*" 11 ptr(array(reg8_t,58)) "unknown_464*" 12 num8_t "char" 13 union(ptr(num8_t),ptr(struct(0:reg16_t,2:num8_t))) "Union_0" 14 ptr(struct(0:reg16_t,2:num8_t)) "StructFrag_0*" 15 ptr(reg32_t) "dword*" 5 ptr(num8_t) "char[]" 16 reg16_t "word" 17 array(reg8_t,5) "unknown_40" 18 ptr(struct(0:num32_t,4:ptr(struct(0:ptr(num8_t),8:ptr(num8_t))),4294967292:reg32_t)) "Struct_5*" 19 ptr(struct(0:ptr(num8_t),8:ptr(num8_t))) "Struct_6*" 20 ptr(struct(0:ptr(num8_t),4:num32_t,8:ptr(num32_t),12:num32_t)) "option*" 21 ptr(struct(0:reg32_t,40:ptr(num8_t),44:ptr(num8_t))) "Struct_2*" 22 ptr(struct(40:ptr(num8_t),44:ptr(num8_t))) "Struct_3*" 3 uint32_t "unsigned int" 23 ptr(uint32_t) "size_t*" 24 array(reg8_t,3) "unknown_24" 25 ptr(struct(0:reg32_t,4:ptr(TOP))) "Struct_0*" 26 reg64_t "qword" 27 array(reg8_t,32) "unknown_256" 15 ptr(reg32_t) "dword[]" 28 int32_t "signed int" 29 num64_t "intmax_t" 23 ptr(uint32_t) "unsigned int*" 30 union(ptr(struct(0:reg32_t,40:ptr(num8_t),44:ptr(num8_t))),ptr(reg32_t)) "Union_1" 31 ptr(struct(0:reg32_t,4:reg32_t)) "StructFrag_3*" 32 union(num32_t,ptr(num8_t)) "Union_3" 33 ptr(num32_t) "int*" 34 ptr(struct(0:array(reg8_t,10),10:num8_t)) "StructFrag_1*" 35 union(ptr(num8_t),ptr(struct(0:array(reg8_t,10),10:num8_t))) "Union_2" 36 ptr(ptr(uint16_t)) "unsigned short**" 37 ptr(ptr(TOP)) "void**" 38 ptr(struct(0:array(reg8_t,16),16:uint32_t)) "StructFrag_9*" 39 ptr(code_t) "proc**" 40 ptr(uint16_t) "unsigned short*" 41 ptr(reg16_t) "word*" 42 ptr(struct(0:reg64_t,8:num8_t)) "StructFrag_11*" 43 ptr(struct(0:array(reg8_t,59186),59186:reg32_t)) "StructFrag_5*" 44 ptr(struct(0:array(reg8_t,536870908),4294967292:reg32_t)) "StructFrag_6*" 18 ptr(struct(0:num32_t,4:ptr(struct(0:ptr(num8_t),8:ptr(num8_t))),4294967292:reg32_t)) "Struct_7*" 45 ptr(struct(0:array(reg8_t,29724),29724:reg32_t)) "StructFrag_7*" 46 ptr(struct(0:array(reg8_t,520),520:reg32_t)) "StructFrag_8*" 47 array(reg8_t,4096) "unknown_32768" 48 array(reg8_t,135168) "unknown_1081344" 49 array(reg8_t,30) "unknown_240" 50 array(reg8_t,17) "unknown_136" 51 array(reg8_t,16) "unknown_128" 52 array(reg8_t,41) "unknown_328" 53 array(reg8_t,7) "unknown_56" 54 array(reg8_t,51) "unknown_408" 55 array(reg8_t,13) "unknown_104" 56 array(reg8_t,27) "unknown_216" 57 array(reg8_t,47) "unknown_376" 58 array(reg8_t,142) "unknown_1136" 59 array(reg8_t,53) "unknown_424" 60 array(reg8_t,55) "unknown_440" 61 array(reg8_t,25) "unknown_200" 62 array(reg8_t,264) "unknown_2112" 63 array(reg8_t,11) "unknown_88" 64 array(reg8_t,34) "unknown_272" 65 array(reg8_t,31) "unknown_248" 66 array(reg8_t,69) "unknown_552" 67 array(reg8_t,19) "unknown_152" 68 array(reg8_t,15) "unknown_120" 69 array(reg8_t,54) "unknown_432" 70 array(reg8_t,14) "unknown_112" 71 array(reg8_t,39) "unknown_312" 72 array(reg8_t,21) "unknown_168" 73 array(reg8_t,9) "unknown_72" 74 array(reg8_t,43) "unknown_344" 75 array(reg8_t,36) "unknown_288" 76 array(reg8_t,37) "unknown_296" 77 array(reg8_t,6) "unknown_48" 78 array(reg8_t,20) "unknown_160" 79 array(reg8_t,91) "unknown_728" 80 array(reg8_t,146) "unknown_1168" 81 array(reg8_t,28) "unknown_224" 82 array(reg8_t,23) "unknown_184" 83 array(reg8_t,76) "unknown_608" 84 array(reg8_t,78) "unknown_624" 85 array(reg8_t,52) "unknown_416" 86 array(reg8_t,40) "unknown_320" 87 array(reg8_t,48) "unknown_384" 88 array(reg8_t,10) "unknown_80" 89 array(reg8_t,62) "unknown_496" 90 array(reg8_t,139) "unknown_1112" 91 array(reg8_t,46) "unknown_368" 92 array(reg8_t,94) "unknown_752" 93 array(reg8_t,29) "unknown_232" 94 array(reg8_t,58) "unknown_464" 95 array(reg8_t,79) "unknown_632" 96 array(reg8_t,26) "unknown_208" 97 array(reg8_t,35) "unknown_280" 98 array(reg8_t,18) "unknown_144" 99 array(reg8_t,24) "unknown_192" 100 array(reg8_t,33) "unknown_264" 101 array(reg8_t,95) "unknown_760" 102 array(reg8_t,92) "unknown_736" 103 array(reg8_t,126) "unknown_1008" 104 array(reg8_t,12) "unknown_96" 105 array(reg8_t,59) "unknown_472" 106 array(reg8_t,45) "unknown_360" 107 array(reg8_t,70) "unknown_560" 108 array(reg8_t,89) "unknown_712" 109 array(reg8_t,61) "unknown_488" 110 array(reg8_t,22) "unknown_176" 111 array(reg8_t,50) "unknown_400" 112 array(reg8_t,190) "unknown_1520" 113 array(reg8_t,42) "unknown_336" 114 array(reg8_t,49) "unknown_392" 115 array(reg8_t,173) "unknown_1384" 116 array(reg8_t,149) "unknown_1192" 117 array(reg8_t,140) "unknown_1120" 118 array(reg8_t,57) "unknown_456" 119 array(reg8_t,63) "unknown_504" 120 array(reg8_t,117) "unknown_936" 121 array(reg8_t,38) "unknown_304" 122 array(reg8_t,102) "unknown_816" 123 array(reg8_t,98) "unknown_784" 124 array(reg8_t,86) "unknown_688" 125 array(reg8_t,113) "unknown_904" 126 array(reg8_t,60) "unknown_480" 127 array(reg8_t,100) "unknown_800" 128 array(reg8_t,77) "unknown_616" 129 array(reg8_t,44) "unknown_352" 130 array(reg8_t,129) "unknown_1032" 131 array(reg8_t,56) "unknown_448" 132 array(num8_t,75) "char[75]" 133 array(num8_t,23) "char[23]" 134 array(num8_t,39) "char[39]" 135 array(num8_t,14) "char[14]" 136 array(num8_t,4) "char[4]" 137 array(num8_t,69) "char[69]" 138 array(num8_t,65) "char[65]" 139 array(num8_t,115) "char[115]" 140 struct(0:ptr(num8_t),4:num32_t,8:ptr(num32_t),12:num32_t) "option" 141 array(reg8_t,80) "unknown_640" 142 array(num8_t,90) "char[90]" 143 array(num8_t,45) "char[45]" 144 array(num8_t,236) "char[236]" 145 array(num8_t,54) "char[54]" 146 array(num8_t,189) "char[189]" 147 array(num8_t,191) "char[191]" 148 array(num8_t,5) "char[5]" 149 array(num8_t,2) "char[2]" 150 array(num8_t,13) "char[13]" 151 array(num8_t,3) "char[3]" 152 array(num8_t,10) "char[10]" 153 array(num8_t,21) "char[21]" 154 array(num8_t,31) "char[31]" 155 array(num8_t,36) "char[36]" 156 array(num8_t,12) "char[12]" 157 array(num8_t,24) "char[24]" 158 array(num8_t,27) "char[27]" 159 array(num8_t,19) "char[19]" 160 array(num8_t,7) "char[7]" 161 array(num8_t,56) "char[56]" 162 array(num8_t,8) "char[8]" 163 array(num8_t,6) "char[6]" 164 array(reg32_t,127) "dword[127]" 165 array(reg32_t,30) "dword[30]" 166 array(reg32_t,34) "dword[34]" 167 array(num8_t,203) "char[203]" 168 array(num8_t,16) "char[16]" 169 array(num8_t,28) "char[28]" 170 array(num8_t,32) "char[32]" 171 array(num8_t,40) "char[40]" 172 array(num8_t,44) "char[44]" 173 array(num8_t,48) "char[48]" 174 array(num8_t,52) "char[52]" 175 array(num8_t,60) "char[60]" 176 array(num8_t,22) "char[22]" 177 array(num8_t,20) "char[20]" 178 array(num8_t,64) "char[64]" 179 array(num8_t,47) "char[47]" 180 array(num8_t,17) "char[17]" 181 array(num8_t,81) "char[81]" 182 array(reg8_t,788) "unknown_6304" 183 array(reg8_t,3232) "unknown_25856" 184 array(reg8_t,6104) "unknown_48832" 1 code_t "(void -?-> dword)*" 185 array(reg8_t,232) "unknown_1856" 186 array(reg8_t,64) "unknown_512" 187 array(reg8_t,420) "unknown_3360" 188 array(reg8_t,256) "unknown_2048"
BlitzBasic
1
matt-noonan/retypd-data
data/kill.decls
[ "MIT" ]
all: go include SuiteSparse_config/SuiteSparse_config.mk go: run - ( cd UMFPACK/Source ; ./ucov.di ) - ( cd AMD/Source ; ./acov.di ) run: prog - ./ut > ut.out - tail ut.out #- $(RM) ut.out prog: ( cd UMFPACK ; $(MAKE) library ) ( cd AMD ; $(MAKE) library ) $(CC) -DDINT $(CF) $(UMFPACK_CONFIG) -IUMFPACK/Source -IUMFPACK/Include -IAMD/Source -IAMD/Include -ISuiteSparse_config -o ut ut.c UMFPACK/Source/libumfpack.a AMD/Source/libamd.a CHOLMOD/Lib/libcholmod.a CAMD/Lib/libcamd.a COLAMD/Lib/libcolamd.a metis-4.0/libmetis.a CCOLAMD/Lib/libccolamd.a SuiteSparse_config/libsuitesparseconfig.a $(LIB) utcov: - ( cd UMFPACK/Source ; ./ucov.di ) - ( cd AMD/Source ; ./acov.di ) purge: ( cd UMFPACK ; $(MAKE) purge ) ( cd AMD ; $(MAKE) purge )
D
3
luoyongheng/dtslam
3rdparty/suitesparse-metis-for-windows-1.2.1/SuiteSparse/UMFPACK/Tcov/GNUmakefile.di
[ "BSD-3-Clause" ]
def hastad_linear(keys, ciphertexts): '''Hastad broadcast attacks with linear padding function: c = (a*m + b)^e % n Args: keys(list of tuples): [(n1, e1), (n2, e2), ...] ciphertexts(list of tuples): [(c1, a1, b1), (c2, a2, b2), ...] Returns: msg(int/None) ''' ni, ei = zip(*keys) ci, ai, bi = zip(*ciphertexts) N = reduce(lambda x, y: x * y, ni) ti = [long(N / n) * inverse_mod(long(N / n), n) for n in ni] K = Zmod(N) P.<m> = PolynomialRing(K, implementation='NTL') f = 0 for i in xrange(len(ti)): t, a, b, c, n, e = ti[i], ai[i], bi[i], ci[i], ni[i], ei[i] if a != 1 and gcd(a, n) != 1: print "Found private key" p = gcd(a, n) q = long(n / p) assert p * q == n d = inverse_mod(e, (p - 1) * (q - 1)) msg = pow(c, d, n) return long((msg - b) / a) # make it monic c = (c * inverse_mod(long(pow(a, e, n)), n)) % n f += t * ((m + b * inverse_mod(a, n)) ^ e - c) # print f msg = f.small_roots() if len(msg) > 0: return msg[0] return None
Sage
4
akbarszcz/CryptoAttacks
CryptoAttacks/PublicKey/sage_stuff.sage
[ "MIT" ]
<ng-content select="mat-icon"></ng-content> <span class="mdc-list-item__primary-text"><ng-content></ng-content></span> <div class="mat-mdc-menu-ripple" matRipple [matRippleDisabled]="disableRipple || disabled" [matRippleTrigger]="_getHostElement()"> </div> <svg *ngIf="_triggersSubmenu" class="mat-mdc-menu-submenu-icon" viewBox="0 0 5 10" focusable="false"><polygon points="0,0 5,5 0,10"/></svg>
HTML
2
tungyingwaltz/components
src/material-experimental/mdc-menu/menu-item.html
[ "MIT" ]
sub main() node = createObject("RoSGNode", "NestedInlineChildren") end sub
Brightscript
3
lkipke/brs
test/e2e/resources/components/scripts/NestedInlineChildrenMain.brs
[ "MIT" ]
@echo off setlocal set BOARD=stm32f4_disco set ZEPHYR_BASE=%userprofile%\zephyr set TOOLCHAIN=gcc-arm-none-eabi-7-2017-q4-major-win32 set DIR=%~dp0 if "%KONAN_DATA_DIR%"=="" (set KONAN_DATA_DIR=%userprofile%\.konan) set KONAN_DEPS=%KONAN_DATA_DIR%/dependencies set GNU_ARM=%KONAN_DEPS%/%TOOLCHAIN% set ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb set GNUARMEMB_TOOLCHAIN_PATH=%GNU_ARM% if defined KONAN_HOME ( set "PATH=%KONAN_HOME%\bin;%PATH%" ) else ( set "PATH=%DIR%..\..\dist\bin;%DIR%..\..\bin;%PATH%" ) if not exist build\ (mkdir build) cd build if not exist CMakeCache.txt (cmake -GNinja -DBOARD=%BOARD% .. || exit /b) :: We need generated headers to be consumed by `cinterop`, :: so we preconfigure the project with `make zephyr`. ninja zephyr call %DIR%\c_interop\platforms\%BOARD%.bat del program.o mkdir %DIR%\build\kotlin call konanc %DIR%/src/main.kt ^ -target zephyr_%BOARD% ^ -r %DIR%/c_interop/platforms/build ^ -l %BOARD% ^ -opt -g -o %DIR%/build/kotlin/program || exit /b ninja || exit /b :: ninja flash :: :: For our STM32 boards the OpenOCD unable to flash the binary, :: so we go with the following alternative utility: echo. echo Now run 'ninja flash' to flash the .bin to the card. echo. echo Or, if that doesn't work, like, for example if you have an stm32f4-disco, echo run the following command: echo st-flash --reset write build/zephyr/zephyr.bin 0x08000000 echo.
Batchfile
4
benasher44/kotlin-native
samples/zephyr/build.bat
[ "ECL-2.0", "Apache-2.0" ]
<header class="navbar"> <div class="container"> <h1 class="navbar-header"> <mt:setvarblock name="site-logo"><mt:assets tag="@SITE_LOGO" limit="1"><mt:asseturl></mt:assets></mt:setvarblock> <a href="<mt:blogrelativeurl>" class="brand"><mt:if name="site-logo"><mt:assets type="image" tag="@SITE_LOGO" limit="1"><img src="<mt:asseturl>" alt="<mt:blogname>"></mt:assets><mt:else><img src="<mt:blogrelativeurl>images/logo.png"></mt:if></a> <button class="navbar-toggle collapsed" data-target=".navbar-collapse" data-toggle="collapse" type="button"><i class="fa fa-list"></i></button> </h1> <nav class="navbar-collapse collapse navbar-right"> <ul class="header-socialbtn"> <mt:if name="facebook"><li class="facebook"><a href="<mt:getvar name="facebook">"><i class="fa fa-facebook"></i></a></li></mt:if> <mt:if name="twitter"><li class="twitter"><a href="<mt:getvar name="twitter">"><i class="fa fa-twitter"></i></a></li></mt:if> </ul> <ul class="nav navbar-nav"> <li<mt:if name="thispage" eq="TOP"> class="active"</mt:if>><a href="<mt:blogrelativeurl>">TOP</a></li> <li<mt:if name="thispage" eq="blog"> class="active"</mt:if>> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><__trans phrase="News"><i class="fa fa-caret-down fa-sm"></i></a> <ul class="dropdown-menu"> <li><a href="<mt:blogrelativeurl>news/">TOP</a></li> <mt:toplevelcategories> <mt:setvarblock name="category_count"><mt:categorycount></mt:setvarblock> <mt:if name="category_count" ne="0"> <li><a href="<mt:categoryarchivelink>"><mt:categorylabel></a></li> </mt:if> </mt:toplevelcategories> </ul> </li> <mt:TopLevelFolders> <mt:setvarblock name="description"><mt:folderdescription></mt:setvarblock> <mt:setvarblock name="currentpage"><mt:folderlabel></mt:setvarblock> <mt:unless name="description" eq="footer_link"> <li class="dropdown<mt:if name="thisfloder" eq="$currentpage"> active</mt:if>"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><mt:FolderLabel><i class="fa fa-caret-down fa-sm"></i></a> <ul class="dropdown-menu"> <mt:pages> <li><a href="<mt:pagepermalink>"><mt:pagetitle></a></li> </mt:pages> </ul> </li> </mt:unless> </mt:TopLevelFolders> <mt:pages no_folder="1"> <li><a href="<mt:pagepermalink>"><mt:pagetitle></a></li> </mt:pages> </ul> </nav> </div> </header>
MTML
3
movabletype/mt-theme-SimpleCorporate
themes/simplecorporate/templates/header.mtml
[ "MIT" ]
/** * Author......: See docs/credits.txt * License.....: MIT */ // #define NEW_SIMD_CODE #ifdef KERNEL_STATIC #include "inc_vendor.h" #include "inc_types.h" #include "inc_platform.cl" #include "inc_common.cl" #include "inc_rp.h" #include "inc_rp.cl" #include "inc_scalar.cl" #include "inc_hash_md4.cl" #include "inc_hash_md5.cl" #endif #define COMPARE_S "inc_comp_single.cl" #define COMPARE_M "inc_comp_multi.cl" #ifdef KERNEL_STATIC DECLSPEC u8 hex_convert (const u8 c) { return (c & 15) + (c >> 6) * 9; } DECLSPEC u8 hex_to_u8 (const u8 *hex) { u8 v = 0; v |= ((u8) hex_convert (hex[1]) << 0); v |= ((u8) hex_convert (hex[0]) << 4); return (v); } #endif typedef struct netntlm { u32 user_len; u32 domain_len; u32 srvchall_len; u32 clichall_len; u32 userdomain_buf[64]; u32 chall_buf[256]; } netntlm_t; typedef struct netntlmv2_tmp { u32 digest_buf[4]; } netntlm_tmp_t; KERNEL_FQ void m27100_init (KERN_ATTR_TMPS_ESALT (netntlm_tmp_t, netntlm_t)) { /** * modifier */ const u64 lid = get_local_id (0); const u64 gid = get_global_id (0); if (gid >= gid_max) return; /** * base */ u32 in[16]; in[ 0] = pws[gid].i[ 0]; in[ 1] = pws[gid].i[ 1]; in[ 2] = pws[gid].i[ 2]; in[ 3] = pws[gid].i[ 3]; in[ 4] = pws[gid].i[ 4]; in[ 5] = pws[gid].i[ 5]; in[ 6] = pws[gid].i[ 6]; in[ 7] = pws[gid].i[ 7]; u8 *in_ptr = (u8 *) in; u32 out[4]; u8 *out_ptr = (u8 *) out; for (int i = 0, j = 0; i < 16; i += 1, j += 2) { out_ptr[i] = hex_to_u8 (in_ptr + j); } tmps[gid].digest_buf[0] = out[ 0]; tmps[gid].digest_buf[1] = out[ 1]; tmps[gid].digest_buf[2] = out[ 2]; tmps[gid].digest_buf[3] = out[ 3]; } KERNEL_FQ void m27100_loop (KERN_ATTR_TMPS_ESALT (netntlm_tmp_t, netntlm_t)) { } KERNEL_FQ void m27100_comp (KERN_ATTR_TMPS_ESALT (netntlm_tmp_t, netntlm_t)) { /** * modifier */ const u64 gid = get_global_id (0); if (gid >= gid_max) return; const u64 lid = get_local_id (0); u32 w0[4]; u32 w1[4]; u32 w2[4]; u32 w3[4]; w0[0] = tmps[gid].digest_buf[0]; w0[1] = tmps[gid].digest_buf[1]; w0[2] = tmps[gid].digest_buf[2]; w0[3] = tmps[gid].digest_buf[3]; w1[0] = 0; w1[1] = 0; w1[2] = 0; w1[3] = 0; w2[0] = 0; w2[1] = 0; w2[2] = 0; w2[3] = 0; w3[0] = 0; w3[1] = 0; w3[2] = 0; w3[3] = 0; md5_hmac_ctx_t ctx0; md5_hmac_init_64 (&ctx0, w0, w1, w2, w3); md5_hmac_update_global (&ctx0, esalt_bufs[DIGESTS_OFFSET].userdomain_buf, esalt_bufs[DIGESTS_OFFSET].user_len + esalt_bufs[DIGESTS_OFFSET].domain_len); md5_hmac_final (&ctx0); w0[0] = ctx0.opad.h[0]; w0[1] = ctx0.opad.h[1]; w0[2] = ctx0.opad.h[2]; w0[3] = ctx0.opad.h[3]; w1[0] = 0; w1[1] = 0; w1[2] = 0; w1[3] = 0; w2[0] = 0; w2[1] = 0; w2[2] = 0; w2[3] = 0; w3[0] = 0; w3[1] = 0; w3[2] = 0; w3[3] = 0; md5_hmac_ctx_t ctx; md5_hmac_init_64 (&ctx, w0, w1, w2, w3); md5_hmac_update_global (&ctx, esalt_bufs[DIGESTS_OFFSET].chall_buf, esalt_bufs[DIGESTS_OFFSET].srvchall_len + esalt_bufs[DIGESTS_OFFSET].clichall_len); md5_hmac_final (&ctx); tmps[gid].digest_buf[0] = ctx.opad.h[0]; tmps[gid].digest_buf[1] = ctx.opad.h[1]; tmps[gid].digest_buf[2] = ctx.opad.h[2]; tmps[gid].digest_buf[3] = ctx.opad.h[3]; /** * digest */ const u32 r0 = ctx.opad.h[DGST_R0]; const u32 r1 = ctx.opad.h[DGST_R1]; const u32 r2 = ctx.opad.h[DGST_R2]; const u32 r3 = ctx.opad.h[DGST_R3]; #define il_pos 0 #ifdef KERNEL_STATIC #include COMPARE_M #endif }
OpenCL
4
Masha/hashcat
OpenCL/m27100-pure.cl
[ "MIT" ]
<h1>Welcome</h1> <?php echo $this->tag->linkTo('', 'Go Home') ?>
Volt
2
derryberni/mvc
micro-simple-views/views/index.volt
[ "BSD-3-Clause" ]
// Daniel Shiffman // http://youtube.com/thecodingtrain // http://codingtra.in // Coding Challenge #115: Snake Game Redux // https://youtu.be/OMoVcohRgZA Snake snake; int rez = 20; PVector food; float w; float h; void setup() { size(400, 400); w = floor(width / rez); h = floor(height / rez); frameRate(5); snake = new Snake(); foodLocation(); } void foodLocation() { float x = floor(random(w)); float y = floor(random(h)); food = new PVector(x, y); } void keyPressed() { if (keyCode == LEFT) { snake.setDir(-1, 0); } else if (keyCode == RIGHT) { snake.setDir(1, 0); } else if (keyCode == DOWN) { snake.setDir(0, 1); } else if (keyCode == UP) { snake.setDir(0, -1); } else if (key == ' ') { snake.grow(); } } void draw() { scale(rez); background(220); if (snake.eat(food)) { foodLocation(); } snake.update(); snake.show(); if (snake.endGame()) { print("END GAME"); background(255, 0, 0); noLoop(); } noStroke(); fill(255, 0, 0); rect(food.x, food.y, 1, 1); }
Processing
5
aerinkayne/website
CodingChallenges/CC_115_Snake_Game_Redux/Processing/Snake_Game_Redux/Snake_Game_Redux.pde
[ "MIT" ]
"""Tests for the diagnostics data provided by the PVOutput integration.""" from aiohttp import ClientSession from homeassistant.core import HomeAssistant from tests.common import MockConfigEntry from tests.components.diagnostics import get_diagnostics_for_config_entry async def test_diagnostics( hass: HomeAssistant, hass_client: ClientSession, init_integration: MockConfigEntry, ): """Test diagnostics.""" assert await get_diagnostics_for_config_entry( hass, hass_client, init_integration ) == { "energy_consumption": 1000, "energy_generation": 500, "normalized_output": 0.5, "power_consumption": 2500, "power_generation": 1500, "reported_date": "2021-12-29", "reported_time": "22:37:00", "temperature": 20.2, "voltage": 220.5, }
Python
4
MrDelik/core
tests/components/pvoutput/test_diagnostics.py
[ "Apache-2.0" ]
// sdk stuff import io/File import structs/[List, ArrayList] // our stuff import Driver import rock/frontend/[BuildParams, Target] import rock/middle/Module import rock/backend/cnaughty/CGenerator /** * Dummy driver, which only generates the .c source code * * Use it with -onlygen or -driver=dummy */ DummyDriver: class extends Driver { init: func (.params) { super(params) // Generating the sources is the *whole point* of onlygen. params clean = false // Don't do lib-caching, we don't want things in .libs/ params libcache = false } compile: func (module: Module) -> Int { params outPath mkdirs() for(candidate in module collectDeps()) { CGenerator new(params, candidate) write() } copyLocals(module, params) if (params verbose) { "Generated sources in %s, enjoy!" format(params outPath path) println() } 0 } }
ooc
4
fredrikbryntesson/launchtest
source/rock/frontend/drivers/DummyDriver.ooc
[ "MIT" ]
/** * This file is part of the Phalcon. * * (c) Phalcon Team <[email protected]> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Phalcon\Helper; /** * Phalcon\Helper\number * * This class offers numeric functions for the framework */ class Number { /** * Helper method to get an array element or a default */ final public static function between(int value, int from, int to) -> bool { return value >= from && value <= to; } }
Zephir
4
zsilbi/cphalcon
phalcon/Helper/Number.zep
[ "BSD-3-Clause" ]
// Licence: GNU General Public License version 2 (GPLv2) #pragma rtGlobals=3 // Use modern global access method and strict wave access. function /S tools_addtowavename(sn, sna) string sn, sna string srn="" if(strsearch(sn[strlen(sn)-1,strlen(sn)],"'",0)==0) srn= sn[0,strlen(sn)-2]+sna+"'" else srn=sn+sna endif return srn end function /S tools_mycleanupstr(name) string name if(cmpstr(name[strlen(name)-1],"\r")==0) name = name[0,strlen(name)-2] endif return name end Function tools_round_dec(val,dec) variable val, dec dec=round(dec) return round(10^dec*val)/10^dec End function /S tools_getwavepathfromgraph(specwave) Wave specwave string path = "" if(waveexists(specwave)) path = GetWavesDataFolder(specwave,2) endif return path end
IGOR Pro
4
ajnavarro/language-dataset
data/github.com/Yohko/IgorProTools/09ef2c30ce71d9226601d814d8dbe87c41c0a9ac/Igor Procedures/tools/tools_utils.ipf
[ "MIT" ]
// Copyright (c) 2016-2021 Bluespec, Inc. All Rights Reserved. package DMA_Cache; // ================================================================ // This is an L1 Cache, coherent with other I- and D- caches. // Can be used for coherent access to mem from devices. // All addresses are physical addresses. // All transactions are full AXI4 width (512b in AWSteria) // The 'front' side faces the external device: an AXI4 'S' interface. // The 'back' side has two interfaces: // - For cacheable addresses: to the next-level cache (L2, usually), // with MESI coherence protocol // - For all other addresses: to MMIO // Note on terminology: // - M,S = 'manager','subordinate' // - Used to be 'master', 'slave'. // - ARM officially adopted the new terminology circa 2021. // - We'll just use M and S (we also use Client and Server, respectively). // ================================================================ // BSV lib imports import Vector :: *; import RegFile :: *; import ConfigReg :: *; import FIFOF :: *; import GetPut :: *; import ClientServer :: *; import Connectable :: *; import Assert :: *; // ---------------- // BSV additional libs import Cur_Cycle :: *; import GetPut_Aux :: *; import Semi_FIFOF :: *; // ---------------- // AXI import AXI4_Types :: *; import AXI4_to_LD :: *; import AXI4_to_ST :: *; // ================================================================ // Project imports import ISA_Decls :: *; import Near_Mem_IFC :: *; // For Wd_{Id/Addr/User/Data}_Mem import AXI_Widths :: *; // For Wd_{Id/Addr/User/Data}_Dma import SoC_Map :: *; // For predicate on addresses (cacheble or not) import MMU_Cache_Common :: *; // For L1<->L2 reqs and rsps, Single_Req/Rsp for MMIO // ================================================================ export DMA_Cache_IFC (..), mkDMA_Cache; // ================================================================ // MODULE INTERFACE interface DMA_Cache_IFC; // Facing external client interface AXI4_Slave_IFC #(Wd_Id_Dma, Wd_Addr_Dma, Wd_Data_Dma, Wd_User_Dma) axi4_s; // ---------------- // Cache-line interface facing next level cache or memory // (for refills, writebacks, downgrades, ...) interface Client_Semi_FIFOF #(L1_to_L2_Req, L2_to_L1_Rsp) l1_to_l2_client; interface Server_Semi_FIFOF #(L2_to_L1_Req, L1_to_L2_Rsp) l2_to_l1_server; // ---------------- // MMIO interface facing memory interface Client #(Single_Req, Single_Rsp) mmio_client; endinterface // **************************************************************** // **************************************************************** // **************************************************************** // Internal types and constants. typedef Bit #(Wd_Data_Dma) Data; // Data on AXI4 typedef TDiv #(Wd_Data_Dma, 8) Bytes_per_Data; // 512/8 = 64 typedef TLog #(Bytes_per_Data) Bits_per_Byte_in_Data; // log (64) = 6 Integer bits_per_byte_in_data = valueOf (Bits_per_Byte_in_Data); typedef 1 DMA_Cache_Num_Ways; // Direct-mapped, for now typedef 64 DMA_Cache_Num_Sets; // Cache holds 64x64 bytes = 4 KB = 1 page typedef TLog #(DMA_Cache_Num_Sets) DMA_Cache_Index_Width; typedef Bit #(DMA_Cache_Index_Width) DMA_Cache_Index; function DMA_Cache_Index fn_addr_to_index (Bit #(64) addr); return truncate (addr >> bits_per_byte_in_data); endfunction function Bit #(64) fn_addr_to_line_addr (Bit #(64) addr); return ((addr >> bits_per_byte_in_data) << bits_per_byte_in_data); endfunction typedef struct { Meta_State tag_state; Bit #(Wd_Addr_Dma) tag_addr; } DMA_Cache_Tag deriving (Bits, FShow); typedef Vector #(DMA_Cache_Num_Ways, DMA_Cache_Tag) Tag_Set; typedef Vector #(DMA_Cache_Num_Ways, Data) Data_Set; // ---------------- // Fix these functions if we move to more set-associative cache function Tag_Set fn_mk_Tag_Set (DMA_Cache_Tag tag0); Tag_Set tag_set = ?; tag_set [0] = tag0; return tag_set; endfunction function Data_Set fn_mk_Data_Set (Data data0); Data_Set data_set = ?; data_set [0] = data0; return data_set; endfunction // ---------------- // State machine typedef enum {STATE_INITIALIZING, // Setting all cache tags to Invalid STATE_IDLE, // Ready to service external requests STATE_EVICTED, // Data evicted, ready to request new data STATE_UPGRADE // refill/upgrade request sent, awaiting response } State deriving (Bits, Eq, FShow); // ================================================================ // AXI4 has independent read-req, write-req and write-data channels. // Here, we merge them into a single queue using this merged struct. typedef enum { AXI4_OP_RD, AXI4_OP_WR } AXI4_Op deriving (Bits, Eq, FShow); typedef struct {AXI4_Op req_op; // AW and AR channel info Bit #(Wd_Id_Dma) id; Bit #(Wd_Addr_Dma) addr; AXI4_Len len; AXI4_Size size; AXI4_Burst burst; AXI4_Lock lock; AXI4_Cache cache; AXI4_Prot prot; AXI4_QoS qos; AXI4_Region region; Bit #(Wd_User_Dma) user; // Write data info Bit #(TDiv #(Wd_Data_Dma, 8)) wstrb; Bit #(Wd_Data_Dma) wdata; } AXI4_Req deriving (Bits, FShow); // ================================================================ // MODULE IMPLEMENTATION (* synthesize *) module mkDMA_Cache (DMA_Cache_IFC); // For debugging: 0: quiet 1: rules Integer verbosity = 0; Integer verbosity_merge = 0; Integer verbosity_MMIO_rd = 0; Integer verbosity_MMIO_wr = 0; // ---------------- // SoC_Map needed for 'is_cached_addr' (vs. MMIO) check SoC_Map_IFC soc_map <- mkSoC_Map; function Bool fn_is_cached_addr (Bit #(Wd_Addr_Dma) addr); return soc_map.m_is_mem_addr (addr); endfunction // ---------------- // FSM state Reg #(State) rg_state <- mkReg (STATE_INITIALIZING); // Transactor for external client AXI4_Slave_Xactor_IFC #(Wd_Id_Dma, Wd_Addr_Dma, Wd_Data_Dma, Wd_User_Dma) axi4_s_xactor <- mkAXI4_Slave_Xactor; // ---------------- // Cache structures RegFile #(DMA_Cache_Index, Tag_Set) rf_tag_sets <- mkRegFileFull; RegFile #(DMA_Cache_Index, Data_Set) rf_data_sets <- mkRegFileFull; // DMA Cache to L2 requests and responses FIFOF #(L1_to_L2_Req) f_L1_to_L2_Reqs <- mkFIFOF; FIFOF #(L2_to_L1_Rsp) f_L2_to_L1_Rsps <- mkFIFOF; // L2 to DMA Cache requests and responses FIFOF #(L2_to_L1_Req) f_L2_to_L1_Reqs <- mkFIFOF; FIFOF #(L1_to_L2_Rsp) f_L1_to_L2_Rsps <- mkFIFOF; // **************************************************************** // **************************************************************** // BEHAVIOR // ================================================================ // Initialization: loop through all cache sets, setting all tags to INVALID Reg #(Bit #(DMA_Cache_Index_Width)) rg_init_index <- mkReg (0); rule rl_init (rg_state == STATE_INITIALIZING); if ((verbosity >= 1) && (rg_init_index == 0)) begin $display ("%0d: %m.rl_init: Initializing cache ...", cur_cycle); end let tag = DMA_Cache_Tag { tag_state: META_INVALID, tag_addr: 0 }; let tag_set = fn_mk_Tag_Set (tag); rf_tag_sets.upd (rg_init_index, tag_set); if (rg_init_index == '1) begin rg_state <= STATE_IDLE; if (verbosity >= 1) $display (" ... done"); end else rg_init_index <= rg_init_index + 1; endrule // ================================================================ // Merge cacheable requests into a single queue, prioritizing reads over writes FIFOF #(AXI4_Req) f_reqs <- mkFIFOF; rule rl_merge_rd_req (fn_is_cached_addr (axi4_s_xactor.o_rd_addr.first.araddr)); let rda <- pop_o (axi4_s_xactor.o_rd_addr); // Assert arlen = 0 (single beat) if (rda.arlen != 0) begin $display ("%0d: ERROR: %m.rl_merge_rd_req: burst requests not supported", cur_cycle); $display (" ", fshow (rda)); $finish (1); end let req = AXI4_Req {req_op: AXI4_OP_RD, id: rda.arid, addr: rda.araddr, len: rda.arlen, size: rda.arsize, burst: rda.arburst, lock: rda.arlock, cache: rda.arcache, prot: rda.arprot, qos: rda.arqos, region: rda.arregion, user: rda.aruser, wstrb: ?, wdata: ?}; f_reqs.enq (req); if (verbosity_merge > 0) begin $display ("%0d: %m.rl_merge_rd_req", cur_cycle); $display (" ", fshow (rda)); end endrule (* descending_urgency = "rl_merge_rd_req, rl_merge_wr_req" *) rule rl_merge_wr_req (fn_is_cached_addr (axi4_s_xactor.o_wr_addr.first.awaddr)); let wra <- pop_o (axi4_s_xactor.o_wr_addr); let wrd <- pop_o (axi4_s_xactor.o_wr_data); // Assert awlen = 0 (single beat) if (wra.awlen != 0) begin $display ("%0d: ERROR: %m.rl_merge_wr_req: burst requests not supported", cur_cycle); $display (" ", fshow (wra)); $finish (1); end let req = AXI4_Req {req_op: AXI4_OP_WR, id: wra.awid, addr: wra.awaddr, len: wra.awlen, size: wra.awsize, burst: wra.awburst, lock: wra.awlock, cache: wra.awcache, prot: wra.awprot, qos: wra.awqos, region: wra.awregion, user: wra.awuser, wstrb: wrd.wstrb, wdata: wrd.wdata}; f_reqs.enq (req); if (verbosity_merge > 0) begin $display ("%0d: %m.rl_merge_wr_req", cur_cycle); $display (" ", fshow (wra)); $display (" ", fshow (wrd)); end endrule // ================================================================ // Handle downgrade-request from L2 (highest priority) rule rl_downgrade (rg_state != STATE_INITIALIZING); let l2_to_l1_req <- pop (f_L2_to_L1_Reqs); if (verbosity >= 1) begin $display ("%0d: %m.rl_downgrade", cur_cycle); $display (" ", fshow (l2_to_l1_req)); end // Probe tag mem for this address and data let line_addr = fn_addr_to_line_addr (l2_to_l1_req.addr); DMA_Cache_Index index = fn_addr_to_index (line_addr); let tag_set = rf_tag_sets.sub (index); let data_set = rf_data_sets.sub (index); let tag = tag_set [0]; // For now, direct mapped only let data = data_set [0]; // For now, direct mapped only if (verbosity >= 1) begin $display (" Index %0h ", index, fshow (tag)); end // Ignore if already INVALID, or already in requested to-state, // or already has different address Bool ignore = ( (tag.tag_state == META_INVALID) || ((tag.tag_state <= l2_to_l1_req.to_state) && (tag.tag_addr == line_addr)) || (tag.tag_addr != line_addr)); if (ignore) begin if (verbosity >= 1) begin $display (" Miss (already evicted/downgraded); no action"); end end else begin // Compose and return response let m_cline = ((tag.tag_state == META_MODIFIED) ? tagged Valid (data) : tagged Invalid); let rsp = L1_to_L2_Rsp {addr: line_addr, to_state: l2_to_l1_req.to_state, m_cline: m_cline}; f_L1_to_L2_Rsps.enq (rsp); if (verbosity >= 1) $display (" Send ", fshow (rsp)); // Update cache tag to state requested by L2 let new_tag = DMA_Cache_Tag {tag_state: l2_to_l1_req.to_state, tag_addr: line_addr }; tag_set [0] = new_tag; // Direct mapped only, for now rf_tag_sets.upd(index, tag_set); end endrule // ================================================================ // Some convenience values for head of merged queue (current request) let req = f_reqs.first; let req_op = req.req_op; let addr = req.addr; let line_addr = fn_addr_to_line_addr (addr); let index = fn_addr_to_index (addr); let tag_set = rf_tag_sets.sub (index); let tag = tag_set [0]; // Direct mapped only, for now // ================================================================ // Evictions on conflict-miss // (Cache frame for AXI4 request's address is currently occupied by // data with a different address; needs to be handed back to L2). Bool evict = ( (tag.tag_state != META_INVALID) && (tag.tag_addr != line_addr)); rule rl_evict ((rg_state == STATE_IDLE) && (! f_L2_to_L1_Reqs.notEmpty) // L2-to-L1 requests have priority && evict); // Evict current occupant (=> INVALID), and evict data if modified let data_set = rf_data_sets.sub (index); let data = data_set [0]; // Direct mapped only, for now let m_cline = ((tag.tag_state != META_MODIFIED) ? tagged Invalid : tagged Valid data); let l1_to_l2_rsp = L1_to_L2_Rsp {addr: tag.tag_addr, to_state: META_INVALID, m_cline: m_cline }; f_L1_to_L2_Rsps.enq (l1_to_l2_rsp); // Set cache frame tag to INVALID let new_tag = DMA_Cache_Tag {tag_state: META_INVALID, tag_addr: ? }; let new_tag_set = fn_mk_Tag_Set (new_tag); rf_tag_sets.upd (index, new_tag_set); if (verbosity >= 1) begin $display ("%0d: %m.rl_evict", cur_cycle); $display (" ", fshow (l1_to_l2_rsp)); end endrule // ================================================================ // For write reqs, update data into the cache line and send AXI4 response // For read reqs, read data from the cache line and send AXI4 response function Action fa_respond_to_client (Bool err, Data rdata); action let axi4_resp = (err ? axi4_resp_slverr : axi4_resp_okay); if (req_op == AXI4_OP_RD) begin AXI4_Rd_Data #(Wd_Id_Dma, Wd_Data_Dma, Wd_User_Dma) rd_data = AXI4_Rd_Data {rid: req.id, rdata: rdata, rresp: axi4_resp, rlast: True, ruser: req.user}; axi4_s_xactor.i_rd_data.enq (rd_data); if(verbosity >= 1) $display(" ", fshow(rd_data)); end else begin AXI4_Wr_Resp #(Wd_Id_Dma, Wd_User_Dma) wr_resp = AXI4_Wr_Resp {bid: req.id, bresp: axi4_resp, buser: req.user}; axi4_s_xactor.i_wr_resp.enq (wr_resp); if(verbosity >= 1) $display(" ", fshow(wr_resp)); end endaction endfunction function Action fa_upd_cache_and_respond (Meta_State new_tag_state, Data rdata); action // Update cache tag let new_tag = DMA_Cache_Tag {tag_state: ((req_op == AXI4_OP_WR) ? META_MODIFIED : new_tag_state), tag_addr: line_addr}; let new_tag_set = fn_mk_Tag_Set (new_tag); rf_tag_sets.upd (index, new_tag_set); if(verbosity >= 1) $display(" new_tag_set = ", fshow (new_tag_set)); // For writes, modify cache using rdata, write-data, wstrb Data new_data = rdata; if (req_op == AXI4_OP_WR) begin Vector #(Bytes_per_Data, Bit #(8)) v_bytes_old = unpack (rdata); Vector #(Bytes_per_Data, Bit #(8)) v_bytes_wr = unpack (req.wdata); Vector #(Bytes_per_Data, Bit #(8)) v_bytes_new = ?; for (Integer j = 0; j < valueOf (Bytes_per_Data); j = j + 1) v_bytes_new [j] = ((req.wstrb [j] == 1'b0) ? v_bytes_old [j] : v_bytes_wr [j]); new_data = pack (v_bytes_new); end // Update data in cache let new_data_set = fn_mk_Data_Set (new_data); rf_data_sets.upd (index, new_data_set); if(verbosity >= 1) $display(" new_data_set = ", fshow (new_data_set)); // Send response to client Bool err = False; fa_respond_to_client (err, rdata); endaction endfunction // ================================================================ // Hit; no eviction, no refill; // just respond and update meta state to MODIFIED on writes Bool is_hit = (( ((req_op == AXI4_OP_RD) && (tag.tag_state >= META_SHARED)) || ((req_op == AXI4_OP_WR) && (tag.tag_state >= META_EXCLUSIVE))) && (tag.tag_addr == line_addr)); rule rl_hit ((rg_state == STATE_IDLE) && (! f_L2_to_L1_Reqs.notEmpty) // L2-to-L1 requests have priority && is_hit); let new_tag_state = ((req_op == AXI4_OP_RD) ? tag.tag_state : META_MODIFIED); let data_set = rf_data_sets.sub (index); let old_data = data_set [0]; // Direct-mapped only, for now if (verbosity >= 1) begin $display ("%0d: %m.rl_hit", cur_cycle); end fa_upd_cache_and_respond (new_tag_state, old_data); // Done with the current request; discard it f_reqs.deq; endrule // ================================================================ // Hit; but first needs upgrade from Invalid/Shared to Shared/Exclusive // Do upgrade if tag state is // Req is RD: tag state is I // Reg is WR: tag state is I or // tag state is S, E and addr matches tag function Bool fn_do_upgrade (); Bool result; if (tag.tag_state == META_INVALID) // Refill needed for read or write result = True; else if (tag.tag_addr != line_addr) // Tag does not match; need to evict before upgrade result = False; else if (req_op == AXI4_OP_RD) // RD and tag match; no need to upgrade result = False; else // WR and tag match; upgrade if S (not E, M) result = (tag.tag_state == META_SHARED); return result; endfunction rule rl_upgrade_req ((rg_state == STATE_IDLE) && (! f_L2_to_L1_Reqs.notEmpty) // L2-to-L1 reqs have priority && fn_do_upgrade ()); // Request refill/upgrade from L2 let l1_to_l2_req = L1_to_L2_Req {addr: line_addr, from_state: tag.tag_state, to_state: ((req_op == AXI4_OP_RD) ? META_SHARED : META_EXCLUSIVE), can_up_to_E: (req_op == AXI4_OP_WR)}; f_L1_to_L2_Reqs.enq (l1_to_l2_req); rg_state <= STATE_UPGRADE; if (verbosity >= 1) begin $display ("%0d: %m.rl_upgrade_req", cur_cycle); $display (" ", fshow (l1_to_l2_req)); end endrule // When upgrade response arrives from L2, update cache, and respond to client rule rl_upgrade_rsp ((rg_state == STATE_UPGRADE) && (! f_L2_to_L1_Reqs.notEmpty)); // L2-to-L1 reqs have priority let rsp <- pop (f_L2_to_L1_Rsps); // Assert response is for addr requested if (rsp.addr != line_addr) begin $display ("%0d: %m.rl_upgrade_rsp: ERROR: rsp is not for addr %0h", cur_cycle, line_addr); $display (" ", fshow (rsp)); $finish (1); end // Old data can be from L2 or from this cache Data old_data = ?; if (rsp.m_cline matches tagged Valid .x) begin if (tag.tag_state != META_INVALID) begin $display ("%0d: %m.rl_upgrade_rsp: ERROR: rsp has refill data for non-INVALID frame", cur_cycle); $display (" ", fshow (rsp)); $finish (1); end old_data = x; end else begin // Assert L2 response contains data if meta state was INVALID if (tag.tag_state == META_INVALID) begin $display ("%0d: %m.rl_upgrade_rsp: ERROR: rsp has no data for INVALID frame", cur_cycle); $display (" ", fshow (rsp)); $finish (1); end old_data = rf_data_sets.sub (index) [0]; // Direct-mapped only, for now end if (verbosity >= 1) begin $display ("%0d: %m.rl_upgrade_rsp", cur_cycle); end fa_upd_cache_and_respond (rsp.to_state, old_data); // Done with the current request; discard it f_reqs.deq; rg_state <= STATE_IDLE; endrule // **************************************************************** // MMIO (request addr is not in cached mem) // LD/ST requests out of the AXI4_to_LD/ST converters FIFOF #(Single_Req) f_single_reqs <- mkFIFOF; FIFOF #(Single_Rsp) f_single_rsps <- mkFIFOF; // Remembers order of LD/ST requests to system FIFOF #(Bool) f_mmio_rsp_is_load <- mkSizedFIFOF (16); // ================================================================ // MMIO reads // AXI4 to LD converter FIFOF #(AXI4_Rd_Addr #(Wd_Id_Dma, Wd_Addr_Dma, Wd_User_Dma)) f_rd_addr <- mkFIFOF; FIFOF #(AXI4_Rd_Data #(Wd_Id_Dma, Wd_Data_Dma, Wd_User_Dma)) f_rd_data <- mkFIFOF; AXI4_to_LD_IFC #(Wd_Addr_Dma, 64) axi4_to_ld <- mkAXI4_to_LD (to_FIFOF_O (f_rd_addr), to_FIFOF_I (f_rd_data)); // Pass MMIO read requests into axi4_to_ld module rule rl_mmio_AXI_rd_req (! fn_is_cached_addr (axi4_s_xactor.o_rd_addr.first.araddr)); let rda <- pop_o (axi4_s_xactor.o_rd_addr); f_rd_addr.enq (rda); if (verbosity_MMIO_rd != 0) begin $display ("%0d: %m.rl_mmio_AXI_rd_req", cur_cycle); $display (" awid %0h awaddr %0h awlen %0h awsize %0h awuser %0h", rda.arid, rda.araddr, rda.arlen, rda.arsize, rda.aruser); end endrule // Pass MMIO LD requests from axi4_to_ld module out to system rule rl_mmio_LD_req; match { .size_code, .addr } <- pop_o (axi4_to_ld.reqs); let req = Single_Req {is_read: True, addr: addr, size_code: size_code, data: ?}; f_single_reqs.enq (req); f_mmio_rsp_is_load.enq (True); if (verbosity_MMIO_rd != 0) begin $display ("%0d: %m.rl_mmio_LD_req: ", cur_cycle); $display (" ", fshow (req)); end endrule // Pass MMIO LD response from system back into axi4_to_ld_module rule rl_mmio_LD_rsp (f_mmio_rsp_is_load.first); f_mmio_rsp_is_load.deq; let rsp <- pop (f_single_rsps); Bool err = (! rsp.ok); axi4_to_ld.rsps.enq (tuple2 (err, rsp.data)); if (verbosity_MMIO_rd != 0) begin $display ("%0d: %m.rl_mmio_LD_rsp: ", cur_cycle); $display (" ", fshow (rsp)); end endrule // Pass AXI4 response to client rule rl_mmio_AXI_rd_rsp; let rdd <- pop (f_rd_data); axi4_s_xactor.i_rd_data.enq (rdd); if (verbosity_MMIO_rd != 0) begin $display ("%0d: %m.rl_mmio_AXI_rd_rsp: ", cur_cycle); $display (" ", fshow (rdd)); end endrule // ================================================================ // MMIO writes // AXI4 to ST converter FIFOF #(AXI4_Wr_Addr #(Wd_Id_Dma, Wd_Addr_Dma, Wd_User_Dma)) f_wr_addr <- mkFIFOF; FIFOF #(AXI4_Wr_Data #(Wd_Data_Dma, Wd_User_Dma)) f_wr_data <- mkFIFOF; FIFOF #(AXI4_Wr_Resp #(Wd_Id_Dma, Wd_User_Dma)) f_wr_resp <- mkFIFOF; AXI4_to_ST_IFC #(Wd_Addr_Dma, 64) axi4_to_st <- mkAXI4_to_ST (to_FIFOF_O (f_wr_addr), to_FIFOF_O (f_wr_data), to_FIFOF_I (f_wr_resp)); // Pass MMIO write requests into axi4_to_st module rule rl_mmio_axi_wr_req (! fn_is_cached_addr (axi4_s_xactor.o_wr_addr.first.awaddr)); let wra <- pop_o (axi4_s_xactor.o_wr_addr); let wrd <- pop_o (axi4_s_xactor.o_wr_data); f_wr_addr.enq (wra); f_wr_data.enq (wrd); if (verbosity_MMIO_wr != 0) begin $display ("%0d: %m.rl_mmio_AXI_wr_req", cur_cycle); $display (" awid %0h awaddr %0h awlen %0h awsize %0h awuser %0h", wra.awid, wra.awaddr, wra.awlen, wra.awsize, wra.awuser); $display (" (<wdata>, <wstrb> below) wlast %0d wuser %0h", wrd.wlast, wrd.wuser); $display (" [127:0] %032h %04h", wrd.wdata [127:0], wrd.wstrb [15:0]); $display (" [255:128] %032h %04h", wrd.wdata [255:128], wrd.wstrb [31:16]); $display (" [383:256] %032h %04h", wrd.wdata [383:256], wrd.wstrb [47:32]); $display (" [511:384] %032h %04h", wrd.wdata [511:384], wrd.wstrb [63:48]); end endrule // Pass MMIO ST requests out from axi4_to_st module out to system rule rl_mmio_ST_req; match { .size_code, .addr, .wdata } <- pop_o (axi4_to_st.reqs); let req = Single_Req {is_read: False, addr: addr, size_code: size_code, data: wdata}; f_single_reqs.enq (req); f_mmio_rsp_is_load.enq (False); if (verbosity_MMIO_wr != 0) begin $display ("%0d: %m.rl_mmio_ST_req: ", cur_cycle); $display (" ", fshow (req)); end endrule // For MMIO ST requests, no response expected from system rule rl_mmio_st_rsp (! f_mmio_rsp_is_load.first); f_mmio_rsp_is_load.deq; Bool err = False; axi4_to_st.rsps.enq (err); if (verbosity_MMIO_wr != 0) begin $display ("%0d: %m.rl_mmio_ST_rsp: ", cur_cycle); $display (" err = ", fshow (err)); end endrule // Pass AXI4 response to client rule rl_mmio_axi_wr_rsp; let wrr <- pop (f_wr_resp); axi4_s_xactor.i_wr_resp.enq (wrr); if (verbosity_MMIO_wr != 0) begin $display ("%0d: %m.rl_mmio_AXI_wr_rsp: ", cur_cycle); $display (" ", fshow (wrr)); end endrule // **************************************************************** // **************************************************************** // INTERFACE // **************************************************************** // **************************************************************** // Facing external client interface AXI4_Slave_IFC axi4_s = axi4_s_xactor.axi_side; // ---------------- // Facing L2 cache (for refills, writebacks, downgrades, ...) interface l1_to_l2_client = fifofs_to_Client_Semi_FIFOF (f_L1_to_L2_Reqs, f_L2_to_L1_Rsps); interface l2_to_l1_server = fifofs_to_Server_Semi_FIFOF (f_L2_to_L1_Reqs, f_L1_to_L2_Rsps); // ---------------- // MMIO interface facing memory interface mmio_client = toGPClient (f_single_reqs, f_single_rsps); endmodule: mkDMA_Cache // ================================================================ endpackage: DMA_Cache
Bluespec
5
darius-bluespec/Flute
src_Core/Near_Mem_VM_WB_L1_L2/DMA_Cache.bsv
[ "Apache-2.0" ]
4 37 8 24 14 14 6 23 38 27 47 2 9 6 39 41 28 42 4 23 3 25 11 38 49 1 9 16 23 38 49 35 7 30 20 36 25 16 38 50 13 29 25 1 36 47 17 45 11 8 9 10 48 4 1 24 35 41 27 13 3 42 7 3 26 18 17 27 32 28 24 22 33 1 23 31 20 34 15 6 2 27 38 12 22 16 23 49 26 46 1 17 27 7 45 44 40 45 35 43 9 23 19 47 5 34 2 24 42 32 12 1 9 19 18 44 44 29 23 20 1 20 42 47 15 5 27 14 25 13 9 27 39 50 34 18 26 10 1 16 48 39 32 37 20 48 42 39 22 21 6 29 37 40 47 38 38 44 13 36 8 20 2 28 5 5 1 5 5 2 3 4 1 3 4 3 4 3 1 5 5 1 1 4 5 5 2 2 3 3 4 4 2 3 5 5 2 1 4 4 4 5 1 2 5 1 4 5 2 4 2 4 4 2 2 2 5 5 1 2 2 2 1 2 1 2 2 5 3 5 4 3 3 5 3 1 3 1 3 1 2 5 4 5 3 5 2 1 2 2 2 2 4 4 5 4 2 5 1 1 5 4 2 1 5 4 1 4 2 2 4 4 2 2 1 5 2 5 4 2 2 4 2 1 4 3 2 2 1 3 1 2 1 4 4 1 1 4 5 5 4 3 3 3 5 1 4 5 2 3 3 3 2 1 4 5 2 4 2 5 3 3 3 3 1 4 2 1 2 5 3 5 2 3 4 1 3 1 2 2 4 3 4 1 3 2 4 1 5 3 2 4 2 1 5 4 1 2 1 2 5 5 4 5 3 4 4 4 1 1 4 3 3 4 4 1 2 4 4 4 2 4 3 3 3 2 2 4 1 4 4 5 1 1 4 1 4 4 3 3 1 4 3 1 1 2 5 4 3 3 2 1 1 1 4 3 1 5 2 2 1 3 5 4 1 1 3 3 5 3 5 4 2 5 3 3 1 1 3 5 5 2 5 3 4 2 4 3 4 3 2 2 4 4 5 5 2 5 4 5 1 3 3 4 5 4 4 2 3 1 1 4 5 2 3 5 2 4 5 1 1 4 2 3 5 5 4 4 3 4 1 1 1 4 1 5 5 3 4 5 4 2 4 4 1 5 5 2 5 4 1 5 4 5 2 4 5 3 4 1 3 1 3 3 3 5 5 3 2 4 2 1 3 2 4 2 4 2 2 4 3 3 3 2 3 4 4 2 4 2 4 5 3 1 1 4 4 4 5 1 3 3 5 1 1 2 1 3 3 2 2 2 3 1 2 2 5 1 3 1 1 5 5 1 4 4 1 3 4 2 5 2 4 3 1 3 2 5 1 1 5 4 3 1 2 1 2 3 3 1 2 4 1 2 4 5 1 1 5 2 5 5 5 3 2 4 2 5 1 1 5 3 1 3 4 2 4 4 5 4 1 5 4 3 2 2 2 3 4 2 1 1 2 2 2 4 3 1 2 5 2 2 2 3 5 1 1 1 1 2 3 2 1 2 1 2 2 3 3 2 4 2 1 4 3 3 3 5 2 3 3 2 4 5 5 2 3 3 5 2 1 3 4 4 5 5 5 3 2 3 1 2 2 4 3 4 3 5 5 5 5 2 2 2 2 3 4 2 2 5 3 1 2 3 3 3 1 5 4 5 2 5 1 1 5 1 1 2 5 5 1 1 2 1 4 1 2 3 4 5 5 5 4 4 3 1 4 4 1 3 3 3 3 5 3 4 1 3 3 3 1 1 5 4 2 4 4 3 2 1 4 4 1 4 1 3 1 2 5 1 1 1 5 1 5 1 1 3 1 1 3 2 1 2 4 3 3 1 2 4 3 3 3 5 3 2 4 3 4 5 3 2 3 4 4 2 1 5 1 5 5 5 1 3 3 1 1 2 1 4 5 3 5 3 4 4 2 5 1 3 1 4 1 5 1 4 2 3 4 2 4 2 5 2 1 3 1 1 5 1 4 1 1 3 5 2 1 3 1 3 1 1 5 2 5 1 5 3 4 5 1 2 3 5 2 1 4 1 3 2 2 3 5 1 3 1 1 5 1 1 3 2 1 1 4 4 3 3 2 1 5 2 2 4 3 3 4 1 5 1 3 2 1 1 4 3 1 4 2 4 4 3 4 3 3 5 3 1 3 2 4 2 4 4 2 1 4 1 1 3 3 2 2 1 1 3 4 1 3 1 1 3 4 3 5 3 4 1 2 3 2 4 1 5 4 3 2 4 3 2 4 1 5 2 3 4 3 1 3 5 4 5 2 3 1 3 5 3 2 4 5 1 1 1 1 1 5 2 3 2 4 1 3 5 2 5 1 2 4 5 5 5 3 4 1 2 5 2 2 3 1 1 1 3 5 3 1 2 1 4 5 2 4 2 3 4 2 3 2 5 4 1 5 1 1 4 2 1 5 1 4 2 4 3 3 4 1 3 1 1 5 4 2 5 5 3 4 4 1 1 5 4 4 3 1 4 4 2 1 5 4 3 2 2 3 5 4 2 1 4 2 1 4 4 1 3 4 5 4 5 3 4 1 4 1 1 5 2 5 5 1 1 5 2 2 1 4 1 3 4 4 3 4 2 4 5 2 5 3 3 3 4 2 5 4 1 3 3 5 4 5 1 3 5 2 1 1 3 3 3 1 4 3 4 4 5 5 3 2 4 5 2 1 2 1 2 5 3 4 4 4 4 2 4 1 2 2 2 4 3 5 1 5 4 3 5 1 5 1 5 2 5 4 3 4 3 5 5 5 3 4 4 2 1 2 1 2 3 1 2 1 5 2 1 4 1 3 1 5 5 4 5 3 4 2 1 4 5 3 5 5 5 1 2 5 4 3 5 5 3 4 5 3 3 4 5 1 3 3 2 3 3 2 1 2 3 5 4 4 4 4 5 4 3 1 4 2 1 2 4 2 2 4 3 4 1 3 5 5 5 4 1 2 3 2 3 3 4 4 3 2 3 1 4 1 5 3 4 5 3 1 3 4 3 3 3 2 4 4 5 3 4 1 2 4 1 1 4 2 4 5 1 5 3 5 2 1 3 5 5 4 2 5 1 4 4 5 2 2 3 1 2 3 4 3 2 2 3 4 3 4 4 5 2 2 1 3 1 3 3 3 3 3 4 5 1 5 5 4 4 2 5 5 1 5 3 5 1 5 5 4 2 5 2 3 1 1 2 4 2 2 1 3 2 4 2 1 5 2 1 1 2 3 3 2 1 5 4 5 4 1 1 2 1 3 1 4 4 3 4 3 3 3 3 2 2 3 4 3 1 2 4 1 3 4 2 3 3 4 4 5 3 1 2 2 3 4 4 4 2 4 4 2 3 5 4 3 1 2 1 3 4 1 2 3 3 3 1 1 1 5 1 5 3 4 5 2 2 3 4 3 1 1 1 2 1 3 4 4 2 2 4 3 5 4 2 2 3 1 2 1 4 2 3 5 2 4 5 4 3 2 3 4 3 5 3 3 5 3 1 3 1 5 5 2 3 5 1 2 4 4 1 1 5 3 2 4 3 1 3 1 1 2 5 3 5 1 2 3 3 3 5 4 5 2 2 1 2 5 1 5 1 2 2 5 4 5 3 4 2 4 4 4 4 3 5 1 3 2 5 5 1 5 3 3 2 4 5 1 1 4 3 2 4 5 4 1 5 1 3 3 1 2 4 3 2 5 3 5 5 4 5 4 3 2 1 1 5 3 3 3 4 3 2 1 5 3 3 4 4 1 5 3 5 5 3 4 3 5 3 1 1 2 5 5 5 1 2 3 5 1 4 3 5 1 1 3 3 1 2 1 4 2 5 1 4 1 2 4 4 4 2 4 1 5 1 3 2 2 3 5 1 5 3 5 3 5 2 3 1 4 1 3 3 4 3 5 2 1 2 4 5 4 3 2 1 4 2 2 1 3 2 2 1 1 4 2 4 5 1 1 4 1 1 5 5 4 1 3 1 1 1 2 1 3 5 3 2 1 5 1 1 4 4 4 5 2 2 2 4 3 3 3 3 1 4 2 2 4 3 3 1 2 5 3 2 3 5 4 3 1 4 1 3 3 5 5 2 3 3 3 4 1 4 4 2 1 3 2 3 4 3 4 5 3 3 4 2 5 4 1 2 1 2 5 5 1 4 1 3 5 2 2 3 1 5 5 5 1 2 1 1 4 5 3 1 4 5 4 3 2 4 5 2 3 3 5 5 5 5 4 1 5 3 2 1 2 1 4 5 4 1 4 5 2 3 4 3 2 5 2 2 3 1 5 3 1 2 3 5 5 3 5 4 5 1 2 5 4 3 2 1 5 2 2 4 5 3 1 5 2 4 3 1 3 1 1 4 1 2 2 3 3 4 3 3 5 3 4 3 1 3 4 5 3 1 5 4 3 1 4 3 4 5 4 2 2 3 1 2 3 1 4 1 4 5 3 1 1 3 3 4 2 1 5 3 3 1 1 1 4 2 2 1 3 1 1 2 5 1 5 1 1 1 3 2 3 4 3 3 3 4 3 5 2 2 1 4 3 5 2 4 3 3 1 2 4 2 3 4 2 5 3 5 1 1 4 2 2 2 3 5 4 1 5 2 4 2 2 3 3 2 5 4 4 3 5 4 4 1 1 1 4 5 1 3 2 5 2 4 5 2 4 2 4 5 5 5 4 5 3 2 5 5 1 3 1 5 5 1 4 4 1 4 3 4 5 1 2 4 1 3 4 2 3 5 5 3 3 3 3 1 5 4 1 4 2 4 3 4 5 2 4 3 1 3 2 4 4 3 4 5 1 4 4 3 2 5 1 5 2 1 1 4 1 3 2 5 4 3 5 5 1 4 5 1 1 5 3 5 4 1 1 4 3 3 5 3 5 1 5 4 5 1 4 1 4 3 1 1 4 2 2 2 5 2 5 3 5 4 4 4 1 3 2 1 4 5 4 5 5 5 3 1 1 3 3 5 5 5 5 2 1 4
Matlab
0
yinrun/LOPDC-Benchmarks
lofri/matlab/n40-m4-r50-23.matlab
[ "MIT" ]
package com.baeldung.ssl; import java.io.InputStream; import java.io.OutputStream; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; public class SecureConnection { public static void main(String[] args) { if (args.length != 2) { System.out.println("Use: SecureConnection host port"); System.exit(1); } try { String host = getHost(args); Integer port = getPort(args); SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault(); SSLSocket sslsocket = (SSLSocket) sslsocketfactory.createSocket(host, port); InputStream in = sslsocket.getInputStream(); OutputStream out = sslsocket.getOutputStream(); out.write(1); while (in.available() > 0) { System.out.print(in.read()); } System.out.println("Secured connection performed successfully"); } catch (Exception exception) { exception.printStackTrace(); } } /** * Get the host from arguments * @param args the arguments * @return the host */ private static String getHost(String[] args) { return args[0]; } /** * Get the port from arguments * @param args the arguments * @return the port */ private static Integer getPort(String[] args) { return Integer.parseInt(args[1]); } }
Java
5
zeesh49/tutorials
core-java/src/main/java/com/baeldung/ssl/SecureConnection.java
[ "MIT" ]
static const q15_t in_val[46] = { 0xFFC6, 0x0251, 0x0376, 0x02B3, 0x0158, 0xFE63, 0xFCC4, 0xFC4D, 0xFD55, 0xFFED, 0x02A3, 0x036D, 0x033E, 0x0147, 0xFE71, 0xFC4E, 0xFC67, 0xFD5E, 0xFF34, 0x02D8, 0x0340, 0x0362, 0x0147, 0xFED7, 0xFCBD, 0xFBF9, 0xFDE3, 0x0039, 0x026F, 0x035C, 0x035E, 0x019A, 0xFEE8, 0xFCA6, 0xFC4C, 0xFDB7, 0xFFBC, 0x0214, 0x0371, 0x02F5, 0x0187, 0xFE46, 0xFC4E, 0xFBBC, 0xFE67, 0xFFC6 }; static const q15_t in_coeff[532] = { 0x4000, 0x2000, 0x0000, 0x4CCD, 0x3333, 0x199A, 0x5555, 0x4000, 0x2AAB, 0x1555, 0x0000, 0x5B6E, 0x4925, 0x36DB, 0x2492, 0x1249, 0x6000, 0x5000, 0x4000, 0x3000, 0x2000, 0x1000, 0x0000, 0x638E, 0x5555, 0x471C, 0x38E4, 0x2AAB, 0x1C72, 0x0E39, 0x6666, 0x599A, 0x4CCD, 0x4000, 0x3333, 0x2666, 0x199A, 0x0CCD, 0x0000, 0x6C4F, 0x6276, 0x589E, 0x4EC5, 0x44EC, 0x3B14, 0x313B, 0x2762, 0x1D8A, 0x13B1, 0x09D9, 0x0000, 0x7685, 0x71C7, 0x6D09, 0x684C, 0x638E, 0x5ED1, 0x5A13, 0x5555, 0x5098, 0x4BDA, 0x471C, 0x425F, 0x3DA1, 0x38E4, 0x3426, 0x2F68, 0x2AAB, 0x25ED, 0x212F, 0x1C72, 0x17B4, 0x12F7, 0x0E39, 0x097B, 0x04BE, 0x4000, 0x2000, 0x0000, 0x4CCD, 0x3333, 0x199A, 0x5555, 0x4000, 0x2AAB, 0x1555, 0x0000, 0x5B6E, 0x4925, 0x36DB, 0x2492, 0x1249, 0x6000, 0x5000, 0x4000, 0x3000, 0x2000, 0x1000, 0x0000, 0x638E, 0x5555, 0x471C, 0x38E4, 0x2AAB, 0x1C72, 0x0E39, 0x6666, 0x599A, 0x4CCD, 0x4000, 0x3333, 0x2666, 0x199A, 0x0CCD, 0x0000, 0x6C4F, 0x6276, 0x589E, 0x4EC5, 0x44EC, 0x3B14, 0x313B, 0x2762, 0x1D8A, 0x13B1, 0x09D9, 0x0000, 0x7685, 0x71C7, 0x6D09, 0x684C, 0x638E, 0x5ED1, 0x5A13, 0x5555, 0x5098, 0x4BDA, 0x471C, 0x425F, 0x3DA1, 0x38E4, 0x3426, 0x2F68, 0x2AAB, 0x25ED, 0x212F, 0x1C72, 0x17B4, 0x12F7, 0x0E39, 0x097B, 0x04BE, 0x4000, 0x2000, 0x0000, 0x4CCD, 0x3333, 0x199A, 0x5555, 0x4000, 0x2AAB, 0x1555, 0x0000, 0x5B6E, 0x4925, 0x36DB, 0x2492, 0x1249, 0x6000, 0x5000, 0x4000, 0x3000, 0x2000, 0x1000, 0x0000, 0x638E, 0x5555, 0x471C, 0x38E4, 0x2AAB, 0x1C72, 0x0E39, 0x6666, 0x599A, 0x4CCD, 0x4000, 0x3333, 0x2666, 0x199A, 0x0CCD, 0x0000, 0x6C4F, 0x6276, 0x589E, 0x4EC5, 0x44EC, 0x3B14, 0x313B, 0x2762, 0x1D8A, 0x13B1, 0x09D9, 0x0000, 0x7685, 0x71C7, 0x6D09, 0x684C, 0x638E, 0x5ED1, 0x5A13, 0x5555, 0x5098, 0x4BDA, 0x471C, 0x425F, 0x3DA1, 0x38E4, 0x3426, 0x2F68, 0x2AAB, 0x25ED, 0x212F, 0x1C72, 0x17B4, 0x12F7, 0x0E39, 0x097B, 0x04BE, 0x4000, 0x2000, 0x0000, 0x4CCD, 0x3333, 0x199A, 0x5555, 0x4000, 0x2AAB, 0x1555, 0x0000, 0x5B6E, 0x4925, 0x36DB, 0x2492, 0x1249, 0x6000, 0x5000, 0x4000, 0x3000, 0x2000, 0x1000, 0x0000, 0x638E, 0x5555, 0x471C, 0x38E4, 0x2AAB, 0x1C72, 0x0E39, 0x6666, 0x599A, 0x4CCD, 0x4000, 0x3333, 0x2666, 0x199A, 0x0CCD, 0x0000, 0x6C4F, 0x6276, 0x589E, 0x4EC5, 0x44EC, 0x3B14, 0x313B, 0x2762, 0x1D8A, 0x13B1, 0x09D9, 0x0000, 0x7685, 0x71C7, 0x6D09, 0x684C, 0x638E, 0x5ED1, 0x5A13, 0x5555, 0x5098, 0x4BDA, 0x471C, 0x425F, 0x3DA1, 0x38E4, 0x3426, 0x2F68, 0x2AAB, 0x25ED, 0x212F, 0x1C72, 0x17B4, 0x12F7, 0x0E39, 0x097B, 0x04BE, 0x4000, 0x2000, 0x0000, 0x4CCD, 0x3333, 0x199A, 0x5555, 0x4000, 0x2AAB, 0x1555, 0x0000, 0x5B6E, 0x4925, 0x36DB, 0x2492, 0x1249, 0x6000, 0x5000, 0x4000, 0x3000, 0x2000, 0x1000, 0x0000, 0x638E, 0x5555, 0x471C, 0x38E4, 0x2AAB, 0x1C72, 0x0E39, 0x6666, 0x599A, 0x4CCD, 0x4000, 0x3333, 0x2666, 0x199A, 0x0CCD, 0x0000, 0x6C4F, 0x6276, 0x589E, 0x4EC5, 0x44EC, 0x3B14, 0x313B, 0x2762, 0x1D8A, 0x13B1, 0x09D9, 0x0000, 0x7685, 0x71C7, 0x6D09, 0x684C, 0x638E, 0x5ED1, 0x5A13, 0x5555, 0x5098, 0x4BDA, 0x471C, 0x425F, 0x3DA1, 0x38E4, 0x3426, 0x2F68, 0x2AAB, 0x25ED, 0x212F, 0x1C72, 0x17B4, 0x12F7, 0x0E39, 0x097B, 0x04BE, 0x4000, 0x2000, 0x0000, 0x4CCD, 0x3333, 0x199A, 0x5555, 0x4000, 0x2AAB, 0x1555, 0x0000, 0x5B6E, 0x4925, 0x36DB, 0x2492, 0x1249, 0x6000, 0x5000, 0x4000, 0x3000, 0x2000, 0x1000, 0x0000, 0x638E, 0x5555, 0x471C, 0x38E4, 0x2AAB, 0x1C72, 0x0E39, 0x6666, 0x599A, 0x4CCD, 0x4000, 0x3333, 0x2666, 0x199A, 0x0CCD, 0x0000, 0x6C4F, 0x6276, 0x589E, 0x4EC5, 0x44EC, 0x3B14, 0x313B, 0x2762, 0x1D8A, 0x13B1, 0x09D9, 0x0000, 0x7685, 0x71C7, 0x6D09, 0x684C, 0x638E, 0x5ED1, 0x5A13, 0x5555, 0x5098, 0x4BDA, 0x471C, 0x425F, 0x3DA1, 0x38E4, 0x3426, 0x2F68, 0x2AAB, 0x25ED, 0x212F, 0x1C72, 0x17B4, 0x12F7, 0x0E39, 0x097B, 0x04BE, 0x4000, 0x2000, 0x0000, 0x4CCD, 0x3333, 0x199A, 0x5555, 0x4000, 0x2AAB, 0x1555, 0x0000, 0x5B6E, 0x4925, 0x36DB, 0x2492, 0x1249, 0x6000, 0x5000, 0x4000, 0x3000, 0x2000, 0x1000, 0x0000, 0x638E, 0x5555, 0x471C, 0x38E4, 0x2AAB, 0x1C72, 0x0E39, 0x6666, 0x599A, 0x4CCD, 0x4000, 0x3333, 0x2666, 0x199A, 0x0CCD, 0x0000, 0x6C4F, 0x6276, 0x589E, 0x4EC5, 0x44EC, 0x3B14, 0x313B, 0x2762, 0x1D8A, 0x13B1, 0x09D9, 0x0000, 0x7685, 0x71C7, 0x6D09, 0x684C, 0x638E, 0x5ED1, 0x5A13, 0x5555, 0x5098, 0x4BDA, 0x471C, 0x425F, 0x3DA1, 0x38E4, 0x3426, 0x2F68, 0x2AAB, 0x25ED, 0x212F, 0x1C72, 0x17B4, 0x12F7, 0x0E39, 0x097B, 0x04BE }; static const uint16_t in_config[126] = { 0x0001, 0x0002, 0x0001, 0x0004, 0x0001, 0x0004, 0x0001, 0x0006, 0x0001, 0x0006, 0x0001, 0x0008, 0x0001, 0x0008, 0x0001, 0x000C, 0x0001, 0x001A, 0x0002, 0x0002, 0x0002, 0x0004, 0x0002, 0x0004, 0x0002, 0x0006, 0x0002, 0x0006, 0x0002, 0x0008, 0x0002, 0x0008, 0x0002, 0x000C, 0x0002, 0x001A, 0x0003, 0x0002, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0006, 0x0003, 0x0006, 0x0003, 0x0008, 0x0003, 0x0008, 0x0003, 0x000C, 0x0003, 0x001A, 0x000C, 0x0002, 0x000C, 0x0004, 0x000C, 0x0004, 0x000C, 0x0006, 0x000C, 0x0006, 0x000C, 0x0008, 0x000C, 0x0008, 0x000C, 0x000C, 0x000C, 0x001A, 0x000D, 0x0002, 0x000D, 0x0004, 0x000D, 0x0004, 0x000D, 0x0006, 0x000D, 0x0006, 0x000D, 0x0008, 0x000D, 0x0008, 0x000D, 0x000C, 0x000D, 0x001A, 0x000E, 0x0002, 0x000E, 0x0004, 0x000E, 0x0004, 0x000E, 0x0006, 0x000E, 0x0006, 0x000E, 0x0008, 0x000E, 0x0008, 0x000E, 0x000C, 0x000E, 0x001A, 0x000F, 0x0002, 0x000F, 0x0004, 0x000F, 0x0004, 0x000F, 0x0006, 0x000F, 0x0006, 0x000F, 0x0008, 0x000F, 0x0008, 0x000F, 0x000C, 0x000F, 0x001A }; static const q15_t ref_val[1080] = { 0xFFF1, 0x0077, 0xFFF4, 0x005F, 0xFFF6, 0x004F, 0xFFF8, 0x0044, 0xFFF9, 0x003C, 0xFFFA, 0x0035, 0xFFFA, 0x0030, 0xFFFC, 0x0025, 0xFFFE, 0x0012, 0xFFF1, 0x0077, 0x0206, 0x0268, 0xFFF4, 0x005F, 0x017C, 0x0351, 0xFFF6, 0x004F, 0x013C, 0x029C, 0xFFF8, 0x0044, 0x010F, 0x023D, 0xFFF9, 0x003C, 0x00ED, 0x01F5, 0xFFFA, 0x0035, 0x00D3, 0x01BE, 0xFFFA, 0x0030, 0x00BE, 0x0191, 0xFFFC, 0x0025, 0x0092, 0x0134, 0xFFFE, 0x0012, 0x0046, 0x0095, 0xFFF1, 0x0077, 0x0206, 0x0268, 0x01B0, 0x0045, 0xFFF4, 0x005F, 0x017C, 0x0351, 0x036D, 0x01D6, 0xFFF6, 0x004F, 0x013C, 0x029C, 0x0466, 0x03D6, 0xFFF8, 0x0044, 0x010F, 0x023D, 0x039C, 0x04F2, 0xFFF9, 0x003C, 0x00ED, 0x01F5, 0x0328, 0x0428, 0xFFFA, 0x0035, 0x00D3, 0x01BE, 0x02CE, 0x03B1, 0xFFFA, 0x0030, 0x00BE, 0x0191, 0x0287, 0x0353, 0xFFFC, 0x0025, 0x0092, 0x0134, 0x01F1, 0x028F, 0xFFFE, 0x0012, 0x0046, 0x0095, 0x00EF, 0x013B, 0xFFF1, 0x0077, 0x0206, 0x0268, 0x01B0, 0x0045, 0xFE62, 0xFD75, 0xFD7C, 0xFEA6, 0x009F, 0x022D, 0x0286, 0x01F1, 0x0040, 0xFE4C, 0xFD41, 0xFD8B, 0xFE7C, 0x0050, 0x023C, 0x0278, 0x0203, 0x0059, 0xFFF4, 0x005F, 0x017C, 0x0351, 0x036D, 0x01D6, 0xFF84, 0xFCFF, 0xFC0C, 0xFCB3, 0xFEE6, 0x01B2, 0x039A, 0x039B, 0x0225, 0xFF67, 0xFCDE, 0xFBD1, 0xFCA1, 0xFEAB, 0x014F, 0x03AF, 0x038F, 0x024F, 0xFFF6, 0x004F, 0x013C, 0x029C, 0x0466, 0x03D6, 0x0165, 0xFE65, 0xFBA1, 0xFB18, 0xFC9E, 0xFFA3, 0x02F3, 0x04C3, 0x0412, 0x01AA, 0xFE3E, 0xFB7A, 0xFABA, 0xFC7E, 0xFF56, 0x0289, 0x04DC, 0x0417, 0xFFF8, 0x0044, 0x010F, 0x023D, 0x039C, 0x04F2, 0x03AB, 0x008D, 0xFD37, 0xFAA4, 0xFACA, 0xFD0C, 0x00A0, 0x0408, 0x055F, 0x03DF, 0x00CF, 0xFD09, 0xFA5E, 0xFA5A, 0xFCDC, 0x004B, 0x0399, 0x0589, 0xFFF9, 0x003C, 0x00ED, 0x01F5, 0x0328, 0x0428, 0x04F2, 0x0314, 0xFF96, 0xFC52, 0xFA3B, 0xFAFD, 0xFDC6, 0x0187, 0x04A5, 0x055E, 0x0346, 0xFFD6, 0xFC07, 0xF9E4, 0xFA7B, 0xFD8F, 0x012C, 0x043F, 0xFFFA, 0x0035, 0x00D3, 0x01BE, 0x02CE, 0x03B1, 0x0438, 0x048A, 0x0253, 0xFED4, 0xFBEB, 0xFA4A, 0xFB81, 0xFE7B, 0x020E, 0x04B6, 0x04F6, 0x0284, 0xFEFE, 0xFB90, 0xF9E2, 0xFAF4, 0xFE3E, 0x01BA, 0xFFFA, 0x0030, 0x00BE, 0x0191, 0x0287, 0x0353, 0x03CC, 0x03E7, 0x03F2, 0x01B7, 0xFE7C, 0xFBF0, 0xFAAA, 0xFC0B, 0xFEE4, 0x021C, 0x0468, 0x0460, 0x01D5, 0xFE9A, 0xFB84, 0xFA36, 0xFB76, 0xFEAD, 0xFFFC, 0x0025, 0x0092, 0x0134, 0x01F1, 0x028F, 0x02EC, 0x0301, 0x02E1, 0x02BF, 0x02D2, 0x035E, 0x01D5, 0xFF28, 0xFCCD, 0xFB35, 0xFBF6, 0xFE22, 0x00EC, 0x0343, 0x03A9, 0x01D3, 0xFF28, 0xFC4E, 0xFFFE, 0x0012, 0x0046, 0x0095, 0x00EF, 0x013B, 0x0168, 0x0172, 0x0163, 0x0153, 0x015C, 0x0185, 0x01CD, 0x0221, 0x0267, 0x0289, 0x028A, 0x0271, 0x0251, 0x024C, 0x0265, 0x029F, 0x02E5, 0x031F, 0xFFF1, 0x0077, 0x0206, 0x0268, 0x01B0, 0x0045, 0xFE62, 0xFD75, 0xFD7C, 0xFEA6, 0x009F, 0x022D, 0x0286, 0x01F1, 0x0040, 0xFE4C, 0xFD41, 0xFD8B, 0xFE7C, 0x0050, 0x023C, 0x0278, 0x0203, 0x0059, 0xFE9B, 0xFD5D, 0xFFF4, 0x005F, 0x017C, 0x0351, 0x036D, 0x01D6, 0xFF84, 0xFCFF, 0xFC0C, 0xFCB3, 0xFEE6, 0x01B2, 0x039A, 0x039B, 0x0225, 0xFF67, 0xFCDE, 0xFBD1, 0xFCA1, 0xFEAB, 0x014F, 0x03AF, 0x038F, 0x024F, 0xFFA7, 0xFD32, 0xFFF6, 0x004F, 0x013C, 0x029C, 0x0466, 0x03D6, 0x0165, 0xFE65, 0xFBA1, 0xFB18, 0xFC9E, 0xFFA3, 0x02F3, 0x04C3, 0x0412, 0x01AA, 0xFE3E, 0xFB7A, 0xFABA, 0xFC7E, 0xFF56, 0x0289, 0x04DC, 0x0417, 0x01F7, 0xFE84, 0xFFF8, 0x0044, 0x010F, 0x023D, 0x039C, 0x04F2, 0x03AB, 0x008D, 0xFD37, 0xFAA4, 0xFACA, 0xFD0C, 0x00A0, 0x0408, 0x055F, 0x03DF, 0x00CF, 0xFD09, 0xFA5E, 0xFA5A, 0xFCDC, 0x004B, 0x0399, 0x0589, 0x0401, 0x0124, 0xFFF9, 0x003C, 0x00ED, 0x01F5, 0x0328, 0x0428, 0x04F2, 0x0314, 0xFF96, 0xFC52, 0xFA3B, 0xFAFD, 0xFDC6, 0x0187, 0x04A5, 0x055E, 0x0346, 0xFFD6, 0xFC07, 0xF9E4, 0xFA7B, 0xFD8F, 0x012C, 0x043F, 0x05A3, 0x0370, 0xFFFA, 0x0035, 0x00D3, 0x01BE, 0x02CE, 0x03B1, 0x0438, 0x048A, 0x0253, 0xFED4, 0xFBEB, 0xFA4A, 0xFB81, 0xFE7B, 0x020E, 0x04B6, 0x04F6, 0x0284, 0xFEFE, 0xFB90, 0xF9E2, 0xFAF4, 0xFE3E, 0x01BA, 0x0464, 0x0544, 0xFFFA, 0x0030, 0x00BE, 0x0191, 0x0287, 0x0353, 0x03CC, 0x03E7, 0x03F2, 0x01B7, 0xFE7C, 0xFBF0, 0xFAAA, 0xFC0B, 0xFEE4, 0x021C, 0x0468, 0x0460, 0x01D5, 0xFE9A, 0xFB84, 0xFA36, 0xFB76, 0xFEAD, 0x01D8, 0x041A, 0xFFFC, 0x0025, 0x0092, 0x0134, 0x01F1, 0x028F, 0x02EC, 0x0301, 0x02E1, 0x02BF, 0x02D2, 0x035E, 0x01D5, 0xFF28, 0xFCCD, 0xFB35, 0xFBF6, 0xFE22, 0x00EC, 0x0343, 0x03A9, 0x01D3, 0xFF28, 0xFC4E, 0xFAC4, 0xFB70, 0xFFFE, 0x0012, 0x0046, 0x0095, 0x00EF, 0x013B, 0x0168, 0x0172, 0x0163, 0x0153, 0x015C, 0x0185, 0x01CD, 0x0221, 0x0267, 0x0289, 0x028A, 0x0271, 0x0251, 0x024C, 0x0265, 0x029F, 0x02E5, 0x031F, 0x033B, 0x0369, 0xFFF1, 0x0077, 0x0206, 0x0268, 0x01B0, 0x0045, 0xFE62, 0xFD75, 0xFD7C, 0xFEA6, 0x009F, 0x022D, 0x0286, 0x01F1, 0x0040, 0xFE4C, 0xFD41, 0xFD8B, 0xFE7C, 0x0050, 0x023C, 0x0278, 0x0203, 0x0059, 0xFE9B, 0xFD5D, 0xFD76, 0xFF00, 0xFFF4, 0x005F, 0x017C, 0x0351, 0x036D, 0x01D6, 0xFF84, 0xFCFF, 0xFC0C, 0xFCB3, 0xFEE6, 0x01B2, 0x039A, 0x039B, 0x0225, 0xFF67, 0xFCDE, 0xFBD1, 0xFCA1, 0xFEAB, 0x014F, 0x03AF, 0x038F, 0x024F, 0xFFA7, 0xFD32, 0xFC03, 0xFCC9, 0xFFF6, 0x004F, 0x013C, 0x029C, 0x0466, 0x03D6, 0x0165, 0xFE65, 0xFBA1, 0xFB18, 0xFC9E, 0xFFA3, 0x02F3, 0x04C3, 0x0412, 0x01AA, 0xFE3E, 0xFB7A, 0xFABA, 0xFC7E, 0xFF56, 0x0289, 0x04DC, 0x0417, 0x01F7, 0xFE84, 0xFBE7, 0xFB25, 0xFFF8, 0x0044, 0x010F, 0x023D, 0x039C, 0x04F2, 0x03AB, 0x008D, 0xFD37, 0xFAA4, 0xFACA, 0xFD0C, 0x00A0, 0x0408, 0x055F, 0x03DF, 0x00CF, 0xFD09, 0xFA5E, 0xFA5A, 0xFCDC, 0x004B, 0x0399, 0x0589, 0x0401, 0x0124, 0xFD67, 0xFB03, 0xFFF9, 0x003C, 0x00ED, 0x01F5, 0x0328, 0x0428, 0x04F2, 0x0314, 0xFF96, 0xFC52, 0xFA3B, 0xFAFD, 0xFDC6, 0x0187, 0x04A5, 0x055E, 0x0346, 0xFFD6, 0xFC07, 0xF9E4, 0xFA7B, 0xFD8F, 0x012C, 0x043F, 0x05A3, 0x0370, 0x0043, 0xFC98, 0xFFFA, 0x0035, 0x00D3, 0x01BE, 0x02CE, 0x03B1, 0x0438, 0x048A, 0x0253, 0xFED4, 0xFBEB, 0xFA4A, 0xFB81, 0xFE7B, 0x020E, 0x04B6, 0x04F6, 0x0284, 0xFEFE, 0xFB90, 0xF9E2, 0xFAF4, 0xFE3E, 0x01BA, 0x0464, 0x0544, 0x02C3, 0xFF9A, 0xFFFA, 0x0030, 0x00BE, 0x0191, 0x0287, 0x0353, 0x03CC, 0x03E7, 0x03F2, 0x01B7, 0xFE7C, 0xFBF0, 0xFAAA, 0xFC0B, 0xFEE4, 0x021C, 0x0468, 0x0460, 0x01D5, 0xFE9A, 0xFB84, 0xFA36, 0xFB76, 0xFEAD, 0x01D8, 0x041A, 0x04C2, 0x023E, 0xFFFC, 0x0025, 0x0092, 0x0134, 0x01F1, 0x028F, 0x02EC, 0x0301, 0x02E1, 0x02BF, 0x02D2, 0x035E, 0x01D5, 0xFF28, 0xFCCD, 0xFB35, 0xFBF6, 0xFE22, 0x00EC, 0x0343, 0x03A9, 0x01D3, 0xFF28, 0xFC4E, 0xFAC4, 0xFB70, 0xFE0A, 0x00DA, 0xFFFE, 0x0012, 0x0046, 0x0095, 0x00EF, 0x013B, 0x0168, 0x0172, 0x0163, 0x0153, 0x015C, 0x0185, 0x01CD, 0x0221, 0x0267, 0x0289, 0x028A, 0x0271, 0x0251, 0x024C, 0x0265, 0x029F, 0x02E5, 0x031F, 0x033B, 0x0369, 0x0112, 0xFD8C, 0xFFF1, 0x0077, 0x0206, 0x0268, 0x01B0, 0x0045, 0xFE62, 0xFD75, 0xFD7C, 0xFEA6, 0x009F, 0x022D, 0x0286, 0x01F1, 0x0040, 0xFE4C, 0xFD41, 0xFD8B, 0xFE7C, 0x0050, 0x023C, 0x0278, 0x0203, 0x0059, 0xFE9B, 0xFD5D, 0xFD76, 0xFF00, 0x00B8, 0x020E, 0xFFF4, 0x005F, 0x017C, 0x0351, 0x036D, 0x01D6, 0xFF84, 0xFCFF, 0xFC0C, 0xFCB3, 0xFEE6, 0x01B2, 0x039A, 0x039B, 0x0225, 0xFF67, 0xFCDE, 0xFBD1, 0xFCA1, 0xFEAB, 0x014F, 0x03AF, 0x038F, 0x024F, 0xFFA7, 0xFD32, 0xFC03, 0xFCC9, 0xFF4F, 0x01C7, 0xFFF6, 0x004F, 0x013C, 0x029C, 0x0466, 0x03D6, 0x0165, 0xFE65, 0xFBA1, 0xFB18, 0xFC9E, 0xFFA3, 0x02F3, 0x04C3, 0x0412, 0x01AA, 0xFE3E, 0xFB7A, 0xFABA, 0xFC7E, 0xFF56, 0x0289, 0x04DC, 0x0417, 0x01F7, 0xFE84, 0xFBE7, 0xFB25, 0xFCBE, 0x0013, 0xFFF8, 0x0044, 0x010F, 0x023D, 0x039C, 0x04F2, 0x03AB, 0x008D, 0xFD37, 0xFAA4, 0xFACA, 0xFD0C, 0x00A0, 0x0408, 0x055F, 0x03DF, 0x00CF, 0xFD09, 0xFA5E, 0xFA5A, 0xFCDC, 0x004B, 0x0399, 0x0589, 0x0401, 0x0124, 0xFD67, 0xFB03, 0xFAE0, 0xFD30, 0xFFF9, 0x003C, 0x00ED, 0x01F5, 0x0328, 0x0428, 0x04F2, 0x0314, 0xFF96, 0xFC52, 0xFA3B, 0xFAFD, 0xFDC6, 0x0187, 0x04A5, 0x055E, 0x0346, 0xFFD6, 0xFC07, 0xF9E4, 0xFA7B, 0xFD8F, 0x012C, 0x043F, 0x05A3, 0x0370, 0x0043, 0xFC98, 0xFAA6, 0xFB18, 0xFFFA, 0x0035, 0x00D3, 0x01BE, 0x02CE, 0x03B1, 0x0438, 0x048A, 0x0253, 0xFED4, 0xFBEB, 0xFA4A, 0xFB81, 0xFE7B, 0x020E, 0x04B6, 0x04F6, 0x0284, 0xFEFE, 0xFB90, 0xF9E2, 0xFAF4, 0xFE3E, 0x01BA, 0x0464, 0x0544, 0x02C3, 0xFF9A, 0xFC3D, 0xFABD, 0xFFFA, 0x0030, 0x00BE, 0x0191, 0x0287, 0x0353, 0x03CC, 0x03E7, 0x03F2, 0x01B7, 0xFE7C, 0xFBF0, 0xFAAA, 0xFC0B, 0xFEE4, 0x021C, 0x0468, 0x0460, 0x01D5, 0xFE9A, 0xFB84, 0xFA36, 0xFB76, 0xFEAD, 0x01D8, 0x041A, 0x04C2, 0x023E, 0xFF51, 0xFC49, 0xFFFC, 0x0025, 0x0092, 0x0134, 0x01F1, 0x028F, 0x02EC, 0x0301, 0x02E1, 0x02BF, 0x02D2, 0x035E, 0x01D5, 0xFF28, 0xFCCD, 0xFB35, 0xFBF6, 0xFE22, 0x00EC, 0x0343, 0x03A9, 0x01D3, 0xFF28, 0xFC4E, 0xFAC4, 0xFB70, 0xFE0A, 0x00DA, 0x033D, 0x0464, 0xFFFE, 0x0012, 0x0046, 0x0095, 0x00EF, 0x013B, 0x0168, 0x0172, 0x0163, 0x0153, 0x015C, 0x0185, 0x01CD, 0x0221, 0x0267, 0x0289, 0x028A, 0x0271, 0x0251, 0x024C, 0x0265, 0x029F, 0x02E5, 0x031F, 0x033B, 0x0369, 0x0112, 0xFD8C, 0xFAB9, 0xF93A };
Max
1
maxvankessel/zephyr
tests/lib/cmsis_dsp/filtering/src/fir_q15.pat
[ "Apache-2.0" ]
#!/bin/zsh # WARP DIRECTORY # ============== # Jump to custom directories in terminal # because `cd` takes too long... # # @github.com/mfaerevaag/wd eval "wd() { source '${0:A:h}/wd.sh' }"
Shell
4
chensanle/ohmyzsh
plugins/wd/wd.plugin.zsh
[ "MIT" ]
//SPDX-License-Identifier: MIT pragma solidity ^0.4.15; contract OldPragmaFloat { uint x; function OldPragmaFloat() public { x = 7; } }
Solidity
3
santanaluiz/truffle
packages/compile-solidity/test/sources/v0.4.x/OldPragmaFloat.sol
[ "MIT" ]
ZX1->(dbSetOrder(1), dbGoTop(), dbSeek(cChave)) //https://pt.stackoverflow.com/q/358314/101
xBase
1
piovezan/SOpt
xBase/Alias.prg
[ "MIT" ]
object UninstallProgressForm: TUninstallProgressForm Left = 191 Top = 139 BorderIcons = [biSystemMenu] BorderStyle = bsDialog Caption = 'UninstallProgressForm' ClientHeight = 360 ClientWidth = 497 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = True Scaled = False DesignSize = ( 497 360) PixelsPerInch = 96 TextHeight = 13 object FBevel: TBevel Left = 0 Top = 313 Width = 497 Height = 2 Anchors = [akLeft, akRight, akBottom] Shape = bsTopLine end object FCancelButton: TNewButton Left = 410 Top = 327 Width = 75 Height = 23 Anchors = [akRight, akBottom] Cancel = True Caption = '*' Enabled = False TabOrder = 2 end object FOuterNotebook: TNewNotebook Left = 0 Top = 0 Width = 497 Height = 313 ActivePage = FInnerPage Anchors = [akLeft, akTop, akRight, akBottom] Color = clBtnFace ParentColor = False TabOrder = 0 object FInnerPage: TNewNotebookPage DesignSize = ( 497 313) object FBevel1: TBevel Left = 0 Top = 58 Width = 499 Height = 3 Anchors = [akLeft, akTop, akRight] Shape = bsTopLine end object FInnerNotebook: TNewNotebook Left = 4 Top = 64 Width = 489 Height = 245 ActivePage = FInstallingPage Anchors = [akLeft, akTop, akRight, akBottom] TabOrder = 1 object FInstallingPage: TNewNotebookPage DesignSize = ( 489 245) object FProgressBar: TNewProgressBar Left = 36 Top = 56 Width = 417 Height = 21 Anchors = [akLeft, akTop, akRight] Min = 0 Max = 400 Style = npbstNormal end object FStatusLabel: TNewStaticText Left = 36 Top = 12 Width = 417 Height = 16 Anchors = [akLeft, akTop, akRight] AutoSize = False Caption = '*' ShowAccelChar = False TabOrder = 0 end end end object FMainPanel: TPanel Left = 0 Top = 0 Width = 497 Height = 58 Anchors = [akLeft, akTop, akRight] BevelOuter = bvNone Color = clWindow TabOrder = 0 DesignSize = ( 497 58) object FWizardSmallBitmapImage: TBitmapImage Left = 451 Top = 13 Width = 32 Height = 32 Anchors = [akTop, akRight] end object FPageDescriptionLabel: TNewStaticText Left = 40 Top = 26 Width = 389 Height = 29 Anchors = [akLeft, akTop, akRight] AutoSize = False Caption = '*' ShowAccelChar = False TabOrder = 1 WordWrap = True end object FPageNameLabel: TNewStaticText Left = 24 Top = 10 Width = 405 Height = 14 Anchors = [akLeft, akTop, akRight] AutoSize = False Caption = '*' TabOrder = 0 end end end end object FBeveledLabel: TNewStaticText Left = 0 Top = 306 Width = 5 Height = 14 Anchors = [akLeft, akBottom] Caption = '*' Enabled = False TabOrder = 1 Visible = False end end
Pascal
2
mqt635/issrc
Projects/UninstProgressForm.dfm
[ "FSFAP" ]
{ shortWithList(list: [1, 2, 3]) longWithList(list: ["hello world this is a very long string!","hello world this is a very long string!", "hello world this is a very long string!"]) }
GraphQL
0
fuelingtheweb/prettier
tests/graphql_lists/lists.graphql
[ "MIT" ]
fileFormatVersion: 2 guid: e0f1e5147a394f428f9a6447c4a8a1f4 timeCreated: 1591919825
Unity3D Asset
0
GardnerOne/ml-agents
com.unity.ml-agents.extensions/Runtime/Sensors/PoseExtractor.cs.meta
[ "Apache-2.0" ]
data { int<lower=1> N; // number of observations int<lower=1> T; // number of tracts int<lower=1> Z; // number of zones int<lower=1> H; // number of neighorhoods int<lower=1> L; // number of land int<lower=1> G; // number of grades int<lower=1> Y; // number of years int<lower=1> C; // number of cohorts int num_students[N]; // response var int<lower=1,upper=T> tract[N]; // tract id's int<lower=1,upper=Z> zone[T]; // zone id's int<lower=1,upper=H> nbhd[T]; // neighborhood id's int<lower=1,upper=L> land[T]; // land id's int<lower=1,upper=G> grade[N]; // grade id's int<lower=1,upper=Y> year[N]; // year id's int<lower=1,upper=C> cohort[N]; // cohort id's } parameters { real mu[T]; real<lower=0> sigma; real<lower=0> tau_grade_zone[G]; real<lower=0> tau_grade_nbhd[G]; real<lower=0> tau_grade_land[G]; real<lower=0> tau_year_zone[Y]; real<lower=0> tau_year_nbhd[Y]; real<lower=0> tau_year_land[Y]; real<lower=0> tau_cohort_zone[C]; real<lower=0> tau_cohort_nbhd[C]; real<lower=0> tau_cohort_land[C]; real beta_grade_zone[G, Z]; real beta_grade_nbhd[G, H]; real beta_grade_land[G, L]; real beta_year_zone[Y, Z]; real beta_year_nbhd[Y, H]; real beta_year_land[Y, L]; real beta_cohort_zone[C, Z]; real beta_cohort_nbhd[C, H]; real beta_cohort_land[C, L]; } transformed parameters { real theta[N]; for(n in 1:N) theta[n] = sigma * mu[tract[n]] + tau_grade_zone[grade[n]] * beta_grade_zone[grade[n], zone[tract[n]]] + tau_grade_nbhd[grade[n]] * beta_grade_nbhd[grade[n], nbhd[tract[n]]] + tau_grade_land[grade[n]] * beta_grade_land[grade[n], land[tract[n]]] + tau_year_zone[year[n]] * beta_year_zone[year[n], zone[tract[n]]] + tau_year_nbhd[year[n]] * beta_year_nbhd[year[n], nbhd[tract[n]]] + tau_year_land[year[n]] * beta_year_land[year[n], land[tract[n]]] + tau_cohort_zone[cohort[n]] * beta_cohort_zone[cohort[n], zone[tract[n]]] + tau_cohort_nbhd[cohort[n]] * beta_cohort_nbhd[cohort[n], nbhd[tract[n]]] + tau_cohort_land[cohort[n]] * beta_cohort_land[cohort[n], land[tract[n]]]; } model { mu ~ normal(0, 1); for(g in 1:G) { beta_grade_zone[g, ] ~ normal(0, 1); beta_grade_nbhd[g, ] ~ normal(0, 1); beta_grade_land[g, ] ~ normal(0, 1); } for(y in 1:Y) { beta_year_zone[y, ] ~ normal(0, 1); beta_year_nbhd[y, ] ~ normal(0, 1); beta_year_land[y, ] ~ normal(0, 1); } for(c in 1:C) { beta_cohort_zone[c, ] ~ normal(0, 1); beta_cohort_nbhd[c, ] ~ normal(0, 1); beta_cohort_land[c, ] ~ normal(0, 1); } tau_grade_zone ~ gamma(2, 1/G); tau_grade_nbhd ~ gamma(2, 1/G); tau_grade_land ~ gamma(2, 1/G); tau_year_zone ~ gamma(2, 1/Y); tau_year_nbhd ~ gamma(2, 1/Y); tau_year_land ~ gamma(2, 1/Y); tau_cohort_zone ~ gamma(2, 1/Z); tau_cohort_nbhd ~ gamma(2, 1/Z); tau_cohort_land ~ gamma(2, 1/Z); num_students ~ poisson_log(theta); }
Stan
5
stan-dev/stancon_talks
2018-helsinki/Contributed-Talks/auerbach_jones_winstanley/model2.stan
[ "CC-BY-4.0", "BSD-3-Clause" ]
// Copyright 2006-2015 Las Venturas Playground. All rights reserved. // Use of this source code is governed by the GPLv2 license, a copy of which can // be found in the LICENSE file. /** Las Venturas Playground v3.0 - Missionary Hills Jump This map was created by BRKHN - LVP Mapper 04/05/2010 - Added by Jay **/ #define MAP14 14 map_create(MAP14) { map_set_id(MAP14); map_set_name("Missionary Hills"); map_set_spawn(-2517.465, -1415.963, 809.959, 0.0); map_set_checkpoint(-2497.0042,-715.0800,307.4918); map_set_max_players(10); map_add_object(18450,-2512.173,-994.413,387.029,0.859,-45.550,-90.000); map_add_object(18450,-2511.347,-939.071,330.583,0.859,-45.550,-90.000); map_add_object(18450,-2510.602,-883.488,273.840,0.859,-45.550,-90.000); map_add_object(18450,-2513.009,-1049.300,442.950,0.859,-45.550,-90.000); map_add_object(18450,-2513.855,-1105.186,499.974,0.859,-45.550,-90.000); map_add_object(18450,-2514.709,-1160.825,556.681,0.859,-45.550,-90.000); map_add_object(18450,-2515.603,-1216.206,613.234,0.859,-45.550,-90.000); map_add_object(18450,-2516.405,-1270.793,668.903,0.859,-45.550,-90.000); map_add_object(18450,-2517.259,-1326.573,725.840,0.859,-45.550,-90.000); map_add_object(18450,-2518.068,-1380.845,781.136,0.859,-45.550,-90.000); map_add_object(1634,-2506.279,-856.795,248.275,-47.269,0.0,0.0); map_add_object(1634,-2510.427,-856.852,248.307,-47.269,0.0,0.0); map_add_object(1634,-2514.580,-856.919,248.340,-47.269,0.0,0.0); map_add_object(1634,-2506.344,-848.159,245.798,-34.377,0.0,0.0); map_add_object(1634,-2510.436,-848.247,245.820,-34.377,0.0,0.0); map_add_object(1634,-2514.500,-848.289,245.805,-34.377,0.0,0.0); map_add_object(1634,-2506.346,-839.165,246.615,-6.875,0.0,0.0); map_add_object(1634,-2510.480,-839.145,246.596,-6.875,0.0,0.0); map_add_object(1634,-2514.610,-839.114,246.572,-6.875,0.0,0.0); map_add_object(1634,-2506.344,-831.194,250.679,10.313,0.0,0.0); map_add_object(1634,-2510.497,-831.117,250.684,10.313,0.0,0.0); map_add_object(1634,-2514.666,-831.017,250.636,10.313,0.0,0.0); map_add_object(16409,-2517.465,-1415.963,809.959,0.0,0.0,-90.000); return 1; }
PAWN
3
EPIC-striker/playground
pawn/Resources/Maps/MapZones/Jumps/Missionary_Hills.pwn
[ "MIT" ]
; CLW file contains information for the MFC ClassWizard [General Info] Version=1 LastClass=CMcaViewerDlg LastTemplate=CDialog NewFileInclude1=#include "stdafx.h" NewFileInclude2=#include "McaViewer.h" ClassCount=3 Class1=CMcaViewerApp Class2=CMcaViewerDlg Class3=CAboutDlg ResourceCount=5 Resource1=IDD_ABOUTBOX Resource2=IDR_MAINFRAME Resource3=IDD_MCAVIEWER_DIALOG Resource4=IDD_ABOUTBOX (English (U.S.)) Resource5=IDD_MCAVIEWER_DIALOG (English (U.S.)) [CLS:CMcaViewerApp] Type=0 HeaderFile=McaViewer.h ImplementationFile=McaViewer.cpp Filter=N [CLS:CMcaViewerDlg] Type=0 HeaderFile=McaViewerDlg.h ImplementationFile=McaViewerDlg.cpp Filter=D BaseClass=CDialog VirtualFilter=dWC LastObject=CMcaViewerDlg [CLS:CAboutDlg] Type=0 HeaderFile=McaViewerDlg.h ImplementationFile=McaViewerDlg.cpp Filter=D [DLG:IDD_ABOUTBOX] Type=1 ControlCount=4 Control1=IDC_STATIC,static,1342177283 Control2=IDC_STATIC,static,1342308352 Control3=IDC_STATIC,static,1342308352 Control4=IDOK,button,1342373889 Class=CAboutDlg [DLG:IDD_MCAVIEWER_DIALOG] Type=1 ControlCount=3 Control1=IDOK,button,1342242817 Control2=IDCANCEL,button,1342242816 Control3=IDC_STATIC,static,1342308352 Class=CMcaViewerDlg [DLG:IDD_MCAVIEWER_DIALOG (English (U.S.))] Type=1 Class=CMcaViewerDlg ControlCount=6 Control1=IDCANCEL,button,1342242816 Control2=IDC_LIST_MCA,listbox,1352728833 Control3=IDB_DETECT,button,1342242816 Control4=IDB_CLEAR,button,1342242816 Control5=IDB_POLL,button,1342242816 Control6=IDB_CLEAR_BANK,button,1342242816 [DLG:IDD_ABOUTBOX (English (U.S.))] Type=1 Class=CAboutDlg ControlCount=4 Control1=IDC_STATIC,static,1342177283 Control2=IDC_STATIC,static,1342308480 Control3=IDC_STATIC,static,1342308352 Control4=IDOK,button,1342373889
Clarion
1
oudream/ccxx
test/dump/swdbgbk_src/chap06/McaViewer/McaViewer.clw
[ "MIT" ]
SELECT domain, hits, visits FROM ( SELECT domain(URL) AS domain, count() AS hits FROM test.hits GROUP BY domain ) ANY LEFT JOIN ( SELECT domain(StartURL) AS domain, sum(Sign) AS visits FROM test.visits GROUP BY domain ) USING domain ORDER BY hits DESC LIMIT 10 SETTINGS joined_subquery_requires_alias = 0;
SQL
3
pdv-ru/ClickHouse
tests/queries/1_stateful/00044_any_left_join_string.sql
[ "Apache-2.0" ]
import QtQuick 2.3 import QtQuick.Controls 1.2 import QGroundControl.FactSystem 1.0 import QGroundControl.FactControls 1.0 import QGroundControl.Controls 1.0 import QGroundControl.Palette 1.0 /* IMPORTANT NOTE: Any changes made here must also be made to SensorsComponentSummary.qml */ Item { anchors.fill: parent FactPanelController { id: controller; } property Fact mag0IdFact: controller.getParameterFact(-1, "CAL_MAG0_ID") property Fact gyro0IdFact: controller.getParameterFact(-1, "CAL_GYRO0_ID") property Fact accel0IdFact: controller.getParameterFact(-1, "CAL_ACC0_ID") property Fact dpressOffFact: controller.getParameterFact(-1, "SENS_DPRES_OFF") property Fact airspeedDisabledFact: controller.getParameterFact(-1, "FW_ARSP_MODE") property Fact airspeedBreakerFact: controller.getParameterFact(-1, "CBRK_AIRSPD_CHK") property bool _airspeedVisible: airspeedDisabledFact.value == 0 && airspeedBreakerFact.value !== 162128 property bool _airspeedCalRequired: _airspeedVisible && dpressOffFact.value === 0 Column { anchors.fill: parent VehicleSummaryRow { labelText: qsTr("Compass:") valueText: mag0IdFact ? (mag0IdFact.value === 0 ? qsTr("Setup required") : qsTr("Ready")) : "" } VehicleSummaryRow { labelText: qsTr("Gyro:") valueText: gyro0IdFact ? (gyro0IdFact.value === 0 ? qsTr("Setup required") : qsTr("Ready")) : "" } VehicleSummaryRow { labelText: qsTr("Accelerometer:") valueText: accel0IdFact ? (accel0IdFact.value === 0 ? qsTr("Setup required") : qsTr("Ready")) : "" } VehicleSummaryRow { labelText: qsTr("Airspeed:") visible: _airspeedVisible valueText: _airspeedCalRequired ? qsTr("Setup required") : qsTr("Ready") } } }
QML
4
uav-operation-system/qgroundcontrol
src/AutoPilotPlugins/PX4/SensorsComponentSummaryFixedWing.qml
[ "Apache-2.0" ]
# Token:: # Punctuator # Name # IntValue # FloatValue # StringValue # Punctuator:: one of # ! $ ( ) ... : = @ [ ] { | } # Name:: # /[_A-Za-z][_0-9A-Za-z]*/ # Document : # Definition (list) # Definition : # ExecutableDefinition # TypeSystemDefinition # TypeSystemExtension # ExecutableDefinition : # FragmentDefinition # OperationDefintion # FragmentDefinition type someType { id: ID } fragment subsriberFields on someType { id name fooInt(int: 1234, negInt: -56789, zero: 0) fooFloat( float: 1.1 floatExp: 1.4e10 floatExpSign1: 1.4e+10 floatExpSign2: 1.5e-40 floatExpBigE: 1.5E10 ) fooBool(x: true, y: false) fooString(str: "hello", strUni: "\u2116", strEscWs: "\t") fooLongStr( lStr: """ Hello Reader, This is a long string block. Best, Writer """ ) fooNull(nullThing: null) fooList(numList: [1, 2, 3], strList: ["a", "b", "c"]) fooObj(someObj: { str: "hi", int: 2 }) } # OperationDefintion query _A1 { getThings(strArg: "string") { id # commas here are ignored but valid name } } query _A2($x: String) { someFn(episode: $x) { name } } mutation B1 { changeThings(intArg: 123) { parent { nestedField1 nestedField2 } } } subscription C1_Hello { subsribePlease(floatArg: 1.4) { id ...subsriberFields } } # TypeSystemDefinition : # SchemaDefinition # TypeDefinition schema { query: Query mutation: Mutation } type Query { """ Can provide documentation this way. """ scalars: Scalars someList: SomeLists fooBar: FooBar } interface Thing { id: ID! } type Scalars implements Thing { id: ID! int: Int! float: Float! str: String! @deprecated(reason: "Need to test a directive") bool: Boolean type: StringTypes } type SomeLists { ints: [Int!]! } type Foo { fooVal: String } type Bar { barVal: String } union FooBar = Foo | Bar enum StringTypes { ONE TWO } input Xyz { id: ID! } type Mutation { createXyz(input: xyz!): Xyz! }
GraphQL
5
JesseVermeulen123/bat
tests/syntax-tests/source/GraphQL/test.graphql
[ "Apache-2.0", "MIT" ]
require_relative 'module' require 'fastlane_core/command_executor' module Screengrab class AndroidEnvironment attr_reader :android_home # android_home - the String path to the install location of the Android SDK # build_tools_version - the String version of the Android build tools that should be used, ignored def initialize(android_home, build_tools_version = nil) @android_home = android_home end def platform_tools_path @platform_tools_path ||= find_platform_tools(android_home) end def adb_path @adb_path ||= find_adb(platform_tools_path) end private def find_platform_tools(android_home) return nil unless android_home platform_tools_path = Helper.localize_file_path(File.join(android_home, 'platform-tools')) File.directory?(platform_tools_path) ? platform_tools_path : nil end def find_adb(platform_tools_path) return FastlaneCore::CommandExecutor.which('adb') unless platform_tools_path adb_path = Helper.get_executable_path(File.join(platform_tools_path, 'adb')) adb_path = Helper.localize_file_path(adb_path) return executable_command?(adb_path) ? adb_path : nil end def executable_command?(cmd_path) Helper.executable?(cmd_path) end end end
Ruby
5
flufff42/fastlane
screengrab/lib/screengrab/android_environment.rb
[ "MIT" ]
import createSvgIcon from './utils/createSvgIcon'; import { jsx as _jsx } from "react/jsx-runtime"; export default createSvgIcon( /*#__PURE__*/_jsx("path", { d: "M8.83 19.1c-.26-.6.09-1.28.73-1.41l3.58-.71-4.35-9.81c-.34-.76 0-1.64.76-1.98.76-.34 1.64 0 1.98.76l2.43 5.49.84-.37c.28-.13.59-.18.9-.17l4.56.21c.86.04 1.6.63 1.83 1.45l1.23 4.33c.27.96-.2 1.97-1.11 2.37l-5.63 2.49c-.48.21-1.26.33-1.76.14l-5.45-2.27c-.24-.09-.44-.28-.54-.52zm-2.08-5.72c.26-.26.29-.66.09-.95C5.68 10.74 5 8.7 5 6.5c0-.88.11-1.74.32-2.56l1.09 1.09c.3.3.79.29 1.08-.02.28-.3.25-.78-.04-1.07L5.21 1.71a.9959.9959 0 0 0-1.41 0L1.53 3.97c-.3.3-.29.79.02 1.08.3.28.78.25 1.07-.04L3.8 3.82c-.2.86-.3 1.76-.3 2.68 0 2.51.77 4.85 2.09 6.77.27.39.82.45 1.16.11z" }), 'SwipeUpRounded');
JavaScript
4
dany-freeman/material-ui
packages/mui-icons-material/lib/esm/SwipeUpRounded.js
[ "MIT" ]
#%RAML 1.0 Library types: rule: properties: tenantName: type: string maxLength: 64 description: Tenant Name pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$" policyName: type: string maxLength: 64 description: Policy Name pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$" ruleId: type: string maxLength: 64 description: Rule Id pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$" direction: type: string description: Direction pattern: "^(in|out)$" priority: type: integer description: Priority fromEndpointGroup: type: string maxLength: 64 description: From Endpoint Group pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])?$" toEndpointGroup: type: string maxLength: 64 description: To Endpoint Group pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])?$" fromNetwork: type: string maxLength: 64 description: From Network pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])?$" toNetwork: type: string maxLength: 64 description: To Network pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])?$" fromIpAddress: type: string description: IP Address pattern: "^(((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})(\\\\-(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9]))?(/(3[0-1]|2[0-9]|1[0-9]|[1-9]))?)?$" toIpAddress: type: string description: IP Address pattern: "^(((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})(\\\\-(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9]))?(/(3[0-1]|2[0-9]|1[0-9]|[1-9]))?)?$" protocol: type: string description: Protocol pattern: "^(tcp|udp|icmp||[0-9]{1,3}?)$" port: type: integer description: Port No action: type: string description: Action pattern: "^(allow|deny)$" rules: type: array items: type: rule upd_rule: type: rule inspect_rule: properties: Config: type: rule serviceLB: properties: tenantName: type: string maxLength: 64 description: Tenant Name pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$" networkName: type: string maxLength: 64 description: Service network name pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$" serviceName: type: string maxLength: 256 description: service name pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$" ipAddress: type: string maxLength: 15 description: Service ip pattern: "^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})?$" selectors: type: array items: type: string description: labels key value pair ports: type: array items: type: string description: service provider port serviceLBs: type: array items: type: serviceLB upd_serviceLB: type: serviceLB inspect_serviceLB: properties: Config: type: serviceLB Oper: properties: serviceVip: type: string description: allocated IP addresses numProviders: type: integer description: " number of provider endpoints for the service" providers: type: array items: type: endpoint description: provider endpoints for the service endpointGroup: properties: groupName: type: string maxLength: 64 pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$" tenantName: type: string maxLength: 64 pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$" networkName: type: string maxLength: 64 pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$" ipPool: type: string description: IP-pool pattern: "^$|^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})(\\\\-((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))?$" policies: type: array items: type: string extContractsGrps: type: array items: type: string netProfile: type: string cfgdTag: type: string pattern: "^((([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9]))?$" endpointGroups: type: array items: type: endpointGroup upd_endpointGroup: type: endpointGroup inspect_endpointGroup: properties: Config: type: endpointGroup Oper: properties: pktTag: type: integer description: internal packet tag externalPktTag: type: integer description: external packet tag numEndpoints: type: integer description: number of endpoints endpoints: type: array items: type: endpoint description: endpoints in the group allocatedIPAddresses: type: string description: allocated IP addresses availableIPAddresses: type: string description: Available IP addresses groupTag: type: string description: Derived EndpointGroup Tag volume: properties: volumeName: type: string description: Volume Name tenantName: type: string description: Tenant Name datastoreType: type: string poolName: type: string size: type: string mountPoint: type: string volumes: type: array items: type: volume upd_volume: type: volume inspect_volume: properties: Config: type: volume Bgp: properties: hostname: type: string maxLength: 256 description: host name pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$" routerip: type: string description: Bgp router intf ip pattern: "^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})(\\\\-(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9]))?/(3[0-1]|2[0-9]|1[0-9]|[1-9])$" as: type: string maxLength: 64 description: AS id neighbor-as: type: string maxLength: 64 description: AS id neighbor: type: string maxLength: 15 description: Bgp neighbor pattern: "^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})?$" Bgps: type: array items: type: Bgp upd_Bgp: type: Bgp inspect_Bgp: properties: Config: type: Bgp Oper: properties: numRoutes: type: integer description: number of routes neighborStatus: type: string description: neighbor status adminStatus: type: string description: admin status routes: type: array items: type: string description: routes policy: properties: policyName: type: string maxLength: 64 description: Policy Name pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$" tenantName: type: string maxLength: 64 description: Tenant Name pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$" policys: type: array items: type: policy upd_policy: type: policy inspect_policy: properties: Config: type: policy Oper: properties: numEndpoints: type: integer description: number of endpoints policyViolations: type: integer description: number of policyViolations endpoints: type: array items: type: endpoint description: endpoints associate with the policy endpoint: properties: {} endpoints: type: array items: type: endpoint upd_endpoint: type: endpoint inspect_endpoint: properties: Config: type: endpoint Oper: properties: network: type: string endpointID: type: string serviceName: type: string endpointGroupId: type: integer endpointGroupKey: type: string ipAddress: type: array items: type: string macAddress: type: string homingHost: type: string intfName: type: string vtepIP: type: string labels: type: string containerID: type: string containerName: type: string virtualPort: type: string extContractsGroup: properties: tenantName: type: string maxLength: 64 description: Tenant name pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$" contractsGroupName: type: string maxLength: 64 description: Contracts group name pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$" contractsType: type: string description: Contracts type contracts: type: array items: type: string description: Contracts list extContractsGroups: type: array items: type: extContractsGroup upd_extContractsGroup: type: extContractsGroup inspect_extContractsGroup: properties: Config: type: extContractsGroup appProfile: properties: tenantName: type: string maxLength: 64 description: Tenant Name pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$" appProfileName: type: string maxLength: 64 description: Application Profile Name pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$" endpointGroups: type: array items: type: string description: Member groups of the appProf appProfiles: type: array items: type: appProfile upd_appProfile: type: appProfile inspect_appProfile: properties: Config: type: appProfile network: properties: networkName: type: string maxLength: 64 description: Network name pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$" tenantName: type: string maxLength: 64 description: Tenant Name pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$" nwType: type: string description: Network Type pattern: "^(infra|data)$" encap: type: string description: Encapsulation pattern: "^(vlan|vxlan)$" pktTag: type: integer description: Vlan/Vxlan Tag subnet: type: string description: Subnet pattern: "^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})(\\\\-((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))?/(3[0-1]|2[0-9]|1[0-9]|[1-9])$" gateway: type: string description: Gateway pattern: "^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})?$" ipv6Subnet: type: string description: IPv6Subnet pattern: "^((((([0-9]|[a-f]|[A-F]){1,4})((\\\\:([0-9]|[a-f]|[A-F]){1,4}){7}))|(((([0-9]|[a-f]|[A-F]){1,4}\\\\:){0,6}|\\\\:)((\\\\:([0-9]|[a-f]|[A-F]){1,4}){0,6}|\\\\:)))/(1[0-2][0-7]|[1-9][0-9]|[1-9]))?$" ipv6Gateway: type: string description: IPv6Gateway pattern: "^(((([0-9]|[a-f]|[A-F]){1,4})((\\\\:([0-9]|[a-f]|[A-F]){1,4}){7}))|(((([0-9]|[a-f]|[A-F]){1,4}\\\\:){0,6}|\\\\:)((\\\\:([0-9]|[a-f]|[A-F]){1,4}){0,6}|\\\\:)))?$" cfgdTag: type: string maxLength: 128 description: Configured Network Tag pattern: "^((([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9]))?$" networks: type: array items: type: network upd_network: type: network inspect_network: properties: Config: type: network Oper: properties: pktTag: type: integer description: internal packet tag externalPktTag: type: integer description: external packet tag numEndpoints: type: integer description: external packet tag allocatedAddressesCount: type: integer description: Vlan/Vxlan Tag allocatedIPAddresses: type: string description: allocated IP addresses availableIPAddresses: type: string description: Available IP addresses endpoints: type: array items: type: endpoint description: endpoints in the network networkTag: type: string description: Derived Network Tag aciGw: properties: name: type: string maxLength: 64 description: name of this block(must be 'aciGw') pattern: "^(aciGw)$" pathBindings: type: string maxLength: 2048 description: List of ACI fabric ports connected to cluster pattern: "^$|^(topology/pod-[0-9]{1,4}/paths-[0-9]{1,4}/pathep-\\\\[eth[0-9]{1,2}/[0-9]{1,2}\\\\]){1}(,topology/pod-[0-9]{1,4}/paths-[0-9]{1,4}/pathep-\\\\[eth[0-9]{1,2}/[0-9]{1,2}\\\\])*$" nodeBindings: type: string maxLength: 2048 description: List of ACI complete nodes to be bound pattern: "^$|^(topology/pod-[0-9]{1,4}/node-[0-9]{1,4}){1}(,topology/pod-[0-9]{1,4}/node-[0-9]{1,4})*$" physicalDomain: type: string maxLength: 128 description: Name of the physical domain pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$" enforcePolicies: type: string maxLength: 64 description: Enforce security policy pattern: "^(yes|no){1}$" includeCommonTenant: type: string maxLength: 64 description: Include common tenant when searching for objects pattern: "^(yes|no){1}$" aciGws: type: array items: type: aciGw upd_aciGw: type: aciGw inspect_aciGw: properties: Config: type: aciGw Oper: properties: numAppProfiles: type: integer global: properties: name: type: string maxLength: 64 description: name of this block(must be 'global') pattern: "^(global)$" networkInfraType: type: string maxLength: 64 description: Network infrastructure type pattern: "^(aci|aci-opflex|default)?$" vlans: type: string description: Allowed vlan range pattern: "^([0-9]{1,4}?-[0-9]{1,4}?)$" vxlans: type: string description: Allwed vxlan range pattern: "^([0-9]{1,8}?-[0-9]{1,8}?)$" fwdMode: type: string maxLength: 64 description: Forwarding Mode pattern: "^(bridge|routing)?$" arpMode: type: string maxLength: 64 description: ARP Mode pattern: "^(proxy|flood)?$" pvtSubnet: type: string description: Private Subnet used by host bridge pattern: "^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})/16$" globals: type: array items: type: global upd_global: type: global inspect_global: properties: Config: type: global Oper: properties: numNetworks: type: integer defaultNetwork: type: string vlansInUse: type: string vxlansInUse: type: string freeVXLANsStart: type: integer clusterMode: type: string volumeProfile: properties: volumeProfileName: type: string description: Volume profile Name tenantName: type: string description: Tenant Name datastoreType: type: string poolName: type: string size: type: string mountPoint: type: string volumeProfiles: type: array items: type: volumeProfile upd_volumeProfile: type: volumeProfile inspect_volumeProfile: properties: Config: type: volumeProfile tenant: properties: tenantName: type: string maxLength: 64 description: Tenant Name pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])$" defaultNetwork: type: string maxLength: 64 description: Network name pattern: "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9])?$" tenants: type: array items: type: tenant upd_tenant: type: tenant inspect_tenant: properties: Config: type: tenant Oper: properties: totalNetworks: type: integer description: total number of networks totalEPGs: type: integer description: total number of EPGs totalNetprofiles: type: integer description: total number of Netprofiles totalAppProfiles: type: integer description: total number of App-Profiles totalServicelbs: type: integer description: total number of Servicelbs totalPolicies: type: integer description: total number of totalPolicies totalEndpoints: type: integer description: total number of endpoints in the tenant endpoints: type: array items: type: endpoint description: endpoints in the tenant networks: type: array items: type: network description: networks in the tenant endpointGroups: type: array items: type: endpointGroup description: endpointGroups in the tenant policies: type: array items: type: policy description: policies in the tenant servicelbs: type: array items: type: serviceLB description: servicelbs in the tenant netprofile: properties: profileName: type: string maxLength: 64 description: Network profile name tenantName: type: string description: Tenant name bandwidth: type: string maxLength: 64 description: Allocated bandwidth pattern: "^([1-9][0-9]* (([kmgKMG{1}]bps)|[kmgKMG{1}]|(kb|Kb|Gb|gb|Mb|mb)))?$|^([1-9][0-9]*(((k|m|g|K|G|M)bps)|(k|m|g|K|M|G)|(kb|Kb|Gb|gb|Mb|mb)))?$" DSCP: type: integer description: DSCP burst: type: integer description: burst size netprofiles: type: array items: type: netprofile upd_netprofile: type: netprofile inspect_netprofile: properties: Config: type: netprofile
RAML
5
sap-ariba/netplugin
contivmodel/spec/netmaster/libraries/netmaster.raml
[ "Apache-2.0" ]
#include "caffe2/operators/free_op.h" namespace caffe2 { REGISTER_CPU_OPERATOR(Free, FreeOp<CPUContext>); SHOULD_NOT_DO_GRADIENT(Free); OPERATOR_SCHEMA(Free) .NumInputs(1, INT_MAX) .NumOutputs(1, INT_MAX) .SameNumberOfOutput() .EnforceOneToOneInplace() .SetDoc(R"DOC( Frees the content of the blobs. The input and output blobs should be one-to-one inplace.)DOC"); } // namespace caffe2
C++
4
Hacky-DH/pytorch
caffe2/operators/free_op.cc
[ "Intel" ]
/* * Copyright 2014 The Sculptor Project Team, including the original * author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.sculptor.generator import com.google.inject.Injector import java.lang.reflect.Method import java.util.Properties import javax.inject.Inject import javax.inject.Named import org.eclipse.emf.common.util.Diagnostic import org.eclipse.emf.common.util.URI import org.eclipse.emf.ecore.EObject import org.eclipse.emf.ecore.resource.Resource import org.eclipse.emf.ecore.util.Diagnostician import org.eclipse.xtext.resource.IResourceServiceProvider import org.eclipse.xtext.resource.XtextResource import org.eclipse.xtext.resource.XtextResourceSet import org.eclipse.xtext.util.EmfFormatter import org.eclipse.xtext.validation.AbstractValidationDiagnostic import org.eclipse.xtext.validation.CheckMode import org.sculptor.dsl.sculptordsl.DslApplication import org.sculptor.dsl.sculptordsl.DslModel import org.sculptor.generator.SculptorGeneratorIssue.SculptorGeneratorIssueImpl import org.sculptor.generator.SculptorGeneratorIssue.Severity import org.sculptor.generator.configuration.MutableConfigurationProvider import org.slf4j.LoggerFactory import sculptormetamodel.Application /** * This class provides a strategy implementation of the Sculptor generators internal workflow: * <ol> * <li>updates the generator configuration with the given properties * <li>read the Sculptor DSL model from a given URL * <li>validate the resources of the DSL model * <li>validate the DSL model * <li>transform the DSL model into a generator model * <li>generate the code from the generator model * </ol> * * Any problems occurring during workflow execution are stored as {@link SculptorGeneratorIssue} in * the {@link SculptorGeneratorContext}. * * @see #run(String) */ class SculptorGeneratorWorkflow { val static LOG = LoggerFactory.getLogger(SculptorGeneratorWorkflow) @Inject var Injector injector @Inject @Named("Mutable Defaults") var MutableConfigurationProvider configuration @Inject var IResourceServiceProvider.Registry registry @Inject var Diagnostician diagnostitian var XtextResourceSet resourceSet @Inject protected def final void setResourceSet(XtextResourceSet resourceSet) { resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE) this.resourceSet = resourceSet } def final boolean run(String modelURI, Properties properties) { LOG.debug("Executing workflow with model from '{}'", modelURI) updateConfiguration(properties) if (readModel(modelURI)) { if (validateResources()) { val dslApp = getApplication() if (validateApplication(dslApp)) { val app = transformAndModifyApplication(dslApp) if (app !== null) { if (generateCode(app) !== null) { return true } } } } } LOG.debug("Executing workflow failed") false } protected def updateConfiguration(Properties properties) { if (properties !== null) { LOG.debug("Updating configuration with {}", properties) properties.stringPropertyNames.forEach[key|configuration.setString(key, properties.getProperty(key))] } } protected def boolean readModel(String modelUri) { LOG.debug("Reading model from '{}'", modelUri) // Read all the models from given URI and check for imports var newUris = newArrayList newUris.add(modelUri) var int resourceSetSize do { // Remember the current number of resources in the resource set resourceSetSize = resourceSet.resources.size // Convert given text into URIs var realUris = newArrayList for (uri : newUris) { try { realUris.add(URI.createURI(uri)) } catch (Exception e) { SculptorGeneratorContext.addIssue( new SculptorGeneratorIssueImpl(Severity.ERROR, "Invalid URI '" + uri + "' : " + e.message, e)) return false } } // Check the existing URIs for new URIs from imports newUris = newArrayList for (uri : realUris) { val resource = resourceSet.getResource(uri, true) for (contents : resource.contents) { if (contents instanceof DslModel) { for (import : contents.imports) { val app = contents.app LOG.debug("Application" + (if (app.basePackage !== null && !app.basePackage.empty) " '{}'" else "Part '{}'") + " imports resource URI '{}'", app.name, import.importURI) newUris.add(import.importURI) } } } } } while (!newUris.empty && resourceSetSize != resourceSet.resources.size) true } protected def boolean validateResources() { LOG.debug("Validating resource in resourceset '{}'", resourceSet) // Validate all resources in resource set resourceSet.resources.forall [ LOG.debug("Validating resource '{}'", it.URI) val provider = registry.getResourceServiceProvider(it.URI) val issues = provider.resourceValidator.validate(it, CheckMode.ALL, null) issues.forall [ val message = "Resource validation error \"" + it.message + "\" in line " + it.lineNumber + if(it.uriToProblem !== null) " of " + it.uriToProblem.trimFragment else "" switch it.severity { case ERROR: { SculptorGeneratorContext.addIssue(new SculptorGeneratorIssueImpl(Severity.ERROR, message)) return false } case WARNING: SculptorGeneratorContext.addIssue(new SculptorGeneratorIssueImpl(Severity.WARNING, message)) default: SculptorGeneratorContext.addIssue(new SculptorGeneratorIssueImpl(Severity.INFO, message)) } true ] ] } protected def DslApplication getApplication() { LOG.debug("Retrieving application from resource set '{}'", resourceSet) var DslApplication mainApp = null for (Resource resource : resourceSet.resources) { for (EObject obj : resource.contents) { if (obj instanceof DslModel) { val model = obj if (mainApp === null) { mainApp = model.app } else { mainApp.modules.addAll(model.app.modules) } } } } if (mainApp !== null) { LOG.debug("Found application '{}'", mainApp.name) } else { SculptorGeneratorContext.addIssue( new SculptorGeneratorIssueImpl(Severity.ERROR, "No application found in resource set: " + resourceSet)) } mainApp } protected def boolean validateApplication(DslApplication application) { LOG.debug("Validating application '{}'", application.name) val appDiagnostic = diagnostitian.validate(application) if (appDiagnostic.getSeverity() != Diagnostic.OK) { logDiagnostic(appDiagnostic) if (appDiagnostic.getSeverity() == Diagnostic.ERROR) { SculptorGeneratorContext.addIssue( new SculptorGeneratorIssueImpl(Severity.ERROR, "Validating application '" + application.name + "' failed")) return false } } true } protected def Application transformAndModifyApplication(DslApplication application) { LOG.debug("Transforming application '{}'", application.name) var transformedApplication = runAction("org.sculptor.generator.transform.DslTransformation.transform", application) as Application if (transformedApplication !== null) { LOG.debug("Modifying transformed application '{}'", transformedApplication.name) transformedApplication = runAction("org.sculptor.generator.transform.Transformation.modify", transformedApplication) as Application } if (transformedApplication === null) { SculptorGeneratorContext.addIssue( new SculptorGeneratorIssueImpl(Severity.ERROR, "Transformation and modification of application '" + application.name + "' failed")) } transformedApplication } protected def Object generateCode(Application application) { LOG.debug("Generating code from application '{}'", application.name) runAction("org.sculptor.generator.template.RootTmpl.root", application) } protected def Object runAction(String actionName, Object input) { LOG.debug("Running action '{}' on '{}'", actionName, input.class.name) try { val lastDot = actionName.lastIndexOf('.') val actionClass = Class.forName(actionName.substring(0, lastDot)) var Method actionMethod try { actionMethod = actionClass.getMethod(actionName.substring(lastDot + 1), input.class) } catch (Throwable th) { actionMethod = actionClass.getMethod(actionName.substring(lastDot + 1), input.class.interfaces.get(0)) } val actionObj = injector.getInstance(actionClass) return actionMethod.invoke(actionObj, input) } catch (Throwable t) { SculptorGeneratorContext.addIssue( new SculptorGeneratorIssueImpl(Severity.ERROR, "Error running action '" + actionName + "': " + if(t.cause instanceof SculptorGeneratorException) t.cause.message else t.message, t)) } null } protected def void logDiagnostic(Diagnostic diagnostic) { val eObject = if (diagnostic instanceof AbstractValidationDiagnostic) (diagnostic).sourceEObject else null if (eObject !== null) { val message = "Model validation error \"" + diagnostic.getMessage() + "\" at " + EmfFormatter.objPath(eObject) switch diagnostic.severity { case Diagnostic.ERROR: SculptorGeneratorContext.addIssue(new SculptorGeneratorIssueImpl(Severity.ERROR, message)) case Diagnostic.WARNING: SculptorGeneratorContext.addIssue(new SculptorGeneratorIssueImpl(Severity.WARNING, message)) default: SculptorGeneratorContext.addIssue(new SculptorGeneratorIssueImpl(Severity.INFO, message)) } } if (diagnostic.getChildren() !== null) { for (Diagnostic childDiagnostic : diagnostic.getChildren()) { logDiagnostic(childDiagnostic) } } } }
Xtend
5
sculptor/sculptor
sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/SculptorGeneratorWorkflow.xtend
[ "Apache-2.0" ]
console.log "1 is main", module is require*.main test1 = require './0.em' test1.error()
EmberScript
0
ghempton/ember-script
test/cli-eval-errors-files/1.em
[ "BSD-3-Clause" ]
@Optional("Foo") class Bar
Groff
1
punzki/kotlin
jps-plugin/testData/incremental/multiModule/multiplatform/custom/commonSourcesCompilerArg/c_b.kt.new.5
[ "ECL-2.0", "Apache-2.0" ]
The functions in this file (well, the single function) will allow the user to plot different functions using the Gnuplot program. In fact, all it really does is output a number of points on the list and allow the user to activate Gnuplot and use the plotting program to get the appropriate output. The first line just gives the module name. For the moment, I don't anticipate using any modules (although this may change). > module Plot where Now we give the type of the function. This consists of a file name, a list of values, and a function that goes from the appropriate types. > plot2d:: (Fractional a, Fractional b, Ord a, Ord b, Show a, Show b) > => String -> [(a, b)] -> [a] -> (a -> b) -> String > plot2d fl expected inp f = plot2d' expected inp f > plot2d':: (Fractional a, Fractional b, Ord a, Ord b, Show a, Show b) > => [(a, b)] -> [a] -> (a -> b) -> String > plot2d' [] [] f = [] > plot2d' ((e1, e2):es) (x:xs) f > | (e1 `isSame` x) && (e2 `isSame` x') > = (show e1) ++ > " " ++ > (show e2) ++ > "\n" ++ > plot2d' es xs f > | otherwise > = "Mismatch: " ++ > (show e1) ++ > " " ++ > (show e2) ++ > " " ++ > (show x) ++ > " " ++ > (show x') ++ > "\n" ++ > plot2d' es xs f > where x' = f x > plot2d' es [] _ = "Extra expected: " ++ show es > plot2d' [] xs _ = "Extra results: " ++ show xs > isSame :: (Fractional a, Ord a) => a -> a -> Bool > x `isSame` y = abs (x - y) < 0.00001 And now, let's create a function to make a range out of a triple of a start point, an end point, and an increment. > createRange:: (Num a, Ord a) => a -> a -> a -> [a] > createRange s e i = if s > e then [] > else s : createRange (s+i) e i We now settle down to a couple of more specific functions that do things that are more unique to gnuplot. First, we have something that creates the appropriate gnuplot command file. > createGnuPlot:: Show a => String -> a -> a -> String > createGnuPlot fl s e = > "set terminal latex\n" ++ > "set output \"" ++ > (fl ++ ".tex\"\n") ++ > "set nokey\n" ++ > "plot [" ++ > (show s) ++ > ":" ++ > (show e) ++ > "] \"" ++ > (fl ++ ".plt\"") ++ > " with lines\n" And now we create a fairly specific plotExam function that takes a string, a function, and two floats and produces the correct files > plotExam:: String -> [(Float, Float)] -> Float -> Float -> (Float -> Float) > -> String > plotExam fl expected s e f = plot2d (fl++".plt") expected r f ++ > createGnuPlot fl s e > where r = createRange s e ((e - s) / 2500)
Literate Haskell
4
ocharles/ghc
testsuite/tests/programs/barton-mangler-bug/Plot.lhs
[ "BSD-3-Clause" ]
<div class="footer"> <p>&copy; Jonathan Bullock 2013 | Mixed with <a href="http://twitter.github.com/bootstrap/">Bootstrap v2.3.1</a> | Baked with <a href="http://jbake.org">JBake ${version}</a></p> </div> </div> <!-- /container --> <!-- Le javascript ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="/js/jquery-1.9.1.min.js"></script> <script src="/js/bootstrap.min.js"></script> </body> </html>
Groovy Server Pages
3
bmarwell/jbake
jbake-core/src/test/resources/fixture/groovyTemplates/footer.gsp
[ "MIT" ]
-- This script presumes that you are an OmniFocus user, -- and that you'd like to have a project in OmniFocus for a reading list of articles from NetNewsWire. -- Running this script creates a new task in an OmniFocus project called "NetNewsWire reading list" -- with information about the current article. -- Ideally, the name of the task will be the name of the article, but some articles don't have names -- so if there is not name for the article, just use a default string "A NetNewsWireArticle without a title" to getTitleOrSomething() tell application "NetNewsWire" set myTitle to the title of the current article if (myTitle is "") then set myTitle to "A NetNewsWireArticle without a title" end if end tell end getTitleOrSomething -- Here's where the script starts -- first get the url and the title of the current article tell application "NetNewsWire" set myUrl to the url of the current article set myTitle to my getTitleOrSomething() end tell tell application "OmniFocus" tell document 1 -- Second, ensure that the front OmniFocus document has a project called "NetNewsWire reading list" set names to name of every project if names does not contain "NetNewsWire reading list" then make new project with properties {name:"NetNewsWire reading list"} end if -- lastly, add a task in that project referring to the current article -- the "Note" field of the task will contain the url for the article tell project "NetNewsWire reading list" make new task with properties {name:myTitle, note:myUrl} end tell end tell end tell
AppleScript
5
bubudrc/NetNewsWire
AppleScript/OmniFocus-AddToNNWReadingList.applescript
[ "MIT" ]
2016-02-18 13:49:24 - irc: disconnected from server 2016-02-18 13:49:24 [13:49] 2016-02-19 14:11:49 NicholasB just share him this link 2016-02-19 14:11:49 [14:11] 2016-02-19 14:11:50 NicholasB https://telegram.me/joinchat/B0P5bQHqb4U857sKaz9Ktw 2016-02-19 14:13:03 fsociety ah k thanks 2016-02-19 14:13:06 - [NicholasB] is away: Mobile 2016-02-19 14:19:00 [14:13] 2016-02-19 14:19:36 < NicholasB (Nicholas_B@telegram) has quit (bitlbee.localhost telegram.localhost) 2016-02-19 14:19:45 > NicholasB (Nicholas_B@telegram) is back on server 2016-02-19 14:25:00 [14:19] 2016-02-19 16:46:38 - irc: disconnected from server 2016-02-19 16:46:38 [16:46] 2016-02-23 10:33:23 fsociety once again, thanks for the whole vap thing 2016-02-23 10:33:23 [10:33] 2016-02-23 10:33:25 - [NicholasB] is away: Mobile 2016-02-23 10:35:06 NicholasB np.. like i said it cost me nothing. 2016-02-23 10:35:30 fsociety as long as im not putting you out of pocket i have no issues 2016-02-23 10:35:54 NicholasB nope not at all. 2016-02-23 10:36:57 fsociety excellent :) 2016-02-23 10:42:00 [10:36] 2016-02-23 11:03:29 - irc: disconnected from server 2016-02-23 11:03:29 [11:03] 2016-02-25 11:38:03 NicholasB hey boss im posting today. i only have a few spare flavours thought. but it will get you through a few weeks 2016-02-25 11:38:09 NicholasB *though 2016-02-25 11:38:35 NicholasB cinnamon. ice blueberry and carmael candy. 2016-02-25 11:39:46 NicholasB you might hate them or love them. im not a caramel guy but some people dig the shit out of it 2016-02-25 11:40:01 fsociety haha thanks dude 2016-02-25 11:40:01 - [NicholasB] is away: Mobile 2016-02-25 11:40:16 fsociety that gives me a good starting point when i bulk buy some juices 2016-02-25 20:51:54 - irc: disconnected from server 2016-02-26 07:34:08 NicholasB <br><img id="3"> 2016-02-26 07:39:54 NicholasB it appears that's its already at the po box awaiting collection 2016-02-26 07:54:13 fsociety ahh thanks for that i'll grab it the moment i get to the office :) 2016-02-26 07:54:13 - [NicholasB] is away: Mobile 2016-02-26 10:22:14 fsociety do you have a link on how to put this bloody thing together.. haha 2016-02-26 10:22:24 NicholasB hahaha 2016-02-26 10:22:28 NicholasB it's easy 2016-02-26 10:22:40 NicholasB get a coil 2016-02-26 10:23:03 NicholasB I would say a 1.8 (there are wriiten on the box or on the side of the coil 2016-02-26 10:23:35 NicholasB screw it in to the bronzy base on the chamber mouth piece thing 2016-02-26 10:23:45 NicholasB called a cleromiser 2016-02-26 10:25:09 fsociety the clear atomizer? 2016-02-26 10:25:27 NicholasB yeah 2016-02-26 10:25:45 NicholasB but they call them clearomisers 2016-02-26 10:25:51 fsociety done that 2016-02-26 10:25:55 NicholasB done that? 2016-02-26 10:25:58 NicholasB ha 2016-02-26 10:25:59 NicholasB cool 2016-02-26 10:26:12 NicholasB now put some juice in the chamber 2016-02-26 10:26:23 NicholasB from the bottom. half fill it 2016-02-26 10:26:29 NicholasB a liitle more 2016-02-26 10:26:33 NicholasB don't overfill 2016-02-26 10:29:26 NicholasB screw on the bronze bit that has the coil attached 2016-02-26 10:29:40 NicholasB after you have filled it 2016-02-26 10:36:21 NicholasB then 2016-02-26 10:36:25 NicholasB attach it to the battery 2016-02-26 10:37:01 NicholasB turn the wheel on the bottom of the battery all the way  clockwise to the lowest sotting 2016-02-26 10:37:01 fsociety im still very confused 2016-02-26 10:37:09 fsociety you have the mouth piece and then the other end 2016-02-26 10:37:58 NicholasB yeah 2016-02-26 10:37:59 NicholasB https://www.youtube.com/watch?v=moHJ9cG2u_g 2016-02-26 10:38:02 NicholasB there you go 2016-02-26 10:40:56 fsociety um is the silicon those pieces of plastic you put some of that other bits in 2016-02-26 10:40:57 fsociety haha 2016-02-26 10:41:03 fsociety cause there is none otherwise 2016-02-26 10:41:35 fsociety cause it just leaks 2016-02-26 10:41:44 NicholasB yeah. I've never used these. the are just replacemt one 2016-02-26 10:41:59 NicholasB it shold have them installed already 2016-02-26 10:42:39 fsociety umm.. i just dont get how you are suppose to put the juice in underneath and not make it leak out of the mouth piece 2016-02-26 10:42:59 NicholasB have you got the coil in? 2016-02-26 10:43:42 NicholasB in the bronzy bit 2016-02-26 10:43:53 fsociety i dont see a bronzy brown thing 2016-02-26 10:44:12 NicholasB it attached to the bottom of the tank 2016-02-26 10:44:43 NicholasB mouth piece / tank / broze tank base 2016-02-26 10:44:54 fsociety found it 2016-02-26 10:45:06 fsociety and then that screw bit 2016-02-26 10:45:15 fsociety but it would still leak as it still has the hole 2016-02-26 10:46:14 fsociety do i put the juice in through the mouth piece then 2016-02-26 10:46:24 NicholasB if you have the coil in 2016-02-26 10:46:27 NicholasB then it wont 2016-02-26 10:47:43 NicholasB no 2016-02-26 10:47:47 fsociety ahhh 2016-02-26 10:47:55 NicholasB you put the jucie in the base 2016-02-26 10:48:00 NicholasB did you watch the vid? 2016-02-26 10:48:07 fsociety i did 2016-02-26 10:48:16 fsociety still confusing 2016-02-26 10:49:21 fsociety still leaking 2016-02-26 10:49:47 fsociety ugh 2016-02-26 10:51:10 NicholasB where is it leaking from? 2016-02-26 10:53:05 fsociety the other end 2016-02-26 10:53:38 fsociety i dont think there is silicon on the glass tubes 2016-02-26 10:53:48 NicholasB ohh 2016-02-26 10:54:03 NicholasB well roll some silicoln ove the broze base 2016-02-26 10:54:10 NicholasB soor I assumed it was there 2016-02-26 10:54:24 NicholasB just near the thread 2016-02-26 10:54:29 fsociety ill figure it out eventually 2016-02-26 10:55:59 NicholasB check the other clearo it might be set up correctly 2016-02-26 10:56:06 NicholasB s oyou can see 2016-02-26 10:56:24 NicholasB sorry boss. youll get there all the bits are pretty much new 2016-02-26 10:56:53 fsociety found a better one 2016-02-26 10:57:00 fsociety much easier to follow, no videos.. just images 2016-02-26 10:57:06 NicholasB cool 2016-02-26 10:57:10 NicholasB I sent you three didn't i 2016-02-26 10:57:15 NicholasB ohhh 2016-02-26 10:57:20 NicholasB guide you mean 2016-02-26 10:59:25 fsociety i seem to be missing the head, the longer rounder bit 2016-02-26 10:59:26 fsociety http://cdn.shopify.com/s/files/1/0096/9352/files/MG_0472_large.jpg?437 2016-02-26 11:00:11 NicholasB that's the coil 2016-02-26 11:00:17 NicholasB wait 2016-02-26 11:00:22 NicholasB which part 2016-02-26 11:00:32 NicholasB at the very top off the picture 2016-02-26 11:00:41 NicholasB the little knob 2016-02-26 11:01:04 fsociety the bit the hand has the fingers on 2016-02-26 11:01:21 NicholasB well that's a differth tank 2016-02-26 11:01:32 fsociety oh 2016-02-26 11:01:33 NicholasB yours is the brownish bit 2016-02-26 11:01:37 fsociety then i have no clue 2016-02-26 11:01:49 NicholasB tahts a pro tank you have a protank mini 2016-02-26 11:01:57 fsociety tbh dude either im colour blind but i dont see a brown bit 2016-02-26 11:02:21 NicholasB I wish I could draw 2016-02-26 11:02:23 NicholasB wait 2016-02-26 11:02:54 NicholasB it might be dark grey 2016-02-26 11:03:04 NicholasB I always thought it was brownish 2016-02-26 11:05:58 NicholasB <br><img id="4"> 2016-02-26 11:06:22 NicholasB Screw the thing on the right in to the brownish thing in the middle. 2016-02-26 11:06:40 NicholasB Fill the tank up from the open bottle 2016-02-26 11:06:56 NicholasB Screw the brown bit with the coil in to the tank. 2016-02-26 11:07:04 fsociety send me the url 2016-02-26 11:07:45 NicholasB http://cdn.smokersexit.com/content/images/thumbs/0000337_kangertech-mini-protank-ii-clear-clearomizer-kit.jpeg 2016-02-26 11:08:16 NicholasB if you middle bit doest have silicon 2016-02-26 11:08:20 NicholasB stick on on 2016-02-26 11:08:23 NicholasB *one 2016-02-26 11:08:59 fsociety is the silicon the bits on the coil or the glass tubey bit 2016-02-26 11:09:20 NicholasB on the brow meatl base bit 2016-02-26 11:09:49 NicholasB you can see it in the photo 2016-02-26 11:10:15 fsociety thats a dark grey ;) 2016-02-26 11:10:34 NicholasB ehhh it the only dark thing in the whole kit 2016-02-26 11:10:43 NicholasB its a bit bronzey 2016-02-26 11:12:13 fsociety silicon on 2016-02-26 11:12:24 fsociety only had one that size.. lucky 2016-02-26 11:12:32 fsociety lots of tiny ones but only one the right size 2016-02-26 11:12:40 NicholasB oh really there should be more. 2016-02-26 11:12:53 fsociety lots of tinyer ones 2016-02-26 11:13:05 fsociety anyway 2016-02-26 11:13:07 fsociety so coil 2016-02-26 11:13:15 NicholasB oh well the tiny one will word if yo stretch them. its the smallest tank you can buy so tnhey wont be for any other tank 2016-02-26 11:13:20 NicholasB yeah 2016-02-26 11:13:28 NicholasB just screw it in to the base 2016-02-26 11:13:43 fsociety so pick it put and go from underneath 2016-02-26 11:14:11 NicholasB ? to fill it? 2016-02-26 11:14:23 fsociety no put the coil intho the base 2016-02-26 11:14:27 fsociety is that what im doing 2016-02-26 11:14:32 fsociety not the tank 2016-02-26 11:14:36 NicholasB yeah 2016-02-26 11:14:48 NicholasB not the tank 2016-02-26 11:15:08 NicholasB it will fit in the tank after you put the coil in the base and put juice in the tank 2016-02-26 11:16:54 NicholasB http://www.itsvaping.com.au/pages/how-to-fill-the-kanger-mini-protank-2 2016-02-26 11:26:22 NicholasB worked it? 2016-02-26 11:30:27 fsociety figured it out eventually 2016-02-26 11:30:35 NicholasB yay! 2016-02-26 11:30:38 fsociety now to test it 2016-02-26 11:30:39 NicholasB sorry 2016-02-26 11:30:47 NicholasB description in text are hard 2016-02-26 11:30:49 fsociety all good 2016-02-26 11:30:56 NicholasB start on a low voltage 2016-02-26 11:31:14 NicholasB and move up (there is a voltage wheel on the base of the battery 2016-02-26 11:31:34 NicholasB and let the juice soak in for a minute or two 2016-02-26 11:31:39 NicholasB before you start 2016-02-26 11:31:57 fsociety umm so where does that go 2016-02-26 11:32:13 NicholasB the battery? 2016-02-26 11:32:35 NicholasB or the juice 2016-02-26 11:32:37 fsociety i dont see no noltage switch 2016-02-26 11:32:47 NicholasB its not a switch 2016-02-26 11:32:48 fsociety let alone to plug in the charger 2016-02-26 11:32:54 NicholasB the base of the battery twists 2016-02-26 11:33:15 NicholasB the chargec screw to the top 2016-02-26 11:33:51 NicholasB but it has some charge I think 2016-02-26 11:34:29 fsociety does it charge in the top before you put the tank in it 2016-02-26 11:34:49 NicholasB yeah you take the tank off to charge it 2016-02-26 11:35:58 NicholasB http://www.bestecig.com/help.asp?id=85 2016-02-26 11:39:31 fsociety finally 2016-02-26 11:39:33 fsociety FINALLY 2016-02-26 11:39:34 fsociety it worked 2016-02-26 11:39:40 fsociety umm. is this nicotine juice 2016-02-26 11:39:42 NicholasB hahaha 2016-02-26 11:39:45 NicholasB yup 2016-02-26 11:39:50 fsociety excellent i thought it was 2016-02-26 11:40:08 fsociety now i have that nictone buzz, i dont get off cigarettes 2016-02-26 11:40:09 NicholasB though two are 6mg 2016-02-26 11:40:11 NicholasB one is 12 2016-02-26 11:40:29 fsociety yeah i put in the 12 2016-02-26 11:40:34 fsociety explains my nicotine buzz 2016-02-26 11:40:42 fsociety i usually only smoke 8s 2016-02-26 11:40:45 NicholasB after a while (like 5 dayo to a week) 2016-02-26 11:40:53 NicholasB replace the coil 2016-02-26 11:41:03 fsociety wears out quickly hey 2016-02-26 11:41:13 NicholasB 12mg is close to an 8 in a cigarrete as far as absorbion goes 2016-02-26 11:41:36 NicholasB the coils? yeah but ther are cheap 2016-02-26 11:41:44 NicholasB 5ish bucks for a packet 2016-02-26 12:00:10 fsociety ahh thats pretty cheap 2016-02-26 12:00:31 fsociety had to put it up pretty high to begin with to deal with going from cigarettes to these though 2016-02-26 12:00:49 fsociety i'd imagine i could drop it down after a week or so.. when those cigarettes urges slowly disappear 2016-02-26 12:06:14 NicholasB Do what Dan did. Smoke vape in the day. Cigs at noght 2016-02-26 12:06:28 NicholasB And after a week or two you'll be off the cigs 2016-02-26 12:06:55 fsociety ahhhh 2016-02-26 12:06:59 fsociety is that how it roles 2016-02-26 12:09:04 NicholasB It's a common train of action. 2016-02-26 12:10:01 fsociety seems fair enough. i shall see how i go 2016-02-26 13:02:09 NicholasB what flavour did you go with first 2016-02-27 10:46:51 - irc: disconnected from server 2016-03-04 12:38:19 NicholasB hey boss 2016-03-04 12:38:30 NicholasB im moving to some diffent juices etg. 2016-03-04 12:38:45 NicholasB yau want i off load some morevape stuff? 2016-03-07 12:35:55 NicholasB cool 2016-03-07 12:36:06 NicholasB ill send them sometime this week 2016-03-07 12:36:13 NicholasB with some heads and more coils 2016-03-07 12:36:31 NicholasB if i find some of my old batteries ill chuck em in as well 2016-03-07 13:04:00 fsociety haha you are too kind 2016-03-07 13:04:00 - [NicholasB] is away: Mobile 2016-03-07 19:16:50 - irc: disconnected from server
IRC log
0
0x4b1dN/2016-dots
misc/weechat/logs/irc.bitlbee.nicholasb.weechatlog
[ "MIT" ]
#%RAML 0.8 --- title: Starhackit baseUri: http://localhost:8080/api/v1 version: v1 mediaType: application/json protocols: [ HTTP, HTTPS ] documentation: - title: User REST API content: 'User REST API documentation' traits: !include traits.raml /auth: /login: description: 'Authenticate with the given username/email and password' post: body: application/json: schema: !include login/login.in.schema.json example: !include login/login.in.sample.json responses: 200: body: schema: !include login/login.out.schema.json example: !include login/login.out.sample.json 401: description: 'Unauthorized' body: schema: !include error.schema.json example: !include login/login.error.sample.json /logout: description: Logout post: responses: 200: body: example: !include success.out.json /register: description: Request the creation of a new account. post: body: application/json: schema: !include register/register.in.schema.json example: !include register/register.in.sample.json responses: 200: body: example: !include success.out.json 422: body: schema: !include error.schema.json example: !include register/register.error.sample.json /verify_email_code: description: Verify the code that was sent by email during the account registration. post: body: application/json: schema: !include verifyEmailCode/verifyEmailCode.in.schema.json example: !include verifyEmailCode/verifyEmailCode.in.sample.json responses: 200: body: example: !include success.out.json /reset_password: description: Start a request to reset the password. post: body: application/json: schema: !include resetPassword/resetPassword.in.schema.json example: !include resetPassword/resetPassword.in.sample.json responses: 200: body: example: !include success.out.json /verify_reset_password_token: description: Verify the reset password token. post: body: application/json: schema: !include verifyResetPasswordToken/verifyResetPasswordToken.in.schema.json example: !include verifyResetPasswordToken/verifyResetPasswordToken.in.sample.json responses: 200: body: example: !include success.out.json 422: body: schema: !include error.schema.json example: !include verifyResetPasswordToken/verifyResetPasswordToken.error.sample.json /me: description: Get information about the current authenticated user get: responses: 200: body: schema: !include user.out.schema.json example: !include user.out.sample.json patch: responses: 204: body: schema: !include user.out.schema.json example: !include user.out.sample.json /users: description: Get all users get: is: [ searchable: {description: "with valid searchable fields: firtName", example: "[\"firtName\", \"marco\", \"like\"]"}, orderable: {fieldsList: "lastName"}, pageable ] responses: 200: body: example: !include users.out.sample.json /{userId}: description: Get one user get: responses: 200: body: schema: !include user.out.schema.json example: !include user.out.sample.json
RAML
4
surumen/msoma.org
server/src/plugins/users/raml/users.raml
[ "Unlicense" ]
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. * You can obtain one at http://mozilla.org/MPL/2.0/. * * Source: https://streams.spec.whatwg.org/#readablestreamdefaultreader */ [Exposed=(Window,Worker,Worklet)] interface ReadableStreamBYOBReader { constructor(ReadableStream stream); Promise<ReadableStreamBYOBReadResult> read(ArrayBufferView view); undefined releaseLock(); }; ReadableStreamBYOBReader includes ReadableStreamGenericReader; dictionary ReadableStreamBYOBReadResult { ArrayBufferView value; boolean done; };
WebIDL
3
dkozma/wasm-bindgen
crates/web-sys/webidls/unstable/ReadableStreamBYOBReader.webidl
[ "Apache-2.0", "MIT" ]
LITHO,CANAL,CODIGO 002357,C,000283 002401,A,000027 002400,B,000046 002353,C,000316 002454,A,000351 002459,A,000037 002399,A,000262 002342,A,000052 002354,C,000329 002349,A,000118 002348,C,000177 002347,B,000059 002355,A,000183 002463,C,000206 002356,C,000352 002461,B,000309 002351,C,000117 002352,C,000273 002453,C,000311 002343,B,000307 002344,C,000151 002350,A,000287 002467,A,000291 002462,A,000281 002464,A,000356 002468,A,000147 002465,A,000296 002456,C,000203 002466,A,000264 002458,C,000327 002457,A,000192 002345,A,000004 002358,C,000286 002402,C,000144 002359,A,000010 002346,A,000197 002455,A,000358
IDL
1
plandauro/admision
storage/calificacioncepre/2019-IIhojaidentificacion_PE03.dlm
[ "MIT" ]
import { Col, Row } from '@freecodecamp/react-bootstrap'; import React from 'react'; import { useTranslation } from 'react-i18next'; import { AsSeenInText } from '../../../assets/images/components'; const AsSeenIn = (): JSX.Element => { const { t } = useTranslation(); return ( <Row className='as-seen-in'> <Col sm={8} smOffset={2} xs={12}> <div className='text-center'> <p className='big-heading'>{t('landing.as-seen-in')}</p> <AsSeenInText fill='light' /> </div> </Col> </Row> ); }; AsSeenIn.displayName = 'AsSeenIn'; export default AsSeenIn;
TypeScript
4
fcastillo-serempre/freeCodeCamp
client/src/components/landing/components/as-seen-in.tsx
[ "BSD-3-Clause" ]
#!/usr/bin/env bash # Copyright 2018 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. set -o errexit set -o nounset set -o pipefail run_template_output_tests() { set -o nounset set -o errexit kube::log::status "Testing --template support on commands" ### Test global request timeout option # Pre-condition: no POD exists create_and_use_new_namespace kube::test::get_object_assert pods "{{range.items}}{{${id_field:?}}}:{{end}}" '' # Command # check that create supports --template output kubectl create "${kube_flags[@]:?}" -f test/fixtures/doc-yaml/admin/limitrange/valid-pod.yaml # Post-condition: valid-pod POD is created kubectl get "${kube_flags[@]:?}" pods -o json kube::test::get_object_assert pods "{{range.items}}{{${id_field:?}}}:{{end}}" 'valid-pod:' # check that patch command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" patch --dry-run=client pods/valid-pod -p '{"patched":"value3"}' --type=merge --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'valid-pod:' # check that label command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" label --dry-run=client pods/valid-pod label=value --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'valid-pod:' # check that annotate command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" annotate --dry-run=client pods/valid-pod annotation=value --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'valid-pod:' # check that apply command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" apply --dry-run=client -f test/fixtures/doc-yaml/admin/limitrange/valid-pod.yaml --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'valid-pod:' # check that create command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" create -f test/fixtures/doc-yaml/admin/limitrange/valid-pod.yaml --dry-run=client --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'valid-pod:' # check that autoscale command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" autoscale --max=2 -f hack/testdata/scale-deploy-1.yaml --dry-run=client --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'scale-1:' # check that expose command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" expose -f hack/testdata/redis-slave-replicaset.yaml --save-config --port=80 --target-port=8000 --dry-run=client --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'redis-slave:' # check that run command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" run --dry-run=client --template="{{ .metadata.name }}:" pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)') kube::test::if_has_string "${output_message}" 'pi:' # check that taint command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" taint node 127.0.0.1 dedicated=foo:PreferNoSchedule --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" '127.0.0.1:' # untaint node kubectl taint node 127.0.0.1 dedicated- # check that "apply set-last-applied" command supports --template output kubectl "${kube_flags[@]:?}" create -f test/e2e/testing-manifests/statefulset/cassandra/controller.yaml output_message=$(kubectl "${kube_flags[@]:?}" apply set-last-applied -f test/e2e/testing-manifests/statefulset/cassandra/controller.yaml --dry-run=client --create-annotation --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'cassandra:' # check that "auth reconcile" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" auth reconcile --dry-run=client -f test/fixtures/pkg/kubectl/cmd/auth/rbac-resource-plus.yaml --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'testing-CR:testing-CRB:testing-RB:testing-R:' # check that "create clusterrole" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" create clusterrole --template="{{ .metadata.name }}:" --verb get myclusterrole --non-resource-url /logs/ --resource pods) kube::test::if_has_string "${output_message}" 'myclusterrole:' # check that "create clusterrolebinding" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" create clusterrolebinding foo --clusterrole=myclusterrole --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'foo:' # check that "create configmap" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" create configmap cm --dry-run=client --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'cm:' # check that "create deployment" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" create deployment deploy --image=nginx --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'deploy:' # check that "create job" command supports --template output kubectl create "${kube_flags[@]:?}" -f - <<EOF apiVersion: batch/v1 kind: CronJob metadata: name: pi spec: schedule: "*/10 * * * *" jobTemplate: spec: template: metadata: labels: parent: "pi" spec: containers: - name: pi image: perl command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"] restartPolicy: OnFailure EOF output_message=$(kubectl "${kube_flags[@]:?}" create job foo --from=cronjob/pi --dry-run=client --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'foo:' # check that "create namespace" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" create ns bar --dry-run=client --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'bar:' # check that "create namespace" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" create rolebinding foo --clusterrole=myclusterrole --dry-run=client --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'foo:' # check that "create role" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" create role --dry-run=client --template="{{ .metadata.name }}:" --verb get myrole --resource pods) kube::test::if_has_string "${output_message}" 'myrole:' # check that "create quota" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" create quota foo --dry-run=client --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'foo:' # check that "create priorityclass" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" create priorityclass foo --dry-run=client --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'foo:' # check that "create poddisruptionbudget" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" create poddisruptionbudget foo --dry-run=client --selector=foo --min-available=1 --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'foo:' # check that "create serviceaccount" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" create serviceaccount foo --dry-run=client --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'foo:' # check that "set env" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" set env pod/valid-pod --dry-run=client A=B --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'valid-pod:' # check that "set image" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" set image pod/valid-pod --dry-run=client kubernetes-serve-hostname=nginx --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'valid-pod:' # check that "set resources" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" set resources pod/valid-pod --limits=memory=256Mi --dry-run=client --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'valid-pod:' # check that "set selector" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" set selector -f hack/testdata/kubernetes-service.yaml A=B --local --dry-run=client --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'kubernetes:' # check that "set serviceaccount" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" set serviceaccount pod/valid-pod deployer --dry-run=client --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'valid-pod:' # check that "set subject" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" set subject clusterrolebinding/foo --user=foo --dry-run=client --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'foo:' # check that "create secret docker-registry" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" create secret docker-registry foo --docker-username user --docker-password pass --docker-email [email protected] --dry-run=client --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'foo:' # check that "create secret generic" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" create secret generic foo --from-literal=key1=value1 --dry-run=client --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'foo:' # check that "create secret tls" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" create secret tls --dry-run=client foo --key=hack/testdata/tls.key --cert=hack/testdata/tls.crt --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'foo:' # check that "create service clusterip" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" create service clusterip foo --dry-run=client --tcp=8080 --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'foo:' # check that "create service externalname" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" create service externalname foo --dry-run=client --external-name=bar --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'foo:' # check that "create service loadbalancer" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" create service loadbalancer foo --dry-run=client --tcp=8080 --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'foo:' # check that "create service nodeport" command supports --template output output_message=$(kubectl "${kube_flags[@]:?}" create service nodeport foo --dry-run=client --tcp=8080 --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'foo:' # check that "config view" ouputs "yaml" as its default output format output_message=$(kubectl "${kube_flags[@]:?}" config view) kube::test::if_has_string "${output_message}" 'kind: Config' # check that "rollout pause" supports --template output output_message=$(kubectl "${kube_flags[@]:?}" rollout pause deploy/deploy --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'deploy:' # check that "rollout history" supports --template output output_message=$(kubectl "${kube_flags[@]:?}" rollout history deploy/deploy --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'deploy:' # check that "rollout resume" supports --template output output_message=$(kubectl "${kube_flags[@]:?}" rollout resume deploy/deploy --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'deploy:' # check that "rollout undo" supports --template output output_message=$(kubectl "${kube_flags[@]:?}" rollout undo deploy/deploy --to-revision=1 --template="{{ .metadata.name }}:") kube::test::if_has_string "${output_message}" 'deploy:' # check that "config view" command supports --template output # and that commands that set a default output (yaml in this case), # default to "go-template" as their output format when a --template # value is provided, but no explicit --output format is given. output_message=$(kubectl "${kube_flags[@]:?}" config view --template="{{ .kind }}:") kube::test::if_has_string "${output_message}" 'Config' # check that running a command with both a --template flag and a # non-template --output prefers the non-template output value output_message=$(kubectl "${kube_flags[@]:?}" create configmap cm --dry-run=client --template="{{ .metadata.name }}:" --output yaml) kube::test::if_has_string "${output_message}" 'kind: ConfigMap' # cleanup kubectl delete cronjob pi "${kube_flags[@]:?}" kubectl delete pods --all "${kube_flags[@]:?}" kubectl delete rc cassandra "${kube_flags[@]:?}" kubectl delete clusterrole myclusterrole "${kube_flags[@]:?}" kubectl delete clusterrolebinding foo "${kube_flags[@]:?}" kubectl delete deployment deploy "${kube_flags[@]:?}" set +o nounset set +o errexit }
Shell
5
767829413/kubernetes
test/cmd/template-output.sh
[ "Apache-2.0" ]
- // MIR for `main` before Inline + // MIR for `main` after Inline fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:16:11: 16:11 let _1: (); // in scope 0 at $DIR/cycle.rs:17:5: 17:9 bb0: { StorageLive(_1); // scope 0 at $DIR/cycle.rs:17:5: 17:9 _1 = f::<fn() {g}>(g) -> bb1; // scope 0 at $DIR/cycle.rs:17:5: 17:9 // mir::Constant // + span: $DIR/cycle.rs:17:5: 17:6 // + literal: Const { ty: fn(fn() {g}) {f::<fn() {g}>}, val: Value(Scalar(<ZST>)) } // mir::Constant // + span: $DIR/cycle.rs:17:7: 17:8 // + literal: Const { ty: fn() {g}, val: Value(Scalar(<ZST>)) } } bb1: { StorageDead(_1); // scope 0 at $DIR/cycle.rs:17:9: 17:10 _0 = const (); // scope 0 at $DIR/cycle.rs:16:11: 18:2 return; // scope 0 at $DIR/cycle.rs:18:2: 18:2 } }
Diff
2
mbc-git/rust
src/test/mir-opt/inline/cycle.main.Inline.diff
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
<div class="hidden"> \begin{code} main = putStrLn "Easter Egg: to force Makefile" \end{code} </div> LiquidHaskell ============== Refinement Types for Haskell ------------------------------ <br> <br> <div class="fragment"> **Ranjit Jhala** University of California, San Diego <br> <br> Joint work with: N. Vazou, E. Seidel, P. Rondon, M. Kawaguchi D. Vytiniotis, S. Peyton-Jones </div> {#plan} ------- **Part I** Refinement Types <br> <div class="fragment"> **Part II** Case Studies </div> <br> <div class="fragment"> **Part III** Haskell (Lazy Evaluation) </div> {#plan} -------- <br> (And *if* we have time...) <br> **Part IV** Abstract Refinements I: Refinement Types ------------------- <br> <a href="00_Motivation.lhs.slides.html" target="_blank">**Motivation**</a> <br> <div class="fragment"> <a href="01_SimpleRefinements.lhs.slides.html" target="_blank">**Refinements**</a> </div> <br> <div class="fragment"> <a href="02_Measures.lhs.slides.html" target= "_blank">**Measures**</a> </div> II: Case Studies ---------------- <br> <a href="13_RedBlack.lhs.slides.html" target="_blank">**Red-Black Trees**</a> <br> <a href="14_Memory.lhs.slides.html" target="_blank">**Low-level Memory Safety**</a> III: Haskell ------------ <br> <a href="09_Laziness.lhs.slides.html" target="_blank">**Lazy Evaluation**</a> <br> <div class="fragment"> <a href="10_Termination.lhs.slides.html" target="_blank">**Termination**</a> </div> <br> <div class="fragment"> <a href="11_Evaluation.lhs.slides.html" target="_blank">**Evaluation**</a> </div> IV: Abstract Refinements ------------------------ <br> <a href="04_AbstractRefinements.lhs.slides.html" target= "_blank">**Abstracting Refinements over Types**</a> <br> <div class="fragment"> **Demos** <br> + [Basic](../hs/02_AbstractRefinements.hs) + [Induction](../hs/02_AbstractRefinements.hs) + [Recursion](../hs/02_AbstractRefinements.hs) + [Key-Value](../hs/02_AbstractRefinements.hs) </div> Conclusion ---------- <br> <br> <br> <div class="fragment"> <a href="12_Conclusion.lhs.slides.html" target="_blank">[Continue]</a> </div>
Literate Haskell
1
curiousleo/liquidhaskell
docs/slides/BOS14/lhs/Index-Boston-Haskell.lhs
[ "MIT", "BSD-3-Clause" ]
#pragma once #include "caffe2/core/logging.h" #include "caffe2/predictor/emulator/emulator.h" #include "caffe2/predictor/emulator/output_formatter.h" #include "caffe2/predictor/emulator/profiler.h" C10_DECLARE_int(warmup); C10_DECLARE_int(iter); C10_DECLARE_int(threads); C10_DECLARE_int(runs); C10_DECLARE_string(run_net); C10_DECLARE_string(init_net); C10_DECLARE_string(data_net); C10_DECLARE_string(input_dims); C10_DECLARE_string(input_types); namespace caffe2 { namespace emulator { struct BenchmarkParam { std::unique_ptr<Profiler> profiler; std::unique_ptr<Emulator> emulator; std::unique_ptr<OutputFormatter> formatter; }; /* * benchmark runner takes an @emulator to run nets. * The runtime will be measured by @profiler. * The output will be formatted by @formatter */ class BenchmarkRunner { public: void benchmark(const BenchmarkParam& param); virtual ~BenchmarkRunner() noexcept {} protected: virtual void pre_benchmark_setup() {} virtual void post_benchmark_cleanup() {} }; } // namespace emulator } // namespace caffe2
C
4
Hacky-DH/pytorch
caffe2/predictor/emulator/benchmark.h
[ "Intel" ]
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports Microsoft.CodeAnalysis.Editor.VisualBasic.KeywordHighlighting Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.KeywordHighlighting Public Class WithBlockHighlighterTests Inherits AbstractVisualBasicKeywordHighlighterTests Friend Overrides Function GetHighlighterType() As Type Return GetType(WithBlockHighlighter) End Function <Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)> Public Async Function TestWithBlock1() As Task Await TestAsync(<Text> Class C Sub M() {|Cursor:[|With|]|} y .x = 10 Console.WriteLine(.x) [|End With|] End Sub End Class</Text>) End Function <Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)> Public Async Function TestWithBlock2() As Task Await TestAsync(<Text> Class C Sub M() [|With|] y .x = 10 Console.WriteLine(.x) {|Cursor:[|End With|]|} End Sub End Class</Text>) End Function End Class End Namespace
Visual Basic
3
ffMathy/roslyn
src/EditorFeatures/VisualBasicTest/KeywordHighlighting/WithBlockHighlighterTests.vb
[ "MIT" ]
%p Hello, World!
Scaml
0
JavascriptID/sourcerer-app
src/test/resources/samples/langs/Scaml/hello.scaml
[ "MIT" ]
h2. RequireJS endprologue. h3. RequireJS modules explained We use "RequireJS":http://requirejs.org to manage JavaScript dependencies, that's why some basic understanding is very helpful. By using RequireJS, we gain some nice benefits: First, we the dependency management between JavaScript files is done for us, meaning they are included in the correct order. The basic element of RequireJS is a so called +module+ which is one file that defines and exports a JavaScript object. This reference can be used in other modules by *requiring* that module. NOTE: A module does not need to define its own name, it is simply named by its location on the file system. Modules are created using +define(dependencies, callback)+, where the first parameter @dependencies@ is an array of other RequireJS modules this plugin needs in order to function properly. The second parameter is @callback@ is a function which is executed *as soon as all dependencies are loaded*. The first dependency is passed to the @callback@ as first parameter, the second dependency as the second, and so on. NOTE: Circular dependencies need some special treatment. It is most often a sign of bad code, but if you need to do this, follow the "guide at the RequireJS website":http://requirejs.org/docs/api.html#circular. You may use modules by requireing them if you specified the dependency you may use: <javascript> var module = require( 'module' ); </javascript> If you want to load a module dynamically without defining a dependency you may use: <javascript> // note the array! require( ['module'], function( module ) { // module available here }); </javascript> h3. Using require You may user require to define modules as well as requiring dynamically other modules. To define a module you need to define it with its dependencies and a callback function. The callback function gets the defined modules as parameters in order you defined them. <javascript filename="myplugin/lib/module.js"> define( [ 'dependendmodule1', 'dependendmodule2' ], function( dependendmodule1, dependendmodule2 ) { "use strict"; // you can use dependendmodule1, dependendmodule2 here. // both are loaded. return {}; }); </javascript> You do not need to define all parameter of the callback function but +require+ the module as needed. In order to not interfere with other modules we require all Aloha Editor modules in the +aloha+ context. The configuration is available in +Aloha.settings.requireConf+. The method +Aloha.require()+ is a shorthand to require with the Aloha Editor configuration and additionally gives you the +Aloha+ object an argument if you pass only a callback function or as return if you pass no argument at all. <javascript filename="myplugin/lib/module.js"> define( [ 'dependendmodule1', 'dependendmodule2' ], function() { "use strict"; var Aloha = Aloha.require(), dependendmodule1 = require( Aloha.settings.requireConf, 'dependendmodule1' ), dependendmodule2 = Aloha.require( 'dependendmodule2' ); // shorthand to the above Aloha.require( function( localAloha ) { // localAloha is available here }; return {}; }); </javascript> You may also require module or Aloha itself on demand <javascript filename="someJS.js"> ( function() { "use strict"; Aloha.require( function( Aloha ) { // localAloha is available here // but not neccessarily fully initialized Aloha.jQuery('body').bind('aloha', function() { // Aloha is initialized here }); }); Aloha.require( ['dependendmodule1'], function( dependendmodule1 ) { // dependendmodule1 is available here }; return {}; }); </javascript> h3. Aloha plugins and their dependencies In the following example, we define a components plugin with two modules. The first module @componenttype@ defines two classes. The second module @component@ has a dependency to @componenttype@, and RequireJS injects what has been returned by @componenttype@. The plugin requires the module +aloha/plugin+ which gives you the plugin factory method +create()+ <javascript filename="plugin1/lib/plugin1-plugin.js"> define( [ 'aloha/plugin' ], function( plugin ) { "use strict"; // we do nothing but provide component modules... return plugin.create( 'plugin1', {}); }); </javascript> The +componenttye+ has no dependency thus the dependency array is empty. <javascript filename="plugin1/lib/abstractmodule.js"> define( [], // no dependency function() { "use strict"; var abstractModule = Class.extend({ doOther: function() { return 'didOther'; } }); return abstractModule; }); </javascript> The +component+ depends on the local module +componenttype+ and defines its dependency. <javascript filename="plugin1/lib/module.js"> define( ['./abstractmodule'], // dependency in the same path function( abstractModule ) { "use strict"; var module = abstractModule.extend({ doSome: function() { return 'didSome'; } }); return new module(); }); </javascript> h4. Cross plugin dependencies If we want to use cross plugin modules you should not define a dependency on +plugin1/module+ from plugin1 because that would hinder your plugin from working, because of the unfullfilled dependency. Instead require the module in your code with a +Aloha.require()+ and extend the module with our own function when plugin2 is loaded. If another plugin would require +plugin1/module+ it would have our extended functionality. <javascript filename="plugin2/lib/plugin2-plugin.js"> define( [ 'aloha/plugin' ], function( plugin, module ) { "use strict"; // now we require the the modue of plugin1 Aloha.require( [ 'plugin1/module' ], function( module ) } // module is available here module.doThis = function() { return 'didThis'; }; }); // we do nothing but provide component modules... return plugin.create( 'plugin2', {}); }); </javascript> h3. Aloha require path mapping for plugins So, at which place does Aloha look up modules? We'll explain this with a few examples: |_. Definition in RequireJS |_. File Name | | @myplugin/foo@ | @path_to_bundle/myplugin/lib/foo.js@ <br /> Including other RequireJS modules is the most common case | | @myplugin/vendor/legacy_lib@ | @path_to_bundle/myplugin/vendor/legacy_lib.js@ <br /> Include a legacy library | | @css!myplugin/css/cssfile.css@ | @path_to_bundle/myplugin/css/cssfile.css@ <br /> Includes the CSS file in the document @<head>@. | | @i18n!myplugin/nls/i18n.js@ | uses +Aloha.settings.locale+ or tries to detect the language from the browser. | | @text!myplugin/res/template.html@ | Load the content of a text file (e.g. templates). | NOTE: The bundle name is not part of the RequireJS definition, as this is installation-specific. You as plugin developer should not care about where other plugins are located on disk. h3. Changelog * July 3, 2011: Initial version by "Sebastian Kurfürst":credits.html#skurfuerst and "Christopher Hlubek":credits.html#hlubek
Textile
4
luciany/Aloha-Editor
doc/guides/source/require.textile
[ "CC-BY-3.0" ]
; **************************************************************************** ; * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. * ; * Copyright (C) 2012 Alon Bar-Lev <[email protected]> * ; * This program is free software; you can redistribute it and/or modify * ; * it under the terms of the GNU General Public License version 2 * ; * as published by the Free Software Foundation. * ; **************************************************************************** ; TAP-Windows install script for Windows, using NSIS SetCompressor /SOLID lzma !addplugindir . !include "MUI.nsh" !include "StrFunc.nsh" !include "x64.nsh" !define MULTIUSER_EXECUTIONLEVEL Admin !include "MultiUser.nsh" !include FileFunc.nsh !insertmacro GetParameters !insertmacro GetOptions ${StrLoc} ;-------------------------------- ;Configuration ;General OutFile "${OUTPUT}" ShowInstDetails show ShowUninstDetails show ;Remember install folder InstallDirRegKey HKLM "SOFTWARE\${PRODUCT_NAME}" "" ;-------------------------------- ;Modern UI Configuration Name "${PRODUCT_NAME} ${PRODUCT_VERSION}-I${PRODUCT_TAP_WIN_BUILD}" !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of ${PRODUCT_NAME}, a kernel driver to provide virtual tap device functionality on Windows originally written by James Yonan.\r\n\r\nNote that ${PRODUCT_NAME} will only run on Windows Vista or later.\r\n\r\n\r\n" !define MUI_COMPONENTSPAGE_TEXT_TOP "Select the components to install/upgrade. Stop any ${PRODUCT_NAME} processes or the ${PRODUCT_NAME} service if it is running. All DLLs are installed locally." !define MUI_COMPONENTSPAGE_SMALLDESC !define MUI_FINISHPAGE_NOAUTOCLOSE !define MUI_ABORTWARNING !define MUI_ICON "icon.ico" !define MUI_UNICON "icon.ico" !define MUI_HEADERIMAGE !define MUI_HEADERIMAGE_BITMAP "install-whirl.bmp" !define MUI_UNFINISHPAGE_NOAUTOCLOSE !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "${IMAGE}\license.txt" !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH ;-------------------------------- ;Languages !insertmacro MUI_LANGUAGE "English" ;-------------------------------- ;Language Strings LangString DESC_SecTAP ${LANG_ENGLISH} "Install/Upgrade the TAP virtual device driver. Will not interfere with CIPE." LangString DESC_SecTAPUtilities ${LANG_ENGLISH} "Install the TAP Utilities." LangString DESC_SecTAPSDK ${LANG_ENGLISH} "Install the TAP SDK." ;-------------------------------- ;Reserve Files ;Things that need to be extracted on first (keep these lines before any File command!) ;Only useful for BZIP2 compression ReserveFile "install-whirl.bmp" ;-------------------------------- ;Macros !macro SelectByParameter SECT PARAMETER DEFAULT ${GetOptions} $R0 "/${PARAMETER}=" $0 ${If} ${DEFAULT} == 0 ${If} $0 == 1 !insertmacro SelectSection ${SECT} ${EndIf} ${Else} ${If} $0 != 0 !insertmacro SelectSection ${SECT} ${EndIf} ${EndIf} !macroend ;-------------------------------- ;Installer Sections Section /o "TAP Virtual Ethernet Adapter" SecTAP SetOverwrite on ${If} ${RunningX64} DetailPrint "We are running on a 64-bit system." SetOutPath "$INSTDIR\bin" File "${DEVCON64}" SetOutPath "$INSTDIR\driver" File "${IMAGE}\amd64\OemVista.inf" File "${IMAGE}\amd64\${PRODUCT_TAP_WIN_COMPONENT_ID}.cat" File "${IMAGE}\amd64\${PRODUCT_TAP_WIN_COMPONENT_ID}.sys" ${Else} DetailPrint "We are running on a 32-bit system." SetOutPath "$INSTDIR\bin" File "${DEVCON32}" SetOutPath "$INSTDIR\driver" File "${IMAGE}\i386\OemVista.inf" File "${IMAGE}\i386\${PRODUCT_TAP_WIN_COMPONENT_ID}.cat" File "${IMAGE}\i386\${PRODUCT_TAP_WIN_COMPONENT_ID}.sys" ${EndIf} SectionEnd Section /o "TAP Utilities" SecTAPUtilities SetOverwrite on # Delete previous start menu RMDir /r "$SMPROGRAMS\${PRODUCT_NAME}" FileOpen $R0 "$INSTDIR\bin\addtap.bat" w FileWrite $R0 "rem Add a new TAP virtual ethernet adapter$\r$\n" FileWrite $R0 '"$INSTDIR\bin\${DEVCON_BASENAME}" install "$INSTDIR\driver\OemVista.inf" ${PRODUCT_TAP_WIN_COMPONENT_ID}$\r$\n' FileWrite $R0 "pause$\r$\n" FileClose $R0 FileOpen $R0 "$INSTDIR\bin\deltapall.bat" w FileWrite $R0 "echo WARNING: this script will delete ALL TAP virtual adapters (use the device manager to delete adapters one at a time)$\r$\n" FileWrite $R0 "pause$\r$\n" FileWrite $R0 '"$INSTDIR\bin\${DEVCON_BASENAME}" remove ${PRODUCT_TAP_WIN_COMPONENT_ID}$\r$\n' FileWrite $R0 "pause$\r$\n" FileClose $R0 ; Create shortcuts CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Utilities" CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Add a new TAP virtual ethernet adapter.lnk" "$INSTDIR\bin\addtap.bat" "" ; set runas admin flag on the addtap link ShellLink::SetRunAsAdministrator "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Add a new TAP virtual ethernet adapter.lnk" Pop $0 ${If} $0 != 0 DetailPrint "Setting RunAsAdmin flag on addtap failed: status = $0" ${Endif} CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Delete ALL TAP virtual ethernet adapters.lnk" "$INSTDIR\bin\deltapall.bat" "" ; set runas admin flag on the deltapall link ShellLink::SetRunAsAdministrator "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Delete ALL TAP virtual ethernet adapters.lnk" Pop $0 ${If} $0 != 0 DetailPrint "Setting RunAsAdmin flag on deltapall failed: status = $0" ${Endif} SectionEnd Section /o "TAP SDK" SecTAPSDK SetOverwrite on SetOutPath "$INSTDIR\include" File "${IMAGE}\include\tap-windows.h" SectionEnd Function .onInit ${GetParameters} $R0 ClearErrors ${IfNot} ${AtLeastWinVista} MessageBox MB_OK "This package requires at least Windows Vista" SetErrorLevel 1 Quit ${EndIf} !insertmacro SelectByParameter ${SecTAP} SELECT_TAP 1 !insertmacro SelectByParameter ${SecTAPUtilities} SELECT_UTILITIES 0 !insertmacro SelectByParameter ${SecTAPSDK} SELECT_SDK 0 !insertmacro MULTIUSER_INIT SetShellVarContext all ${If} ${RunningX64} SetRegView 64 StrCpy $INSTDIR "$PROGRAMFILES64\${PRODUCT_NAME}" ${Else} StrCpy $INSTDIR "$PROGRAMFILES\${PRODUCT_NAME}" ${EndIf} FunctionEnd ;-------------------------------- ;Dependencies Function .onSelChange ${If} ${SectionIsSelected} ${SecTAPUtilities} !insertmacro SelectSection ${SecTAP} ${EndIf} FunctionEnd ;-------------------- ;Post-install section Section -post ; Store README, license, icon SetOverwrite on SetOutPath $INSTDIR File "${IMAGE}\license.txt" File "icon.ico" ${If} ${SectionIsSelected} ${SecTAP} ; ; install/upgrade TAP driver if selected, using devcon ; ; TAP install/update was selected. ; Should we install or update? ; If tapinstall error occurred, $R5 will ; be nonzero. IntOp $R5 0 & 0 nsExec::ExecToStack '"$INSTDIR\bin\${DEVCON_BASENAME}" hwids ${PRODUCT_TAP_WIN_COMPONENT_ID}' Pop $R0 # return value/error/timeout IntOp $R5 $R5 | $R0 DetailPrint "${DEVCON_BASENAME} hwids returned: $R0" ; If tapinstall output string contains "${PRODUCT_TAP_WIN_COMPONENT_ID}" we assume ; that TAP device has been previously installed, ; therefore we will update, not install. Push "${PRODUCT_TAP_WIN_COMPONENT_ID}" Push ">" Call StrLoc Pop $R0 ${If} $R5 == 0 ${If} $R0 == "" StrCpy $R1 "install" ${Else} StrCpy $R1 "update" ${EndIf} DetailPrint "TAP $R1 (${PRODUCT_TAP_WIN_COMPONENT_ID}) (May require confirmation)" nsExec::ExecToLog '"$INSTDIR\bin\${DEVCON_BASENAME}" $R1 "$INSTDIR\driver\OemVista.inf" ${PRODUCT_TAP_WIN_COMPONENT_ID}' Pop $R0 # return value/error/timeout ${If} $R0 == "" IntOp $R0 0 & 0 SetRebootFlag true DetailPrint "REBOOT flag set" ${EndIf} IntOp $R5 $R5 | $R0 DetailPrint "${DEVCON_BASENAME} returned: $R0" ${EndIf} DetailPrint "${DEVCON_BASENAME} cumulative status: $R5" ${If} $R5 != 0 MessageBox MB_OK "An error occurred installing the TAP device driver." ${EndIf} ; Store install folder in registry WriteRegStr HKLM SOFTWARE\${PRODUCT_NAME} "" $INSTDIR ${EndIf} ; Create uninstaller WriteUninstaller "$INSTDIR\Uninstall.exe" ; Show up in Add/Remove programs WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}" WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" "$INSTDIR\Uninstall.exe" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayIcon" "$INSTDIR\icon.ico" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayVersion" "${PRODUCT_VERSION}" WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "NoModify" 1 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "NoRepair" 1 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "Publisher" "${PRODUCT_PUBLISHER}" WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "HelpLink" "https://openvpn.net/index.php/open-source.html" WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "URLInfoAbout" "https://openvpn.net" ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 IntFmt $0 "0x%08X" $0 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "EstimatedSize" "$0" SectionEnd ;-------------------------------- ;Descriptions !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SecTAP} $(DESC_SecTAP) !insertmacro MUI_DESCRIPTION_TEXT ${SecTAPUtilities} $(DESC_SecTAPUtilities) !insertmacro MUI_DESCRIPTION_TEXT ${SecTAPSDK} $(DESC_SecTAPSDK) !insertmacro MUI_FUNCTION_DESCRIPTION_END ;-------------------------------- ;Uninstaller Section Function un.onInit ClearErrors !insertmacro MULTIUSER_UNINIT SetShellVarContext all ${If} ${RunningX64} SetRegView 64 ${EndIf} FunctionEnd Section "Uninstall" DetailPrint "TAP REMOVE" nsExec::ExecToLog '"$INSTDIR\bin\${DEVCON_BASENAME}" remove ${PRODUCT_TAP_WIN_COMPONENT_ID}' Pop $R0 # return value/error/timeout DetailPrint "${DEVCON_BASENAME} remove returned: $R0" Delete "$INSTDIR\bin\${DEVCON_BASENAME}" Delete "$INSTDIR\bin\addtap.bat" Delete "$INSTDIR\bin\deltapall.bat" Delete "$INSTDIR\driver\OemVista.inf" Delete "$INSTDIR\driver\${PRODUCT_TAP_WIN_COMPONENT_ID}.cat" Delete "$INSTDIR\driver\${PRODUCT_TAP_WIN_COMPONENT_ID}.sys" Delete "$INSTDIR\include\tap-windows.h" Delete "$INSTDIR\icon.ico" Delete "$INSTDIR\license.txt" Delete "$INSTDIR\Uninstall.exe" RMDir "$INSTDIR\bin" RMDir "$INSTDIR\driver" RMDir "$INSTDIR\include" RMDir "$INSTDIR" RMDir /r "$SMPROGRAMS\${PRODUCT_NAME}" DeleteRegKey HKLM "SOFTWARE\${PRODUCT_NAME}" DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" SectionEnd
NSIS
5
LK26/outline-client
third_party/tap-windows6/installer/tap-windows6.nsi
[ "Apache-2.0" ]
#!/usr/bin/env io template := """ <table cellpadding=3 cellspacing=0 border=0> <tr> <td bgcolor=#888888 width=70> <font color=white face="helvetica, arial, sans"> @name@ </td> <td bgcolor=@color@ width=@length@> <font color=white face="helvetica, arial, sans"> <font color=@fontColor@>@time@</font> </td> </tr> </table> """ Io := Object clone Python := Object clone s := File setPath(Path with(System launchPath, "SpeedResults")) asString doString(s) slotNames := list("localAccesses", "localSets", "slotAccesses", "slotSets", "blockActivations", "instantiations") show := method(name, value, color, fontColor, t := template asBuffer t replace("@name@", name) t replace("@time@", value asString(0, 1) ) t replace("@length@", (value * 30) asString(0, 0)) t replace("@color@", color) t replace("@fontColor@", fontColor) write(t, "\n\n") ) slotNames foreach(slot, write("<table cellpadding=0 cellspacing=1 border=0><tr>") write("<td rowspan=2 bgcolor=#888888 width=120><font color=white face=\"helvetica, arial, sans\">&nbsp;&nbsp;", slot, "</td><td>") show("Io", Io getSlot(slot), "#9999cc", "#bbbbee") show("Python", Python getSlot(slot), "#888888", "#aaaaaa") write("</td></tr></table>\n") )
Io
4
akluth/io
samples/speed/speedResults2.io
[ "BSD-3-Clause" ]
;-----------------------------------------------------------------------------; ; Author: HD Moore ; Compatible: Confirmed Windows 7, Windows 2008 Server, Windows XP SP1, Windows SP3, Windows 2000 ; Known Bugs: Incompatible with Windows NT 4.0, buggy on Windows XP Embedded (SP1) ; Version: 1.0 ;-----------------------------------------------------------------------------; [BITS 32] %ifdef ENABLE_SSL %define HTTP_OPEN_FLAGS ( 0x80000000 | 0x04000000 | 0x00400000 | 0x00200000 | 0x00000200 | 0x00800000 | 0x00002000 | 0x00001000 ) ;0x80000000 | ; INTERNET_FLAG_RELOAD ;0x04000000 | ; INTERNET_NO_CACHE_WRITE ;0x00400000 | ; INTERNET_FLAG_KEEP_CONNECTION ;0x00200000 | ; INTERNET_FLAG_NO_AUTO_REDIRECT ;0x00000200 | ; INTERNET_FLAG_NO_UI ;0x00800000 | ; INTERNET_FLAG_SECURE ;0x00002000 | ; INTERNET_FLAG_IGNORE_CERT_DATE_INVALID ;0x00001000 ; INTERNET_FLAG_IGNORE_CERT_CN_INVALID %else %define HTTP_OPEN_FLAGS ( 0x80000000 | 0x04000000 | 0x00400000 | 0x00200000 | 0x00000200 ) ;0x80000000 | ; INTERNET_FLAG_RELOAD ;0x04000000 | ; INTERNET_NO_CACHE_WRITE ;0x00400000 | ; INTERNET_FLAG_KEEP_CONNECTION ;0x00200000 | ; INTERNET_FLAG_NO_AUTO_REDIRECT ;0x00000200 ; INTERNET_FLAG_NO_UI %endif ; Input: EBP must be the address of 'api_call'. ; Output: EDI will be the socket for the connection to the server ; Clobbers: EAX, ESI, EDI, ESP will also be modified (-0x1A0) load_wininet: push 0x0074656e ; Push the bytes 'wininet',0 onto the stack. push 0x696e6977 ; ... push esp ; Push a pointer to the "wininet" string on the stack. push 0x0726774C ; hash( "kernel32.dll", "LoadLibraryA" ) call ebp ; LoadLibraryA( "wininet" ) set_retry: push byte 8 ; retry 8 times should be enough pop edi xor ebx, ebx ; push 8 zeros ([1]-[8]) mov ecx, edi push_zeros: push ebx loop push_zeros internetopen: ; DWORD dwFlags [1] ; LPCTSTR lpszProxyBypass (NULL) [2] ; LPCTSTR lpszProxyName (NULL) [3] ; DWORD dwAccessType (PRECONFIG = 0) [4] ; LPCTSTR lpszAgent (NULL) [5] push 0xA779563A ; hash( "wininet.dll", "InternetOpenA" ) call ebp internetconnect: ; DWORD_PTR dwContext (NULL) [6] ; dwFlags [7] push byte 3 ; DWORD dwService (INTERNET_SERVICE_HTTP) push ebx ; password (NULL) push ebx ; username (NULL) push dword 4444 ; PORT call got_server_uri ; double call to get pointer for both server_uri and server_uri: ; server_host; server_uri is saved in EDI for later db "/12345", 0x00 got_server_host: push eax ; HINTERNET hInternet push 0xC69F8957 ; hash( "wininet.dll", "InternetConnectA" ) call ebp httpopenrequest: ; dwContext (NULL) [8] push HTTP_OPEN_FLAGS ; dwFlags push ebx ; accept types push ebx ; referrer push ebx ; version push edi ; server URI push ebx ; method push eax ; hConnection push 0x3B2E55EB ; hash( "wininet.dll", "HttpOpenRequestA" ) call ebp xchg esi, eax ; save hHttpRequest in esi send_request: %ifdef ENABLE_SSL ; InternetSetOption (hReq, INTERNET_OPTION_SECURITY_FLAGS, &dwFlags, sizeof (dwFlags) ); set_security_options: push 0x00003380 ;0x00002000 | ; SECURITY_FLAG_IGNORE_CERT_DATE_INVALID ;0x00001000 | ; SECURITY_FLAG_IGNORE_CERT_CN_INVALID ;0x00000200 | ; SECURITY_FLAG_IGNORE_WRONG_USAGE ;0x00000100 | ; SECURITY_FLAG_IGNORE_UNKNOWN_CA ;0x00000080 ; SECURITY_FLAG_IGNORE_REVOCATION mov eax, esp push byte 4 ; sizeof(dwFlags) push eax ; &dwFlags push byte 31 ; DWORD dwOption (INTERNET_OPTION_SECURITY_FLAGS) push esi ; hHttpRequest push 0x869E4675 ; hash( "wininet.dll", "InternetSetOptionA" ) call ebp %endif httpsendrequest: push ebx ; lpOptional length (0) push ebx ; lpOptional (NULL) push ebx ; dwHeadersLength (0) push ebx ; lpszHeaders (NULL) push esi ; hHttpRequest push 0x7B18062D ; hash( "wininet.dll", "HttpSendRequestA" ) call ebp test eax,eax jnz short allocate_memory try_it_again: dec edi jnz send_request ; if we didn't allocate before running out of retries, fall through to ; failure failure: push 0x56A2B5F0 ; hardcoded to exitprocess for size call ebp allocate_memory: push byte 0x40 ; PAGE_EXECUTE_READWRITE push 0x1000 ; MEM_COMMIT push 0x00400000 ; Stage allocation (8Mb ought to do us) push ebx ; NULL as we dont care where the allocation is push 0xE553A458 ; hash( "kernel32.dll", "VirtualAlloc" ) call ebp ; VirtualAlloc( NULL, dwLength, MEM_COMMIT, PAGE_EXECUTE_READWRITE ); download_prep: xchg eax, ebx ; place the allocated base address in ebx push ebx ; store a copy of the stage base address on the stack push ebx ; temporary storage for bytes read count mov edi, esp ; &bytesRead download_more: push edi ; &bytesRead push 8192 ; read length push ebx ; buffer push esi ; hRequest push 0xE2899612 ; hash( "wininet.dll", "InternetReadFile" ) call ebp test eax,eax ; download failed? (optional?) jz failure mov eax, [edi] add ebx, eax ; buffer += bytes_received test eax,eax ; optional? jnz download_more ; continue until it returns 0 pop eax ; clear the temporary storage execute_stage: ret ; dive into the stored stage address got_server_uri: pop edi call got_server_host server_host:
Assembly
5
OsmanDere/metasploit-framework
external/source/shellcode/windows/x86/src/block/block_reverse_http.asm
[ "BSD-2-Clause", "BSD-3-Clause" ]
/***************************************************************************** * * QUERY: CREATE INDEX * * Note: we cannot put TABLESPACE clause after WHERE clause unless we are * willing to make TABLESPACE a fully reserved word. *****************************************************************************/ IndexStmt: CREATE_P opt_unique INDEX opt_concurrently opt_index_name ON qualified_name access_method_clause '(' index_params ')' opt_reloptions where_clause { PGIndexStmt *n = makeNode(PGIndexStmt); n->unique = $2; n->concurrent = $4; n->idxname = $5; n->relation = $7; n->accessMethod = $8; n->indexParams = $10; n->options = $12; n->whereClause = $13; n->excludeOpNames = NIL; n->idxcomment = NULL; n->indexOid = InvalidOid; n->oldNode = InvalidOid; n->primary = false; n->isconstraint = false; n->deferrable = false; n->initdeferred = false; n->transformed = false; n->onconflict = PG_ERROR_ON_CONFLICT; $$ = (PGNode *)n; } | CREATE_P opt_unique INDEX opt_concurrently IF_P NOT EXISTS index_name ON qualified_name access_method_clause '(' index_params ')' opt_reloptions where_clause { PGIndexStmt *n = makeNode(PGIndexStmt); n->unique = $2; n->concurrent = $4; n->idxname = $8; n->relation = $10; n->accessMethod = $11; n->indexParams = $13; n->options = $15; n->whereClause = $16; n->excludeOpNames = NIL; n->idxcomment = NULL; n->indexOid = InvalidOid; n->oldNode = InvalidOid; n->primary = false; n->isconstraint = false; n->deferrable = false; n->initdeferred = false; n->transformed = false; n->onconflict = PG_IGNORE_ON_CONFLICT; $$ = (PGNode *)n; } ; access_method: ColId { $$ = $1; }; access_method_clause: USING access_method { $$ = $2; } | /*EMPTY*/ { $$ = (char*) DEFAULT_INDEX_TYPE; } ; opt_concurrently: CONCURRENTLY { $$ = true; } | /*EMPTY*/ { $$ = false; } ; opt_index_name: index_name { $$ = $1; } | /*EMPTY*/ { $$ = NULL; } ; opt_reloptions: WITH reloptions { $$ = $2; } | /* EMPTY */ { $$ = NIL; } ; opt_unique: UNIQUE { $$ = true; } | /*EMPTY*/ { $$ = false; } ;
Yacc
4
AldoMyrtaj/duckdb
third_party/libpg_query/grammar/statements/index.y
[ "MIT" ]
<template> <block> <v-article :title="currentMovie.title" :user_name="currentMovie.user ? currentMovie.user.user_name : ''" :content="currentMovie.content || ''" :summary="currentMovie.summary || ''" ></v-article> </block> </template> <script> import { mapState, mapActions } from 'vuex' import article from '@/components/article' export default { onLoad(query) { this.clearMovieDetail() const { id } = query this.initPage(id) }, components: { 'v-article': article }, computed: { ...mapState('movie', ['currentMovie']) }, methods: { ...mapActions('movie', ['getMovieDetail', 'clearMovieDetail']), async initPage(id) { await this.getMovieDetail(id) } } } </script> <style scoped> </style>
Vue
4
ye1088/uni-app
examples/uniapp-one/pages/movie/detail/main.vue
[ "Apache-2.0" ]
// check-pass fn main() {} #[cfg(FALSE)] impl X { const Y: u8; }
Rust
1
Eric-Arellano/rust
src/test/ui/parser/impl-item-const-pass.rs
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using Newtonsoft.Json; namespace osu.Game.Online.API.Requests.Responses { public class APISeasonalBackgrounds { [JsonProperty("ends_at")] public DateTimeOffset EndDate; [JsonProperty("backgrounds")] public List<APISeasonalBackground> Backgrounds { get; set; } } public class APISeasonalBackground { [JsonProperty("url")] public string Url { get; set; } } }
C#
4
ewyn72/osu
osu.Game/Online/API/Requests/Responses/APISeasonalBackgrounds.cs
[ "MIT" ]
.class interface abstract Landroid/support/v4/view/accessibility/AccessibilityManagerCompatIcs$AccessibilityStateChangeListenerBridge; .super Ljava/lang/Object; .source "AccessibilityManagerCompatIcs.java" # annotations .annotation system Ldalvik/annotation/EnclosingClass; value = Landroid/support/v4/view/accessibility/AccessibilityManagerCompatIcs; .end annotation .annotation system Ldalvik/annotation/InnerClass; accessFlags = 0x608 name = "AccessibilityStateChangeListenerBridge" .end annotation # virtual methods .method public abstract onAccessibilityStateChanged(Z)V .end method
Smali
3
jarekankowski/pegasus_spyware
sample3/decompiled_raw/smali/android/support/v4/view/accessibility/AccessibilityManagerCompatIcs$AccessibilityStateChangeListenerBridge.smali
[ "MIT" ]
10 5 2 0 0 1 5 7 5 3 1 2 [0 0 0] [0 0 0] [0 0 0] [0 0 0] [0 0 0] 1 3 4 8 9 6 11 [8 -6 20 10 1 10 23 1 -3] [1 7 3 9 12 9 -4 9 13] [2 5 18 0 3 12 19 3 12] [7 8 8] 2 3 4 4 9 10 11 [14 8 6 11 15 10 2 2 1] [0 10 7 0 14 0 0 1 3] [2 -4 12 18 16 -4 6 2 0] [5 6 2] 3 3 3 9 8 6 [1 0 0 9 6 9 2 2 0] [1 2 1 5 5 6 5 -1 2] [0 0 3 0 6 3 6 0 1] 4 3 3 11 5 7 [7 2 9] [7 -3 12 6 0 1 -2 12 0] [18 17 12 0 5 1 -4 13 -8] 5 3 2 8 11 [12 4 3 8 19 7 3 6 2] [7 9 2] 6 3 3 10 7 11 [1 0 5 12 9 21 11 21 3] [2 5 1 -1 18 8 9 -6 -6] [2 7 7] 7 3 4 2 6 4 11 [-47 -16 -55 -39 -55 -44 -50 -30 -30] [-39 -21 -60 -18 -59 -23 -50 -13 -18] [-12 -56 -26 -18 -45 -41 -61 -40 -17] [3 2 2] 8 3 1 11 [5 7 8] 9 3 1 11 [1 2 5] 10 3 2 11 3 [5 4 8] [-43 -39 -29 -60 -32 -18 -33 -44 -35] 11 1 0 0 1 0 0 0 0 0 0 0 0 1 1 7 3 2 3 5 4 3 4 2 8 3 2 3 5 4 3 4 3 8 3 2 3 5 4 3 4 2 1 5 1 3 3 3 3 5 4 2 6 1 3 3 3 3 5 4 3 2 1 3 3 3 3 5 4 3 1 1 3 5 1 1 5 2 2 2 3 3 5 1 1 5 2 2 3 2 3 5 1 1 5 2 2 4 1 7 3 2 5 4 4 1 1 2 2 3 2 5 4 4 1 1 3 9 3 2 5 4 4 1 1 5 1 7 3 1 2 3 3 4 1 2 9 3 1 2 3 3 4 1 3 2 3 1 2 3 3 4 1 6 1 2 5 3 4 1 1 1 3 2 7 5 3 4 1 1 1 3 3 7 5 3 4 1 1 1 3 7 1 3 4 1 1 1 5 2 2 2 2 4 1 1 1 5 2 2 3 2 4 1 1 1 5 2 2 8 1 5 3 2 3 3 5 1 1 2 7 3 2 3 3 5 1 1 3 8 3 2 3 3 5 1 1 9 1 1 1 2 3 4 5 5 3 2 2 1 2 3 4 5 5 3 3 5 1 2 3 4 5 5 3 10 1 5 5 2 3 5 5 5 1 2 4 5 2 3 5 5 5 1 3 8 5 2 3 5 5 5 1 11 1 0 0 0 0 0 0 0 0 5 5 5 5 5 29 51
Eagle
2
klorel/or-tools
examples/data/rcpsp/multi_mode_max_delay/mm_j10/psp124.sch
[ "Apache-2.0" ]
import { Component, NgModule, Type } from '@angular/core'; import { TestBed, fakeAsync, flushMicrotasks } from '@angular/core/testing'; import { ElementsLoader } from './elements-loader'; import { ELEMENT_MODULE_LOAD_CALLBACKS_TOKEN, WithCustomElementComponent } from './element-registry'; interface Deferred { resolve(): void; reject(err: any): void; } describe('ElementsLoader', () => { let elementsLoader: ElementsLoader; beforeEach(() => { const injector = TestBed.configureTestingModule({ providers: [ ElementsLoader, { provide: ELEMENT_MODULE_LOAD_CALLBACKS_TOKEN, useValue: new Map<string, () => Promise<Type<WithCustomElementComponent>>>([ ['element-a-selector', async () => createFakeCustomElementModule('element-a-module')], ['element-b-selector', async () => createFakeCustomElementModule('element-b-module')], ['element-c-selector', async () => createFakeCustomElementModule('element-c-module')], ]), }, ] }); elementsLoader = injector.inject(ElementsLoader); }); describe('loadContainedCustomElements()', () => { let loadCustomElementSpy: jasmine.Spy; beforeEach(() => loadCustomElementSpy = spyOn(elementsLoader, 'loadCustomElement')); it('should attempt to load and register all contained elements', fakeAsync(() => { expect(loadCustomElementSpy).not.toHaveBeenCalled(); const hostEl = document.createElement('div'); hostEl.innerHTML = ` <element-a-selector></element-a-selector> <element-b-selector></element-b-selector> `; elementsLoader.loadContainedCustomElements(hostEl); flushMicrotasks(); expect(loadCustomElementSpy).toHaveBeenCalledTimes(2); expect(loadCustomElementSpy).toHaveBeenCalledWith('element-a-selector'); expect(loadCustomElementSpy).toHaveBeenCalledWith('element-b-selector'); })); it('should attempt to load and register only contained elements', fakeAsync(() => { expect(loadCustomElementSpy).not.toHaveBeenCalled(); const hostEl = document.createElement('div'); hostEl.innerHTML = ` <element-b-selector></element-b-selector> `; elementsLoader.loadContainedCustomElements(hostEl); flushMicrotasks(); expect(loadCustomElementSpy).toHaveBeenCalledTimes(1); expect(loadCustomElementSpy).toHaveBeenCalledWith('element-b-selector'); })); it('should wait for all contained elements to load and register', fakeAsync(() => { const deferreds = returnPromisesFromSpy(loadCustomElementSpy); const hostEl = document.createElement('div'); hostEl.innerHTML = ` <element-a-selector></element-a-selector> <element-b-selector></element-b-selector> `; const log: any[] = []; elementsLoader.loadContainedCustomElements(hostEl).subscribe( v => log.push(`emitted: ${v}`), e => log.push(`errored: ${e}`), () => log.push('completed'), ); flushMicrotasks(); expect(log).toEqual([]); deferreds[0].resolve(); flushMicrotasks(); expect(log).toEqual([]); deferreds[1].resolve(); flushMicrotasks(); expect(log).toEqual(['emitted: undefined', 'completed']); })); it('should fail if any of the contained elements fails to load and register', fakeAsync(() => { const deferreds = returnPromisesFromSpy(loadCustomElementSpy); const hostEl = document.createElement('div'); hostEl.innerHTML = ` <element-a-selector></element-a-selector> <element-b-selector></element-b-selector> `; const log: any[] = []; elementsLoader.loadContainedCustomElements(hostEl).subscribe( v => log.push(`emitted: ${v}`), e => log.push(`errored: ${e}`), () => log.push('completed'), ); flushMicrotasks(); expect(log).toEqual([]); deferreds[0].resolve(); flushMicrotasks(); expect(log).toEqual([]); deferreds[1].reject('foo'); flushMicrotasks(); expect(log).toEqual(['errored: foo']); })); }); describe('loadCustomElement()', () => { let definedSpy: jasmine.Spy; let whenDefinedSpy: jasmine.Spy; let whenDefinedDeferreds: Deferred[]; beforeEach(() => { // `loadCustomElement()` uses the `window.customElements` API. Provide mocks for these tests. definedSpy = spyOn(window.customElements, 'define'); whenDefinedSpy = spyOn(window.customElements, 'whenDefined'); whenDefinedDeferreds = returnPromisesFromSpy(whenDefinedSpy); }); it('should be able to load and register an element', fakeAsync(() => { elementsLoader.loadCustomElement('element-a-selector'); flushMicrotasks(); expect(definedSpy).toHaveBeenCalledTimes(1); expect(definedSpy).toHaveBeenCalledWith('element-a-selector', jasmine.any(Function)); // Verify the right component was loaded/registered. const Ctor = definedSpy.calls.argsFor(0)[1]; expect(Ctor.observedAttributes).toEqual(['element-a-module']); })); it('should wait until the element is defined', fakeAsync(() => { let state = 'pending'; elementsLoader.loadCustomElement('element-b-selector').then(() => state = 'resolved'); flushMicrotasks(); expect(state).toBe('pending'); expect(whenDefinedSpy).toHaveBeenCalledTimes(1); expect(whenDefinedSpy).toHaveBeenCalledWith('element-b-selector'); whenDefinedDeferreds[0].resolve(); flushMicrotasks(); expect(state).toBe('resolved'); })); it('should not load and register the same element more than once', fakeAsync(() => { elementsLoader.loadCustomElement('element-a-selector'); flushMicrotasks(); expect(definedSpy).toHaveBeenCalledTimes(1); definedSpy.calls.reset(); // While loading/registering is still in progress: elementsLoader.loadCustomElement('element-a-selector'); flushMicrotasks(); expect(definedSpy).not.toHaveBeenCalled(); definedSpy.calls.reset(); whenDefinedDeferreds[0].resolve(); // Once loading/registering is already completed: let state = 'pending'; elementsLoader.loadCustomElement('element-a-selector').then(() => state = 'resolved'); flushMicrotasks(); expect(state).toBe('resolved'); expect(definedSpy).not.toHaveBeenCalled(); })); it('should fail if defining the custom element fails', fakeAsync(() => { let state = 'pending'; elementsLoader.loadCustomElement('element-b-selector').catch(e => state = `rejected: ${e}`); flushMicrotasks(); expect(state).toBe('pending'); whenDefinedDeferreds[0].reject('foo'); flushMicrotasks(); expect(state).toBe('rejected: foo'); })); it('should be able to load and register an element again if previous attempt failed', fakeAsync(() => { elementsLoader.loadCustomElement('element-a-selector'); flushMicrotasks(); expect(definedSpy).toHaveBeenCalledTimes(1); definedSpy.calls.reset(); // While loading/registering is still in progress: elementsLoader.loadCustomElement('element-a-selector').catch(() => undefined); flushMicrotasks(); expect(definedSpy).not.toHaveBeenCalled(); whenDefinedDeferreds[0].reject('foo'); flushMicrotasks(); expect(definedSpy).not.toHaveBeenCalled(); // Once loading/registering has already failed: elementsLoader.loadCustomElement('element-a-selector'); flushMicrotasks(); expect(definedSpy).toHaveBeenCalledTimes(1); }) ); }); }); // TEST CLASSES/HELPERS class FakeCustomElementModule implements WithCustomElementComponent { static readonly modulePath: string; customElementComponent: Type<any>; } function createFakeComponent(inputName: string): Type<any> { // eslint-disable-next-line @angular-eslint/no-inputs-metadata-property @Component({inputs: [inputName]}) class FakeComponent {} return FakeComponent; } function createFakeCustomElementModule(modulePath: string): typeof FakeCustomElementModule { @NgModule({}) class FakeModule extends FakeCustomElementModule { static override readonly modulePath = modulePath; override customElementComponent = createFakeComponent(modulePath); } return FakeModule; } function returnPromisesFromSpy(spy: jasmine.Spy): Deferred[] { const deferreds: Deferred[] = []; spy.and.callFake(() => new Promise<void>((resolve, reject) => deferreds.push({resolve, reject}))); return deferreds; }
TypeScript
5
faso-dev/angular
aio/src/app/custom-elements/elements-loader.spec.ts
[ "MIT" ]
/* Copyright © 2011, 2012 MLstate This file is part of Opa. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * Define a template system. * * @author Anthonin Bonnefoy, 2011-2011 * @destination public * @category web * @stability experimental */ /** * {1 About this module} * * This module contains a high-level interface for parsing xml with * normal tags (span, div) and exporting them in xhtml. * This template system is designed to be safe and extensible. You * can extend the system so that it can process your own tags. * * {1 Where should I start?} * * For simple html parse, you can use the Template.default engine with * Template.parse for obtaining a Template.content tree. * {[ content = Template.parse(Template.default, "<div></div>") } * * You can store this structure in a database and use the Template.to_xhtml function * to produce the corresponding xhtml. * {[ Template.to_xhtml( Template.default, content) } * * You can also retrieve the xml sources from a given content with Template.to_source. * {[ Template.to_source( Template.default, content) } * * {1 What if I need more?} * If the base tags are not sufficient, you can create your own engine to parse and export your own tags * and combine it with existing engine. * * {2 A simple extension} * An engine is responsible to parse and to export a set of tags. * For example, we will create an engine which will support the <ns:response /> tag and combine it with the default engine. * First, we need to create the type sum for the tag * {[ type MyEngine.tag = { response } } * Next, we implement the engine. We start from Template.empty which is an engine with default * functions and implement parse (conversion from xml to content) and export functions. * {[ * my_namespace = "http://response.xsd" * * my_engine = { Template.empty with * // Parse function. It takes the xmlns, and a xmlns parse which is able to process xmlns into Template.content. * // If the current engine is able to process the current, it should create a Template.content. Otherwise, it should fail. * parse(_conf, {xmlns_parser=_; ~xmlns }) : outcome(Template.content(either(MyEngine.tag, 'b)), Template.failure) = * match xmlns with * // We check if the node namespace is correct * | { ~tag; namespace="http://response.xsd" ... } -> * match tag with * // We use Template.to_extension to encapsulate our type in the Template.content tree. * | "response" -> { success = Template.to_extension({ response }) } * | _ -> { failure = { unsupported_tag; ns=my_namespace; ~tag } } * end * | _ -> { failure = { unsupported_node = xmlns } } * // Export function. It takes a Template.content tree and create the xhtml. * export(content, _) = * // We use Template.from_extension to extract the * // extension tag if it exists * match Template.from_extension(content) with * | { none } -> { failure = { unknown_tag = "Expected extension" } } * | { some=opa_tag } -> * match opa_tag with * | { response } -> { success = <>42</> } * end * } * } * * This is enough to create an engine for our "response" tag. We will combine it * with the default engine in order to use our new tag in a html tree. * * {[ * engine = Template.combine(Template.default, my_engine) * content = Template.parse(engine, * "<div xmlns:my=\"http://response.xsd\"> * <my:response /> * </div>" * ) * xhtml = Template.to_xhtml(engine, content) * } * The resulting xhtml should be something like * {[ <div>42</div> } * * {2 Manage attribute} * To see how manage attribute in our tags, we will create a "date" tag which will take * the date format as an attribute. * * {[ * * // Our engine type * type DateEngine.tag = { date; format:string } * * default_date_format : string = "%d/%m/%y" * * date_attribute = "format" * * // Parse function for date tag. It seeks if a "format" attribute exists and fetch its value. * parse_date_tag(args:Template.args) : DateEngine.tag = * match List.find( { namespace=_; ~name; value=_ } -> name == date_attribute, args) with * | {some = {value=format ... } } -> { date; ~format } * | { none } -> { date; format=default_date_format } * * // The export to xhtml function * date_html(date_format)= * match Date.try_generate_printer(date_format) with * | { success=date_printer } -> <>{Date.to_formatted_string(date_printer, Date.now())}</> * | { ~failure } -> <>Incorrect date format {failure}</> * * // The engine implementation. * date_engine = { Template.empty with * parse(_conf, {~xmlns; xmlns_parser=_}) = * match xmlns with * | {tag="date"; ~args; namespace=_; content=_; specific_attributes=_ } -> { success = Template.to_extension(parse_date_tag(args)) } * | _ -> { failure = { unsupported_node=xmlns } } * * export(content, _) = * match Template.from_extension(content) with * | { none } -> { failure = { unknown_tag = "Expected extension" } } * | { some=date_tag } -> * match date_tag with * | { date; ~format} -> { success = date_html(format) } * end * } * } * To use this engine, same thing * {[ * html_date_engine = Template.combine(Template.default, date_engine) * * content = Template.parse(html_date_engine, * "<div> * <date format=\"%d %m\" /> * </div>") * * xhtml = Template.to_xhtml(html_date_engine, content) * } * The resulting xhtml should the date to the desired format. * * {2 Support children in tag} * To allow children in tags, you have to create a record with a field containing the children. * We will try to create a tag "headfoot" which wrap its' content between a <div>head</div> and a <div>foot</div>. * First, the type : * {[ * type HeadFoot.content('a) = Template.content(either(head_foot_tag('a), 'a) ) * type head_foot_tag('a) = { header_footer; children: HeadFoot.content('a) } * } * * {[ * * head_foot_engine : Template.engine(head_foot_tag('a), 'a) = { Template.empty with * // Parse the tag. This time, we put the children passed in argument in the record. * parse(_conf, {~xmlns; ~xmlns_parser} ) = * match xmlns with * | {tag="headfoot"; ~content ... } -> * children = Template.parse_list_xmlns(content, xmlns_parser) * {success = Template.to_extension( { header_footer; ~children } ) } * | _ -> { failure = { unsupported_node=xmlns } } * * // Export the tag in xhtml. The children is already transformed in xhtml and * // provided as an argument. We just need to wrap our child in a header/footer * export(content, child) = * head_foot_html() = * <><div>Header</div>{child}<div>Footer</div></> * match Template.from_extension(content) with * | { none } -> { failure = { unknown_tag = "Expected extension" } } * | { some=head_foot_tag } -> * match head_foot_tag with * | { header_footer; children=_ } -> { success = head_foot_html() } * | _ -> { failure = { unknown_tag = "" } } * end * } * } * Now, we can use our headfoot tag. * {[ * engine = Template.combine(Template.default, head_foot_engine) * content = Template.parse(engine, * "<headfoot> * The body * </headfoot>") * xhtml = Template.to_xhtml(engine, content) * } * This will give the given xhtml : <><div>head</div>The body<div>foot</div></> * * {2 Multiple extension} * To combine two engines, use the Template.combine function. However, engine combined with this function * can't be combined with another engine. * If you wish to combine more than two engines, you need to use the Template.extend function with the * firsts engines and use Template.combine with the last two engines. * For example, we can combine the default engine, my_engine and date_engine this way : * {[ * big_engine = Template.combine(Template.extend(Template.default, my_engine), date_engine) * } * The new engine will be able to process input with date and response tag. * {2 Source export} * You need to implement the source function on your engine to be able to convert a Template.content to a xml source. * The source function of the engine takes the node, the already processed children of this node, the map of xmlns binding * and a printer for source indentation. * In our headfoot engine, we can to implement source as the following : * {[ * source(content, content_exporter, _xmlns_binding, printer, depth) = * match Template.from_extension(content) with * | { none } -> { failure = { unknown_tag = "Expected extension" } } * | { some={header_footer; ~children } } -> * child = Outcome.get(content_exporter(children) ) * res = Template.print_tag("headfoot", none, "", false, true, some(child) ) * { success = printer(depth)(res) } * } * With this, a {[ Template.to_source(head_foot_engine, content) } will be able to print the headfoot tags correctly. * */ Template = {{ default_conf = { strict = false ; fallback_to_text_node = true} @private map_content(translation:('a -> 'b), content:Template.content('a)) : Template.content('b) = match content with | { ~standard_tag; ~content; ~standard_attribute } -> { ~standard_tag; content=map_content(translation, content); ~standard_attribute} | { anchor; ~anchor_attribute; ~content } -> {anchor; ~anchor_attribute; content=map_content(translation, content) } | { blockquote; ~content; ~quote_attribute } -> { blockquote; content=map_content(translation, content); ~quote_attribute} | { quote; ~content; ~quote_attribute } -> { quote; content=map_content(translation, content); ~quote_attribute} | { ~fragment } -> { fragment = List.map(el -> map_content(translation, el), fragment) } | { ~text } -> { ~text } | { ~checked_text } -> { ~checked_text } | { ~extension } -> { extension = translation(extension) } | { br ; ~standard_attribute } -> { br ; ~standard_attribute } | { form ; ~content ; ~form_attribute } -> { form ; content=map_content(translation, content) ; ~form_attribute } | { hr ; ~standard_attribute } -> { hr ; ~standard_attribute } | { img ; ~img_attribute } -> { img ; ~img_attribute } | { input ; ~input_attribute } -> { input ; ~input_attribute } | { label ; ~content ; ~label_attribute } -> { label ; content=map_content(translation, content) ; ~label_attribute } | { optgroup ; ~content ; ~optgroup_attribute } -> { optgroup ; content=map_content(translation, content) ; ~optgroup_attribute } | { option ; ~content ; ~option_attribute } -> { option ; content=map_content(translation, content) ; ~option_attribute } | { select ; ~content ; ~select_attribute } -> { select ; content=map_content(translation, content) ; ~select_attribute } | { td ; ~content ; ~td_attribute } -> { td ; content=map_content(translation, content) ; ~td_attribute } | { textarea ; ~content ; ~textarea_attribute } -> { textarea ; content=map_content(translation, content) ; ~textarea_attribute } | { th ; ~content ; ~th_attribute } -> { th ; content=map_content(translation, content) ; ~th_attribute } | { link ; ~link_attribute } -> { link; ~link_attribute } | { head ; ~content } -> { head ; content=map_content(translation, content) } | { ~title } -> { ~title } | { meta; ~meta_attribute } -> { meta; ~meta_attribute } | { base; ~base_attribute } -> { base; ~base_attribute } abstract_map_xmlns_parser(fun:(xmlns -> outcome(Template.content('a), Template.failure)), mapper:(Template.content('a) -> Template.content('b) )):(xmlns -> outcome(Template.content('b), Template.failure)) = xmlns -> match fun(xmlns) with | { ~success} -> {success= mapper(success)} | { ~failure } -> { ~failure } @private map_content_right_shift(content:Template.content(either(either('a, 'b), 'c))):Template.content(either('a, either('b,'c))) = map_content( cont -> match cont with | { ~right } -> { right = { ~right } } | { left = { ~right } } -> { right = { left = right } } | { left = { ~left } } -> { ~left } , content) @private xmlns_parser_right_shift(fun) = abstract_map_xmlns_parser(fun, map_content_right_shift) @private map_content_left_swap(content:Template.content(either(either('a, 'b), 'c))):Template.content(either(either('b, 'a), 'c)) = map_content( cont -> match cont with | { left = { ~right } } -> { left = { left = right } } | { left = { ~left } } -> { left = { right = left } } | { ~right } -> { ~right } , content) @private xmlns_parser_left_swap(fun:(xmlns -> outcome(Template.content(either(either('a, 'b), 'c)), Template.failure ) )):(xmlns -> outcome(Template.content(either(either('b, 'a), 'c)), Template.failure) ) = abstract_map_xmlns_parser(fun, map_content_left_swap) @private map_content_left_shift(content:Template.content(either('a, either('b, 'c)))):Template.content(either(either('a, 'b), 'c)) = map_content( cont -> match cont with | { ~left } -> { left = { ~left } } | { right = { ~left } } -> { left = { right = left } } | { right = { ~right } } -> { ~right } , content) @private xmlns_parser_left_shift(fun) = abstract_map_xmlns_parser(fun, map_content_left_shift) @private map_content_swap(content:Template.content(either('a,'b))):Template.content(either('b,'a) ) = map_content(a -> match a with | { ~right } -> { left = right } | { ~left } -> { right = left } , content) @private xmlns_parser_swap(fun:(xmlns -> outcome(Template.content(either('a,'b) ), Template.failure ) ) ) : (xmlns -> outcome(Template.content(either('b, 'a)), Template.failure) ) = abstract_map_xmlns_parser(fun, map_content_swap) /** * {1 Import and export interface} */ rec try_of_xmlns_with_conf(conf:Template.conf, engine:Template.engine('a, 'b), input:xmlns) : outcome(Template.content(either('a, 'b)), Template.failure ) = engine.parse(conf, {xmlns_parser=(xmlns -> try_of_xmlns_with_conf(conf, engine, xmlns) ); xmlns=input}) /** * Convert a xmlns using the specified engine into a Template.content tree. * It may fails if a tag is not known from the engine */ try_of_xmlns(engine:Template.engine('a, 'b), input:xmlns) : outcome(Template.content(either('a, 'b)), Template.failure ) = try_of_xmlns_with_conf(default_conf, engine, input) /** * Try to parse the input string into a template content. * If the xml is invalid, the input is stored as a text node * If the engine can't process the xml, it returns an error. */ try_parse_with_conf(conf:Template.conf, engine:Template.engine('a, 'b), input:string) : outcome(Template.content(either('a, 'b)), Template.failure ) = ( remove_span(content:Template.content(either('a, 'b))) = match content with | { standard_tag={span}; ~content ... } -> content | _ -> @fail match Xmlns.try_parse(input) with | { ~some } -> try_of_xmlns_with_conf(conf, engine, some) | { none } -> ( // TODO : Remove this hack when the xml parser is able to parse fragment at the root of document match Xmlns.try_parse("<span>{input}</span>") with | { ~some } -> ( match try_of_xmlns_with_conf(conf, engine, some) with | { ~success } -> { success = remove_span(success) } | { ~failure } -> { ~failure } ) | { none } -> if conf.fallback_to_text_node then { success = { text = input } } else { failure = {xml_parse_error = "The given input is not a correct xml." } } ) ) try_parse(engine:Template.engine('a, 'b), input:string) : outcome(Template.content(either('a, 'b)), Template.failure ) = try_parse_with_conf(default_conf, engine, input) /** * Parse the input string into a Template content * If the engine can't process the xml, the input is stored as a text node */ parse_with_conf(conf, engine:Template.engine('a, 'b), input:string) : Template.content(either('a, 'b)) = ( match try_parse_with_conf(conf, engine, input) with | { ~success } -> success | { failure=_ } -> { text = input } ) parse(engine:Template.engine('a, 'b), input:string) : Template.content(either('a, 'b)) = parse_with_conf(default_conf, engine, input) /** * Convert a Template.content using the engine into a xhtml. It may fails if the engine is unable to * export an element inside the content tree */ rec to_xhtml(engine:Template.engine('a, 'b), content:Template.content(either('a, 'b))) : xhtml = exporter(content) = { success = to_xhtml(engine, content) } Outcome.get(engine.export(content, exporter )) /** * Export the ast into a string representing the xml source */ to_source(engine:Template.engine('a,'b), content:Template.content(either('a,'b)) ):string = to_source_with_printer(engine, content, default_printer) /** * Export the ast into a string representing the xml source with the specific printer. */ to_source_with_printer(engine:Template.engine('a,'b), content:Template.content(either('a,'b)), printer:(int -> Template.printer) ):string = add_xmlns_binding(content:Template.content(either('a,'b)), xml_bindings:stringmap(string)) :stringmap(string) = match content with | { ~standard_attribute ... } -> List.fold_left( (acc, el -> StringMap.add(el.uri, el.name, acc) ) , xml_bindings , standard_attribute.local_binding ) | _ -> xml_bindings end rec process_source(content:Template.content(either('a,'b) ), xmlns_binding) = xmlns_binding = add_xmlns_binding(content, xmlns_binding) exporter(content) = { success = process_source(content, xmlns_binding) } Outcome.get(engine.source(content, exporter, xmlns_binding, printer, 0)) process_source(content, StringMap_empty) /** * {1 Ast manipulation} */ /** * Create a text node */ text(txt:string):Template.content(either('a, 'b) ) = { text = txt } /** * Create a title node */ title(txt:string):Template.content(either('a, 'b) ) = { title = txt } fragment(lst) : Template.content(either('a, 'b) ) = { fragment = lst } /** * {1 Extensibility interface} */ @private rec private_combine_parse(engine_a, engine_b, conf, import_arg:Template.import_arg('a, 'b)):outcome(Template.content(either('a,'b)), Template.failure) = ( { ~xmlns_parser ~xmlns } = import_arg parsing_a:(xmlns -> outcome(Template.content(either('a,'b)), Template.failure)) = xmlns -> private_combine_parse(engine_a, engine_b, conf, { ~xmlns_parser; ~xmlns } ) parsing_b:(xmlns -> outcome(Template.content(either('b,'a)), Template.failure)) = xmlns_parser_swap( xmlns -> private_combine_parse(engine_a, engine_b, conf, { ~xmlns_parser; ~xmlns } ) ) match engine_a.parse(conf, { ~xmlns; xmlns_parser=parsing_a } ) with | { ~success } -> { ~success } | { failure=failure_a } -> match engine_b.parse(conf, { ~xmlns; xmlns_parser=parsing_b } ) with | { ~success } -> {success = map_content_swap(success) } | { failure=failure_b } -> { failure={ multiple_failure=[failure_a, failure_b] } } end ) @private rec abstract_combine_map(processor_a, processor_b, content, exporter, depth)= a_exporter(content) = abstract_combine_map(processor_a, processor_b, content, exporter, depth+1) b_exporter(content) = abstract_combine_map(processor_a, processor_b, map_content_swap(content), exporter, depth+1) match processor_a(content, a_exporter, depth) with | { ~success } -> { ~success } | { failure=_ } -> processor_b(map_content_swap(content), b_exporter, depth) @private rec private_combine_export(engine_a, engine_b, content, exporter):outcome(xhtml, Template.export_failure) = processor_a(content, exporter, _) = engine_a.export(content, exporter) processor_b(content, exporter, _) = engine_b.export(content, exporter) abstract_combine_map(processor_a, processor_b, content, exporter, 0) @private rec private_combine_source(engine_a, engine_b, content, exporter, xmlns_binding, printer, depth):outcome(string, Template.export_failure) = processor_a(content,exporter,depth) = engine_a.source(content, exporter, xmlns_binding, printer, depth) processor_b(content,exporter,depth) = engine_b.source(content, exporter, xmlns_binding, printer, depth) abstract_combine_map(processor_a, processor_b, content, exporter, depth) /** * Combine two engine into a new engine. * This new engine is capable of processing all tags from the first and the second engine. * Warning : Engine combined with this function can't be combined anymore. To combine multiple engines, use the extend function. */ combine(engine_a:Template.engine('a, 'b), engine_b:Template.engine('b, 'a)): Template.engine('a, 'b) = {{ parse(conf, import_arg:Template.import_arg('a, 'b)):outcome(Template.content(either('a,'b)), Template.failure) = private_combine_parse(engine_a, engine_b, conf, import_arg) export(content:Template.content(either('a, 'b)), exporter:(Template.content(either('a, 'b) ) -> outcome(xhtml, Template.export_failure) )):outcome(xhtml, Template.export_failure) = private_combine_export(engine_a, engine_b, content, exporter) cachable(content:Template.content(either('a, 'b) ) ) : bool = engine_a.cachable(content) || engine_b.cachable(map_content_swap(content)) source(content : Template.content(either('a, 'b)), exporter:(Template.content(either('a,'b)) -> outcome(string, Template.export_failure) ), xmlns_binding:stringmap(string), printer:(int -> Template.printer), depth ) : outcome(string, Template.export_failure) = private_combine_source(engine_a, engine_b, content, exporter, xmlns_binding, printer, depth) }} @private rec private_extend_parse(engine_a, engine_b, conf, import_arg:Template.import_arg(either('a, 'b), 'c)) = ( { ~xmlns_parser ~xmlns } = import_arg parsing_a:(xmlns -> outcome(Template.content(either('a, either('b, 'c))), Template.failure)) = xmlns_parser_right_shift( xmlns -> match xmlns_parser(xmlns) with | {~success } -> {~success} | {failure=failure_a} -> match private_extend_parse(engine_a, engine_b, conf, { ~xmlns_parser; ~xmlns } ) with | { ~success } -> { ~success } | { failure=failure_b } -> multiple_failure([failure_a, failure_b]) ) parsing_b:(xmlns -> outcome(Template.content(either('b, either('a, 'c))), Template.failure)) = xmlns_parser_right_shift(xmlns_parser_left_swap( xmlns -> match xmlns_parser(xmlns) with | {~success } -> {~success} | {failure=failing_a} -> match private_extend_parse(engine_a, engine_b, conf, { ~xmlns_parser; ~xmlns } ) with | { failure=failure_b } -> multiple_failure([failing_a, failure_b] ) | { ~success } -> { ~success } end )) match engine_a.parse(conf, { ~xmlns; xmlns_parser=parsing_a } ) with | { ~success } -> { success=map_content_left_shift(success) } | { failure=failure_a } -> parsed_b : outcome(Template.content(either(either('a, 'b), 'c)), Template.failure) = match engine_b.parse(conf, { ~xmlns; xmlns_parser=parsing_b } ) with | { ~success } -> {success = map_content_left_swap(map_content_left_shift(success)) } | { failure=failure_b } -> multiple_failure([failure_a, failure_b]) end parsed_b ) @private rec abstract_extend_export(processor_a, processor_b, content, exporter, depth)= a_arg : Template.content(either('a, either('b, 'c) ) ) = map_content_right_shift( content ) b_arg : Template.content(either('b, either('a, 'c) ) ) = map_content_right_shift( map_content_left_swap(content)) a_exporter(content) = match exporter(map_content_left_shift(content)) with | { ~success } -> { ~success } | { failure=_ } -> abstract_extend_export(processor_a, processor_b, map_content_left_shift(content), exporter, depth+1) b_exporter(content) = match exporter(map_content_left_swap(map_content_left_shift(content))) with | { ~success } -> { ~success } | { failure=_ } -> abstract_extend_export(processor_a, processor_b, map_content_left_swap(map_content_left_shift(content)), exporter, depth+1) match processor_a(a_arg, a_exporter, depth) with | { ~success } -> { ~success } | { failure=_ } -> match processor_b(b_arg, b_exporter, depth) with | { ~success } -> { ~success } | { ~failure } -> { ~failure } @private rec private_extend_export(engine_a, engine_b, content:Template.content(either(either('a, 'b), 'c)), exporter:(Template.content(either(either('a, 'b), 'c)) -> outcome(xhtml, Template.export_failure) )) = processor_a(content, exporter, _)= engine_a.export(content, exporter) processor_b(content, exporter, _)= engine_b.export(content, exporter) abstract_extend_export(processor_a, processor_b, content, exporter, 0) @private rec private_extend_source(engine_a, engine_b, content:Template.content(either(either('a, 'b), 'c)), exporter:(Template.content(either(either('a, 'b), 'c)) -> outcome(string, Template.export_failure) ), xmlns_binding, printer, depth) = processor_a(content,exporter, depth) = engine_a.source(content, exporter, xmlns_binding, printer, depth) processor_b(content,exporter, depth) = engine_b.source(content, exporter, xmlns_binding, printer, depth) abstract_extend_export(processor_a, processor_b, content, exporter, depth) /** * Extend an engine with another one. The resulting engine can be extended with another engine using extend or combine. * Warning : An extended engine must be combined with another engine in order to be usable */ extend(engine_a:Template.engine('a, either('b, 'c)), engine_b:Template.engine('b, either('a, 'c))): Template.engine(either('a, 'b), 'c) = { parse(conf, import_arg:Template.import_arg(either('a, 'b), 'c)) = private_extend_parse(engine_a, engine_b, conf, import_arg) export(content:Template.content(either(either('a, 'b), 'c)), exporter):outcome(xhtml, Template.export_failure) = private_extend_export(engine_a, engine_b, content, exporter) cachable(content:Template.content(either(either('a, 'b), 'c ) ) ) : bool = engine_a.cachable(map_content_right_shift(content)) || engine_b.cachable(map_content_right_shift(map_content_left_swap(content))) source(content : Template.content(either(either('a, 'b), 'c)), exporter, xmlns_binding:stringmap(string), printer:(int -> Template.printer), depth:int) : outcome(string, Template.export_failure) = private_extend_source(engine_a, engine_b, content, exporter, xmlns_binding, printer, depth) } /*to_cached_content : engine(a), content(a) -> content(either(a, unsafe_cached))*/ /** * Encapsultate a type as a content extension */ to_extension(el : 'a ) : Template.content(either('a, 'b) ) = { extension = { left = el } } /** * Extract the type from the extension */ from_extension(content: Template.content(either('a, 'b) )) : option('a) = match content with | { extension = { ~left } } -> some(left) | _ -> none /** * {1 Parse and string_of functions} */ parse_dir(str : string) : option(Template.dir) = match str with | "ltr" -> some({ ltr }) | "rtl" -> some({ rtl }) | _ -> none parse_method(str:string) : option(Template.form_method) = match str with | "get" -> some({get}) | "post" -> some({post}) | _ -> none parse_enctype(str:string) : option(Template.form_enctype) = match str with | "application/x-www-form-urlencoded" -> some({application_x_www_form_urlencoded}) | "multipart/form-data" -> some({multipart_form_data } ) | "text/plain" -> some({text_plain}) | _ -> none parse_input_type(str:string) : option(Template.input_type) = match str with | "button" -> some({ button }) | "checkbox" -> some({ checkbox }) | "file" -> some({ file }) | "hidden" -> some({ hidden }) | "image" -> some({ image }) | "password" -> some({ password }) | "radio" -> some({ radio }) | "reset" -> some({ reset }) | "submit" -> some({ submit }) | "text" -> some({ text }) | _ -> none parse_media(str:string) : option(Template.media) = match str with | "screen" -> some({ screen }) | "tty" -> some({ tty }) | "tv" -> some({ tv }) | "projection" -> some({ projection }) | "handheld" -> some({ handheld }) | "print" -> some({ print }) | "braille" -> some({ braille }) | "aural" -> some({ aural }) | "all" -> some({ all }) | _ -> none parse_rel(str:string) : option(Template.rel) = match str with | "alternate" -> some({ alternate }) | "appendix" -> some({ appendix }) | "bookmark" -> some({ bookmark }) | "chapter" -> some({ chapter }) | "contents" -> some({ contents }) | "copyright" -> some({ copyright }) | "glossary" -> some({ glossary }) | "help" -> some({ help }) | "home" -> some({ home }) | "index" -> some({ index }) | "next" -> some({ next }) | "prev" -> some({ prev }) | "section" -> some({ section }) | "start" -> some({ start }) | "stylesheet" -> some({ stylesheet }) | "subsection" -> some({ subsection }) | _ -> none parse_rev(str:string) : option(Template.rev) = match str with | "alternate" -> some({ alternate }) | "appendix" -> some({ appendix }) | "bookmark" -> some({ bookmark }) | "chapter" -> some({ chapter }) | "contents" -> some({ contents }) | "copyright" -> some({ copyright }) | "glossary" -> some({ glossary }) | "help" -> some({ help }) | "home" -> some({ home }) | "index" -> some({ index }) | "next" -> some({ next }) | "prev" -> some({ prev }) | "section" -> some({ section }) | "start" -> some({ start }) | "stylesheet" -> some({ stylesheet }) | "subsection" -> some({ subsection }) | _ -> none parse_name(str:string) : option(Template.name) = match str with | "author" -> some({ author }) | "description" -> some({ description }) | "keywords" -> some({ keywords }) | "generator" -> some({ generator }) | "revised" -> some({ revised }) | _ -> none string_of_dir(dir:Template.dir):string = match dir with | {rtl} -> "rtl" | {ltr} -> "ltr" string_of_method(method:Template.form_method):string = match method with | { get } -> "get" | { post } -> "post" string_of_enctype(enctype:Template.form_enctype):string = match enctype with | { application_x_www_form_urlencoded } -> "application/x-www-form-urlencoded" | { multipart_form_data } -> "multipart/form-data" | { text_plain } -> "text/plain" string_of_input_type(input_type:Template.input_type) : string = match input_type with | { button } -> "button" | { checkbox } -> "checkbox" | { file } -> "file" | { hidden } -> "hidden" | { image } -> "image" | { password } -> "password" | { radio } -> "radio" | { reset } -> "reset" | { submit } -> "submit" | { text } -> "text" rec string_of_template_failure(failure:Template.failure) : string = match failure with | { unsupported_tag; ~tag; ~ns } -> "Unsupported tag. Tag name={tag}, namespace={ns}" | { ~attribute_tag_error } -> attribute_tag_error | { ~unknown_attribute } -> "Unknown attribute : {unknown_attribute}. " | { ~attribute_required } -> attribute_required | { ~xml_parse_error } -> "Xml parse error : {xml_parse_error}" | { ~namespace_not_supported_by_engine } -> "Unsupported namespace : {namespace_not_supported_by_engine}" | { ~multiple_failure } -> list_errors = List.map(string_of_template_failure, multiple_failure) List.to_string_using("Multiple failure :\n", "", "\n", list_errors) | { ~dom_error } -> "Error in dom structure : {dom_error}" | { ~unsupported_node } -> "unsupported_node : {unsupported_node}" | { empty_engine } -> "empty_engine" rec xhtml_of_template_failure(failure:Template.failure) : xhtml = match failure with | { ~multiple_failure } -> if List.is_empty(multiple_failure) then <></> else list_errors = List.map(xhtml_of_template_failure, multiple_failure) List.foldl(el, acc -> <>{acc}<br />{el}</> ,list_errors , <>Multiple failure : </> ) | other -> <>{string_of_template_failure(other)}</> string_of_media(media:Template.media) : string = match media with | { screen } -> "screen" | { tty } -> "tty" | { tv } -> "tv" | { projection } -> "projection" | { handheld } -> "handheld" | { print } -> "print" | { braille } -> "braille" | { aural } -> "aural" | { all } -> "all" string_of_rel(rel:Template.rel) : string = match rel with | { alternate } -> "alternate" | { appendix } -> "appendix" | { bookmark } -> "bookmark" | { chapter } -> "chapter" | { contents } -> "contents" | { copyright } -> "copyright" | { glossary } -> "glossary" | { help } -> "help" | { home } -> "home" | { index } -> "index" | { next } -> "next" | { prev } -> "prev" | { section } -> "section" | { start } -> "start" | { stylesheet } -> "stylesheet" | { subsection } -> "subsection" string_of_rev(rev:Template.rev) : string = match rev with | { alternate } -> "alternate" | { appendix } -> "appendix" | { bookmark } -> "bookmark" | { chapter } -> "chapter" | { contents } -> "contents" | { copyright } -> "copyright" | { glossary } -> "glossary" | { help } -> "help" | { home } -> "home" | { index } -> "index" | { next } -> "next" | { prev } -> "prev" | { section } -> "section" | { start } -> "start" | { stylesheet } -> "stylesheet" | { subsection } -> "subsection" string_of_name(name:Template.name) : string = match name with | { author } -> "author" | { description } -> "description" | { keywords } -> "keywords" | { generator } -> "generator" | { revised } -> "revised" /** * {1 Default values} */ /** * An empty engine with default options and default operations */ empty : Template.engine('a, 'b) = { parse(_conf, _) = { failure = { empty_engine } } ; export(_, _)= { failure = {unknown_tag = "" } } ; cachable = _ -> false ; source = _, _, _, _, _ -> { failure = { unknown_tag = "" } } } /** * Default printer which add line break and spaces for source indentation */ default_printer(depth:int):Template.printer = str -> if depth == 0 then str("","\n") else spaces = String.repeat(depth, " ") str("\n{spaces}", "\n{spaces}") /** * The default engine which is able to process html */ default = TemplateBaseEngine.base_engine /** * Create a tag printer for a xml tag. * The tag printer have placeholder before the two concerned node for pretty printing * If autoclose is active, the child is ignored. * @param tag_name The name of the node to print * @param may_binding The xmlns binding to add to your tag name. For example, tag_name toto and may_binding some(opa) will print <opa:toto /> * @param attr The list of attributes * @param autoclose Specifies if the tag has no end tag * @param may_child The node's children. */ print_tag(tag_name:string, may_binding:option(string), attr:string, autoclose:bool, print_after:bool, may_child:option(string)) : (string, string -> string) = (before, after -> after = if print_after then after else "" binding = Option.switch(a -> "{a}:", "", may_binding) if autoclose then "{before}<{binding}{tag_name}{attr}/>" else match may_child with | { some=child } -> "{before}<{binding}{tag_name} {attr}>{child}{after}</{binding}{tag_name}>" | { none } -> "{before}<{binding}{tag_name} {attr}></{binding}{tag_name}>" ) /** * Make Template content structure public */ export_to_public : Template.content('a) -> Template.public_content('a) = identity /** * Make Template content structure private */ export_to_private : Template.public_content('a) -> Template.content('a) = identity merge_outcome(outcomes:list(outcome('a,'b) ) ): outcome(list('a), list('b) ) = failures = List.filter(Outcome.is_failure, outcomes) if List.is_empty(failures) then {success = List.map(Outcome.get, outcomes) } else {failure = List.filter_map(outcome -> match outcome with | { success=_ } -> {none} | { ~failure } -> {some=failure} , outcomes ) } merge_outcome_content(outcomes) = match merge_outcome(outcomes) with | { ~success } -> {success = { fragment = success } } | { ~failure } -> { failure= { multiple_failure = failure } } parse_list_xmlns(children:list(xmlns), xmlns_parser:(xmlns -> outcome(Template.content('a), Template.failure ))):outcome(Template.content('a), Template.failure) = merge_outcome_content(List.map(xmlns_parser, children)) export_list_content(content:list(Template.content), exporter):xhtml = outcome = merge_outcome(List.map(exporter, content) ) <>{Outcome.get(outcome)}</> error_unsupported_tag(tag:string):outcome('a, Template.failure) = { failure = { unsupported_tag; ~tag; ns="" } } error_unsupported_node(node:xmlns):outcome('a, Template.failure) = { failure = { unsupported_node=node } } multiple_failure(lst_failure : list(Template.failure ) ):outcome('a, Template.failure) = {failure = { multiple_failure = lst_failure } } }}
Opa
4
Machiaweliczny/oppailang
lib/stdlib/web/template/template.opa
[ "MIT" ]
var arrayWithHoles = require("./arrayWithHoles.js"); var iterableToArrayLimit = require("./iterableToArrayLimit.js"); var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); var nonIterableRest = require("./nonIterableRest.js"); function _slicedToArray(arr, i) { return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); } module.exports = _slicedToArray; module.exports["default"] = module.exports, module.exports.__esModule = true;
JavaScript
4
AdityaJPutra/Alphabot-Md
node_modules/@babel/runtime/helpers/slicedToArray.js
[ "MIT" ]
{ metadata: { namespace: "MathML", namespaceURI: "http://www.w3.org/1998/Math/MathML", attrsNullNamespace: true, }, data: [ "definitionURL", "encoding", ], }
JSON5
1
zipated/src
third_party/blink/renderer/core/html/parser/mathml_attribute_names.json5
[ "BSD-3-Clause" ]
// MIR for `too_complex` after PreCodegen fn too_complex(_1: Result<i32, usize>) -> Option<i32> { debug x => _1; // in scope 0 at $DIR/separate_const_switch.rs:9:16: 9:17 let mut _0: std::option::Option<i32>; // return place in scope 0 at $DIR/separate_const_switch.rs:9:42: 9:53 let mut _2: std::ops::ControlFlow<usize, i32>; // in scope 0 at $DIR/separate_const_switch.rs:14:11: 19:6 let mut _3: isize; // in scope 0 at $DIR/separate_const_switch.rs:16:13: 16:18 let _4: i32; // in scope 0 at $DIR/separate_const_switch.rs:16:16: 16:17 let mut _5: i32; // in scope 0 at $DIR/separate_const_switch.rs:16:44: 16:45 let _6: usize; // in scope 0 at $DIR/separate_const_switch.rs:17:17: 17:18 let mut _7: usize; // in scope 0 at $DIR/separate_const_switch.rs:17:42: 17:43 let _8: i32; // in scope 0 at $DIR/separate_const_switch.rs:20:31: 20:32 let mut _9: i32; // in scope 0 at $DIR/separate_const_switch.rs:20:42: 20:43 let _10: usize; // in scope 0 at $DIR/separate_const_switch.rs:21:28: 21:29 scope 1 { debug v => _4; // in scope 1 at $DIR/separate_const_switch.rs:16:16: 16:17 } scope 2 { debug r => _6; // in scope 2 at $DIR/separate_const_switch.rs:17:17: 17:18 } scope 3 { debug v => _8; // in scope 3 at $DIR/separate_const_switch.rs:20:31: 20:32 } scope 4 { debug r => _10; // in scope 4 at $DIR/separate_const_switch.rs:21:28: 21:29 } bb0: { StorageLive(_2); // scope 0 at $DIR/separate_const_switch.rs:14:11: 19:6 _3 = discriminant(_1); // scope 0 at $DIR/separate_const_switch.rs:15:15: 15:16 switchInt(move _3) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/separate_const_switch.rs:15:9: 15:16 } bb1: { StorageLive(_6); // scope 0 at $DIR/separate_const_switch.rs:17:17: 17:18 _6 = ((_1 as Err).0: usize); // scope 0 at $DIR/separate_const_switch.rs:17:17: 17:18 StorageLive(_7); // scope 2 at $DIR/separate_const_switch.rs:17:42: 17:43 _7 = _6; // scope 2 at $DIR/separate_const_switch.rs:17:42: 17:43 ((_2 as Break).0: usize) = move _7; // scope 2 at $DIR/separate_const_switch.rs:17:23: 17:44 discriminant(_2) = 1; // scope 2 at $DIR/separate_const_switch.rs:17:23: 17:44 StorageDead(_7); // scope 2 at $DIR/separate_const_switch.rs:17:43: 17:44 StorageDead(_6); // scope 0 at $DIR/separate_const_switch.rs:17:43: 17:44 StorageLive(_10); // scope 0 at $DIR/separate_const_switch.rs:21:28: 21:29 _10 = ((_2 as Break).0: usize); // scope 0 at $DIR/separate_const_switch.rs:21:28: 21:29 discriminant(_0) = 0; // scope 4 at $DIR/separate_const_switch.rs:21:34: 21:38 StorageDead(_10); // scope 0 at $DIR/separate_const_switch.rs:21:37: 21:38 goto -> bb3; // scope 0 at $DIR/separate_const_switch.rs:21:37: 21:38 } bb2: { StorageLive(_4); // scope 0 at $DIR/separate_const_switch.rs:16:16: 16:17 _4 = ((_1 as Ok).0: i32); // scope 0 at $DIR/separate_const_switch.rs:16:16: 16:17 StorageLive(_5); // scope 1 at $DIR/separate_const_switch.rs:16:44: 16:45 _5 = _4; // scope 1 at $DIR/separate_const_switch.rs:16:44: 16:45 ((_2 as Continue).0: i32) = move _5; // scope 1 at $DIR/separate_const_switch.rs:16:22: 16:46 discriminant(_2) = 0; // scope 1 at $DIR/separate_const_switch.rs:16:22: 16:46 StorageDead(_5); // scope 1 at $DIR/separate_const_switch.rs:16:45: 16:46 StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:16:45: 16:46 StorageLive(_8); // scope 0 at $DIR/separate_const_switch.rs:20:31: 20:32 _8 = ((_2 as Continue).0: i32); // scope 0 at $DIR/separate_const_switch.rs:20:31: 20:32 StorageLive(_9); // scope 3 at $DIR/separate_const_switch.rs:20:42: 20:43 _9 = _8; // scope 3 at $DIR/separate_const_switch.rs:20:42: 20:43 ((_0 as Some).0: i32) = move _9; // scope 3 at $DIR/separate_const_switch.rs:20:37: 20:44 discriminant(_0) = 1; // scope 3 at $DIR/separate_const_switch.rs:20:37: 20:44 StorageDead(_9); // scope 3 at $DIR/separate_const_switch.rs:20:43: 20:44 StorageDead(_8); // scope 0 at $DIR/separate_const_switch.rs:20:43: 20:44 goto -> bb3; // scope 0 at $DIR/separate_const_switch.rs:20:43: 20:44 } bb3: { StorageDead(_2); // scope 0 at $DIR/separate_const_switch.rs:23:1: 23:2 return; // scope 0 at $DIR/separate_const_switch.rs:23:2: 23:2 } }
Mirah
3
mbc-git/rust
src/test/mir-opt/separate_const_switch.too_complex.PreCodegen.after.mir
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
Hello, {{NAME}} I hope your {{TIME_PERIOD}} was fun.
Modelica
0
wukuan405/mo
demo/fun-trip.mo
[ "MIT" ]
= Overview = * CPU: Intel Core 2 Solo U3500 @ 1.40GHz (speeds: 0.8, 1.2 and 1.4GHz), 3MB L2 * Screen: 1366x768 LED = BIOS versions = * 1.10 - average ACPI temperature around 34°C, good GL playing * 1.20 - average ACPI temperature around 39°C, good GL playing * 1.31 - big slowdown in X windows from time to time, GL games with annoying slowdowns regularly The most recent BIOS updates (1.20 onwards) come with a DOS flasher; older come only with a windows flasher. I used a [http://www.pcengines.ch/freedos.htm freedos image] stored in a USB flash memory to boot freedos and flash the BIOS. = Drivers = All provided in linux 2.6.32 kernels. Linux 2.6.29 has problems at least with the wire ethernet card (Attansic Technology Corp. Device 1063). Loading and unloading the ethernet card driver module (atl1c) helps getting a working link, although it will change from eth0 to eth1, eth2, or another interface name. == lspci == 00:00.0 Host bridge: Intel Corporation Mobile 4 Series Chipset Memory Controller Hub (rev 07) 00:02.0 VGA compatible controller: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller (rev 07) 00:02.1 Display controller: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller (rev 07) 00:1a.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 (rev 03) 00:1a.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5 (rev 03) 00:1a.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2 (rev 03) 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 03) 00:1c.0 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 1 (rev 03) 00:1c.1 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 2 (rev 03) 00:1d.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 (rev 03) 00:1d.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 (rev 03) 00:1d.2 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 (rev 03) 00:1d.3 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6 (rev 03) 00:1d.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 (rev 03) 00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 93) 00:1f.0 ISA bridge: Intel Corporation ICH9M-E LPC Interface Controller (rev 03) 00:1f.2 IDE interface: Intel Corporation ICH9M/M-E 2 port SATA IDE Controller (rev 03) 00:1f.3 SMBus: Intel Corporation 82801I (ICH9 Family) SMBus Controller (rev 03) 00:1f.5 IDE interface: Intel Corporation ICH9M/M-E 2 port SATA IDE Controller (rev 03) 00:1f.6 Signal processing controller: Intel Corporation 82801I (ICH9 Family) Thermal Subsystem (rev 03) 01:00.0 Ethernet controller: Attansic Technology Corp. Device 1063 (rev c0) 02:00.0 Network controller: Intel Corporation Wireless WiFi Link 5100 = Configuration = { # Make te network WLAN card (wlan0) firmware available require = [ ./nixos/modules/hardware/network/intel-5000.nix ]; boot = rec { initrd = { kernelModules = [ "ata_piix" "reiserfs" ]; }; kernelParams = [ "selinux=0" "apm=on" "acpi=on" "vga=0x317" "console=tty1" "video=vesafb:ywrap" # Important, to disable Kernel Mode Setting for the graphics card # This will allow backlight regulation "nomodeset" ]; kernelModules = [ "acpi-cpufreq" "cpufreq-ondemand" # not autoloaded in 2.6.32.2 "kvm-intel" ]; resumeDevice = "8:2"; extraKernelParams = ["resume=/dev/sda2"]; kernelPackages = pkgs.kernelPackages_2_6_32; postBootCommands = '' echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ''; }; services = { xserver = { enable = true; defaultDepth = 24; videoDriver = "intel"; exportConfiguration = true; enableTCP = true; autorun = true; driSupport = false; synaptics = { enable = true; dev = "/dev/input/event8"; }; }; }; = X settings = == Backlight == Having disabled Kernel Mode Setting for the i915 kernel drm module (kernel parameter ''nomodeset''), use ''xrandr'' to set: xrandr --output LVDS --set BACKLIGHT_CONTROL combination xrandr --output LVDS --set BACKLIGHT 300 # ~1000, max light. If those steps make your mouse cursor not appear, switch to another VT, and then back to X, and it will come. == Synaptics pad == I like the pad speed set by: synclient MaxTapTime=0 MaxSpeed=1.12 MinSpeed=0.6 AccelFactor=0.001 VertEdgeScroll=1 Install the ''xf86-input-synaptics-1.2.0'' for ''synclient'' to be in your PATH. = Suspending and hibernating = Usual pm-utils work, with pm-suspend and pm-hibernate. [[Category:Installation]] [[Category:Hardware]] [[Category:Laptops]]
MediaWiki
3
pmeiyu/nixos-hardware
acer/aspire/4810t/README.wiki
[ "CC0-1.0" ]
# Copyright (c) 2018-2021, Carnegie Mellon University # See LICENSE for details memo := function(context, prefix, exp) local v, isum; exp := SReduce(toExpArg(exp), SpiralDefaults); ##Pass the real opts instead if IsValue(exp) then return exp.v; elif IsVar(exp) then return exp; else if IsBound(context.ISum) and context.ISum <> [] then isum := Last(context.ISum); v := var.fresh_t(prefix, TInt); if not IsBound(isum.memos) then isum.memos := []; fi; Add(isum.memos, [v, exp]); #Print(v.id , " -> ", exp, " [", isum.var, " in ", isum.domain, "]\n"); v.mapping := exp; return v; else return exp; fi; fi; end; nomemo := (cx,pfx,exp) -> exp; memo := nomemo; # memo feature is currently broken -- disable it Class(ProcessMemos, RuleSet); RewriteRules(ProcessMemos, rec( # pull out cmemos PullOutCmemo := Rule(cmemo, function(e,cx) local target; target := cx.(e.target); if not IsBound(target.memos) then target.memos := [ e.args[1], e.mapping ]; else Add(target.memos, [ e.args[1], e.mapping ]); fi; return e.args[1]; end), # process memos at ISum ProcessISumMemos := Rule(@(1, [ISum, ISumAcc], e->IsBound(e.memos)), e -> ObjId(@(1).val)(e.var, e.domain, FoldL(Reversed(e.memos), (ex,m) -> Data(m[1], m[2], ex)), e.child(1))) ));
GAP
3
sr7cb/spiral-software
namespaces/spiral/sigma/memo.gi
[ "BSD-2-Clause-FreeBSD" ]
# frozen_string_literal: true module ActiveRecord module ConnectionAdapters class PoolManager # :nodoc: def initialize @name_to_role_mapping = Hash.new { |h, k| h[k] = {} } end def shard_names @name_to_role_mapping.values.flat_map { |shard_map| shard_map.keys } end def role_names @name_to_role_mapping.keys end def pool_configs(role = nil) if role @name_to_role_mapping[role].values else @name_to_role_mapping.flat_map { |_, shard_map| shard_map.values } end end def remove_role(role) @name_to_role_mapping.delete(role) end def remove_pool_config(role, shard) @name_to_role_mapping[role].delete(shard) end def get_pool_config(role, shard) @name_to_role_mapping[role][shard] end def set_pool_config(role, shard, pool_config) if pool_config @name_to_role_mapping[role][shard] = pool_config else raise ArgumentError, "The `pool_config` for the :#{role} role and :#{shard} shard was `nil`. Please check your configuration. If you want your writing role to be something other than `:writing` set `config.active_record.writing_role` in your application configuration. The same setting should be applied for the `reading_role` if applicable." end end end end end
Ruby
4
puzzle/nochmal
spec/dummy/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/pool_manager.rb
[ "MIT" ]
#lang scribble/manual @require[@for-label[r-cade]] @title{R-cade Game Engine} @author[@author+email["Jeffrey Massung" "[email protected]"]] @defmodule[r-cade] R-cade is a simple, retro game engine for Racket. @;; ---------------------------------------------------- @section{Homepage} All the most recent updates, blog posts, etc. can be found at @url{http://r-cade.io}. @;; ---------------------------------------------------- @section{Core} @defproc[(run [game-loop procedure?] [width exact-nonnegative-integer?] [height exact-nonnegative-integer?] [#:init init procedure? #f] [#:scale scale-factor exact-nonnegative-integer? #f] [#:fps frame-rate exact-nonnegative-integer? 60] [#:shader enable-shader boolean? #t] [#:title window-title string? "R-cade"]) void?]{ Creates a new game window, video memory, and enters the main game loop. The @racket[game-loop] parameter is a function you provide, which will be called once per frame and should take no arguments. The @racket[width] and @racket[height] parameters define the size of video memory (not the size of the window!). The @racket[init] procedure - if provided - is called before the @racket[game-loop] starts. If you have initialization or setup code that requires R-cade state be initialized, this is where you can safely do it. The @racket[scale-factor] parameter will determine the initial size of the window. The default will let auto pick a scale factor that is appropriate given the size of the display. The @racket[frame-rate] is the number of times per second the @racket[game-loop] function will be called the window will update with what's stored in VRAM. The @racket[enable-shader] controls whether or not the contents of VRAM are rendered using a fullscreen shader effect. If this is set to @racket[#f] the effect will be disabled. The @racket[window-title] parameter is the title given to the window created. } @;; ---------------------------------------------------- @defproc[(quit) void?]{Closes the window, which will terminate the main game loop.} @;; ---------------------------------------------------- @defproc[(goto [game-loop procedure?]) void?]{Changes the game loop function to @racket[game-loop]. This doesn't take affect until the next frame. This function is used to change between various game states. For example, you might have a @tt{start-screen} game state, a @tt{main-game} state, and a @tt{pause-game} state that are switched between.} @;; ---------------------------------------------------- @defproc[(wait [until procedure? btn-any]) void?]{Hard stops the game loop and waits until either the window is closed or the until function returns true. While waiting, events are still processed. This is commonly used to wait for the user to press a button.} @;; ---------------------------------------------------- @defproc[(sync) void?]{Called once per frame automatically by the main game loop. You shouldn’t need to call this yourself unless you are creating your own game loop. It processes all events, renders video memory, and ensures the framerate is locked.} @;; ---------------------------------------------------- @defproc[(frame) exact-nonnegative-integer?]{Returns the current frame: 1, 2, 3, ...} @;; ---------------------------------------------------- @defproc[(frametime) real?]{Returns the delta time (in seconds) since the last frame. It’s best to use this when applying any kind of velocity to a game object instead of assuming the framerate will be constant.} @;; ---------------------------------------------------- @defproc[(gametime) real?]{Returns the total time (in seconds) since the game started.} @;; ---------------------------------------------------- @defproc[(width) exact-nonnegative-integer?]{Returns the width of VRAM in pixels. This is the same value that was passed to the @racket[run] function.} @;; ---------------------------------------------------- @defproc[(height) exact-nonnegative-integer?]{Returns the height of VRAM in pixels. This is the same value that was passed to the @racket[run] function.} @;; ---------------------------------------------------- @section{Input} All @tt{btn-*} functions return either @racket[#t] or @racket[#f] to indicate if the button should currently be considered "pressed". The @racket[hold] parameter should be set to @racket[#f] if the button predicate should only return @racket[#t] once when the button is initially pressed, but @racket[#f] if held down. If @racket[hold] is @racket[#t], then the @racket[rate] parameter can also be optionally set to limit how often a held button can return true. The rate is in presses per second. For example, if you want to know if the Z button was just pressed this frame by the player, you would check with: @code[]{(btn-z)} If you want to know if the Z button is pressed, regardless of how long it has been held down for: @code[]{(btn-z #t)} But, let's say you're using the Z button to shoot a weapon, but only want the user to be able to fire at a rate of 3 times per second, you could check with: @code[]{(btn-z #t 3)} @;; ---------------------------------------------------- @defproc[(btn-start [hold boolean? #f] [rate exact-nonnegative-integer? #f]) boolean?]{Returns the state of the ENTER key.} @;; ---------------------------------------------------- @defproc[(btn-select [hold boolean? #f] [rate exact-nonnegative-integer? #f]) boolean?]{Returns the state of the SPACEBAR key.} @;; ---------------------------------------------------- @defproc[(btn-quit [hold boolean? #f] [rate exact-nonnegative-integer? #f]) boolean?]{Returns the state of the ESCAPE key.} @;; ---------------------------------------------------- @defproc[(btn-z [hold boolean? #f] [rate exact-nonnegative-integer? #f]) boolean?]{Returns the state of the Z key.} @;; ---------------------------------------------------- @defproc[(btn-x [hold boolean? #f] [rate exact-nonnegative-integer? #f]) boolean?]{Returns the state of the X key.} @;; ---------------------------------------------------- @defproc[(btn-up [hold boolean? #f] [rate exact-nonnegative-integer? #f]) boolean?]{Returns the state of the UP arrow key.} @;; ---------------------------------------------------- @defproc[(btn-down [hold boolean? #f] [rate exact-nonnegative-integer? #f]) boolean?]{Returns the state of the DOWN arrow key.} @;; ---------------------------------------------------- @defproc[(btn-right [hold boolean? #f] [rate exact-nonnegative-integer? #f]) boolean?]{Returns the state of the RIGHT arrow key.} @;; ---------------------------------------------------- @defproc[(btn-left [hold boolean? #f] [rate exact-nonnegative-integer? #f]) boolean?]{Returns the state of the LEFT arrow key.} @;; ---------------------------------------------------- @defproc[(btn-mouse [hold boolean? #f] [rate exact-nonnegative-integer? #f]) boolean?]{Returns the state of the LEFT mouse button.} @;; ---------------------------------------------------- @defproc[(btn-any) boolean?]{Returns the equivelant of: @racketblock[(or (btn-start) (btn-select) (btn-quit) (btn-z) (btn-x))]} This function isn't really used much outside of @racket[wait]. @;; ---------------------------------------------------- @defproc[(mouse-x) exact-nonnegative-integer?]{Returns the X pixel (in VRAM) that the mouse is over. @tt{0} is the left edge.} @;; ---------------------------------------------------- @defproc[(mouse-y) exact-nonnegative-integer?]{Returns the Y pixel (in VRAM) that the mouse is over. @tt{0} is the top edge.} @;; ---------------------------------------------------- @defproc[(hide-mouse) void?]{Hides the mouse cursor while over the window.} @;; ---------------------------------------------------- @defproc[(show-mouse) void?]{Shows the mouse cursor while over the window.} @;; ---------------------------------------------------- @section{Actions} Sometimes you want to be able to bind buttons to specific, named actions so your code is easier to read (and modify if you want to change your button mapping). To do this, use the @racket[action] function. @;; ---------------------------------------------------- @defproc[(action [btn procedure?] [hold boolean? #f] [rate exact-nonnegative-integer? 0]) procedure?]{ Returns a function with arity 0 that returns either @racket[#t] or @racket[#f], indicating whether or not the action is should be considered "pressed". The @racket[btn] parameter should be one of the @tt{btn-*} functions (e.g. @racket[btn-z]). The @racket[hold] and @racket[rate] parameters are the same as what would be passed to the @racket[btn] function. } @;; ---------------------------------------------------- @section{Timers} It's possible to create countdown timer functions that expire after some time has elapsed. @;; ---------------------------------------------------- @defproc[(timer [time real?] [#:loop loop boolean? #f]) procedure?]{ Returns a function that will count down the @racket[time] until it reaches @tt{0.0}, at which point the function returned will return @racket[#t] indicating the time has elapsed. If @racket[loop] is @racket[#t], then when the timer expires it will automatically reset back to @racket[time] and begin counting down again. Example use: @racketblock[ (define boss-attack-timer (timer 5 #:loop #t)) (define (game-loop) (when (boss-attack-timer) (do-boss-attack))) ] Note: the timer will only advance when called. This allows you to "pause" a timer by simply not calling it (e.g. while the game is paused). However, this also means calling the function multiple times in the same frame will advance it multiple times. } @;; ---------------------------------------------------- @section{Drawing} @;; ---------------------------------------------------- @defproc[(cls [c exact-nonnegative-integer? 0]) void?]{Clears video memory with the specified color. Remember that video memory isn’t magically wiped each frame.} @;; ---------------------------------------------------- @defproc[(color [c exact-nonnegative-integer?]) void?]{Changes the active color to @racket[c] (0-15). The default color palette is the same as the PICO-8: @image["scribblings/palette.png"]} @;; ---------------------------------------------------- @defproc[(set-color! [c exact-nonnegative-integer?] [r byte?] [g byte?] [b byte?]) void?]{ Changes the color in the palette at index @racket[c] to the RGB byte values specified by @racket[r], @racket[g], and @racket[b].} @;; ---------------------------------------------------- @defproc[(draw [x real?] [y real?] [sprite (listof byte?)]) void?]{ Uses the current color to render a 1-bit sprite composed of bytes to VRAM at (@racket[x],@racket[y]). For example: @code[]{(draw 10 12 '(#b01000000 #b11100000 #b01000000))} The above would draw a 3x3 sprite that looks like a + sign to the pixels at (10,12) -> (12,14). Any bit set in the sprite pattern will change the pixel color in VRAM to the current color. Any cleared bits are skipped. @italic{Remember! The most significant bit of each byte is drawn at @racket[x]. This is important, because if you'd like to draw a single pixel at (@racket[x],@racket[y]), you need to draw @tt{#b10000000} and not @tt{#b00000001}!} } @;; ---------------------------------------------------- @defproc[(draw-ex [x real?] [y real?] [sprite (listof integer?)]) void?]{ This is exactly the same as @racket[draw], except that the sprite is considered to be 16-bits wide. The most significant byte of each scanline is rendered first, followed by the least significant byte. } @;; ---------------------------------------------------- @defproc[(text [x real?] [y real?] [s any]) void?]{Draw the value @racket[s] at (@racket[x],@racket[y]) using the current font. The default font is a fixed-width, ASCII font with character range [@tt{#x20},@tt{#x7f}]. Each character is 3x6 pixels in size.} @;; ---------------------------------------------------- @defproc[(line [x1 real?] [y1 real?] [x2 real?] [y2 real?]) void?]{Draw a line from (@racket[x1],@racket[y1]) to (@racket[x2],@racket[y2]) using the current color.} @;; ---------------------------------------------------- @defproc[(rect [x real?] [y real?] [w real?] [h real?] [#:fill boolean? #f]) void?]{ Draw a rectangle starting at (@racket[x],@racket[y]) with a width @racket[w] and height @racket[h] using the current color. If @racket[fill] is @racket[#t] then it will be a solid rectangle, otherwise just the outline. } @;; ---------------------------------------------------- @defproc[(circle [x real?] [y real?] [r real?] [#:fill boolean? #f]) void?]{ Draw a circle with its center at (@racket[x],@racket[y]) and radius @racket[r] using the current color. If @racket[fill] is @racket[#t] then it will be solid, otherwise just the outline. } @;; ---------------------------------------------------- @section{Fonts} There are three built-in fonts and it's possible to create your own and use them as well. @;; ---------------------------------------------------- @defproc[(make-font [sprites (vectorof (listof byte?))] [#:advance width exact-nonnegative-integer? 8] [#:base base exact-nonnegative-integer? 33]) font?]{ Define a new font that can be set with the @racket[font] function and rendered with @racket[text]. The @racket[width] parameter is the pixel width of each character sprite. The @racket[base] parameter is the ordinal value of the first ASCII character in the font (typically this is @racket[33], the @racket[#\!] character). Any character drawn that isn't in the font is drawn as a space. } @;; ---------------------------------------------------- @defproc[(font [font font?]) void?]{ Sets the current @racket[font] to draw characters with when using the @racket[text] function. } @;; ---------------------------------------------------- @defproc[(font-sprite [char char?]) (or/c (listof byte?) #f)]{ Returns the sprite in the current @racket[font] for @racket[char] or @racket[#f] if no sprite exists for it. } @;; ---------------------------------------------------- @defproc[(font-advance) exact-nonnegative-integer?]{ Returns the cursor x advance value in pixels for the current @racket[font]. This is always the width of the font plus 1 pixel. } @;; ---------------------------------------------------- @defproc[(font-height) exact-nonnegative-integer?]{ Returns the line height in pixels for the current @racket[font]. The line height is always the number of scanlines of the first character sprite in the font plus 1 pixel. } @;; ---------------------------------------------------- @defthing[basic-font font?]{ The default font of 3x6 character sprites. } @;; ---------------------------------------------------- @defthing[tall-font font?]{ A font of 5x8 character sprites. } @;; ---------------------------------------------------- @defthing[wide-font font?]{ A font of 7x8 character sprites. } @;; ---------------------------------------------------- @section{Voices} All sounds (and music) are played using voices. A voice is both an "instrument" (wave function) and an "envelope" (volume function). @;; ---------------------------------------------------- @defproc[(voice [instrument procedure?] [envelope procedure?]) voice?]{ The @racket[instrument] function is like @racket[sin] or @racket[cos]. It is given a value in the range of @tt{[0.0, 2pi]} and returns a value in the range of @tt{[-1.0, 1.0]}. Aside from any built-in Racket functions (e.g. @racket[sin] and @racket[cos]) there are 4 other pre-defined wave functions you can use: @itemlist[ @item{@racket[sawtooth-wave]} @item{@racket[square-wave]} @item{@racket[triangle-wave]} @item{@racket[noise-wave]} ] Additionally, you can create your own wave functions (instruments) with the @racket[synth] macro. The @racket[envelope] function is used to set the volume of a sound over the duration of it. The @racket[envelope] function is given a single value in the range [@tt{0.0}, @tt{1.0}] indicating where in the sound it is. It should return a value in the range [@tt{0.0}, @tt{1.0}], where @tt{0.0} indicates a null amplitude and @tt{1.0} indicates full amplitude. Some pre-defined envelopes include: @itemlist[ @item{@racket[basic-envelope]} @item{@racket[fade-in-envelope]} @item{@racket[fade-out-envelope]} @item{@racket[z-envelope]} @item{@racket[s-envelope]} @item{@racket[peak-envelope]} @item{@racket[trough-envelope]} @item{@racket[adsr-envelope]} ] There is also an @racket[envelope] function that helps with the creation of your own envelopes. } @;; ---------------------------------------------------- @defproc[(voice? [x any]) boolean?]{Returns @racket[#t] if @racket[x] is a valid @racket[voice] object.} @;; ---------------------------------------------------- @defthing[basic-voice voice? #:value (voice sin basic-envelope)]{The default @racket[voice] used to create sounds.} @;; ---------------------------------------------------- @defform/subs[(synth (wave-function q) ...) ([wave-function procedure?] [q real?])]{ Creates a lambda function that is the combination of multiple @racket[wave-function]s at frequency harmonics, each muliplied by @racket[q]. Each @racket[wave-function] can be any function valid as the instrument of a @racket[voice]. Most common would be @racket[sin] and @racket[cos]. For each @racket[wave-function] there should also be a corresponding @racket[q] argument that is how much that wave function will be multiplied by. The wave functions are passed the frequency harmonic of the sound they are used for in the order they are provided to the @racket[synth] macro. For example, if the sound is playing a solid tone of 440 Hz, then the first wave function will be at 440 Hz, the second wave function at 880 Hz, the third at 1320 Hz, etc. For example: @racketblock[ (synth (sin 1.0) ; sin(x) * 1.0 (cos 0.3) ; cos(x * 2) * 0.3 (sin 0.1) ; sin(x * 3) * 0.1 (cos -0.3)) ; cos(x * 4) * -0.3 ] The above would be equivelant to the following wave function: @racketblock[ (λ (x) (+ (* (sin x) 1.0) (* (cos (* x 2)) 0.3) (* (sin (* x 3)) 0.1) (* (cos (* x 4)) -0.3))) ] The function returned takes the x argument, applies it to each of the harmonics and returns the sum of them. A simple online tool for playing with harmonic sound functions can be found at @url{https://meettechniek.info/additional/additive-synthesis.html}. @italic{TIP: Instead of just the generic sine and cosine functions, trying sythenizing with some other wave functions like triangle-wave and noise-wave!} } @;; ---------------------------------------------------- @defproc[(envelope [y real?] ...) procedure?]{Returns a function that can be used as the @racket[#:envelope] paramater to the @racket[sound] function. It builds a simple, evenly spaced, linearly interpolated plot of amplitude envelopes. For example, the @racket[z-envelope] is defined as: @racketblock[(define z-envelope (envelope 1 1 0 0))] This means that in the time range of [@tt{0.0}, @racket[0.33]] the sound will play at full amplitude. From [@racket[0.33], @racket[0.66]] the envelope will decay the amplitude linearly from @tt{1.0} down to @tt{0.0}. Finally, from [@racket[0.66], @tt{1.0}] the amplitude of the sound will be forced to @tt{0.0}. } @;; ---------------------------------------------------- @defthing[square-wave procedure?]{A wave function that may be passed as an instrument.} @;; ---------------------------------------------------- @defthing[triangle-wave procedure?]{A wave function that may be passed as an instrument.} @;; ---------------------------------------------------- @defthing[sawtooth-wave procedure?]{A wave function that may be passed as an instrument.} @;; ---------------------------------------------------- @defthing[noise-wave procedure?]{A wave function that may be passed as an instrument.} @;; ---------------------------------------------------- @defthing[basic-envelope procedure? #:value (const 1)]{An envelope function that may be passed as an envelope.} @;; ---------------------------------------------------- @defthing[fade-in-envelope procedure? #:value (envelope 0 1)]{An envelope function that may be passed as an envelope.} @;; ---------------------------------------------------- @defthing[fade-out-envelope procedure? #:value (envelope 1 0)]{An envelope function that may be passed as an envelope.} @;; ---------------------------------------------------- @defthing[z-envelope procedure? #:value (envelope 1 1 0 0)]{An envelope function that may be passed as an envelope.} @;; ---------------------------------------------------- @defthing[s-envelope procedure? #:value (envelope 0 0 1 1)]{An envelope function that may be passed as an envelope.} @;; ---------------------------------------------------- @defthing[peak-envelope procedure? #:value (envelope 0 1 0)]{An envelope function that may be passed as an envelope.} @;; ---------------------------------------------------- @defthing[trough-envelope procedure? #:value (envelope 1 0 1)]{An envelope function that may be passed as an envelope.} @;; ---------------------------------------------------- @defthing[adsr-envelope procedure? #:value (envelope 0 1 0.7 0.7 0)]{An envelope function that may be passed as an envelope. This is the default enevelope used for musical notes.} @;; ---------------------------------------------------- @section{Sound} All audio is played by composing 16-bit PCM WAV data using a @racket[voice]. Audio data that can be played is created using the @racket[sound] and @racket[music] functions. @;; ---------------------------------------------------- @defproc[(sound [curve procedure?] [seconds real?] [voice voice? basic-voice]) sound?]{ All sounds are made using the sound function. The @racket[curve] argument is a function that is given a single value in the range of [@tt{0.0}, @tt{1.0}] and should return a frequency to play at that time; @tt{0.0} is the beginning of the waveform and @tt{1.0} is the end. The seconds parameter defines the length of the waveform. The @racket[voice] is used to define the wave function and volume envelope used when generating the PCM data for this sound. It is optional, and the default voice is just a simple @racket[sin] wave and the @racket[basic-envelope]. } @;; ---------------------------------------------------- @defproc[(tone [freq real?] [seconds real?] [voice voice? basic-voice]) sound?]{ Helper function that returns a @racket[sound] that plays a constant frequency. } @;; ---------------------------------------------------- @defproc[(sweep [start-freq real?] [end-freq real?] [seconds real?] [voice voice? basic-voice]) sound?]{ Helper function that returns a @racket[sound] using a curve function that linearly interpolates from @racket[start-freq] to @racket[end-freq]. } @;; ---------------------------------------------------- @defproc[(play-sound [sound sound?]) void?]{ Queues the sound buffer to be played on one of 8 sound channels. If no sound channels are available then the sound will not be played. } @;; ---------------------------------------------------- @defproc[(stop-sound) void?]{Stops all sounds currently playing and clears the sound queue.} @;; ---------------------------------------------------- @defproc[(sound-volume [vol real?]) void?]{Sets the volume of all sounds played. @racket[0.0] is muted and @racket[100.0] is full volume.} @;; ---------------------------------------------------- @section{Music} Music is created by parsing notes and creating an individual waveform for each note, then combining them together into a single waveform to be played on a dedicated music channel. Only one "tune" can be playing at a time. @;; ---------------------------------------------------- @defproc[(music [notes string?] [#:tempo beats-per-minute exact-nonnegative-integer? 160] [#:voice voice? basic-note]) music?]{ Parses the @racket[notes] string and builds a waveform for each note. Notes are in the format @tt{<key>[<octave>][<hold>]}. For example: @itemlist[ @item{@racket["C#3--"] is a C-sharp in 3rd octave and held for a total of 3 quarter-notes time;} @item{@racket["Bb"] is a B-flat held for a single quarter-note and uses the octave of whatever note preceeded it;} ] The default octave is 4, but once an octave is specified for a note then that becomes the new default octave for subsequent notes. How long each note is held for (in seconds) is determined by the @racket[#:tempo] (beats per minute) parameter. A single beat is assumed to be a single quarter-note. So, with a little math, a @tt{"C#--"} at a rate of 160 BPM would play for 1.125 seconds (3 beats * 60 s/m ÷ 160 bpm). It is not possible to specify 1/8th and 1/16th notes. In order to achieve them, increase the @racket[#:tempo] appropriately. By default, the @racket[voice] used is the @racket[basic-note], which uses the @racket[adsr-envelope] function (ADSR stands for attack, decay, sustain, release). Unlike sounds, which use the envelope function across the entire sound, when generating music the envelope function is applied to each note. This is important to keep in mind if you decide to override the envelope with your own, as it's how each note can be distinguished from the next. } @;; ---------------------------------------------------- @defthing[basic-note voice? #:value (voice sin adsr-envelope)]{The default @racket[voice] used to create music.} @;; ---------------------------------------------------- @defproc[(music? [x any]) boolean?]{Returns @racket[#t] if @racket[x] is a PCM music object.} @;; ---------------------------------------------------- @defproc[(play-music [riff music?] [#:loop loop boolean? #t]) void?]{ Stops any music currently playing and starts playing @racket[riff]. The @racket[loop] parameter will determine whether the @racket[riff] stops or repeats when finished. } @;; ---------------------------------------------------- @defproc[(stop-music) void?]{Stops any music currently playing.} @;; ---------------------------------------------------- @defproc[(pause-music [pause boolean? #t]) void?]{If pause is @racket[#t] then the currently playing music is paused, otherwise it is resumed. If the music was not already pausedy and is told to resume, it will instead restart from the beginning.} @;; ---------------------------------------------------- @defproc[(music-volume [vol real?]) void?]{Sets the volume of any music played. @racket[0.0] is muted and @racket[100.0] is full volume.}
Racket
5
massung/r-cade
scribblings/r-cade.scrbl
[ "Apache-2.0" ]
import * as React from 'react'; import Box from '@mui/material/Box'; import Popper, { PopperPlacementType } from '@mui/material/Popper'; import Typography from '@mui/material/Typography'; import Grid from '@mui/material/Grid'; import Button from '@mui/material/Button'; import Fade from '@mui/material/Fade'; import Paper from '@mui/material/Paper'; export default function PositionedPopper() { const [anchorEl, setAnchorEl] = React.useState<HTMLButtonElement | null>(null); const [open, setOpen] = React.useState(false); const [placement, setPlacement] = React.useState<PopperPlacementType>(); const handleClick = (newPlacement: PopperPlacementType) => (event: React.MouseEvent<HTMLButtonElement>) => { setAnchorEl(event.currentTarget); setOpen((prev) => placement !== newPlacement || !prev); setPlacement(newPlacement); }; return ( <Box sx={{ width: 500 }}> <Popper open={open} anchorEl={anchorEl} placement={placement} transition> {({ TransitionProps }) => ( <Fade {...TransitionProps} timeout={350}> <Paper> <Typography sx={{ p: 2 }}>The content of the Popper.</Typography> </Paper> </Fade> )} </Popper> <Grid container justifyContent="center"> <Grid item> <Button onClick={handleClick('top-start')}>top-start</Button> <Button onClick={handleClick('top')}>top</Button> <Button onClick={handleClick('top-end')}>top-end</Button> </Grid> </Grid> <Grid container justifyContent="center"> <Grid item xs={6}> <Button onClick={handleClick('left-start')}>left-start</Button> <br /> <Button onClick={handleClick('left')}>left</Button> <br /> <Button onClick={handleClick('left-end')}>left-end</Button> </Grid> <Grid item container xs={6} alignItems="flex-end" direction="column"> <Grid item> <Button onClick={handleClick('right-start')}>right-start</Button> </Grid> <Grid item> <Button onClick={handleClick('right')}>right</Button> </Grid> <Grid item> <Button onClick={handleClick('right-end')}>right-end</Button> </Grid> </Grid> </Grid> <Grid container justifyContent="center"> <Grid item> <Button onClick={handleClick('bottom-start')}>bottom-start</Button> <Button onClick={handleClick('bottom')}>bottom</Button> <Button onClick={handleClick('bottom-end')}>bottom-end</Button> </Grid> </Grid> </Box> ); }
TypeScript
4
dany-freeman/material-ui
docs/data/material/components/popper/PositionedPopper.tsx
[ "MIT" ]
#Signature file v4.1 #Version 1.49
Standard ML
0
timfel/netbeans
platform/libs.jsr223/nbproject/org-netbeans-libs-jsr223.sig
[ "Apache-2.0" ]
etf load spy pred mc exit
Gosu
0
minhhoang1023/GamestonkTerminal
scripts/test_etf_pred.gst
[ "MIT" ]
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon")); var _jsxRuntime = require("react/jsx-runtime"); var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", { d: "M20 6h-8l-1.41-1.41C10.21 4.21 9.7 4 9.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm-8 9.79V14H9c-.55 0-1-.45-1-1s.45-1 1-1h3v-1.79c0-.45.54-.67.85-.35l2.79 2.79c.2.2.2.51 0 .71l-2.79 2.79c-.31.31-.85.09-.85-.36z" }), 'DriveFileMoveRounded'); exports.default = _default;
JavaScript
3
good-gym/material-ui
packages/material-ui-icons/lib/DriveFileMoveRounded.js
[ "MIT" ]
import React, {Component, PropTypes} from 'react' import MailMergeToken from './mail-merge-token' import {DragBehaviors} from './mail-merge-constants' import {tokenQuerySelector} from './mail-merge-utils' import ListensToMailMergeSession from './listens-to-mail-merge-session' /** * MailMergeBodyTokens are rendered by the OverlaidComponents component in the * subject and body of the composer. * The OverlaidComponents' state is effectively the state of the contenteditable * inside those fields, * and it decides what to render based on the * anchor (img) tags that are present in the contenteditable. * * Given this setup, we use the lifecycle methods of MailMergeBodyToken to keep * the state of the contenteditable (the tokens actually rendered in the UI), * in sync with our token state for mail merge (tokenDataSource) */ class MailMergeBodyToken extends Component { static displayName = 'MailMergeBodyToken' static propTypes = { className: PropTypes.string, tokenId: PropTypes.string, field: PropTypes.string, colName: PropTypes.string, sessionState: PropTypes.object, mailMergeSession: PropTypes.object, draftClientId: PropTypes.string, colIdx: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), isPreview: PropTypes.bool, } constructor(props) { super(props) this.state = this.getState(props) } componentDidMount() { // When the token gets mounted, it means a mail merge token anchor node was // added to the contenteditable, via drop, paste, or any other means, so we // add it to our mail merge state const {colIdx, field, colName, tokenId, mailMergeSession} = this.props const {tokenDataSource} = mailMergeSession.state const token = tokenDataSource.getToken(field, tokenId) if (!token) { mailMergeSession.linkToDraft({colIdx, field, colName, tokenId}) } } componentWillReceiveProps(nextProps) { this.setState(this.getState(nextProps, this.state.colIdx)) } shouldComponentUpdate(nextProps, nextState) { return ( this.props.isPreview !== nextProps.isPreview || this.state.colIdx !== nextState.colIdx || this.props.sessionState.selection !== nextProps.sessionState.selection || this.props.sessionState.tableDataSource !== nextProps.sessionState.tableDataSource || this.props.sessionState.tokenDataSource !== nextProps.sessionState.tokenDataSource ) } componentDidUpdate() { // A token might be removed by mutations to the contenteditable, in which // case the tokenDataSource's state is updated by componentWillUnmount. // // However, when a token is removed from state via other means, e.g. when a // table column is removed, we also want to make sure that we remove it from the // UI. Since the contenteditable is effectively the source of state for // OverlaidComponents, we imperatively remove the token from contenteditable // if it has been removed from our state. const {field, tokenId, sessionState: {tokenDataSource}} = this.props const token = tokenDataSource.getToken(field, tokenId) if (!token) { const node = document.querySelector(tokenQuerySelector(tokenId)) if (node) { node.parentNode.removeChild(node) } } } componentWillUnmount() { // A token might be removed by any sort of mutations to the contenteditable. // When an the actual anchor node in the contenteditable is removed from // the dom tree, OverlaidComponents will unmount our corresponding token, // so this is where we get to update our tokenDataSource's state const {field, tokenId, mailMergeSession} = this.props mailMergeSession.unlinkFromDraft({field, tokenId}) } getState(props) { // Keep colIdx as state in case the column changes index when importing a // new csv file, thus changing styling const {sessionState: {tokenDataSource}, field, tokenId} = props const nextToken = tokenDataSource.getToken(field, tokenId) if (nextToken) { const {colIdx, colName} = nextToken return {colIdx, colName} } const {colIdx, colName} = props return {colIdx, colName} } render() { const {colIdx, colName} = this.state const {className, draftClientId, sessionState, isPreview} = this.props const {tableDataSource, selection} = sessionState const selectionValue = tableDataSource.cellAt({rowIdx: selection.rowIdx, colIdx}) || "No value selected" if (isPreview) { return <span>{selectionValue}</span> } return ( <span className={className}> <MailMergeToken draggable colIdx={colIdx} colName={colName} dragBehavior={DragBehaviors.Move} draftClientId={draftClientId} > <span className="selection-value"> {selectionValue} </span> </MailMergeToken> </span> ) } } export default ListensToMailMergeSession(MailMergeBodyToken)
JSX
5
cnheider/nylas-mail
packages/client-app/internal_packages/composer-mail-merge/lib/mail-merge-body-token.jsx
[ "MIT" ]
;;; lang/yaml/config.el -*- lexical-binding: t; -*- (use-package! yaml-mode :mode "Procfile\\'" :init (when (featurep! +lsp) (add-hook 'yaml-mode-local-vars-hook #'lsp!)) :config (setq-hook! 'yaml-mode-hook tab-width yaml-indent-offset))
Emacs Lisp
4
leezu/doom-emacs
modules/lang/yaml/config.el
[ "MIT" ]
#!/bin/bash -xe YAML_FILENAME=verbatim-sources/workflows-pytorch-ge-config-tests.yml DIFF_TOOL=meld # Allows this script to be invoked from any directory: cd $(dirname "$0") pushd .. $DIFF_TOOL $YAML_FILENAME <(./codegen_validation/normalize_yaml_fragment.py < $YAML_FILENAME) popd
Shell
3
Hacky-DH/pytorch
.circleci/codegen_validation/compare_normalized_yaml.sh
[ "Intel" ]
/* eslint react/no-danger: 0 */ import React, {Component, PropTypes} from 'react' import {findDOMNode} from 'react-dom' import {EditorAPI} from 'nylas-exports' import {OverlaidComponents, DropZone} from 'nylas-component-kit' import ListensToMailMergeSession from './listens-to-mail-merge-session' import * as Handlers from './mail-merge-token-dnd-handlers' class MailMergeSubjectTextField extends Component { static displayName = 'MailMergeSubjectTextField' static containerRequired = false static propTypes = { value: PropTypes.string, fallback: PropTypes.func, draft: PropTypes.object, session: PropTypes.object, sessionState: PropTypes.object, draftClientId: PropTypes.string, onSubjectChange: PropTypes.func.isRequired, } componentDidMount() { const {isWorkspaceOpen} = this.props.sessionState this.savedSelection = null if (isWorkspaceOpen) { this.editor = new EditorAPI(findDOMNode(this.refs.contenteditable)) } } shouldComponentUpdate(nextProps) { return ( this.props.draftClientId !== nextProps.draftClientId || this.props.value !== nextProps.value || this.props.sessionState.isWorkspaceOpen !== nextProps.sessionState.isWorkspaceOpen ) } componentDidUpdate() { const {isWorkspaceOpen} = this.props.sessionState if (isWorkspaceOpen) { this.editor = new EditorAPI(findDOMNode(this.refs.contenteditable)) if (this.savedSelection && this.savedSelection.rawSelection.anchorNode) { this.editor.select(this.savedSelection) this.savedSelection = null } } } onInputChange = (event) => { const value = event.target.innerHTML this.savedSelection = this.editor.currentSelection().exportSelection() this.props.onSubjectChange(value) } onInputKeyDown = (event) => { if (['Enter', 'Return'].includes(event.key)) { event.stopPropagation() event.preventDefault() } } onDrop = (event) => { Handlers.onDrop('subject', {editor: this.editor, event}) } onDragOver = (event) => { Handlers.onDragOver({editor: this.editor, event}) } shouldAcceptDrop = (event) => { return Handlers.shouldAcceptDrop({event}) } focus() { const {isWorkspaceOpen} = this.props.sessionState if (isWorkspaceOpen) { findDOMNode(this.refs.contenteditable).focus() } else { this.refs.fallback.focus() } } renderContenteditable() { const {value} = this.props return ( <DropZone className="mail-merge-subject-text-field composer-subject subject-field" onDrop={this.onDrop} onDragOver={this.onDragOver} shouldAcceptDrop={this.shouldAcceptDrop} > <div ref="contenteditable" contentEditable name="subject" placeholder="Subject" onBlur={this.onInputChange} onInput={this.onInputChange} onKeyDown={this.onInputKeyDown} dangerouslySetInnerHTML={{__html: value}} /> </DropZone> ) } render() { const {isWorkspaceOpen} = this.props.sessionState if (!isWorkspaceOpen) { const Fallback = this.props.fallback return <Fallback ref="fallback" {...this.props} /> } const {draft, session} = this.props const exposedProps = {draft, session} return ( <OverlaidComponents className="mail-merge-subject-overlaid" exposedProps={exposedProps} > {this.renderContenteditable()} </OverlaidComponents> ) } } export default ListensToMailMergeSession(MailMergeSubjectTextField)
JSX
4
cnheider/nylas-mail
packages/client-app/internal_packages/composer-mail-merge/lib/mail-merge-subject-text-field.jsx
[ "MIT" ]
NAME ParaView::ServerManagerKit LIBRARY_NAME vtkPVServerManagerKit
Kit
0
xj361685640/ParaView
Kits/ServerManager/vtk.kit
[ "Apache-2.0", "BSD-3-Clause" ]
#!/bin/bash # The script builds the Deno package. rsync --archive --prune-empty-dirs --relative --exclude={'*.flow','benchmark.*','test.*','snapshot.md'} src/./ deno cp {CHANGELOG.md,LICENSE.md,typings.d.ts} deno yarn ts-node scripts/build/_lib/addDenoExtensions.ts
Shell
3
essana3/date-fns
scripts/build/deno.sh
[ "MIT" ]
package com.baeldung.ddd.order.doubledispatch; import java.util.List; import com.baeldung.ddd.order.OrderLine; import com.baeldung.ddd.order.doubledispatch.visitor.OrderVisitor; public class SpecialOrder extends Order { private boolean eligibleForExtraDiscount; public SpecialOrder(List<OrderLine> orderLines) { super(orderLines); this.eligibleForExtraDiscount = false; } public SpecialOrder(List<OrderLine> orderLines, boolean eligibleForSpecialDiscount) { super(orderLines); this.eligibleForExtraDiscount = eligibleForSpecialDiscount; } public boolean isEligibleForExtraDiscount() { return eligibleForExtraDiscount; } @Override protected double applyDiscountPolicy(SpecialDiscountPolicy discountPolicy) { return discountPolicy.discount(this); } @Override public void accept(OrderVisitor visitor) { visitor.visit(this); } }
Java
4
DBatOWL/tutorials
ddd/src/main/java/com/baeldung/ddd/order/doubledispatch/SpecialOrder.java
[ "MIT" ]
-- Unit tests for simple NOT IN with a literal expression of a single column -- -- More information can be found in not-in-unit-tests-single-column.sql. -- This file has the same test cases as not-in-unit-tests-single-column.sql with literals instead of -- subqueries. --CONFIG_DIM1 spark.sql.optimizeNullAwareAntiJoin=true --CONFIG_DIM1 spark.sql.optimizeNullAwareAntiJoin=false CREATE TEMPORARY VIEW m AS SELECT * FROM VALUES (null, 1.0), (2, 3.0), (4, 5.0) AS m(a, b); -- Uncorrelated NOT IN Subquery test cases -- Case 1 (not possible to write a literal with no rows, so we ignore it.) -- (empty subquery -> all rows returned) -- Case 2 -- (subquery includes null -> no rows returned) SELECT * FROM m WHERE a NOT IN (null); -- Case 3 -- (probe column is null -> row not returned) SELECT * FROM m WHERE b = 1.0 -- Only matches (null, 1.0) AND a NOT IN (2); -- Case 4 -- (probe column matches subquery row -> row not returned) SELECT * FROM m WHERE b = 3.0 -- Only matches (2, 3.0) AND a NOT IN (2); -- Case 5 -- (probe column does not match subquery row -> row is returned) SELECT * FROM m WHERE b = 3.0 -- Only matches (2, 3.0) AND a NOT IN (6);
SQL
5
OlegPt/spark
sql/core/src/test/resources/sql-tests/inputs/subquery/in-subquery/not-in-unit-tests-single-column-literal.sql
[ "Apache-2.0" ]
;----------------- Include Algorithms Library -------------------------------- __includes [ "A-star.nls" "LayoutSpace.nls"] ;--------------- Customizable Reports ------------------- ; These reports must be customized in order to solve different problems using the ; same A* function. ; Rules are represented by using lists [ "representation" cost f], where: ; - f allows to transform states (it is the transition function), ; - cost is the cost of applying the transition on a state, ; - and "representation" is a string to identify the rule. ; Un posible movimiento consiste en cambiar una carta de montón: to-report AI:children-states let cartas (n-values 10 [x -> x + 1]) report map [ i -> (list (change i) (list i 1))] cartas end ; Change i cambia la carta i de montón: to-report change [i] let M1 first content let M2 last content ifelse member? i M1 [report (list (sort remove i M1) (sort fput i M2))] [report (list (sort fput i M1) (sort remove i M2))] end ; final-state? is an agent report that identifies the final states for the problem. ; It usually will be a property on the content of the state (for example, if it is ; equal to the Final State). It allows the use of parameters because maybe the ; verification of reaching the goal depends on some extra information from the problem. to-report AI:final-state? [params] let M1 first content let M2 last content let suma ifelse-value (M1 = []) [0][sum M1] let prod ifelse-value (M2 = []) [0] [reduce * M2] report (abs (suma - 36) + abs (prod - 360) < 10) end ; Searcher report to compute the heuristic for this searcher to-report AI:heuristic [#Goal] let M1 first [content] of current-state let M2 last [content] of current-state let suma ifelse-value (M1 = []) [0][sum M1] let prod ifelse-value (M2 = []) [0] [reduce * M2] report abs (suma - 36) + abs (prod - 360) end to-report AI:equal? [a b] report a = b end ;-------------------------------------------------------------------------------- ; Auxiliary procedure to test the A* algorithm for sorting lists to test ca let M1 (n-values 10 [x -> x + 1]) let M2 n-of 4 M1 foreach M2 [ x -> set M1 remove x M1] Let Initial_State (list M1 M2) print (word "Initial State: " Initial_State) no-display ; We compute the path with A* let path (A* Initial_State true True True) layout-radial AI:states AI:transitions AI:state 0 style display ; if any, we highlight it if path != false [ ;repeat 1000 [layout-spring states links 1 3 .3] highlight-path path print (word "Actions to get it: " (map [ t -> first [rule] of t ] path)) let c [content] of ([end2] of last path) print (word "Current State: " c) set M1 first c set M2 last c let suma ifelse-value (M1 = []) [0][sum M1] let prod ifelse-value (M2 = []) [0] [reduce * M2] show suma show prod ] print (word (max [who] of turtles - count AI:states) " searchers used") print (word (count AI:states) " states created") end ; Auxiliary procedure the highlight the path when it is found. It makes use of reduce procedure with ; highlight report to highlight-path [path] foreach path [ t -> ask t [ set color red set thickness .4 ] ] end @#$#@#$#@ GRAPHICS-WINDOW 85 10 522 448 -1 -1 13.0 1 10 1 1 1 0 0 0 1 -16 16 -16 16 0 0 1 ticks 30.0 BUTTON 10 10 73 43 NIL test NIL 1 T OBSERVER NIL NIL NIL NIL 1 @#$#@#$#@ @#$#@#$#@ default true 0 Polygon -7500403 true true 150 5 40 250 150 205 260 250 circle false 0 Circle -7500403 true true 0 0 300 @#$#@#$#@ NetLogo 6.1.1 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ default 1.0 -0.2 0 0.0 1.0 0.0 1 1.0 0.0 0.2 0 0.0 1.0 link direction true 0 Line -7500403 true 150 150 90 180 Line -7500403 true 150 150 210 180 @#$#@#$#@ 1 @#$#@#$#@
NetLogo
5
fsancho/IA
03. Informed Search/A-star Problem Solver - Cartas.nlogo
[ "MIT" ]
use lib "$ENV{ANTELOPE}/data/perl" ; #This program is used to grab the pde format qed weekly #files from the site $remote_host and leave it in the directory #$qed_dir. This program will check the update times of files #on the remote site and compare that to the files in $qed_store. #If there are files to update they will be grabbed via the #Net:Ftp module. The local qed_weekly catalog will be #subset and inserts the new origins. #here are the modules we are going to be using .. #Net::Ping to see if the machine is accessable (no longer works 1/2004) #LWP to access the web , and see if the server is up #Datascope of course # Have to include these push statements to get all the modules I need. If # program is run without them I get error messages about not finding # the Net/FTP.pm, LWP/Simple.pm, and MIME/Base64.pm. use Datascope; use File::Basename; #use Net::Ping; use Net::FTP; use LWP::Simple; use Cwd; require "flush.pl"; require "css30.pl"; use Getopt::Std; require "pf2.pl"; if (! getopts('v') || @ARGV != 1 ) { &usage; } # get pf file from command line (or look down pf path) $Pf = $ARGV[0] ; if ( $Pf =~ /\.pf/) { print STDERR "\n Do not use the 'pf' extension when specifying the paramter file. \n"; &usage; } $Pf = $ARGV[0] . ".pf"; unless ( -e $Pf) { print STDERR "PFPATH - $ENV{PFPATH} \n" if $opt_v; @pf_dirs = split /:/, $ENV{PFPATH} ; print STDERR "@pf_dirs \n" if $opt_v; foreach $pf_dir (@pf_dirs) { $tmp_dir = $pf_dir . "/" . $Pf; print STDERR "$tmp_dir \n" if $opt_v; &eval_pf( $tmp_dir ) ; } } else { &eval_pf( $Pf ) ; } $mail_to = join(" ",@mail_to); print STDERR "mail_to is @mail_to \n" if $opt_v; &setup_global_vars; # if directories from setup_global_vars dont exist you need to make them &mk_qed_dir($qed_dir); &mk_store_dir($qed_store); &mk_temp_dir($qed_temp); open (MAILLOG, ">$mail_log") || die "Can't open $mail_log \n"; &log_mesg("Starting getter...\n"); # removed on 1/17/03 as the USGS seems to have disallowed ping if(&server_up){ &log_mesg("Server [$remote_host] is up\n"); # check for update files on remote server # if new files exist on remote site, retreive them and continue, # else exit now and don't update the local qed_weekly catalog, # convert retreived file to css format # check the new origin file for start/end times $ftp = Net::FTP->new("$remote_host") or die "Can't connect: $@ \n" ; $ftp->login("anonymous",$account) or die "Couldn't login \n"; # $remote_pwd = $ftp->pwd or die "Couldn't get remote pwd. \n"; # print STDERR "CWD on $remote_host is: $remote_pwd\n"; $ftp->cwd("$remote_dir") or die "Couldn't change to directory $remote_dir. \n"; $ftp->binary; @listing = $ftp->dir or die "Couldn't get file listing on remote machine\n"; &check_remote_list; # check to see if remote site has newer file than local qed file # and retreive it $ftp->quit; &log_mesg("Done with ftp. \n"); $num2convert = @convert_list; # quit if there are no files to work on if ($num2convert == 0) { &log_failure_and_die("No files to update. Exiting... \n"); } $c_cnt = 0; while ($c_cnt < $num2convert) { $file2convert = $convert_list[$c_cnt]; &log_mesg("Going to run convert file for $file2convert. \n"); # Don't process ehdf.doc file if ($file2convert =~ /doc\b/) { &log_mesg("$file2convert is not a valid qed weekly file. This file will not be converted. \n"); ++$c_cnt; next; } #need to strip .dat from $file2convert so that new_css can be of the form 1999807w ($basename,$ext) = split (/\./,$file2convert); # remove extension with split $base = basename($basename); $new_css = $qed_temp.$base; if (! -e $new_css) { &log_mesg("No descriptor file for $new_css, creating. \n"); dbcreate("$new_css","css3.0","$qed_temp\{$base}"); } if ($file2convert =~ /qedevents/) { # the qed2origin program isn't working since y2k, file2convert will never be qedevents.txt &log_mesg("Run $qed2tables2 for $file2convert. \n"); print STDERR "$qed2tables2 $fullyear $qed_store$base.$ext $new_css \n" if $opt_v; &log_mesg("$qed2tables2 $fullyear $qed_store$base.$ext $new_css \n") if $opt_v; &safe_exec("$qed2tables2 $fullyear $qed_store$base.$ext $new_css") ; } else { print STDERR "$qed2tables $qed_store$base.$ext $new_css -auth $author \n" if $opt_v; &log_mesg("Running $qed2tables for $qed_store$base.$ext. \n"); $output = `$qed2tables $qed_store$base.$ext $new_css -auth $author \n`; } if ($output ne "") { &log_mesg("pde2origin ERROR for $base: \n $output \n"); return; } # check db for start/end times @db2add = dbopen($new_css,"r"); @db2add_origin = dblookup(@db2add,"","origin","",""); #get min and max times of origins to be added $min_otime =dbex_eval(@db2add_origin, "min(time)"); $max_otime =dbex_eval(@db2add_origin, "max(time)"); print STDERR "\nLooking to add origins from:", &strydtime($min_otime), "to:", &strydtime($max_otime), " \n\n" if ($opt_v || $opt_V); @qed = dbopen($qed_catalog,"r+"); @qed_or = dblookup(@qed,"","origin","",""); $qed_recs = dbquery (@qed_or,"dbRECORD_COUNT"); print STDERR "Number of records in current qed_weekly bulletin: $qed_recs\n" if ($opt_v || $opt_V); @dbcheck = dblookup(@qed_or,"","origin","","dbSCRATCH"); $nrows = dbquery (@db2add_origin,"dbRECORD_COUNT"); print STDERR "Number of records that might be added: $nrows \n" if ($opt_v || $opt_V); for ($row = 0; $row < $nrows; $row++) { $db2add_origin[3] = $row ; $record = dbget(@db2add_origin); print "Record is: $record\n" if $opt_V; @or_record = split(//,$record); dbput(@dbcheck,$record); # find any matching rows in existing qed bulletin @matchall = dbmatches(@dbcheck,@qed_or, "chkor","lat","lon","time","depth","ml","mb","ms","ndef","evid"); if ($#matchall != -1) { # Found a matching record, no need to update print STDERR "Found matching record with no updates needed\n" if ($opt_v || $opt_V) ; next; } else { #Either record is completely new, or you need to update a # pre-existing qed record if there has been a change to # lat/lon/time/depth/mag print STDERR "All fields of this record do not match.\n" if ($opt_v || $opt_V) ; # @matchsome = dbmatches(@dbcheck,@qed_or,"chkor2","evid"); @matchsome = dbmatches(@dbcheck,@qed_or,"chkor2"); if ($#matchsome != -1) { # Need to update values to pre-existing event print STDERR "Updating fields for an event\n" if ($opt_v ||$opt_V); # $qed_or[3] = $matchsome[0]; dbput(@qed_or,$record); } else { # we have a new record print STDERR "Adding new record to origin table for an event\n" if ($opt_v || $opt_V); eval { dbadd(@qed_or,$record) } ; if ($@) { warn $@; print STDERR "Duplicate origin matches pre-existing origin. Will ignore\n" if ($opt_v || $opt_V); } } } } dbclose @db2add; print STDERR "Number of records in earlier qed bulletin: $qed_recs\n" if ($opt_v || $opt_V); $nrows2 = dbquery(@qed_or,"dbRECORD_COUNT"); print STDERR "Number of records in final pde bulletin: $nrows2 \n" if ($opt_v || $opt_V); dbclose @pde; ++$c_cnt; } } else { &log_mesg("Server [$remote_host] is down.\n"); } &tidy_up; # Here are all the subroutines sub usage { print STDERR <<END; \nUSAGE: \t$0 [-v] parameter_file END exit(1); } sub setup_global_vars{ ($thismonth) = (localtime)[4]; ($thisyear) = (localtime)[5]; # change thismonth from 0-11 to 1-12 convention $thismonth = $thismonth + 1; $fullyear = $thisyear + 1900 ; # EDIT THESE VARIABLES $qed2tables2 = "$ENV{ANTELOPE}/bin/qed2oribin"; #path to qed2origin print STDERR "Account is $account from pf $Pf. \n" if $opt_v; # QED PICKUP (should not need modification) # $remote_host = "gldfs.cr.usgs.gov"; $remote_host = "ghtftp.cr.usgs.gov"; # $remote_dir = "weekly/"; $remote_dir = "pub/weekly/"; # LOCAL STORAGE DIRECTORIES AND LOGS (modify if needed) $qed_store = $qed_dir."qed_store/"; $qed_temp = $qed_dir."temp/"; $temp_qed = $qed_temp."temp_qed"; $qed_catalog = $qed_dir."qed_weekly"; $log_file = $qed_dir."weekly.log"; $mail_log = $qed_dir."mail.log"; $opened_log = 0; $recs_b4 = 0; $recs_after = 0; $recs_removed = 0; $table = ".origin"; @convert_list = (); } sub safe_exec { # run system cmds safely my ( $cmd ) = @_ ; # &log_mesg ("$cmd \n") ; print STDERR "safe_exec cmd is $cmd \n" if $opt_v; system ( $cmd ) ; if ($?) { print STDERR "$cmd error $? \n" if $opt_v ; &log_prob_and_die("$cmd error $? \n"); # print STDERR "$cmd error $? \n"; &bad_exit(); } } sub bad_exit { my $cmd; print MAILLOG "Check errors in $mail_log and $log_file \n"; close (MAILLOG) ; $cmd = "mailx -s \"PROBLEMS - $0 \" $mail_to < $mail_log"; print STDERR "$cmd \n" if $opt_v; if ($mail_to) { &safe_exec($cmd) ; if ($?) { print STDERR "$cmd error $? \n"; &log_mesg ("$cmd error $? \n"); } } exit(1); } sub mk_temp_dir { # mk qed temp dir my ( $qed_temp ) = @_ ; my ( $mkdir ); if (-W $qed_temp) { return; } else { &log_mesg("mk_temp_dir $qed_temp\n") ; $mkdir = "mkdir -p $qed_temp"; &safe_exec( $mkdir ); return; } } sub mk_store_dir { # mk qed store dir my ( $qed_store ) = @_ ; my ( $mkdir ); if (-W $qed_store) { return; } else { &log_mesg("mk_store_dir $qed_store \n"); $mkdir = "mkdir -p $qed_store"; &safe_exec( $mkdir ); return; } } sub mk_qed_dir { # mk qed dir my ( $qed_dir ) = @_ ; my ( $mkdir ); # check to see if qed_dir exists and that it is writable (cant use log_mesg because log does not exist) if (-W $qed_dir) { return; } else { print STDERR "Default qed dir does not exist, creating.\n" if $opt_v; $mkdir = "mkdir -p $qed_dir"; print STDERR "Going to run safe_exec for $mkdir \n" if $opt_v; &safe_exec( $mkdir ); return; } } sub server_up{ # This check has been phased out as over the years # pingecho, Net:Ping, and unix ping have all been blocked. # Now, I just assume that the system is up and attempt to # get files I want... $timeout = 10; # The pingecho command stopped working ~8/24/1999. # I have no idea why. # if(pingecho($remote_host, $timeout)){ # return 1; # } else { # return 0; # } # Tried to get Net::Ping to work but unsuccessful. # $p = Net::Ping->new("tcp", 2); # $epi = "epicenter.ucsd.edu"; # if ($p->ping($epi)) { # print STDERR "$epi is alive and well.\n"; # } else { # print STDERR "Your ping of $epi did not work.\n"; # } # print "$epi is alive according to pingecho.\n" if pingecho($epi); # # if ($p->ping($remote_host)) { # return 1; # } else { # return 0; # } # $p->close(); # Going to use safe_exec to run unix ping. # $pingme = "/usr/sbin/ping $remote_host"; # &log_mesg("$pingme\n"); # $ping_out = system( $pingme ); # ping returns 0 if machine is up, non-zero if problem $ping_out = 0; unless ($ping_out) { &log_mesg("Assuming sys is alive, so set server_up to 1.\n"); return 1; } else { # Until they allow ping-ing again, you'll never get here without # some code re-write. &log_mesg("sys is dead, so set server_up to 0.\n"); return 0; } } sub log_mesg{ my($log_prob) = $_[0]; if(!$opened_log){ open(LOGFILE, ">>$log_file") || (print STDERR "CAN'T OPEN LOGFILE\n"); $opened_log = 1; } #set up the time in a nice format for output to the log file $prob_time = substr(strtime(time),0,-4); print LOGFILE "$prob_time\t$log_prob"; flush(LOGFILE); } sub tidy_up{ my $cmd; &log_mesg("Cleaning up $qed_temp\n"); # change to figure out why qedevents.txt is not added properly $rm_origin = "/usr/bin/rm -r $qed_temp/e*"; # system("\rm -r $qed_temp/e*"); &safe_exec ($rm_origin); &log_mesg("Exiting $0\n"); print MAILLOG "Finished with $0. Verify that catalog looks ok.\n"; print MAILLOG "\n Files retreived from $remote_host include: @convert_list.\n"; close(MAILLOG); $cmd = "mailx -s \"QED weekly catalog updated \" $mail_to < $mail_log"; if ($mail_to) { system ($cmd) ; if ($?) { print STDERR "$cmd error $? \n"; } } close(LOGFILE); exit(0); } sub check_remote_list { foreach (@listing) { (@lsout) = split(/\s+/, $_); if ($lsout[0] =~ /total/) { next; # } elsif ($lsout[8] =~ /ehdf|qedevents/) { # qedevents.txt contains updated qed, but not yet weekly files } elsif ($lsout[8] =~ /ehdf/) { # removed qedevents.txt becauase of y2k probs. $file = $lsout[8] or die "Couldn't find file name for @lsout \n"; $upd_mo = $lsout[5]; $upd_dy = $lsout[6]; $upd_t_yr = $lsout[7]; # looks like it will be year if time is gt 6 months previous to now, time if less than 6 mos. if (length $upd_t_yr != 4) { # get the abbreviated month names mapped to 1-12 numeric months %mo_names = ( Jan => 1, Feb => 2, Mar => 3, Apr => 4, May => 5, Jun => 6, Jul => 7, Aug => 8, Sep => 9, Oct => 10, Nov => 11, Dec => 12, ); $num_mo = $mo_names{$upd_mo}; if ($num_mo <= $thismonth) { $upd_yr = $fullyear; } else { --$upd_yr; } # need to get abreviated month converted to 1-12 and current month converted to 1-12. # if ab_month >1 and < cur_month than set upd_yr = this_yr # else set upd_yr = this_yr - 1 $upd_time = $upd_t_yr; } else { $upd_yr = $upd_t_yr; $upd_time = "00:00:00"; $num_mo = $mo_names{$upd_mo}; } # get last update time of remote file (this could be replaced by an ftp->mdtm if permissions allow) $last_remote_update = str2epoch("$upd_mo $upd_dy $upd_yr $upd_time") || die "Couldn't find last update time of $file \n"; print STDERR "checking file: $file \n" if $opt_v; # $last_remote_update = $ftp->mdtm( $test_run ) || die "Couldn't get modify time on remote $file \n"; # print STDERR "$last_remote_update \n" || die "Can't get last_remote_update time.\n" ; $gzipfile = $qed_store.$file.".gz"; if (-e $qed_store.$file) { $local_update = (stat("$qed_store$file"))[9] || die "Couldn't find last update time for $qed_store$file \n"; print STDERR "file: $file \n\tlast remote update: $last_remote_update last local update: $local_update\n" if $opt_v; if ($local_update < $last_remote_update) { &get_remote_file; next; } else { &log_mesg("No change to file $file. \n"); } } elsif (-e $gzipfile) { # add check to see if gzipped file exists $local_update = (stat("$gzipfile"))[9] || die "Couldn't find last update time for $gzipfile \n"; if ($local_update < $last_remote_update) { &get_remote_file; next; } else { &log_mesg("No change to file $file. \n"); } } else { &log_mesg("File $file does not exist locally, grabbing it. \n"); &get_remote_file; next; #else close } } else { &log_mesg("no ehdf match for $lsout[8] \n") ; next; } #foreach close } } sub get_remote_file { &log_mesg("Retreiving file $file from $remote_host .\n"); $ftp->get($file,$qed_store.$file) || die "Can't retreive file $file from $remote_host or store it as $qed_store.$file.\n"; @convert_list = (@convert_list, $qed_store.$file); } sub log_failure_and_die { my($problem) = $_[0]; &log_mesg($problem); print MAILLOG "\n\t $problem \n"; close MAILLOG ; print STDERR "$problem \n"; $cmd = "mailx -s \"NO UPDATE- $0 \" $mail_to < $mail_log" ; if ($mail_to) { system($cmd); if ($?) { print STDERR "$cmd error $? \n"; } } exit(1); } sub log_prob_and_die{ my($problem) = $_[0]; &log_mesg($problem); print MAILLOG "Check errors in $mail_log and $log_file \n"; print MAILLOG "\n\t $problem \n"; close MAILLOG ; print STDERR "$problem \n"; $cmd = "mailx -s \"PROBLEMS - $0 \" $mail_to < $mail_log" ; if ($mail_to) { system($cmd); if ($?) { print STDERR "$cmd error $? \n"; } } exit(1); }
XProc
4
jreyes1108/antelope_contrib
nobuild/bin/import/update_weekly_qed/update_weekly_qed.xpl
[ "BSD-2-Clause", "MIT" ]
pytorch { local: *4llvm*; };
Linker Script
0
Hacky-DH/pytorch
caffe2/version_script.lds
[ "Intel" ]
Module: OLE-Automation Synopsis: Macro to define a COM dual interface. Author: David N. Gray Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc. All rights reserved. License: See License.txt in this distribution for details. Warranty: Distributed WITHOUT WARRANTY OF ANY KIND define macro dual-interface-definer { define ?modifiers:* dual-interface ?class-name:name (?superclass:name) ?slots-and-stuff:* end } => { define ?modifiers dispatch-interface ?class-name ## "+dispatch" (?superclass) ?slots-and-stuff end; define inline-only constant ?class-name ## "+dispatch-vstruct" :: <type> = ?superclass ## "-vstruct"; define ?modifiers custom-interface ?class-name (?class-name ## "+dispatch") ?slots-and-stuff end; define dual-type-info "$" ## ?class-name ## "-dual-type" (?superclass) dispatch-type type-information(?class-name ## "+dispatch"); ?slots-and-stuff end; define inline method vtable-type-information (x :: subclass(?class-name)) => ( result :: <dual-type-info> ) "$" ## ?class-name ## "-dual-type" end; define inline method type-information (x :: subclass(?class-name)) => ( result :: <dual-type-info> ) "$" ## ?class-name ## "-dual-type" end; } end macro dual-interface-definer; define C-struct <IDispatch>-vstruct sealed inline-only slot vtbl-unknown :: <IUnknown>-vstruct, getter: #f, setter: #f; sealed inline-only slot vtbl-GetTypeInfoCount :: <C-function-pointer>; sealed inline-only slot vtbl-GetTypeInfo :: <C-function-pointer>; sealed inline-only slot vtbl-GetIDsOfNames :: <C-function-pointer>; sealed inline-only slot vtbl-Invoke :: <C-function-pointer>; end C-struct; define constant <simple-dispatch>-vstruct :: <type> = <IDispatch>-vstruct; define inline sealed sideways method dummy-value-for-type ( type == <BSTR> ) => ( value :: <BSTR> ); $NULL-BSTR end; define macro dual-type-info-definer { define ?modifiers:* dual-type-info ?variable-name:name (?supertype:expression) dispatch-type ?disptype:expression; ?slots-and-stuff:* end } => { define internal-vtable-type-info ?variable-name (?supertype) typeinfo-class { <dual-type-info> }; class-options { dispatch: ?disptype }; typeinfo { ?slots-and-stuff }; members { ?slots-and-stuff }; end; } end macro; define generic dispatch-type-information (interface :: type-union(<Interface>, <class>)) => (result :: false-or(<LPTYPEINFO>)); define inline method dispatch-type-information (cls :: <class>) => (info :: singleton(#f)) #f end; define inline method dispatch-type-information (cls :: subclass(<IDispatch>)) => ( info :: false-or(<LPTYPEINFO>) ) let typeinfo = type-information(cls); typeinfo & dispatch-type-information(typeinfo) end; define inline method dispatch-type-information (obj :: <IDispatch>) => (info :: false-or(<LPTYPEINFO>) ) dispatch-type-information(object-class(obj)); end; define inline method dispatch-type-information (info :: <dylan-type-info>) => (info :: singleton(#f)) #f end; define inline method dispatch-type-information (info :: <disp-type-info> ) => (info :: <disp-type-info>) info end; define COM-interface <dual-type-info> ( <vtable-type-info> ) constant slot dispatch-type-information :: <LPTYPEINFO>, required-init-keyword: dispatch:; end <dual-type-info>; // From MSDN documentation: // // By default, the TYPEKIND enumeration for a dual interface is // TKIND_INTERFACE. Tools that bind to interfaces should check the type // flags for TYPEFLAG_FDUAL. If this flag is set, the TKIND_DISPATCH type // description is available through a call to // ITypeInfo::GetRefTypeOfImplType with an index of -1, followed by a call // to ITypeInfo::GetRefTypeInfo. define method initialize(this :: <dual-type-info>, #rest args, #key, #all-keys) => (); next-method(); IUnknown/AddRef(this.dispatch-type-information); this.type-flags := logior(this.type-flags, $TYPEFLAG-FDUAL, $TYPEFLAG-FOLEAUTOMATION); end method initialize; define method terminate(this :: <dual-type-info>) => (); next-method(); IUnknown/Release(this.dispatch-type-information); end method terminate; define constant $href-dispatch = $href-inherited + 1; // arbitrary key define method ITypeInfo/GetRefTypeOfImplType(this :: <dual-type-info>, index == -1 ) => (status :: <HRESULT>, reftype :: <integer>); values( $S-OK, $href-dispatch ) end; define method ITypeInfo/GetRefTypeInfo(this :: <dual-type-info>, hreftype == $href-dispatch) => (status :: <HRESULT>, ptinfo :: <LPTYPEINFO>); let typeinfo = this.dispatch-type-information; IUnknown/AddRef(typeinfo); values( $S-OK, typeinfo ) end;
Dylan
4
kryptine/opendylan
sources/ole/ole-automation/dual.dylan
[ "BSD-2-Clause" ]
breed [AI:GNGNeurons AI:GNGNeuron] breed [data datum] undirected-link-breed [AI:GNGLinks AI:GNGLink] AI:GNGNeurons-own [ AI:weight AI:error ] AI:GNGLinks-own [ AI:age ] globals [ Lambda edad_max alpha beta eps_w eps_n M step ] to setup ca ask patches [set pcolor white] ; Create Data ;setup-data setup-GNG reset-ticks tick end to setup-GNG ; Parameters of the Algorithm set Lambda 20 set edad_max 15 set alpha 0.5 set beta 0.0005 set eps_w 0.05 set eps_n 0.005 set M 1000 ; Create starting GNG-graph let N1 createGNGNeuron (list random-xcor random-ycor) 0 let N2 createGNGNeuron (list random-xcor random-ycor) 0 connectGNG N1 N2 0 end to-report take-one-data create-data 2 [ rt random 360 fd random-normal 5 .5 ;setxy xcor ycor * .5 set color [255 0 0 30] set shape "circle" set size .3 ] create-data 1 [ set xcor random-normal 0 .5 set heading 0 fd random-ycor set color [255 0 0 30] set shape "circle" set size .3 ] report one-of data end to GNG ;let u nobody ;; Para reducir el coste de calcular u en la creación de nodos if count AI:GNGNeurons > M [stop] let x take-one-data let BMU min-one-of AI:GNGNeurons [distance x] let SMU min-one-of (AI:GNGNeurons with [self != BMU]) [distance x] ask BMU [ set AI:error AI:error + (distance x) ^ 2 face x fd (distance x) * eps_w ask my-AI:GNGLinks [ set AI:age AI:age + 1 ifelse AI:age > edad_max [ die ] [ ask other-end [ face x fd (distance x) * eps_n ] ] ] ] let l (AI:link BMU SMU) ifelse l != nobody [ ask l [ set AI:age 0 ] ] [ connectGNG BMU SMU 0 ] ;let max_error 0 ;; Para reducir el coste de calcular u en la creación de nodos ask AI:GNGNeurons [ set AI:Error AI:Error * (1 - beta) if (not any? AI:GNGLink-neighbors) [die] ;if max_error < AI:error [set u self set max_error AI:error] ;; Para reducir el coste de calcular u en la creación de nodos ] if ticks mod Lambda = 0 and (count AI:GNGNeurons < M) [ let WMU max-one-of AI:GNGNeurons [AI:Error] ;; Comentar para reducir el coste de calcular u en la creación de nodos let SWMU max-one-of ([AI:GNGLink-neighbors] of WMU) [AI:Error] let xr ([xcor] of WMU + [xcor] of SWMU) / 2 let yr ([ycor] of WMU + [ycor] of SWMU) / 2 ask AI:link WMU SWMU [die] let EWMU 0 let ESWMU 0 ask WMU [set AI:Error AI:Error * alpha set EWMU AI:Error] ask SWMU [set AI:Error AI:Error * alpha set ESWMU AI:Error] let r createGNGNeuron (list xr yr) ((ESWMU + EWMU) / 2) connectGNG WMU r 0 connectGNG SWMU r 0 ] ask data [die] tick end to-report AI:link [u v] report AI:GNGlink ([who] of u) ([who] of v) end to-report createGNGNeuron [W Er] let rep nobody create-AI:GNGNeurons 1 [ set AI:Weight W set AI:error Er set rep self set color [0 0 255 50] set shape "circle" setxy (first W) (last W) set size .5 ] report rep end to connectGNG [N1 N2 age] ask N1 [ create-AI:GNGLink-with N2 [ set AI:age age ] ] end to diversity ask AI:GNGNeurons [ ask other AI:GNGNeurons with [distance myself < 10 ^ -3] [die] ] ; Distancias entre todos los nodos let d (reduce sentence map [y -> map [x -> [distance x] of y] (sort AI:GNGNeurons with [who > [who] of y])] (sort AI:GNGNeurons)) ; Distancia mínima desde cada nodo ;let d map [x -> min [distance x] of (AI:GNGNeurons with [self != x])] (sort AI:GNGNeurons) histogram d end @#$#@#$#@ GRAPHICS-WINDOW 210 10 647 448 -1 -1 13.0 1 10 1 1 1 0 0 0 1 -16 16 -16 16 1 1 1 ticks 30.0 BUTTON 8 10 100 43 NIL Setup NIL 1 T OBSERVER NIL NIL NIL NIL 1 BUTTON 104 10 189 43 NIL GNG T 1 T OBSERVER NIL NIL NIL NIL 1 MONITOR 27 53 162 98 Graph Size count AI:GNGNeurons 17 1 11 PLOT 648 10 1136 160 Distancias internas NIL NIL 0.0 1.0 0.0 10.0 true false "" "" PENS "default" 0.01 0 -16777216 true "" "" BUTTON 649 161 728 194 NIL diversity NIL 1 T OBSERVER NIL NIL NIL NIL 1 @#$#@#$#@ ## WHAT IS IT? (a general understanding of what the model is trying to show or explain) ## HOW IT WORKS (what rules the agents use to create the overall behavior of the model) ## HOW TO USE IT (how to use the model, including a description of each of the items in the Interface tab) ## THINGS TO NOTICE (suggested things for the user to notice while running the model) ## THINGS TO TRY (suggested things for the user to try to do (move sliders, switches, etc.) with the model) ## EXTENDING THE MODEL (suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.) ## NETLOGO FEATURES (interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features) ## RELATED MODELS (models in the NetLogo Models Library and elsewhere which are of related interest) ## CREDITS AND REFERENCES (a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links) @#$#@#$#@ default true 0 Polygon -7500403 true true 150 5 40 250 150 205 260 250 airplane true 0 Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15 arrow true 0 Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150 box false 0 Polygon -7500403 true true 150 285 285 225 285 75 150 135 Polygon -7500403 true true 150 135 15 75 150 15 285 75 Polygon -7500403 true true 15 75 15 225 150 285 150 135 Line -16777216 false 150 285 150 135 Line -16777216 false 150 135 15 75 Line -16777216 false 150 135 285 75 bug true 0 Circle -7500403 true true 96 182 108 Circle -7500403 true true 110 127 80 Circle -7500403 true true 110 75 80 Line -7500403 true 150 100 80 30 Line -7500403 true 150 100 220 30 butterfly true 0 Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240 Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240 Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163 Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165 Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225 Circle -16777216 true false 135 90 30 Line -16777216 false 150 105 195 60 Line -16777216 false 150 105 105 60 car false 0 Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180 Circle -16777216 true false 180 180 90 Circle -16777216 true false 30 180 90 Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89 Circle -7500403 true true 47 195 58 Circle -7500403 true true 195 195 58 circle false 0 Circle -7500403 true true 0 0 300 circle 2 false 0 Circle -7500403 true true 0 0 300 Circle -16777216 true false 30 30 240 cow false 0 Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167 Polygon -7500403 true true 73 210 86 251 62 249 48 208 Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123 cylinder false 0 Circle -7500403 true true 0 0 300 dot false 0 Circle -7500403 true true 90 90 120 face happy false 0 Circle -7500403 true true 8 8 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240 face neutral false 0 Circle -7500403 true true 8 7 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Rectangle -16777216 true false 60 195 240 225 face sad false 0 Circle -7500403 true true 8 8 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183 fish false 0 Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166 Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165 Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60 Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166 Circle -16777216 true false 215 106 30 flag false 0 Rectangle -7500403 true true 60 15 75 300 Polygon -7500403 true true 90 150 270 90 90 30 Line -7500403 true 75 135 90 135 Line -7500403 true 75 45 90 45 flower false 0 Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135 Circle -7500403 true true 85 132 38 Circle -7500403 true true 130 147 38 Circle -7500403 true true 192 85 38 Circle -7500403 true true 85 40 38 Circle -7500403 true true 177 40 38 Circle -7500403 true true 177 132 38 Circle -7500403 true true 70 85 38 Circle -7500403 true true 130 25 38 Circle -7500403 true true 96 51 108 Circle -16777216 true false 113 68 74 Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218 Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240 house false 0 Rectangle -7500403 true true 45 120 255 285 Rectangle -16777216 true false 120 210 180 285 Polygon -7500403 true true 15 120 150 15 285 120 Line -16777216 false 30 120 270 120 leaf false 0 Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195 Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195 line true 0 Line -7500403 true 150 0 150 300 line half true 0 Line -7500403 true 150 0 150 150 pentagon false 0 Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120 person false 0 Circle -7500403 true true 110 5 80 Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90 Rectangle -7500403 true true 127 79 172 94 Polygon -7500403 true true 195 90 240 150 225 180 165 105 Polygon -7500403 true true 105 90 60 150 75 180 135 105 plant false 0 Rectangle -7500403 true true 135 90 165 300 Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285 Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285 Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210 Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135 Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135 Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60 Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90 sheep false 15 Circle -1 true true 203 65 88 Circle -1 true true 70 65 162 Circle -1 true true 150 105 120 Polygon -7500403 true false 218 120 240 165 255 165 278 120 Circle -7500403 true false 214 72 67 Rectangle -1 true true 164 223 179 298 Polygon -1 true true 45 285 30 285 30 240 15 195 45 210 Circle -1 true true 3 83 150 Rectangle -1 true true 65 221 80 296 Polygon -1 true true 195 285 210 285 210 240 240 210 195 210 Polygon -7500403 true false 276 85 285 105 302 99 294 83 Polygon -7500403 true false 219 85 210 105 193 99 201 83 square false 0 Rectangle -7500403 true true 30 30 270 270 square 2 false 0 Rectangle -7500403 true true 30 30 270 270 Rectangle -16777216 true false 60 60 240 240 star false 0 Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108 target false 0 Circle -7500403 true true 0 0 300 Circle -16777216 true false 30 30 240 Circle -7500403 true true 60 60 180 Circle -16777216 true false 90 90 120 Circle -7500403 true true 120 120 60 tree false 0 Circle -7500403 true true 118 3 94 Rectangle -6459832 true false 120 195 180 300 Circle -7500403 true true 65 21 108 Circle -7500403 true true 116 41 127 Circle -7500403 true true 45 90 120 Circle -7500403 true true 104 74 152 triangle false 0 Polygon -7500403 true true 150 30 15 255 285 255 triangle 2 false 0 Polygon -7500403 true true 150 30 15 255 285 255 Polygon -16777216 true false 151 99 225 223 75 224 truck false 0 Rectangle -7500403 true true 4 45 195 187 Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194 Rectangle -1 true false 195 60 195 105 Polygon -16777216 true false 238 112 252 141 219 141 218 112 Circle -16777216 true false 234 174 42 Rectangle -7500403 true true 181 185 214 194 Circle -16777216 true false 144 174 42 Circle -16777216 true false 24 174 42 Circle -7500403 false true 24 174 42 Circle -7500403 false true 144 174 42 Circle -7500403 false true 234 174 42 turtle true 0 Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210 Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105 Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105 Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87 Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210 Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99 wheel false 0 Circle -7500403 true true 3 3 294 Circle -16777216 true false 30 30 240 Line -7500403 true 150 285 150 15 Line -7500403 true 15 150 285 150 Circle -7500403 true true 120 120 60 Line -7500403 true 216 40 79 269 Line -7500403 true 40 84 269 221 Line -7500403 true 40 216 269 79 Line -7500403 true 84 40 221 269 wolf false 0 Polygon -16777216 true false 253 133 245 131 245 133 Polygon -7500403 true true 2 194 13 197 30 191 38 193 38 205 20 226 20 257 27 265 38 266 40 260 31 253 31 230 60 206 68 198 75 209 66 228 65 243 82 261 84 268 100 267 103 261 77 239 79 231 100 207 98 196 119 201 143 202 160 195 166 210 172 213 173 238 167 251 160 248 154 265 169 264 178 247 186 240 198 260 200 271 217 271 219 262 207 258 195 230 192 198 210 184 227 164 242 144 259 145 284 151 277 141 293 140 299 134 297 127 273 119 270 105 Polygon -7500403 true true -1 195 14 180 36 166 40 153 53 140 82 131 134 133 159 126 188 115 227 108 236 102 238 98 268 86 269 92 281 87 269 103 269 113 x false 0 Polygon -7500403 true true 270 75 225 30 30 225 75 270 Polygon -7500403 true true 30 75 75 30 270 225 225 270 @#$#@#$#@ NetLogo 6.1.1 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ default 0.0 -0.2 0 0.0 1.0 0.0 1 1.0 0.0 0.2 0 0.0 1.0 link direction true 0 Line -7500403 true 150 150 90 180 Line -7500403 true 150 150 210 180 @#$#@#$#@ 0 @#$#@#$#@
NetLogo
5
fsancho/IA
11. Machine Learning/Growing Neural Gas/GNG.nlogo
[ "MIT" ]
# frozen_string_literal: true module ELFTools # Define common methods for dynamic sections and dynamic segments. # # @note # This module can only be included by {ELFTools::Sections::DynamicSection} # and {ELFTools::Segments::DynamicSegment} because methods here assume some # attributes exist. module Dynamic # Iterate all tags. # # @note # This method assume the following methods already exist: # header # tag_start # @yieldparam [ELFTools::Dynamic::Tag] tag # @return [Enumerator<ELFTools::Dynamic::Tag>, Array<ELFTools::Dynamic::Tag>] # If block is not given, an enumerator will be returned. # Otherwise, return array of tags. def each_tags(&block) return enum_for(:each_tags) unless block_given? arr = [] 0.step do |i| tag = tag_at(i).tap(&block) arr << tag break if tag.header.d_tag == ELFTools::Constants::DT_NULL end arr end # Use {#tags} to get all tags. # @return [Array<ELFTools::Dynamic::Tag>] # Array of tags. def tags @tags ||= each_tags.to_a end # Get a tag of specific type. # @param [Integer, Symbol, String] type # Constant value, symbol, or string of type # is acceptable. See examples for more information. # @return [ELFTools::Dynamic::Tag] The desired tag. # @example # dynamic = elf.segment_by_type(:dynamic) # # type as integer # dynamic.tag_by_type(0) # the null tag # #=> #<ELFTools::Dynamic::Tag:0x0055b5a5ecad28 @header={:d_tag=>0, :d_val=>0}> # dynamic.tag_by_type(ELFTools::Constants::DT_NULL) # #=> #<ELFTools::Dynamic::Tag:0x0055b5a5ecad28 @header={:d_tag=>0, :d_val=>0}> # # # symbol # dynamic.tag_by_type(:null) # #=> #<ELFTools::Dynamic::Tag:0x0055b5a5ecad28 @header={:d_tag=>0, :d_val=>0}> # dynamic.tag_by_type(:pltgot) # #=> #<ELFTools::Dynamic::Tag:0x0055d3d2d91b28 @header={:d_tag=>3, :d_val=>6295552}> # # # string # dynamic.tag_by_type('null') # #=> #<ELFTools::Dynamic::Tag:0x0055b5a5ecad28 @header={:d_tag=>0, :d_val=>0}> # dynamic.tag_by_type('DT_PLTGOT') # #=> #<ELFTools::Dynamic::Tag:0x0055d3d2d91b28 @header={:d_tag=>3, :d_val=>6295552}> def tag_by_type(type) type = Util.to_constant(Constants::DT, type) each_tags.find { |tag| tag.header.d_tag == type } end # Get tags of specific type. # @param [Integer, Symbol, String] type # Constant value, symbol, or string of type # is acceptable. See examples for more information. # @return [Array<ELFTools::Dynamic::Tag>] The desired tags. # # @see #tag_by_type def tags_by_type(type) type = Util.to_constant(Constants::DT, type) each_tags.select { |tag| tag.header.d_tag == type } end # Get the +n+-th tag. # # Tags are lazy loaded. # @note # This method assume the following methods already exist: # header # tag_start # @note # We cannot do bound checking of +n+ here since the only way to get size # of tags is calling +tags.size+. # @param [Integer] n The index. # @return [ELFTools::Dynamic::Tag] The desired tag. def tag_at(n) return if n.negative? @tag_at_map ||= {} return @tag_at_map[n] if @tag_at_map[n] dyn = Structs::ELF_Dyn.new(endian: endian) dyn.elf_class = header.elf_class stream.pos = tag_start + n * dyn.num_bytes dyn.offset = stream.pos @tag_at_map[n] = Tag.new(dyn.read(stream), stream, method(:str_offset)) end private def endian header.class.self_endian end # Get the DT_STRTAB's +d_val+ offset related to file. def str_offset # TODO: handle DT_STRTAB not exitsts. @str_offset ||= @offset_from_vma.call(tag_by_type(:strtab).header.d_val.to_i) end # A tag class. class Tag attr_reader :header # @return [ELFTools::Structs::ELF_Dyn] The dynamic tag header. attr_reader :stream # @return [#pos=, #read] Streaming object. # Instantiate a {ELFTools::Dynamic::Tag} object. # @param [ELF_Dyn] header The dynamic tag header. # @param [#pos=, #read] stream Streaming object. # @param [Method] str_offset # Call this method to get the string offset related # to file. def initialize(header, stream, str_offset) @header = header @stream = stream @str_offset = str_offset end # Some dynamic have name. TYPE_WITH_NAME = [Constants::DT_NEEDED, Constants::DT_SONAME, Constants::DT_RPATH, Constants::DT_RUNPATH].freeze # Return the content of this tag records. # # For normal tags, this method just return # +header.d_val+. For tags with +header.d_val+ # in meaning of string offset (e.g. DT_NEEDED), this method would # return the string it specified. # Tags with type in {TYPE_WITH_NAME} are those tags with name. # @return [Integer, String] The content this tag records. # @example # dynamic = elf.segment_by_type(:dynamic) # dynamic.tag_by_type(:init).value # #=> 4195600 # 0x400510 # dynamic.tag_by_type(:needed).value # #=> 'libc.so.6' def value name || header.d_val.to_i end # Is this tag has a name? # # The criteria here is if this tag's type is in {TYPE_WITH_NAME}. # @return [Boolean] Is this tag has a name. def name? TYPE_WITH_NAME.include?(header.d_tag) end # Return the name of this tag. # # Only tags with name would return a name. # Others would return +nil+. # @return [String, nil] The name. def name return nil unless name? Util.cstring(stream, @str_offset.call + header.d_val.to_i) end end end end
Ruby
5
rmNULL/brew
Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/elftools-1.1.2/lib/elftools/dynamic.rb
[ "BSD-2-Clause" ]
#lang scribble/base @(require scriblib/figure scriblib/footnote scribble/manual "defs.rkt" "bib.rkt" scribble-latex-utils/utils) @title[#:tag "sec:surface"]{Growing a Surface Language} Cur provides an object language with no more convenience than Curnel. It contains only features necessary for expressivity and nothing that is macro expressible in terms of other features@~citea{felleisen1990expressive}. By contrast, Gallina, the core language of Coq, includes extensions that are macro expressible in terms of other features, such as a non-dependent arrow and multi-arity functions. Let us now take on the role of a Cur user (more precisely, an extension author) and begin implementing a surface language. We begin by implementing the simple syntactic sugar like the non-dependent arrow notation. We then implement more sophisticated syntax sugar: we implement a @racket[let] form with optional type annotations, and a pattern matching form for eliminating inductive types. We conclude with some extensions that go beyond syntax---extensions that add compile-time behaviors but do not necessarily generate code, like debugging features and staged meta-programming. @section{Simple Syntax} @subsubsub*section*{Alias for @code{(Type 0)}} Writing @code{(Type 0)} for all these examples is somewhat tedious. We start with a simple example macro that elaborates @code{Type} to @code{(Type 0)}. Eventually, a more sophisticated extension could resolve all universe levels automatically, but this will do for now. First, let us import a renamed copy of the default form: @racketblock[ require only-in curnel Type default-Type ] Next we define a simple macro with two syntaxes: one applied to an argument, one without any argument. In the first case, we simply expand to the default form. In the second case, we provide level @racket[0] as a default. Note that the choice of surface syntax does not affect how we write syntax objects. @racketblock[ define-syntax (Type syn) syntax-case syn () [(Type i) #'(default-Type i)] [Type #'(default-Type 0)] ] @subsubsub*section*{Multi-Arity Syntax} Cur provides only single-arity functions in the base language. As mentioned in @secref{sec:cur}, we can redefine existing forms like function and application syntax, so we redefine them to support multi-arity functions via automatic currying. First, let us import renamed copies of the default forms: @racketblock[ require only-in curnel #%app default-app λ default-λ ] With these renamed copies, we can redefine @racket[#%app] and @racket[λ] while still generating code that uses the original forms. Next, we define a simple recursive macro for @racket[λ] that curries all arguments using @racket[default-λ]. @racketblock[ define-syntax λ syntax-rules (:) [(λ b) b] [(λ (a : t) (ar : tr) ... b) (default-λ (a : t) (λ (ar : tr) ... b))] define-syntax lambda make-rename-transformer #'λ ] The @racket[syntax-rules] form is similar to @racket[syntax-case], but specialized to support writing simple syntactic rewrites rather than arbitrary metalanguage computation. The syntax @racket[...] is part of the pattern and template languages for syntax objects. In a pattern, it matches a list of the preceding pattern. In a template, it splices in the list indicated by the preceding pattern. Next, we redefine application. The macro automatically curries applications using @racket[default-app]. @racketblock[ define-syntax #%app syntax-rules () [(#%app e1 e2) (default-app e1 e2)] [(#%app e1 e2 e3 ...) (#%app (#%app e1 e2) e3 ...)] ] These forms are automatically integrated into the object language, replacing the old forms, and are ready to use even later in the same module: @racketblock[ define id $ lambda (A : Type) (a : A) a id Nat z ] @subsubsub*section*{Non-dependent Arrow Syntax} Now let us define a non-dependent arrow form. We start by defining a single-arity arrow syntax @racket[arrow]: @RACKETBLOCK[ define-syntax (arrow syn) syntax-case syn () [(arrow t1 t2) #`(Π (#,(gensym) : t1) t2)] ] Note that in Cur we must explicitly generate a fresh name using @racket[gensym], due to a limitation in the representation of names in our object language. We use syntax quasiquote @racket[#`code:blank] to create a syntax template that supports escaping to compute parts of the template, and use syntax unquote @RACKET[#,code:blank] to escape the template and run metalanguage expressions. Now we can easily define the multi-arity arrow, with both ASCII and unicode names. @#reader scribble/comment-reader (racketblock define-syntax -> syntax-rules () [(-> a) a] [(-> a a* ...) (arrow a (-> a* ...))] define-syntax → make-rename-transformer(#'->) ;; Usage: data Nat : 0 Type z : Nat s : {Nat → Nat} ) @subsubsub*section*{Top-level Function Definition Syntax} Writing top-level function definitions using @racket[lambda] is verbose. Most languages features special syntax for conveniently defining top-level functions, so let us add this to Cur: @racketblock[ define-syntax define syntax-rules (:) [(define (id (x : t) ...) body) (default-define id (lambda (x : t) ... body))] [(define id body) (default-define id body)] define (id (A : Type) (a : A)) a ] @subsubsub*section*{Notation for Formal Models and Proofs} Recall that our original goal was to provide better support for user-defined notation in formal models and proofs. Thus far, we have merely defined a surface language, which users should not be expected to do. However, the same language-extension facilities serve both purposes. As language implementers, we use language extension to build a surface language. As users, we use language extension to define our own notation---and we have the same power as language implementers when defining new notation. For instance, suppose we as a user model the simply-typed λ-calculus. After writing a small-step evaluation relation and a type-checking relation, we want to use standard notation while doing proofs about the model. We define this notation as follows: @racketblock[ define-syntax-rule (↦ e1 e2) (steps-to e1 e2) define-syntax ⊢ syntax-rules (:) [(⊢ Γ e : t) (type-checks Γ e t)] define-syntax nfx syntax-rules (⊢ :) [(nfx Γ ⊢ e : t) (⊢ Γ e : t)] ] The form @racket[define-syntax-rule] is simply syntax sugar using @racket[define-syntax] followed by @racket[syntax-rules]. The @code{nfx} macro is used by the sweet-expression reader to extend the reader with new infix notation. The reader can automatically parse some infix notation, but the @code{type-checks} notation is irregular so we define the @code{nfx} macro to assist the reader. Now we can use the notation to state a lemma: @racketblock[ define lemma:type-preservation (forall (e1 : STLC-Term) (e2 : STLC-Term) (Γ : STLC-Env) (t : STLC-Type) {{Γ ⊢ e1 : t} -> {e1 ↦ e2} -> {Γ ⊢ e2 : t}}) ] The sweet-expression reader provides some support for infix notation, but other work has implemented more sophisticated support for non-s-expression based syntax extensions. @citeta{rafkind2012} used the extensible reader to implement syntax-extension for algebraic notation. Other work has even developed language-extension via syntactic macros based on parsing expression grammars, rather than on pre-parsed s-expressions representations@~citea{allen2009growing}. @section{Sophisticated Syntax} The extensions in the previous section are simple syntactic rewrites, but recall that our goal is to support @emph{sophisticated} user-defined extensions. The extensions we study in this section use metalanguage computation to compute parts of the object language code. @subsubsub*section*{Let Syntax} Let us begin by defining @racket[let] in terms of application. Note that a proper dependent @racket[let] requires changing the type system, so this @racket[let] is only a programming convenience. We define the @racket[let] construct with two syntaxes: one expects a type annotation, while the other attempts to infer the type. In the first syntax, when there is a type annotation, we manually type check the annotated term before generating code so that we can report an error in the surface syntax. In the second syntax, when there is no annotation, we attempt to infer a type and report an error if we cannot. @RACKETBLOCK[ define-syntax (let syn) syntax-case syn (: =) [(let ([x = e : t]) body) (unless (cur-type-check? #'e #'t) (error 'let "~a does not have expected type ~a" #'e #'t) #'((λ (x : t) body) e))] [(let ([x = e]) body) (unless (cur-type-infer #'e) (error 'let "Could not infer type for ~a; ~a" #'e "try adding annotation via [x = e : t]") #`((λ (x : #,cur-type-infer(#'e)) body) e))] ] Pattern variables are only bound inside syntax templates, so we use syntax quote to refer @racket[e] and @racket[t] in metalanguage code. The metalanguage function @code{error} takes a symbol naming the form in which the error occurred, a format string where @code{~a} is a formatting escape, and a list of arguments for the format string. Syntax objects have associated source location information, so we could even report error messages with the file name and line number of the @racket[let] expression, but we omit this for clarity. @subsubsub*section*{Pattern Matching Syntax} @figure**["fig:match" "A Pattern Matcher for Inductive Types" @#reader scribble/comment-reader #:escape-id UNSYNTAX (RACKETBLOCK define-syntax (match syn) syntax-case syn () ; expects discriminant @racket[e] and list of clauses @racket[clause*] (_ e clause* ...) let* ([clauses (map clause-parse (syntax->list #'(clause* ...)))] [R (infer-result clauses)] [D (cur-type-infer #'e)] [motive #`(lambda (x : #,D) #,R)]) #`(elim #,D #,motive #,(map (curry clause->method D motive) clauses) e) define-syntax (recur syn) syntax-case syn () (_ id) dict-ref ih-dict $ syntax->datum #'id begin-for-syntax define-struct clause (args body) define ih-dict (make-hash) define (clause-parse syn) syntax-case syn (pattern body) make-clause (syntax-case pattern (:) [c '()] [(c (x : t) ...) (syntax->list #'((x : t) ...))]) #'body define (infer-result clauses) for/or ([clause clauses]) cur-type-infer $ clause-body clause define (infer-ihs D motive args-syn) syntax-case args-syn () .... ; D needed to detect recursive arguments ; motive needed to compute type of inductive hypotheses define (clause->method D motive clause) let* ([ihs (infer-ihs D motive (clause-args clause))]) dict-for-each ihs lambda (k v) dict-set! ih-dict k $ car v #`(lambda #,@clause-args(clause) #,@(dict-map ihs (lambda (k v) #`(#,(car v) : #,(cdr v)))) #,clause-body(clause)) )] Recall the addition function for natural number we defined in @secref{sec:curnel}, which we redefine as @racket[+] below: @racketblock[ define (+ [n1 : Nat] [n2 : Nat]) elim Nat lambda (x : Nat) Nat (n2 lambda (x : Nat) (ih : Nat) $ s ih) n1 ] This version of @racket[+] is easier to read and write now that we have multi-arity functions, but still requires a lot of annotations and other syntactic overhead. Instead, we would like to define @racket[plus] using pattern matching and to avoid writing obvious annotations, like the motive, when they can be inferred. We would like to define @racket[plus], for instance, like so: @racketblock[ define (+ [n1 : Nat] [n2 : Nat]) match n1 z n2 (s (x : Nat)) s $ recur x ] In this definition we use @racket[match], which we present shortly. The @racket[match] form automatically infers the motive, the annotations on @racket[elim], and inductive hypotheses. It also provides the @racket[recur] form to allows users to refer to generated inductive hypotheses by the name of the recursive argument from which they are derived. @Figure-ref{fig:match} presents the definition of the @racket[match] extension. This simplified version demonstrates how to coordinate two different extensions, namely the @racket[match] and @racket[recur] forms, and how to generate and compose multiple syntax templates. It makes use of nontrivial metalanguage features, like state and user-defined datatypes structures. We omit parts of the implementation that do not contribute to the goal of demonstrating these features, and features like error checking code. Recall that @racket[...] is an identifier used in patterns and templates, so we use @racket[....] to indicate omitted code. First, we transform the syntax representing a sequence of clauses into a list of syntax using @racket[syntax->list]. We parse each clause into a structure using @racket[clause-parse]. Each clauses consist of a pattern and a body. The pattern must be either a constructor name for constructors that take no arguments, or a constructor name followed by names with type annotations for all arguments to the constructor. We store the list of arguments and the body of the clause in a clause structure, to be used when generating methods for the eliminator. After parsing each clause, we compute the motive. The body of the motive is the type @racket[R] of the result of the @racket[match], and the argument to the motive has type @racket[D] of the discriminant. Note that in this implementation, we do not attempt to handle indexed or parameterized inductive types. The full implementation can infer parameters and some indexed inductive types and supports optional annotation syntax for when inference fails. Finally, we generate a method for each clause using @racket[clause->method]. While generating methods, we infer which arguments are recursive arguments and compute the inductive hypotheses. We update a compile-time dictionary @racket[ih-dict] that associates the name of the recursive argument to the generated name for that inductive hypothesis. The @racket[recur] form looks up its argument in @racket[ih-dict]. @section{Beyond Syntax} Thus far, all our examples demonstrate syntactic transformations. Our sophisticated language-extension system also supports creating syntactic forms that have semantic behavior at compile-time and do not necessarily generate object language code. For example, we can create a type assertion form that allows users to check that an expression has a particular type and receive a type error if not: @#reader scribble/comment-reader (racketblock define-syntax (:: syn) syntax-case syn () (_ e t) if $ cur-type-check? #'e #'t #'(void) (error ':: "Inferred ~a; expected ~a." #'t (cur-type-infer #'e)) ; Usage: {z :: Nat} ) We check during expansion that @racket[e] has type @racket[t]. If the check succeeds, we generate the no-op expression @racket[#'(void)]. If the check fails, it reports an error similar to what we do for checking annotations in the @racket[let] form. This form has no behavior in the object language but provides extra behavior at compile-time to support debugging. We can also create a syntactic form that forces normalization at compile-time: @racketblock[ define-syntax (run syn) syntax-case syn () (_ expr) $ cur-normalize #'expr ] The @racket[run] form does not provide new syntactic sugar, but transforms the syntax by normalization via the reflection API. This can be used to simplify proofs or perform staged meta-programming. For example, we specialize the exponentiation function @racket[exp] to the @racket[square] function at compile-time: @racketblock[ define square $ run $ exp (s (s z)) ]
Racket
5
bluephoenix47/cic-redex
cur-paper/syntax-sugar.scrbl
[ "BSD-2-Clause" ]
/* * Copyright (C) 2012 The Guava Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.common.testing; import static com.google.common.truth.Truth.assertThat; import com.google.common.base.Predicates; import com.google.common.collect.ImmutableList; import java.util.Arrays; import java.util.List; import junit.framework.TestCase; /** * Unit tests for {@link AbstractPackageSanityTests}. * * @author Ben Yu */ public class AbstractPackageSanityTestsTest extends TestCase { /* * This is a public type so that the Android test runner can create an instance directly as it * insists upon doing. It then runs the test, which behaves exactly like this package's existing * PackageSanityTests. (The test would run on the JVM, too, if not for the suppression below, and * that would be a problem because it violates small-test rules. Note that we strip the * suppression externally, but it's OK because we don't enforce test-size rules there.) * * We'd just use PackageSanityTests directly, saving us from needing this separate type, but we're * currently skipping MediumTests on Android, and we skip them by not making them present at * runtime at all. I could just make _this_ test a MediumTest, but then it wouldn't run on * Android.... The right long-term fix is probably to get MediumTests running under Android by * default and then suppress them strategically as needed. */ public static final class ConcretePackageSanityTests extends AbstractPackageSanityTests {} private final AbstractPackageSanityTests sanityTests = new ConcretePackageSanityTests(); public void testFindClassesToTest_testClass() { assertThat(findClassesToTest(ImmutableList.of(EmptyTest.class))).isEmpty(); assertThat(findClassesToTest(ImmutableList.of(EmptyTests.class))).isEmpty(); assertThat(findClassesToTest(ImmutableList.of(EmptyTestCase.class))).isEmpty(); assertThat(findClassesToTest(ImmutableList.of(EmptyTestSuite.class))).isEmpty(); } public void testFindClassesToTest_noCorrespondingTestClass() { assertThat(findClassesToTest(ImmutableList.of(Foo.class))).containsExactly(Foo.class); assertThat(findClassesToTest(ImmutableList.of(Foo.class, Foo2Test.class))) .containsExactly(Foo.class); } public void testFindClassesToTest_publicApiOnly() { sanityTests.publicApiOnly(); assertThat(findClassesToTest(ImmutableList.of(Foo.class))).isEmpty(); assertThat(findClassesToTest(ImmutableList.of(PublicFoo.class))).contains(PublicFoo.class); } public void testFindClassesToTest_ignoreClasses() { sanityTests.ignoreClasses(Predicates.<Object>equalTo(PublicFoo.class)); assertThat(findClassesToTest(ImmutableList.of(PublicFoo.class))).isEmpty(); assertThat(findClassesToTest(ImmutableList.of(Foo.class))).contains(Foo.class); } public void testFindClassesToTest_ignoreUnderscores() { assertThat(findClassesToTest(ImmutableList.of(Foo.class, Foo_Bar.class))) .containsExactly(Foo.class, Foo_Bar.class); sanityTests.ignoreClasses(AbstractPackageSanityTests.UNDERSCORE_IN_NAME); assertThat(findClassesToTest(ImmutableList.of(Foo.class, Foo_Bar.class))) .containsExactly(Foo.class); } public void testFindClassesToTest_withCorrespondingTestClassButNotExplicitlyTested() { assertThat(findClassesToTest(ImmutableList.of(Foo.class, FooTest.class), "testNotThere")) .containsExactly(Foo.class); assertThat(findClassesToTest(ImmutableList.of(Foo.class, FooTest.class), "testNotPublic")) .containsExactly(Foo.class); } public void testFindClassesToTest_withCorrespondingTestClassAndExplicitlyTested() { ImmutableList<Class<?>> classes = ImmutableList.of(Foo.class, FooTest.class); assertThat(findClassesToTest(classes, "testPublic")).isEmpty(); assertThat(findClassesToTest(classes, "testNotThere", "testPublic")).isEmpty(); } public void testFindClassesToTest_withCorrespondingTestClass_noTestName() { assertThat(findClassesToTest(ImmutableList.of(Foo.class, FooTest.class))) .containsExactly(Foo.class); } static class EmptyTestCase {} static class EmptyTest {} static class EmptyTests {} static class EmptyTestSuite {} static class Foo {} static class Foo_Bar {} public static class PublicFoo {} static class FooTest { @SuppressWarnings("unused") // accessed reflectively public void testPublic() {} @SuppressWarnings("unused") // accessed reflectively void testNotPublic() {} } // Shouldn't be mistaken as Foo's test static class Foo2Test { @SuppressWarnings("unused") // accessed reflectively public void testPublic() {} } private List<Class<?>> findClassesToTest( Iterable<? extends Class<?>> classes, String... explicitTestNames) { return sanityTests.findClassesToTest(classes, Arrays.asList(explicitTestNames)); } }
Java
5
ksodhi2/guava
guava-testlib/test/com/google/common/testing/AbstractPackageSanityTestsTest.java
[ "Apache-2.0" ]
<div class="options_container_arrow_overlay"></div> <div class="options_data"> <div class="title"> <div class="title_content"> <div class="version"><img src="images/db.png" class="layers" />RethinkDB {{version}}</div> <span class="title_text">Web UI Settings</span> </div> </div> <div class="options_content"> <div class="toggle-primary"> <div class="switch"> <input type="radio" class="switch-input" name="updates" value="yes" id="updates_yes" {{#if check_update}}checked{{/if}}> <label for="updates_yes" class="switch-label switch-label-off">Yes</label> <input type="radio" class="switch-input" name="updates" value="no" id="updates_no" {{#unless check_update}}checked{{/unless}}> <label for="updates_no" class="switch-label switch-label-on">No</label> <span class="switch-selection"></span> </div> </div> <div class="description">Automatically look for updates to RethinkDB</div> </div> </div>
Handlebars
4
zadcha/rethinkdb
admin/static/handlebars/options_view.hbs
[ "Apache-2.0" ]
''********************************************************************************** ''*This Demo turns on the iPod, plays for 10 seconds, * ''* stops, and then turns the iPod off. See iPod.spin documentation. * ''********************************************************************************** OBJ iPod : "iPod.spin" CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 Tx = 0 Rx = 1 PUB Trial iPod.Initialize(Rx,Tx) 'Always call this method first repeat 2 iPod.iPodOn 'Sometimes you need to send a command twice waitcnt(clkfreq + cnt) iPod.Play iPod.Release 'Always send a release command after any other command repeat 10 waitcnt(clkfreq + cnt) iPod.Stop iPod.Release waitcnt(clkfreq + cnt) iPod.iPodOff iPod.Release
Propeller Spin
4
deets/propeller
libraries/community/p1/All/iPod/iPodTrial.spin
[ "MIT" ]
# docker > 도커 컨테이너들과 이미지들을 관리한다. > 더 많은 정보: <https://docs.docker.com/engine/reference/commandline/cli/>. - 현재 실행중인 도커 컨테이너들 목록보기: `docker ps` - 모든 도커 컨테이너들(실행중이고 중지된) 목록 보기: `docker ps -a` - 사용자 정의 이름으로 이미지로부터 컨테이너 실행: `docker run --name {{컨테이너_이름}} {{이미지}}` - 기존 컨테이너 실행 또는 중지하기: `docker {{실행|중지}} {{컨테이너_이름}}` - 도커 레지스트리로부터 이미지 가져오기: `docker pull {{이미지}}` - 이미 실행중인 컨테이너 내부에서 쉘 열기: `docker exec -it {{컨테이너_이름}} {{쉘}}` - 중지된 컨테이너 제거하기: `docker rm {{컨테이너_이름}}` - 컨테이너 로그를 가져오고 팔로우하기: `docker logs -f {{컨테이너_이름}}`
Markdown
3
pavelshtanko/tldr
pages.ko/common/docker.md
[ "CC-BY-4.0" ]