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
|
---|---|---|---|---|---|
@echo off
rem
rem Installation script for CK packages.
rem
rem See CK LICENSE.txt for licensing details.
rem See CK Copyright.txt for copyright details.
rem
rem Developer(s): Grigori Fursin, 2017
rem
rem PACKAGE_DIR
rem INSTALL_DIR
rem get eigen and protobuf
cd /d %INSTALL_DIR%\src
git submodule update --init -- third_party\eigen
git submodule update --init -- third_party\protobuf
if "%BUILD_PYTHON%" == "ON" (
git submodule update --init -- third_party\pybind11
echo.
echo You are compiling Caffe2 with Python support!
echo To use it you need to set up CK env as following ^(after installation^)^:
echo.
echo ck xset env tags=lib,caffe2 & call tmp-ck-env.bat & ipython2
echo.
set /p id="Press enter to continue"
)
cd /d %INSTALL_DIR%\obj
echo **************************************************************
echo Building protobuf for Caffe 2 ...
cmake %INSTALL_DIR%\src\third_party\protobuf\cmake ^
-G"%CK_CMAKE_GENERATOR%" ^
-DCMAKE_BUILD_TYPE:STRING=%CMAKE_CONFIG% ^
-DCMAKE_INSTALL_PREFIX=. ^
-Dprotobuf_BUILD_TESTS=OFF ^
-DCMAKE_BUILD_TYPE=Debug
msbuild INSTALL.vcxproj
exit /b 1
echo **************************************************************
echo Preparing vars for Caffe 2 ...
set CK_CXX_FLAGS_FOR_CMAKE=
set CK_CXX_FLAGS_ANDROID_TYPICAL=
set CK_CMAKE_EXTRA=%CK_CMAKE_EXTRA% ^
-DCMAKE_BUILD_TYPE:STRING=%CMAKE_CONFIG% ^
-DCMAKE_VERBOSE_MAKEFILE=1 ^
-DBUILD_TEST=OFF ^
-DBLAS=%WHICH_BLAS% ^
-DUSE_THREADS=%USE_THREADS% ^
-DUSE_NERVANA_GPU=%USE_NERVANA_GPU% ^
-DUSE_GLOG=OFF ^
-DUSE_GFLAGS=OFF ^
-DUSE_LMDB=OFF ^
-DUSE_LEVELDB=OFF ^
-DUSE_LITE_PROTO=%USE_LITE_PROTO% ^
-DUSE_NCCL=%USE_NCCL% ^
-DUSE_NNPACK=%USE_NNPACK% ^
-DUSE_OPENCV=OFF ^
-DUSE_CUDA=%USE_CUDA% ^
-DUSE_CNMEM=%USE_CNMEM% ^
-DUSE_ZMQ=%USE_ZMQ% ^
-DUSE_ROCKSDB=%USE_ROCKSDB% ^
-DUSE_REDIS=%USE_REDIS% ^
-DUSE_MPI=%USE_MPI% ^
-DUSE_GLOO=%USE_GLOO% ^
-DBUILD_SHARED_LIBS=OFF ^
-DUSE_OPENMP=%USE_OPENMP% ^
-DBUILD_PYTHON=%BUILD_PYTHON% ^
-DBUILD_BINARY=OFF ^
-DBUILD_TEST=%BUILD_TEST% ^
-DPROTOBUF_PROTOC_EXECUTABLE="%CK_ENV_LIB_PROTOBUF_HOST%\bin\protoc.exe" ^
-DGFLAGS_INCLUDE_DIR="%CK_ENV_LIB_GFLAGS_INCLUDE%" ^
-DGFLAGS_LIBRARY_RELEASE="%CK_ENV_LIB_GFLAGS_LIB%\gflags.lib" ^
-DGFLAGS_LIBRARY_DEBUG="%CK_ENV_LIB_GFLAGS_LIB%\gflags.lib" ^
-DGLOG_INCLUDE_DIR="%CK_ENV_LIB_GLOG_INCLUDE%" ^
-DGLOG_LIBRARY_RELEASE="%CK_ENV_LIB_GLOG_LIB%\glog.lib" ^
-DGLOG_LIBRARY_DEBUG="%CK_ENV_LIB_GLOG_LIB%\glog.lib" ^
-DLMDB_INCLUDE_DIR="%CK_ENV_LIB_LMDB_INCLUDE%" ^
-DLMDB_LIBRARIES="%CK_ENV_LIB_LMDB_LIB%\lmdb.lib" ^
-DOpenCV_DIR="%CK_ENV_LIB_OPENCV%" ^
-DOpenCV_LIB_PATH="%CK_ENV_LIB_OPENCV_LIB%"
rem -DUSE_LMDB=%USE_LMDB% ^
rem -DPROTOBUF_DIR="%CK_ENV_LIB_PROTOBUF_HOST%\cmake" ^
rem -DPROTOBUF_PROTOC_EXECUTABLE="%CK_ENV_LIB_PROTOBUF_HOST%\bin\protoc.exe" ^
rem -DOpenBLAS_INCLUDE_DIR="%CK_ENV_LIB_OPENBLAS_INCLUDE%" ^
rem -DOpenBLAS_LIB="%CK_ENV_LIB_OPENBLAS_LIB%\%CK_ENV_LIB_OPENBLAS_STATIC_NAME%" ^
rem -DBLAS=%WHICH_BLAS% ^
exit /b 0
| Arc | 4 | hanwenzhu/ck-mlops | package/lib-caffe2-master-eigen-cpu-universal/scripts.win/install.bat.arc | [
"Apache-2.0"
] |
// rustfmt-license_template_path: tests/license-template/lt.txt
// Copyright 2019 The rustfmt developers.
fn main() {
println!("Hello world!");
}
| Rust | 3 | mbc-git/rust | src/tools/rustfmt/tests/target/license-templates/license.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
#!/usr/bin/env sage
for t in range(int(input())):
xs = [int(x) for x in input().split()]
x = xs[0]
ys = xs[1:]
ps = Partitions(x)
c = 0
for p in ps:
ok = True
for y in ys:
if y in p:
ok = False
break
if ok:
c += 1
print(f'Case #{t+1}: {c-1}')
| Sage | 3 | Ashindustry007/competitive-programming | tuenti/tuenti-challenge-10/11.sage | [
"WTFPL"
] |
// Test bindings-after-at with or-patterns and slice-patterns
// run-pass
#[derive(Debug, PartialEq)]
enum MatchArm {
Arm(usize),
Wild,
}
#[derive(Debug, PartialEq)]
enum Test {
Foo,
Bar,
Baz,
Qux,
}
fn test(foo: &[Option<Test>]) -> MatchArm {
match foo {
bar @ [Some(Test::Foo), .., Some(Test::Qux | Test::Foo)] => {
assert_eq!(bar, foo);
MatchArm::Arm(0)
},
[.., bar @ Some(Test::Bar | Test::Qux), _] => {
assert!(bar == &Some(Test::Bar) || bar == &Some(Test::Qux));
MatchArm::Arm(1)
},
_ => MatchArm::Wild,
}
}
fn main() {
let foo = vec![
Some(Test::Foo),
Some(Test::Bar),
Some(Test::Baz),
Some(Test::Qux),
];
// path 1a
assert_eq!(test(&foo), MatchArm::Arm(0));
// path 1b
assert_eq!(test(&[Some(Test::Foo), Some(Test::Bar), Some(Test::Foo)]), MatchArm::Arm(0));
// path 2a
assert_eq!(test(&foo[..3]), MatchArm::Arm(1));
// path 2b
assert_eq!(test(&[Some(Test::Bar), Some(Test::Qux), Some(Test::Baz)]), MatchArm::Arm(1));
// path 3
assert_eq!(test(&foo[1..2]), MatchArm::Wild);
}
| Rust | 5 | mbc-git/rust | src/test/ui/pattern/bindings-after-at/or-patterns-slice-patterns.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
<?xml version='1.0' encoding='utf-8' standalone='yes'?>
<!-- See definitions in C:\Windows\Microsoft.NET\Framework\v4.0.30319\CLR-ETW.man for .NET events -->
<!-- See MSDN docs about 'region of interest': https://docs.microsoft.com/windows-hardware/test/wpt/regions-of-interest -->
<!--
Unlike JIT, GC is largely single threaded and the times correlate very well with PerfView where we can drill down into each GC
generation in the region graph in WPA.
We use bascially the GC Start/Stop events where the GC Start event has also the generation traced which enables us to create
regions for each GC type.
GC suspensions work a bit different were I use the GCSuspendEE_V1 as start and GCRestartEEEnd as end event. This allows us
to capture in principle also the time where the suspension or resumption itself takes. An abnormally long time would indicate
a GC bug or a thread priority problem.
-->
<InstrumentationManifest>
<Instrumentation>
<Regions>
<RegionRoot Guid="{d8d639a0-cf4c-45fb-976a-0000DEADBEEF}" Name="GC" FriendlyName="GC Activity">
<Region Guid="{d8d639a1-cf4c-45fb-976a-100000000101}" Name="Gen 0" FriendlyName="GCs">
<Region Guid="{d8d639a1-cf4c-45fb-976a-000000000001}" Name="Gen 0" FriendlyName="Gen 0">
<Start>
<Event Provider="{e13c0d23-ccbc-4e12-931b-d9cc2eee27e4}" Id="1" Version="1"/>
<PayloadIdentifier FieldName="Depth" FieldValue="0"/>
<!-- Depth is the Generation number -->
</Start>
<Start>
<Event Provider="{e13c0d23-ccbc-4e12-931b-d9cc2eee27e4}" Id="1" Version="2"/>
<!-- .NET 4.6 has a new GC Start event -->
<PayloadIdentifier FieldName="Depth" FieldValue="0"/>
</Start>
<Stop>
<Event Provider="{e13c0d23-ccbc-4e12-931b-d9cc2eee27e4}" Id="2" Version="1"/>
</Stop>
<Match>
<Event PID="true"/>
</Match>
<Naming>
<PayloadBased NameField="Depth"/>
</Naming>
</Region>
</Region>
<Region Guid="{d8d639a1-cf4c-45fb-976b-100000000101}" Name="Gen 1" FriendlyName="GCs">
<Region Guid="{d8d639a1-cf4c-45fb-976a-000000000005}" Name="Gen 1" FriendlyName="Gen 1">
<Start>
<Event Provider="{e13c0d23-ccbc-4e12-931b-d9cc2eee27e4}" Id="1" Version="1"/>
<PayloadIdentifier FieldName="Depth" FieldValue="1"/>
</Start>
<Start>
<Event Provider="{e13c0d23-ccbc-4e12-931b-d9cc2eee27e4}" Id="1" Version="2"/>
<!-- .NET 4.6 has a new GC Start event -->
<PayloadIdentifier FieldName="Depth" FieldValue="1"/>
</Start>
<Stop>
<Event Provider="{e13c0d23-ccbc-4e12-931b-d9cc2eee27e4}" Id="2" Version="1"/>
</Stop>
<Match>
<Event PID="true"/>
</Match>
<Naming>
<PayloadBased NameField="Depth"/>
</Naming>
</Region>
</Region>
<Region Guid="{d8d639a1-cf4c-45fb-976c-100000000101}" Name="Gen 2" FriendlyName="GCs">
<Region Guid="{d8d639a1-cf4c-45fb-976a-000000000006}" Name="Gen 2" FriendlyName="Gen 2">
<Start>
<Event Provider="{e13c0d23-ccbc-4e12-931b-d9cc2eee27e4}" Id="1" Version="1"/>
<PayloadIdentifier FieldName="Depth" FieldValue="2"/>
</Start>
<Start>
<Event Provider="{e13c0d23-ccbc-4e12-931b-d9cc2eee27e4}" Id="1" Version="2"/>
<!-- .NET 4.6 has a new GC Start event -->
<PayloadIdentifier FieldName="Depth" FieldValue="2"/>
</Start>
<Stop>
<Event Provider="{e13c0d23-ccbc-4e12-931b-d9cc2eee27e4}" Id="2" Version="1"/>
</Stop>
<Match>
<Event PID="true"/>
</Match>
<Naming>
<PayloadBased NameField="Depth"/>
</Naming>
</Region>
</Region>
<Region Guid="{d8d639a2-cf4c-45fb-976a-000000000003}" Name="GCSuspends" FriendlyName="GC Suspensions">
<Region Guid="{d8d639a2-cf4c-45fb-976a-000000000002}" Name="GCSuspend" FriendlyName="GC Suspension">
<Start>
<Event Provider="{e13c0d23-ccbc-4e12-931b-d9cc2eee27e4}" Id="9" Version="1"/>
</Start>
<Stop>
<Event Provider="{e13c0d23-ccbc-4e12-931b-d9cc2eee27e4}" Id="3" Version="1"/>
</Stop>
<Match>
<Event PID="true"/>
</Match>
</Region>
</Region>
</RegionRoot>
</Regions>
</Instrumentation>
</InstrumentationManifest>
| XML | 4 | vedhasp/PowerShell | tools/performance/GC.Regions.xml | [
"MIT"
] |
# Bad declaration
PREFIX :a: <http://example/>
ASK{}
| SPARQL | 0 | alpano-unibz/ontop | test/sparql-compliance/src/test/resources/testcases-dawg-sparql-1.1/syntax-query/syn-bad-pname-04.rq | [
"Apache-2.0"
] |
enum UnstableEnum {
"a",
"b"
};
dictionary UnstableDictionary {
UnstableEnum unstableEnum;
};
typedef unsigned long UnstableTypedef;
[NoInterfaceObject]
partial interface UnstableInterface {
UnstableTypedef enum_value(optional UnstableDictionary unstableDictionary = {});
};
interface GetUnstableInterface {
static UnstableInterface get();
};
| WebIDL | 3 | tlively/wasm-bindgen | crates/webidl-tests/webidls/unstable/unstable.webidl | [
"Apache-2.0",
"MIT"
] |
#!/usr/bin/env sage
# reference https://github.com/comaeio/OPCDE/blob/master/2017/15%20ways%20to%20break%20RSA%20security%20-%20Renaud%20Lifchitz/opcde2017-ds-lifchitz-break_rsa.pdf
import sys
def factor(n):
depth = 50
x = PolynomialRing(Zmod(n), "x").gen()
for den in IntegerRange(2, depth + 1):
for num in IntegerRange(1, den):
if gcd(num, den) == 1:
r = den / num
phint = isqrt(n * r)
f = x - phint
sr = f.small_roots(beta=0.5)
if len(sr) > 0:
p = phint - sr[0]
p = p.lift()
if n % p == 0:
return p
try:
n = int(sys.argv[1])
p = factor(n)
if p is None:
print(0)
else:
print(p)
except:
print(0)
| Sage | 3 | CrackerCat/RsaCtfTool | sage/smallfraction.sage | [
"Beerware"
] |
;;;;
;;;; Simple histogram capture example using LFE (Lisp flavored Erlang)
;;;;
(defun record (r n)
(case n
(0 'ok)
(n
(hdr_histogram:record r (random:uniform n))
(record r (- n 1)))))
(defun main (args)
;; Create a fresh HDR histogram instance
(let ((r (case (hdr_histogram:open 10000000 3) ((tuple 'ok x) x))))
;; record a random uniform distribution of 1M data points
(record r 100000)
;; print percentiles to stdout as CLASSIC
(hdr_histogram:print r 'classic)
(timer:sleep 1000)
;; log percentiles to file as CSV
(hdr_histogram:log r 'csv "elixir.hgrm")
;; print other values
; (let (
; (min (hdr_histogram:min r))
; (mean (hdr_histogram:mean r))
; (median (hdr_histogram:median r))
; (max (hdr_histogram:max r))
; (stddev (hdr_histogram:stddev r))
; (99le (hdr_histogram:percentile r 99.0))
; (999999le (hdr_histogram:percentile r 99.9999))
; (mem (hdr_histogram:get_memory_size r))
; (count (hdr_histogram:get_total_count r)))
; ; do something with the values ...
;; we're done, cleanup any held resources
(hdr_histogram:close r)
(io:format "Done!~n")))
| LFE | 4 | Zabrane/hdr_histogram_erl | examples/simple.lfe | [
"CC0-1.0"
] |
@prefix : <http://example.org/base#> .
:c :d [] .
_:b1 :a :b .
| Turtle | 3 | joshrose/audacity | lib-src/lv2/sord/tests/test-id.ttl | [
"CC-BY-3.0"
] |
<?php
/**
* @var array $namespaces
*/
$items = [['name' => 'Namespaces']];
?>
<?= $this->partial('partials/breadcrumb.phtml', ['items'=> $items]) ?>
<div class="namespace-list">
<ul>
<?php foreach ($namespaces as $namespaceName => $ns): ?>
<li>
<a href="<?= $this->url(Zephir\Documentation::namespaceUrl($namespaceName)) ?>">
<?= $namespaceName ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
| HTML+PHP | 4 | nawawi/zephir | templates/Api/themes/zephir/partials/namespaces.phtml | [
"MIT"
] |
--TEST--
Duplicate labels are not allowed
--FILE--
<?php
foo:
foo:
goto foo;
?>
--EXPECTF--
Fatal error: Label 'foo' already defined in %s on line %d
| PHP | 2 | thiagooak/php-src | Zend/tests/duplicate_label_error.phpt | [
"PHP-3.01"
] |
/* It's an automatically generated code. Do not modify it. */
package com.intellij.ide.fileTemplates.impl;
import com.intellij.lexer.LexerBase;
import com.intellij.psi.tree.IElementType;
%%
%unicode
%public
%class FileTemplateTextLexer
%extends LexerBase
%function advanceImpl
%type IElementType
%eof{ return;
%eof}
ALPHA=[A-Za-z_]
DIGIT=[0-9]
MACRO="$"({ALPHA}|{DIGIT})+|"$""{"({ALPHA}|{DIGIT})+"}"
DIRECTIVE="#"{ALPHA}+
%%
<YYINITIAL> {MACRO} { return FileTemplateTokenType.MACRO; }
<YYINITIAL> {DIRECTIVE} { return FileTemplateTokenType.DIRECTIVE; }
<YYINITIAL> [^] { return FileTemplateTokenType.TEXT; }
| JFlex | 3 | halotroop2288/consulo | modules/base/lang-impl/src/main/java/com/intellij/ide/fileTemplates/impl/FileTemplateTextLexer.flex | [
"Apache-2.0"
] |
fn putnumln(n: int) -> void = do
putnum(n);
putchar('\n')
end in
fn fib(n: int) -> void =
let a = 0,
b = 1,
c = 0
in
while n != 0 do
putnumln(b);
c = a;
a = b;
b = c + b;
n = n - 1;
end
in do
fib(getnum())
end | Harbour | 3 | adam-mcdaniel/harbor | examples/fibonacci.hb | [
"Apache-2.0"
] |
#!/usr/bin/env bash
# This file contains the steps that should be run when building a "cache" image with contents that should be
# layered directly **on top of the source tree** once a dev container is created. This avoids having to run long
# running commands like "yarn install" from the ground up. Developers (and should) still run these commands
# after the actual dev container is created, but only differences will be processed.
yarn install
yarn electron
| Shell | 3 | sbj42/vscode | .devcontainer/prepare.sh | [
"MIT"
] |
#!/bin/csh
wget https://cms-service-dqm.web.cern.ch/cms-service-dqm/CAF/certification/Cosmics15/status.Cosmics15.week5.html
set MYDAT=`cat status.Cosmics15.week5.html | grep "<title>" | awk -F \( '{print $2}' | awk -F \) '{print $1}'`
set FIN=`date -d"$MYDAT" '+%Y_%m_%d_%H_%M_%S'`
echo ${FIN}
cat status.Cosmics15.week5.html | grep "<tr><th>" | awk -F "</th><td" '{print $1}' | awk -F "<tr><th>" '{print $2}' | awk -F "</th><th>" '{print $1}' > tmp.htm
touch runsets_${FIN}
set k=0
set j=0
foreach i (`cat tmp.htm`)
if( ${i} == "Run" ) then
set k=0
@ j = ${j} + "1"
else
echo ${i} >> runsets_${FIN}
@ k = ${k} + "1"
endif
if (${j} > "1") then
break
endif
end
rm
tmp.htm
| Tcsh | 2 | ckamtsikis/cmssw | DPGAnalysis/HcalTools/scripts/cmt/parce_runs.csh | [
"Apache-2.0"
] |
/*
* @LANG: c++
*/
/**
* Test a high character to make sure signedness
* isn't messing us up.
*/
#include <stdio.h>
#include <string.h>
struct Fsm
{
int cs;
// Initialize the machine. Invokes any init statement blocks. Returns 0
// if the machine begins in a non-accepting state and 1 if the machine
// begins in an accepting state.
int init( );
// Execute the machine on a block of data. Returns -1 if after processing
// the data, the machine is in the error state and can never accept, 0 if
// the machine is in a non-accepting state and 1 if the machine is in an
// accepting state.
int execute( const unsigned char *data, int len );
// Indicate that there is no more data. Returns -1 if the machine finishes
// in the error state and does not accept, 0 if the machine finishes
// in any other non-accepting state and 1 if the machine finishes in an
// accepting state.
int finish( );
};
%%{
machine Fsm;
alphtype unsigned char;
# Indicate we got the high character.
action gothigh {
printf("yes\n");
}
main := 0xe8 @gothigh '\n';
}%%
%% write data;
int Fsm::init( )
{
%% write init;
return 0;
}
int Fsm::execute( const unsigned char *_data, int _len )
{
const unsigned char *p = _data;
const unsigned char *pe = _data+_len;
%% write exec;
if ( cs == Fsm_error )
return -1;
if ( cs >= Fsm_first_final )
return 1;
return 0;
}
int Fsm::finish()
{
if ( cs == Fsm_error )
return -1;
if ( cs >= Fsm_first_final )
return 1;
return 0;
}
Fsm fsm;
void test( unsigned char *buf, int len )
{
fsm.init();
fsm.execute( buf, len );
if ( fsm.finish() > 0 )
printf("ACCEPT\n");
else
printf("FAIL\n");
}
unsigned char data1[] = { 0xe8, 10 };
unsigned char data2[] = { 0xf8, 10 };
int main()
{
test( data1, 2 );
test( data2, 2 );
return 0;
}
##### OUTPUT #####
yes
ACCEPT
FAIL
| Ragel in Ruby Host | 5 | podsvirov/colm-suite | test/ragel.d/high2.rl | [
"MIT"
] |
Set map_ADAM2ovf[ovf_,ADAM_variables] "Mapper MAKRO og ADAM overførsler" /
tot.Ty_o "Overførsler"
# Overførsler til uddannelse og aktivering mv.
ledigyd.Tyuly "Ledighedsydelse"
aktarbj.Tyuada "Overførsler til aktiverede i arbejdsmarkedsydelsesordningen udenfor arbejdsstyrken"
# sbeskjobtdag.Tyuadj "Overførsler til dagpengemodtagere i offentlig løntilskudslignende ordning, uden for nettoarbejdsstyrken"
aktdag.Tyuadr "Overførsler til AF aktiverede ekskl. arbejdsmarkedsydelse udenfor arbejdsstyrken (dagpenge)"
aktkont.Tyuak "Overførsler til aktiverede kontantshjælpmodtagere"
reval.Tyury "Revalideringsydelse"
uddsu.Tyusu "Statens uddannelsesstøtte"
# Overførsler til ledige arbejdsløshedsdagpengemodtagere, inkl. arbejdsmarkedsydelse
leddag.Tydd "Arbejdsløshedsdagpenge ekskl. arbejdsmarkedsydelse"
ledarbj.Tyda "Arbejdsmarkedsydelse"
# Overførsler til midlertidigt fraværende fra arbejdsstyrken
ferie.Tymlf "Udbetalte feriedagpenge"
syge.Tyms "Overførsler til sygedagpenge"
barsel.Tymb "Overførsler til barselsdagpenge"
orlov.Tymo "Overførsler til arbejdsmarkedsorlov"
udvforlob.Tymr "Samlet ydelse til personer i resourceforløbsordning"
# Pensioner og overførsler til personer på øvrige tilbagetrækningsordninger
pension.Typfp "Overførsler til folkepension (i Danmark)"
fortid.Typfo "Overførsler til førtidspension (i Danmark)"
udlpens.Typfp_e "Folkepension til udland"
udlfortid.Typfo_e "Førtidspension til udland"
efterl.Typef "Overførsler til efterløn"
overg.Typov "Overførsler til overgangsydelse"
fleksyd.Typfy "Overførsel til flexydelse"
tjmand.Typt "Overførsler til tjenestemandspension"
tillaeg.Typpt "Personlige tillæg"
tilbtrk.Typq "Pensioner og overførsler til personer på øvrige tilbagetrækningsordninger"
# Øvrige indkomstoverførsler
ledkont.(Tyrkk,Tyrku) "Overførsler til ledige kontanthjælpsmodtagere"
intro.Tyrki "Modtagere af integrationsydelse, kontanthjælp til flygtninge, introduktionsydelse (passiv periode)"
kontflex.Tyrkrs "Overførsler til kontanthjælp i øvrigt, skattepligtig del"
kontrest.Tyrkrr "Overførsler til kontanthjælp i øvrigt, skattepligtig del"
boernyd.Tyrbf "Børnefamilieydelse"
groen.Tyrgc "Grøn check"
boligst.Tyrhs "Boligstøtte"
boligyd.Tyrhy "Overførsler til boligydelse"
skatpl.Tyrrs "Øvrige indkomstoverførsler, skattepligtige"
iskatpl.Tyrrr "Øvrige indkomstoverførsler, ikke skattepligtige"
/; | GAMS | 4 | gemal/MAKRO | Model/Sets/map_ADAM2ovf.sets.gms | [
"MIT"
] |
; NSD version 4.0.0_imp_2
; nsd-patch zone example.com. run at time Mon Apr 4 15:59:43 2011
$ORIGIN com.
example 3600 IN SOA mainserv.example.net. root.example. (
2003070707 3600 28800 2419200 3600 )
3600 IN NS ns0.xname.org.
3600 IN NS ns1.xname.org.
$ORIGIN d.4.0.3.0.e.f.f.f.3.f.0.1.2.0.example.com.
0 7200 IN IPSECKEY 10 2 2 2001:db8:0:8002::2000:1 AQNRU3mG7TVTO2BkR47usntb102uFJtugbo6BSGvgqt4AQ==
$ORIGIN 2.0.192.in-addr.arpa.example.com.
38 7200 IN IPSECKEY 10 1 2 192.0.2.38 AQNRU3mG7TVTO2BkR47usntb102uFJtugbo6BSGvgqt4AQ==
$ORIGIN example.com.
chi 3600 IN A 192.0.2.2
3600 IN DHCID AAEBOSD+XR3Os/0LozeXVqcNc7FwCfQdWL3b/NaiUDlW2No=
chi6 3600 IN AAAA 2001:db8::1234:5678
3600 IN DHCID AAIBY2/AuCccgoJbsaxcQc9TUapptP69lOjxfNuVAA2kjEA=
client 3600 IN A 192.0.2.3
3600 IN DHCID AAABxLmlskllE0MVjd57zHcWmEH3pCQ6VytcKD//7es/deY=
ourtest1 3600 IN IPSECKEY 10 3 2 mygateway.example.com. AQNRU3mG7TVTO2BkR47usntb102uFJtugbo6BSGvgqt4AQ==
ourtest2 3600 IN IPSECKEY 10 1 2 192.0.2.38
ourtest3 3600 IN IPSECKEY 10 0 2 .
test3 7200 IN IPSECKEY 10 0 2 . AQNRU3mG7TVTO2BkR47usntb102uFJtugbo6BSGvgqt4AQ==
test4 7200 IN IPSECKEY 10 1 2 192.0.2.3 AQNRU3mG7TVTO2BkR47usntb102uFJtugbo6BSGvgqt4AQ==
test5 7200 IN IPSECKEY 10 3 2 mygateway.example.com. AQNRU3mG7TVTO2BkR47usntb102uFJtugbo6BSGvgqt4AQ==
| DNS Zone | 3 | gearnode/nsd | tpkg/ipseckey.tdir/ipseckey.zone | [
"BSD-3-Clause"
] |
#cs ----------------------------------------------------------------------------
Devil Server
AutoIt Version: 3.3.14.5
Version: Release ( 22:38 25.11.2018 )
#ce ----------------------------------------------------------------------------
#NoTrayIcon
#include <Misc.au3>
#include <WinAPIFiles.au3>
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
; The program will not start twice
_Singleton("devil_check_server", 0)
; Read config file
Global $Config_ClientID = IniRead("config.ini", "Config", "ClientID", "defective_client")
Global $Config_ServerPatch = IniRead("config.ini", "Config", "ServerPatch", "C:\")
Global $Config_ControlPanelPatch = IniRead("config.ini", "Config", "ControlPanelPatch", "Devil-ControlPanel.exe")
Global $Config_AddToStartup = IniRead("config.ini", "Config", "AddToStartup", "False")
Global $Config_Speed = IniRead("config.ini", "Config", "Speed", "10")
; Variables
Global $ServerData = ""
Global $Status_CrazyMouse = "False"
Global $Status_BlockTaskManager = "False"
; Hotkey to start Control Panel
HotKeySet("{PAUSE}", "RunControlPanel")
; ------------------------------------------------------------------------------
; Add backdoor to start-up
If $Config_AddToStartup = "True" Then
If Not FileExists(@StartupDir & "\devil_server.lnk") Then
FileCreateShortcut(@ScriptFullPath, @StartupDir & "\devil_server.lnk", @ScriptDir, "", "devil_server")
Sleep($Config_Speed + 300)
If FileExists(@StartupDir & "\devil_server.lnk") Then
MsgBox($MB_OK, "Devil Server", "Devil Server added to start-up!")
Else
MsgBox($MB_OK, "Devil Server", "Devil Server can not add self to the start-up! Try again!")
EndIf
EndIf
EndIf
; ------------------------------------------------------------------------------
; Main Loop
While True
Sleep($Config_Speed + 1)
$ServerData = ReadServer()
; Definition and execution of the received command
If $ServerData[0] = "execute_command" Then
CMDExecute($ServerData[1])
ElseIf $ServerData[0] = "show_message" Then
ShowMessageBox($ServerData[1])
ElseIf $ServerData[0] = "load_file" Then
LoadFile($ServerData[1])
ElseIf $ServerData[0] = "shutdown" Then
SystemShutdown()
ElseIf $ServerData[0] = "block_task_manager" Then
$Status_BlockTaskManager = $ServerData[1]
ElseIf $ServerData[0] = "crazy_mouse" Then
$Status_CrazyMouse = $ServerData[1]
EndIf
; Same for crazy mouse and task manager blocker
If $Status_BlockTaskManager = "True" Then
BlockTaskManager()
EndIf
If $Status_CrazyMouse = "True" Then
CrazyMouse()
EndIf
WEnd
; ------------------------------------------------------------------------------
; Get data from the shared folder
Func ReadServer()
; Read data from server
If FileExists($Config_ServerPatch & "\" & $Config_ClientID) Then
Local $Data[2]
$Data[0] = IniRead($Config_ServerPatch & "\" & $Config_ClientID, "Data", "Type", "")
$Data[1] = IniRead($Config_ServerPatch & "\" & $Config_ClientID, "Data", "Command", "")
FileDelete($Config_ServerPatch & "\" & $Config_ClientID)
Return $Data
Else
Local $Data = ["", ""]
Return $Data
EndIf
EndFunc
; Upload and run file
Func LoadFile($File_name)
Sleep($Config_Speed + 500) ; Some delay for file loading
FileCopy($Config_ServerPatch & "\" & $File_name, @ScriptDir, 1)
FileDelete($Config_ServerPatch & "\" & $File_name)
ShellExecute($File_name) ; Launch the file
FileSetAttrib($File_name, "+H") ; Hide the file!
EndFunc
; Execute to CMD
Func CMDExecute($Command)
Run(@ComSpec & " /c " & $Command, "", @SW_HIDE)
EndFunc
; Show message
Func ShowMessageBox($Text)
MsgBox($MB_OK, "Message", $Text, 10)
EndFunc
; Shutdown system
Func SystemShutdown()
Shutdown($SD_SHUTDOWN)
EndFunc
; Block task manager
Func BlockTaskManager()
If ProcessExists("taskmgr.exe") Then ProcessClose("taskmgr.exe")
EndFunc
; Сrazy mouse
Func CrazyMouse()
MouseMove(Random(0, @DesktopWidth), Random(0, @DesktopHeight), 3) ; Move mouse to random position
EndFunc
; Run Control Panel using hotkeys
Func RunControlPanel()
Run($Config_ControlPanelPatch)
EndFunc | AutoIt | 2 | ejnshtein/Devil-Backdoor | Devil-Server.au3 | [
"MIT"
] |
! Copyright (C) 2017 Björn Lindqvist
USING: kernel llvm.ffi tools.test ;
{ } [
"my_module" LLVMModuleCreateWithName
! dup LLVMDumpModule
LLVMDisposeModule
] unit-test
{ 10 } [
LLVMInt32Type 10 LLVMVectorType LLVMGetVectorSize
] unit-test
{ 32 } [
LLVMInt32Type LLVMGetIntTypeWidth
] unit-test
| Factor | 4 | alex-ilin/factor | extra/llvm/ffi/ffi-tests.factor | [
"BSD-2-Clause"
] |
CONFIG_COLLECT_TIMESTAMPS=y
CONFIG_USE_BLOBS=y
CONFIG_VENDOR_GOOGLE=y
CONFIG_BOARD_GOOGLE_PARROT=y
CONFIG_HAVE_MRC=y
CONFIG_MRC_FILE="/build/parrot/firmware/mrc.bin"
CONFIG_CBFS_SIZE=0x100000
CONFIG_CONSOLE_CBMEM=y
# CONFIG_CONSOLE_SERIAL is not set
# CONFIG_PCI_ROM_RUN is not set
# CONFIG_ON_DEVICE_ROM_RUN is not set
# CONFIG_S3_VGA_ROM_RUN is not set
CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
CONFIG_FRAMEBUFFER_VESA_MODE_117=y
CONFIG_FRAMEBUFFER_KEEP_VESA_MODE=y
CONFIG_VGA_BIOS_ID="8086,0106"
CONFIG_VGA_BIOS=y
CONFIG_VGA_BIOS_FILE="3rdparty/blobs/mainboard/google/parrot/snm_2130_coreboot.bin"
CONFIG_CPU_ADDR_BITS=36
CONFIG_CACHE_ROM=y
CONFIG_MARK_GRAPHICS_MEM_WRCOMB=y
CONFIG_ELOG=y
CONFIG_ELOG_GSMI=y
CONFIG_ELOG_BOOT_COUNT=y
CONFIG_ELOG_BOOT_COUNT_CMOS_OFFSET=144
CONFIG_SPI_FLASH_SMM=y
CONFIG_CMOS_POST=y
CONFIG_CMOS_POST_OFFSET=0x70
# CONFIG_MULTIBOOT is not set
CONFIG_PAYLOAD_NONE=y
CONFIG_CHROMEOS=y
CONFIG_ANY_TOOLCHAIN=y
CONFIG_HAVE_IFD_BIN=y
CONFIG_HAVE_ME_BIN=y
CONFIG_VBOOT_STARTS_IN_ROMSTAGE=y
| Parrot | 2 | MIPS/CI20_chromiumos_chromiumos-overlay | sys-boot/coreboot/files/configs/config.parrot | [
"BSD-3-Clause",
"MIT"
] |
{% assign offset = include.offset | default: 40 %}
{% assign limit = include.limit | default: 7 %}
{% assign percentage = include.percentage | default: 20 %}
{% assign percentage-color = include.percentage-color | default: "green" %}
{% assign due = include.due | default: "2 days" %}
<div class="card">
{% include ui/progress.html value=percentage class="card-progress" color=percentage-color %}
<div class="card-body">
<h3 class="card-title">
<a href="#">{{ include.title | default: 'Task Title' }}</a>
{% if include.badge %} <span class="badge ms-2">{{ include.badge }}</span>{% endif %}
</h3>
{% include ui/avatar-list.html offset=offset limit=limit stacked=true class="mb-3" %}
<div class="card-meta d-flex justify-content-between">
<div class="d-flex align-items-center">
{% include ui/icon.html icon="check" class="me-2" %}
<span>5/10</span>
</div>
<span>Due {{ due }}</span>
</div>
</div>
</div>
| HTML | 3 | muhginanjar/tabler | src/pages/_includes/cards/project-kanban.html | [
"MIT"
] |
<!DOCTYPE html>
<html lang="en">
<head>
<title>Multiple animated skinned meshes</title>
<meta charset="utf-8">
<meta content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" name="viewport">
<link type="text/css" rel="stylesheet" href="main.css">
</head>
<body>
<div id="info">
This demo shows how to clone a skinned mesh using <strong>SkeletonUtils.clone()</strong><br/>
Soldier model from <a href="https://www.mixamo.com" target="_blank" rel="noopener">https://www.mixamo.com</a>.
</div>
<script type="module">
import * as THREE from '../build/three.module.js';
import { GLTFLoader } from './jsm/loaders/GLTFLoader.js';
import * as SkeletonUtils from './jsm/utils/SkeletonUtils.js';
let camera, scene, renderer;
let clock;
const mixers = [];
init();
animate();
function init() {
camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 1000 );
camera.position.set( 2, 3, - 6 );
camera.lookAt( 0, 1, 0 );
clock = new THREE.Clock();
scene = new THREE.Scene();
scene.background = new THREE.Color( 0xa0a0a0 );
scene.fog = new THREE.Fog( 0xa0a0a0, 10, 50 );
const hemiLight = new THREE.HemisphereLight( 0xffffff, 0x444444 );
hemiLight.position.set( 0, 20, 0 );
scene.add( hemiLight );
const dirLight = new THREE.DirectionalLight( 0xffffff );
dirLight.position.set( - 3, 10, - 10 );
dirLight.castShadow = true;
dirLight.shadow.camera.top = 4;
dirLight.shadow.camera.bottom = - 4;
dirLight.shadow.camera.left = - 4;
dirLight.shadow.camera.right = 4;
dirLight.shadow.camera.near = 0.1;
dirLight.shadow.camera.far = 40;
scene.add( dirLight );
// scene.add( new THREE.CameraHelper( dirLight.shadow.camera ) );
// ground
const mesh = new THREE.Mesh( new THREE.PlaneGeometry( 200, 200 ), new THREE.MeshPhongMaterial( { color: 0x999999, depthWrite: false } ) );
mesh.rotation.x = - Math.PI / 2;
mesh.receiveShadow = true;
scene.add( mesh );
const loader = new GLTFLoader();
loader.load( 'models/gltf/Soldier.glb', function ( gltf ) {
gltf.scene.traverse( function ( object ) {
if ( object.isMesh ) object.castShadow = true;
} );
const model1 = SkeletonUtils.clone( gltf.scene );
const model2 = SkeletonUtils.clone( gltf.scene );
const model3 = SkeletonUtils.clone( gltf.scene );
const mixer1 = new THREE.AnimationMixer( model1 );
const mixer2 = new THREE.AnimationMixer( model2 );
const mixer3 = new THREE.AnimationMixer( model3 );
mixer1.clipAction( gltf.animations[ 0 ] ).play(); // idle
mixer2.clipAction( gltf.animations[ 1 ] ).play(); // run
mixer3.clipAction( gltf.animations[ 3 ] ).play(); // walk
model1.position.x = - 2;
model2.position.x = 0;
model3.position.x = 2;
scene.add( model1, model2, model3 );
mixers.push( mixer1, mixer2, mixer3 );
animate();
} );
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.shadowMap.enabled = true;
document.body.appendChild( renderer.domElement );
window.addEventListener( 'resize', onWindowResize );
}
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize( window.innerWidth, window.innerHeight );
}
function animate() {
requestAnimationFrame( animate );
const delta = clock.getDelta();
for ( const mixer of mixers ) mixer.update( delta );
renderer.render( scene, camera );
}
</script>
</body>
</html>
| HTML | 5 | omgEn/threeJs | examples/webgl_animation_multiple.html | [
"MIT"
] |
def venv [venv-dir] {
let venv-abs-dir = ($venv-dir | path expand)
let venv-name = ($venv-abs-dir | path basename)
let old-path = ($nu.path | str collect (path-sep))
let new-path = (if (windows?) { (venv-path-windows $venv-abs-dir) } { (venv-path-unix $venv-abs-dir) })
let new-env = [[name, value];
[VENV_OLD_PATH $old-path]
[VIRTUAL_ENV $venv-name]]
$new-env | append $new-path
}
def venv-path-unix [venv-dir] {
let venv-path = ([$venv-dir "bin"] | path join)
let new-path = ($nu.path | prepend $venv-path | str collect (path-sep))
[[name, value]; [PATH $new-path]]
}
def venv-path-windows [venv-dir] {
# 1. Conda on Windows needs a few additional Path elements
# 2. The path env var on Windows is called Path (not PATH)
let venv-path = ([$venv-dir "Scripts"] | path join)
let new-path = ($nu.path | prepend $venv-path | str collect (path-sep))
[[name, value]; [Path $new-path]]
}
def windows? [] {
(sys).host.name == "Windows"
}
def path-sep [] {
if (windows?) { ";" } { ":" }
}
| Nu | 4 | lily-mara/nu_scripts | virtual_environments/venv.nu | [
"MIT"
] |
@forward 'select-theme' hide color, theme, typography;
@forward 'select-theme' as mat-select-* hide mat-select-density;
| SCSS | 2 | RAM-16/gdscaec-Angular | node_modules/@angular/material/select/_select-legacy-index.scss | [
"MIT"
] |
{
"labels": {
"formats": [
${"battleLabelsTemplates.xc":"def.hitLogBackground"},
${"battleLabelsTemplates.xc":"def.hitLogBody"},
${"battleLabelsTemplates.xc":"def.hitLogHeader"},
${"battleLabelsTemplates.xc":"def.totalEfficiency"},
${"battleLabelsTemplates.xc":"def.totalHP"},
${"battleLabelsTemplates.xc":"def.avgDamage"},
${"battleLabelsTemplates.xc":"def.mainGun"},
${"battleLabelsTemplates.xc":"def.damageLogBackground"},
${"battleLabelsTemplates.xc":"def.damageLog"},
${"battleLabelsTemplates.xc":"def.lastHit"},
${"battleLabelsTemplates.xc":"def.repairTimeEngine"},
${"battleLabelsTemplates.xc":"def.repairTimeGun"},
${"battleLabelsTemplates.xc":"def.repairTimeTurret"},
${"battleLabelsTemplates.xc":"def.repairTimeComplex"},
${"battleLabelsTemplates.xc":"def.repairTimeSurveying"},
${"battleLabelsTemplates.xc":"def.repairTimeRadio"}
]
}
}
| XC | 0 | elektrosmoker/RelhaxModpack | RelhaxModpack/RelhaxUnitTests/bin/Debug/patch_regressions/followPath/check_03.xc | [
"Apache-2.0"
] |
#!/bin/sh
#
# Generate a discrete lookup table for a sigmoid function in the smoothstep
# family (https://en.wikipedia.org/wiki/Smoothstep), where the lookup table
# entries correspond to x in [1/nsteps, 2/nsteps, ..., nsteps/nsteps]. Encode
# the entries using a binary fixed point representation.
#
# Usage: smoothstep.sh <variant> <nsteps> <bfp> <xprec> <yprec>
#
# <variant> is in {smooth, smoother, smoothest}.
# <nsteps> must be greater than zero.
# <bfp> must be in [0..62]; reasonable values are roughly [10..30].
# <xprec> is x decimal precision.
# <yprec> is y decimal precision.
#set -x
cmd="sh smoothstep.sh $*"
variant=$1
nsteps=$2
bfp=$3
xprec=$4
yprec=$5
case "${variant}" in
smooth)
;;
smoother)
;;
smoothest)
;;
*)
echo "Unsupported variant"
exit 1
;;
esac
smooth() {
step=$1
y=`echo ${yprec} k ${step} ${nsteps} / sx _2 lx 3 ^ '*' 3 lx 2 ^ '*' + p | dc | tr -d '\\\\\n' | sed -e 's#^\.#0.#g'`
h=`echo ${yprec} k 2 ${bfp} ^ ${y} '*' p | dc | tr -d '\\\\\n' | sed -e 's#^\.#0.#g' | tr '.' ' ' | awk '{print $1}' `
}
smoother() {
step=$1
y=`echo ${yprec} k ${step} ${nsteps} / sx 6 lx 5 ^ '*' _15 lx 4 ^ '*' + 10 lx 3 ^ '*' + p | dc | tr -d '\\\\\n' | sed -e 's#^\.#0.#g'`
h=`echo ${yprec} k 2 ${bfp} ^ ${y} '*' p | dc | tr -d '\\\\\n' | sed -e 's#^\.#0.#g' | tr '.' ' ' | awk '{print $1}' `
}
smoothest() {
step=$1
y=`echo ${yprec} k ${step} ${nsteps} / sx _20 lx 7 ^ '*' 70 lx 6 ^ '*' + _84 lx 5 ^ '*' + 35 lx 4 ^ '*' + p | dc | tr -d '\\\\\n' | sed -e 's#^\.#0.#g'`
h=`echo ${yprec} k 2 ${bfp} ^ ${y} '*' p | dc | tr -d '\\\\\n' | sed -e 's#^\.#0.#g' | tr '.' ' ' | awk '{print $1}' `
}
cat <<EOF
#ifndef JEMALLOC_INTERNAL_SMOOTHSTEP_H
#define JEMALLOC_INTERNAL_SMOOTHSTEP_H
/*
* This file was generated by the following command:
* $cmd
*/
/******************************************************************************/
/*
* This header defines a precomputed table based on the smoothstep family of
* sigmoidal curves (https://en.wikipedia.org/wiki/Smoothstep) that grow from 0
* to 1 in 0 <= x <= 1. The table is stored as integer fixed point values so
* that floating point math can be avoided.
*
* 3 2
* smoothstep(x) = -2x + 3x
*
* 5 4 3
* smootherstep(x) = 6x - 15x + 10x
*
* 7 6 5 4
* smootheststep(x) = -20x + 70x - 84x + 35x
*/
#define SMOOTHSTEP_VARIANT "${variant}"
#define SMOOTHSTEP_NSTEPS ${nsteps}
#define SMOOTHSTEP_BFP ${bfp}
#define SMOOTHSTEP \\
/* STEP(step, h, x, y) */ \\
EOF
s=1
while [ $s -le $nsteps ] ; do
$variant ${s}
x=`echo ${xprec} k ${s} ${nsteps} / p | dc | tr -d '\\\\\n' | sed -e 's#^\.#0.#g'`
printf ' STEP(%4d, UINT64_C(0x%016x), %s, %s) \\\n' ${s} ${h} ${x} ${y}
s=$((s+1))
done
echo
cat <<EOF
#endif /* JEMALLOC_INTERNAL_SMOOTHSTEP_H */
EOF
| Shell | 5 | Mu-L/jemalloc | include/jemalloc/internal/smoothstep.sh | [
"BSD-2-Clause"
] |
; -*- scheme -*-
(load "system.lsp")
(load "compiler.lsp")
(make-system-image "flisp.boot")
| Common Lisp | 3 | greimel/julia | src/flisp/mkboot1.lsp | [
"Zlib"
] |
struct Foo<'a, A> {}
//~^ ERROR parameter `'a` is never used
//~| ERROR parameter `A` is never used
fn main() {}
| Rust | 1 | Eric-Arellano/rust | src/test/ui/issues/issue-36299.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
#!/usr/bin/gnuplot -persist
set title "Boehm-GC: Optimized vs. non-Optimized (Generational Mode)"
set xlabel "Interval #"
set ylabel "Pause Time [ms]"
set terminal pdfcairo transparent enhanced fontscale 0.5 size 5.00in, 3.00in
set output "GC_bench_incr.pdf"
plot "boehm_incr.txt" title "non-optimized GC" w i, "boehm_incr_opt.txt" title "optimized GC" w i
set output
# EOF
| Gnuplot | 4 | gamemaker1/v | vlib/v/tests/bench/gcboehm/GC_bench_incr.plt | [
"MIT"
] |
#
# script to convert mchedr (USGS) format data for input file
# or gather it from remote website
#
# originally this was a
# script to collect mine bulletin data from USGS website via ftp
#
# J.Eakins
# 11/2007 with updates for ftp collection of older data, 4/2008
#
use Datascope;
use File::Basename;
use File::Path;
use Net::FTP;
use LWP::Simple;
use Cwd;
use Getopt::Std;
our ($opt_A, $opt_v, $opt_V, $opt_a, $opt_f, $opt_p);
our ($database, $file2convert, $num2convert, $iwant);
our ($flush, $nrecords, $key, $c_cnt);
our (@db, @db_origin, @db_origerr, @db_netmag, @db_arrival, @db_assoc, @db_event);
our (@arrival_record, @origin_record, @dbmatch, @matchall, @matchsome);
our ($orid, $lat, $lon, $auth, $depth, $or_time, $nsta, $mb, $ms, $ml );
our ($chan, $sta, $phase, $ar_time, $month, $day, $year, $arrhr, $arrmin, $arrsec, $arid, $arr_time);
our (%bulletins, $bulltype, $mchedr_store);
our (@listing, @convert_list, @foo);
our ($ftp, $account, $host, $getfile, $remote_host);
our ($upd_mo, $upd_dy, $upd_t_yr, $upd_yr, $upd_time, $local_update, $last_remote_update);
our ($hr, $min, $sec, $latNS, $lonEW, $dtype, $sd1, $regionnum) ;
our ($oterr, $laterr, $lonerr, $deperr, $mbsta, $mssta);
our ($mag1, $mag1type, $mag1src, $mag2, $mag2type, $mag2src);
our ($smjaz, $smjplng, $smj, $intaz, $intplng, $int);
our ($smnaz, $smnplng, $smn, $comment, $presid);
our ($ev2stadist, $ev2staaz, $stambper, $stambamp, $stambmag, $stambused);
our ($pf, $ref);
if ( ! getopts('vVAa:f:p') || @ARGV != 1 ) {
print STDERR "getopts or number of arguments failure.\n";
&usage;
} else {
$database = $ARGV[0];
}
if ($opt_f) {
$file2convert = $opt_f ;
}
&setup_global_vars;
$flush = 0;
@db = dbopen($database, "r+");
@db_origin = dblookup(@db, "", "origin" , "", "");
@db_origerr = dblookup(@db, "", "origerr" , "", "");
@db_netmag = dblookup(@db, "", "netmag" , "", "");
@db_arrival = dblookup(@db, "", "arrival" , "", "");
@db_assoc = dblookup(@db, "", "assoc" , "", "");
@db_event = dblookup(@db, "", "event" , "", "");
$nrecords = dbquery(@db_origin, "dbRECORD_COUNT");
if ($nrecords > 0 ) {
$orid = dbnextid (@db_origin, "orid") ;
} else {
$orid = 1 ;
}
#
# if opt_f then open local file.
# otherwise, download file(s) open and convert
#
if ($opt_f) { # only a single file
$num2convert = 1;
open (FILE, "$file2convert") || die "Can't open $file2convert for while loop.\n";
&convert_file ;
} else {
# loop over each of the bulletins listed in pf file
foreach $key (keys %bulletins) {
$bulltype = $key;
print "bulltype $bulltype\n" if $opt_v;
@listing = () ;
@convert_list= () ;
$num2convert = 0 ;
# get proper author name
if ($opt_a) {
$auth = $opt_a ;
} elsif ($bulltype->{author}) {
$auth = "$bulltype->{author}";
} else {
$auth = "mchdr" ;
}
# check to make sure storeage directory exists
$mchedr_store = "$bulltype->{local_dir}" ;
if (! -d $mchedr_store ) {
mkpath "$mchedr_store" ;
}
$mchedr_store = $mchedr_store . "/" ;
$iwant = $bulltype->{file} ;
print STDERR "Remote dir is: ", $bulltype->{remote_dir}, " \n" if $opt_v ;
print STDERR "File I want is: $iwant\n" if $opt_v ;
$ftp = Net::FTP->new("$bulltype->{remote_host}") or die "Can't connect: $@ \n" ;
$ftp->login("anonymous",$account) or die "Couldn't login \n";
$ftp->cwd("$bulltype->{remote_dir}") or die "Couldn't change directory\n";
$ftp->binary;
# @listing = $ftp->dir("$iwant") or die "Couldn't get file listing on remote machine\n";
@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 files in local_dir
# if so retreive it/them
$ftp->quit;
print "Done with ftp.\n";
$num2convert = @convert_list;
print "Convert list:, @convert_list, \n" if ($opt_v);
print "Number of files to convert: $num2convert\n";
if ($num2convert == 0) {
print "No files to update. Exiting... \n";
exit(1);
}
$c_cnt = 0;
while ($c_cnt < $num2convert) {
$file2convert = $convert_list[$c_cnt];
open (FILE, "$file2convert") || die "Can't open $file2convert for while loop.\n";
&convert_file ;
$c_cnt++;
close FILE;
}
} # end of loop over each bulletin type
} # end of process to gather list of files
dbclose(@db);
exit;
sub usage {
print STDERR <<END;
USAGE: \t$0 [-A] [-a auth] [-f file] [-p pffile] [-v] db
-A create arrivals if available in input file
-a author name for author field
-f file the mchedr format file to convert
-p pf the parameter file; default is mchedr2db.pf
-v verbose messages
db database you wish to create
END
exit;
}
sub create_arrival {
@arrival_record = () ;
if ($phase =~ /P/) {
$chan = "BHZ";
} elsif ($phase =~ /S/) {
$chan = "BHN";
} elsif ($phase =~ /Lg/) {
$chan = "BHN";
} else {
$chan = "BHZ";
}
$ar_time = "$month\/$day\/$year $arrhr:$arrmin:$arrsec";
$nrecords = dbquery(@db_arrival, "dbRECORD_COUNT");
if ($nrecords > 0 ) {
$arid = dbnextid (@db_arrival, "arid") ;
} else {
$arid = 1 ;
}
push(@arrival_record, "sta", $sta,
"time", $ar_time,
"arid", $arid,
"jdate", yearday($ar_time),
"chan", $chan,
"iphase", $phase,
"auth", $auth
);
@dbmatch = dblookup(@db,"","arrival","","dbSCRATCH");
dbputv(@dbmatch,@arrival_record);
@matchall = dbmatches(@dbmatch,@db_arrival,"ckor");
if ($#matchall != -1) {
# This record matches a pre-existing record in arrival table
print STDERR "Problem with input file. It looks like you have duplicate arrivals.\n" if $opt_v ;
print STDERR "Rejecting: $sta $chan $ar_time $phase $arid\n" if $opt_v;
next;
} else {
# Add the record to the arrival table if no lat/lon/time/phase matches
print STDERR "Adding record to arrival table: $lat $lon $ar_time $phase.\n" if ($opt_v || $opt_V) ;
eval { dbaddv(@db_arrival ,@arrival_record) } ;
if ($@) {
warn $@;
print STDERR "Problem adding arrival record. $sta, $ar_time, $phase matches pre-existing arrival. Will ignore.\n" if ($opt_v || $opt_V) ;
}
}
}
sub create_origin {
@origin_record = ();
push(@origin_record, "lat", $lat,
"lon", $lon,
"depth", $depth,
"time", str2epoch("$or_time"),
"orid", $orid,
"nass", $nsta,
"jdate", yearday("$or_time"),
"grn", grn("lat","$lat"),
"srn", srn("lon","$lon"),
"etype", "ex",
"mb", $mb,
"ms", $ms,
"ml", $ml,
"auth", $auth
);
@dbmatch = dblookup(@db,"","origin","","dbSCRATCH");
dbputv(@dbmatch,@origin_record);
@matchall = dbmatches(@dbmatch,@db_origin,"ckor","lat","lon","time","depth","mb","ml","ndef");
if ($#matchall != -1) { # This record matches a pre-existing record in origin table
printf STDERR "No change to origin record for orid: $orid\n" if ($opt_v || $opt_V) ;
next;
} else { # Add the record to the origin table if no lat/lon/time/depth matches
# add the record to the origin table if no lat/lon/timd/depth matches
# update field values if primary key matches
@matchsome = dbmatches(@dbmatch,@db_origin,"ckor2","lat","lon","time");
if ($#matchsome != -1) {
# This record matches a pre-existing origin table record, but values have changed
print STDERR "Updating fields\n" if ($opt_v || $opt_V) ;
$db_origin[3] = $matchsome[0];
dbputv(@db_origin,@origin_record);
} else { # New record (?)
print STDERR "Adding record to origin table: $lat $lon $or_time $orid.\n" if ($opt_v || $opt_V) ;
eval { dbaddv(@db_origin,@origin_record) } ;
if ($@) {
warn $@;
print STDERR "Duplicate origin. $lat, $lon, $depth, $or_time, $mb, $ml, $orid matches pre -existing origin. Will ignore.\n" if ($opt_v || $opt_V) ;
}
}
}
# $orid++;
}
#sub create_moment {
# @moment_record = ();
#
# push(@moment_record, "orid", $orid,
# "mexpon", $expo,
# "mrr", $mrr,
# "mtt", $mss,
# "mff", $mee,
# "mrt", $mrs,
# "mrf", $mre,
# "mtf", $mse,
# "mrrerr", $mrrerr,
# "mtterr", $msserr,
# "mfferr", $meeerr,
# "mrterr", $mrserr,
# "mrferr", $mreerr,
# "mtferr", $mseerr,
# "taxval", $ev[1],
# "taxplg", $evp[1],
# "taxazm", $evaz[1],
# "paxval", $ev[2],
# "paxplg", $evp[2],
# "paxazm", $evaz[2],
# "naxval", $ev[3],
# "naxplg", $evp[3],
# "naxazm", $evaz[3],
# "bestdc", $scmo,
# "str1", $strike[1],
# "dip1", $dip[1],
# "rake1", $rake[1],
# "str2", $strike[2],
# "dip2", $dip[2],
# "rake2", $rake[2],
# "auth", $auth
# );
# dbaddv(@db_moment,@moment_record);
#}
#sub create_centryd {
# @centryd_record = ();
#
# push(@centryd_record, "orid", $orid,
# "jdate", yearday($or_time),
# "timecentryd", str2epoch("$or_time") + $dt,
# "lat", $clat,
# "lon", $clon,
# "depth", $cdepth,
# "coterr", $dterr,
# "claerr", $claterr,
# "cloerr", $clonerr,
# "cdperr", $cdeptherr,
# "durat", $ahdur,
# "nslpb", $bwsta,
# "nrlpb", $bwrec,
# "tmnlpb", $bwcorr,
# "nsmw", $mwsta,
# "nrmw", $mwrec,
# "tmnmw", $mwcorr,
# "auth", $auth
# );
# dbaddv(@db_centryd,@centryd_record);
#}
sub setup_global_vars {
#
# read pf file
#
if ($opt_p) {
$pf = $opt_p;
} else {
$pf = "mchedr2db.pf" ;
}
$account = pfget($pf, "account");
$ref = pfget($pf, 'bulletins') ;
%bulletins = %$ref ;
foreach $key (keys %bulletins) {
$bulltype = $key ;
%$bulltype = (
file => pfget ($pf, "bulletins\{${bulltype}\{file\}\}"),
remote_host => pfget ($pf, "bulletins\{${bulltype}\{remote_host\}\}"),
remote_dir => pfget ($pf, "bulletins\{${bulltype}\{remote_dir\}\}"),
local_dir => pfget ($pf, "bulletins\{${bulltype}\{local_dir\}\}"),
author => pfget ($pf, "bulletins\{${bulltype}\{author\}\}"),
arrivals => pfget ($pf, "bulletins\{${bulltype}\{arrivals\}\}")
);
}
if (!$account) {
my ($name,$passwd,$uid,$gid,$quota,$comment,$gcos) = getpwuid($<) ;
chop ($host = `uname -n`);
$account = "$name\@$host";
}
# print STDERR "Account is $account from pf $Pf. \n" if $opt_v ;
}
sub convert_file {
print STDERR "Going to run convert_file for $file2convert. \n" if $opt_v;
while (<FILE>) {
if (/^\n/) { # new line, can ignore
next;
} elsif (/^HY/ ) { #
# need to flush previous solution...
if ($flush) {
&create_origin;
# &create_event ;
# &create_arrival;
$orid++;
}
$year = substr($_,2,4);
$month = substr($_,6,2);
$day = substr($_,8,2);
$hr = substr($_,11,2);
$min = substr($_,13,2);
$sec = substr($_,15,5);
$lat = substr($_, 21,6);
$latNS = substr($_, 27,1);
$lon = substr($_, 29,7);
$lonEW = substr($_, 36,1);
$depth = substr($_, 38,5);
$dtype = substr($_, 43,1); # depth fixed? N, G, D, * or ? are valid
$sd1 = substr($_, 44,4); # standard deviation (of what???)
$nsta = substr($_, 48,3);
$regionnum = substr($_, 52,3);
if ($day < 10) {
$day =~ s/^\s+//;
}
if ($min < 10) {
$min =~ s/^\s+//;
}
if ($sec < 10) {
$sec =~ s/^\s+//;
}
$or_time = "$month\/$day\/$year $hr:$min:$sec";
print STDERR "Origin time is: $or_time\n" if $opt_v ;
if ( $latNS =~ /S/ ) {
$lat = -$lat ;
}
if ( $lonEW =~ /W/ ) {
$lon = -$lon ;
}
$flush++ ;
next;
} elsif (/^E/) { # should be second line in record. Second test added for
# foul-ups in allorder.dek
$oterr = substr($_, 2,5);
$laterr = substr($_, 8,6);
$lonerr = substr($_, 15,6);
$deperr = substr($_, 22,5);
$mb = substr($_, 28,3);
$mbsta = substr($_, 32,3);
$ms = substr($_, 36,3);
$mssta = substr($_, 40,2);
$mag1 = substr($_, 42,3);
$mag1type = substr($_, 45,2);
$mag1src = substr($_, 47,4);
$mag2 = substr($_, 51,3);
$mag2type = substr($_, 54,2);
$mag2src = substr($_, 56,4);
# $mwrec = substr($_, 22,3);
# $mwcoff = substr($_, 25,4);
# $dt = substr($_, 33,6);
# $dterr = substr($_, 39,4);
# $clat = substr($_, 43,7);
# $claterr = substr($_, 50,5);
# $clon = substr($_, 55,8);
# $clonerr = substr($_, 63,5);
# $cdepth = substr($_, 68,6);
# $cdeptherr = substr($_, 74,5);
if ($ms <= 0.0) {
$ms = "-999.00";
}
#
if ($mb <= 0.0) {
$mb = "-999.00";
}
# need to translate mag1type and mag2type and sest available ml/mb/ms if possible
if ($mag1type =~ /ML/ ) {
$ml = $mag1 ;
} elsif ($mag2type =~ /ML/ ) {
$ml = $mag2 ;
} elsif ($mag1type =~ /MB/ ) {
$mb = $mag1 ;
} elsif ($mag2type =~ /MB/ ) {
$mb = $mag2 ;
} elsif ($mag1type =~ /LG/ ) { # this is mbLg (Nuttli)
$mb = $mag1 ;
} elsif ($mag2type =~ /LG/ ) { # this is mbLg (Nuttli)
$mb = $mag2 ;
} elsif ($mag1type =~ /MD/ ) {
$mb = $mag1 ;
print STDERR "Can't shoehorn MD magtypes: setting MD to ML \n";
} elsif ($mag2type =~ /MD/ ) {
$mb = $mag2 ;
print STDERR "Can't shoehorn MD magtypes: setting MD to ML \n";
} else {
print STDERR "Can't parse magtypes: $mag1type or $mag2type \n";
}
# cube format definitions
# B = body magnitude (Mb)
# C = duration magnitude (Md)
# D = duration magnitude (Md)
# E = energy magnitude (Me)
# G = local magnitude (Ml)
# I = "Tsuboi" moment magnitude (Mi)
# L = local magnitude (Ml)
# N = "Nuttli" surface wave magnitude (MbLg)
# O = moment magnitude (Mw)
# P = body magnitude (Mb)
# S = surface wave magnitude (Ms)
# T = teleseismic moment magnitude (Mt)
# W = regional moment magnitude (Mw)
# see also: http://neic.usgs.gov/neis/epic/code_magnitude.html
next;
} elsif (/^L/) { # 90% error ellipse record
$smjaz = substr($_, 2,6);
$smjplng = substr($_, 8,5);
$smj = substr($_, 13,8);
$intaz = substr($_, 21,6);
$intplng = substr($_, 27,5);
$int = substr($_, 32,8);
$smnaz = substr($_, 40,5);
$smnplng = substr($_, 46,5);
$smn = substr($_, 51,8);
next;
} elsif (/^C/) { # Comments
$comment = substr($_, 2,58);
next;
} elsif (/^A/) { # Moment or tensor info - not programmed
next;
} elsif (/^P/) { # primary phase info
$sta = substr($_, 2,5);
$phase = substr($_, 7,8); # need to remove clarity (e or q?)
$arrhr = substr($_, 15,2);
$arrmin = substr($_, 17,2);
$arrsec = substr($_, 19,5);
$presid = substr($_, 25,5);
$ev2stadist = substr($_, 32,6);
$ev2staaz = substr($_, 39,5);
$stambper = substr($_, 44,4);
$stambamp = substr($_, 48,7);
$stambmag = substr($_, 56,3);
$stambused = substr($_, 59,1);
$arr_time = "$month\/$day\/$year $arrhr:$arrmin:$arrsec";
&clean_phase ;
&create_arrival if ( is_epoch_string($arr_time) && ($bulltype->{arrivals} =~ /yes|YES|Y|y/ || $opt_A )) ;
next;
} elsif (/^M/) { # Surface wave record - not programmed
next;
} elsif (/^S/) { # secondary phase info
# some attention might need to be given if we come across pP phases...
# current rule will be to skip?
$phase = substr($_, 7,8); # need to remove clarity (e or q?)
$arrhr = substr($_, 15,2);
$arrmin = substr($_, 17,2);
$arrsec = substr($_, 19,5);
$arr_time = "$month\/$day\/$year $arrhr:$arrmin:$arrsec";
&clean_phase ;
&create_arrival if (is_epoch_string($arr_time) && ($bulltype->{arrivals} =~ /yes|YES|Y|y/ || $opt_A )) ;
# yet another pick for the same station
$phase = substr($_, 25,8); # need to remove clarity (e or q?)
$arrhr = substr($_, 33,2);
$arrmin = substr($_, 35,2);
$arrsec = substr($_, 37,5);
$arr_time = "$month\/$day\/$year $arrhr:$arrmin:$arrsec";
&clean_phase ;
&create_arrival if (is_epoch_string($arr_time) && ($bulltype->{arrivals} =~ /yes|YES|Y|y/ || $opt_A)) ;
$phase = substr($_, 43,8); # need to remove clarity (e or q?)
$arrhr = substr($_, 51,2);
$arrmin = substr($_, 53,2);
$arrsec = substr($_, 55,5);
$arr_time = "$month\/$day\/$year $arrhr:$arrmin:$arrsec";
&clean_phase ;
&create_arrival if (is_epoch_string($arr_time) && ($bulltype->{arrivals} =~ /yes|YES|Y|y/ || $opt_A)) ;
next;
}
}
print STDERR "Going to create origin record.\n" if $opt_v;
&create_origin;
}
sub check_remote_list {
foreach (@listing) {
(@foo) = split(/\s+/, $_);
if ($foo[0] =~ /total/) {
next;
} elsif ($foo[8] =~ /$iwant/) {
$getfile = $foo[8] or die "Couldn't find file name for @foo \n";
$upd_mo = $foo[5];
$upd_dy = $foo[6];
$upd_t_yr = $foo[7];
if ($upd_t_yr =~ /:/) { # use current yeary
$upd_yr = (localtime())[7];
$upd_yr += 1900;
} else {
$upd_yr = $upd_t_yr;
}
# get last update time of remote file (this could be replaced by an ftp->mdtm if permissions allow)
print STDERR "file is $getfile \n" if $opt_v;
$last_remote_update = str2epoch("$upd_mo $upd_dy $upd_yr $upd_time") || die "Couldn't find last update time of $getfile\n";
# $last_remote_update = $ftp->mdtm( $getfile) || die "Couldn't get modify time on remote $getfile \n";
print STDERR "Last remote update time is: $last_remote_update \n" if $opt_v ;
if (-e $mchedr_store.$getfile) {
$local_update = (stat("$mchedr_store$getfile"))[9] || die "Couldn't find last update time for $mchedr_store$getfile \n";
print STDERR "Local update for $getfile: $local_update. Remote update for $getfile: $last_remote_update\n";
if ($local_update < $last_remote_update) {
&get_remote_file;
next;
} else {
print STDERR "No change to file $getfile. \n";
}
} else {
print STDERR "File $getfile does not exist locally, grabbing it. \n";
&get_remote_file;
next;
}
} else {
print STDERR "no match for $foo[8] \n" if $opt_v;
next;
}
}
}
sub get_remote_file {
print STDERR "Retreiving file $getfile from $bulltype->{remote_host}.\n";
$ftp->get($getfile,$mchedr_store.$getfile) || die "Can't retreive file $getfile from $remote_host or store it as $mchedr_store.$getfile.\n";
@convert_list = (@convert_list, $mchedr_store.$getfile);
}
sub run { # run system cmds safely
my ( $cmd ) = @_ ;
print STDERR "run cmd is $cmd \n" if ($opt_v || $opt_V) ;
system ( $cmd ) ;
if ($?) {
print STDERR "$cmd error $? \n" ;
exit(1);
}
}
sub trim {
my @out = @_;
for (@out) {
s/^\s+//;
s/\s+$//;
}
return wantarray ? @out : $out[0];
}
sub clean_phase {
if ($phase =~ /e/) {
$phase =~ s/e//g;
} elsif ($phase =~ /q/) {
$phase =~ s/q//g;
} elsif ($phase =~ /^p/) {
$phase = "";
next;
}
}
| XProc | 4 | jreyes1108/antelope_contrib | bin/import/mchedr2db/mchedr2db.xpl | [
"BSD-2-Clause",
"MIT"
] |
# pyenv
This plugin looks for [pyenv](https://github.com/pyenv/pyenv), a Simple Python version
management system, and loads it if it's found. It also loads pyenv-virtualenv, a pyenv
plugin to manage virtualenv, if it's found.
To use it, add `pyenv` to the plugins array in your zshrc file:
```zsh
plugins=(... pyenv)
```
## Settings
- `ZSH_PYENV_QUIET`: if set to `true`, the plugin will not print any messages if it
finds that `pyenv` is not properly configured.
- `ZSH_PYENV_VIRTUALENV`: if set to `false`, the plugin will not load pyenv-virtualenv
when it finds it.
## Functions
- `pyenv_prompt_info`: displays the Python version in use by pyenv; or the global Python
version, if pyenv wasn't found.
| Markdown | 4 | sshishov/ohmyzsh | plugins/pyenv/README.md | [
"MIT"
] |
# set base frequency
60 mtof 0 pset
'amps' '0.5 0.5 0.1 0.1 0.2 0.2' gen_vals
'padsynth' 262144 0 p 40 'amps' gen_padsynth
36 mtof 0 p / 'padsynth' tbldur / 0 phasor
1 0 0 'padsynth' tabread 0 0.1 3 randi *
60 mtof 0 p / 'padsynth' tbldur / 0 phasor
1 0 0 'padsynth' tabread 0 0.1 2 randi *
65 mtof 0 p / 'padsynth' tbldur / 0 phasor
1 0 0 'padsynth' tabread 0 0.15 1 randi *
70 mtof 0 p / 'padsynth' tbldur / 0 phasor
1 0 0 'padsynth' tabread 0 0.2 0.5 randi *
+ + +
#dup jcrev 4 * swap 0.2 * +
dup dup 0.9 3000 revsc 0.1 * drop +
| SourcePawn | 2 | aleatoricforest/Sporth | examples/padsynth.sp | [
"MIT"
] |
#import <Foundation/Foundation.h>
typedef NSString * const PandaStyle NS_STRING_ENUM;
extern PandaStyle PandaStyleCute;
| C | 2 | lwhsu/swift | test/IRGen/Inputs/clang_string_enum.h | [
"Apache-2.0"
] |
"""Constants for the Radio Thermostat integration."""
DOMAIN = "radiotherm"
TIMEOUT = 25
| Python | 1 | mib1185/core | homeassistant/components/radiotherm/const.py | [
"Apache-2.0"
] |
package com.baeldung.properties.testproperty;
import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@TestPropertySource("/foo.properties")
public class FilePropertyInjectionUnitTest {
@Value("${foo}")
private String foo;
@Test
public void whenFilePropertyProvided_thenProperlyInjected() {
assertThat(foo).isEqualTo("bar");
}
}
| Java | 4 | DBatOWL/tutorials | spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/properties/testproperty/FilePropertyInjectionUnitTest.java | [
"MIT"
] |
-- name: create-table-builds
CREATE TABLE IF NOT EXISTS builds (
build_id INTEGER PRIMARY KEY AUTOINCREMENT
,build_repo_id INTEGER
,build_trigger TEXT
,build_number INTEGER
,build_parent INTEGER
,build_status TEXT
,build_error TEXT
,build_event TEXT
,build_action TEXT
,build_link TEXT
,build_timestamp INTEGER
,build_title TEXT
,build_message TEXT
,build_before TEXT
,build_after TEXT
,build_ref TEXT
,build_source_repo TEXT
,build_source TEXT
,build_target TEXT
,build_author TEXT
,build_author_name TEXT
,build_author_email TEXT
,build_author_avatar TEXT
,build_sender TEXT
,build_deploy TEXT
,build_params TEXT
,build_started INTEGER
,build_finished INTEGER
,build_created INTEGER
,build_updated INTEGER
,build_version INTEGER
,UNIQUE(build_repo_id, build_number)
--,FOREIGN KEY(build_repo_id) REFERENCES repos(repo_id) ON DELETE CASCADE
);
-- name: create-index-builds-repo
CREATE INDEX IF NOT EXISTS ix_build_repo ON builds (build_repo_id);
-- name: create-index-builds-author
CREATE INDEX IF NOT EXISTS ix_build_author ON builds (build_author);
-- name: create-index-builds-sender
CREATE INDEX IF NOT EXISTS ix_build_sender ON builds (build_sender);
-- name: create-index-builds-ref
CREATE INDEX IF NOT EXISTS ix_build_ref ON builds (build_repo_id, build_ref);
-- name: create-index-build-incomplete
CREATE INDEX IF NOT EXISTS ix_build_incomplete ON builds (build_status)
WHERE build_status IN ('pending', 'running');
-- name: alter-table-builds-add-column-debug
ALTER TABLE builds ADD COLUMN build_debug BOOLEAN NOT NULL DEFAULT 0;
| SQL | 4 | sthagen/drone-drone | store/shared/migrate/sqlite/files/004_create_table_builds.sql | [
"Apache-2.0"
] |
{{ flashSession.output() }}
<div class="row">
<div class="col-sm-12">
<div class="card card-secondary">
<div class="card-header">
<h3 class="card-title">
Controllers List<br />
<small>All controllers that we managed to find</small>
</h3>
<div class="card-tools">
{{ link_to(webtools_uri ~ "/controllers/generate", "Generate", 'class': 'btn btn-primary') }}
</div>
</div>
<div class="card-body">
<table class="table table-hover">
<tr>
<th>Name</th>
<th>Size</th>
<th>Owner</th>
<th>Last modified</th>
<th width="10%">Actions</th>
</tr>
{%- if controllers_dir is empty -%}
<tr class="warning">
<td colspan="5">
<p class="text-center">
Sorry, Phalcon WebTools doesn't know where the controllers directory is.<br>
Please add the valid path for <code>controllersDir</code>
in the <code>application</code> section.
</p>
</td>
</tr>
{%- else -%}
{% for controller in controllers %}
<tr>
<td>
{{- controller.name }}
{% if controller.is_writable is false -%}
<span class="label label-warning">ro</span>
{%- endif -%}
</td>
<td>{{ controller.size ~ ' b'}}</td>
<td>{{ controller.owner }}</td>
<td>{{ controller.modified_time }}</td>
<td>
{{ link_to(webtools_uri ~ "/controllers/edit/" ~ rawurlencode(controller.filename),
'<i class="fas fa-pen-square"></i>', 'class': 'btn btn-warning btn-sm') }}
</td>
</tr>
{% endfor %}
{%- endif -%}
</table>
</div>
</div>
</div>
</div>
| Volt | 4 | PSD-Company/phalcon-devtools-docker | src/Web/Tools/Views/controllers/index.volt | [
"BSD-3-Clause"
] |
(defprolog g
a <--;)
(defprolog h
b <--;)
(defprolog i
a <--;
b <--;)
(defprolog j
b <--;)
(defprolog f
X <-- (g X) (fork [(h X) (i X) (j X)]);) | Shen | 3 | tizoc/chibi-shen | shen-test-programs/fork.shen | [
"BSD-3-Clause"
] |
<component name="icon">
<nss>
icon: {
width: 24,
height: 24,
fontFamily: "ionicons"
}
</nss>
<layout class="icon">
</layout>
<script>
module.exports = class extends Component {
constructor(attr) {
super(attr);
this.shape = attr.shape || "";
this.style.coating = 4;
if (!this.style.lineHeight) {
this.style.lineHeight = this.style.height-1;
}
}
paint(ctx, width, height) {
super.paint(ctx, width, height);
let ox = 0;
let icon = window.fontShapes[this.shape];
let w = ctx.measureText(icon).width;
let lineHeight = this.style.lineHeight;
let oy = Math.ceil(lineHeight*0.5);
if (this.style.textAlign == "center") {
ox = (width-w)*0.5-1;
}
if (this.style.textAlign == "right") {
ox = (width-w);
}
ctx.fontFamily = this.style.fontFamily;
ctx.fontSize = this.style.fontSize;
ctx.fillStyle = this.style.color;
ctx.textBaseline = "middle";
ctx.fillText(icon, ox, oy-2);
}
}
</script>
</component>
| nesC | 4 | wiltonlazary/Nidium | src/Embed/framework/components/icon.nc | [
"Apache-2.0",
"BSD-2-Clause"
] |
// moduleSuffixes has one entry and there's a matching package with a specific path.
// @fullEmitPaths: true
// @filename: /tsconfig.json
{
"compilerOptions": {
"allowJs": true,
"checkJs": false,
"outDir": "bin",
"moduleResolution": "node",
"traceResolution": true,
"moduleSuffixes": [".ios"]
}
}
// @filename: /node_modules/some-library/foo.ios.js
"use strict";
exports.__esModule = true;
function iosfoo() {}
exports.iosfoo = iosfoo;
// @filename: /node_modules/some-library/foo.ios.d.ts
export declare function iosfoo(): void;
// @filename: /node_modules/some-library/foo.js
"use strict";
exports.__esModule = true;
function basefoo() {}
exports.basefoo = basefoo;
// @filename: /node_modules/some-library/foo.d.ts
export declare function basefoo(): void;
// @filename: /index.ts
import { iosfoo } from "some-library/foo";
| TypeScript | 4 | monciego/TypeScript | tests/cases/compiler/moduleResolutionWithSuffixes_one_externalModulePath.ts | [
"Apache-2.0"
] |
/*##############################################################################
HPCC SYSTEMS software Copyright (C) 2017 HPCC Systems®.
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.
############################################################################## */
//nohthor
//nothor
resistorCodes := dataset([{0, 'Black'},
{1, 'Brown'},
{2, 'Red'},
{3, 'Orange'},
{4, 'Yellow'},
{5, 'Green'},
{6, 'Blue'},
{7, 'Violet'},
{8, 'Grey'},
{9, 'White'}], {unsigned1 value, string color}) : stored('colorMap');
color2code := DICTIONARY(resistorCodes, { color => value});
bands := DATASET([{'Red'},{'Yellow'},{'Blue'}], {string band}) : STORED('bands');
valrec := RECORD
unsigned1 value;
END;
valrec getValue(bands L) := TRANSFORM
SELF.value := color2code[L.band].value;
END;
results := allnodes(PROJECT(bands, getValue(LEFT)));
ave(results, value); // Should remain the same regardless of how many slaves there are
| ECL | 4 | miguelvazq/HPCC-Platform | testing/regress/ecl/dictallnodes.ecl | [
"Apache-2.0"
] |
Strict
Import "bmk_modutil.bmx"
Import "bmk_util.bmx"
Type TInfo
Field info:TList=New TList
Method Find$( key$ )
key=key.ToLower()+":"
For Local t$=EachIn info
If t.ToLower()[..Len(key)]=key Return t[Len(key)..].Trim()
Next
End Method
Method ReadFromStream:TModInfo( stream:TStream )
While Not stream.Eof()
Local t$=stream.ReadLine()
If Not t Return
info.AddLast t
Wend
End Method
End Type
Type TModInfo Extends TInfo
Field name$
Field version#
Field modprivs$
Field modserver$
Field serverinfo:Object
Function CreateFromModule:TModInfo( name$ )
Local path$=ModuleInterface( name,"release."+cfg_platform+"."+opt_arch )
If FileType(path)<>FILETYPE_FILE Return
Local src:TSourceFile=ParseSourceFile( path )
If Not src Return
Local modinfo:TModInfo=New TModInfo
modinfo.name=name
modinfo.info=src.info
modinfo.info.AddFirst "Module: "+name
modinfo.version=Float( modinfo.Find( "Version" ) )
modinfo.modserver=modinfo.Find( "ModServer" )
Return modinfo
End Function
Function CreateFromStream:TModInfo( stream:TStream )
Local modinfo:TModInfo=New TModInfo
modinfo.ReadFromStream stream
modinfo.name=modinfo.Find( "Module" )
If Not modinfo.name Return
modinfo.version=Float( modinfo.Find( "Version" ) )
modinfo.modprivs=modinfo.Find( "ModPrivs" )
modinfo.modserver=modinfo.Find( "ModServer" )
Return modinfo
End Function
End Type
| BlitzMax | 5 | jabdoa2/blitzmax | src/bmk/bmk_modinfo.bmx | [
"Zlib"
] |
CREATE TABLE `rollups` (
`metric_id` int(10) unsigned NOT NULL,
`value` bigint(20) DEFAULT NULL,
PRIMARY KEY (`metric_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
| LOLCODE | 3 | Madhur1997/skeema | fs/testdata/sqlsymlinks/product/extensiondontmatter.lol | [
"Apache-2.0"
] |
from django.contrib import admin
from django.contrib.admin import sites
from django.test import SimpleTestCase, override_settings
from .sites import CustomAdminSite
@override_settings(INSTALLED_APPS=[
'admin_default_site.apps.MyCustomAdminConfig',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
])
class CustomAdminSiteTests(SimpleTestCase):
def setUp(self):
# Reset admin.site since it may have already been instantiated by
# another test app.
self._old_site = admin.site
admin.site = sites.site = sites.DefaultAdminSite()
def tearDown(self):
admin.site = sites.site = self._old_site
def test_use_custom_admin_site(self):
self.assertEqual(admin.site.__class__.__name__, 'CustomAdminSite')
class DefaultAdminSiteTests(SimpleTestCase):
def test_use_default_admin_site(self):
self.assertEqual(admin.site.__class__.__name__, 'AdminSite')
def test_repr(self):
self.assertEqual(str(admin.site), "AdminSite(name='admin')")
self.assertEqual(repr(admin.site), "AdminSite(name='admin')")
class AdminSiteTests(SimpleTestCase):
def test_repr(self):
admin_site = CustomAdminSite(name='other')
self.assertEqual(repr(admin_site), "CustomAdminSite(name='other')")
| Python | 4 | KaushikSathvara/django | tests/admin_default_site/tests.py | [
"BSD-3-Clause",
"0BSD"
] |
#tag Class
Protected Class GKTurnBasedParticipant
Inherits NSObject
#tag Method, Flags = &h21
Private Shared Function ClassRef() As Ptr
static ref as ptr = NSClassFromString("GKTurnBasedParticipant")
return ref
End Function
#tag EndMethod
#tag ComputedProperty, Flags = &h0
#tag Getter
Get
declare function lastTurnDate_ lib GameKitLib selector "lastTurnDate" (obj_id as ptr) as ptr
Return new NSDate(lastTurnDate_(self))
End Get
#tag EndGetter
lastTurnDate As NSDate
#tag EndComputedProperty
#tag ComputedProperty, Flags = &h0
#tag Getter
Get
declare function matchOutcome_ lib GameKitLib selector "matchOutcome" (obj_id as ptr) as GKTurnBasedMatchOutcome
Return (matchOutcome_(self))
End Get
#tag EndGetter
#tag Setter
Set
declare sub matchOutcome_ lib GameKitLib selector "setMatchOutcome:" (obj_id as ptr, matchOutcome as GKTurnBasedMatchOutcome)
matchOutcome_(self, value)
End Set
#tag EndSetter
matchOutcome As GKTurnBasedMatchOutcome
#tag EndComputedProperty
#tag ComputedProperty, Flags = &h0
#tag Getter
Get
declare function player_ lib GameKitLib selector "player" (obj_id as ptr) as ptr
Return new GKPlayer(player_(self))
End Get
#tag EndGetter
player As GKPlayer
#tag EndComputedProperty
#tag ComputedProperty, Flags = &h0
#tag Getter
Get
declare function status_ lib GameKitLib selector "status" (obj_id as ptr) as GKTurnBasedParticipantStatus
Return (status_(self))
End Get
#tag EndGetter
status As GKTurnBasedParticipantStatus
#tag EndComputedProperty
#tag ComputedProperty, Flags = &h0
#tag Getter
Get
declare function timeoutDate_ lib GameKitLib selector "timeoutDate" (obj_id as ptr) as ptr
Return new NSDate(timeoutDate_(self))
End Get
#tag EndGetter
timeoutDate As NSDate
#tag EndComputedProperty
#tag ViewBehavior
#tag ViewProperty
Name="Index"
Visible=true
Group="ID"
InitialValue="-2147483648"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Left"
Visible=true
Group="Position"
InitialValue="0"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Name"
Visible=true
Group="ID"
InitialValue=""
Type="String"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Super"
Visible=true
Group="ID"
InitialValue=""
Type="String"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Top"
Visible=true
Group="Position"
InitialValue="0"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="matchOutcome"
Visible=false
Group="Behavior"
InitialValue=""
Type="GKTurnBasedMatchOutcome"
EditorType="Enum"
#tag EnumValues
"0 - None"
"1 - Quit"
"2 - Won"
"3 - Lost"
"4 - Tied"
"5 - TimeExpired"
"6 - First"
"7 - Second"
"8 - Third"
"9 - Fourth"
#tag EndEnumValues
#tag EndViewProperty
#tag ViewProperty
Name="status"
Visible=false
Group="Behavior"
InitialValue=""
Type="GKTurnBasedParticipantStatus"
EditorType="Enum"
#tag EnumValues
"0 - Unknown"
"1 - Invited"
"2 - Declined"
"3 - Matching"
"4 - Active"
"5 - Done"
#tag EndEnumValues
#tag EndViewProperty
#tag EndViewBehavior
End Class
#tag EndClass
| Xojo | 3 | kingj5/iOSKit | Modules/GameKitFolder/GameKit/GKTurnBasedParticipant.xojo_code | [
"MIT"
] |
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#include "test_precomp.hpp"
#include <opencv2/dnn/shape_utils.hpp>
#include "npy_blob.hpp"
namespace opencv_test { namespace {
template<typename TString>
static std::string _tf(TString filename, bool required = true)
{
String rootFolder = "dnn/";
return findDataFile(rootFolder + filename, required);
}
class Test_Model : public DNNTestLayer
{
public:
void testDetectModel(const std::string& weights, const std::string& cfg,
const std::string& imgPath, const std::vector<int>& refClassIds,
const std::vector<float>& refConfidences,
const std::vector<Rect2d>& refBoxes,
double scoreDiff, double iouDiff,
double confThreshold = 0.24, double nmsThreshold = 0.0,
const Size& size = {-1, -1}, Scalar mean = Scalar(),
double scale = 1.0, bool swapRB = false, bool crop = false,
bool nmsAcrossClasses = false)
{
checkBackend();
Mat frame = imread(imgPath);
DetectionModel model(weights, cfg);
model.setInputSize(size).setInputMean(mean).setInputScale(scale)
.setInputSwapRB(swapRB).setInputCrop(crop);
model.setPreferableBackend(backend);
model.setPreferableTarget(target);
model.setNmsAcrossClasses(nmsAcrossClasses);
std::vector<int> classIds;
std::vector<float> confidences;
std::vector<Rect> boxes;
model.detect(frame, classIds, confidences, boxes, confThreshold, nmsThreshold);
std::vector<Rect2d> boxesDouble(boxes.size());
for (int i = 0; i < boxes.size(); i++) {
boxesDouble[i] = boxes[i];
}
normAssertDetections(refClassIds, refConfidences, refBoxes, classIds,
confidences, boxesDouble, "",
confThreshold, scoreDiff, iouDiff);
}
void testClassifyModel(const std::string& weights, const std::string& cfg,
const std::string& imgPath, std::pair<int, float> ref, float norm,
const Size& size = {-1, -1}, Scalar mean = Scalar(),
double scale = 1.0, bool swapRB = false, bool crop = false)
{
checkBackend();
Mat frame = imread(imgPath);
ClassificationModel model(weights, cfg);
model.setInputSize(size).setInputMean(mean).setInputScale(scale)
.setInputSwapRB(swapRB).setInputCrop(crop);
std::pair<int, float> prediction = model.classify(frame);
EXPECT_EQ(prediction.first, ref.first);
ASSERT_NEAR(prediction.second, ref.second, norm);
}
void testKeypointsModel(const std::string& weights, const std::string& cfg,
const Mat& frame, const Mat& exp, float norm,
const Size& size = {-1, -1}, Scalar mean = Scalar(),
double scale = 1.0, bool swapRB = false, bool crop = false)
{
checkBackend();
std::vector<Point2f> points;
KeypointsModel model(weights, cfg);
model.setInputSize(size).setInputMean(mean).setInputScale(scale)
.setInputSwapRB(swapRB).setInputCrop(crop);
model.setPreferableBackend(backend);
model.setPreferableTarget(target);
points = model.estimate(frame, 0.5);
Mat out = Mat(points).reshape(1);
normAssert(exp, out, "", norm, norm);
}
void testSegmentationModel(const std::string& weights_file, const std::string& config_file,
const std::string& inImgPath, const std::string& outImgPath,
float norm, const Size& size = {-1, -1}, Scalar mean = Scalar(),
double scale = 1.0, bool swapRB = false, bool crop = false)
{
checkBackend();
Mat frame = imread(inImgPath);
Mat mask;
Mat exp = imread(outImgPath, 0);
SegmentationModel model(weights_file, config_file);
model.setInputSize(size).setInputMean(mean).setInputScale(scale)
.setInputSwapRB(swapRB).setInputCrop(crop);
model.segment(frame, mask);
normAssert(mask, exp, "", norm, norm);
}
void testTextRecognitionModel(const std::string& weights, const std::string& cfg,
const std::string& imgPath, const std::string& seq,
const std::string& decodeType, const std::vector<std::string>& vocabulary,
const Size& size = {-1, -1}, Scalar mean = Scalar(),
double scale = 1.0, bool swapRB = false, bool crop = false)
{
checkBackend();
Mat frame = imread(imgPath, IMREAD_GRAYSCALE);
TextRecognitionModel model(weights, cfg);
model.setDecodeType(decodeType)
.setVocabulary(vocabulary)
.setInputSize(size).setInputMean(mean).setInputScale(scale)
.setInputSwapRB(swapRB).setInputCrop(crop);
model.setPreferableBackend(backend);
model.setPreferableTarget(target);
std::string result = model.recognize(frame);
EXPECT_EQ(result, seq) << "Full frame: " << imgPath;
std::vector<Rect> rois;
rois.push_back(Rect(0, 0, frame.cols, frame.rows));
rois.push_back(Rect(0, 0, frame.cols, frame.rows)); // twice
std::vector<std::string> results;
model.recognize(frame, rois, results);
EXPECT_EQ((size_t)2u, results.size()) << "ROI: " << imgPath;
EXPECT_EQ(results[0], seq) << "ROI[0]: " << imgPath;
EXPECT_EQ(results[1], seq) << "ROI[1]: " << imgPath;
}
void testTextDetectionModelByDB(const std::string& weights, const std::string& cfg,
const std::string& imgPath, const std::vector<std::vector<Point>>& gt,
float binThresh, float polyThresh,
uint maxCandidates, double unclipRatio,
const Size& size = {-1, -1}, Scalar mean = Scalar(),
double scale = 1.0, bool swapRB = false, bool crop = false)
{
checkBackend();
Mat frame = imread(imgPath);
TextDetectionModel_DB model(weights, cfg);
model.setBinaryThreshold(binThresh)
.setPolygonThreshold(polyThresh)
.setUnclipRatio(unclipRatio)
.setMaxCandidates(maxCandidates)
.setInputSize(size).setInputMean(mean).setInputScale(scale)
.setInputSwapRB(swapRB).setInputCrop(crop);
model.setPreferableBackend(backend);
model.setPreferableTarget(target);
// 1. Check common TextDetectionModel API through RotatedRect
std::vector<cv::RotatedRect> results;
model.detectTextRectangles(frame, results);
EXPECT_GT(results.size(), (size_t)0);
std::vector< std::vector<Point> > contours;
for (size_t i = 0; i < results.size(); i++)
{
const RotatedRect& box = results[i];
Mat contour;
boxPoints(box, contour);
std::vector<Point> contour2i(4);
for (int i = 0; i < 4; i++)
{
contour2i[i].x = cvRound(contour.at<float>(i, 0));
contour2i[i].y = cvRound(contour.at<float>(i, 1));
}
contours.push_back(contour2i);
}
#if 0 // test debug
Mat result = frame.clone();
drawContours(result, contours, -1, Scalar(0, 0, 255), 1);
imshow("result", result); // imwrite("result.png", result);
waitKey(0);
#endif
normAssertTextDetections(gt, contours, "", 0.05f);
// 2. Check quadrangle-based API
// std::vector< std::vector<Point> > contours;
model.detect(frame, contours);
#if 0 // test debug
Mat result = frame.clone();
drawContours(result, contours, -1, Scalar(0, 0, 255), 1);
imshow("result_contours", result); // imwrite("result_contours.png", result);
waitKey(0);
#endif
normAssertTextDetections(gt, contours, "", 0.05f);
}
void testTextDetectionModelByEAST(
const std::string& weights, const std::string& cfg,
const std::string& imgPath, const std::vector<RotatedRect>& gt,
float confThresh, float nmsThresh,
const Size& size = {-1, -1}, Scalar mean = Scalar(),
double scale = 1.0, bool swapRB = false, bool crop = false,
double eps_center = 5/*pixels*/, double eps_size = 5/*pixels*/, double eps_angle = 1
)
{
checkBackend();
Mat frame = imread(imgPath);
TextDetectionModel_EAST model(weights, cfg);
model.setConfidenceThreshold(confThresh)
.setNMSThreshold(nmsThresh)
.setInputSize(size).setInputMean(mean).setInputScale(scale)
.setInputSwapRB(swapRB).setInputCrop(crop);
model.setPreferableBackend(backend);
model.setPreferableTarget(target);
std::vector<cv::RotatedRect> results;
model.detectTextRectangles(frame, results);
EXPECT_EQ(results.size(), (size_t)1);
for (size_t i = 0; i < results.size(); i++)
{
const RotatedRect& box = results[i];
#if 0 // test debug
Mat contour;
boxPoints(box, contour);
std::vector<Point> contour2i(4);
for (int i = 0; i < 4; i++)
{
contour2i[i].x = cvRound(contour.at<float>(i, 0));
contour2i[i].y = cvRound(contour.at<float>(i, 1));
}
std::vector< std::vector<Point> > contours;
contours.push_back(contour2i);
Mat result = frame.clone();
drawContours(result, contours, -1, Scalar(0, 0, 255), 1);
imshow("result", result); //imwrite("result.png", result);
waitKey(0);
#endif
const RotatedRect& gtBox = gt[i];
EXPECT_NEAR(box.center.x, gtBox.center.x, eps_center);
EXPECT_NEAR(box.center.y, gtBox.center.y, eps_center);
EXPECT_NEAR(box.size.width, gtBox.size.width, eps_size);
EXPECT_NEAR(box.size.height, gtBox.size.height, eps_size);
EXPECT_NEAR(box.angle, gtBox.angle, eps_angle);
}
}
};
TEST_P(Test_Model, Classify)
{
std::pair<int, float> ref(652, 0.641789);
std::string img_path = _tf("grace_hopper_227.png");
std::string config_file = _tf("bvlc_alexnet.prototxt");
std::string weights_file = _tf("bvlc_alexnet.caffemodel", false);
Size size{227, 227};
float norm = 1e-4;
testClassifyModel(weights_file, config_file, img_path, ref, norm, size);
}
TEST_P(Test_Model, DetectRegion)
{
applyTestTag(
CV_TEST_TAG_LONG,
CV_TEST_TAG_MEMORY_2GB
);
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021040000)
// accuracy
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL_FP16)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
#endif
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2020040000) // nGraph compilation failure
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL_FP16)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
#endif
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GE(2019010000)
// FIXIT DNN_BACKEND_INFERENCE_ENGINE is misused
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_OPENCL_FP16)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16);
#endif
#if defined(INF_ENGINE_RELEASE)
if (target == DNN_TARGET_MYRIAD
&& getInferenceEngineVPUType() == CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X);
#endif
std::vector<int> refClassIds = {6, 1, 11};
std::vector<float> refConfidences = {0.750469f, 0.780879f, 0.901615f};
std::vector<Rect2d> refBoxes = {Rect2d(240, 53, 135, 72),
Rect2d(112, 109, 192, 200),
Rect2d(58, 141, 117, 249)};
std::string img_path = _tf("dog416.png");
std::string weights_file = _tf("yolo-voc.weights", false);
std::string config_file = _tf("yolo-voc.cfg");
double scale = 1.0 / 255.0;
Size size{416, 416};
bool swapRB = true;
double confThreshold = 0.24;
double nmsThreshold = (target == DNN_TARGET_MYRIAD) ? 0.397 : 0.4;
double scoreDiff = 8e-5, iouDiff = 1e-5;
if (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD || target == DNN_TARGET_CUDA_FP16)
{
scoreDiff = 1e-2;
iouDiff = 1.6e-2;
}
testDetectModel(weights_file, config_file, img_path, refClassIds, refConfidences,
refBoxes, scoreDiff, iouDiff, confThreshold, nmsThreshold, size,
Scalar(), scale, swapRB);
}
TEST_P(Test_Model, DetectRegionWithNmsAcrossClasses)
{
applyTestTag(
CV_TEST_TAG_LONG,
CV_TEST_TAG_MEMORY_2GB
);
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021040000)
// accuracy
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL_FP16)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
#endif
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2020040000) // nGraph compilation failure
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL_FP16)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
#endif
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GE(2019010000)
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_OPENCL_FP16)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16);
#endif
#if defined(INF_ENGINE_RELEASE)
if (target == DNN_TARGET_MYRIAD
&& getInferenceEngineVPUType() == CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X);
#endif
std::vector<int> refClassIds = { 6, 11 };
std::vector<float> refConfidences = { 0.750469f, 0.901615f };
std::vector<Rect2d> refBoxes = { Rect2d(240, 53, 135, 72),
Rect2d(58, 141, 117, 249) };
std::string img_path = _tf("dog416.png");
std::string weights_file = _tf("yolo-voc.weights", false);
std::string config_file = _tf("yolo-voc.cfg");
double scale = 1.0 / 255.0;
Size size{ 416, 416 };
bool swapRB = true;
bool crop = false;
bool nmsAcrossClasses = true;
double confThreshold = 0.24;
double nmsThreshold = (target == DNN_TARGET_MYRIAD) ? 0.15: 0.15;
double scoreDiff = 8e-5, iouDiff = 1e-5;
if (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD || target == DNN_TARGET_CUDA_FP16)
{
scoreDiff = 1e-2;
iouDiff = 1.6e-2;
}
testDetectModel(weights_file, config_file, img_path, refClassIds, refConfidences,
refBoxes, scoreDiff, iouDiff, confThreshold, nmsThreshold, size,
Scalar(), scale, swapRB, crop,
nmsAcrossClasses);
}
TEST_P(Test_Model, DetectionOutput)
{
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021040000)
// Exception: Function contains several inputs and outputs with one friendly name! (HETERO bug?)
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target != DNN_TARGET_CPU)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
#endif
#if defined(INF_ENGINE_RELEASE)
// FIXIT DNN_BACKEND_INFERENCE_ENGINE is misused
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_OPENCL_FP16)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16);
if (target == DNN_TARGET_MYRIAD)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD);
#endif
std::vector<int> refClassIds = {7, 12};
std::vector<float> refConfidences = {0.991359f, 0.94786f};
std::vector<Rect2d> refBoxes = {Rect2d(491, 81, 212, 98),
Rect2d(132, 223, 207, 344)};
std::string img_path = _tf("dog416.png");
std::string weights_file = _tf("resnet50_rfcn_final.caffemodel", false);
std::string config_file = _tf("rfcn_pascal_voc_resnet50.prototxt");
Scalar mean = Scalar(102.9801, 115.9465, 122.7717);
Size size{800, 600};
double scoreDiff = default_l1, iouDiff = 1e-5;
float confThreshold = 0.8;
double nmsThreshold = 0.0;
if (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_CUDA_FP16)
{
if (backend == DNN_BACKEND_OPENCV)
scoreDiff = 4e-3;
else
scoreDiff = 2e-2;
iouDiff = 1.8e-1;
}
testDetectModel(weights_file, config_file, img_path, refClassIds, refConfidences, refBoxes,
scoreDiff, iouDiff, confThreshold, nmsThreshold, size, mean);
}
TEST_P(Test_Model, DetectionMobilenetSSD)
{
Mat ref = blobFromNPY(_tf("mobilenet_ssd_caffe_out.npy"));
ref = ref.reshape(1, ref.size[2]);
std::string img_path = _tf("street.png");
Mat frame = imread(img_path);
int frameWidth = frame.cols;
int frameHeight = frame.rows;
std::vector<int> refClassIds;
std::vector<float> refConfidences;
std::vector<Rect2d> refBoxes;
for (int i = 0; i < ref.rows; i++)
{
refClassIds.emplace_back(ref.at<float>(i, 1));
refConfidences.emplace_back(ref.at<float>(i, 2));
int left = ref.at<float>(i, 3) * frameWidth;
int top = ref.at<float>(i, 4) * frameHeight;
int right = ref.at<float>(i, 5) * frameWidth;
int bottom = ref.at<float>(i, 6) * frameHeight;
int width = right - left + 1;
int height = bottom - top + 1;
refBoxes.emplace_back(left, top, width, height);
}
std::string weights_file = _tf("MobileNetSSD_deploy.caffemodel", false);
std::string config_file = _tf("MobileNetSSD_deploy.prototxt");
Scalar mean = Scalar(127.5, 127.5, 127.5);
double scale = 1.0 / 127.5;
Size size{300, 300};
double scoreDiff = 1e-5, iouDiff = 1e-5;
if (target == DNN_TARGET_OPENCL_FP16)
{
scoreDiff = 1.7e-2;
iouDiff = 6.91e-2;
}
else if (target == DNN_TARGET_MYRIAD)
{
scoreDiff = 0.017;
if (getInferenceEngineVPUType() == CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X)
iouDiff = 0.1;
}
else if (target == DNN_TARGET_CUDA_FP16)
{
scoreDiff = 0.002;
iouDiff = 1e-2;
}
float confThreshold = FLT_MIN;
double nmsThreshold = 0.0;
testDetectModel(weights_file, config_file, img_path, refClassIds, refConfidences, refBoxes,
scoreDiff, iouDiff, confThreshold, nmsThreshold, size, mean, scale);
}
TEST_P(Test_Model, Keypoints_pose)
{
if (target == DNN_TARGET_OPENCL_FP16)
applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL_FP16);
#ifdef HAVE_INF_ENGINE
if (target == DNN_TARGET_MYRIAD)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
#endif
Mat inp = imread(_tf("pose.png"));
std::string weights = _tf("onnx/models/lightweight_pose_estimation_201912.onnx", false);
float kpdata[] = {
237.65625f, 78.25f, 237.65625f, 136.9375f,
190.125f, 136.9375f, 142.59375f, 195.625f, 79.21875f, 176.0625f, 285.1875f, 117.375f,
348.5625f, 195.625f, 396.09375f, 176.0625f, 205.96875f, 313.0f, 205.96875f, 430.375f,
205.96875f, 528.1875f, 269.34375f, 293.4375f, 253.5f, 430.375f, 237.65625f, 528.1875f,
221.8125f, 58.6875f, 253.5f, 58.6875f, 205.96875f, 78.25f, 253.5f, 58.6875f
};
Mat exp(18, 2, CV_32FC1, kpdata);
Size size{256, 256};
float norm = 1e-4;
double scale = 1.0/255;
Scalar mean = Scalar(128, 128, 128);
bool swapRB = false;
// Ref. Range: [58.6875, 508.625]
if (target == DNN_TARGET_CUDA_FP16)
norm = 20; // l1 = 1.5, lInf = 20
testKeypointsModel(weights, "", inp, exp, norm, size, mean, scale, swapRB);
}
TEST_P(Test_Model, Keypoints_face)
{
#if defined(INF_ENGINE_RELEASE)
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
#endif
Mat inp = imread(_tf("gray_face.png"), 0);
std::string weights = _tf("onnx/models/facial_keypoints.onnx", false);
Mat exp = blobFromNPY(_tf("facial_keypoints_exp.npy"));
Size size{224, 224};
double scale = 1.0/255;
Scalar mean = Scalar();
bool swapRB = false;
// Ref. Range: [-1.1784188, 1.7758257]
float norm = 1e-4;
if (target == DNN_TARGET_OPENCL_FP16)
norm = 5e-3;
if (target == DNN_TARGET_MYRIAD)
{
// Myriad2: l1 = 0.0004, lInf = 0.002
// MyriadX: l1 = 0.003, lInf = 0.009
norm = 0.009;
}
if (target == DNN_TARGET_CUDA_FP16)
norm = 0.004; // l1 = 0.0006, lInf = 0.004
testKeypointsModel(weights, "", inp, exp, norm, size, mean, scale, swapRB);
}
TEST_P(Test_Model, Detection_normalized)
{
std::string img_path = _tf("grace_hopper_227.png");
std::vector<int> refClassIds = {15};
std::vector<float> refConfidences = {0.999222f};
std::vector<Rect2d> refBoxes = {Rect2d(0, 4, 227, 222)};
std::string weights_file = _tf("MobileNetSSD_deploy.caffemodel", false);
std::string config_file = _tf("MobileNetSSD_deploy.prototxt");
Scalar mean = Scalar(127.5, 127.5, 127.5);
double scale = 1.0 / 127.5;
Size size{300, 300};
double scoreDiff = 1e-5, iouDiff = 1e-5;
float confThreshold = FLT_MIN;
double nmsThreshold = 0.0;
if (target == DNN_TARGET_CUDA)
{
scoreDiff = 3e-4;
iouDiff = 0.018;
}
if (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD || target == DNN_TARGET_CUDA_FP16)
{
scoreDiff = 5e-3;
iouDiff = 0.09;
}
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GE(2020040000)
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD)
{
scoreDiff = 0.02;
iouDiff = 0.1f;
}
#endif
testDetectModel(weights_file, config_file, img_path, refClassIds, refConfidences, refBoxes,
scoreDiff, iouDiff, confThreshold, nmsThreshold, size, mean, scale);
}
TEST_P(Test_Model, Segmentation)
{
applyTestTag(
CV_TEST_TAG_MEMORY_2GB
);
std::string inp = _tf("dog416.png");
std::string weights_file = _tf("fcn8s-heavy-pascal.prototxt");
std::string config_file = _tf("fcn8s-heavy-pascal.caffemodel", false);
std::string exp = _tf("segmentation_exp.png");
Size size{128, 128};
float norm = 0;
double scale = 1.0;
Scalar mean = Scalar();
bool swapRB = false;
testSegmentationModel(weights_file, config_file, inp, exp, norm, size, mean, scale, swapRB);
}
TEST_P(Test_Model, TextRecognition)
{
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021040000)
// IE Exception: Ngraph operation Reshape with name 71 has dynamic output shape on 0 port, but CPU plug-in supports only static shape
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && (target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16))
applyTestTag(target == DNN_TARGET_OPENCL ? CV_TEST_TAG_DNN_SKIP_IE_OPENCL : CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16,
CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION
);
#endif
std::string imgPath = _tf("text_rec_test.png");
std::string weightPath = _tf("onnx/models/crnn.onnx", false);
std::string seq = "welcome";
Size size{100, 32};
double scale = 1.0 / 127.5;
Scalar mean = Scalar(127.5);
std::string decodeType = "CTC-greedy";
std::vector<std::string> vocabulary = {"0","1","2","3","4","5","6","7","8","9",
"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
testTextRecognitionModel(weightPath, "", imgPath, seq, decodeType, vocabulary, size, mean, scale);
}
TEST_P(Test_Model, TextRecognitionWithCTCPrefixBeamSearch)
{
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021040000)
// IE Exception: Ngraph operation Reshape with name 71 has dynamic output shape on 0 port, but CPU plug-in supports only static shape
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && (target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16))
applyTestTag(target == DNN_TARGET_OPENCL ? CV_TEST_TAG_DNN_SKIP_IE_OPENCL : CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16,
CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION
);
#endif
std::string imgPath = _tf("text_rec_test.png");
std::string weightPath = _tf("onnx/models/crnn.onnx", false);
std::string seq = "welcome";
Size size{100, 32};
double scale = 1.0 / 127.5;
Scalar mean = Scalar(127.5);
std::string decodeType = "CTC-prefix-beam-search";
std::vector<std::string> vocabulary = {"0","1","2","3","4","5","6","7","8","9",
"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
testTextRecognitionModel(weightPath, "", imgPath, seq, decodeType, vocabulary, size, mean, scale);
}
TEST_P(Test_Model, TextDetectionByDB)
{
if (target == DNN_TARGET_OPENCL_FP16)
applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL_FP16);
std::string imgPath = _tf("text_det_test1.png");
std::string weightPath = _tf("onnx/models/DB_TD500_resnet50.onnx", false);
// GroundTruth
std::vector<std::vector<Point>> gt = {
{ Point(142, 193), Point(136, 164), Point(213, 150), Point(219, 178) },
{ Point(136, 165), Point(122, 114), Point(319, 71), Point(330, 122) }
};
Size size{736, 736};
double scale = 1.0 / 255.0;
Scalar mean = Scalar(122.67891434, 116.66876762, 104.00698793);
float binThresh = 0.3;
float polyThresh = 0.5;
uint maxCandidates = 200;
double unclipRatio = 2.0;
testTextDetectionModelByDB(weightPath, "", imgPath, gt, binThresh, polyThresh, maxCandidates, unclipRatio, size, mean, scale);
}
TEST_P(Test_Model, TextDetectionByEAST)
{
std::string imgPath = _tf("text_det_test2.jpg");
std::string weightPath = _tf("frozen_east_text_detection.pb", false);
// GroundTruth
std::vector<RotatedRect> gt = {
RotatedRect(Point2f(657.55f, 409.5f), Size2f(316.84f, 62.45f), -4.79)
};
// Model parameters
Size size{320, 320};
double scale = 1.0;
Scalar mean = Scalar(123.68, 116.78, 103.94);
bool swapRB = true;
// Detection algorithm parameters
float confThresh = 0.5;
float nmsThresh = 0.4;
double eps_center = 5/*pixels*/;
double eps_size = 5/*pixels*/;
double eps_angle = 1;
if (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_CUDA_FP16 || target == DNN_TARGET_MYRIAD)
{
eps_center = 10;
eps_size = 25;
eps_angle = 3;
}
testTextDetectionModelByEAST(weightPath, "", imgPath, gt, confThresh, nmsThresh, size, mean, scale, swapRB, false/*crop*/,
eps_center, eps_size, eps_angle
);
}
INSTANTIATE_TEST_CASE_P(/**/, Test_Model, dnnBackendsAndTargets());
}} // namespace
| C++ | 4 | nowireless/opencv | modules/dnn/test/test_model.cpp | [
"Apache-2.0"
] |
#!/usr/bin/env python3
from Crypto.Util.number import *
n = 52178350834061676530661142763437528175939173162548834910461380382483681023504449475239900491841074782821392249320860823097325377779179778151007892499580930406461580726768214088743068238597081895989447624756966077578276481781135051643517472303490237203407063499270608676859611056919106912278542255222168336947
c = 34949879894352773381563766686969406659651067393178989183552474327060142011300198059019233995661990511999145886998610787173636314451335648930866647600088223983541020098878256484637324053779768909874288988325476084700252205177950492909985360754246255356379604802452883346364649868902398622065306258498220396345
P.<x> = PolynomialRing(Zmod(n))
pad = b'\x00' + b'\xff' * (128 - 2 - 16) + b'\x00'
pad = bytes_to_long(pad) << (8 * 16)
f = (pad + x) ^ 3 - c
roots = f.small_roots()
if roots:
root = roots[0]
flag = long_to_bytes(root)
print(flag)
| Sage | 3 | fossabot/Crypto-Course | RSA/Stereotyped/solve.sage | [
"MIT"
] |
ARCHIVE_WRITE_NEW(3) manual page
== NAME ==
'''archive_write_new'''
- functions for creating archives
== LIBRARY ==
Streaming Archive Library (libarchive, -larchive)
== SYNOPSIS ==
'''<nowiki>#include <archive.h></nowiki>'''
<br>
''struct archive *''
<br>
'''archive_write_new'''(''void'');
== DESCRIPTION ==
Allocates and initializes a
'''struct archive'''
object suitable for writing a tar archive.
NULL
is returned on error.
A complete description of the
'''struct archive'''
object can be found in the overview manual page for
[[ManPageibarchive3]].
== SEE ALSO ==
[[ManPageBsdtar1]],
[[ManPagerchiverite3]],
[[ManPagerchiveriteetptions3]],
[[ManPageibarchive3]],
[[ManPageCpio5]],
[[ManPageMtree5]],
[[ManPageTar5]]
| MediaWiki | 1 | probonopd/imagewriter | dependencies/libarchive-3.4.2/doc/wiki/ManPageArchiveWriteNew3.wiki | [
"Apache-2.0"
] |
print "hello world"
| Nit | 1 | JavascriptID/sourcerer-app | src/test/resources/samples/langs/Nit/hello_world.nit | [
"MIT"
] |
rm -f log dir1/log dir1/stinky
touch t1.do
../../flush-cache
redo t1
touch t1.do
../../flush-cache
redo t1
../../flush-cache
redo-ifchange t1
C1="$(wc -l <dir1/log)"
C2="$(wc -l <log)"
. ../../skip-if-minimal-do.sh
if [ "$C1" -ne 1 -o "$C2" -ne 2 ]; then
echo "failed: t1>t1, c1=$C1, c2=$C2" >&2
exit 55
fi
| Stata | 2 | BlameJohnny/redo | t/250-makedir/dirtest/all.do | [
"Apache-2.0"
] |
Hello <%= @user.name -%>,
Your password has been reset.
| RHTML | 2 | andypohl/kent | src/hg/encode/hgEncodeSubmit/app/views/user_notifier/reset_password.rhtml | [
"MIT"
] |
// https://html.spec.whatwg.org/multipage/obsolete.html#htmlfontelement
[Exposed=Window,
HTMLConstructor]
interface HTMLFontElement : HTMLElement {
[CEReactions, Reflect] attribute [LegacyNullToEmptyString] DOMString color;
[CEReactions, Reflect] attribute DOMString face;
[CEReactions, Reflect] attribute DOMString size;
};
| WebIDL | 3 | Unique184/jsdom | lib/jsdom/living/nodes/HTMLFontElement.webidl | [
"MIT"
] |
<?python
def get_font_size(tag):
if tag.count <= 3:
count = 12
elif tag.count <= 5:
count = 15
elif tag.count <= 7:
count = 18
elif tag.count <= 9:
count = 20
else:
count = 24
font = "%spx" % count
return font
?>
<div xmlns:py="http://purl.org/kid/ns#" id="tags">
<span py:for="tag in tags" style='font-size: ${get_font_size(tag)}'> <a title='${tag.count}' href='/${site.name}/blog/tags/${tag.name}'>${tag.name}</a></span>
</div> | Genshi | 3 | CarlosGabaldon/calabro | calabro/widgets/templates/tags.kid | [
"MIT"
] |
// Proposed webidl
[Exposed=Window]
interface EditContextTextRange {
attribute long start;
attribute long end;
};
[Exposed=Window]
interface TextUpdateEvent : Event {
readonly attribute EditContextTextRange updateRange;
readonly attribute DOMString updateText;
readonly attribute EditContextTextRange newSelection;
};
[Exposed=Window]
interface TextFormatUpdateEvent : Event {
readonly attribute EditContextTextRange formatRange;
readonly attribute DOMString underlineColor;
readonly attribute DOMString backgroundColor;
readonly attribute DOMString textDecorationColor;
readonly attribute DOMString textUnderlineStyle;
};
enum EditContextInputMode {
"text",
"decimal",
"password",
"search",
"email",
"numeric",
"tel",
"url"
};
enum EditContextInputAction {
"enter",
"done",
"go",
"next",
"previous",
"search",
"send"
};
enum EditContextInputPolicy {
"auto",
"manual"
};
dictionary EditContextInit {
DOMString text;
EditContextTextRange selection;
EditContextInputMode inputMode;
EditContextInputPolicy inputPolicy;
EditContextInputAction action;
};
/// @event name="textupdate", type="TextUpdateEvent"
/// @event name="textformatupdate", type="TextFormatUpdateEvent"
/// @event name="focus", type="FocusEvent"
/// @event name="blur", type="FocusEvent"
/// @event name="compositionstart", type="CompositionEvent"
/// @event name="compositionend", type="CompositionEvent"
[Exposed=Window]
[Constructor(optional EditContextInit options)]
interface EditContext : EventTarget {
void focus();
void blur();
void updateSelection(unsigned long start, unsigned long end);
void updateLayout(DOMRect controlBounds, DOMRect selectionBounds);
void updateText(unsigned long start, unsigned long end, DOMString updateText);
readonly attribute DOMString text;
readonly attribute EditContextTextRange selection;
readonly attribute EditContextInputMode inputMode;
readonly attribute EditContextInputPolicy inputPolicy
readonly attribute EditContextInputAction action;
// Event handler attributes
attribute EventHandler ontextupdate;
attribute EventHandler ontextformatupdate;
attribute EventHandler oncompositionstart;
attribute EventHandler oncompositionend;
};
| WebIDL | 4 | SaiCorporation/Project-2 | EditContext/editcontext.webidl | [
"CC-BY-4.0"
] |
{
"domain": "ue_smart_radio",
"name": "Logitech UE Smart Radio",
"documentation": "https://www.home-assistant.io/integrations/ue_smart_radio",
"codeowners": [],
"iot_class": "cloud_polling"
}
| JSON | 2 | MrDelik/core | homeassistant/components/ue_smart_radio/manifest.json | [
"Apache-2.0"
] |
\include "deutsch.ly"
| LilyPond | 0 | HolgerPeters/lyp | spec/user_files/include_stock.ly | [
"MIT"
] |
<p class="bold">offline document storage</p>
<p> </p>
<p>cryptee uses an encrypted offline storage on your device to store all your offline documents. if you'd like to conveniently delete all offline documents stored on this device, you can do this with one click here:</p>
<p> </p>
<button onclick="clearDocsOfflineStorage();">
<i class="ri-delete-bin-6-line"></i>
<u>clear offline documents storage</u>
</button>
<p> </p>
<hr>
<p> </p>
<p class="bold">local cache</p>
<p> </p>
<p>cryptee uses an encrypted, local cache on your device to speed things up a bit instead of downloading & decrypting everything every single time. during bad network connectivity or frequent drop-outs, cryptee falls back to this cache to keep running as expected, and reduce network dependency.</p>
<p> </p>
<p>if you're experiencing issues that are <i>specific to this device</i>, like filenames not updating on this device or not sync'ing correctly to/from this device, or your search results not returning everything you're looking for, you can try clearing your local cache here. if clearing the cache using the button below doesn't solve your problem, please contact our helpdesk.</p>
<p> </p>
<button onclick="clearDocsCache();">
<i class="ri-database-2-line"></i>
<u>clear local cache</u>
</button> | Kit | 2 | pws1453/web-client | source/imports/app/account-tab-docs-settings-storage-caches.kit | [
"MIT"
] |
# This file is distributed under the same license as the Django package.
#
# Translators:
# Igor Jerosimić, 2019-2020
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-11 20:56+0200\n"
"PO-Revision-Date: 2020-05-12 20:01+0000\n"
"Last-Translator: Transifex Bot <>\n"
"Language-Team: Serbian (Latin) (http://www.transifex.com/django/django/"
"language/sr@latin/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: sr@latin\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
msgid "PostgreSQL extensions"
msgstr "PostgreSQL ekstenzije"
#, python-format
msgid "Item %(nth)s in the array did not validate:"
msgstr "Stavka %(nth)su nizu nije ispravna:"
msgid "Nested arrays must have the same length."
msgstr "Ugnježdeni nizovi moraju da budu iste dužine."
msgid "Map of strings to strings/nulls"
msgstr "Mapa znakovnih niski na znakovne niske/null-ove"
#, python-format
msgid "The value of “%(key)s” is not a string or null."
msgstr "Vrednost \"%(key)s\" nije znakovni niz ili null."
msgid "Could not load JSON data."
msgstr "Ne mogu da učitam JSON podatke."
msgid "Input must be a JSON dictionary."
msgstr "Ulazna vrednost mora biti JSON dict."
msgid "Enter two valid values."
msgstr "Unesite dve ispravne vrednosti."
msgid "The start of the range must not exceed the end of the range."
msgstr "Početak opsega ne može biti preko kraja opsega."
msgid "Enter two whole numbers."
msgstr "Unesite dva cela broja."
msgid "Enter two numbers."
msgstr "Unesite dva broja."
msgid "Enter two valid date/times."
msgstr "Unesite dva ispravna datuma/vremena."
msgid "Enter two valid dates."
msgstr "Unesite dva ispravna datuma."
#, python-format
msgid ""
"List contains %(show_value)d item, it should contain no more than "
"%(limit_value)d."
msgid_plural ""
"List contains %(show_value)d items, it should contain no more than "
"%(limit_value)d."
msgstr[0] ""
"Lista sadrži %(show_value)dstavku, ne bi trebalo da sadrži više od "
"%(limit_value)d."
msgstr[1] ""
"Lista sadrži %(show_value)dstavke, ne bi trebalo da sadrži više od "
"%(limit_value)d."
msgstr[2] ""
"Lista sadrži %(show_value)dstavki, ne bi trebalo da sadrži više od "
"%(limit_value)d."
#, python-format
msgid ""
"List contains %(show_value)d item, it should contain no fewer than "
"%(limit_value)d."
msgid_plural ""
"List contains %(show_value)d items, it should contain no fewer than "
"%(limit_value)d."
msgstr[0] ""
"Lista sadrži %(show_value)dstavku, ne bi trebalo da sadrži manje od "
"%(limit_value)d."
msgstr[1] ""
"Lista sadrži %(show_value)dstavke, ne bi trebalo da sadrži manje od "
"%(limit_value)d."
msgstr[2] ""
"Lista sadrži %(show_value)dstavki, ne bi trebalo da sadrži manje od "
"%(limit_value)d."
#, python-format
msgid "Some keys were missing: %(keys)s"
msgstr "Neki ključevi nedostaju: %(keys)s"
#, python-format
msgid "Some unknown keys were provided: %(keys)s"
msgstr "Dati su neki nepoznati ključevi: %(keys)s"
#, python-format
msgid ""
"Ensure that this range is completely less than or equal to %(limit_value)s."
msgstr "Ovaj opseg mora ukupno biti manji ili jednak sa %(limit_value)s"
#, python-format
msgid ""
"Ensure that this range is completely greater than or equal to "
"%(limit_value)s."
msgstr "Ovaj opseg mora biti ukupno veći ili jednak %(limit_value)s."
| Gettext Catalog | 3 | jpmallarino/django | django/contrib/postgres/locale/sr_Latn/LC_MESSAGES/django.po | [
"BSD-3-Clause",
"0BSD"
] |
TDScriptLeafNode{#name:'postUpgradeRebuildCharacterCollectionIndexes',#contents:'[ :topez :objIn :tokens :command :commandNode |
| opts args |
\"for help: ./postUpgradeRebuildCharacterCollectionIndexes -h\"
command
getOptsMixedLongShort:
{#(\'help\' $h #\'none\').
#(\'sourceVersion\' nil #\'required\')}
optionsAndArguments: [ :options :operands |
opts := options.
args := operands ].
opts
at: \'help\'
ifAbsent: [
| gsTool sourceStoneVersion currentStoneVersion report nscCount |
gsTool := topez toolInstanceFor: \'gs\'.
currentStoneVersion := ((gsTool gsversion: #\'stone\') at: \'gsVersion\')
asMetacelloVersionNumber.
opts
at: \'sourceVersion\'
ifPresent: [ :sourceVersionString | sourceStoneVersion := sourceVersionString asMetacelloVersionNumber ]
ifAbsent: [ self error: \'Required option --sourceVersion not present\' ].
Transcript
cr;
show: \'Rebuilding CharacterCollection indexes using \' , command command printString;
cr;
show: \'----------------------------\';
cr;
show: \'Finding CharacterCollection indexes...\'.
System commit.
IndexManager findAllCharacterCollectionIndexesForUser: nil.
SortedCollection initializeForConversion.
nscCount := IndexManager _loadHiddenSet: 41.
Transcript
cr;
show:
\'Rebuilding indexes for \' , nscCount printString
, \' nscs with CharacterCollection indexes...\'.
System hiddenSetReinit: 41.
report := IndexManager
rebuildCharacterCollectionIndexesFromFilesForGem: 1
of: 1.
Transcript
cr;
show: report.
IndexManager writeTotalsFiles.
IndexManager createConversionResultFileForTotalGems: 1.
report ]
ifPresent: [ :ignored |
TDManPage
viewManPage:
\'NAME
postUpgradeRebuildCharacterCollectionIndexes - Post-upgrade rebuild CharacterCollection indexes
SYNOPSIS
postUpgradeRebuildCharacterCollectionIndexes [-h|--help] --sourceVersion=<source-gemstone-version>
DESCRIPTION
Rebuild CharacterCollection indexes.
The environment variable $upgradeLogDir is expected to be set -- normally set by
$GS_HOME/bin/upgradeStone.
EXAMPLES
./postUpgradeRebuildCharacterCollectionIndexes -h
./postUpgradeRebuildCharacterCollectionIndexes --sourceVersion=3.1.0.6
\'
topez: topez ] ]',#creationTime:DateAndTime['2016-05-23T12:00:04.4277639389038-07:00'],#modificationTime:DateAndTime['2016-06-07T14:51:57.11459302902222-07:00']} | STON | 4 | ahdach/GsDevKit_home | sys/default/server/upgrade/postUpgradeRebuildCharacterCollectionIndexes.ston | [
"MIT"
] |
(unless (find-package :ql-to-nix-util)
(load "ql-to-nix-util.lisp"))
(defpackage :ql-to-nix-quicklisp-bootstrap
(:use :common-lisp :ql-to-nix-util)
(:export #:with-quicklisp)
(:documentation
"This package provides a way to create a temporary quicklisp installation."))
(in-package :ql-to-nix-quicklisp-bootstrap)
(declaim (optimize (debug 3) (speed 0) (space 0) (compilation-speed 0) (safety 3)))
;; This file cannot have any dependencies beyond quicklisp and asdf.
;; Otherwise, we'll miss some dependencies!
(defvar *quicklisp*
(namestring (pathname-as-directory (uiop:getenv "quicklisp")))
"The path to the nix quicklisp package.")
(defun prepare-quicklisp-dir (target-dir quicklisp-prototype-dir)
"Install quicklisp into the specified `target-dir'.
`quicklisp-prototype-dir' should be the path to the quicklisp nix
package."
(ensure-directories-exist target-dir)
(dolist (subdir '(#P"dists/quicklisp/" #P"tmp/" #P"local-projects/" #P"quicklisp/"))
(ensure-directories-exist (merge-pathnames subdir target-dir)))
(with-open-file (s (merge-pathnames #P"dists/quicklisp/enabled.txt" target-dir) :direction :output :if-exists :supersede)
(format s "1~%"))
(uiop:copy-file
(merge-pathnames #P"lib/common-lisp/quicklisp/quicklisp-distinfo.txt" quicklisp-prototype-dir)
(merge-pathnames #P"dists/quicklisp/distinfo.txt" target-dir))
(uiop:copy-file
(merge-pathnames #P"lib/common-lisp/quicklisp/asdf.lisp" quicklisp-prototype-dir)
(merge-pathnames #P"asdf.lisp" target-dir))
(uiop:copy-file
(merge-pathnames #P"lib/common-lisp/quicklisp/setup.lisp" quicklisp-prototype-dir)
(merge-pathnames #P"setup.lisp" target-dir))
(copy-directory-tree
(merge-pathnames #P"lib/common-lisp/quicklisp/quicklisp/" quicklisp-prototype-dir)
(merge-pathnames #P"quicklisp/" target-dir)))
(defun call-with-quicklisp (function &key (target-dir :temp) (cache-dir :temp))
"Invoke the given function with the path to a quicklisp installation.
Quicklisp will be loaded before the function is called. `target-dir'
can either be a pathname for the place where quicklisp should be
installed or `:temp' to request installation in a temporary directory.
`cache-dir' can either be a pathname for a place to store fasls or
`:temp' to request caching in a temporary directory."
(when (find-package :ql)
(error "Already loaded quicklisp in this process"))
(labels
((make-ql (ql-dir)
(prepare-quicklisp-dir ql-dir *quicklisp*)
(with-temporary-asdf-cache (ql-dir)
(load (merge-pathnames #P"setup.lisp" ql-dir))
(if (eq :temp cache-dir)
(funcall function ql-dir)
(with-asdf-cache (ql-dir cache-dir)
(funcall function ql-dir))))))
(if (eq :temp target-dir)
(with-temporary-directory (dir)
(make-ql dir))
(make-ql target-dir))))
(defmacro with-quicklisp ((quicklisp-dir) (&key (cache-dir :temp)) &body body)
"Install quicklisp in a temporary directory, load it, bind
`quicklisp-dir' to the path where quicklisp was installed, and then
evaluate `body'.
`cache-dir' can either be a pathname for a place to store fasls or
`:temp' to request caching in a temporary directory."
`(call-with-quicklisp
(lambda (,quicklisp-dir)
,@body)
:cache-dir ,cache-dir))
| Common Lisp | 4 | collinwright/nixpkgs | pkgs/development/lisp-modules/quicklisp-to-nix/quicklisp-bootstrap.lisp | [
"MIT"
] |
extends Control
onready var render_distance_label = $RenderDistanceLabel
onready var render_distance_slider = $RenderDistanceSlider
onready var fog_checkbox = $FogCheckBox
func _ready():
render_distance_slider.value = Settings.render_distance
render_distance_label.text = "Render distance: " + str(Settings.render_distance)
fog_checkbox.pressed = Settings.fog_enabled
func _on_RenderDistanceSlider_value_changed(value):
Settings.render_distance = value
render_distance_label.text = "Render distance: " + str(value)
Settings.save_settings()
func _on_FogCheckBox_pressed():
Settings.fog_enabled = fog_checkbox.pressed
Settings.save_settings()
| GDScript | 4 | jonbonazza/godot-demo-projects | 3d/voxel/menu/options/option_buttons.gd | [
"MIT"
] |
i 00001 17 24 02003 00 042 0017
i 00002 00 012 2005 00 040 0016
i 00003 00 001 0000 00 040 0003
i 00004 00 001 2004 00 040 0002
i 00005 00 001 2003 00 040 0001
i 00006 16 045 0017 17 25 00004
i 00007 17 35 00020 03 25 77745
i 00010 03 35 00020 02 25 77756
i 00011 02 35 00020 01 25 77767
i 00012 01 35 00020 00 012 2000
i 00013 00 27 00020 00 010 2003
i 00014 00 012 2001 00 27 00020
i 00015 00 010 2004 00 012 2002
i 00016 00 27 00020 00 22 00000
i 00017 06 33 12345 00 22 00000
i 00020 02 33 76543 00 22 00000
d 02000 0000 0000 0000 0011
d 02001 0000 0000 0000 0022
d 02002 0000 0000 0000 0033
d 02005 0000 0000 0007 7777
| Octave | 0 | besm6/mesm6 | test/stx/stx.oct | [
"MIT"
] |
object UninstSharedFileForm: TUninstSharedFileForm
Left = 200
Top = 108
BorderIcons = [biSystemMenu]
BorderStyle = bsDialog
Caption = 'UninstSharedFileForm'
ClientHeight = 225
ClientWidth = 397
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
Scaled = False
DesignSize = (
397
225)
PixelsPerInch = 96
TextHeight = 13
object NoToAllButton: TNewButton
Left = 283
Top = 189
Width = 75
Height = 23
Anchors = [akBottom]
Caption = '*'
ModalResult = 9
TabOrder = 3
end
object NoButton: TNewButton
Left = 202
Top = 189
Width = 75
Height = 23
Anchors = [akBottom]
Caption = '*'
ModalResult = 7
TabOrder = 2
end
object YesToAllButton: TNewButton
Left = 121
Top = 189
Width = 75
Height = 23
Anchors = [akBottom]
Caption = '*'
ModalResult = 10
TabOrder = 1
end
object YesButton: TNewButton
Left = 40
Top = 189
Width = 75
Height = 23
Anchors = [akBottom]
Caption = '*'
Default = True
ModalResult = 6
TabOrder = 0
end
object LocationEdit: TEdit
Left = 88
Top = 148
Width = 297
Height = 21
Anchors = [akLeft, akTop, akRight]
ParentColor = True
ReadOnly = True
TabOrder = 8
end
object LocationLabel: TNewStaticText
Left = 12
Top = 151
Width = 5
Height = 14
Caption = '*'
TabOrder = 7
end
object FilenameEdit: TEdit
Left = 88
Top = 116
Width = 297
Height = 21
Anchors = [akLeft, akTop, akRight]
ParentColor = True
ReadOnly = True
TabOrder = 6
end
object FilenameLabel: TNewStaticText
Left = 12
Top = 119
Width = 5
Height = 14
Caption = '*'
TabOrder = 5
end
object BodyLabel: TNewStaticText
Left = 12
Top = 12
Width = 373
Height = 97
Anchors = [akLeft, akTop, akRight]
AutoSize = False
Caption = '*'
ShowAccelChar = False
TabOrder = 4
WordWrap = True
end
end
| Pascal | 3 | Patriccollu/issrc | Projects/UninstSharedFileForm.dfm | [
"FSFAP"
] |
-- Copyright 2021 Jeff Foley. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
local json = require("json")
name = "ARIN"
type = "api"
function start()
set_rate_limit(1)
end
function asn(ctx, addr, asn)
if addr == "" then
return
end
local resp, err = request(ctx, {url=asn_url(addr)})
if (err ~= nil and err ~= "") then
log(ctx, "asn request to service failed: " .. err)
return
end
local j = json.decode(resp)
if (j == nil or j.cidr0_cidrs == nil or j.arin_originas0_originautnums == nil or
#(j.cidr0_cidrs) == 0 or #(j.arin_originas0_originautnums) == 0) then
return
end
local asn = j.arin_originas0_originautnums[1]
if (j.cidr0_cidrs[1]['v4prefix'] == nil or j.cidr0_cidrs[1]['v4prefix'] == "") then
return
end
local cidr = j.cidr0_cidrs[1]['v4prefix'] .. "/" .. tostring(j.cidr0_cidrs[1]['length'])
if j.entities[1]['vcardArray'] == nil then
return
end
local desc = j.name .. " - " .. j.entities[1]['vcardArray'][2][2][4]
new_asn(ctx, {
['addr']=addr,
['asn']=asn,
['desc']=desc,
['prefix']=cidr,
})
end
function asn_url(addr)
return "https://rdap.arin.net/registry/ip/" .. addr
end
| Ada | 4 | Elon143/Amass | resources/scripts/api/arin.ads | [
"Apache-2.0"
] |
USING: assocs help.markup help.syntax trees ;
IN: trees.avl
HELP: AVL{
{ $syntax "AVL{ { key value }... }" }
{ $values { "key" "a key" } { "value" "a value" } }
{ $description "Literal syntax for an AVL tree." } ;
HELP: <avl>
{ $values { "tree" avl } }
{ $description "Creates an empty AVL tree" } ;
HELP: >avl
{ $values { "assoc" assoc } { "avl" avl } }
{ $description "Converts any " { $link assoc } " into an AVL tree. If the input assoc is any kind of " { $link tree } ", the elements are added in level order (breadth-first search) to attempt to copy it's shape." } ;
HELP: avl
{ $class-description "This is the class for AVL trees. These conform to the assoc protocol and have efficient (logarithmic time) storage and retrieval operations." } ;
ARTICLE: "trees.avl" "AVL trees"
"This is a library for AVL trees, with logarithmic time storage and retrieval operations. These trees conform to the assoc protocol."
{ $subsections
avl
<avl>
>avl
POSTPONE: AVL{
} ;
ABOUT: "trees.avl"
| Factor | 5 | alex-ilin/factor | extra/trees/avl/avl-docs.factor | [
"BSD-2-Clause"
] |
;;; Test equality functions
(require 'test)
;; eq
(assert-exit (eq 'a 'a))
(assert-exit (eq 'b 'b))
(assert-exit (not (eq 'a 'b)))
(assert-exit (not (eq 10 10)))
(let ((var 10))
(assert-exit (eq var var)))
;; eql
(assert-exit (eql 100 100))
(assert-exit (eql 10 10))
(assert-exit (eql 10.1 10.1))
(assert-exit (not (eql 10 100)))
;; equal
(assert-exit (equal '(a b c) '(a b c)))
(assert-exit (equal '(a (b) c) '(a (b) c)))
(assert-exit (equal '(a (b 10) c) '(a (b 10) c)))
(assert-exit (equal '(a (b 10) nil c) '(a (b 10) nil c)))
(assert-exit (equal '(a (b 10) (10.7 nil) c) '(a (b 10) (10.7 nil) c)))
(assert-exit (not (equal '(a (b 10) (10.6 nil) c) '(a (b 10) (10.7 nil) c))))
(assert-exit (not (equal '(a (b 10) (10.6 nil) c) '(a (10) (10.7 nil) c))))
| wisp | 4 | skeeto/wisp | test/eq-test.wisp | [
"Unlicense"
] |
pub struct GenX<S> {
inner: S,
}
impl<S> Into<S> for GenX<S> { //~ ERROR conflicting implementations
fn into(self) -> S {
self.inner
}
}
fn main() {}
| Rust | 3 | Eric-Arellano/rust | src/test/ui/error-codes/e0119/issue-27403.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
syntax = "proto2";
import "google/protobuf/timestamp.proto";
package upb_test;
message MapTest {
map<string, double> map_string_double = 1;
}
message PackedTest {
repeated bool bool_packed = 1 [packed = true];
repeated int32 i32_packed = 2 [packed = true];
repeated int64 i64_packed = 3 [packed = true];
repeated fixed32 f32_packed = 4 [packed = true];
repeated fixed64 f64_packed = 5 [packed = true];
}
message UnpackedTest {
repeated bool bool_packed = 1 [packed = false];
repeated int32 i32_packed = 2 [packed = false];
repeated int64 i64_packed = 3 [packed = false];
repeated fixed32 f32_packed = 4 [packed = false];
repeated fixed64 f64_packed = 5 [packed = false];
}
message TestLargeFieldNumber {
optional int32 i32 = 456214797;
}
message TestTimestamp {
optional google.protobuf.Timestamp ts = 1;
}
| Protocol Buffer | 3 | warlock135/grpc | third_party/upb/tests/bindings/lua/test.proto | [
"Apache-2.0"
] |
{
global:
*horovod*;
# PyTorch binding
*PyInit*;
*initmpi_lib_v2*;
# Legacy PyTorch binding
*init_mpi_lib*;
*init_mpi_lib_impl*;
local: *;
};
| Linker Script | 0 | markWJJ/horovod | horovod.lds | [
"Apache-2.0"
] |
/home/spinalvm/hdl/riscv-compliance/work//C.BNEZ.elf: file format elf32-littleriscv
Disassembly of section .text.init:
80000000 <_start>:
80000000: 0001 nop
80000002: 0001 nop
80000004: 0001 nop
80000006: 0001 nop
80000008: 0001 nop
8000000a: 0001 nop
8000000c: 0001 nop
8000000e: 0001 nop
80000010: 0001 nop
80000012: 0001 nop
80000014: 0001 nop
80000016: 0001 nop
80000018: 0001 nop
8000001a: 0001 nop
8000001c: 0001 nop
8000001e: 0001 nop
80000020: 0001 nop
80000022: 0001 nop
80000024: 0001 nop
80000026: 0001 nop
80000028: 0001 nop
8000002a: 0001 nop
8000002c: 0001 nop
8000002e: 0001 nop
80000030: 0001 nop
80000032: 0001 nop
80000034: 0001 nop
80000036: 0001 nop
80000038: 0001 nop
8000003a: 0001 nop
8000003c: 0001 nop
8000003e: 0001 nop
80000040: 0001 nop
80000042: 0001 nop
80000044: 0001 nop
80000046: 0001 nop
80000048: 0001 nop
8000004a: 0001 nop
8000004c: 0001 nop
8000004e: 0001 nop
80000050: 0001 nop
80000052: 0001 nop
80000054: 0001 nop
80000056: 0001 nop
80000058: 0001 nop
8000005a: 0001 nop
8000005c: 0001 nop
8000005e: 0001 nop
80000060: 0001 nop
80000062: 0001 nop
80000064: 0001 nop
80000066: 0001 nop
80000068: 0001 nop
8000006a: 0001 nop
8000006c: 0001 nop
8000006e: 0001 nop
80000070: 0001 nop
80000072: 0001 nop
80000074: 0001 nop
80000076: 0001 nop
80000078: 0001 nop
8000007a: 0001 nop
8000007c: 0001 nop
8000007e: 0001 nop
80000080: 0001 nop
80000082: 0001 nop
80000084: 0001 nop
80000086: 0001 nop
80000088: 0001 nop
8000008a: 0001 nop
8000008c: 0001 nop
8000008e: 0001 nop
80000090: 0001 nop
80000092: 0001 nop
80000094: 0001 nop
80000096: 0001 nop
80000098: 0001 nop
8000009a: 0001 nop
8000009c: 0001 nop
8000009e: 0001 nop
800000a0: 0001 nop
800000a2: 0001 nop
800000a4: 0001 nop
800000a6: 0001 nop
800000a8: 0001 nop
800000aa: 0001 nop
800000ac: 0001 nop
800000ae: 0001 nop
800000b0: 0001 nop
800000b2: 0001 nop
800000b4: 0001 nop
800000b6: 0001 nop
800000b8: 0001 nop
800000ba: 0001 nop
800000bc: 0001 nop
800000be: 0001 nop
800000c0: 0001 nop
800000c2: 0001 nop
800000c4: 0001 nop
800000c6: 0001 nop
800000c8: 0001 nop
800000ca: 0001 nop
800000cc: 0001 nop
800000ce: 0001 nop
800000d0: 0001 nop
800000d2: 0001 nop
800000d4: 0001 nop
800000d6: 0001 nop
800000d8: 0001 nop
800000da: 0001 nop
800000dc: 0001 nop
800000de: 0001 nop
800000e0: 0001 nop
800000e2: 0001 nop
800000e4: 0001 nop
800000e6: 0001 nop
800000e8: 0001 nop
800000ea: 0001 nop
800000ec: 0001 nop
800000ee: 00001117 auipc sp,0x1
800000f2: f1210113 addi sp,sp,-238 # 80001000 <codasip_signature_start>
800000f6: 4681 li a3,0
800000f8: e291 bnez a3,800000fc <_start+0xfc>
800000fa: 4681 li a3,0
800000fc: c036 sw a3,0(sp)
800000fe: 00001117 auipc sp,0x1
80000102: f0610113 addi sp,sp,-250 # 80001004 <test_2_res>
80000106: 4705 li a4,1
80000108: e311 bnez a4,8000010c <_start+0x10c>
8000010a: 4701 li a4,0
8000010c: c03a sw a4,0(sp)
8000010e: 00001117 auipc sp,0x1
80000112: efa10113 addi sp,sp,-262 # 80001008 <test_3_res>
80000116: 57fd li a5,-1
80000118: e391 bnez a5,8000011c <_start+0x11c>
8000011a: 4781 li a5,0
8000011c: c03e sw a5,0(sp)
8000011e: 00001117 auipc sp,0x1
80000122: eee10113 addi sp,sp,-274 # 8000100c <test_4_res>
80000126: 00008437 lui s0,0x8
8000012a: fff40413 addi s0,s0,-1 # 7fff <_start-0x7fff8001>
8000012e: e011 bnez s0,80000132 <_start+0x132>
80000130: 4401 li s0,0
80000132: c022 sw s0,0(sp)
80000134: 00001117 auipc sp,0x1
80000138: edc10113 addi sp,sp,-292 # 80001010 <test_5_res>
8000013c: 64a1 lui s1,0x8
8000013e: e091 bnez s1,80000142 <_start+0x142>
80000140: 4481 li s1,0
80000142: c026 sw s1,0(sp)
80000144: 00001517 auipc a0,0x1
80000148: ebc50513 addi a0,a0,-324 # 80001000 <codasip_signature_start>
8000014c: 00001597 auipc a1,0x1
80000150: ed458593 addi a1,a1,-300 # 80001020 <_end>
80000154: f0100637 lui a2,0xf0100
80000158: f2c60613 addi a2,a2,-212 # f00fff2c <_end+0x700fef0c>
8000015c <complience_halt_loop>:
8000015c: 00b50c63 beq a0,a1,80000174 <complience_halt_break>
80000160: 4554 lw a3,12(a0)
80000162: c214 sw a3,0(a2)
80000164: 4514 lw a3,8(a0)
80000166: c214 sw a3,0(a2)
80000168: 4154 lw a3,4(a0)
8000016a: c214 sw a3,0(a2)
8000016c: 4114 lw a3,0(a0)
8000016e: c214 sw a3,0(a2)
80000170: 0541 addi a0,a0,16
80000172: b7ed j 8000015c <complience_halt_loop>
80000174 <complience_halt_break>:
80000174: f0100537 lui a0,0xf0100
80000178: f2050513 addi a0,a0,-224 # f00fff20 <_end+0x700fef00>
8000017c: 00052023 sw zero,0(a0)
...
Disassembly of section .data:
80001000 <codasip_signature_start>:
80001000: ffff 0xffff
80001002: ffff 0xffff
80001004 <test_2_res>:
80001004: ffff 0xffff
80001006: ffff 0xffff
80001008 <test_3_res>:
80001008: ffff 0xffff
8000100a: ffff 0xffff
8000100c <test_4_res>:
8000100c: ffff 0xffff
8000100e: ffff 0xffff
80001010 <test_5_res>:
80001010: ffff 0xffff
80001012: ffff 0xffff
...
| ObjDump | 1 | cbrune/VexRiscv | src/test/resources/asm/C.BNEZ.elf.objdump | [
"MIT"
] |
package com.baeldung.mapstruct.mappingCollections.dto;
import java.util.ArrayList;
import java.util.List;
public class CompanyDTO {
private List<EmployeeDTO> employees;
public List<EmployeeDTO> getEmployees() {
return employees;
}
public void setEmployees(List<EmployeeDTO> employees) {
this.employees = employees;
}
public void addEmployee(EmployeeDTO employeeDTO) {
if (employees == null) {
employees = new ArrayList<>();
}
employees.add(employeeDTO);
}
}
| Java | 4 | DBatOWL/tutorials | mapstruct/src/main/java/com/baeldung/mapstruct/mappingCollections/dto/CompanyDTO.java | [
"MIT"
] |
lorem ipsum,[[dolor sit amet]],[[consectetur||https://www.sun.com]] adipiscing elit.
| Creole | 0 | jquorning/ada-wiki | regtests/expect/wiki-import/q.creole | [
"Apache-2.0"
] |
<mt:include module="<__trans phrase="Config">">
<!DOCTYPE html>
<html lang="<mt:bloglanguage>" itemscope itemtype="http://schema.org/WebPage">
<head>
<meta charset="<mt:publishcharset>">
<title><mt:categorylabel> | <__trans phrase="News"> | <mt:blogname encode_html="1"></title>
<meta name="description" content="<mt:if tag="categorydescription"><mt:categorydescription remove_html="1" encede_html="1"><mt:else><__trans phrase="News archive for category '[_2]' from [_1]." params="<mt:blogname encode_html="1">%%<mt:categorylabel encode_html="1">"></mt:if>">
<meta name="keywords" content="<mt:getvar name="metakeywords"><__trans phrase="News">,<mt:categorylabel>">
<meta name="viewport" content="width=device-width,initial-scale=1">
<mt:assets tag="@SITE_FAVICON" limit="1"><link rel="shortcut icon" href="<mt:asseturl encode_html="1">"></mt:assets>
<link rel="start" href="<mt:blogurl encode_html="1">">
<link rel="alternate" type="application/atom+xml" title="Recent Entries" href="<mt:link template="feed_recent">">
<mt:CanonicalLink>
<!-- Open Graph Protocol -->
<meta property="og:type" content="article">
<meta property="og:locale" content="<mt:blogLanguage setvar="blog_lang"><mt:if name="blog_lang" eq="ja">ja_JP<mt:else><mt:Var name="blog_lang"></mt:if>">
<meta property="og:title" content="<mt:categorylabel> | <__trans phrase="News"> | <mt:blogname encode_html="1">">
<meta property="og:url" content="<mt:categoryarchivelink encode_html="1">">
<meta property="og:description" content="<mt:if tag="categorydescription"><mt:categorydescription remove_html="1" encede_html="1"><mt:else><__trans phrase="News archive for category '[_2]' from [_1]." params="<mt:blogname encode_html="1">%%<mt:categorylabel encode_html="1">"></mt:if>">
<meta property="og:site_name" content="<mt:blogname encode_html="1">">
<meta property="og:image" content="<mt:assets type="image" tag="@OG-IMAGE" limit="1"><mt:asseturl encode_html="1"></mt:assets>">
<mt:if name="fbAppId"><meta property="fb:app_id" content="<mt:var name="fbAppId" escape="html">"></mt:if>
<!-- Microdata -->
<meta itemprop="description" content="<mt:if tag="categorydescription"><mt:categorydescription remove_html="1" encede_html="1"><mt:else><__trans phrase="News archive for category '[_2]' from [_1]." params="<mt:blogname encode_html="1">%%<mt:categorylabel encode_html="1">"></mt:if>">
<link itemprop="url" href="<mt:categoryarchivelink encode_html="1">">
<link itemprop="image" href="<mt:assets type="image" tag="@OG-IMAGE" limit="1"><mt:assetthumbnailurl width="320" encode_html="1"></mt:assets>">
<mt:include module="<__trans phrase="common_stylesheet">">
<mt:include module="<__trans phrase="common_head_js">">
</head>
<body id="top">
<mt:setvarblock name="thispage">blog</mt:setvarblock>
<mt:include module="<__trans phrase="Header">">
<section id="localnavi">
<div class="container">
<div class="row">
<div class="col-sm-12">
<nav role="navigation" class="breadcrumb">
<ul class="clearfix">
<li class="home"><a href="<mt:blogrelativeurl>"><i class="fa fa-home fa-lg"></i></a></li>
<li><a href="<mt:blogrelativeurl>news/"><__trans phrase="News"></a></li>
<li><span><mt:categorylabel></span></li>
</ul>
</nav>
</div>
</div>
</div>
</section>
<section id="mainvisual-lower">
<div class="overray"></div>
<div class="container">
<div class="row">
<div class="col-sm-12">
<h2><i class="fa fa-book"></i><__trans phrase="News"></h2>
</div>
</div>
</div>
</section>
<div id="content">
<div class="container">
<div class="row-fluid">
<div class="col-sm-9" id="blog-primary-content">
<h1 class="page-title"><mt:categorylabel></h1>
<div id="entry-list">
<mt:include module="<__trans phrase="Entry listing">">
</div>
<div class="holder"></div>
</div><!-- /primary-content -->
<aside class="col-sm-3 pull-right" id="sidebar">
<mt:include module="<__trans phrase="Blog Side Nav">">
</aside><!-- sidebar -->
</div>
</div>
</div>
<mt:include module="<__trans phrase="Footer">">
<mt:include module="common_bottom_js">
</body>
</html>
| MTML | 4 | movabletype/mt-theme-SimpleCorporate | themes/simplecorporate/templates/category_entry_listing.mtml | [
"MIT"
] |
//This file is part of "GZE - GroundZero Engine"
//The permisive licence allow to use GZE for free or commercial project (Apache License, Version 2.0).
//For conditions of distribution and use, see copyright notice in Licence.txt, this license must be included with any distribution of the code.
package {
/**
* @author Maeiky
*/
public overclass Key {
public var aKeyDown : CArray<Bool, 1, 256>
public var aKeyPress : CArray<Bool, 1, 256>
public var aKeyRelease : CArray<Bool, 1, 256>
public enum eKey : Int {
Abnt_C1 = 0xC1;
Abnt_C2 = 0xC2;
Numpad_Add = 0x6B;
Attn = 0xF6;
Backspace = 0x08;
Break = 0x03;
Clear = 0x0C;
CrSel = 0xF7;
Numpad_Dot = 0x6E;
Numpad_Divide = 0x6F;
ErEof = 0xF9;
Escape = 0x1B;
Execute = 0x2B;
ExSel = 0xF8;
Ico_Clear = 0xE6;
Ico_Help = 0xE3;
KEY_0 = 0x30;
KEY_1 = 0x31;
KEY_2 = 0x32;
KEY_3 = 0x33;
KEY_4 = 0x34;
KEY_5 = 0x35;
KEY_6 = 0x36;
KEY_7 = 0x37;
KEY_8 = 0x38;
KEY_9 = 0x39;
KEY_A = 0x41;
KEY_B = 0x42;
KEY_C = 0x43;
KEY_D = 0x44;
KEY_E = 0x45;
KEY_F = 0x46;
KEY_G = 0x47;
KEY_H = 0x48;
KEY_I = 0x49;
KEY_J = 0x4A;
KEY_K = 0x4B;
KEY_L = 0x4C;
KEY_M = 0x4D;
KEY_N = 0x4E;
KEY_O = 0x4F;
KEY_P = 0x50;
KEY_Q = 0x51;
KEY_R = 0x52;
KEY_S = 0x53;
KEY_T = 0x54;
KEY_U = 0x55;
KEY_V = 0x56;
KEY_W = 0x57;
KEY_X = 0x58;
KEY_Y = 0x59;
KEY_Z = 0x5A;
Numpad_Multiply = 0x6A;
NoName = 0xFC;
Numpad_0 = 0x60;
Numpad_1 = 0x61;
Numpad_2 = 0x62;
Numpad_3 = 0x63;
Numpad_4 = 0x64;
Numpad_5 = 0x65;
Numpad_6 = 0x66;
Numpad_7 = 0x67;
Numpad_8 = 0x68;
Numpad_9 = 0x69;
OEM_1 = 0xBA;
OEM_102 = 0xE2;
OEM_2 = 0xBF;
OEM_3 = 0xC0;
OEM_4 = 0xDB;
OEM_5 = 0xDC;
OEM_6 = 0xDD;
OEM_7 = 0xDE;
OEM_8 = 0xDF;
OEM_ATTN = 0xF0;
OEM_AUTO = 0xF3;
OEM_AX = 0xE1;
OEM_BACKTAB = 0xF5;
OEM_CLEAR = 0xFE;
OEM_COMMA = 0xBC;
OEM_COPY = 0xF2;
OEM_CUSEL = 0xEF;
OEM_ENLW = 0xF4;
OEM_FINISH = 0xF1;
OEM_FJ_LOYA = 0x95;
OEM_FJ_MASSHOU = 0x93;
OEM_FJ_ROYA = 0x96;
OEM_FJ_TOUROKU = 0x94;
OEM_JUMP = 0xEA;
OEM_MINUS = 0xBD;
OEM_PA1 = 0xEB;
OEM_PA2 = 0xEC;
OEM_PA3 = 0xED;
OEM_PERIOD = 0xBE;
OEM_PLUS = 0xBB;
OEM_RESET = 0xE9;
OEM_WSCTRL = 0xEE;
PA1 = 0xFD;
Packet = 0xE7;
Play = 0xFA;
ProcessKey = 0xE5;
Return = 0x0D;
Select = 0x29;
Separator = 0x6C;
SPACE = 0x20;
Numpad_Subtract = 0x6D;
Tab = 0x09;
Zoom = 0xFB;
None = 0xFF;
Accept = 0x1E;
Apps = 0x5D;
BROWSER_BACK = 0xA6;
BROWSER_FAVORITES = 0xAB;
BROWSER_FORWARD = 0xA7;
BROWSER_HOME = 0xAC;
BROWSER_REFRESH = 0xA8;
BROWSER_SEARCH = 0xAA;
BROWSER_STOP = 0xA9;
Capital = 0x14;
Convert = 0x1C;
Delete = 0x2E;
End = 0x23;
F1 = 0x70;
F10 = 0x79;
F11 = 0x7A;
F12 = 0x7B;
F13 = 0x7C;
F14 = 0x7D;
F15 = 0x7E;
F16 = 0x7F;
F17 = 0x80;
F18 = 0x81;
F19 = 0x82;
F2 = 0x71;
F20 = 0x83;
F21 = 0x84;
F22 = 0x85;
F23 = 0x86;
F24 = 0x87;
F3 = 0x72;
F4 = 0x73;
F5 = 0x74;
F6 = 0x75;
F7 = 0x76;
F8 = 0x77;
F9 = 0x78;
Final = 0x18;
Help = 0x2F;
Home = 0x24;
Ico_00 = 0xE4;
Insert = 0x2D;
JUNJA = 0x17;
KANA = 0x15;
KANJI = 0x19;
LAUNCH_APP1 = 0xB6 ;
LAUNCH_APP2 = 0xB7;
LAUNCH_MAIL = 0xB4;
LAUNCH_MEDIA_SELECT = 0xB5;
Mouse_Left = 0x01;
LControl = 0xA2;
LMenu = 0xA4;
LShift = 0xA0;
LWin = 0x5B;
Media_NextTrack = 0xB0;
Media_PlayPause = 0xB3;
Media_PrevTrack = 0xB1;
Media_Stop = 0xB2;
ModeChange = 0x1F;
NonConvert = 0x1D;
NumLock = 0x90;
OEM_Jisho = 0x92;
Pause = 0x13;
Print = 0x2A;
PageUp = 0x21;
PageDown = 0x22;
Mouse_Right = 0x02;
Mouse_Middle = 0x04;
RConctrol = 0xA3;
RMenu = 0xA5;
RShift = 0xA1;
RWin = 0x5C;
Scroll_Lock = 0x91;
Sleep = 0x5F;
Snapshot = 0x2C;
Up = 0x26;
Down = 0x28;
Left = 0x25;
Right = 0x27;
Volume_Down = 0xAE;
Volume_Mute = 0xAD;
Volume_Up = 0xAF;
XButton_1 = 0x05;
XButton_2 = 0x06;
}
public function Key():Void {
}
public function fIsDown(_hKey:eKey):Bool {
return aKeyDown[_hKey];
}
/*
OEM_2 = 0xBF //OEM_2 (? /)
OEM_3 = 0xC0 //OEM_3 (~ `)
OEM_4 = 0xDB //OEM_4 ({ [)
OEM_5 = 0xDC //OEM_5 (| )
OEM_6 = 0xDD //OEM_6 (} ])
OEM_7 = 0xDE //OEM_7 (" ')
OEM_8 = 0xDF //OEM_8 (§ !)
OEM_ATTN = 0xF0 //Oem Attn
//OEM_COMMA (< ,)
*/
}
}
| Redcode | 4 | VLiance/GZE | src/Lib_GZ/Input/Key.cw | [
"Apache-2.0"
] |
mes 2,2,2
exp $etext
pro $etext,0
end 0
| Eiffel | 0 | wyan/ack | mach/em22/libend/etext.e | [
"BSD-3-Clause"
] |
create-react-class = require \create-react-class
Form = create-react-class do
# render :: a -> ReactElement
render: ->
div null,
# SELECTED COUNTRIES
if @state.selected-countries.length > 0
div do
style: margin: 8
span null, "you selected: "
span do
style:
font-weight: \bold
@state.selected-countries
|> map (.label)
|> Str.join ', '
# MULTISELECT
React.create-element MultiSelect,
ref: \select
placeholder: "Select countries"
options: @state.countries
value: @state.selected-countries
# on-value-change :: Item -> (a -> Void) -> void
on-values-change: (selected-countries) ~> @set-state {selected-countries}
# render-no-results-found :: a -> ReactElement
render-no-results-found: ~>
div class-name: \no-results-found,
if !!@req then "loading countries ..." else "No results found"
# get-initial-state :: a -> UIState
get-initial-state: ->
countries: []
selected-countries: []
# component-will-mount :: a -> Void
component-will-mount: ->
@req = $.getJSON "http://restverse.com/countries"
..done (countries) ~>
<~ @set-state {countries}
@refs.select.highlight-first-selectable-option!
..always ~> delete @req
render (React.create-element Form, null), mount-node | LiveScript | 5 | rodcope1/react-selectize-rodcope1 | public/examples/multi/ChangeCallback.ls | [
"Apache-2.0"
] |
Strict
?Win32
Framework BRL.D3D7Max2D
?MacOS
Framework BRL.GLMax2D
?
Import BRL.GNet
Import BRL.BASIC
Import BRL.PNGLoader
Const GAMEPORT=12345
Const SLOT_TYPE=0
Const SLOT_NAME=1
Const SLOT_CHAT=2
Const SlOT_SCORE=3
Const SLOT_X=4
Const SLOT_Y=5
Const SLOT_VX=6
Const SLOT_VY=7
Const SLOT_ROT=8
Const SLOT_TIMEOUT=9
Const SLOT_HIT=10
Local GWIDTH=640
Local GHEIGHT=480
Local GDEPTH=0
Local GHERTZ=30
Graphics GWIDTH,GHEIGHT,GDEPTH,GHERTZ
AutoMidHandle True
Local playerImage:TImage=LoadImage( "ship.png" )
Local bulletImage:TImage=LoadImage( "bullet1.png" )
Local warpImage:TImage=LoadImage( "sparkle.png" )
Local host:TGNetHost=CreateGNetHost()
SeedRnd MilliSecs()
Local playerName$="Player"
Local playerChat$=""
Local playerX#=Rnd(GWIDTH-64)+32
Local playerY#=Rnd(GHEIGHT-64)+32
Local playerVx#=0
Local playerVy#=0
Local playerRot#=0
Local playerScore=0
Local playerHit#=0
Local playerShot=0
'create local player
Local localPlayer:TGNetObject=CreateGNetObject( host )
SetGNetString localPlayer,SLOT_TYPE,"player"
SetGNetString localPlayer,SLOT_NAME,playerName
SetGNetString localPlayer,SLOT_CHAT,"Ready"
SetGNetFloat localPlayer,SLOT_X,playerX
SetGNetFloat localPlayer,SLOT_Y,playerY
SetGNetFloat localPlayer,SLOT_ROT,playerRot
SetGNetFloat localPlayer,SLOT_HIT,playerHit
SetGNetInt localPlayer,SLOT_SCORE,playerScore
While Not KeyHit( KEY_ESCAPE )
Local c=GetChar()
Select c
Case 8
If playerChat playerChat=playerChat[..playerChat.length-1]
Case 13
If playerChat
If playerChat[..1]="/"
Local cmd$=playerChat[1..]
Local i=cmd.Find(" "),arg$
If i<>-1
arg=cmd[i+1..]
cmd=cmd[..i]
EndIf
Select cmd.ToLower()
Case "nick"
If arg
playerName=arg
SetGNetString localPlayer,SLOT_NAME,playerName
EndIf
Case "listen"
If Not GNetListen( host,GAMEPORT ) Notify "Listen failed"
Case "connect"
If Not arg arg="localhost"
If Not GNetConnect( host,arg,GAMEPORT ) Notify "Connect failed"
End Select
Else
SetGNetString localPlayer,SLOT_CHAT,playerChat
EndIf
playerChat=""
EndIf
Default
If c>31 And c<127 playerChat:+Chr(c)
End Select
If KeyDown( KEY_LEFT )
playerRot:-5
If playerRot<-180 playerRot:+360
SetGNetFloat localPlayer,SLOT_ROT,playerRot
Else If KeyDown( KEY_RIGHT )
playerRot:+5
If playerRot>=180 playerRot:-360
SetGNetFloat localPlayer,SLOT_ROT,playerRot
EndIf
If KeyDown( KEY_UP )
playerVx:+Cos(playerRot)*.15
playerVy:+Sin(playerRot)*.15
Else
playerVx:*.99
If Abs(playerVx)<.1 playerVx=0
playerVy:*.99
If Abs(playerVy)<.1 playerVy=0
EndIf
If playerVx
playerX:+playerVx
If playerX<-8 playerX:+GWIDTH+16 Else If playerX>=GWIDTH+8 playerX:-GWIDTH+16
SetGNetFloat localPlayer,SLOT_X,playerX
EndIf
If playerVy
playerY:+playerVy
If playerY<-8 playerY:+GHEIGHT+16 Else If playerY>=GHEIGHT+8 playerY:-GHEIGHT+16
SetGNetFloat localPlayer,SLOT_Y,playerY
EndIf
If playerShot playerShot:-1
If KeyHit( KEY_LALT ) And Not playerShot
Local obj:TGnetObject=CreateGNetObject( host )
SetGNetString obj,SLOT_TYPE,"bullet"
SetGNetFloat obj,SLOT_X,playerX
SetGNetFloat obj,SLOT_Y,playerY
SetGNetFloat obj,SLOT_VX,playerVx+Cos(playerRot)*10
SetGNetFloat obj,SLOT_VY,playerVy+Sin(playerRot)*10
SetGNetInt obj,SLOT_TIMEOUT,60
playerShot=5
EndIf
'update bullets
For Local obj:TGNetObject=EachIn GNetObjects( host )
If obj.State()=GNET_CLOSED Continue
Local typ$=GetGNetString( obj,SLOT_TYPE )
If typ<>"bullet" Continue
Local x#=GetGNetFloat( obj,SLOT_X )
Local y#=GetGNetFloat( obj,SLOT_Y )
If GNetObjectRemote( obj )
'remote bullet? Check for collision...
Local dx#=x-playerX,dy#=y-playerY
If dx*dx+dy*dy<256'144
Local msg:TGNetObject=CreateGNetMessage( host )
If playerHit
SetGNetString msg,SLOT_TYPE,"gotme"
Else
SetGNetString msg,SLOT_TYPE,"hurtme"
playerHit=1
EndIf
SendGNetMessage msg,obj
EndIf
Else
'local bullet? Update...
Local t=GetGNetInt( obj,SLOT_TIMEOUT )
If Not t
CloseGNetObject obj
Continue
EndIf
Local vx#=GetGNetFloat( obj,SLOT_VX )
Local vy#=GetGNetFloat( obj,SLOT_VY )
Local dx#=x-GWIDTH/2
Local dy#=y-GHEIGHT/2
Local rot#=ATan2(dy,dx)
Local accel#=1/(dx*dx+dy*dy)*2000
vx:-Cos(rot)*accel
vy:-Sin(rot)*accel
x:+vx
y:+vy
SetGNetFloat obj,SLOT_X,x
SetGNetFloat obj,SLOT_Y,y
SetGNetFloat obj,SLOT_VX,vx
SetGNetFloat obj,SLOT_VY,vy
SetGNetInt obj,SLOT_TIMEOUT,t-1
EndIf
Next
If playerHit
playerHit:-.05
If playerHit<0 playerHit=0
SetGNetFloat localPlayer,SLOT_HIT,playerHit
EndIf
GNetSync host
For Local msg:TGNetObject=EachIn GNetMessages( host )
Local typ$=GetGNetString( msg,SLOT_TYPE )
Select typ
Case "gotme","hurtme"
Local obj:TGNetObject=GNetMessageObject(msg)
If obj.State()<>GNET_CLOSED
If typ="hurtme"
playerScore:+1
SetGNetInt localPlayer,SLOT_SCORE,playerScore
EndIf
CloseGNetObject obj
EndIf
End Select
Next
Cls
Local ty
For Local obj:TGNetObject=EachIn GNetObjects( host )
If obj.State()=GNET_CLOSED Continue
Local typ$=GetGNetString( obj,SLOT_TYPE )
Local x#=GetGNetFloat( obj,SLOT_X )
Local y#=GetGNetFloat( obj,SLOT_Y )
Select typ
Case "bullet"
SetBlend LIGHTBLEND
SetColor 255,255,255
DrawImage bulletImage,x,y
SetBlend MASKBLEND
Case "player"
Local rot#=GetGNetFloat( obj,SLOT_ROT )
Local name$=GetGNetString( obj,SLOT_NAME )
Local chat$=GetGNetString( obj,SLOT_CHAT )
Local score=GetGNetInt( obj,SLOT_SCORE )
Local hit#=GetGNetFloat( obj,SLOT_HIT )
SetRotation rot
SetColor 255,255,255
DrawImage playerImage,x,y
If hit
SetAlpha hit
SetBlend LIGHTBLEND
DrawImage playerImage,x,y
SetBlend MASKBLEND
SetAlpha 1
SetColor 255,255,255
EndIf
SetRotation 0
DrawText name+":"+score,x,y+16
If obj=localPlayer SetColor 255,255,255 Else SetColor 0,128,255
DrawText name+":"+chat,0,ty
ty:+16
End Select
Next
If playerChat
SetColor 255,255,0
DrawText ">"+playerChat,0,GHEIGHT-16
SetColor 0,255,0
DrawRect TextWidth(">"+playerChat),GHEIGHT-16,8,16
EndIf
SetColor 255,255,255
Local txt$="MemAllocd:"+GCMemAlloced()
DrawText txt,GWIDTH-TextWidth(txt),0
SetBlend LIGHTBLEND
SetRotation Rnd(360)
SetScale Rnd(2,2.125),Rnd(2,2.125)
DrawImage warpImage,GWIDTH/2,GHEIGHT/2
SetScale 1,1
SetRotation 0
SetBlend MASKBLEND
Flip
Wend
CloseGNetHost host
| BlitzMax | 5 | jabdoa2/blitzmax | samples/mak/gnetdemo.bmx | [
"Zlib"
] |
<p>before</p>
<p>after</p> | HTML | 0 | Theo-Steiner/svelte | test/hydration/samples/if-block-false/_before.html | [
"MIT"
] |
;; -*- no-byte-compile: t; -*-
;;; lang/rst/packages.el
(package! sphinx-mode :pin "b5ac514e213459dcc57184086f10b5b6be3cecd8")
| Emacs Lisp | 2 | leezu/doom-emacs | modules/lang/rst/packages.el | [
"MIT"
] |
Add a debug argument to `web.run_app()` for enabling debug mode on loop.
| Cucumber | 4 | ikrivosheev/aiohttp | CHANGES/3796.feature | [
"Apache-2.0"
] |
import ThirdPartyEmailPasswordNode from 'supertokens-node/recipe/thirdpartyemailpassword'
import SessionNode from 'supertokens-node/recipe/session'
import { appInfo } from './appInfo'
export let backendConfig = () => {
return {
framework: 'express',
supertokens: {
connectionURI: 'https://try.supertokens.io',
},
appInfo,
recipeList: [
ThirdPartyEmailPasswordNode.init({
providers: [
// We have provided you with development keys which you can use for testing.
// IMPORTANT: Please replace them with your own OAuth keys for production use.
ThirdPartyEmailPasswordNode.Google({
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
}),
ThirdPartyEmailPasswordNode.Github({
clientId: process.env.GITHUB_CLIENT_ID,
clientSecret: process.env.GITHUB_CLIENT_SECRET,
}),
ThirdPartyEmailPasswordNode.Apple({
clientId: process.env.APPLE_CLIENT_ID,
clientSecret: {
keyId: process.env.APPLE_KEY_ID,
privateKey: process.env.APPLE_PRIVATE_KEY.replace(/\\n/g, '\n'),
teamId: process.env.APPLE_TEAM_ID,
},
}),
],
}),
SessionNode.init(),
],
isInServerlessEnv: true,
}
}
| JavaScript | 5 | blomqma/next.js | examples/with-supertokens/config/backendConfig.js | [
"MIT"
] |
#ifndef NPY_SIMD
#error "Not a standalone header"
#endif
#ifndef _NPY_SIMD_AVX2_UTILS_H
#define _NPY_SIMD_AVX2_UTILS_H
#define npyv256_shuffle_odd(A) _mm256_permute4x64_epi64(A, _MM_SHUFFLE(3, 1, 2, 0))
#define npyv256_shuffle_odd_ps(A) _mm256_castsi256_ps(npyv256_shuffle_odd(_mm256_castps_si256(A)))
#define npyv256_shuffle_odd_pd(A) _mm256_permute4x64_pd(A, _MM_SHUFFLE(3, 1, 2, 0))
NPY_FINLINE __m256i npyv256_mul_u8(__m256i a, __m256i b)
{
const __m256i mask = _mm256_set1_epi32(0xFF00FF00);
__m256i even = _mm256_mullo_epi16(a, b);
__m256i odd = _mm256_mullo_epi16(_mm256_srai_epi16(a, 8), _mm256_srai_epi16(b, 8));
odd = _mm256_slli_epi16(odd, 8);
return _mm256_blendv_epi8(even, odd, mask);
}
#endif // _NPY_SIMD_AVX2_UTILS_H
| C | 4 | iam-abbas/numpy | numpy/core/src/common/simd/avx2/utils.h | [
"BSD-3-Clause"
] |
CREATE TABLE `tb_yzcwyrztvj` (
`col_ubxpjfudbv` timestamp(5) NOT NULL DEFAULT CURRENT_TIMESTAMP(5),
PRIMARY KEY (`col_ubxpjfudbv`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
| SQL | 3 | yuanweikang2020/canal | parse/src/test/resources/ddl/alter/mysql_6.sql | [
"Apache-2.0"
] |
; Purpose: Automates RogueKillerCMD cleaning
; Requirements: RogueKillerCMD.exe placed in the same directory as this compiled file
; Author: reddit.com/user/SleepyDoge
; Version: 1.0.0-TRON
; Misc: Included for use with Tron by reddit.com/user/vocatus
#include <MsgBoxConstants.au3>
#include <TrayConstants.au3>
#include <Array.au3>
#include <Constants.au3>
sleep(1000)
;Wait for RogueKiller to Start, timeout of 3 minutes
ProcessWait( "RogueKillerCMD.exe", 180 )
;Activate Tron Window and send keystrokes until RogueKillerCMD.exe isn't running
do
sleep(30000)
ControlSend("TRON v6.6.0 [stage_3_disinfect] [RogueKiller]", "", "", "remove{ENTER}")
ControlSend("Administrator: TRON v6.6.0 [stage_3_disinfect] [RogueKiller]", "", "", "remove{ENTER}")
$errorCheck = ProcessExists("RogueKillerCMD.exe")
until $errorCheck = 0
Exit
| AutoIt | 4 | Mchar7/tron | resources/stage_3_disinfect/roguekiller/RogueKillerAutomation_source.au3 | [
"MIT"
] |
fileFormatVersion: 2
guid: 4655b85b9047b42e0b35f79c9245b65a
folderAsset: yes
timeCreated: 1516234013
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
| Unity3D Asset | 0 | cihan-demir/NineMensMorris | MLPYthonEnv/ml-agents-release_17/Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scenes.meta | [
"MIT"
] |
%%{
machine css_parser;
alphtype unsigned char;
include css_syntax "css_syntax.rl";
main := selectors_group;
}%%
%% write data;
#include <cstddef>
namespace rspamd::css {
int
parse_css_selector (const unsigned char *data, std::size_t len)
{
const unsigned char *p = data, *pe = data + len, *eof;
int cs;
%% write init;
%% write exec;
return cs;
}
} | Ragel in Ruby Host | 4 | msuslu/rspamd | src/libserver/css/css_selector_parser.rl | [
"Apache-2.0"
] |
//! Slow, fallback algorithm for cases the Eisel-Lemire algorithm cannot round.
use crate::num::dec2flt::common::BiasedFp;
use crate::num::dec2flt::decimal::{parse_decimal, Decimal};
use crate::num::dec2flt::float::RawFloat;
/// Parse the significant digits and biased, binary exponent of a float.
///
/// This is a fallback algorithm that uses a big-integer representation
/// of the float, and therefore is considerably slower than faster
/// approximations. However, it will always determine how to round
/// the significant digits to the nearest machine float, allowing
/// use to handle near half-way cases.
///
/// Near half-way cases are halfway between two consecutive machine floats.
/// For example, the float `16777217.0` has a bitwise representation of
/// `100000000000000000000000 1`. Rounding to a single-precision float,
/// the trailing `1` is truncated. Using round-nearest, tie-even, any
/// value above `16777217.0` must be rounded up to `16777218.0`, while
/// any value before or equal to `16777217.0` must be rounded down
/// to `16777216.0`. These near-halfway conversions therefore may require
/// a large number of digits to unambiguously determine how to round.
///
/// The algorithms described here are based on "Processing Long Numbers Quickly",
/// available here: <https://arxiv.org/pdf/2101.11408.pdf#section.11>.
pub(crate) fn parse_long_mantissa<F: RawFloat>(s: &[u8]) -> BiasedFp {
const MAX_SHIFT: usize = 60;
const NUM_POWERS: usize = 19;
const POWERS: [u8; 19] =
[0, 3, 6, 9, 13, 16, 19, 23, 26, 29, 33, 36, 39, 43, 46, 49, 53, 56, 59];
let get_shift = |n| {
if n < NUM_POWERS { POWERS[n] as usize } else { MAX_SHIFT }
};
let fp_zero = BiasedFp::zero_pow2(0);
let fp_inf = BiasedFp::zero_pow2(F::INFINITE_POWER);
let mut d = parse_decimal(s);
// Short-circuit if the value can only be a literal 0 or infinity.
if d.num_digits == 0 || d.decimal_point < -324 {
return fp_zero;
} else if d.decimal_point >= 310 {
return fp_inf;
}
let mut exp2 = 0_i32;
// Shift right toward (1/2 ... 1].
while d.decimal_point > 0 {
let n = d.decimal_point as usize;
let shift = get_shift(n);
d.right_shift(shift);
if d.decimal_point < -Decimal::DECIMAL_POINT_RANGE {
return fp_zero;
}
exp2 += shift as i32;
}
// Shift left toward (1/2 ... 1].
while d.decimal_point <= 0 {
let shift = if d.decimal_point == 0 {
match d.digits[0] {
digit if digit >= 5 => break,
0 | 1 => 2,
_ => 1,
}
} else {
get_shift((-d.decimal_point) as _)
};
d.left_shift(shift);
if d.decimal_point > Decimal::DECIMAL_POINT_RANGE {
return fp_inf;
}
exp2 -= shift as i32;
}
// We are now in the range [1/2 ... 1] but the binary format uses [1 ... 2].
exp2 -= 1;
while (F::MINIMUM_EXPONENT + 1) > exp2 {
let mut n = ((F::MINIMUM_EXPONENT + 1) - exp2) as usize;
if n > MAX_SHIFT {
n = MAX_SHIFT;
}
d.right_shift(n);
exp2 += n as i32;
}
if (exp2 - F::MINIMUM_EXPONENT) >= F::INFINITE_POWER {
return fp_inf;
}
// Shift the decimal to the hidden bit, and then round the value
// to get the high mantissa+1 bits.
d.left_shift(F::MANTISSA_EXPLICIT_BITS + 1);
let mut mantissa = d.round();
if mantissa >= (1_u64 << (F::MANTISSA_EXPLICIT_BITS + 1)) {
// Rounding up overflowed to the carry bit, need to
// shift back to the hidden bit.
d.right_shift(1);
exp2 += 1;
mantissa = d.round();
if (exp2 - F::MINIMUM_EXPONENT) >= F::INFINITE_POWER {
return fp_inf;
}
}
let mut power2 = exp2 - F::MINIMUM_EXPONENT;
if mantissa < (1_u64 << F::MANTISSA_EXPLICIT_BITS) {
power2 -= 1;
}
// Zero out all the bits above the explicit mantissa bits.
mantissa &= (1_u64 << F::MANTISSA_EXPLICIT_BITS) - 1;
BiasedFp { f: mantissa, e: power2 }
}
| Rust | 5 | mbc-git/rust | library/core/src/num/dec2flt/slow.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
'***************************************************************************************
' HalfDuplexSerial
' Copyright (c) 2010 Dave Hein
' July 6, 2010
' See end of file for terms of use
'***************************************************************************************
' This object implements a half-duplex serial port. It is implemented in Spin and
' LMM PASM. The lmm.start method must be called before calling this object.
'
' The dbprintf method provide formatted output. The dbprint0 to dbprintf6 methods are
' used depending on how many parameters are passed.
'***************************************************************************************
OBJ
lmm : "SpinLMM"
CON
' LMM PASM constants
reg0 = lmm#reg0
reg1 = lmm#reg1
reg2 = lmm#reg2
reg3 = lmm#reg3
reg4 = lmm#reg4
fjmp = lmm#fjmp
fretx = lmm#fretx
lmm_pc = lmm#lmm_pc
dcurr = lmm#dcurr
' Run the txbyte LMM program to transmit a single byte at 57,600 baud
PUB tx(value)
lmm.run1(@txbyte, value)
DAT org 0
txbyte mov reg3, #1 ' Create P30 bitmask
shl reg3, #30
or outa, reg3 ' Set P30 high
or dira, reg3 ' Set P30 for output
sub dcurr, #4 ' Read byte off the stack
rdlong reg0, dcurr
or reg0, #$100 ' Add start and stop bits to byte
shl reg0, #2
or reg0, #1
mov reg4, #11 ' Set count for 11 bits
mov reg1, #174 ' Initialize for 460,800 baud
shl reg1, #3 ' Reduce to 57,600 baud
mov reg2, reg1 ' Initialize wait count
add reg2, cnt
txbyte1 shr reg0, #1 wc ' Output a bit to P30
muxc outa, reg3
waitcnt reg2, reg1 ' Wait one bit time
djnz reg4, #FJMP
long @@@txbyte1
jmp #FRETX ' Return
' Run the rxbyte LMM program to read a single byte at 57,600 baud
PUB rx
result := lmm.run0(@rxbyte)
DAT org 0
rxbyte mov reg3, #1 ' Create P31 bit mask
shl reg3, #31
andn dira, reg3 ' Set P31 for input
mov reg4, #10 ' Set count for 10 bits
mov reg1, #174 ' Initialize for 460,800 baud
shl reg1, #3 ' Reduce to 57,600 baud
mov reg2, reg1 ' Initialize for one-half bit time
shr reg2, #1
rxbyte1 test reg3, ina wc ' Wait for start bit
if_c sub lmm_pc, #8
add reg2, cnt ' Add CNT to one-half bit time
rxbyte2 waitcnt reg2, reg1 ' Wait to sample bit
test reg3, ina wc
rcr reg0, #1 ' Shift bit into MSB
djnz reg4, #FJMP
long @@@rxbyte2
shr reg0, #23 ' Right justify
and reg0, #$FF ' Remove stop bit
jmp #FRETX ' Return byte
' Convert a string of hex digits to a number
PUB strtohex(ptr)
repeat 8
case byte[ptr]
"0".."9": result := (result << 4) + byte[ptr++] - "0"
"a".."f": result := (result << 4) + byte[ptr++] - "a" + 10
"A".."F": result := (result << 4) + byte[ptr++] - "A" + 10
other: quit
' Convert a string of hex digits to a number
PUB strtodec(ptr)
repeat
case byte[ptr]
"0".."9": result := (result * 10) + byte[ptr++] - "0"
other: quit
' Read a string from the serial port and echo each character received
PUB getstr(ptr, num) | i, value
repeat i from 0 to num - 2
byte[ptr][i] := value := rx
tx(value)
if value == 13
quit
byte[ptr][i] := 0
' Transmit a string out the serial port
PUB str(ptr)
repeat while byte[ptr]
tx(byte[ptr++])
' Convert a number to hex characters and transmit out the serial port
PUB hex(value, digits)
'' Print a hexadecimal number
value <<= (8 - digits) << 2
repeat digits
tx(lookupz((value <-= 4) & $F : "0".."9", "A".."F"))
PUB dec(value) | i
'' Print a decimal number
if (value < 0)
tx("-")
if (value == NEGX)
tx("2")
value += 2_000_000_000
value := -value
i := 1_000_000_000
repeat while (i > value and i > 1)
i /= 10
repeat while (i > 0)
tx(value/i + "0")
value //= i
i /= 10
PUB bin(value, digits)
'' Print a binary number
value <<= 32 - digits
repeat digits
tx((value <-= 1) & 1 + "0")
PUB dbprintf0(fmtstr)
dbprintf(fmtstr, @fmtstr)
PUB dbprintf1(fmtstr, arg1)
dbprintf(fmtstr, @arg1)
PUB dbprintf2(fmtstr, arg1, arg2)
dbprintf(fmtstr, @arg1)
PUB dbprintf3(fmtstr, arg1, arg2, arg3)
dbprintf(fmtstr, @arg1)
PUB dbprintf4(fmtstr, arg1, arg2, arg3, arg4)
dbprintf(fmtstr, @arg1)
PUB dbprintf5(fmtstr, arg1, arg2, arg3, arg4, arg5)
dbprintf(fmtstr, @arg1)
PUB dbprintf6(fmtstr, arg1, arg2, arg3, arg4, arg5, arg6)
dbprintf(fmtstr, @arg1)
PUB dbprintf(fmtstr, arglist) | arg, val, digits
arg := long[arglist]
arglist += 4
repeat while (val := byte[fmtstr++])
if (val == "%")
digits := 0
repeat
case (val := byte[fmtstr++])
"d" : dec(arg)
"x" :
ifnot digits
digits := 8
hex(arg, digits)
"b" :
ifnot digits
digits := 32
bin(arg, digits)
"s" : str(arg)
"0".."9":
digits := (digits * 10) + val - "0"
next
0 : return
other: tx(val)
quit
arg := long[arglist]
arglist += 4
elseif (val == "\")
case (val := byte[fmtstr++])
"n" : tx(13)
0 : return
other: tx(val)
else
tx(val)
{{
TERMS OF USE: MIT License
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.
}}
| Propeller Spin | 5 | deets/propeller | libraries/community/p1/All/SpinLMM/SpinLMM10/HalfDuplexSerial.spin | [
"MIT"
] |
module Lang
pub type array[#e] extern true
impl array[#e] {
fn len () extern("opal.list") "array.len" -> int
fn cap () extern("opal.list") "array.cap" -> int
fn cap_set (n : int) extern("opal.list") "array.cap_set" -> unit
fn get (i : int) extern("opal.list") "array.get" -> #e
fn set (i : int, t : #e) extern("opal.list") "array.set" -> unit
fn insert (i : int, t : #e) extern("opal.list") "array.insert" -> unit
fn remove (i : int) extern("opal.list") "array.remove" -> unit
fn push (t : #e) {
self[self.len()] = t
}
fn pop () {
self.remove(self.len().pred())
}
fn empty? () { self.len() == 0 }
fn foldl (z : #e', f : fn(#e', #e) -> #e') {
let i = 0;
while i < self.len() {
z = f(z, self[i]);
i = i.succ();
}
z
}
fn foldr (z : #e', f : fn(#e, #e') -> #e') {
let i = self.len();
while i > 0 {
i = i.pred();
z = f(self[i], z);
}
z
}
fn each (f : fn(#e) -> unit) {
let i = 0;
while i < self.len() {
f(self[i]);
i = i.succ();
}
}
fn eachi (f : fn(int, #e) -> unit) {
let i = 0;
while i < self.len() {
f(i, self[i]);
i = i.succ();
}
}
fn copy () {
let res = array();
res.cap_set(self.cap());
self.each(res.push);
res
}
fn fill (elem : #e, n : int) {
self.cap_set(self.cap() + n)
while n > 0 {
self.push(elem)
n = n.pred()
}
}
fn slice (a : int, b : int) {
let res = array()
if a < b {
res.cap_set(b - a);
let i = a;
while i < b {
res.push(self[i]);
i = i.succ();
}
}
; res
}
fn slice_from (a : int) { self.slice(a, self.len()) }
fn slice_to (b : int) { self.slice(0, b) }
fn map (f : fn(#e) -> #e') {
let res = array();
res.cap_set(self.len());
self.eachi |i, x| {
res.push(f(x))
};
res
}
fn to_list () {
let res = [];
let i = self.len();
while i > 0 {
i = i.pred();
res = self[i] $ res;
}
; res
}
fn to_array () { self }
}
impl array[#e(Show)] { fn str () {
let res = "["
let i = 0;
while i < self.len() {
if i > 0 {
res = res + ", ";
}
res = res + self[i].str();
i = i.succ();
}
res + "]"
}}
pub fn array () extern("opal.list") "array" -> array[#e]
pub fn array_of (elem : #e, n : int) {
let a = array();
a.fill(elem, n);
a
}
impl list[#e] {
fn to_array () {
let res = array();
self.each(res.push);
res
}
}
| Opal | 4 | iitalics/Opal | opal_libs/Lang/array.opal | [
"MIT"
] |
/* MMPX.glc
Copyright 2020 Morgan McGuire & Mara Gagiu.
Provided under the Open Source MIT license https://opensource.org/licenses/MIT
See js-demo.html for the commented source code.
This is an optimized GLSL port of that version
by Morgan McGuire and Mara Gagiu.
*/
#define ABGR8 uint
ABGR8 src(int x, int y) {
return readColoru(uvec2(clamp(x, 0, params.width - 1), clamp(y, 0, params.height - 1)));
}
uint luma(ABGR8 C) {
uint alpha = (C & 0xFF000000u) >> 24;
return (((C & 0x00FF0000u) >> 16) + ((C & 0x0000FF00u) >> 8) + (C & 0x000000FFu) + 1u) * (256u - alpha);
}
bool all_eq2(ABGR8 B, ABGR8 A0, ABGR8 A1) {
return ((B ^ A0) | (B ^ A1)) == 0u;
}
bool all_eq3(ABGR8 B, ABGR8 A0, ABGR8 A1, ABGR8 A2) {
return ((B ^ A0) | (B ^ A1) | (B ^ A2)) == 0u;
}
bool all_eq4(ABGR8 B, ABGR8 A0, ABGR8 A1, ABGR8 A2, ABGR8 A3) {
return ((B ^ A0) | (B ^ A1) | (B ^ A2) | (B ^ A3)) == 0u;
}
bool any_eq3(ABGR8 B, ABGR8 A0, ABGR8 A1, ABGR8 A2) {
return B == A0 || B == A1 || B == A2;
}
bool none_eq2(ABGR8 B, ABGR8 A0, ABGR8 A1) {
return (B != A0) && (B != A1);
}
bool none_eq4(ABGR8 B, ABGR8 A0, ABGR8 A1, ABGR8 A2, ABGR8 A3) {
return B != A0 && B != A1 && B != A2 && B != A3;
}
uint applyScalingu(uvec2 origxy, uvec2 xy) {
int srcX = int(origxy.x);
int srcY = int(origxy.y);
ABGR8 A = src(srcX - 1, srcY - 1), B = src(srcX, srcY - 1), C = src(srcX + 1, srcY - 1);
ABGR8 D = src(srcX - 1, srcY + 0), E = src(srcX, srcY + 0), F = src(srcX + 1, srcY + 0);
ABGR8 G = src(srcX - 1, srcY + 1), H = src(srcX, srcY + 1), I = src(srcX + 1, srcY + 1);
ABGR8 J = E, K = E, L = E, M = E;
if (((A ^ E) | (B ^ E) | (C ^ E) | (D ^ E) | (F ^ E) | (G ^ E) | (H ^ E) | (I ^ E)) != 0u) {
ABGR8 P = src(srcX, srcY - 2), S = src(srcX, srcY + 2);
ABGR8 Q = src(srcX - 2, srcY), R = src(srcX + 2, srcY);
ABGR8 Bl = luma(B), Dl = luma(D), El = luma(E), Fl = luma(F), Hl = luma(H);
// 1:1 slope rules
if ((D == B && D != H && D != F) && (El >= Dl || E == A) && any_eq3(E, A, C, G) && ((El < Dl) || A != D || E != P || E != Q)) J = D;
if ((B == F && B != D && B != H) && (El >= Bl || E == C) && any_eq3(E, A, C, I) && ((El < Bl) || C != B || E != P || E != R)) K = B;
if ((H == D && H != F && H != B) && (El >= Hl || E == G) && any_eq3(E, A, G, I) && ((El < Hl) || G != H || E != S || E != Q)) L = H;
if ((F == H && F != B && F != D) && (El >= Fl || E == I) && any_eq3(E, C, G, I) && ((El < Fl) || I != H || E != R || E != S)) M = F;
// Intersection rules
if ((E != F && all_eq4(E, C, I, D, Q) && all_eq2(F, B, H)) && (F != src(srcX + 3, srcY))) K = M = F;
if ((E != D && all_eq4(E, A, G, F, R) && all_eq2(D, B, H)) && (D != src(srcX - 3, srcY))) J = L = D;
if ((E != H && all_eq4(E, G, I, B, P) && all_eq2(H, D, F)) && (H != src(srcX, srcY + 3))) L = M = H;
if ((E != B && all_eq4(E, A, C, H, S) && all_eq2(B, D, F)) && (B != src(srcX, srcY - 3))) J = K = B;
if (Bl < El && all_eq4(E, G, H, I, S) && none_eq4(E, A, D, C, F)) J = K = B;
if (Hl < El && all_eq4(E, A, B, C, P) && none_eq4(E, D, G, I, F)) L = M = H;
if (Fl < El && all_eq4(E, A, D, G, Q) && none_eq4(E, B, C, I, H)) K = M = F;
if (Dl < El && all_eq4(E, C, F, I, R) && none_eq4(E, B, A, G, H)) J = L = D;
// 2:1 slope rules
if (H != B) {
if (H != A && H != E && H != C) {
if (all_eq3(H, G, F, R) && none_eq2(H, D, src(srcX + 2, srcY - 1))) L = M;
if (all_eq3(H, I, D, Q) && none_eq2(H, F, src(srcX - 2, srcY - 1))) M = L;
}
if (B != I && B != G && B != E) {
if (all_eq3(B, A, F, R) && none_eq2(B, D, src(srcX + 2, srcY + 1))) J = K;
if (all_eq3(B, C, D, Q) && none_eq2(B, F, src(srcX - 2, srcY + 1))) K = J;
}
} // H !== B
if (F != D) {
if (D != I && D != E && D != C) {
if (all_eq3(D, A, H, S) && none_eq2(D, B, src(srcX + 1, srcY + 2))) J = L;
if (all_eq3(D, G, B, P) && none_eq2(D, H, src(srcX + 1, srcY - 2))) L = J;
}
if (F != E && F != A && F != G) {
if (all_eq3(F, C, H, S) && none_eq2(F, B, src(srcX - 1, srcY + 2))) K = M;
if (all_eq3(F, I, B, P) && none_eq2(F, H, src(srcX - 1, srcY - 2))) M = K;
}
} // F !== D
} // not constant
// TODO: Write four pixels at once. For now, 1/4x speed.
if ((xy.y & 1u) == 0u) {
if ((xy.x & 1u) == 0u) {
return J;
}
return K;
}
if ((xy.x & 1u) == 0u) {
return L;
}
return M;
}
vec4 applyScalingf(uvec2 origxy, uvec2 xy) {
return unpackUnorm4x8(applyScalingu(origxy, xy));
}
| Tcsh | 4 | ianclawson/Provenance | Cores/PPSSPP/cmake/assets/shaders/tex_mmpx.csh | [
"BSD-3-Clause"
] |
<GameProjectFile>
<PropertyGroup Type="Node" Name="LevelSelection" ID="3a70c19b-f7ee-42c6-b8b3-209bfbde5c21" Version="2.0.0.0" />
<Content ctype="GameProjectContent">
<Content>
<Animation Duration="0" Speed="1" />
<ObjectData Name="Node_0" CanEdit="False" FrameEvent="" ctype="SingleNodeObjectData">
<Position X="0" Y="0" />
<Scale ScaleX="1" ScaleY="1" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="0" Y="0" />
<PrePosition X="0" Y="0" />
<PreSize X="0" Y="0" />
<Children>
<NodeObjectData Name="Node_Background" ActionTag="360000227" FrameEvent="" Tag="5" ObjectIndex="1" ctype="SpriteObjectData">
<Position X="0" Y="0" />
<Scale ScaleX="1" ScaleY="1" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="640" Y="960" />
<PrePosition X="0" Y="0" />
<PreSize X="0" Y="0" />
<FileData Type="Normal" Path="LevelSelection/LS10.png" />
</NodeObjectData>
<NodeObjectData Name="PageView_SelectPage" ActionTag="564277662" FrameEvent="" Tag="10" ObjectIndex="1" TouchEnable="True" BackColorAlpha="0" ComboBoxIndex="1" ColorAngle="0" ScrollDirectionType="0" ctype="PageViewObjectData">
<Position X="73.99939" Y="350.8333" />
<Scale ScaleX="1" ScaleY="1" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="492" Y="538" />
<PrePosition X="0" Y="0" />
<PreSize X="0" Y="0" />
<Children>
<NodeObjectData Name="Panel_Page_1" ActionTag="381278202" FrameEvent="" Tag="11" ObjectIndex="1" TouchEnable="True" BackColorAlpha="0" ComboBoxIndex="1" ColorAngle="0" ctype="PanelObjectData">
<Position X="0" Y="0" />
<Scale ScaleX="1" ScaleY="1" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="492" Y="538" />
<PrePosition X="0" Y="0" />
<PreSize X="0" Y="0" />
<Children>
<NodeObjectData Name="Image_Level_1" ActionTag="281744618" FrameEvent="" Tag="18" ObjectIndex="17" ctype="SpriteObjectData">
<Position X="0" Y="0" />
<Scale ScaleX="1" ScaleY="1" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="417" Y="502" />
<PrePosition X="0" Y="0" />
<PreSize X="0.09349594" Y="0.08550186" />
<FileData Type="Normal" Path="LevelSelection/LS12.png" />
</NodeObjectData>
<NodeObjectData Name="Image_Label_1" ActionTag="1001962982" FrameEvent="" Tag="15" ObjectIndex="3" ctype="SpriteObjectData">
<Position X="246.0001" Y="32.49963" />
<Scale ScaleX="1" ScaleY="1" />
<AnchorPoint ScaleX="0.5" ScaleY="0.5" />
<CColor A="255" R="255" G="255" B="255" />
<Size X="129" Y="36" />
<PrePosition X="0.5000002" Y="0.06040823" />
<PreSize X="0" Y="0" />
<FileData Type="Normal" Path="LevelSelection/LS06.png" />
</NodeObjectData>
</Children>
<SingleColor A="255" R="150" G="200" B="255" />
<FirstColor A="255" R="150" G="200" B="255" />
<EndColor A="255" R="255" G="255" B="255" />
<ColorVector ScaleX="1" ScaleY="-4.371139E-08" />
</NodeObjectData>
<NodeObjectData Name="Panel_Page_2" ActionTag="120224299" FrameEvent="" Tag="12" ObjectIndex="2" TouchEnable="True" BackColorAlpha="0" ComboBoxIndex="1" ColorAngle="0" ctype="PanelObjectData">
<Position X="492" Y="0" />
<Scale ScaleX="1" ScaleY="1" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="492" Y="538" />
<PrePosition X="0" Y="0" />
<PreSize X="1" Y="1" />
<Children>
<NodeObjectData Name="Sprite_Level_2" ActionTag="735637869" FrameEvent="" Tag="19" ObjectIndex="18" ctype="SpriteObjectData">
<Position X="0" Y="0" />
<Scale ScaleX="1" ScaleY="1" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="492" Y="538" />
<PrePosition X="0" Y="0" />
<PreSize X="0" Y="0" />
<FileData Type="Normal" Path="LevelSelection/LS13.png" />
</NodeObjectData>
<NodeObjectData Name="Sprite_Label_2" ActionTag="603660308" FrameEvent="" Tag="16" ObjectIndex="4" ctype="SpriteObjectData">
<Position X="229.3335" Y="32.49957" />
<Scale ScaleX="1" ScaleY="1" />
<AnchorPoint ScaleX="0.5" ScaleY="0.5" />
<CColor A="255" R="255" G="255" B="255" />
<Size X="130" Y="35" />
<PrePosition X="0.466125" Y="0.06040813" />
<PreSize X="0" Y="0" />
<FileData Type="Normal" Path="LevelSelection/LS04.png" />
</NodeObjectData>
</Children>
<SingleColor A="255" R="150" G="200" B="255" />
<FirstColor A="255" R="150" G="200" B="255" />
<EndColor A="255" R="255" G="255" B="255" />
<ColorVector ScaleX="1" ScaleY="-4.371139E-08" />
</NodeObjectData>
<NodeObjectData Name="Panel_Page_3" ActionTag="926963143" FrameEvent="" Tag="38" ObjectIndex="5" TouchEnable="True" BackColorAlpha="0" ComboBoxIndex="1" ColorAngle="0" ctype="PanelObjectData">
<Position X="984" Y="0" />
<Scale ScaleX="1" ScaleY="1" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="492" Y="538" />
<PrePosition X="0" Y="0" />
<PreSize X="0" Y="0" />
<Children>
<NodeObjectData Name="Sprite_Level_3" ActionTag="862438167" FrameEvent="" Tag="39" ObjectIndex="26" ctype="SpriteObjectData">
<Position X="0" Y="0" />
<Scale ScaleX="1" ScaleY="1" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="436" Y="486" />
<PrePosition X="0" Y="0" />
<PreSize X="0" Y="0" />
<FileData Type="Normal" Path="LevelSelection/LS14.png" />
</NodeObjectData>
<NodeObjectData Name="Sprite_Label_3" ActionTag="152222942" FrameEvent="" Tag="40" ObjectIndex="27" ctype="SpriteObjectData">
<Position X="229" Y="32" />
<Scale ScaleX="1" ScaleY="1" />
<AnchorPoint ScaleX="0.5" ScaleY="0.5" />
<CColor A="255" R="255" G="255" B="255" />
<Size X="98" Y="37" />
<PrePosition X="0.4654472" Y="0.05947955" />
<PreSize X="0" Y="0" />
<FileData Type="Normal" Path="LevelSelection/LS05.png" />
</NodeObjectData>
</Children>
<SingleColor A="255" R="150" G="200" B="255" />
<FirstColor A="255" R="150" G="200" B="255" />
<EndColor A="255" R="255" G="255" B="255" />
<ColorVector ScaleX="1" ScaleY="-4.371139E-08" />
</NodeObjectData>
</Children>
<SingleColor A="255" R="150" G="150" B="100" />
<FirstColor A="255" R="150" G="150" B="100" />
<EndColor A="255" R="255" G="255" B="255" />
<ColorVector ScaleX="1" ScaleY="-4.371139E-08" />
</NodeObjectData>
<NodeObjectData Name="Button_Enter" ActionTag="689847562" FrameEvent="" Tag="13" ObjectIndex="3" TouchEnable="True" FontSize="14" ButtonText="" Scale9Width="240" Scale9Height="81" ctype="ButtonObjectData">
<Position X="319.9994" Y="214.1666" />
<Scale ScaleX="1" ScaleY="1" />
<AnchorPoint ScaleX="0.5" ScaleY="0.5" />
<CColor A="255" R="255" G="255" B="255" />
<Size X="240" Y="81" />
<PrePosition X="0" Y="0" />
<PreSize X="0" Y="0" />
<TextColor A="255" R="65" G="65" B="70" />
<DisabledFileData Type="Normal" Path="LevelSelection/LS09.png" />
<PressedFileData Type="Normal" Path="LevelSelection/LS08.png" />
<NormalFileData Type="Normal" Path="LevelSelection/LS07.png" />
</NodeObjectData>
<NodeObjectData Name="Sprite_Star" ActionTag="168618877" FrameEvent="" Tag="14" ObjectIndex="2" ctype="SpriteObjectData">
<Position X="291.4998" Y="297.4998" />
<Scale ScaleX="1" ScaleY="1" />
<AnchorPoint ScaleX="0.5" ScaleY="0.5" />
<CColor A="255" R="255" G="255" B="255" />
<Size X="46" Y="37" />
<PrePosition X="0" Y="0" />
<PreSize X="0" Y="0" />
<FileData Type="Normal" Path="Common/Cn21.png" />
</NodeObjectData>
<NodeObjectData Name="LabelAtlas_CurrentScene" ActionTag="2120879683" FrameEvent="" Tag="11651" ObjectIndex="3" CharWidth="20" CharHeight="31" LabelText="1/3" StartChar="." ctype="TextAtlasObjectData">
<Position X="344.5707" Y="297.1427" />
<Scale ScaleX="1" ScaleY="1" />
<AnchorPoint ScaleX="0.5" ScaleY="0.5" />
<CColor A="255" R="255" G="255" B="255" />
<Size X="60" Y="31" />
<PrePosition X="0" Y="0" />
<PreSize X="0" Y="0" />
<LabelAtlasFileImage_CNB Type="Normal" Path="LevelSelection/LS11.png" />
</NodeObjectData>
<NodeObjectData Name="Button_Left" ActionTag="213262867" FrameEvent="" Tag="8" ObjectIndex="1" TouchEnable="True" FontSize="14" ButtonText="" Scale9Width="66" Scale9Height="83" ctype="ButtonObjectData">
<Position X="65.83301" Y="465.8333" />
<Scale ScaleX="1" ScaleY="1" />
<AnchorPoint ScaleX="0.5" ScaleY="0.5" />
<CColor A="255" R="255" G="255" B="255" />
<Size X="66" Y="83" />
<PrePosition X="0" Y="0" />
<PreSize X="0" Y="0" />
<TextColor A="255" R="65" G="65" B="70" />
<DisabledFileData Type="Normal" Path="LevelSelection/LS02.png" />
<PressedFileData Type="Normal" Path="LevelSelection/LS01.png" />
<NormalFileData Type="Normal" Path="LevelSelection/LS03.png" />
</NodeObjectData>
<NodeObjectData Name="Button_Right" ActionTag="552079242" FrameEvent="" Tag="9" ObjectIndex="2" TouchEnable="True" FlipX="True" FontSize="14" ButtonText="" Scale9Width="66" Scale9Height="83" ctype="ButtonObjectData">
<Position X="574.1658" Y="465.8333" />
<Scale ScaleX="1" ScaleY="1" />
<AnchorPoint ScaleX="0.5" ScaleY="0.5" />
<CColor A="255" R="255" G="255" B="255" />
<Size X="66" Y="83" />
<PrePosition X="0" Y="0" />
<PreSize X="0" Y="0" />
<TextColor A="255" R="65" G="65" B="70" />
<DisabledFileData Type="Normal" Path="LevelSelection/LS02.png" />
<PressedFileData Type="Normal" Path="LevelSelection/LS01.png" />
<NormalFileData Type="Normal" Path="LevelSelection/LS03.png" />
</NodeObjectData>
</Children>
</ObjectData>
</Content>
</Content>
</GameProjectFile> | Csound | 3 | chukong/CocosStudioSamples | DemoMicroCardGame/CocosStudioResources/cocosstudio/LevelSelection.csd | [
"MIT"
] |
#!/bin/sh
# Copyright 2020 gRPC 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 -e
buildfile=BUILD
yamlfile=build_handwritten.yaml
status=0
check_key () {
key=$1
build=$(grep "^$key =" < $buildfile | awk -F\" '{print $2}')
yaml=$(grep "^ *${key}:" < $yamlfile | head -1 | awk '{print $2}')
if [ x"$build" = x ] ; then
echo "$key not defined in $buildfile"
status=1
fi
if [ x"$yaml" = x ] ; then
echo "$key not defined in $yamlfile"
status=1
fi
if [ x"$build" != x"$yaml" ] ; then
echo "$key mismatch between $buildfile ($build) and $yamlfile ($yaml)"
status=1
fi
}
check_key core_version
check_key version
exit $status
| Shell | 4 | arghyadip01/grpc | tools/run_tests/sanity/check_version.sh | [
"Apache-2.0"
] |
package org.xtendroid.db
import java.util.ArrayList
import java.util.Collection
import java.util.List
import java.util.Map
/**
* An List that lazily loads items from a query and loads a batch of beans
* at-a-time. This is ideal for an Adapter that can scroll through an infinite list
* of items from the database, without running out of memory. Multi-threading is also
* handled, so that queries are not performed on the UI thread, even if called from the
* UI Thread.
*/
class LazyList<T> implements List<T> {
// How many items to load in each batch fetch
val static int BATCH_SIZE = 100
val String sql
val Map<String, ? extends Object> values
val BaseDbService db
val Class<T> bean
// buffer to hold window of retrieved data
val List<T> buffer
var private int size
var int head = 0
var int tail = 0
new(String sql, Map<String, ? extends Object> values, BaseDbService db, Class<T> bean) {
this.sql = sql
this.values = values
this.db = db
this.bean = bean
buffer = new ArrayList<T>(BATCH_SIZE)
// get the size of the data
var t = new Thread [|
var res = db.executeForMap("select count(*) as cnt from " + sql, values)
size = Integer.parseInt(res.get("cnt") as String)
]
t.start
t.join
}
override size() {
size
}
override isEmpty() {
size > 0
}
/**
* NOTE: work in progress, no optimizations yet
*/
override get(int idx) {
if (idx < 0) throw new ArrayIndexOutOfBoundsException('''Index «idx», Size «size»''')
if (idx >= size) throw new ArrayIndexOutOfBoundsException('''Index «idx», Size «size»''')
if (idx < head || idx >= tail) {
head = idx - (BATCH_SIZE/2)
if (head < 0) head = 0
tail = idx + (BATCH_SIZE/2)
loadBatch
}
if (head <= idx && idx <= tail) {
// we have the data in our buffer
return buffer.get(idx - head)
}
}
def void loadBatch() {
var t = new Thread [|
// load the batch we need
//Log.d("lazylist", "Fetching " + " limit " + head + "," + (tail - head))
db.executeForBeanList(
"select * from " + sql + " limit " + head + "," + (tail - head),
values, bean, buffer)
]
t.start
t.join
}
/* ------- The following methods are unsupported ------------ */
override add(T arg0) {
throw new UnsupportedOperationException("Operation not supported for LazyList")
}
override add(int arg0, T arg1) {
throw new UnsupportedOperationException("Operation not supported for LazyList")
}
override addAll(Collection<? extends T> arg0) {
throw new UnsupportedOperationException("Operation not supported for LazyList")
}
override addAll(int arg0, Collection<? extends T> arg1) {
throw new UnsupportedOperationException("Operation not supported for LazyList")
}
override clear() {
throw new UnsupportedOperationException("Operation not supported for LazyList")
}
override contains(Object arg0) {
throw new UnsupportedOperationException("Operation not supported for LazyList")
}
override containsAll(Collection<?> arg0) {
throw new UnsupportedOperationException("Operation not supported for LazyList")
}
override indexOf(Object arg0) {
throw new UnsupportedOperationException("Operation not supported for LazyList")
}
override iterator() {
throw new UnsupportedOperationException("Operation not supported for LazyList")
}
override lastIndexOf(Object arg0) {
throw new UnsupportedOperationException("Operation not supported for LazyList")
}
override listIterator() {
throw new UnsupportedOperationException("Operation not supported for LazyList")
}
override listIterator(int arg0) {
throw new UnsupportedOperationException("Operation not supported for LazyList")
}
override remove(int arg0) {
throw new UnsupportedOperationException("Operation not supported for LazyList")
}
override remove(Object arg0) {
throw new UnsupportedOperationException("Operation not supported for LazyList")
}
override removeAll(Collection<?> arg0) {
throw new UnsupportedOperationException("Operation not supported for LazyList")
}
override retainAll(Collection<?> arg0) {
throw new UnsupportedOperationException("Operation not supported for LazyList")
}
override set(int arg0, T arg1) {
throw new UnsupportedOperationException("Operation not supported for LazyList")
}
override subList(int arg0, int arg1) {
throw new UnsupportedOperationException("Operation not supported for LazyList")
}
override toArray() {
throw new UnsupportedOperationException("Operation not supported for LazyList")
}
override <T> toArray(T[] arg0) {
throw new UnsupportedOperationException("Operation not supported for LazyList")
}
} | Xtend | 5 | Buggaboo/Xtendroid | Xtendroid/src/org/xtendroid/db/LazyList.xtend | [
"MIT"
] |
/*
** Case Study Financial Econometrics 4.3
**
** Purpose:
** Compute bipower variation and realized variance
**
** Date:
** 16/01/2015
**
** Author:
** Tamer Dilaver, Koen de Man & Sina Zolnoor
**
** Supervisor:
** L.H. Hoogerheide & S.J. Koopman
**
*/
#include <oxstd.h>
#include <oxfloat.h>
/*
** Function: Compute bipower variation
**
** Input: mReturns: Matrix with returns
**
** Output: vBV: Vector with bipower variations, computed for each column (=day)
*/
fComputeBipowerVariation(const mReturns){
decl dMu, mRhelp, iNumberOfDays, iRows;
dMu = sqrt(2/M_PI);
iNumberOfDays = columns(mReturns);
iRows = rows(mReturns);
mRhelp = zeros(iRows,iNumberOfDays);
vBV= zeros(iNumberOfDays);
decl i, j;
for(i=0; i<columns(mReturns); i++){
for (j=1; j<rows(mReturns); j++){
mRhelp[j][i] = fabs(mReturns[j-1][i]) * fabs(mReturns[j][i]);
}
}
decl vBV;
vBV = sumc(mRhelp[1:][])/dMu^2;
return vBV;
}
main(){
decl mFiveMinuteReturns;
mFiveMinuteReturns = loadmat("FiveMinuteReturns_All.csv");
mFiveMinuteReturns = 100 * mFiveMinuteReturns;
decl vRV; //realized variance
vRV = sumsqrc(mFiveMinuteReturns); //compute RV
decl mDataCloseToClose;
mDataCloseToClose = loadmat("ReturnsCloseToClose.csv");
decl vDate, vYear, vMonth, vDay;
vDate = mDataCloseToClose[][0];
vYear = floor(vDate/10000); //compute year from vDate
vMonth = floor((vDate-floor(vDate/10000)*10000)/100); //compute month from vDate
vDay = vDate-floor(vDate/100)*100; //compute day from vDate
vDate = dayofcalendar(vYear, vMonth, vDay); //date that Ox understands
decl vBV; //bipower variation
vBV = fComputeBipowerVariation(mFiveMinuteReturns); //compute BV
} | Ox | 5 | tamerdilaver/Group4_Code_Data | 7ComputeRV&BV.ox | [
"MIT"
] |
--TEST--
Bug #35699 (date() can't handle leap years before 1970)
--FILE--
<?php
date_default_timezone_set("UTC");
echo date(DATE_ISO8601, strtotime('1964-06-06')), "\n";
echo date(DATE_ISO8601, strtotime('1963-06-06')), "\n";
echo date(DATE_ISO8601, strtotime('1964-01-06')), "\n";
?>
--EXPECT--
1964-06-06T00:00:00+0000
1963-06-06T00:00:00+0000
1964-01-06T00:00:00+0000
| PHP | 3 | guomoumou123/php5.5.10 | ext/date/tests/bug35699.phpt | [
"PHP-3.01"
] |
/// <reference path='fourslash.ts'/>
////function x1(x: 'hi');
////function x1(y: 'bye');
////function x1(z: string);
////function x1(a: any) {
////}
////
////x1(''/*1*/);
////x1('hi'/*2*/);
////x1('bye'/*3*/);
verify.signatureHelp(
{ marker: "1", overloadsCount: 3, parameterName: "z", parameterSpan: "z: string" },
{ marker: "2", overloadsCount: 3, parameterName: "x", parameterSpan: 'x: "hi"' },
{ marker: "3", overloadsCount: 3, parameterName: "y", parameterSpan: 'y: "bye"' },
);
| TypeScript | 4 | nilamjadhav/TypeScript | tests/cases/fourslash/signatureHelpOnOverloadOnConst.ts | [
"Apache-2.0"
] |
// run-pass
fn hrtb(f: impl for<'a> Fn(&'a u32) -> &'a u32) -> u32 {
f(&22) + f(&44)
}
fn main() {
let sum = hrtb(|x| x);
assert_eq!(sum, 22 + 44);
}
| Rust | 4 | Eric-Arellano/rust | src/test/ui/impl-trait/universal_hrtb_named.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
--TEST--
Unserializing payload with unrealistically large element counts
--FILE--
<?php
var_dump(unserialize("a:1000000000:{}"));
var_dump(unserialize("O:1000000000:\"\":0:{}"));
var_dump(unserialize("O:1:\"X\":1000000000:{}"));
var_dump(unserialize("C:1:\"X\":1000000000:{}"));
?>
--EXPECTF--
Notice: unserialize(): Error at offset 14 of 15 bytes in %s on line %d
bool(false)
Notice: unserialize(): Error at offset 2 of 20 bytes in %s on line %d
bool(false)
Notice: unserialize(): Error at offset 18 of 21 bytes in %s on line %d
bool(false)
Warning: Insufficient data for unserializing - 1000000000 required, 1 present in %s on line %d
Notice: unserialize(): Error at offset 20 of 21 bytes in %s on line %d
bool(false)
| PHP | 3 | thiagooak/php-src | ext/standard/tests/serialize/unserialize_large.phpt | [
"PHP-3.01"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.