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
sequencelengths
1
8
{-# LANGUAGE CPP, FlexibleContexts #-} module Graphics.UI.FLTK.LowLevel.X (flcOpenDisplay, flcXid, openCallback) where import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.Dispatch import Graphics.UI.FLTK.LowLevel.Utils import Foreign.Ptr #include "Fl_C.h" #include "xC.h" {# fun flc_open_display as flcOpenDisplay {} -> `()' #} {# fun flc_xid as flcXid' {`Ptr ()'} -> `Ptr ()' #} flcXid :: (Parent a WindowBase) => Ref a -> IO (Maybe WindowHandle) flcXid win = withRef win ( \winPtr -> do res <- flcXid' winPtr if (res == nullPtr) then return Nothing else return (Just (WindowHandle res)) ) {# fun flc_open_callback as openCallback' { id `FunPtr OpenCallbackPrim' } -> `()' #} openCallback :: Maybe OpenCallback -> IO (Maybe (FunPtr OpenCallbackPrim)) openCallback Nothing = openCallback' nullFunPtr >> return Nothing openCallback (Just cb) = do ptr <- mkOpenCallbackPtr $ \cstr -> do txt <- cStringToText cstr cb txt openCallback' ptr return (Just ptr)
C2hs Haskell
4
mtolly/fltkhs
src/Graphics/UI/FLTK/LowLevel/X.chs
[ "MIT" ]
/* * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #include <openssl/core_dispatch.h> #include "prov/seeding.h" static OSSL_FUNC_get_entropy_fn *c_get_entropy = NULL; static OSSL_FUNC_cleanup_entropy_fn *c_cleanup_entropy = NULL; static OSSL_FUNC_get_nonce_fn *c_get_nonce = NULL; static OSSL_FUNC_cleanup_nonce_fn *c_cleanup_nonce = NULL; int ossl_prov_seeding_from_dispatch(const OSSL_DISPATCH *fns) { for (; fns->function_id != 0; fns++) { /* * We do not support the scenario of an application linked against * multiple versions of libcrypto (e.g. one static and one dynamic), but * sharing a single fips.so. We do a simple sanity check here. */ #define set_func(c, f) \ do { if (c == NULL) c = f; else if (c != f) return 0; } while (0) switch (fns->function_id) { case OSSL_FUNC_GET_ENTROPY: set_func(c_get_entropy, OSSL_FUNC_get_entropy(fns)); break; case OSSL_FUNC_CLEANUP_ENTROPY: set_func(c_cleanup_entropy, OSSL_FUNC_cleanup_entropy(fns)); break; case OSSL_FUNC_GET_NONCE: set_func(c_get_nonce, OSSL_FUNC_get_nonce(fns)); break; case OSSL_FUNC_CLEANUP_NONCE: set_func(c_cleanup_nonce, OSSL_FUNC_cleanup_nonce(fns)); break; } #undef set_func } return 1; } size_t ossl_prov_get_entropy(PROV_CTX *prov_ctx, unsigned char **pout, int entropy, size_t min_len, size_t max_len) { if (c_get_entropy == NULL) return 0; return c_get_entropy(ossl_prov_ctx_get0_handle(prov_ctx), pout, entropy, min_len, max_len); } void ossl_prov_cleanup_entropy(PROV_CTX *prov_ctx, unsigned char *buf, size_t len) { if (c_cleanup_entropy != NULL) c_cleanup_entropy(ossl_prov_ctx_get0_handle(prov_ctx), buf, len); } size_t ossl_prov_get_nonce(PROV_CTX *prov_ctx, unsigned char **pout, size_t min_len, size_t max_len, const void *salt, size_t salt_len) { if (c_get_nonce == NULL) return 0; return c_get_nonce(ossl_prov_ctx_get0_handle(prov_ctx), pout, min_len, max_len, salt, salt_len); } void ossl_prov_cleanup_nonce(PROV_CTX *prov_ctx, unsigned char *buf, size_t len) { if (c_cleanup_nonce != NULL) c_cleanup_nonce(ossl_prov_ctx_get0_handle(prov_ctx), buf, len); }
C
4
pmesnier/openssl
providers/common/provider_seeding.c
[ "Apache-2.0" ]
var qrt = (\dur:1); var eth = (\dur:1/2); SkoarTestRunner(( low: [ "_c) _d) _e) _f) _g) _a) _b)", [(note: 0), (note: 2), (note: 4), (note: 5), (note: 7), (note: 9), (note: 11)] ], high: [ "c) d) e) f) g) a) b)", [(note: 12), (note: 14), (note: 16), (note: 17), (note: 19), (note: 21), (note: 23)] ], flats_low: [ "_cb) _db) _eb) _fb) _gb) _ab) _bb ) _b )", [(note: -1), (note: 1), (note: 3), (note: 4), (note: 6), (note: 8), (note: 10), (note: 11)] ], flats_high: [ "cb) db) eb) fb) gb) ab) bb ) b )", [(note: 11), (note: 13), (note: 15), (note: 16), (note: 18), (note: 20), (note: 22), (note: 23)] ], sharps_low: [ "_c#) _d#) _e#) _f#) _g#) _a#) _b# ) _b )", [(note: 1), (note: 3), (note: 5), (note: 6), (note: 8), (note: 10), (note: 12), (note: 11)] ], sharps_high: [ "c#) d#) e#) f#) g#) a#) b#) b)", [(note: 13), (note: 15), (note: 17), (note: 18), (note: 20), (note: 22), (note: 24), (note: 23)] ], choards_basic: [ "C) D) E) F) G) A) B)", [ (note: [0,4,7]), (note: [2,6,9]), (note: [4,8,11]), (note: [5,9,12]), (note: [7,11,14]), (note: [9,13,16]), (note: [11,15,18])] ], choards_moar: [ "Cm) C7) Cm7) CM7) CmM7) Cdim) Csus2) Csus4M7) Caug) Caug6)", [ (note: [0, 3, 7]), (note: [0, 4, 7, 10]), (note: [0, 3, 7, 10]), (note: [0, 4, 7, 11]), (note: [0, 3, 7, 11]), (note: [0, 3, 6]), (note: [0, 2, 7]), (note: [0, 5, 7, 11]), // c f g b (note: [0, 4, 8]), (note: [0, 4, 8, 9]), ] ], ));
SuperCollider
3
sofakid/Skoarcery
SuperCollider/Testing/noaty.scd
[ "Artistic-2.0" ]
#include <cmath> #include <vector> #include "caffe/layers/swish_layer.hpp" #include "caffe/util/math_functions.hpp" namespace caffe { template <typename Dtype> void SwishLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) { NeuronLayer<Dtype>::LayerSetUp(bottom, top); sigmoid_bottom_vec_.clear(); sigmoid_bottom_vec_.push_back(sigmoid_input_.get()); sigmoid_top_vec_.clear(); sigmoid_top_vec_.push_back(sigmoid_output_.get()); sigmoid_layer_->SetUp(sigmoid_bottom_vec_, sigmoid_top_vec_); } template <typename Dtype> void SwishLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) { NeuronLayer<Dtype>::Reshape(bottom, top); sigmoid_input_->ReshapeLike(*bottom[0]); sigmoid_layer_->Reshape(sigmoid_bottom_vec_, sigmoid_top_vec_); } template <typename Dtype> void SwishLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) { const Dtype* bottom_data = bottom[0]->cpu_data(); Dtype* sigmoid_input_data = sigmoid_input_->mutable_cpu_data(); Dtype* top_data = top[0]->mutable_cpu_data(); const int count = bottom[0]->count(); Dtype beta = this->layer_param_.swish_param().beta(); caffe_copy(count, bottom_data, sigmoid_input_data); caffe_scal(count, beta, sigmoid_input_data); sigmoid_layer_->Forward(sigmoid_bottom_vec_, sigmoid_top_vec_); caffe_mul(count, bottom_data, sigmoid_output_->cpu_data(), top_data); } template <typename Dtype> void SwishLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top, const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) { if (propagate_down[0]) { const Dtype* top_data = top[0]->cpu_data(); const Dtype* top_diff = top[0]->cpu_diff(); const Dtype* sigmoid_output_data = sigmoid_output_->cpu_data(); Dtype* bottom_diff = bottom[0]->mutable_cpu_diff(); const int count = bottom[0]->count(); Dtype beta = this->layer_param_.swish_param().beta(); for (int i = 0; i < count; ++i) { const Dtype swish_x = top_data[i]; bottom_diff[i] = top_diff[i] * (beta * swish_x + sigmoid_output_data[i] * (1. - beta * swish_x)); } } } #ifdef CPU_ONLY STUB_GPU(SwishLayer); #endif INSTANTIATE_CLASS(SwishLayer); REGISTER_LAYER_CLASS(Swish); } // namespace caffe
C++
4
adriengb/caffe
src/caffe/layers/swish_layer.cpp
[ "Intel", "BSD-2-Clause" ]
// --------------------------------------------------------------------- // The Great Computer Language Shootout // http://shootout.alioth.debian.org/ // // Based on D language implementation by Dave Fladebo // // Contributed by Anthony Borla // --------------------------------------------------------------------- final class NBodySystem { constant PI = 3.141592653589793; constant SOLAR_MASS = 4 * PI * PI; constant DAYS_PER_YEAR = 365.24; static void create() { float px, py, pz; foreach(bodies, Body i) { px += i->vx * i->mass; py += i->vy * i->mass; pz += i->vz * i->mass; } bodies[0]->offsetMomentum(px, py, pz); } public void advance(float dt) { float dx, dy, dz, distance, mag; int idx, length = sizeof(bodies); foreach(bodies, Body i) { foreach(bodies[idx + 1 .. length], Body j) { dx = i->x - j->x; dy = i->y - j->y; dz = i->z - j->z; distance = sqrt(dx * dx + dy * dy + dz * dz); mag = dt / (distance * distance * distance); i->vx -= dx * j->mass * mag; i->vy -= dy * j->mass * mag; i->vz -= dz * j->mass * mag; j->vx += dx * i->mass * mag; j->vy += dy * i->mass * mag; j->vz += dz * i->mass * mag; } idx += 1; } foreach(bodies, Body i) { i->x += dt * i->vx; i->y += dt * i->vy; i->z += dt * i->vz; } } public float energy() { float dx, dy, dz, e, distance; int idx, length = sizeof(bodies); foreach(bodies, Body i) { e += 0.5 * i->mass * (i->vx * i->vx + i->vy * i->vy + i->vz * i->vz); foreach(bodies[idx + 1 .. length], Body j) { dx = i->x - j->x; dy = i->y - j->y; dz = i->z - j->z; distance = sqrt(dx * dx + dy * dy + dz * dz); e -= (i->mass * j->mass) / distance; } idx += 1; } return e; } private final class Body { static void create(float x, float y, float z, float vx, float vy, float vz, float mass) { this->x = x; this->y = y; this->z = z; this->vx = vx; this->vy = vy; this->vz = vz; this->mass = mass; } void offsetMomentum(float px, float py, float pz) { vx = -px / SOLAR_MASS; vy = -py / SOLAR_MASS; vz = -pz / SOLAR_MASS; } float x, y, z, vx, vy, vz, mass; } // sun jupiter saturn uranus neptune private array(Body) bodies = ({ Body(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SOLAR_MASS), Body(4.84143144246472090e+00, -1.16032004402742839e+00, -1.03622044471123109e-01, 1.66007664274403694e-03 * DAYS_PER_YEAR, 7.69901118419740425e-03 * DAYS_PER_YEAR, -6.90460016972063023e-05 * DAYS_PER_YEAR, 9.54791938424326609e-04 * SOLAR_MASS), Body(8.34336671824457987e+00, 4.12479856412430479e+00, -4.03523417114321381e-01, -2.76742510726862411e-03 * DAYS_PER_YEAR, 4.99852801234917238e-03 * DAYS_PER_YEAR, 2.30417297573763929e-05 * DAYS_PER_YEAR, 2.85885980666130812e-04 * SOLAR_MASS), Body(1.28943695621391310e+01, -1.51111514016986312e+01, -2.23307578892655734e-01, 2.96460137564761618e-03 * DAYS_PER_YEAR, 2.37847173959480950e-03 * DAYS_PER_YEAR, -2.96589568540237556e-05 * DAYS_PER_YEAR, 4.36624404335156298e-05 * SOLAR_MASS), Body(1.53796971148509165e+01, -2.59193146099879641e+01, 1.79258772950371181e-01, 2.68067772490389322e-03 * DAYS_PER_YEAR, 1.62824170038242295e-03 * DAYS_PER_YEAR, -9.51592254519715870e-05 * DAYS_PER_YEAR, 5.15138902046611451e-05 * SOLAR_MASS) }); } // -------------------------------- int main(int argc, array(string) argv) { int N = (int)argv[1]; NBodySystem nbs = NBodySystem(); write("%.9f\n", nbs->energy()); for(int i = 0; i < N; i++) nbs->advance(0.01); write("%.9f\n", nbs->energy()); return 0; }
Pike
5
kragen/shootout
bench/nbody/nbody.pike
[ "BSD-3-Clause" ]
# read /proc/*.kernel and report the state of the process stack # # TODO: [bug] without knowing our real pid, we can only use the contents of /proc # to try to work it out, which means, for example, if the computer is reset # while the process stack is deep, then we can report processes as still # "running" even though they're not # TODO: [nice] what other stuff should we display? size of *.user? number of open # files? return address? whether a trap function is in use? include "stdio.sl"; var showproc = func(pid) { var name = sprintf("/proc/%d.kernel", [pid]); var fd = open(name, O_READ); free(name); if (fd < 0) return 0; var sp; var ret; var cwdblk; var args_sz; var args_ptr; var args; var trapfunc; var fdtable = malloc(128); # this should match sys_exit_impl() from kernel/sys_proc.sl read(fd, &sp, 1); read(fd, &ret, 1); read(fd, &cwdblk, 1); read(fd, &args_sz, 1); args = malloc(args_sz); read(fd, &args_ptr, 1); read(fd, args, args_sz); read(fd, &trapfunc, 1); read(fd, fdtable, 128); close(fd); printf("%d ", [pid]); var args_off = args - args_ptr; var p = args; while (*p) { puts(*p + args_off); p++; if (*p) putchar(' '); }; putchar('\n'); free(args); free(fdtable); return 1; }; var pid = 0; while (1) { if (!showproc(pid)) break; pid++; };
Slash
4
jes/scamp-cpu
sys/ps.sl
[ "Unlicense" ]
declare module moduleB { interface IUseModuleA { a: moduleA.A; } }
TypeScript
3
nilamjadhav/TypeScript
tests/baselines/reference/project/declarationsExportNamespace/node/useModule.d.ts
[ "Apache-2.0" ]
/*--------------------------------------------------*/ /* SAS Programming for R Users - code for exercises */ /* Copyright 2016 SAS Institute Inc. */ /*--------------------------------------------------*/ /*SP4R07s08*/ /*Part A*/ proc iml; simulations = 1000; sampleSize = 30; min = 5; max = 10; call randseed(802); /*Part B*/ simulationNumber = 1:simulations; each = j(simulations,1,sampleSize); simulationNumber = repeat(simulationNumber,each)`; /*Part C*/ total = simulations*sampleSize; vec = randfun(total,"Uniform",min,max); /*Part D*/ create sp4r.simulation var {simulationNumber vec}; append; close sp4r.simulation; /*Part E*/ submit; ods select none; proc means data=sp4r.simulation; by simulationNumber; var vec; output out=sp4r.out mean=mean; run; ods select default; endsubmit; /*Part F*/ use sp4r.out; read all var {mean} into means; close sp4r.out; /*Part G*/ mean = mean(means); sd = std(means); call qntl(percentiles,means,{.025, .975}); out = mean//sd//percentiles; reset noname; print out[colname="Mu" rowname={"Mean","Standard Deviation","LCL","UCL"}]; quit;
SAS
4
snowdj/sas-prog-for-r-users
code/SP4R07s08.sas
[ "CC-BY-4.0" ]
-- Copyright (c) 2010 The Chromium Authors. All rights reserved. -- Use of this source code is governed by a BSD-style license that can be -- found in the LICENSE file. -- This script copies the HTML of a tab to a TextEdit document. tell application "Chromium" tell tab 1 of window 1 to view source repeat while (loading of tab 2 of window 1) end repeat tell tab 2 of window 1 to select all tell tab 2 of window 1 to copy selection end tell tell application "TextEdit" set text of document 1 to the clipboard end tell
AppleScript
2
zealoussnow/chromium
chrome/browser/ui/cocoa/applescript/examples/copy_html.applescript
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
;########################################################### ; Original by majkinetor ; http://www.autohotkey.com/board/topic/49214-ahk-ahk-l-forms-framework-08/ ; With parts and adjustments based on rbrtryn's ChooseColor function ; http://www.autohotkey.com/board/topic/91229-windows-color-picker-plus/ ;########################################################### Dlg_Color(ByRef Color, hGui := 0, ByRef Palette := "") { static StructSize := VarSetCapacity(ChooseColor, 9 * A_PtrSize, 0) static CustomSize := VarSetCapacity(Custom, 64, 0) clr := ColorBGR(Color) Loop, Parse, Palette, `,, %A_Space% NumPut(ColorBGR(A_LoopField), Custom, (A_Index - 1) * 4, "UInt") VarSetCapacity(ChooseColor, StructSize, 0) , NumPut(StructSize, ChooseColor, 0, "UInt") , NumPut(hGui, ChooseColor, A_PtrSize, "UPtr") , NumPut(clr, ChooseColor, 3 * A_PtrSize, "UInt") , NumPut(&Custom, ChooseColor, 4 * A_PtrSize, "UPtr") , NumPut(0x00000103, ChooseColor, 5 * A_PtrSize, "UInt") nRC := DllCall("comdlg32\ChooseColor", "UPtr", &ChooseColor, "UInt") ann := ErrorLevel oldFormat := A_FormatInteger SetFormat, Integer, Hex Palette := "" Loop, 16 Palette .= ColorRGB(NumGet(Custom, (A_Index - 1) * 4, "UInt")) "," If (ann != 0) || (nRC = 0) return false clr := NumGet(ChooseColor, 3 * A_PtrSize) Color := ColorRGB(clr) StringTrimLeft, Color, Color, 2 Loop, % 6-strlen(Color) Color := 0 Color Color := "0x" Color SetFormat, Integer, %oldFormat% return true } ColorBGR(Color) { return ((Color & 0xFF) << 16) + (Color & 0xFF00) + ((Color >> 16) & 0xFF) } ColorRGB(Color) { return (Color & 0xff00) + ((Color & 0xff0000) >> 16) + ((Color & 0xff) << 16) }
AutoHotkey
4
standardgalactic/PuloversMacroCreator
LIB/Dlg.ahk
[ "Unlicense" ]
#define MyArchitecture "x64" #define OutputSuffix "x64" #include "sakura-common.iss"
Inno Setup
1
saurabhacellere/sakura
installer/sakura-x64.iss
[ "Zlib" ]
define ($ip 10.100.0.2, $mac aa:aa:aa:aa:aa:aa) Idle -> tap :: KernelTap(10.100.0.1/24, DEVNAME vEth1) ; tap -> c :: Classifier(12/0806 20/0001, 12/0806 20/0002, 12/0800, -); //Answer to ARP requests c[0] -> ARPResponder( $ip $mac) -> tap ; //Discard ARP replies for now c[1] -> Discard; //Print IP packets c[2] -> Print("IP", -1) -> Discard; //Discard non-IP, non-ARP packets c[3] -> Discard;
Click
3
BorisPis/asplos22-nicmem-fastclick
conf/tutorial/tutorial-02.click
[ "BSD-3-Clause-Clear" ]
import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.core.MatOfKeyPoint; import org.opencv.features2d.Features2d; import org.opencv.highgui.HighGui; import org.opencv.imgcodecs.Imgcodecs; import org.opencv.xfeatures2d.SURF; class SURFDetection { public void run(String[] args) { String filename = args.length > 0 ? args[0] : "../data/box.png"; Mat src = Imgcodecs.imread(filename, Imgcodecs.IMREAD_GRAYSCALE); if (src.empty()) { System.err.println("Cannot read image: " + filename); System.exit(0); } //-- Step 1: Detect the keypoints using SURF Detector double hessianThreshold = 400; int nOctaves = 4, nOctaveLayers = 3; boolean extended = false, upright = false; SURF detector = SURF.create(hessianThreshold, nOctaves, nOctaveLayers, extended, upright); MatOfKeyPoint keypoints = new MatOfKeyPoint(); detector.detect(src, keypoints); //-- Draw keypoints Features2d.drawKeypoints(src, keypoints, src); //-- Show detected (drawn) keypoints HighGui.imshow("SURF Keypoints", src); HighGui.waitKey(0); System.exit(0); } } public class SURFDetectionDemo { public static void main(String[] args) { // Load the native OpenCV library System.loadLibrary(Core.NATIVE_LIBRARY_NAME); new SURFDetection().run(args); } }
Java
4
thisisgopalmandal/opencv
samples/java/tutorial_code/features2D/feature_detection/SURFDetectionDemo.java
[ "BSD-3-Clause" ]
# geo ip request if (obj.status == 750) { set req.url = regsub(req.url, "(/fastlycdn/esi/getcountry/.*)", "/fastlycdn/esi/getcountryaction/?country_code=") obj.response; return (restart); } # geo ip country code if (obj.status == 755) { set obj.status = 200; synthetic obj.response; return(deliver); } # formkey request if (obj.status == 760) { set obj.status = 200; synthetic obj.response; return (deliver); }
VCL
4
dimitar-ivanov-tryzens/fastly-magento
app/code/community/Fastly/CDN/etc/vcl_snippets/error.vcl
[ "BSD-3-Clause" ]
#!/usr/bin/env python # coding: utf-8 # Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # 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. # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny vocab first, and then a tiny model - so the outcome is truly tiny - # all files ~60KB. As compared to taking a full-size model, reducing to the minimum its layers and # emb dimensions, but keeping the full vocab + merges files, leading to ~3MB in total for all files. # The latter is done by `fsmt-make-super-tiny-model.py`. # # It will be used then as "stas/tiny-wmt19-en-ru" from pathlib import Path import json import tempfile from transformers import FSMTTokenizer, FSMTConfig, FSMTForConditionalGeneration from transformers.models.fsmt.tokenization_fsmt import VOCAB_FILES_NAMES mname_tiny = "tiny-wmt19-en-ru" # Build # borrowed from a test vocab = [ "l", "o", "w", "e", "r", "s", "t", "i", "d", "n", "w</w>", "r</w>", "t</w>", "lo", "low", "er</w>", "low</w>", "lowest</w>", "newer</w>", "wider</w>", "<unk>", ] vocab_tokens = dict(zip(vocab, range(len(vocab)))) merges = ["l o 123", "lo w 1456", "e r</w> 1789", ""] with tempfile.TemporaryDirectory() as tmpdirname: build_dir = Path(tmpdirname) src_vocab_file = build_dir / VOCAB_FILES_NAMES["src_vocab_file"] tgt_vocab_file = build_dir / VOCAB_FILES_NAMES["tgt_vocab_file"] merges_file = build_dir / VOCAB_FILES_NAMES["merges_file"] with open(src_vocab_file, "w") as fp: fp.write(json.dumps(vocab_tokens)) with open(tgt_vocab_file, "w") as fp: fp.write(json.dumps(vocab_tokens)) with open(merges_file, "w") as fp : fp.write("\n".join(merges)) tokenizer = FSMTTokenizer( langs=["en", "ru"], src_vocab_size = len(vocab), tgt_vocab_size = len(vocab), src_vocab_file=src_vocab_file, tgt_vocab_file=tgt_vocab_file, merges_file=merges_file, ) config = FSMTConfig( langs=['ru', 'en'], src_vocab_size=1000, tgt_vocab_size=1000, d_model=4, encoder_layers=1, decoder_layers=1, encoder_ffn_dim=4, decoder_ffn_dim=4, encoder_attention_heads=1, decoder_attention_heads=1, ) tiny_model = FSMTForConditionalGeneration(config) print(f"num of params {tiny_model.num_parameters()}") # Test batch = tokenizer(["Making tiny model"], return_tensors="pt") outputs = tiny_model(**batch) print("test output:", len(outputs.logits[0])) # Save tiny_model.half() # makes it smaller tiny_model.save_pretrained(mname_tiny) tokenizer.save_pretrained(mname_tiny) print(f"Generated {mname_tiny}") # Upload # transformers-cli upload tiny-wmt19-en-ru
Python
4
liminghao1630/transformers
scripts/fsmt/fsmt-make-super-tiny-model.py
[ "Apache-2.0" ]
insert into Users(id, name, creation_date, last_login_date, active, age, email, status) values(1, 'John', TO_DATE('01/01/2018', 'DD/MM/YYYY'), TO_DATE('01/01/2020', 'DD/MM/YYYY'), 1, 23, '[email protected]', 1); insert into Users(id, name, creation_date, last_login_date, active, age, email, status) values(2, 'Bob', TO_DATE('02/02/2019', 'DD/MM/YYYY'), TO_DATE('02/02/2020', 'DD/MM/YYYY'), 1, 56, '[email protected]', 1); insert into Users(id, name, creation_date, last_login_date, active, age, email, status) values(3, 'Cindy', TO_DATE('02/02/2019', 'DD/MM/YYYY'), TO_DATE('02/02/2020', 'DD/MM/YYYY'), 1, 18, '[email protected]', 0);
SQL
3
DBatOWL/tutorials
persistence-modules/spring-data-jpa-query-2/src/main/resources/insert_users.sql
[ "MIT" ]
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { Disposable, Event, EventEmitter, SourceControlActionButton, Uri, workspace } from 'vscode'; import * as nls from 'vscode-nls'; import { Repository, Operation } from './repository'; import { dispose } from './util'; import { Branch } from './api/git'; const localize = nls.loadMessageBundle(); interface ActionButtonState { readonly HEAD: Branch | undefined; readonly isSyncRunning: boolean; readonly repositoryHasNoChanges: boolean; } export class ActionButtonCommand { private _onDidChange = new EventEmitter<void>(); get onDidChange(): Event<void> { return this._onDidChange.event; } private _state: ActionButtonState; private get state() { return this._state; } private set state(state: ActionButtonState) { if (JSON.stringify(this._state) !== JSON.stringify(state)) { this._state = state; this._onDidChange.fire(); } } private disposables: Disposable[] = []; constructor(readonly repository: Repository) { this._state = { HEAD: undefined, isSyncRunning: false, repositoryHasNoChanges: false }; repository.onDidRunGitStatus(this.onDidRunGitStatus, this, this.disposables); repository.onDidChangeOperations(this.onDidChangeOperations, this, this.disposables); } get button(): SourceControlActionButton | undefined { if (!this.state.HEAD || !this.state.HEAD.name || !this.state.HEAD.commit) { return undefined; } const config = workspace.getConfiguration('git', Uri.file(this.repository.root)); const showActionButton = config.get<string>('showUnpublishedCommitsButton', 'whenEmpty'); const postCommitCommand = config.get<string>('postCommitCommand'); const noPostCommitCommand = postCommitCommand !== 'sync' && postCommitCommand !== 'push'; let actionButton: SourceControlActionButton | undefined; if (showActionButton === 'always' || (showActionButton === 'whenEmpty' && this.state.repositoryHasNoChanges && noPostCommitCommand)) { if (this.state.HEAD.upstream) { if (this.state.HEAD.ahead) { const config = workspace.getConfiguration('git', Uri.file(this.repository.root)); const rebaseWhenSync = config.get<string>('rebaseWhenSync'); const ahead = `${this.state.HEAD.ahead}$(arrow-up)`; const behind = this.state.HEAD.behind ? `${this.state.HEAD.behind}$(arrow-down) ` : ''; const icon = this.state.isSyncRunning ? '$(sync~spin)' : '$(sync)'; actionButton = { command: { command: this.state.isSyncRunning ? '' : rebaseWhenSync ? 'git.syncRebase' : 'git.sync', title: localize('scm button sync title', "{0} {1}{2}", icon, behind, ahead), tooltip: this.state.isSyncRunning ? localize('syncing changes', "Synchronizing Changes...") : this.repository.syncTooltip, arguments: [this.repository.sourceControl], }, description: localize('scm button sync description', "{0} Sync Changes {1}{2}", icon, behind, ahead) }; } } else { actionButton = { command: { command: this.state.isSyncRunning ? '' : 'git.publish', title: localize('scm button publish title', "$(cloud-upload) Publish Branch"), tooltip: this.state.isSyncRunning ? localize('scm button publish branch running', "Publishing Branch...") : localize('scm button publish branch', "Publish Branch"), arguments: [this.repository.sourceControl], } }; } } return actionButton; } private onDidChangeOperations(): void { const isSyncRunning = this.repository.operations.isRunning(Operation.Sync) || this.repository.operations.isRunning(Operation.Push) || this.repository.operations.isRunning(Operation.Pull); this.state = { ...this.state, isSyncRunning }; } private onDidRunGitStatus(): void { this.state = { ...this.state, HEAD: this.repository.HEAD, repositoryHasNoChanges: this.repository.indexGroup.resourceStates.length === 0 && this.repository.mergeGroup.resourceStates.length === 0 && this.repository.untrackedGroup.resourceStates.length === 0 && this.repository.workingTreeGroup.resourceStates.length === 0 }; } dispose(): void { this.disposables = dispose(this.disposables); } }
TypeScript
4
sbj42/vscode
extensions/git/src/actionButton.ts
[ "MIT" ]
Makefile.self: @:
Self
0
MusicalPatterns/performer
Makefile.self
[ "MIT" ]
library: make-dylan-app executable: make-dylan-app files: library template-constants make-dylan-app
Dylan
1
kryptine/opendylan
sources/app/make-dylan-app/make-dylan-app.lid
[ "BSD-2-Clause" ]
(:~ : Factorization and inlining. :) module namespace t="de/bottlecaps/railroad/xq/transform-ast.xq"; import module namespace r="de/bottlecaps/railroad/xq/eliminate-recursion.xq" at "eliminate-recursion.xq"; import module namespace n="de/bottlecaps/railroad/xq/normalize-ast.xq" at "normalize-ast.xq"; import module namespace b="de/bottlecaps/railroad/xq/ast-to-ebnf.xq" at "ast-to-ebnf.xq"; declare namespace g="http://www.w3.org/2001/03/XPath/grammar"; (:~ : The maximum number of alternatives, that is allowed in factorization. :) declare variable $t:alternative-limit := 64; (:~ : Check whether a production is trivial, i.e. its body is : a single string or empty. : : @param $p the production. : @param $productions the set of productions. : @param $string true, if single strings are considered trivial. : @param $empty true, if empty bodies are considered trivial. : @return true, if the production is trivial. :) declare function t:is-trivial($p as element(g:production), $productions as element(g:production)*, $string as xs:boolean, $empty as xs:boolean) as xs:boolean { empty($productions[@name eq $p/@name and not(. is $p)]) and (($string and count($p/*) eq 1 and exists($p/g:string)) or ($empty and count($p/*) eq 0)) }; (:~ : Rewrite a grammar, removing any trivial nonterminals. This involves : dropping trivial productions and replacing their references by their : respective bodies. : : @param $grammar the grammar to be rewritten. : @param $inline the string inlining option. : @param $remove the empty inlining option. : @return the grammar, rewritten. :) declare function t:remove-trivial-nonterminals($grammar as element(g:grammar), $inline as xs:boolean, $remove as xs:boolean) as element(g:grammar) { let $productions := $grammar/g:production return if (count($productions) < 2) then $grammar else let $rewrite := t:inline($grammar, $productions[t:is-trivial(., $productions, $inline, $remove)]) return if (empty($rewrite/g:production) or deep-equal($grammar, $rewrite)) then $grammar else t:remove-trivial-nonterminals($rewrite, $inline, $remove) }; (:~ : Apply factoring to grammar. : : @param $grammar the grammar. : @param $factoring the factoring options, i.e. "none", "left-only", "full-left", "right-only", "full-right" : "left-right", or "right-left". : @param $inline the string inlining option. : @param $keep the empty keeping option. : @return the transformed grammar. :) declare function t:factorize($grammar as element(g:grammar), $factoring as xs:string, $inline as xs:boolean, $keep as xs:boolean) as element(g:grammar) { let $remove := not($keep) let $g1 := if ($inline or $remove) then t:remove-trivial-nonterminals($grammar, $inline, $remove) else $grammar return if ($factoring = ("", "none")) then $g1 else let $g2 := n:normalize($g1) let $g3 := n:denormalize ( n:introduce-separators ( if ($factoring = "left-only") then t:left-factorize($g2) else if ($factoring = "right-only") then t:right-factorize($g2) else if ($factoring = "full-left") then t:left-factorize(t:right-factorize(t:left-factorize($g2))) else if ($factoring = "full-right") then t:right-factorize(t:left-factorize(t:right-factorize($g2))) else error(xs:QName("t:factorize"), concat("invalid argument: $factoring: ", $factoring)) ) ) return if (deep-equal($grammar, $g3)) then $grammar else t:factorize($g3, $factoring, $inline, $keep) }; (:~ : Apply transformations to grammar. : : @param $grammar the grammar. : @param $recursion-removal the removal options. : @param $factoring the factoring options. : @param $inline the string inlining option. : @param $keep the empty keeping option. : @return the transformed grammar. :) declare function t:transform($grammar as element(g:grammar), $recursion-removal as xs:string*, $factoring as xs:string, $inline as xs:boolean, $keep as xs:boolean) as element(g:grammar) { let $g1 := if (exists($recursion-removal)) then r:eliminate-recursion($grammar, $recursion-removal) else $grammar let $g2 := t:factorize($g1, $factoring, $inline, $keep) return if (empty($recursion-removal)) then $g2 else let $g3 := t:inline($g2, r:eliminated-recursion-with-single-reference($grammar, $g2, $recursion-removal)) return if ($factoring = ("", "none")) then $g3 else t:factorize($g3, $factoring, $inline, $keep) }; (:~ : Apply single-production right-factoring transformation to node $ast. : : @param $ast the grammar to be transformed. : @return the transformed grammar. :) declare function t:right-factorize($ast as node()) as node() { let $reversed := n:reverse($ast) let $right-factored := t:left-factorize($reversed) return if (deep-equal($reversed, $right-factored)) then $ast else n:reverse($right-factored) }; (:~ : Apply single-production left-factoring transformation to nodes $todo. : : @param $todo the nodes to be transformed. : @param $done the intermediate result, that was calculated in preceding : recursion levels of this tail-recursive transformation. : @return the transformed nodes. :) declare function t:left-factorize($todo as node()*, $done as node()*) as node()* { if (empty($todo)) then $done else if ($todo[1]/self::g:choice and count($todo[1]/*) gt $t:alternative-limit) then t:left-factorize($todo[position() gt 1], ($done, $todo[1])) else let $node := $todo[1] let $children := n:children($node) let $left-factor := if (not($node/self::g:choice)) then () else ( for $c in $children let $case := n:unwrap-sequence($c)[1] where some $d in $children[. << $c] satisfies deep-equal($case, n:unwrap-sequence($d)[1]) return $case )[1] let $left-factor-choice := if ($left-factor or not($node/self::g:choice)) then () else ( for $c in $children let $case := n:unwrap-sequence($c)[1] where $case/self::g:choice and ( every $subcase in n:children($case) satisfies some $d in $children satisfies deep-equal($subcase, $d) ) return $case )[1] (: (: A | B+ D | (B+|) E | F => A | (B+|)B D | (B+|) E | F :) find prefix of: B+ use it to create this: (B+|) and verify prefix exists: (B+|) if so, replace B+ by (B+|)B do not flatten or the like, and have the left-factor rule catch it in the next step. :) let $left-factor-oom := if ($left-factor or $left-factor-choice or not($node/self::g:choice)) then () else ( for $c in $children let $oneOrMore := n:unwrap-sequence($c)[1] where $oneOrMore/self::g:oneOrMore return let $hs := n:children($oneOrMore) let $choice := element g:choice { $oneOrMore, n:wrap-sequence(()) } where some $d in $children satisfies deep-equal($choice, n:unwrap-sequence($d)[1]) return ($oneOrMore, n:wrap-sequence(($choice, $hs))) )[position() le 2] let $single-child := if (count($children) eq 1) then $children else () let $empty := $children/self::g:sequence[empty(n:children(.))] let $non-empty := $children[not(. is $empty)] return if (exists($left-factor)) then (: (A|B C|B D|E) => (A|B(C|D)|E):) let $choice := let $factored := for $c at $i in $children let $elements := n:unwrap-sequence($c) where deep-equal($left-factor, $elements[1]) return $i let $cases := ( $children[position() lt $factored[1]], n:wrap-sequence (( $left-factor, n:choice ( for $c at $i in $children[position() = $factored] return n:wrap-sequence(n:unwrap-sequence($c)[position() gt 1]) ) )), for $c at $i in $children where not($i = $factored) and $i gt $factored[1] return $c ) return n:choice($cases) return t:left-factorize(($choice, $todo[position() gt 1]), $done) else if (exists($left-factor-choice)) then (: (A|(B|C)D|B|C|E) => (A|(B|C)D|(B|C)|E) :) let $choice := let $factored := for $c at $i in $children where some $d in n:children($left-factor-choice) satisfies deep-equal($d, $c) return $i let $cases := ( $children[position() lt $factored[1]], $left-factor-choice, $children[not(position() = $factored) and position() gt $factored[1]] ) return element g:choice {$cases} (: no flattening here :) return t:left-factorize(($choice, $todo[position() gt 1]), $done) else if (exists($left-factor-oom)) then let $choice := element g:choice (: no flattening here :) { for $c at $i in $children let $elements := n:unwrap-sequence($c) return if (deep-equal($left-factor-oom[1], $elements[1])) then n:wrap-sequence((n:unwrap-sequence($left-factor-oom[2]), $elements[position() gt 1])) else $c } return t:left-factorize(($choice, $todo[position() gt 1]), $done) else if (count($children) eq 2 and $node/self::g:choice and exists($empty) and n:is-sequence-item($node) and exists(n:unwrap-sequence($non-empty)) and deep-equal(n:unwrap-sequence($non-empty)[1], $todo[2])) then (: (A B|) A => A (B A|) :) t:left-factorize ( ( $todo[2], n:choice (( $empty[. << $non-empty], n:wrap-sequence (( n:unwrap-sequence($non-empty)[position() gt 1], $todo[2] )), $empty[. >> $non-empty] )), $todo[position() gt 2] ), $done ) else if ($node/self::g:oneOrMore and n:is-sequence-item($node) and exists($children) and deep-equal($children[1], $todo[2])) then (: (A B)+ A => A (B A)+ :) t:left-factorize ( ( $todo[2], element g:oneOrMore { $children[position() gt 1], $todo[2] }, $todo[position() gt 2] ), $done ) else if ($node/self::g:choice and $children[1]/self::g:oneOrMore and $children[2]/self::g:sequence[empty(n:children(.))] and n:is-sequence-item($node) and exists(n:children($children[1])) and deep-equal(n:children($children[1])[1], $todo[2])) then (: ((A B)+|) A => A ((B A)+|) :) t:left-factorize ( ( $todo[2], element g:choice { element g:oneOrMore { n:children($children[1])[position() gt 1], $todo[2] }, $children[2] }, $todo[position() gt 2] ), $done ) else if (empty($children)) then t:left-factorize($todo[position() gt 1], ($done, $node)) else t:left-factorize ( $todo[position() gt 1], ( $done, element {node-name($node)} { $node/@*, if (n:is-sequence-item($children)) then t:left-factorize($children, ()) else for $c in $children return n:wrap-sequence(t:left-factorize(n:unwrap-sequence($c), ())) } ) ) }; (:~ : Apply single-production left-factoring transformation to node $ast. : : @param $ast the grammar to be transformed. : @return the transformed grammar. :) declare function t:left-factorize($ast as node()) as node() { let $left-factored := t:left-factorize($ast, ()) return if (deep-equal($ast, $left-factored)) then $ast else t:left-factorize($left-factored) }; (:~ : Rewrite a grammar fragment, while inlining some nonterminal references. Drop : the inlined productions from the result. : : @param $nodes the grammar fragment. : @param $inline-nonterminals the set of nonterminal productions : that will be inlined to their reference context. : @return the rewritten grammar fragment. :) declare function t:inline($nodes as node()*, $inline-nonterminals as element(g:production)*) as node()* { for $node in $nodes return typeswitch ($node) case element(g:production) return if ($node/@name = $inline-nonterminals/@name) then () else element g:production { $node/@*, t:inline($node/node(), $inline-nonterminals) } case element(g:ref) return if ($node/@context or not($node/@name = $inline-nonterminals/@name)) then $node else let $definition := $inline-nonterminals[@name eq $node/@name] return t:inline(n:children($definition), $inline-nonterminals) case element() return let $children := n:children($node) let $replacement := if (empty($children)) then $node/node() else for $c in $children return if (n:is-sequence-item($c)) then t:inline($c, $inline-nonterminals) else n:wrap-sequence(t:inline(n:unwrap-sequence($c), $inline-nonterminals)) return if (exists($children) and empty($replacement) and ($node/self::g:zeroOrMore or $node/self::g:oneOrMore or $node/self::g:optional)) then () else element {node-name($node)} { $node/@*, $replacement } default return $node };
XQuery
5
bannmann/rr
src/main/resources/de/bottlecaps/railroad/xq/transform-ast.xq
[ "Apache-2.0" ]
--# -path=.:../estonian:../common:../abstract:../prelude resource SymbolicEst = Symbolic with (Symbol = SymbolEst), (Grammar = GrammarEst) ;
Grammatical Framework
3
daherb/gf-rgl
src/api/SymbolicEst.gf
[ "BSD-3-Clause" ]
#(set! null:counter3 (+ null:counter3 1))
LilyPond
1
HolgerPeters/lyp
spec/user_files/counter3.ly
[ "MIT" ]
# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 inherit cmake DESCRIPTION="SimCList is a high quality C (C++ embeddable) library for handling lists" HOMEPAGE="https://mij.oltrelinux.com/devel/simclist" COMMIT=6aef848d1743af66045a6f413cd3b8b1f1578c15 SRC_URI="https://github.com/mij/simclist/archive/${COMMIT}.tar.gz -> ${P}.tar.gz" S="${WORKDIR}"/${PN}-${COMMIT} LICENSE="BSD" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="debug doc dump hash threads" BDEPEND="doc? ( app-doc/doxygen )" CMAKE_IN_SOURCE_BUILD=1 src_prepare() { sed -i -e "/-O2/d" CMakeLists.txt || die cmake_src_prepare } src_configure() { local mycmakeargs=( -DSIMCLIST_DEBUG=$(usex debug) -DSIMCLIST_THREADING=$(usex threads) -DSIMCLIST_NO_DUMPRESTORE=$(usex dump) -DSIMCLIST_ALLOW_LOCATIONBASED_HASHES=$(usex hash) ) cmake_src_configure } src_compile(){ cmake_src_compile if use doc; then doxygen || die "doxygen failed" fi } src_install() { doheader simclist.h dolib.so libsimclist.so if use doc ; then dodoc -r doc/html/* fi }
Gentoo Ebuild
4
justxi/sci
dev-libs/simclist/simclist-1.6_p1.ebuild
[ "BSD-3-Clause" ]
(module (import "env" "bar" (func $bar (param i32) (result i32))) (func "foo1" (result i32) (local $x i32) (local.set $x (call $bar (i32.const 0))) (drop (call $bar (i32.const 1)) ) (local.get $x) ;; local2stack can help here ) )
WebAssembly
3
phated/binaryen
test/unit/input/stack_ir.wat
[ "Apache-2.0" ]
#If MOJO_VERSION_X #Error "Mojo version error" #Endif Function FixDataPath:String( path:String ) Local i:=path.Find( ":/" ) If i<>-1 And path.Find("/")=i+1 Return path If path.StartsWith("./") Or path.StartsWith("/") Return path Return "monkey://data/"+path End
Monkey
4
Regal-Internet-Brothers/webcc-monkey
webcc.data/modules/mojo/data.monkey
[ "Zlib" ]
<?xml version="1.0" encoding="UTF-8"?> <!-- ******************************************************************* --> <!-- --> <!-- (c) Copyright IBM Corp. 2010, 2013 --> <!-- --> <!-- 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. --> <!-- --> <!-- ******************************************************************* --> <faces-config> <faces-config-extension> <namespace-uri>http://www.ibm.com/xsp/coreex</namespace-uri> <default-prefix>xe</default-prefix> <designer-extension> <control-subpackage-name>listview</control-subpackage-name> </designer-extension> </faces-config-extension> <group> <group-type>com.ibm.xsp.extlib.group.listview.jsId</group-type> <property> <!-- reuse the descr/display-name from dwa-calendar --> <description>%/com.ibm.xsp.extlib.group.calendar.jsId/jsId/descr%</description> <display-name>%/com.ibm.xsp.extlib.group.calendar.jsId/jsId/name%</display-name> <property-name>jsId</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>basics</category> <!-- Note, we should probably document for the users: the jsId is not clientId namespaced, so if you include 2 calendarStores with the same jsId on the same page, it won't work. --> <!-- This is declaring a jsId (not referencing an existing jsId that's declared elsewhere) --> <!-- Should maybe have need some kind of editor. Not sure such editors have been provided by the Designer team - maybe ask them to build editor extensions. --> <!-- This is not a control reference, it is a declaration of a JavaScript variable --> <!-- This is not a server requestScope variable name, it's a client-side browser variable name.--> <tags> not-control-id-reference not-server-variable-name </tags> </designer-extension> </property-extension> </property> <group-extension> <designer-extension> <tags>group-in-control</tags> </designer-extension> </group-extension> </group> <!-- View Grid --> <component> <description>A control that displays a iNotes list view</description> <display-name>iNotes List View</display-name> <component-type>com.ibm.xsp.extlib.listview.ListView</component-type> <component-class>com.ibm.xsp.extlib.component.listview.UIListView</component-class> <group-type-ref>com.ibm.xsp.group.core.prop.style</group-type-ref> <group-type-ref>com.ibm.xsp.group.core.prop.styleClass</group-type-ref> <group-type-ref>com.ibm.xsp.extlib.group.listview.jsId</group-type-ref> <property> <description>A reference to the ID of a data store control, like the Notes List View Store control</description> <display-name>Data Store ID</display-name> <property-name>storeComponentId</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>basics</category> <editor>com.ibm.xsp.extlib.designer.tooling.editor.XPageControlIDEditor</editor> <editor-parameter> http://www.ibm.com/xsp/coreex|notesListViewStore </editor-parameter> <!-- TODO should this property be marked as required? or is there some control nesting / children arrangement so that the connection is implicit? --> <tags> todo </tags> </designer-extension> </property-extension> </property> <property> <description>A reference to the ID of a control that handles the appearance and design of the view, like the Notes List View Design control</description> <display-name>Design Control ID</display-name> <property-name>structureComponentId</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>basics</category> <!-- TODO should this property be marked as required? or is there some control nesting / children arrangement so that the connection is implicit? --> <tags> todo </tags> <editor>com.ibm.xsp.extlib.designer.tooling.editor.XPageControlIDEditor</editor> <editor-parameter> http://www.ibm.com/xsp/coreex|notesListViewDesign </editor-parameter> </designer-extension> </property-extension> </property> <property> <description>Allow the view to be shown in narrow screen mode when it detects that the screen is not wide enough to show all the columns</description> <display-name>Allow Narrow Mode</display-name> <property-name>canBeNarrowMode</property-name> <property-class>boolean</property-class> <property-extension> <designer-extension> <category>format</category> <!-- TODO this defaults to true in listView.js, but defaults to false in UIListView.isCanBeNarrowMode and in the renderer, so it is not possible to change this setting. --> <!-- Update 2012-06-14, see the internal IBM iNotes docs: https://csnext.ibm.com:8000/jazz/web/projects/iNotes%20Dojo%20Widgets#action=com.ibm.team.scm.browseElement&workspaceItemId=_cLvicCmsEeC7FK4OQ6QADA&componentItemId=_6mQ1wCicEeCnmI4HqB8aSQ&path=%2Fdocs%2Fhomepage%2FlistView%2Fdoc%2FListView.html --> <tags> todo </tags> </designer-extension> </property-extension> </property> <property> <description>Whether to hide the column header area, containing the column titles</description> <display-name>Hide Column Headers</display-name> <property-name>hideColumns</property-name> <property-class>boolean</property-class> <property-extension> <designer-extension> <category>format</category> </designer-extension> </property-extension> </property> <property> <description>Enable use of two different colors for odd and even rows, which can make wide lists easier to read.</description> <display-name>Color Alternate Rows</display-name> <property-name>alternateRows</property-name> <property-class>boolean</property-class> <property-extension> <designer-extension> <category>format</category> <!-- TODO how do you configure the color for the alternate rows? there are localization impacts for colors, so generally it can't just be hard-coded in the control (different countries attach different meaning to different colors). That said, the OneUI people attempt to assign colors in a manner to not antagonize people so maybe this iNotes control has been similarly carefully designed?. Also, where-ever it is assignable, it should be assignable as a syle/styleClass rather than as a color-only property. --> <tags> todo </tags> </designer-extension> </property-extension> </property> <property> <description>Specifies whether to display the column name when the columnTitle property has no value</description> <display-name>Show Column Name When Column Title Is Empty</display-name> <property-name>showColumnNameForEmptyTitle</property-name> <property-class>boolean</property-class> <property-extension> <designer-extension> <category>format</category> </designer-extension> </property-extension> </property> <property> <description>Action handler when an entry is going to be created</description> <display-name>New Entry Action</display-name> <property-name>onNewEntry</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>events</category> <event>true</event> <subcategory>container-event</subcategory> <!-- TODO same points about xe:calendarView events propertys apply to these event properties, Need to ensure they work with the xp:eventHandler. When using All Properties view instead of eventHandler, generated function name should be clientId based, to allow for multiple list views on the same page. Description isn't especially useful. --> <!-- Q: how is a new entry triggered? A: by double-clicking on an empty timeslot --> <!-- TODO for this description and the next few, is this event responsible for creating the entry, or is it just a place to put code before the entry is created. If it is responsible for creating the enttry, then there should be an in-built simple action that can be dropped in here, to create the entry easily (not sure whether should be a client-side or server-side simple action). Similar applies for the next few actions - do they need to do the action, and if so, there should probably be a simple action. --> <!-- TODO Designer support has issues - xp v xe and eventHandler support --> <tags> todo </tags> </designer-extension> </property-extension> </property> <property> <description>Action handler when an entry is going to be opened</description> <display-name>Open Entry Action</display-name> <property-name>onOpenEntry</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>events</category> <event>true</event> <subcategory>container-event</subcategory> </designer-extension> </property-extension> </property> <property> <description>Action handler when an entry is selected</description> <display-name>Select Entry Action</display-name> <property-name>onSelectEntry</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>events</category> <event>true</event> <subcategory>container-event</subcategory> </designer-extension> </property-extension> </property> <property> <description>Action handler when an entry is going to be deleted</description> <display-name>Delete Entry Action</display-name> <property-name>onDeleteEntry</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>events</category> <event>true</event> <subcategory>container-event</subcategory> </designer-extension> </property-extension> </property> <property> <description>Action handler when context menu needs to be launched</description> <display-name>Handle Context Menu</display-name> <property-name>onContextMenu</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>events</category> <event>true</event> <subcategory>container-event</subcategory> </designer-extension> </property-extension> </property> <property> <description>Action handler when the list will be re-sorted, for example, when the user clicks on the column header of a sortable column</description> <display-name>Sort Changed Action</display-name> <property-name>onSortChanged</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>events</category> <event>true</event> <subcategory>container-event</subcategory> </designer-extension> </property-extension> </property> <property> <description>Action handler when a cell is clicked</description> <display-name>Cell Click Script</display-name> <property-name>onCellClick</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>events</category> <event>true</event> <subcategory>container-event</subcategory> <!-- TODO what's the difference between the onCellClick action and the onSelectEntry action in how you trigger them. --> <!-- TODO for accessibility this click action should also be possible to do with a keyboard --> <tags> todo </tags> </designer-extension> </property-extension> </property> <property> <description>Action handler when a cell is double-clicked</description> <display-name>Cell Double-Click Script</display-name> <property-name>onCellDblClick</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>events</category> <event>true</event> <subcategory>container-event</subcategory> <!-- TODO for accessibility this click action should also be possible to do with a keyboard --> <!-- TODO what's the difference between the onCellDblClick action and the onOpenEntry action in how you trigger them. --> <!-- TODO for accessibility this click action should also be possible to do with a keyboard, and should be different to the keyboard combination for onCellClick. --> <tags> todo </tags> </designer-extension> </property-extension> </property> <component-extension> <base-component-type>javax.faces.Component</base-component-type> <component-family>com.ibm.xsp.extlib.listview.ListView</component-family> <renderer-type>com.ibm.xsp.extlib.listview.ListView</renderer-type> <tag-name>listView</tag-name> <designer-extension> <in-palette>true</in-palette> <category>iNotes</category> <!-- Note, the component-class, component-family etc include ".dwa.", but that is the old name for the iNotes product. It would be best of those were renamed, but they cannot be renamed as that would break applications that were created using the 8.5.3UpgradePack1 release. --> <!-- Note, the description and category mention iNotes, but this control doesn't need iNotes on the server to work. --> <!-- Note, the description does not explain what the list view control looks like, or what kind of data it displays (lists of multi-column values), and is not helpful. Working on the assumption that people will have to copy from an example to get this to work, as the inter-connection of 3 separate controls is complicated, and the explanation of how to connect it to a Notes view is not easy.--> <!-- TODO MWD Investigate ListView widget within iNotes itself --> <tags> todo </tags> </designer-extension> </component-extension> </component> <!-- Data Store --> <component> <description>Data store for Notes list view</description> <display-name>Notes List View Store</display-name> <component-type>com.ibm.xsp.extlib.listview.NotesListViewStore</component-type> <component-class>com.ibm.xsp.extlib.component.listview.UINotesListViewStore</component-class> <group-type-ref>com.ibm.xsp.extlib.group.listview.jsId</group-type-ref> <property> <description>The Domino database containing the Domino view. This value can include the server name or replica ID. If not specified then the current database is assumed.</description> <display-name>Database Name</display-name> <property-name>databaseName</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>basics</category> <!-- Not sure if this the same as the xe:dominoView databaseName - allowing server prefixes etc, could maybe reuse a common property group or description --> </designer-extension> </property-extension> </property> <property> <description>The Domino view that will provide content to display in the List View control</description> <display-name>View Name</display-name> <property-name>viewName</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>basics</category> <!-- Note, not sure if this can be a folder name also. --> <!-- It might be preferable if the description could have an explanation of any required column names, etc, but really an entire document would be needed describing everything - there's a lot of information, so not attempting to include it all in the description tooltip. --> </designer-extension> </property-extension> </property> <component-extension> <base-component-type>javax.faces.Component</base-component-type> <component-family>com.ibm.xsp.extlib.listview.ListViewStore</component-family> <renderer-type>com.ibm.xsp.extlib.listview.NotesListViewStore</renderer-type> <tag-name>notesListViewStore</tag-name> <designer-extension> <in-palette>true</in-palette> <category>iNotes</category> <!-- The description is not especially useful, but an entire document would be needed to explain this, so not getting into it in the description --> </designer-extension> </component-extension> </component> <component> <description>Defines the design of columns shown in the list view. The columns shown should be a subset of the data columns retrieved from the server by the data store. The design may also be provided by List View Column controls in the List View control, instead of using this design control.</description> <display-name>Notes List View Design</display-name> <component-type>com.ibm.xsp.extlib.listview.NotesListViewDesign</component-type> <component-class>com.ibm.xsp.extlib.component.listview.UINotesListViewDesign</component-class> <group-type-ref>com.ibm.xsp.extlib.group.listview.jsId</group-type-ref> <property> <description>The Domino database containing the Domino view. This value can include the server name or replica ID. If not specified then the current database is assumed.</description> <display-name>Database Name</display-name> <property-name>databaseName</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>basics</category> </designer-extension> </property-extension> </property> <property> <description>The Domino view that will provide content to display in the List View control</description> <display-name>View Name</display-name> <property-name>viewName</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <!-- Note, not sure if this can be a folder name also. --> <!-- It might be preferable if the description could have an explanation of any required column names, etc, but really an entire document would be needed describing everything - there's a lot of information, so not attempting to include it all in the description tooltip. --> <category>basics</category> </designer-extension> </property-extension> </property> <component-extension> <base-component-type>javax.faces.Component</base-component-type> <component-family>com.ibm.xsp.extlib.listview.ListViewDesign</component-family> <renderer-type>com.ibm.xsp.extlib.listview.NotesListViewDesign</renderer-type> <tag-name>notesListViewDesign</tag-name> <designer-extension> <in-palette>true</in-palette> <category>iNotes</category> <!-- Note, this does not expect list view column children. They are used within the main xe:listView tag. This control takes the databaseName and viewName, same as the data store --> <!-- TODO the XPagesExt.nsf does not have any examples using xe:notesListViewDesign --> <!-- This internal IBM doc has some info on it: https://csnext.ibm.com:8000/jazz/web/projects/iNotes%20Dojo%20Widgets#action=com.ibm.team.scm.browseElement&workspaceItemId=_cLvicCmsEeC7FK4OQ6QADA&componentItemId=_6mQ1wCicEeCnmI4HqB8aSQ&path=%2Fdocs%2Fhomepage%2FlistView%2Fdoc%2FListViewDataStore.html --> <!-- TODO this is useless, the whole point is that it's meant to allow you to display a subset of the metadata provided by the data store. But both this and the data store only accept databaseName/viewName as configuration - they don't allow custom URLs or inline computed results, so it's not really possible to use a different design from the data store's design. Or at least, the only way to do so would be to use a different design viewName, but in that case if you're building a whole view design element, then you might as well use that view design element for the data store. Really, in practice people will not use this design store, they will instead just use listViewColumn's nested under the listView to define the design. (Instead of reading the design from some URL on the server.) --> <tags> todo </tags> </designer-extension> </component-extension> </component> <!-- view column may better be isolated with dojo grid column, if possible --> <component> <description>Defines a column as part of the design and structure of the list view. This will refer to a column in the data source of the list view.</description> <display-name>List View Column</display-name> <component-type>com.ibm.xsp.extlib.listview.ListViewColumn</component-type> <component-class>com.ibm.xsp.extlib.component.listview.UIListViewColumn</component-class> <property> <description>The name of the column in the store data. If you set the value of the field to "_item", then your formatter will be called with the entire item from the store - instead of just one field value.</description> <display-name>Column Name</display-name> <property-name>columnName</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>basics</category> </designer-extension> </property-extension> </property> <property> <description>The column title displayed for this column. The view column name can be used instead if this property is not specified and the showColumnNameForEmptyTitle property is set to true.</description> <display-name>Column Title</display-name> <property-name>columnTitle</property-name> <property-class>java.lang.String</property-class> <property-extension> <localizable>true</localizable> <designer-extension> <category>basics</category> <!-- This is a column header label displayed at all times, not an accessibility title displayed as a tooltip. --> <tags> not-accessibility-title </tags> </designer-extension> </property-extension> </property> <property> <description>The width of the column</description> <display-name>Width</display-name> <property-name>width</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>format</category> <!-- TODO Why is there no style property which could handle the width and other props ??? --> <!-- TODO description should explain what the value should be - I'd guess like "10px", "20%" etc. also, there should be an editor with suggestions for what the values should be like. --> <editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor> <!-- Note, this allows either the string "auto" or an integer value (assumed to be em), or a value ending in px. The value should not contain em or %, as that gives a server-side NumberFormatException --> <!-- TODO there is an issue in ListViewRenderer, it is attempting to treat "30" as a chars number, and "30px" as a pixels number, but the "30px" is treated as a chars number, because the putBoolean only works if the boolean argument is true. --> <editor-parameter> auto 10 20 30 </editor-parameter> <tags> todo </tags> </designer-extension> </property-extension> </property> <property> <description>When the list view is wider than the width of all of the columns combined, by default the last column will be extended in width, so it takes up the remaining space. Set this column as expandable so it will take the extra width.</description> <display-name>Extendable</display-name> <property-name>extendable</property-name> <property-class>boolean</property-class> <property-extension> <designer-extension> <category>format</category> </designer-extension> </property-extension> </property> <property> <description>Indicates whether the column width is fixed, or whether can be resized by the user in the browser</description> <display-name>Fixed Width</display-name> <property-name>fixedWidth</property-name> <property-class>boolean</property-class> <property-extension> <designer-extension> <category>format</category> <!-- Note, by default column widths are resizable. --> </designer-extension> </property-extension> </property> <property> <description>Show gradient color on the cell</description> <display-name>Show Gradient</display-name> <property-name>showGradient</property-name> <property-class>boolean</property-class> <property-extension> <designer-extension> <category>format</category> <!-- TODO gradient would probably be fading from one color at the top to another color at the bottom, where do you specify those 2 colors? --> <!-- TODO this behavior is broken - maybe the CSS styles aren't in place? It instead shows a gray background for all cells in the column, and when you click on a row, the font text turns to white. --> <tags> todo </tags> </designer-extension> </property-extension> </property> <property> <description>Controls the visibility and formatting of this column when the control displayed in Narrow Display mode.</description> <display-name>Narrow Display</display-name> <property-name>narrowDisplay</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>format</category> <editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor> <editor-parameter> top wrap hide </editor-parameter> <!-- Maybe the description should give the 3 options with a textual explanation of each and a comment to the translator that the option text values are not translatable. --> <tags> todo </tags> </designer-extension> </property-extension> </property> <property> <description>The sequence number of this column when the control is in Narrow Display mode</description> <display-name>Narrow Display Sequence Number</display-name> <property-name>sequenceNumber</property-name> <property-class>int</property-class> <property-extension> <designer-extension> <category>format</category> <!-- TODO description should explain how the sequence works. --> <tags> todo </tags> </designer-extension> </property-extension> </property> <property> <description>Determine if the wrapped column starts directly beneath this column in Narrow Display Mode</description> <display-name>Narrow Display Begin Wrap Under This Column</display-name> <property-name>beginWrapUnder</property-name> <property-class>boolean</property-class> <property-extension> <designer-extension> <category>format</category> </designer-extension> </property-extension> </property> <property> <description>Show a twistie for this column when the current row has children, for example, when the row has response documents</description> <display-name>Show Twistie</display-name> <property-name>twistie</property-name> <property-class>boolean</property-class> <property-extension> <designer-extension> <category>format</category> </designer-extension> </property-extension> </property> <property> <description>Indicates that this is an empty response column, used to indent the current row because it is a response to a previous row. Default is false.</description> <display-name>Response Indent Column</display-name> <property-name>response</property-name> <property-class>boolean</property-class> <property-extension> <designer-extension> <category>format</category> </designer-extension> <!-- TODO I haven't managed to get a working example of this description is based on reading the .js files. --> <tags> todo </tags> </property-extension> </property> <property> <description>Enables re-sorting the view by clicking the column header</description> <display-name>Sort</display-name> <property-name>sort</property-name> <property-class>int</property-class> <property-extension> <designer-extension> <category>format</category> <editor>com.ibm.xsp.extlib.designer.tooling.editor.BitwiseFlagsEditor</editor> <editor-parameter> 0x0001:ascending 0x0002:descending </editor-parameter> </designer-extension> </property-extension> </property> <property> <description>Show as icon</description> <display-name>Icon</display-name> <property-name>icon</property-name> <property-class>boolean</property-class> <property-extension> <designer-extension> <category>format</category> <!-- when this flag is set, it assumes the content of the column in the row is either a) a snippet of HTML including an img tag, like: <img src="icon1.gif"/>, or b) the name of an image file in the mail nsf, like "sent.gif", where it will build up an image tag using ../../ in the URL, like: <img src="../../sent.gif"/> In the case of b), there is no icon alt text, which is bad accessibility. --> <!-- TODO this is not very usable - column values would need to be computed to include an <img> tag.--> <!-- TODO needs description --> <!-- 2012-06-27: Leaving the description vague until we have a recommended use pattern. --> <!-- TODO is the icon alt text output correctly - how does it know what the alt text should be? --> <tags> todo </tags> </designer-extension> </property-extension> </property> <component-extension> <component-family>com.ibm.xsp.extlib.listview.ListView</component-family> <renderer-type>com.ibm.xsp.extlib.listview.ListViewColumn</renderer-type> <tag-name>listViewColumn</tag-name> <designer-extension> <in-palette>true</in-palette> <category>iNotes</category> <!-- Note, this control would be nested in the listView control (used as an alternative to the notesListViewDesign control) --> <!-- TODO 2012-06-27 this control doesn't work in the example in XPagesExt.nsf/DWA_ListView.xsp These controls are not being used to determine how the control should appear, which columns should be shown or how the columns should be configured. It worked in the XPagesExtensionLibrary-853.201109131928NTF release. (Should check with Lisa whether this issue has been logged). --> <tags> todo no-faces-config-renderer </tags> </designer-extension> </component-extension> </component> </faces-config>
XPages
4
jesse-gallagher/XPagesExtensionLibrary
extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.domino/src/com/ibm/xsp/extlib/config/raw-dwa-listview.xsp-config
[ "Apache-2.0" ]
<pre style="font-family: monospace;"><code><div>jq -r <span>'.[]|[.index, .name, .section, .award, .industry]|join("\t")'</span> raw.json |pbcopy </div></code></pre>
HTML
2
asahiocean/joplin
packages/app-cli/tests/enex_to_md/code3.html
[ "MIT" ]
""" Harmonic mean Reference: https://en.wikipedia.org/wiki/Harmonic_mean Harmonic series Reference: https://en.wikipedia.org/wiki/Harmonic_series(mathematics) """ def is_harmonic_series(series: list) -> bool: """ checking whether the input series is arithmetic series or not >>> is_harmonic_series([ 1, 2/3, 1/2, 2/5, 1/3]) True >>> is_harmonic_series([ 1, 2/3, 2/5, 1/3]) False >>> is_harmonic_series([1, 2, 3]) False >>> is_harmonic_series([1/2, 1/3, 1/4]) True >>> is_harmonic_series([2/5, 2/10, 2/15, 2/20, 2/25]) True >>> is_harmonic_series(4) Traceback (most recent call last): ... ValueError: Input series is not valid, valid series - [1, 2/3, 2] >>> is_harmonic_series([]) Traceback (most recent call last): ... ValueError: Input list must be a non empty list >>> is_harmonic_series([0]) Traceback (most recent call last): ... ValueError: Input series cannot have 0 as an element >>> is_harmonic_series([1,2,0,6]) Traceback (most recent call last): ... ValueError: Input series cannot have 0 as an element """ if not isinstance(series, list): raise ValueError("Input series is not valid, valid series - [1, 2/3, 2]") if len(series) == 0: raise ValueError("Input list must be a non empty list") if len(series) == 1 and series[0] != 0: return True rec_series = [] series_len = len(series) for i in range(0, series_len): if series[i] == 0: raise ValueError("Input series cannot have 0 as an element") rec_series.append(1 / series[i]) common_diff = rec_series[1] - rec_series[0] for index in range(2, series_len): if rec_series[index] - rec_series[index - 1] != common_diff: return False return True def harmonic_mean(series: list) -> float: """ return the harmonic mean of series >>> harmonic_mean([1, 4, 4]) 2.0 >>> harmonic_mean([3, 6, 9, 12]) 5.759999999999999 >>> harmonic_mean(4) Traceback (most recent call last): ... ValueError: Input series is not valid, valid series - [2, 4, 6] >>> harmonic_mean([1, 2, 3]) 1.6363636363636365 >>> harmonic_mean([]) Traceback (most recent call last): ... ValueError: Input list must be a non empty list """ if not isinstance(series, list): raise ValueError("Input series is not valid, valid series - [2, 4, 6]") if len(series) == 0: raise ValueError("Input list must be a non empty list") answer = 0 for val in series: answer += 1 / val return len(series) / answer if __name__ == "__main__": import doctest doctest.testmod()
Python
5
NavpreetDevpuri/Python
maths/series/harmonic.py
[ "MIT" ]
{ "props": { "activeClass": "The **active-class** applied to children when they are activated.", "alignWithTitle": "Make `v-tabs` lined up with the toolbar title", "backgroundColor": "Changes the background color of the component.", "centered": "Centers the tabs", "centerActive": "Forces the selected tab to be centered", "cycle": "Will reset to first or last tab when swiping left or right if at the end of indexes", "dark": "Applies the dark theme variant to the component. You can find more information on the Material Design documentation for [dark themes](https://material.io/design/color/dark-theme.html).", "fixedTabs": "`v-tabs-item` min-width 160px, max-width 360px", "grow": "Force `v-tab`'s to take up all available space", "height": "Sets the height of the tabs bar", "hideSlider": "Hide's the generated `v-tabs-slider`", "iconsAndText": "Will stack icon and text vertically", "light": "Applies the light theme variant to the component.", "mobileBreakpoint": "Sets the designated mobile breakpoint for the component.", "optional": "Does not require an active item. Useful when using `v-tab` as a `router-link`", "prevIcon": "Left pagination icon", "nextIcon": "Right pagination icon", "reverseTransition": "The transition used when the component is reversing items. Can be one of the [built in transitions](/styles/transitions) or one your own.", "right": "Aligns tabs to the right", "showArrows": "Show pagination arrows if the tab items overflow their container. For mobile devices, arrows will only display when using this prop.", "sliderColor": "Changes the background color of an auto-generated `v-tabs-slider`", "sliderSize": "Changes the size of the slider, **height** for horizontal, **width** for vertical.", "touchless": "Disable mobile touch functionality", "transition": "Sets the component transition. Can be one of the [built in transitions](/styles/transitions) or one your own.", "vertical": "Stacks tabs on top of each other vertically." }, "events": { "change": "Emitted when tab is changed by user interaction. Returns a string if **href** attribute is set and number if it is not." } }
JSON
5
vanillamasonry/vuetify
packages/api-generator/src/locale/en/v-tabs.json
[ "MIT" ]
/* * Copyright © 2013-2017 Rinat Ibragimov * * This file is part of FreshPlayerPlugin. * * 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. */ // URI parsing automaton // TODO: handle IPv6 addresses in "host" field %%{ machine uri_parser; action fin_scheme { set_url_component(&components->scheme, s, mark.scheme, p); } action fin_username { end_username = p; } action fin_password { end_password = p; } action fin_host { set_url_component(&components->host, s, mark.host, p); } action fin_port { set_url_component(&components->port, s, mark.port, p); } action fin_path { set_url_component(&components->path, s, mark.path, p); } action fin_query { set_url_component(&components->query, s, mark.query, p); } action fin_fragment { set_url_component(&components->ref, s, mark.fragment, p); } action fin_userpass { if (mark.username) set_url_component(&components->username, s, mark.username, end_username); if (mark.password) set_url_component(&components->password, s, mark.password, end_password); } scheme = [^:/?#]+ >{mark.scheme = p;} %fin_scheme; username = [^/?#@:]+ >{mark.username = p; end_username = p;} %fin_username; password = [^/?#@]+ >{mark.password = p; end_password = p;} %fin_password; host = [^/?#@:]+ >{mark.host = p;} %fin_host; port = digit+ >{mark.port = p;} %fin_port; path = ([^?#]*) >{mark.path = p;} %fin_path; query = ([^#]*) >{mark.query = p;} %fin_query; fragment = (any*) >{mark.fragment = p;} %fin_fragment; scheme_c = scheme . ":"; userpass = (username . (":" . password)? . "@") %fin_userpass; authority = userpass? . host . (":" . port)?; slashslash_authority = "//" . authority?; qm_query = "?" . query; sharp_fragment = "#" . fragment; main := scheme_c? . slashslash_authority? . path . qm_query? . sharp_fragment?; }%% %%{ write data; write init; write exec; }%%
Ragel in Ruby Host
4
wyatt8740/freshplayerplugin
src/uri_parser/uri_parser_fsm.rl
[ "MIT" ]
<!DOCTYPE html> <html> <head> <title>Bookshelf: Command unknown</title> </head> <body> <p>Sorry, this command is not known!</p> </body> </html>
Java Server Pages
3
zeesh49/tutorials
patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/unknown.jsp
[ "MIT" ]
cp a:\IF_FOUND.txt d:\IF_FOUND.txt
AGS Script
0
waltersgrey/autoexechack
cam_info/autoexec.ash
[ "MIT" ]
--- layout: "layout.liquid" --- Content
Liquid
0
binyamin/eleventy
test/stubs-layout-cache/test.liquid
[ "MIT" ]
{-# LANGUAGE ForeignFunctionInterface #-} {-| Module : Hapstone.Internal.XCore Description : XCore architecture header ported using C2HS + some boilerplate Copyright : (c) Inokentiy Babushkin, 2016 License : BSD3 Maintainer : Inokentiy Babushkin <[email protected]> Stability : experimental This module contains XCore specific datatypes and their respective Storable instances. Most of the types are used internally and can be looked up here. Some of them are currently unused, as the headers only define them as symbolic constants whose type is never used explicitly, which poses a problem for a memory-safe port to the Haskell language, this is about to get fixed in a future version. Apart from that, because the module is generated using C2HS, some of the documentation is misplaced or rendered incorrectly, so if in doubt, read the source file. -} module Hapstone.Internal.XCore where #include <capstone/xcore.h> {#context lib = "capstone"#} import Foreign import Foreign.C.Types -- | operand type for instruction's operands {#enum xcore_op_type as XCoreOpType {underscoreToCase} deriving (Show, Eq, Bounded)#} -- | XCore registers {#enum xcore_reg as XCoreReg {underscoreToCase} deriving (Show, Eq, Bounded)#} -- | memory access operands -- associated with 'XcoreOpMem' operand type data XCoreOpMemStruct = XCoreOpMemStruct { base :: Word8 -- ^ base register , index :: Word8 -- ^ index register , disp :: Int32 -- ^ displacement/offset value , direct :: Int32 -- ^ +1: forward, -1: backward } deriving (Show, Eq) instance Storable XCoreOpMemStruct where sizeOf _ = {#sizeof xcore_op_mem#} alignment _ = {#alignof xcore_op_mem#} peek p = XCoreOpMemStruct <$> (fromIntegral <$> {#get xcore_op_mem->base#} p) <*> (fromIntegral <$> {#get xcore_op_mem->index#} p) <*> (fromIntegral <$> {#get xcore_op_mem->disp#} p) <*> (fromIntegral <$> {#get xcore_op_mem->direct#} p) poke p (XCoreOpMemStruct b i disp dir) = do {#set xcore_op_mem->base#} p (fromIntegral b) {#set xcore_op_mem->index#} p (fromIntegral i) {#set xcore_op_mem->disp#} p (fromIntegral disp) {#set xcore_op_mem->direct#} p (fromIntegral dir) -- | instruction operand data CsXCoreOp = Reg XCoreReg -- ^ register value for 'XcoreOpReg' operands | Imm Int32 -- ^ immediate value for 'XcoreOpImm' operands | Mem XCoreOpMemStruct -- ^ base/index/disp/direct value for 'XcoreOpMem' -- operands | Undefined -- ^ invalid operand value, for 'XcoreOpInvalid' operand deriving (Show, Eq) instance Storable CsXCoreOp where sizeOf _ = 16 alignment _ = 4 peek p = do t <- fromIntegral <$> {#get cs_xcore_op->type#} p let bP = plusPtr p 4 case toEnum t of XcoreOpReg -> (Reg . toEnum . fromIntegral) <$> (peek bP :: IO Int32) XcoreOpImm -> Imm <$> peek bP XcoreOpMem -> Mem <$> peek bP _ -> return Undefined poke p op = do let bP = plusPtr p 4 setType = {#set cs_xcore_op->type#} p . fromIntegral . fromEnum case op of Reg r -> do poke bP (fromIntegral $ fromEnum r :: Int32) setType XcoreOpReg Imm i -> poke bP i >> setType XcoreOpImm Mem m -> poke bP m >> setType XcoreOpMem _ -> setType XcoreOpInvalid -- | instruction datatype newtype CsXCore = CsXCore [CsXCoreOp] -- ^ operand list of this instruction, -- *MUST* have <= 8 operands, else you'll -- get a runtime error when you -- (implicitly) try to write it to memory -- via it's Storable instance deriving (Show, Eq) instance Storable CsXCore where sizeOf _ = 132 alignment _ = 4 peek p = do num <- fromIntegral <$> {#get cs_xcore->op_count#} p CsXCore <$> peekArray num (plusPtr p {#offsetof cs_xcore.operands#}) poke p (CsXCore o) = do {#set cs_xcore->op_count#} p (fromIntegral $ length o) if length o > 8 then error "operands overflew 8 elements" else pokeArray (plusPtr p {#offsetof cs_xcore->operands#}) o -- | XCore instructions {#enum xcore_insn as XCoreInsn {underscoreToCase} deriving (Show, Eq, Bounded)#} -- | XCore instruction groups {#enum xcore_insn_group as XCoreInsnGroup {underscoreToCase} deriving (Show, Eq, Bounded)#}
C2hs Haskell
4
gregsgit/hapstone
src/Hapstone/Internal/XCore.chs
[ "BSD-3-Clause" ]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <p>A <a href="http://shadowsocks.org">Shadowsocks</a> client for Android, written in Kotlin.</p> <p>Copyright (C) 2017 by Max Lv <a href="&#x6d;&#97;&#x69;&#108;&#116;&#111;&#x3a;&#x6d;&#97;x&#46;&#99;.&#108;&#118;&#x40;&#103;&#109;&#97;&#x69;&#108;&#46;&#x63;&#x6f;&#109;">&#x6d;&#97;&#x78;.&#x63;&#x2e;&#108;v&#64;&#x67;&#109;&#x61;&#x69;&#108;&#x2e;&#99;&#111;&#109;</a></p> <p>Copyright (C) 2017 by Mygod Studio <a href="mailto:[email protected]">[email protected]</a></p> <p>This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</p> <p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.</p> <p>You should have received a copy of the GNU General Public License along with this program. If not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.</p> <h3>Open Source Licenses</h3> <ul> <li>redsocks: <a href="https://github.com/shadowsocks/redsocks/blob/shadowsocks-android/README">APL 2.0</a>&nbsp;</li> <li>libevent: <a href="https://github.com/shadowsocks/libevent/blob/master/LICENSE">BSD</a>&nbsp;</li> <li>tun2socks: <a href="https://github.com/shadowsocks/badvpn/blob/shadowsocks-android/COPYING">BSD</a>&nbsp;</li> <li>shadowsocks-rust: <a href="https://github.com/shadowsocks/shadowsocks-rust/blob/master/LICENSE">MIT</a>&nbsp;</li> <li>libsodium: <a href="https://github.com/jedisct1/libsodium/blob/master/LICENSE">ISC</a>&nbsp;</li> <li>OpenSSL: <a href="https://www.openssl.org/source/license-openssl-ssleay.txt">OpenSSL License</a>&nbsp;</li> <li><a href="#other-licenses">Other licenses</a></li> </ul> </body> </html>
HTML
1
BitlikerAppFork/shadowsocks-android
mobile/src/main/res/raw/about.html
[ "ISC", "OpenSSL", "MIT" ]
types = require "moonscript.types" import build, ntype, NOOP from types import NameProxy from require "moonscript.transform.names" import insert from table -- is a body a single expression/statement is_singular = (body) -> return false if #body != 1 if "group" == ntype body is_singular body[2] else body[1] import transform_last_stm from require "moonscript.transform.statements" class Accumulator body_idx: { for: 4, while: 3, foreach: 4 } new: (accum_name) => @accum_name = NameProxy "accum" @value_name = NameProxy "value" @len_name = NameProxy "len" -- wraps node and mutates body convert: (node) => index = @body_idx[ntype node] node[index] = @mutate_body node[index] @wrap node -- wrap the node into a block_exp wrap: (node, group_type="block_exp") => build[group_type] { build.assign_one @accum_name, build.table! build.assign_one @len_name, 1 node group_type == "block_exp" and @accum_name or NOOP } -- mutates the body of a loop construct to save last value into accumulator mutate_body: (body) => -- shortcut to write simpler code if body is a single expression single_stm = is_singular body val = if single_stm and types.is_value single_stm body = {} single_stm else body = transform_last_stm body, (n) -> if types.is_value n build.assign_one @value_name, n else -- just ignore it build.group { {"declare", {@value_name}} n } @value_name update = { build.assign_one NameProxy.index(@accum_name, @len_name), val {"update", @len_name, "+=", 1} } insert body, build.group update body default_accumulator = (node) => Accumulator!\convert node { :Accumulator, :default_accumulator }
MoonScript
5
Shados/moonscript
moonscript/transform/accumulator.moon
[ "MIT", "Unlicense" ]
#!/bin/bash # # Deploy a jar, source jar, and javadoc jar to Sonatype's snapshot repo. # # Adapted from https://coderwall.com/p/9b_lfq and # http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/ set -e ./gradlew publish -PmavenCentralUsername="${SONATYPE_USERNAME}" -PmavenCentralPassword="${SONATYPE_PASSWORD}"
Shell
4
ansh2166/lottie-android
deploy_snapshot.sh
[ "Apache-2.0" ]
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding -- -- -- -- Terminal_Interface.Curses.Mouse -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 1998-2009,2014 Free Software Foundation, Inc. -- -- -- -- 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, distribute with modifications, 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 ABOVE 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. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: -- $Revision: 1.25 $ -- $Date: 2014/09/13 19:10:18 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; with Interfaces.C; use Interfaces.C; use Interfaces; package body Terminal_Interface.Curses.Mouse is use type System.Bit_Order; function Has_Mouse return Boolean is function Mouse_Avail return C_Int; pragma Import (C, Mouse_Avail, "has_mouse"); begin if Has_Key (Key_Mouse) or else Mouse_Avail /= 0 then return True; else return False; end if; end Has_Mouse; function Get_Mouse return Mouse_Event is type Event_Access is access all Mouse_Event; function Getmouse (Ev : Event_Access) return C_Int; pragma Import (C, Getmouse, "getmouse"); Event : aliased Mouse_Event; begin if Getmouse (Event'Access) = Curses_Err then raise Curses_Exception; end if; return Event; end Get_Mouse; procedure Register_Reportable_Event (Button : Mouse_Button; State : Button_State; Mask : in out Event_Mask) is Button_Nr : constant Natural := Mouse_Button'Pos (Button); State_Nr : constant Natural := Button_State'Pos (State); begin if Button in Modifier_Keys and then State /= Pressed then raise Curses_Exception; else if Button in Real_Buttons then Mask := Mask or ((2 ** (6 * Button_Nr)) ** State_Nr); else Mask := Mask or (BUTTON_CTRL ** (Button_Nr - 4)); end if; end if; end Register_Reportable_Event; procedure Register_Reportable_Events (Button : Mouse_Button; State : Button_States; Mask : in out Event_Mask) is begin for S in Button_States'Range loop if State (S) then Register_Reportable_Event (Button, S, Mask); end if; end loop; end Register_Reportable_Events; function Start_Mouse (Mask : Event_Mask := All_Events) return Event_Mask is function MMask (M : Event_Mask; O : access Event_Mask) return Event_Mask; pragma Import (C, MMask, "mousemask"); R : Event_Mask; Old : aliased Event_Mask; begin R := MMask (Mask, Old'Access); if R = No_Events then Beep; end if; return Old; end Start_Mouse; procedure End_Mouse (Mask : Event_Mask := No_Events) is begin if Mask /= No_Events then Beep; end if; end End_Mouse; procedure Dispatch_Event (Mask : Event_Mask; Button : out Mouse_Button; State : out Button_State); procedure Dispatch_Event (Mask : Event_Mask; Button : out Mouse_Button; State : out Button_State) is L : Event_Mask; begin Button := Alt; -- preset to non real button; if (Mask and BUTTON1_EVENTS) /= 0 then Button := Left; elsif (Mask and BUTTON2_EVENTS) /= 0 then Button := Middle; elsif (Mask and BUTTON3_EVENTS) /= 0 then Button := Right; elsif (Mask and BUTTON4_EVENTS) /= 0 then Button := Button4; end if; if Button in Real_Buttons then L := 2 ** (6 * Mouse_Button'Pos (Button)); for I in Button_State'Range loop if (Mask and L) /= 0 then State := I; exit; end if; L := 2 * L; end loop; else State := Pressed; if (Mask and BUTTON_CTRL) /= 0 then Button := Control; elsif (Mask and BUTTON_SHIFT) /= 0 then Button := Shift; elsif (Mask and BUTTON_ALT) /= 0 then Button := Alt; end if; end if; end Dispatch_Event; procedure Get_Event (Event : Mouse_Event; Y : out Line_Position; X : out Column_Position; Button : out Mouse_Button; State : out Button_State) is Mask : constant Event_Mask := Event.Bstate; begin X := Column_Position (Event.X); Y := Line_Position (Event.Y); Dispatch_Event (Mask, Button, State); end Get_Event; procedure Unget_Mouse (Event : Mouse_Event) is function Ungetmouse (Ev : Mouse_Event) return C_Int; pragma Import (C, Ungetmouse, "ungetmouse"); begin if Ungetmouse (Event) = Curses_Err then raise Curses_Exception; end if; end Unget_Mouse; function Enclosed_In_Window (Win : Window := Standard_Window; Event : Mouse_Event) return Boolean is function Wenclose (Win : Window; Y : C_Int; X : C_Int) return Curses_Bool; pragma Import (C, Wenclose, "wenclose"); begin if Wenclose (Win, C_Int (Event.Y), C_Int (Event.X)) = Curses_Bool_False then return False; else return True; end if; end Enclosed_In_Window; function Mouse_Interval (Msec : Natural := 200) return Natural is function Mouseinterval (Msec : C_Int) return C_Int; pragma Import (C, Mouseinterval, "mouseinterval"); begin return Natural (Mouseinterval (C_Int (Msec))); end Mouse_Interval; end Terminal_Interface.Curses.Mouse;
Ada
3
CandyROM/external_libncurses
Ada95/src/terminal_interface-curses-mouse.adb
[ "X11" ]
.observe-dom-container text-align center .scroll-wrapper width 90% margin 80px auto white-space nowrap border 3px solid #42b983 border-radius 5px overflow hidden .scroll-content display inline-block .scroll-item height 50px line-height 50px font-size 24px display inline-block text-align center padding 0 20px &:nth-child(2n) background-color #C3D899 &:nth-child(2n+1) background-color #F2D4A7 .btn margin 40px auto padding 10px color #fff!important border-radius 4px font-size 20px background-color #666!important
Stylus
4
cym2050/better-scroll
packages/react-examples/src/pages/observe-dom/index.styl
[ "MIT" ]
{ "version_string": "{{ env.version }}", "download_commit": "{{ env.GITHUB_SHA }}", "browse_url": "{{ context.repository.html_url }}", "issues_url": "{{ context.repository.html_url }}/issues", "icon_url": "https://raw.githubusercontent.com/Structed/godot-playfab/main/addons/godot-playfab/icon.png" }
Harbour
2
Structed/godot-playfab
.asset-template.json.hb
[ "MIT" ]
/** * Author......: See docs/credits.txt * License.....: MIT */ //#define NEW_SIMD_CODE #ifdef KERNEL_STATIC #include "inc_vendor.h" #include "inc_types.h" #include "inc_platform.cl" #include "inc_common.cl" #include "inc_simd.cl" #include "inc_hash_sha1.cl" #include "inc_cipher_aes.cl" #endif #define COMPARE_S "inc_comp_single.cl" #define COMPARE_M "inc_comp_multi.cl" typedef struct iphone_passcode_tmp { u32 key0[4]; // original key from pbkdf2 u32 key1[4]; // original key from pbkdf2 u32 iterated_key0[4]; // updated key from pbkdf2 with iterations u32 iterated_key1[4]; // updated key from pbkdf2 with iterations u32 iv[4]; // current iv } iphone_passcode_tmp_t; typedef struct iphone_passcode { u32 uidkey[4]; u32 classkey1[10]; } iphone_passcode_t; DECLSPEC void hmac_sha1_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest) { digest[0] = ipad[0]; digest[1] = ipad[1]; digest[2] = ipad[2]; digest[3] = ipad[3]; digest[4] = ipad[4]; sha1_transform_vector (w0, w1, w2, w3, digest); w0[0] = digest[0]; w0[1] = digest[1]; w0[2] = digest[2]; w0[3] = digest[3]; w1[0] = digest[4]; w1[1] = 0x80000000; w1[2] = 0; w1[3] = 0; w2[0] = 0; w2[1] = 0; w2[2] = 0; w2[3] = 0; w3[0] = 0; w3[1] = 0; w3[2] = 0; w3[3] = (64 + 20) * 8; digest[0] = opad[0]; digest[1] = opad[1]; digest[2] = opad[2]; digest[3] = opad[3]; digest[4] = opad[4]; sha1_transform_vector (w0, w1, w2, w3, digest); } KERNEL_FQ void m26500_init (KERN_ATTR_TMPS_ESALT (iphone_passcode_tmp_t, iphone_passcode_t)) { /** * base */ const u64 gid = get_global_id (0); if (gid >= gid_max) return; sha1_hmac_ctx_t sha1_hmac_ctx0; sha1_hmac_init_global_swap (&sha1_hmac_ctx0, pws[gid].i, pws[gid].pw_len); sha1_hmac_update_global (&sha1_hmac_ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len); // we can reuse context intermediate buffer values for pbkdf2 sha1_hmac_ctx_t sha1_hmac_ctx1 = sha1_hmac_ctx0; sha1_hmac_ctx_t sha1_hmac_ctx2 = sha1_hmac_ctx0; u32 w0[4]; u32 w1[4]; u32 w2[4]; u32 w3[4]; w0[0] = 1; w0[1] = 0; w0[2] = 0; w0[3] = 0; w1[0] = 0; w1[1] = 0; w1[2] = 0; w1[3] = 0; w2[0] = 0; w2[1] = 0; w2[2] = 0; w2[3] = 0; w3[0] = 0; w3[1] = 0; w3[2] = 0; w3[3] = 0; sha1_hmac_update_64 (&sha1_hmac_ctx1, w0, w1, w2, w3, 4); sha1_hmac_final (&sha1_hmac_ctx1); w0[0] = 2; w0[1] = 0; w0[2] = 0; w0[3] = 0; w1[0] = 0; w1[1] = 0; w1[2] = 0; w1[3] = 0; w2[0] = 0; w2[1] = 0; w2[2] = 0; w2[3] = 0; w3[0] = 0; w3[1] = 0; w3[2] = 0; w3[3] = 0; sha1_hmac_update_64 (&sha1_hmac_ctx2, w0, w1, w2, w3, 4); sha1_hmac_final (&sha1_hmac_ctx2); // save tmps[gid].key0[0] = hc_swap32_S (sha1_hmac_ctx1.opad.h[0]); tmps[gid].key0[1] = hc_swap32_S (sha1_hmac_ctx1.opad.h[1]); tmps[gid].key0[2] = hc_swap32_S (sha1_hmac_ctx1.opad.h[2]); tmps[gid].key0[3] = hc_swap32_S (sha1_hmac_ctx1.opad.h[3]); tmps[gid].key1[0] = hc_swap32_S (sha1_hmac_ctx1.opad.h[4]); tmps[gid].key1[1] = hc_swap32_S (sha1_hmac_ctx2.opad.h[0]); tmps[gid].key1[2] = hc_swap32_S (sha1_hmac_ctx2.opad.h[1]); tmps[gid].key1[3] = hc_swap32_S (sha1_hmac_ctx2.opad.h[2]); tmps[gid].iterated_key0[0] = tmps[gid].key0[0]; tmps[gid].iterated_key0[1] = tmps[gid].key0[1]; tmps[gid].iterated_key0[2] = tmps[gid].key0[2]; tmps[gid].iterated_key0[3] = tmps[gid].key0[3]; tmps[gid].iterated_key1[0] = tmps[gid].key1[0]; tmps[gid].iterated_key1[1] = tmps[gid].key1[1]; tmps[gid].iterated_key1[2] = tmps[gid].key1[2]; tmps[gid].iterated_key1[3] = tmps[gid].key1[3]; tmps[gid].iv[0] = 0; tmps[gid].iv[1] = 0; tmps[gid].iv[2] = 0; tmps[gid].iv[3] = 0; } KERNEL_FQ void m26500_loop (KERN_ATTR_TMPS_ESALT (iphone_passcode_tmp_t, iphone_passcode_t)) { const u64 gid = get_global_id (0); const u64 lid = get_local_id (0); const u64 lsz = get_local_size (0); /** * aes shared */ #ifdef REAL_SHM LOCAL_VK u32 s_te0[256]; LOCAL_VK u32 s_te1[256]; LOCAL_VK u32 s_te2[256]; LOCAL_VK u32 s_te3[256]; LOCAL_VK u32 s_te4[256]; for (u32 i = lid; i < 256; i += lsz) { s_te0[i] = te0[i]; s_te1[i] = te1[i]; s_te2[i] = te2[i]; s_te3[i] = te3[i]; s_te4[i] = te4[i]; } SYNC_THREADS (); #else CONSTANT_AS u32a *s_te0 = te0; CONSTANT_AS u32a *s_te1 = te1; CONSTANT_AS u32a *s_te2 = te2; CONSTANT_AS u32a *s_te3 = te3; CONSTANT_AS u32a *s_te4 = te4; #endif if (gid >= gid_max) return; // load stuff u32 key0[4]; u32 key1[4]; key0[0] = tmps[gid].key0[0]; key0[1] = tmps[gid].key0[1]; key0[2] = tmps[gid].key0[2]; key0[3] = tmps[gid].key0[3]; key1[0] = tmps[gid].key1[0]; key1[1] = tmps[gid].key1[1]; key1[2] = tmps[gid].key1[2]; key1[3] = tmps[gid].key1[3]; u32 iterated_key0[4]; u32 iterated_key1[4]; iterated_key0[0] = tmps[gid].iterated_key0[0]; iterated_key0[1] = tmps[gid].iterated_key0[1]; iterated_key0[2] = tmps[gid].iterated_key0[2]; iterated_key0[3] = tmps[gid].iterated_key0[3]; iterated_key1[0] = tmps[gid].iterated_key1[0]; iterated_key1[1] = tmps[gid].iterated_key1[1]; iterated_key1[2] = tmps[gid].iterated_key1[2]; iterated_key1[3] = tmps[gid].iterated_key1[3]; u32 iv[4]; iv[0] = tmps[gid].iv[0]; iv[1] = tmps[gid].iv[1]; iv[2] = tmps[gid].iv[2]; iv[3] = tmps[gid].iv[3]; u32 ukey[4]; ukey[0] = esalt_bufs[DIGESTS_OFFSET].uidkey[0]; ukey[1] = esalt_bufs[DIGESTS_OFFSET].uidkey[1]; ukey[2] = esalt_bufs[DIGESTS_OFFSET].uidkey[2]; ukey[3] = esalt_bufs[DIGESTS_OFFSET].uidkey[3]; u32 ks[44]; AES128_set_encrypt_key (ks, ukey, s_te0, s_te1, s_te2, s_te3); // here's what counts for (u32 i = 0, xorkey = loop_pos + 1; i < loop_cnt; i++, xorkey++) { u32 in[4]; in[0] = key0[0] ^ iv[0] ^ xorkey; in[1] = key0[1] ^ iv[1] ^ xorkey; in[2] = key0[2] ^ iv[2] ^ xorkey; in[3] = key0[3] ^ iv[3] ^ xorkey; aes128_encrypt (ks, in, iv, s_te0, s_te1, s_te2, s_te3, s_te4); iterated_key0[0] ^= iv[0]; iterated_key0[1] ^= iv[1]; iterated_key0[2] ^= iv[2]; iterated_key0[3] ^= iv[3]; in[0] = key1[0] ^ iv[0] ^ xorkey; in[1] = key1[1] ^ iv[1] ^ xorkey; in[2] = key1[2] ^ iv[2] ^ xorkey; in[3] = key1[3] ^ iv[3] ^ xorkey; aes128_encrypt (ks, in, iv, s_te0, s_te1, s_te2, s_te3, s_te4); iterated_key1[0] ^= iv[0]; iterated_key1[1] ^= iv[1]; iterated_key1[2] ^= iv[2]; iterated_key1[3] ^= iv[3]; } tmps[gid].iterated_key0[0] = iterated_key0[0]; tmps[gid].iterated_key0[1] = iterated_key0[1]; tmps[gid].iterated_key0[2] = iterated_key0[2]; tmps[gid].iterated_key0[3] = iterated_key0[3]; tmps[gid].iterated_key1[0] = iterated_key1[0]; tmps[gid].iterated_key1[1] = iterated_key1[1]; tmps[gid].iterated_key1[2] = iterated_key1[2]; tmps[gid].iterated_key1[3] = iterated_key1[3]; tmps[gid].iv[0] = iv[0]; tmps[gid].iv[1] = iv[1]; tmps[gid].iv[2] = iv[2]; tmps[gid].iv[3] = iv[3]; } KERNEL_FQ void m26500_comp (KERN_ATTR_TMPS_ESALT (iphone_passcode_tmp_t, iphone_passcode_t)) { const u64 gid = get_global_id (0); const u64 lid = get_local_id (0); const u64 lsz = get_local_size (0); /** * aes shared */ #ifdef REAL_SHM LOCAL_VK u32 s_td0[256]; LOCAL_VK u32 s_td1[256]; LOCAL_VK u32 s_td2[256]; LOCAL_VK u32 s_td3[256]; LOCAL_VK u32 s_td4[256]; LOCAL_VK u32 s_te0[256]; LOCAL_VK u32 s_te1[256]; LOCAL_VK u32 s_te2[256]; LOCAL_VK u32 s_te3[256]; LOCAL_VK u32 s_te4[256]; for (u32 i = lid; i < 256; i += lsz) { s_td0[i] = td0[i]; s_td1[i] = td1[i]; s_td2[i] = td2[i]; s_td3[i] = td3[i]; s_td4[i] = td4[i]; s_te0[i] = te0[i]; s_te1[i] = te1[i]; s_te2[i] = te2[i]; s_te3[i] = te3[i]; s_te4[i] = te4[i]; } SYNC_THREADS (); #else CONSTANT_AS u32a *s_td0 = td0; CONSTANT_AS u32a *s_td1 = td1; CONSTANT_AS u32a *s_td2 = td2; CONSTANT_AS u32a *s_td3 = td3; CONSTANT_AS u32a *s_td4 = td4; CONSTANT_AS u32a *s_te0 = te0; CONSTANT_AS u32a *s_te1 = te1; CONSTANT_AS u32a *s_te2 = te2; CONSTANT_AS u32a *s_te3 = te3; CONSTANT_AS u32a *s_te4 = te4; #endif if (gid >= gid_max) return; /** * aes */ u32 ukey[8]; ukey[0] = tmps[gid].iterated_key0[0]; ukey[1] = tmps[gid].iterated_key0[1]; ukey[2] = tmps[gid].iterated_key0[2]; ukey[3] = tmps[gid].iterated_key0[3]; ukey[4] = tmps[gid].iterated_key1[0]; ukey[5] = tmps[gid].iterated_key1[1]; ukey[6] = tmps[gid].iterated_key1[2]; ukey[7] = tmps[gid].iterated_key1[3]; u32 ks[60]; aes256_set_decrypt_key (ks, ukey, s_te0, s_te1, s_te2, s_te3, s_td0, s_td1, s_td2, s_td3); u32 cipher[4]; cipher[0] = esalt_bufs[DIGESTS_OFFSET].classkey1[0]; cipher[1] = esalt_bufs[DIGESTS_OFFSET].classkey1[1]; cipher[2] = 0; cipher[3] = 0; u32 lsb[8]; lsb[0] = esalt_bufs[DIGESTS_OFFSET].classkey1[8]; lsb[1] = esalt_bufs[DIGESTS_OFFSET].classkey1[9]; lsb[2] = esalt_bufs[DIGESTS_OFFSET].classkey1[6]; lsb[3] = esalt_bufs[DIGESTS_OFFSET].classkey1[7]; lsb[4] = esalt_bufs[DIGESTS_OFFSET].classkey1[4]; lsb[5] = esalt_bufs[DIGESTS_OFFSET].classkey1[5]; lsb[6] = esalt_bufs[DIGESTS_OFFSET].classkey1[2]; lsb[7] = esalt_bufs[DIGESTS_OFFSET].classkey1[3]; for (int j = 5; j >= 0; j--) { // 1st cipher[1] ^= (4 * j + 4); cipher[2] = lsb[0]; cipher[3] = lsb[1]; AES256_decrypt (ks, cipher, cipher, s_td0, s_td1, s_td2, s_td3, s_td4); lsb[0] = cipher[2]; lsb[1] = cipher[3]; // 2nd cipher[1] ^= (4 * j + 3); cipher[2] = lsb[2]; cipher[3] = lsb[3]; AES256_decrypt (ks, cipher, cipher, s_td0, s_td1, s_td2, s_td3, s_td4); lsb[2] = cipher[2]; lsb[3] = cipher[3]; // 3rd cipher[1] ^= (4 * j + 2); cipher[2] = lsb[4]; cipher[3] = lsb[5]; AES256_decrypt (ks, cipher, cipher, s_td0, s_td1, s_td2, s_td3, s_td4); lsb[4] = cipher[2]; lsb[5] = cipher[3]; // 4th cipher[1] ^= (4 * j + 1); cipher[2] = lsb[6]; cipher[3] = lsb[7]; AES256_decrypt (ks, cipher, cipher, s_td0, s_td1, s_td2, s_td3, s_td4); lsb[6] = cipher[2]; lsb[7] = cipher[3]; } if ((cipher[0] == 0xa6a6a6a6) && (cipher[1] == 0xa6a6a6a6)) { if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET]) == 0) { mark_hash (plains_buf, d_return_buf, SALT_POS, digests_cnt, 0, DIGESTS_OFFSET + 0, gid, 0, 0, 0); } return; } }
OpenCL
4
Masha/hashcat
OpenCL/m26500-pure.cl
[ "MIT" ]
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {assertNumber, assertString} from '../../util/assert'; import {ELEMENT_MARKER, I18nCreateOpCode, I18nCreateOpCodes, I18nRemoveOpCodes, I18nUpdateOpCode, I18nUpdateOpCodes, ICU_MARKER, IcuCreateOpCode, IcuCreateOpCodes} from '../interfaces/i18n'; import {getInstructionFromIcuCreateOpCode, getParentFromIcuCreateOpCode, getRefFromIcuCreateOpCode} from './i18n_util'; /** * Converts `I18nCreateOpCodes` array into a human readable format. * * This function is attached to the `I18nCreateOpCodes.debug` property if `ngDevMode` is enabled. * This function provides a human readable view of the opcodes. This is useful when debugging the * application as well as writing more readable tests. * * @param this `I18nCreateOpCodes` if attached as a method. * @param opcodes `I18nCreateOpCodes` if invoked as a function. */ export function i18nCreateOpCodesToString( this: I18nCreateOpCodes|void, opcodes?: I18nCreateOpCodes): string[] { const createOpCodes: I18nCreateOpCodes = opcodes || (Array.isArray(this) ? this : [] as any); let lines: string[] = []; for (let i = 0; i < createOpCodes.length; i++) { const opCode = createOpCodes[i++] as any; const text = createOpCodes[i] as string; const isComment = (opCode & I18nCreateOpCode.COMMENT) === I18nCreateOpCode.COMMENT; const appendNow = (opCode & I18nCreateOpCode.APPEND_EAGERLY) === I18nCreateOpCode.APPEND_EAGERLY; const index = opCode >>> I18nCreateOpCode.SHIFT; lines.push(`lView[${index}] = document.${isComment ? 'createComment' : 'createText'}(${ JSON.stringify(text)});`); if (appendNow) { lines.push(`parent.appendChild(lView[${index}]);`); } } return lines; } /** * Converts `I18nUpdateOpCodes` array into a human readable format. * * This function is attached to the `I18nUpdateOpCodes.debug` property if `ngDevMode` is enabled. * This function provides a human readable view of the opcodes. This is useful when debugging the * application as well as writing more readable tests. * * @param this `I18nUpdateOpCodes` if attached as a method. * @param opcodes `I18nUpdateOpCodes` if invoked as a function. */ export function i18nUpdateOpCodesToString( this: I18nUpdateOpCodes|void, opcodes?: I18nUpdateOpCodes): string[] { const parser = new OpCodeParser(opcodes || (Array.isArray(this) ? this : [])); let lines: string[] = []; function consumeOpCode(value: number): string { const ref = value >>> I18nUpdateOpCode.SHIFT_REF; const opCode = value & I18nUpdateOpCode.MASK_OPCODE; switch (opCode) { case I18nUpdateOpCode.Text: return `(lView[${ref}] as Text).textContent = $$$`; case I18nUpdateOpCode.Attr: const attrName = parser.consumeString(); const sanitizationFn = parser.consumeFunction(); const value = sanitizationFn ? `(${sanitizationFn})($$$)` : '$$$'; return `(lView[${ref}] as Element).setAttribute('${attrName}', ${value})`; case I18nUpdateOpCode.IcuSwitch: return `icuSwitchCase(${ref}, $$$)`; case I18nUpdateOpCode.IcuUpdate: return `icuUpdateCase(${ref})`; } throw new Error('unexpected OpCode'); } while (parser.hasMore()) { let mask = parser.consumeNumber(); let size = parser.consumeNumber(); const end = parser.i + size; const statements: string[] = []; let statement = ''; while (parser.i < end) { let value = parser.consumeNumberOrString(); if (typeof value === 'string') { statement += value; } else if (value < 0) { // Negative numbers are ref indexes // Here `i` refers to current binding index. It is to signify that the value is relative, // rather than absolute. statement += '${lView[i' + value + ']}'; } else { // Positive numbers are operations. const opCodeText = consumeOpCode(value); statements.push(opCodeText.replace('$$$', '`' + statement + '`') + ';'); statement = ''; } } lines.push(`if (mask & 0b${mask.toString(2)}) { ${statements.join(' ')} }`); } return lines; } /** * Converts `I18nCreateOpCodes` array into a human readable format. * * This function is attached to the `I18nCreateOpCodes.debug` if `ngDevMode` is enabled. This * function provides a human readable view of the opcodes. This is useful when debugging the * application as well as writing more readable tests. * * @param this `I18nCreateOpCodes` if attached as a method. * @param opcodes `I18nCreateOpCodes` if invoked as a function. */ export function icuCreateOpCodesToString( this: IcuCreateOpCodes|void, opcodes?: IcuCreateOpCodes): string[] { const parser = new OpCodeParser(opcodes || (Array.isArray(this) ? this : [])); let lines: string[] = []; function consumeOpCode(opCode: number): string { const parent = getParentFromIcuCreateOpCode(opCode); const ref = getRefFromIcuCreateOpCode(opCode); switch (getInstructionFromIcuCreateOpCode(opCode)) { case IcuCreateOpCode.AppendChild: return `(lView[${parent}] as Element).appendChild(lView[${lastRef}])`; case IcuCreateOpCode.Attr: return `(lView[${ref}] as Element).setAttribute("${parser.consumeString()}", "${ parser.consumeString()}")`; } throw new Error('Unexpected OpCode: ' + getInstructionFromIcuCreateOpCode(opCode)); } let lastRef = -1; while (parser.hasMore()) { let value = parser.consumeNumberStringOrMarker(); if (value === ICU_MARKER) { const text = parser.consumeString(); lastRef = parser.consumeNumber(); lines.push(`lView[${lastRef}] = document.createComment("${text}")`); } else if (value === ELEMENT_MARKER) { const text = parser.consumeString(); lastRef = parser.consumeNumber(); lines.push(`lView[${lastRef}] = document.createElement("${text}")`); } else if (typeof value === 'string') { lastRef = parser.consumeNumber(); lines.push(`lView[${lastRef}] = document.createTextNode("${value}")`); } else if (typeof value === 'number') { const line = consumeOpCode(value); line && lines.push(line); } else { throw new Error('Unexpected value'); } } return lines; } /** * Converts `I18nRemoveOpCodes` array into a human readable format. * * This function is attached to the `I18nRemoveOpCodes.debug` if `ngDevMode` is enabled. This * function provides a human readable view of the opcodes. This is useful when debugging the * application as well as writing more readable tests. * * @param this `I18nRemoveOpCodes` if attached as a method. * @param opcodes `I18nRemoveOpCodes` if invoked as a function. */ export function i18nRemoveOpCodesToString( this: I18nRemoveOpCodes|void, opcodes?: I18nRemoveOpCodes): string[] { const removeCodes = opcodes || (Array.isArray(this) ? this : []); let lines: string[] = []; for (let i = 0; i < removeCodes.length; i++) { const nodeOrIcuIndex = removeCodes[i] as number; if (nodeOrIcuIndex > 0) { // Positive numbers are `RNode`s. lines.push(`remove(lView[${nodeOrIcuIndex}])`); } else { // Negative numbers are ICUs lines.push(`removeNestedICU(${~nodeOrIcuIndex})`); } } return lines; } class OpCodeParser { i: number = 0; codes: any[]; constructor(codes: any[]) { this.codes = codes; } hasMore() { return this.i < this.codes.length; } consumeNumber(): number { let value = this.codes[this.i++]; assertNumber(value, 'expecting number in OpCode'); return value; } consumeString(): string { let value = this.codes[this.i++]; assertString(value, 'expecting string in OpCode'); return value; } consumeFunction(): Function|null { let value = this.codes[this.i++]; if (value === null || typeof value === 'function') { return value; } throw new Error('expecting function in OpCode'); } consumeNumberOrString(): number|string { let value = this.codes[this.i++]; if (typeof value === 'string') { return value; } assertNumber(value, 'expecting number or string in OpCode'); return value; } consumeNumberStringOrMarker(): number|string|ICU_MARKER|ELEMENT_MARKER { let value = this.codes[this.i++]; if (typeof value === 'string' || typeof value === 'number' || value == ICU_MARKER || value == ELEMENT_MARKER) { return value; } assertNumber(value, 'expecting number, string, ICU_MARKER or ELEMENT_MARKER in OpCode'); return value; } }
TypeScript
5
raghavendramohan/angular
packages/core/src/render3/i18n/i18n_debug.ts
[ "MIT" ]
<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Hi,</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Thank you</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Text</div><div class="gmail_default" style="font-family:tahoma,sans-serif">Text</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Thank you again,</div><div class="gmail_default" style="font-family:tahoma,sans-serif">Name</div></div><div class="gmail_extra"><br></div>
HTML
0
cnheider/nylas-mail
packages/client-app/spec/fixtures/emails/email_23_stripped.html
[ "MIT" ]
/****************************************************************************** * Copyright 2018 The Apollo Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * 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. *****************************************************************************/ #include "gtest/gtest.h" #include "modules/perception/base/point_cloud.h" #include "modules/perception/common/point_cloud_processing/downsampling.h" namespace apollo { namespace perception { namespace common { using base::PointCloud; using base::PointF; TEST(PointCloudProcessingDownsamplingTest, downsampling_circular_test1) { PointF center_pt, tmp_pt; center_pt.x = 0.f; center_pt.y = 0.f; center_pt.z = 0.f; float radius = 2.f; float neighbour_dist = 0.f; std::shared_ptr<PointCloud<PointF>> pc_in = std::shared_ptr<PointCloud<PointF>>(new base::PointCloud<PointF>); std::shared_ptr<PointCloud<PointF>> pc_out = std::shared_ptr<PointCloud<PointF>>(new base::PointCloud<PointF>); tmp_pt.x = 1.f; tmp_pt.y = 1.f; tmp_pt.z = 0.f; pc_in->push_back(tmp_pt); tmp_pt.x = 0.f; tmp_pt.y = 1.f; tmp_pt.z = 0.f; pc_in->push_back(tmp_pt); tmp_pt.x = 10.f; tmp_pt.y = 10.f; tmp_pt.z = 10.f; pc_in->push_back(tmp_pt); EXPECT_EQ(pc_in->size(), 3); EXPECT_EQ(pc_in->height(), 1); EXPECT_EQ(pc_in->width(), 3); std::shared_ptr<const PointCloud<PointF>> pc_in_const = pc_in; DownsamplingCircular(center_pt, radius, neighbour_dist, pc_in_const, pc_out); EXPECT_EQ(pc_out->size(), 2); } TEST(PointCloudProcessingDownsamplingTest, downsampling_circular_test2) { PointF center_pt, tmp_pt; center_pt.x = 0.f; center_pt.y = 0.f; center_pt.z = 0.f; float radius = 2.f; float neighbour_dist = 0.f; std::shared_ptr<PointCloud<PointF>> pc_in = std::shared_ptr<PointCloud<PointF>>( new PointCloud<PointF>(4, 4, PointF())); std::shared_ptr<PointCloud<PointF>> pc_out = std::shared_ptr<PointCloud<PointF>>(new base::PointCloud<PointF>); for (size_t i = 0; i < 4; i++) { for (size_t j = 0; j < 4; j++) { tmp_pt.x = static_cast<float>(i); tmp_pt.y = static_cast<float>(j); tmp_pt.z = 0.f; *(pc_in->at(i, j)) = tmp_pt; } } std::shared_ptr<const PointCloud<PointF>> pc_in_const = pc_in; DownsamplingCircular(center_pt, radius, neighbour_dist, pc_in_const, pc_out); EXPECT_EQ(pc_out->size(), 4); } TEST(PointCloudProcessingDownsamplingTest, downsampling_circular_test3) { PointF center_pt, tmp_pt; center_pt.x = 0.f; center_pt.y = 0.f; center_pt.z = 0.f; float radius = 3.f; float neighbour_dist = 1.1f; std::shared_ptr<PointCloud<PointF>> pc_in = std::shared_ptr<PointCloud<PointF>>( new PointCloud<PointF>(4, 4, PointF())); std::shared_ptr<PointCloud<PointF>> pc_out = std::shared_ptr<PointCloud<PointF>>(new base::PointCloud<PointF>); for (size_t i = 0; i < 4; i++) { for (size_t j = 0; j < 4; j++) { tmp_pt.x = static_cast<float>(i); tmp_pt.y = static_cast<float>(j); tmp_pt.z = 0.f; *(pc_in->at(i, j)) = tmp_pt; } } std::shared_ptr<const PointCloud<PointF>> pc_in_const = pc_in; DownsamplingCircular(center_pt, radius, neighbour_dist, pc_in_const, pc_out); EXPECT_EQ(pc_out->size(), 6); } TEST(PointCloudProcessingDownsamplingTest, downsampling_circular_org_all1) { std::shared_ptr<PointCloud<PointF>> pc_in = std::shared_ptr<PointCloud<PointF>>(new PointCloud<PointF>); std::shared_ptr<PointCloud<PointF>> pc_out = std::shared_ptr<PointCloud<PointF>>(new PointCloud<PointF>); PointF center_pt, tmp_pt; center_pt.x = 0.f; center_pt.y = 0.f; center_pt.z = 0.f; for (float i = 1.f; i <= 128.0f; i++) { tmp_pt.x = i; tmp_pt.y = i; tmp_pt.z = i; pc_in->push_back(tmp_pt); } int smp_ratio = 1; float radius = 6.f; int velodyne_model = 64; std::shared_ptr<const PointCloud<PointF>> pc_in_const = pc_in; DownsamplingCircularOrgAll(center_pt, smp_ratio, radius, velodyne_model, pc_in_const, pc_out); EXPECT_EQ(pc_out->size(), 4); } TEST(PointCloudProcessingDownsamplingTest, downsampling_circular_org_all2) { std::shared_ptr<PointCloud<PointF>> pc_in = std::shared_ptr<PointCloud<PointF>>(new PointCloud<PointF>); std::shared_ptr<PointCloud<PointF>> pc_out = std::shared_ptr<PointCloud<PointF>>(new PointCloud<PointF>); PointF center_pt, tmp_pt; center_pt.x = 0.f; center_pt.y = 0.f; center_pt.z = 0.f; tmp_pt.x = 1.f; tmp_pt.y = 1.f; tmp_pt.z = 0.0f / 0.0f; pc_in->push_back(tmp_pt); int smp_ratio = 1; float radius = 6.f; int velodyne_model = 64; std::shared_ptr<const PointCloud<PointF>> pc_in_const = pc_in; DownsamplingCircularOrgAll(center_pt, smp_ratio, radius, velodyne_model, pc_in_const, pc_out); EXPECT_EQ(pc_out->size(), 0); } TEST(PointCloudProcessingDownsamplingTest, downsampling_circular_org_partial1) { std::shared_ptr<PointCloud<PointF>> pc_in = std::shared_ptr<PointCloud<PointF>>( new PointCloud<PointF>(64, 64, PointF())); std::shared_ptr<PointCloud<PointF>> pc_out = std::shared_ptr<PointCloud<PointF>>(new PointCloud<PointF>); PointF center_pt, tmp_pt; typedef std::vector<std::pair<int, int>> VectorPair; VectorPair all_org_idx; center_pt.x = 0.f; center_pt.y = 0.f; center_pt.z = 0.f; for (size_t i = 0; i < 64; i++) { for (size_t j = 0; j < 64; j++) { tmp_pt.x = static_cast<float>(i); tmp_pt.y = static_cast<float>(j); tmp_pt.z = 1.f; *(pc_in->at(i, j)) = tmp_pt; all_org_idx.push_back(std::make_pair(i, j)); } } int org_num = 16; int smp_ratio = 8; float radius = 100.f; int velodyne_model = 64; std::shared_ptr<const PointCloud<PointF>> pc_in_const = pc_in; DownsamplingCircularOrgPartial(center_pt, org_num, smp_ratio, radius, velodyne_model, pc_in_const, pc_out, &all_org_idx); EXPECT_EQ(pc_out->size(), 128); } TEST(PointCloudProcessingDownsamplingTest, downsampling_circular_org_partial2) { std::shared_ptr<PointCloud<PointF>> pc_in = std::shared_ptr<PointCloud<PointF>>( new PointCloud<PointF>(64, 64, PointF())); std::shared_ptr<PointCloud<PointF>> pc_out = std::shared_ptr<PointCloud<PointF>>(new PointCloud<PointF>); PointF center_pt, tmp_pt; typedef std::vector<std::pair<int, int>> VectorPair; VectorPair all_org_idx; center_pt.x = 0.f; center_pt.y = 0.f; center_pt.z = 0.f; for (size_t i = 0; i < 64; i++) { for (size_t j = 0; j < 64; j++) { tmp_pt.x = static_cast<float>(i); tmp_pt.y = static_cast<float>(j); tmp_pt.z = 1.f; *(pc_in->at(i, j)) = tmp_pt; all_org_idx.push_back(std::make_pair(i, j)); } } pc_in->at(0, 0)->x = 0.0f / 0.0f; int org_num = 16; int smp_ratio = 8; float radius = 100.f; int velodyne_model = 64; std::shared_ptr<const PointCloud<PointF>> pc_in_const = pc_in; DownsamplingCircularOrgPartial(center_pt, org_num, smp_ratio, radius, velodyne_model, pc_in_const, pc_out, &all_org_idx); EXPECT_EQ(pc_out->size(), 127); } TEST(PointCloudProcessingDownsamplingTest, downsampling_rectangle_org_partial1) { std::shared_ptr<PointCloud<PointF>> pc_in = std::shared_ptr<PointCloud<PointF>>( new PointCloud<PointF>(128, 128, PointF())); std::shared_ptr<PointCloud<PointF>> pc_out = std::shared_ptr<PointCloud<PointF>>(new PointCloud<PointF>); PointF center_pt, tmp_pt; typedef std::vector<std::pair<int, int>> VectorPair; VectorPair all_org_idx; center_pt.x = 0.f; center_pt.y = 0.f; center_pt.z = 0.f; for (size_t i = 0; i < 126; i++) { for (size_t j = 0; j < 126; j++) { tmp_pt.x = static_cast<float>(i); tmp_pt.y = static_cast<float>(j); tmp_pt.z = 1.f; *(pc_in->at(i, j)) = tmp_pt; all_org_idx.push_back(std::make_pair(i, j)); } } pc_in->at(0, 0)->x = 0.0f / 0.0f; int org_num = 16; int smp_ratio = 8; float front_range = 63.f; float side_range = 63.f; int velodyne_model = 64; std::shared_ptr<const PointCloud<PointF>> pc_in_const = pc_in; DownsamplingRectangleOrgPartial(org_num, smp_ratio, front_range, side_range, velodyne_model, pc_in_const, pc_out, &all_org_idx); EXPECT_EQ(pc_out->size(), 127); } TEST(PointCloudProcessingDownsamplingTest, downsampling_rectangle_org_partial2) { std::shared_ptr<PointCloud<PointF>> pc_in = std::shared_ptr<PointCloud<PointF>>( new PointCloud<PointF>(128, 128, PointF())); std::shared_ptr<PointCloud<PointF>> pc_out = std::shared_ptr<PointCloud<PointF>>(new PointCloud<PointF>); PointF center_pt, tmp_pt; typedef std::vector<std::pair<int, int>> VectorPair; VectorPair all_org_idx; center_pt.x = 0.f; center_pt.y = 0.f; center_pt.z = 0.f; for (size_t i = 0; i < 128; i++) { for (size_t j = 0; j < 128; j++) { tmp_pt.x = static_cast<float>(i); tmp_pt.y = static_cast<float>(j); tmp_pt.z = 1.f; *(pc_in->at(i, j)) = tmp_pt; all_org_idx.push_back(std::make_pair(i, j)); } } int org_num = 16; int smp_ratio = 8; float front_range = 63.f; float side_range = 63.f; int velodyne_model = 64; std::shared_ptr<const PointCloud<PointF>> pc_in_const = pc_in; DownsamplingRectangleOrgPartial(org_num, smp_ratio, front_range, side_range, velodyne_model, pc_in_const, pc_out, &all_org_idx); EXPECT_EQ(pc_out->size(), 128); } TEST(PointCloudProcessingDownsamplingTest, downsampling_rectangle_neighbour1) { PointF tmp_pt; std::shared_ptr<PointCloud<PointF>> pc_in = std::shared_ptr<PointCloud<PointF>>( new PointCloud<PointF>(64, 64, PointF())); std::shared_ptr<PointCloud<PointF>> pc_out = std::shared_ptr<PointCloud<PointF>>(new PointCloud<PointF>); for (size_t i = 0; i < 64; i++) { for (size_t j = 0; j < 64; j++) { tmp_pt.x = static_cast<float>(i); tmp_pt.y = static_cast<float>(j); tmp_pt.z = 1.f; *(pc_in->at(i, j)) = tmp_pt; } } float front_range = 31.f; float side_range = 31.f; double max_nei = 2.f; int velo_model = 64; std::shared_ptr<const PointCloud<PointF>> pc_in_const = pc_in; DownsamplingRectangleNeighbour(front_range, side_range, max_nei, velo_model, pc_in_const, pc_out); EXPECT_EQ(pc_out->size(), 349); } TEST(PointCloudProcessingDownsamplingTest, downsampling_rectangle_neighbour2) { PointF tmp_pt; std::shared_ptr<PointCloud<PointF>> pc_in = std::shared_ptr<PointCloud<PointF>>( new PointCloud<PointF>(64, 64, PointF())); std::shared_ptr<PointCloud<PointF>> pc_out = std::shared_ptr<PointCloud<PointF>>(new PointCloud<PointF>); for (size_t i = 0; i < 64; i++) { for (size_t j = 0; j < 64; j++) { tmp_pt.x = static_cast<float>(i); tmp_pt.y = static_cast<float>(j); tmp_pt.z = 1.f; *(pc_in->at(i, j)) = tmp_pt; } } pc_in->at(0, 0)->x = 0.0f / 0.0f; float front_range = 31.f; float side_range = 31.f; double max_nei = 2.f; int velo_model = 64; std::shared_ptr<const PointCloud<PointF>> pc_in_const = pc_in; DownsamplingRectangleNeighbour(front_range, side_range, max_nei, velo_model, pc_in_const, pc_out); EXPECT_EQ(pc_out->size(), 349); } } // namespace common } // namespace perception } // namespace apollo
C++
5
seeclong/apollo
modules/perception/common/point_cloud_processing/downsampling_test.cc
[ "Apache-2.0" ]
FromInput() -> CPUOnly() -> CheckIP6Header() -> LookupIP6Route() -> DecIP6HLIM() -> DropBroadcasts() -> ToOutput();
Click
1
ANLAB-KAIST/NBA
configs/ipv6-router-cpuonly.click
[ "MIT" ]
{{ render(url('sylius_shop_partial_product_review_latest', {'productId': product.id, 'template': '@SyliusShop/ProductReview/_list.html.twig'})) }}
Twig
3
titomtd/Sylius
src/Sylius/Bundle/ShopBundle/Resources/views/Product/Show/Tabs/Reviews/_latest.html.twig
[ "MIT" ]
#N canvas 675 95 495 378 12; #X msg 74 179 bang; #X obj 66 15 until; #X text 28 50 The until object's left inlet starts a loop in which it outputs "bang" until its right inlet gets a bang which stops it. If you start "until" with a number \, it iterates at most that number of times \, as in the Max "uzi" object.; #X text 33 128 WARNING: if you bang an "until" which doesn't have a stopping mechanism \, Pd goes into an infinite loop!; #X obj 74 237 until; #X text 119 178 start; #X msg 82 206 3; #X text 118 207 start limited to 3 iterations; #X obj 74 265 f; #X obj 112 265 + 1; #X obj 157 264 sel 0; #X obj 74 319 print; #X obj 112 291 mod 10; #X text 234 310 updated for Pd version 0.28; #X text 115 16 - loop; #X connect 0 0 4 0; #X connect 4 0 8 0; #X connect 6 0 4 0; #X connect 8 0 9 0; #X connect 8 0 11 0; #X connect 9 0 12 0; #X connect 10 0 4 1; #X connect 12 0 8 1; #X connect 12 0 10 0;
Pure Data
4
myQwil/pure-data
doc/5.reference/until-help.pd
[ "TCL" ]
// Copyright 2015 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "src/inspector/remote-object-id.h" #include "../../third_party/inspector_protocol/crdtp/json.h" #include "src/inspector/protocol/Protocol.h" #include "src/inspector/string-util.h" namespace v8_inspector { namespace { String16 serializeId(uint64_t isolateId, int injectedScriptId, int id) { return String16::concat( String16::fromInteger64(static_cast<int64_t>(isolateId)), ".", String16::fromInteger(injectedScriptId), ".", String16::fromInteger(id)); } } // namespace RemoteObjectIdBase::RemoteObjectIdBase() : m_isolateId(0), m_injectedScriptId(0), m_id(0) {} bool RemoteObjectIdBase::parseId(const String16& objectId) { const UChar dot = '.'; size_t firstDotPos = objectId.find(dot); if (firstDotPos == String16::kNotFound) return false; bool ok = false; int64_t isolateId = objectId.substring(0, firstDotPos).toInteger64(&ok); if (!ok) return false; firstDotPos++; size_t secondDotPos = objectId.find(dot, firstDotPos); if (secondDotPos == String16::kNotFound) return false; int injectedScriptId = objectId.substring(firstDotPos, secondDotPos - firstDotPos) .toInteger(&ok); if (!ok) return false; secondDotPos++; int id = objectId.substring(secondDotPos).toInteger(&ok); if (!ok) return false; m_isolateId = static_cast<uint64_t>(isolateId); m_injectedScriptId = injectedScriptId; m_id = id; return true; } Response RemoteObjectId::parse(const String16& objectId, std::unique_ptr<RemoteObjectId>* result) { std::unique_ptr<RemoteObjectId> remoteObjectId(new RemoteObjectId()); if (!remoteObjectId->parseId(objectId)) return Response::ServerError("Invalid remote object id"); *result = std::move(remoteObjectId); return Response::Success(); } String16 RemoteObjectId::serialize(uint64_t isolateId, int injectedScriptId, int id) { return serializeId(isolateId, injectedScriptId, id); } Response RemoteCallFrameId::parse(const String16& objectId, std::unique_ptr<RemoteCallFrameId>* result) { std::unique_ptr<RemoteCallFrameId> remoteCallFrameId(new RemoteCallFrameId()); if (!remoteCallFrameId->parseId(objectId)) return Response::ServerError("Invalid call frame id"); *result = std::move(remoteCallFrameId); return Response::Success(); } String16 RemoteCallFrameId::serialize(uint64_t isolateId, int injectedScriptId, int frameOrdinal) { return serializeId(isolateId, injectedScriptId, frameOrdinal); } } // namespace v8_inspector
C++
4
EXHades/v8
src/inspector/remote-object-id.cc
[ "BSD-3-Clause" ]
//============================================================================== // // Copyright (c) 2017-2019 Qualcomm Technologies, Inc. // All Rights Reserved. // Confidential and Proprietary - Qualcomm Technologies, Inc. // //============================================================================== #ifndef _SNPE_BUILDER_HPP_ #define _SNPE_BUILDER_HPP_ #include "SNPE/SNPE.hpp" #include "DlSystem/DlEnums.hpp" #include "DlSystem/UDLFunc.hpp" #include "DlSystem/DlOptional.hpp" #include "DlSystem/TensorShapeMap.hpp" #include "DlSystem/PlatformConfig.hpp" #include "DlSystem/RuntimeList.hpp" namespace zdl { namespace DlContainer { class IDlContainer; } } struct SNPEBuilderImpl; namespace zdl { namespace SNPE { /** @addtogroup c_plus_plus_apis C++ @{ */ /** * The builder class for creating SNPE objects. * Not meant to be extended. */ class ZDL_EXPORT SNPEBuilder final { private: std::unique_ptr<::SNPEBuilderImpl> m_Impl; public: /** * @brief Constructor of NeuralNetwork Builder with a supplied model. * * @param[in] container A container holding the model. * * @return A new instance of a SNPEBuilder object * that can be used to configure and build * an instance of SNPE. * */ explicit SNPEBuilder( zdl::DlContainer::IDlContainer* container); ~SNPEBuilder(); /** * NOTE: DEPRECATED, MAY BE REMOVED IN THE FUTURE. Please use * setRuntimeProcessorOrder() * * @brief Sets the runtime processor. * * @param[in] targetRuntimeProcessor The target runtime. * * @return The current instance of SNPEBuilder. */ SNPEBuilder& setRuntimeProcessor( zdl::DlSystem::Runtime_t targetRuntimeProcessor); /** * @brief Requests a performance profile. * * @param[in] targetRuntimeProfile The target performance profile. * * @return The current instance of SNPEBuilder. */ SNPEBuilder& setPerformanceProfile( zdl::DlSystem::PerformanceProfile_t performanceProfile); /** * @brief Sets the profiling level. Default profiling level for * SNPEBuilder is off. Off and basic only applies to DSP runtime. * * @param[in] profilingLevel The target profiling level. * * @return The current instance of SNPEBuilder. */ SNPEBuilder& setProfilingLevel( zdl::DlSystem::ProfilingLevel_t profilingLevel); /** * @brief Sets a preference for execution priority. * * This allows the caller to give coarse hint to SNPE runtime * about the priority of the network. SNPE runtime is free to use * this information to co-ordinate between different workloads * that may or may not extend beyond SNPE. * * @param[in] ExecutionPriorityHint_t The target performance profile. * * @return The current instance of SNPEBuilder. */ SNPEBuilder& setExecutionPriorityHint( zdl::DlSystem::ExecutionPriorityHint_t priority); /** * @brief Sets the layers that will generate output. * * @param[in] outputLayerNames List of layer names to * output. An empty list will * result in only the final * layer of the model being * the output layer. The list * will be copied. * * @return The current instance of SNPEBuilder. */ SNPEBuilder& setOutputLayers( const zdl::DlSystem::StringList& outputLayerNames); /** * @brief Sets the output tensor names. * * @param[in] outputTensorNames List of tensor names to * output. An empty list will * result in producing output for the final * output tensor of the model. * The list will be copied. * * @return The current instance of SNPEBuilder. */ SNPEBuilder& setOutputTensors( const zdl::DlSystem::StringList& outputTensorNames); /** * @brief Passes in a User-defined layer. * * @param udlBundle Bundle of udl factory function and a cookie * * @return The current instance of SNPEBuilder. */ SNPEBuilder& setUdlBundle( zdl::DlSystem::UDLBundle udlBundle); /** * @brief Sets whether this neural network will perform inference with * input from user-supplied buffers, and write output to user-supplied * buffers. Default behaviour is to use tensors created by * ITensorFactory. * * @param[in] bufferMode Whether to use user-supplied buffer or not. * * @return The current instance of SNPEBuilder. */ SNPEBuilder& setUseUserSuppliedBuffers( bool bufferMode); /** * @brief Sets the debug mode of the runtime. * * @param[in] debugMode This enables debug mode for the runtime. It * does two things. For an empty * outputLayerNames list, all layers will be * output. It might also disable some internal * runtime optimizations (e.g., some networks * might be optimized by combining layers, * etc.). * * @return The current instance of SNPEBuilder. */ SNPEBuilder& setDebugMode( bool debugMode); /** * NOTE: DEPRECATED, MAY BE REMOVED IN THE FUTURE. Please use * setRuntimeProcessorOrder() * * @brief Sets the mode of CPU fallback functionality. * * @param[in] mode This flag enables/disables the functionality * of CPU fallback. When the CPU fallback * functionality is enabled, layers in model that * violates runtime constraints will run on CPU * while the rest of non-violating layers will * run on the chosen runtime processor. In * disabled mode, models with layers violating * runtime constraints will NOT run on the chosen * runtime processor and will result in runtime * exception. By default, the functionality is * enabled. * * @return The current instance of SNPEBuilder. */ SNPEBuilder& setCPUFallbackMode( bool mode); /** * @brief Sets network's input dimensions to enable resizing of * the spatial dimensions of each layer for fully convolutional networks, * and the batch dimension for all networks. * * @param[in] tensorShapeMap The map of input names and their new dimensions. * The new dimensions overwrite the input dimensions * embedded in the model and then resize each layer * of the model. If the model contains * layers whose dimensions cannot be resized e.g FullyConnected, * exception will be thrown when SNPE instance is actually built. * In general the batch dimension is always resizable. * After resizing of layers' dimensions in model based * on new input dimensions, the new model is revalidated * against all runtime constraints, whose failures may * result in cpu fallback situation. * * @return The current instance of SNPEBuilder. */ SNPEBuilder& setInputDimensions(const zdl::DlSystem::TensorShapeMap& inputDimensionsMap); /** * @brief Sets the mode of init caching functionality. * * @param[in] mode This flag enables/disables the functionality of init caching. * When init caching functionality is enabled, a set of init caches * will be created during network building/initialization process * and will be added to DLC container. If such DLC container is saved * by the user, in subsequent network building/initialization processes * these init caches will be loaded from the DLC so as to reduce initialization time. * In disable mode, no init caches will be added to DLC container. * * @return The current instance of SNPEBuilder. */ SNPEBuilder& setInitCacheMode( bool cacheMode); /** * @brief Returns an instance of SNPE based on the current parameters. * * @return A new instance of a SNPE object that can be used * to execute models or null if any errors occur. */ std::unique_ptr<SNPE> build() noexcept; /** * @brief Sets the platform configuration. * * @param[in] platformConfig The platform configuration. * * @return The current instance of SNPEBuilder. */ SNPEBuilder& setPlatformConfig(const zdl::DlSystem::PlatformConfig& platformConfig); /** * @brief Sets network's runtime order of precedence. Example: * CPU_FLOAT32, GPU_FLOAT16, AIP_FIXED8_TF * Note:- setRuntimeProcessor() or setCPUFallbackMode() will be silently ignored when * setRuntimeProcessorOrder() is invoked * * @param[in] runtimeList The list of runtime in order of precedence * * @return The current instance of SNPEBuilder. */ SNPEBuilder& setRuntimeProcessorOrder(const zdl::DlSystem::RuntimeList& runtimeList); /** * @brief Sets the unconsumed tensors as output * * @param[in] setOutput This enables unconsumed tensors (i.e) * outputs which are not inputs to any * layer (basically dead ends) to be marked * for output * * @return The current instance of SNPEBuilder. */ SNPEBuilder& setUnconsumedTensorsAsOutputs( bool setOutput); }; /** @} */ /* end_addtogroup c_plus_plus_apis C++ */ }} #endif
C++
5
Neptos/openpilot
phonelibs/snpe/include/SNPE/SNPEBuilder.hpp
[ "MIT" ]
; RUN: llc -march=sparc < %s | grep weak define weak i32 @func() nounwind { entry: ret i32 0 }
LLVM
3
randolphwong/mcsema
llvm-3.5/test/CodeGen/SPARC/2009-08-28-WeakLinkage.ll
[ "BSD-3-Clause" ]
@import "~common/stylesheet/index"; .divider { position: relative; z-index: 97; &:after { position: absolute; background-color: $theme-light; content: ''; } &.horizontal { width: 7px; margin: 0 -3px; cursor: ew-resize; &:after { top: 0; bottom: 0; left: 3px; width: 1px; } } &.vertical { height: 7px; margin: -3px 0; cursor: ns-resize; &:after { left: 0; right: 0; top: 3px; height: 1px; } } }
SCSS
3
ljx0305/algorithm-visualizer
src/components/Divider/Divider.module.scss
[ "MIT" ]
function omf.check.version -a min_version -a current_version test (echo "$min_version"\n"$current_version" | tr '.' ' ' | sort -n | head -n1) = (echo "$min_version" | tr '.' ' ') end
fish
3
codetriage-readme-bot/oh-my-fish
pkg/omf/functions/util/omf.check.version.fish
[ "MIT" ]
#%RAML 1.0 Library uses: pragma: pragma.raml types: NumberRange: properties: begin: type: number format: int64 end: type: number format: int64 OfferResource: properties: name: type: string description: The name of the resource. role: type: string description: The role this resource is assigned to. scalar?: type: number format: double description: The scalar value of the resource. ranges?: (pragma.forceOptional): type: NumberRange[] description: The range value of the resource. set?: (pragma.forceOptional): type: string[] description: all values of this resource. AgentAttribute: properties: name: type: string description: The name of the attribute. text?: type: string description: The text value of this attribute scalar?: type: number description: The scalar value of the attribute. ranges?: (pragma.forceOptional): type: NumberRange[] description: The range value of the attribute. set?: (pragma.forceOptional): type: string[] description: all values of this attribute. Offer: properties: id: type: string description: The id of this offer hostname: type: string description: the hostname of the agent agentId: type: string description: the id of the agent resources: type: OfferResource[] description: all offered ressources attributes: type: AgentAttribute[] description: all attributes of the agent
RAML
4
fquesnel/marathon
docs/docs/rest-api/public/api/v2/types/offer.raml
[ "Apache-2.0" ]
const createTestCases = require("../_helpers/createTestCases"); module.exports = createTestCases({ nothing: { usedExports: [], expect: { "@angular/core": ["ɵccf", "ɵcrt", "ɵdid", "ɵeld", "ɵted", "ɵvid"], "./app.component": ["AppComponent"] } }, AppComponentNgFactory: { usedExports: ["AppComponentNgFactory"], expect: { "@angular/core": ["ɵccf", "ɵcrt", "ɵdid", "ɵeld", "ɵted", "ɵvid"], "./app.component": ["AppComponent"] } } });
JavaScript
3
1shenxi/webpack
test/configCases/inner-graph/importAll/webpack.config.js
[ "MIT" ]
; CLW file contains information for the MFC ClassWizard [General Info] Version=1 ClassCount=1 Class1=CMFCBlackMoonApp LastClass=CMFCBlackMoonApp NewFileInclude2=#include "..\MFCObj\MFCBlackMoon.h" ResourceCount=0 NewFileInclude1=#include "..\MFCObj\StdAfx.h" [CLS:CMFCBlackMoonApp] Type=0 HeaderFile=..\MFCObj\MFCBlackMoon.h ImplementationFile=..\MFCObj\MFCBlackMoon.cpp Filter=N BaseClass=CWinApp VirtualFilter=AC
Clarion
2
ggp0818/BlackMoonKernelStaticLib
Project/MFCBlackMoon_VC6.clw
[ "BSD-3-Clause" ]
f// RUN: %target-typecheck-verify-swift -parse -parse-stdlib -disable-availability-checking -verify-syntax-tree import Swift class Klass {} func argumentsAndReturns(@_noImplicitCopy _ x: Klass) -> Klass { return x } func letDecls(@_noImplicitCopy _ x: Klass) -> () { @_noImplicitCopy let y: Klass = x print(y) } func varDecls(@_noImplicitCopy _ x: Klass, @_noImplicitCopy _ x2: Klass) -> () { @_noImplicitCopy var y: Klass = x y = x2 print(y) } func getKlass() -> Builtin.NativeObject { let k = Klass() let b = Builtin.unsafeCastToNativeObject(k) return Builtin.move(b) } @_noImplicitCopy var g: Builtin.NativeObject = getKlass() @_noImplicitCopy let g2: Builtin.NativeObject = getKlass()
Swift
3
xjc90s/swift
test/Parse/noimplicitcopy_attr.swift
[ "Apache-2.0" ]
/****************************************************************************** * Copyright 2020 The Apollo Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * 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. *****************************************************************************/ #include "modules/drivers/smartereye/smartereye_device.h" #include <time.h> #include <cmath> #include <string> #define CLEAR(x) memset(&(x), 0, sizeof(x)) namespace apollo { namespace drivers { namespace smartereye { SmartereyeDevice::SmartereyeDevice() {} SmartereyeDevice::~SmartereyeDevice() { uninit(); } bool SmartereyeDevice::init(const std::shared_ptr<Config>& camera_config) { pcamera_ = StereoCamera::connect("192.168.1.251"); pcameraHandler_ = new SmartereyeHandler("camera A"); pcamera_->enableTasks(TaskId::ObstacleTask | TaskId::DisplayTask); inited_ = true; return true; } bool SmartereyeDevice::SetCallback(CallbackFunc ptr) { pcameraHandler_->SetCallback(ptr); return true; } int SmartereyeDevice::poll() { pcamera_->requestFrame(pcameraHandler_, FrameId::Compound); is_capturing_ = true; return 1; } int SmartereyeDevice::uninit() { if (!inited_) { return 1; } pcamera_->disconnectFromServer(); is_capturing_ = false; inited_ = false; return 1; } bool SmartereyeDevice::is_capturing() { return is_capturing_; } bool SmartereyeDevice::wait_for_device() { if (is_capturing_) { ADEBUG << "is capturing"; return true; } return true; } } // namespace smartereye } // namespace drivers } // namespace apollo
C++
4
jzjonah/apollo
modules/drivers/smartereye/smartereye_device.cc
[ "Apache-2.0" ]
5eXl5uXk5eTl5eXl5eXm5eXl5eXl5ebl5ufl5efl5ebm5+bm5ubm5ebm5ufm5ufm 5uXm5+bl5+bl5ufm5+bm5ebn5ufm5ubn5+bm5+bm6Ofn5+fm6Ofn5+jn5ubn6Ofn 5+fm5+fn5+fn6Ofo5ujo5+fo5+fn6Ofo6Ojn6Ojn5+nn5+fn5+jn5+fo5+fo6Ojn 6Ofn5+np6Ofo5ufo6Ojn6Ojn6Ojn5+no5+bn6Ofn5+fn5ufn5+fo5+fo5+fm6Obn 6Ofn5+jo6Ofo6Ojn6Ojo6Ono6eno6ejo5+jo6Ojo6Ono6Ono5Ofo6Ono6ejo6Orp 6ejp6enp6Ojo6Onq6Onp6ejo6eno6enp6eno6ejp6Onp6enp6unp6eno6Onp6unp 6ejp6enq6ejp6unp6enp6Ono6eno6uno6enp6Orp6enq6uno6unp6enp6erp6Orq 6Onq6eno6unp6unp6urp6urq6enp6urq6uno6urp6erp6erq6urp6urq6erq6uvr 6erq6enq6ejq6urp6uvr6erq6urp6unq6unq6Orp6+nq6unp6err6unp6+rp6urp 6ejq6erp6enp6erp6erp6eno6ujp6unq6+rq6urp6+vq6uvr6urq6urp6+rq6urr 6+nq6unq6urq6uvr6+rq6uvr6+rq6uvq6+rr6urr6uvr6+vr6+vq6+vr6+zr6+vr 6+zr6+rr6uvr6+rr6urq6+vr6uzr6+zs6+zs6+zr6+zs7Ovr7Ozr7O3r7Ozs7Ozs 7e3s7ezr6+3r7Ozs7e3t7O7t7O3t7ezt7u3t7u3t7u3t7+/t7e7u7+7u7+3u7+7v 7u7u7u7v7+/w7u/v7/Dv7+/w7+/v7u/w7+/w8O/w8PDw8PDw8PHy8PHw8PHx8PLx 8fLx8vGVjoV7dW1kYmJYVlRVVFRWVldZW1xdYGJjZmlqbG5wcnZ3en1+gYKFh4qL jY6OkZKTlJaXmZqdnqGjpqipq6yur7Gxs7S0tLa2uLm5u7u9vr7AwMHCw8PDxsbI ycrJy8zNz8/S09PU1dfX2dnZ2dja2tra2tvb2tra2tvb29rb3Nzd3d3d3t/e3d/f 3t/f39/f197f39/f3+Df39/e3t7e3t/f3d7d3t7e397e39/e3uDg4ODg4OHh4ODg 4d/f3+De3uDf39/g3d7d3Nza29va2tja2tnZ2NjW1tjX1tbW1tXU1dXV1dXV1dXV 1dXW1dTT09PS0tLS0dHS0NHR09PS09LT0tTU1NPT0tPT09TS09PT0tLR09PT09PT 09TU1NTU1NTU1dXV1dXU1dXV1dXV1dXW1tXX2NfX19fX2djZ2dnZ2drZ2tvb2trb 29vc29vb29vc3Nzd3N7d3d/e3d7e397f3t7e39/f3uDg3t/g4OHg4ODh4d/h4OHh 4OHh4eHh4eHi4uLi4uLj4ePi4+Li4uPj4+Pi4uPj4+Pj4+Ti5OPj4+Xj5eTk5OTk 5OXj5OTk5OTk5OTk5OTj5OPj4+Tk5OTj5uXl5OXl5OTl5eTl5OXl5ebl5ebk5eXl 5ubk5OXn5ubl5eXl5uXl5+Xk5eXl5ebl5ebm5ubl5uXm5ufn5uXn5ubn5ubm5+fm 5ubl5ubn5ufm5ufm5ujn5ubn5+fn5ufm5+jo6Ofn5ubm5+bm5+fn5ufn5+fo6Ofo 5+bn5+jn5ujn5+fn5+fo6Ofo6Ojn6Ofo6Ofn6Ojp5ufo6Ojo6ejn6efn6eno6ejo 6Ojo5+fn6Ojp6Ojo6ejo5+no6Ojo6Ofo5+fo6Onp6Ojn6Obn6Ofm5+fn6Ojn6Ojo 5+jo6Ojo5+jo6Ofo6Onp6Ojo6Ojn6Ojo6Ojo6eno6ejo6enp6Ojp6ejp6unp6Onp 6enp6Onp6Onp6eno6Ono6enp6enp6Ono6enp6OXp6Ojq6ero6unp6unp6enp6unp 6unp6eno6enp6urq6enp6enq6unq6enp6erq6urq6unq6unp6Orp6enp6erq6erp 6erp6urq6urq6enq6+rp6urq6unp6ujp6unq6enq6evq6unq6unq6uvq6unq6urq 6+vp6ujq6unq6urp6unq6unp6+rq6evq6urp6unq6+rq6urq6erp6urr6+nq6urp 6unq6+nq6erp6erq6erq6erp6urq6urq6evq6enp6enp6ero6unq6+nr6urq6+rr 6urq6uvr6urq6+vr6+vq6+zq6+vr6+vq6urr6+rr6+vr6urr6urq6+zr6+rq6+vr 6+vr6uzt6uvr6+vr6+vr7Ovs6+vs6+zs6+vs6+rr6+rr6+vr6+vr6+vr6+zr6+zt 7Ozr7Ovr7Ovr6+zt6+zs7e3t7O3s7O3t7ezt7O3t7ezs7O3u7ezt7O3s7u3t7e3u 7ezu7e3u7e/u7u3u7+3u7u/u7u/v7u/u7+/v8O/v7+/v7+/v8PDv7/Dv7+7v7/Dx 8PDw8PDx8PHv8fHy8PHw8fDx8fHw8fHy8vLy8qOdlpGLhH56dXRycHFxcnR1d3l6 fH+ChIeJi42PkpSWmZyfoaKmqKqrra+vsLK0s7W3uLm6vL2+wMLExcfGyMrKzczN zs/OztDQ0tLT09TV1tbW1dfY2NfY2dra2trc3Nzd3N7e3t7e39/f39/f4ODg4ODg 4eHg3+Hh4eDg4OHg4ODh4uHh4OHh4uHh4eHj4eHi4OHh4uHi4eDh4eHg4eHh4eHi 4eHg4eHg4eDi4eLg4eLj4+Li4+Li4+Hi4eLg4eHh4uHi4uLh4OHg4eDh4N/e4ODf 4ODf397e3d/f3d7f393e3t/d3t7d3d7d3d3d3d3d3tze3d3c3tzb3d3d3Nzc3N3d 3d3e3d3d3d3d3d3d3t7e3tze3d3e3d3e3dzf3d7e3d7d3t7d3t7e3t7e3t7e3t7f 3eDg3+Df4N/f4ODf4N/g4N/g4ODh4OHh4eHg4eDi4eHi4OHh4uHh4uLh4eLi4uLj 4eLj4uLj4+Lh4uPj5OLj5OLj5OPk4+Tk4uPj4+Tj4+Ti5OPk4+Pj5OTl5OXj5OTj 5OPk4+Tk5OXk5eXl5eXl5ubm5eXl5eXm5uXk5eTl5ubl5eXk5Obl5eTj5OXl5OTl 5uXm5ubl4+bl5uXl5ebk5uXl5eXm5uTm5ubn5ubm5uXn5ubm5ufl5ebm5uXm5+Xm 5ufm5+fm5ebm5ubn5ujn5ubl5ubn5ufn5ufn5+fn6Ojn5+fn5+jn5+fm5ufm5+fo 5+fn5+nn5ufn5+bm6Ofm6Ojn5+jo6ejn6Ofp6Ojo5+jo6ejo6Ojn5+jp6ejo6Ojo 6eno6Ojo6Onp6efn6ejo6Ojo6ejo6enp6Ojo6ejo6eno6ejp6eno6ejo6Ojn6Ono 6Ojp6enp6Ojp5+fo6Ojn6Ojo6ejo6ejo6enp6Ofo6ejo6ejp6Ojo6eno6ejp6erp 6Ono6Ojo6eno6eno6enq6erp6uno6ero6Orp6unp6erp6unq6unq6urp6uno6ero 6Orp5eno6erq6urp6unp6erp6Onr6erp6+nq6unq6enq6+nq6urp6urq6erp6urp 6urq6urq6urq6urq6+rp6+rq6uvq6Orq6unr6urs6urr6urp6unq6urq6urq6+rq 6erp6urp6urq6urq6urq6err6err6+rq6+rr6urq6+rr6urr6urq6+vq6uvq6+zq 6urr6uvr6+vq6+rr6urr6uvq6uvq6uvq6+vr6urq6err6evq6uvr6urr6urp6urq 6+rq6unp6urq6urq6urq6uvq6urq6+vr6+vr6+vr6uvs7Ovr6+rq6+vq6+vq6+vq 6+vq6+vr6urr6+zq6uzr6+zr6uvs6uvs6+zr6+zr6+zs6+vr6uzs7Ozs6+vq6+zr 6+zs6+zr6+zs6+zs7Ovr7Ovs7Ovs7Ozs7Ozs7Ozs7O3s7Ozs7Ozt7O3s7Ozs7u3t 7e3t7O3t7e3t7e3t7u3u7e3u7e3t7e3t7e7t7u7u7u7u7u3v7u3v7+/u7+7u7+7w 7+7u7u/w8O7v7+/w8O/x8PDv8PDw8fHw7/Dv8fHx8fDx8fHx8fHx8fHw8fHx8vLy 8vLxs6+qpqGcmJWRkI6Oj5CQkZOVl5mbnaCipKepq62wsrS2uLu9vsDDxMXGx8jI yszNzc7P0NDS0tLU1dXY2NjY2dnc3Nvc3Nzc3Nzd3d3d3t7e397e4N/f39/g4eHh 4OLg4eHh4eHi4eLh4uDh4uHi4eLi4uPi4+Hh4ePh4uHi4+Lh4uLj4uLi4uPi4uLj 4uPi4uLi4uLi4+Pi4uPi4uHi4uPj4uLj4uLi4uPh4eLi4uLi4+Li4+Pj4+Li4+Pj 4uLi4uLi4uPi4+Lh4uHi4uLi4uPi4eHi4eDh4eHf4eHh4eLi4OLh4ODg4eDh4eHh 4eDh4eDh4eLf4eHg4N/h4ODi4ODg4OHh4eDg4OHh4eDh4uDg4uHi4eLg4OHh4eDh 4OHg4uHh4eHh4eDg4eHi4eHi4eHi4eLh4uLi4uHi4uLi4uPj4uPj4uHi5OPk4+Pj 4+Pj4uPk5OLi5OPj4+Pk5OTi4+Pj5OPk5OPj5OPk5OPk5OTk5OXk5OTk4+Tl5eTk 5eXk4+Tk5OTk5OXk5OXl5eXk5eXm5eXk5OXk5uXl5ebl5uXl5ubn5eXm5ubl5ubm 5uXl5eXm5uXm5uXl5eXl5eXk5eXm5uXl5ubn5ubl5ubl5+Xm5ubm5ubn5ubn5efm 5+fm5ubn5+fn6Ofn5+fm5ufo5ubn5+bm5+fn5+fn5+fn5+jm6Ofn5ujn5+fn5+fn 6Ojo6Ojn6Ojn5+jo6Ofn6Ofo5+fn5+jo6Ofo5+jn5+jn5+jn5+jn6Ojo5+jo6Ono 5+no6Ofo6Ojo6Ofp6ejn6Ojo6Onn6Onp6enp6eno6efo5+jo6Ono6Ojo6enp6Ojo 6enp6enp6Ojq6Ojo6eno6Onp6ejp6unp6ujq6unq6enp6Ojp6Orp6Onp6enq6enq 6eno6Onp6eno6ejp6eno6Onp6erp6ejq6eno6erp6enp6enq6urp6Onq6unp6urp 6+nq6enp6enq6unp6erp6+nq6enp6unp6enp6erq6unr6uvq6erp6+rp6erp6unq 6urq6urp6urq6err6uvq6urq6urp6+rq6uvr6uvq6+rp6urq6urq6uvp6+nq6urr 6unq6+vq6+rr6urq6urq6uvq6urp6urq6urr6urq6urq6urr6+rr6urq6uvq6urr 6uvq6erq6uvr6+rr6urr7Ovq6uvr6+vr6+vq6+vr6+rq6+rr6+vr6urq6+vr6uvq 6uvq6+vq6+zq6uvr6+rq6uvq6+rq6urr6+vq6urq6+rq6urq6uvr6+vq6+rq6uvr 6+zr6+vr6uvr6+vr6+vs6+vr6+vr7Ozr7Orr7evr6+rr6uvs6+vr6+rq6+zs6+vs 7Ovs7Ozs7Ovs6+zs7Ozs7Ovs6+zs7Ovs7Ovs6+zs7O3s7Ovs7Ozr7Ozr7Ozs7Ozs 7O3s7O3s7e3t7Ozr7Ozs7uzt7ezs7O3t7uzs7e3t7uzt7ezu7e7t7u3u7u7u7e7u 7e7u7u/u7u/v7e/u7+7v7+/v7u/u7u/w7+/v7u/w7vHv7u/v7vDw8PDw8PHx8fHx 8PDw8fDx8PLx8vLx8fDw8fHy8vLy8vLy8/MAEAEAAAMAAAABBJcAAAEBAAMAAAAB Bt4AAAECAAMAAAABAAgAAAEDAAMAAAABAAEAAAEGAAMAAAABAAEAAAERAAQAAAAQ AB+FwAESAAMAAAABAAEAAAEVAAMAAAABAAEAAAEWAAMAAAABAG8AAAEXAAQAAAAQ AB+GAAEaAAUAAAABAB+GQAEbAAUAAAABAB+GSAEcAAMAAAABAAEAAAEoAAMAAAAB AAIAAAFTAAMAAAABAAEAAIdzAAcAAASkAB+GUAAAAAAAAAAIAAH9gQAD+voABfhz AAf17AAJ82UAC/DeAA3uVwAP69AAEelJABPmwgAV5DsAF+G0ABnfLQAb3KYAHdof AAH9eQAB/XkAAf15AAH9eQAB/XkAAf15AAH9eQAB/XkAAf15AAH9eQAB/XkAAf15 AAH9eQAB/XkAAf15AAGq2yWAAAAAIAAAJYAAAAAgAAAAAASkYXBwbAIgAABzY25y R1JBWVhZWiAH0wAHAAEAAAAAAABhY3NwQVBQTAAAAABub25lAAAAAAAAAAAAAAAA AAAAAAAA9tYAAQAAAADTLWFwcGyYcjd2/nI/x5EwPxA3BfUzAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAVkZXNjAAAA5AAAAEF3dHB0AAAAwAAAABRrVFJD AAAA1AAAAA5jcHJ0AAAEYAAAAEFkc2NtAAABKAAAAzZYWVogAAAAAAAA81EAAQAA AAEWzGN1cnYAAAAAAAAAAQHNAABkZXNjAAAAAAAAABVTY2FubmVyIEdyYXkgUHJv ZmlsZQAAAAAAAAAAAAAAFVNjYW5uZXIgR3JheSBQcm9maWxlAAAAAG1sdWMAAAAA AAAADwAAAAxlblVTAAAAKAAAAw5lc0VTAAAAMAAAAYpkYURLAAAAPAAAAjZkZURF AAAAOgAAAeJmaUZJAAAAMgAAAMRmckZVAAAALgAAATBpdElUAAAALAAAAuJubE5M AAAAKAAAAnJub05PAAAAKAAAAbpwdEJSAAAALgAAArRzdlNFAAAAOgAAAPZqYUpQ AAAAGgAAAV5rb0tSAAAAGgAAApp6aFRXAAAAEgAAAXh6aENOAAAAGgAAAhwAUwBr AGEAbgBuAGUAcgBpAG4AIABIAGEAcgBtAGEAYQAtAHAAcgBvAGYAaQBpAGwAaQBH AHIA5QBzAGsAYQBsAGUAcAByAG8AZgBpAGwAIABmAPYAcgAgAEIAaQBsAGQAbADk AHMAYQByAGUAUAByAG8AZgBpAGwAIABHAHIAaQBzACAAZAB1ACAAUwBjAGEAbgBu AGUAdQByMLkwrTDjMMowsDDsMKQw1zDtMNUwoTCkMOtjg2PPVmhwcJaOgnJfaWPP j/AAUABlAHIAZgBpAGwAIABHAHIAaQBzACAAcABhAHIAYQAgAEUAcwBjAOEAbgBl AHIARwByAOUAdABvAG4AZQBzAGsAYQBuAG4AZQByAHAAcgBvAGYAaQBsAEcAcgBh AHUAcwB0AHUAZgBlAG4ALQBQAHIAbwBmAGkAbAAgAGYA/AByACAAUwBjAGEAbgBu AGUAcmJrY89O6gAgAEcAcgBhAHkAIGPPj/Blh072AEcAcgDlAHQAbwBuAGUAYgBl AHMAawByAGkAdgBlAGwAcwBlACAAdABpAGwAIABTAGMAYQBuAG4AZQByAEcAcgBp AGoAcwBwAHIAbwBmAGkAZQBsACAAUwBjAGEAbgBuAGUAcsKkzpCxCAAgAEcAcgBh AHkAINUEuFzTDMd8AFAAZQByAGYAaQBsACAAQwBpAG4AegBhACAAZABlACAAUwBj AGEAbgBuAGUAcgBQAHIAbwBmAGkAbABvACAARwByAGkAZwBpAG8AIABTAGMAYQBu AG4AZQByAFMAYwBhAG4AbgBlAHIAIABHAHIAYQB5ACAAUAByAG8AZgBpAGwAZQAA dGV4dAAAAABDb3B5cmlnaHQgMjAwMyBBcHBsZSBDb21wdXRlciBJbmMuLCBhbGwg cmlnaHRzIHJlc2VydmVkLgAAAAA=
Max
0
randolphwong/mcsema
boost/libs/algorithm/test/search_test_data/0002e.pat
[ "BSD-3-Clause" ]
.class public final LQQPIM/SoftListType; .super Ljava/lang/Object; # static fields .field public static final BLACKLIST_ROM:LQQPIM/SoftListType; .field public static final BLACKLIST_ROM_THIRDPART:LQQPIM/SoftListType; .field public static final BLACKLIST_WITHPLUGIN:LQQPIM/SoftListType; .field public static final WHITELIST_COMMON:LQQPIM/SoftListType; .field public static final WHITELIST_ROM:LQQPIM/SoftListType; .field public static final WHITELIST_UNUSUAL:LQQPIM/SoftListType; .field public static final _BLACKLIST_ROM:I = 0x2 .field public static final _BLACKLIST_ROM_THIRDPART:I = 0x4 .field public static final _BLACKLIST_WITHPLUGIN:I = 0x3 .field public static final _WHITELIST_COMMON:I = 0x0 .field public static final _WHITELIST_ROM:I = 0x5 .field public static final _WHITELIST_UNUSUAL:I = 0x1 .field static final synthetic a:Z .field private static b:[LQQPIM/SoftListType; # instance fields .field private c:I .field private d:Ljava/lang/String; # direct methods .method static constructor <clinit>()V .locals 7 const/4 v6, 0x4 const/4 v5, 0x3 const/4 v4, 0x2 const/4 v1, 0x1 const/4 v2, 0x0 const-class v0, LQQPIM/SoftListType; invoke-virtual {v0}, Ljava/lang/Class;->desiredAssertionStatus()Z move-result v0 if-nez v0, :cond_0 move v0, v1 :goto_0 sput-boolean v0, LQQPIM/SoftListType;->a:Z const/4 v0, 0x6 new-array v0, v0, [LQQPIM/SoftListType; sput-object v0, LQQPIM/SoftListType;->b:[LQQPIM/SoftListType; new-instance v0, LQQPIM/SoftListType; const-string v3, "WHITELIST_COMMON" invoke-direct {v0, v2, v2, v3}, LQQPIM/SoftListType;-><init>(IILjava/lang/String;)V sput-object v0, LQQPIM/SoftListType;->WHITELIST_COMMON:LQQPIM/SoftListType; new-instance v0, LQQPIM/SoftListType; const-string v2, "WHITELIST_UNUSUAL" invoke-direct {v0, v1, v1, v2}, LQQPIM/SoftListType;-><init>(IILjava/lang/String;)V sput-object v0, LQQPIM/SoftListType;->WHITELIST_UNUSUAL:LQQPIM/SoftListType; new-instance v0, LQQPIM/SoftListType; const-string v1, "BLACKLIST_ROM" invoke-direct {v0, v4, v4, v1}, LQQPIM/SoftListType;-><init>(IILjava/lang/String;)V sput-object v0, LQQPIM/SoftListType;->BLACKLIST_ROM:LQQPIM/SoftListType; new-instance v0, LQQPIM/SoftListType; const-string v1, "BLACKLIST_WITHPLUGIN" invoke-direct {v0, v5, v5, v1}, LQQPIM/SoftListType;-><init>(IILjava/lang/String;)V sput-object v0, LQQPIM/SoftListType;->BLACKLIST_WITHPLUGIN:LQQPIM/SoftListType; new-instance v0, LQQPIM/SoftListType; const-string v1, "BLACKLIST_ROM_THIRDPART" invoke-direct {v0, v6, v6, v1}, LQQPIM/SoftListType;-><init>(IILjava/lang/String;)V sput-object v0, LQQPIM/SoftListType;->BLACKLIST_ROM_THIRDPART:LQQPIM/SoftListType; new-instance v0, LQQPIM/SoftListType; const/4 v1, 0x5 const/4 v2, 0x5 const-string v3, "WHITELIST_ROM" invoke-direct {v0, v1, v2, v3}, LQQPIM/SoftListType;-><init>(IILjava/lang/String;)V sput-object v0, LQQPIM/SoftListType;->WHITELIST_ROM:LQQPIM/SoftListType; return-void :cond_0 move v0, v2 goto :goto_0 .end method .method private constructor <init>(IILjava/lang/String;)V .locals 1 invoke-direct {p0}, Ljava/lang/Object;-><init>()V new-instance v0, Ljava/lang/String; invoke-direct {v0}, Ljava/lang/String;-><init>()V iput-object v0, p0, LQQPIM/SoftListType;->d:Ljava/lang/String; iput-object p3, p0, LQQPIM/SoftListType;->d:Ljava/lang/String; iput p2, p0, LQQPIM/SoftListType;->c:I sget-object v0, LQQPIM/SoftListType;->b:[LQQPIM/SoftListType; aput-object p0, v0, p1 return-void .end method .method public static convert(I)LQQPIM/SoftListType; .locals 2 const/4 v0, 0x0 :goto_0 sget-object v1, LQQPIM/SoftListType;->b:[LQQPIM/SoftListType; array-length v1, v1 if-ge v0, v1, :cond_1 sget-object v1, LQQPIM/SoftListType;->b:[LQQPIM/SoftListType; aget-object v1, v1, v0 invoke-virtual {v1}, LQQPIM/SoftListType;->value()I move-result v1 if-ne v1, p0, :cond_0 sget-object v1, LQQPIM/SoftListType;->b:[LQQPIM/SoftListType; aget-object v0, v1, v0 :goto_1 return-object v0 :cond_0 add-int/lit8 v0, v0, 0x1 goto :goto_0 :cond_1 sget-boolean v0, LQQPIM/SoftListType;->a:Z if-nez v0, :cond_2 new-instance v0, Ljava/lang/AssertionError; invoke-direct {v0}, Ljava/lang/AssertionError;-><init>()V throw v0 :cond_2 const/4 v0, 0x0 goto :goto_1 .end method .method public static convert(Ljava/lang/String;)LQQPIM/SoftListType; .locals 2 const/4 v0, 0x0 :goto_0 sget-object v1, LQQPIM/SoftListType;->b:[LQQPIM/SoftListType; array-length v1, v1 if-ge v0, v1, :cond_1 sget-object v1, LQQPIM/SoftListType;->b:[LQQPIM/SoftListType; aget-object v1, v1, v0 invoke-virtual {v1}, LQQPIM/SoftListType;->toString()Ljava/lang/String; move-result-object v1 invoke-virtual {v1, p0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v1 if-eqz v1, :cond_0 sget-object v1, LQQPIM/SoftListType;->b:[LQQPIM/SoftListType; aget-object v0, v1, v0 :goto_1 return-object v0 :cond_0 add-int/lit8 v0, v0, 0x1 goto :goto_0 :cond_1 sget-boolean v0, LQQPIM/SoftListType;->a:Z if-nez v0, :cond_2 new-instance v0, Ljava/lang/AssertionError; invoke-direct {v0}, Ljava/lang/AssertionError;-><init>()V throw v0 :cond_2 const/4 v0, 0x0 goto :goto_1 .end method # virtual methods .method public final toString()Ljava/lang/String; .locals 1 iget-object v0, p0, LQQPIM/SoftListType;->d:Ljava/lang/String; return-object v0 .end method .method public final value()I .locals 1 iget v0, p0, LQQPIM/SoftListType;->c:I return v0 .end method
Smali
3
jarekankowski/pegasus_spyware
sample4/decompiled_raw/smali/QQPIM/SoftListType.smali
[ "MIT" ]
6 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 #Last line differs 0 0 1 # # Created by Chaste version 2.2.12763 on Wed, 25 May 2011 15:36:59 +0000. Chaste was built on Wed, 25 May 2011 15:36:50 +0000 by machine (uname) 'Linux userpc58.comlab.ox.ac.uk 2.6.24-28-generic #1 SMP Thu Sep 16 14:18:43 UTC 2010 x86_64' using settings: default, no Chaste libraries.
NetLinx
1
mdp19pn/Chaste
heart/test/data/fibre_tests/SimpleAxisymmetric.axi
[ "Apache-2.0", "BSD-3-Clause" ]
main() { undefined; new x = 0; new y; y = 123; }
PAWN
0
pawn-lang/pawn
source/compiler/tests/reset_errline_gh_230.pwn
[ "Zlib" ]
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 job.name 'GoraStorage test' ; register gora/*.jar ; webpage = LOAD '.' USING org.apache.gora.pig.GoraStorage('{ "persistentClass": "com.example.WebPage", "fields": "baseUrl,status,content" }') ; dump webpage ;
PigLatin
3
nbrendah/gora
gora-pig/src/test/examples/example.pig
[ "Apache-2.0" ]
import React from 'react'; import { mount } from 'enzyme'; import Drawer from '..'; import Button from '../../button'; class DrawerEventTester extends React.Component { constructor(props) { super(props); this.state = { visible: false }; } componentDidMount() { this.setState({ visible: true }); // eslint-disable-line react/no-did-mount-set-state } onClose = () => { this.setState({ visible: false, }); }; open = () => { this.setState({ visible: true, }); }; render() { const { visible } = this.state; return ( <div> <Button onClick={this.open}>open</Button> <Drawer visible={visible} onClose={this.onClose} getContainer={false} {...this.props}> Here is content of Drawer </Drawer> </div> ); } } describe('Drawer', () => { it('render correctly', () => { const wrapper = mount(<DrawerEventTester />); const body = wrapper.find('.ant-drawer-body').exists(); expect(body).toBe(true); wrapper.find('button.ant-btn').simulate('click'); const content = wrapper.find('.ant-drawer-body').getDOMNode().innerHTML; expect(content).toBe('Here is content of Drawer'); expect(wrapper.render()).toMatchSnapshot(); }); it('mask trigger onClose', () => { const wrapper = mount(<DrawerEventTester />); wrapper.find('button.ant-btn').simulate('click'); expect(wrapper.instance().state.visible).toBe(true); wrapper.find('.ant-drawer-mask').simulate('click'); expect(wrapper.instance().state.visible).toBe(false); }); it('close button trigger onClose', () => { const wrapper = mount(<DrawerEventTester />); wrapper.find('button.ant-btn').simulate('click'); expect(wrapper.instance().state.visible).toBe(true); wrapper.find('.ant-drawer-close').simulate('click'); expect(wrapper.instance().state.visible).toBe(false); }); it('maskClosable no trigger onClose', () => { const wrapper = mount(<DrawerEventTester maskClosable={false} />); wrapper.find('button.ant-btn').simulate('click'); expect(wrapper.instance().state.visible).toBe(true); wrapper.find('.ant-drawer-mask').simulate('click'); expect(wrapper.instance().state.visible).toBe(true); }); it('dom should be removed after close when destroyOnClose is true', () => { const wrapper = mount(<DrawerEventTester destroyOnClose />); wrapper.find('button.ant-btn').simulate('click'); expect(wrapper.find('.ant-drawer-wrapper-body').exists()).toBe(true); wrapper.setState({ visible: false, }); wrapper.find('.ant-drawer-wrapper-body').simulate('transitionend'); expect(wrapper.find('.ant-drawer-wrapper-body').exists()).toBe(false); }); it('dom should be existed after close when destroyOnClose is false', () => { const wrapper = mount(<DrawerEventTester />); wrapper.find('button.ant-btn').simulate('click'); expect(wrapper.find('.ant-drawer-wrapper-body').exists()).toBe(true); wrapper.setState({ visible: false, }); wrapper.find('.ant-drawer-wrapper-body').simulate('transitionend'); expect(wrapper.find('.ant-drawer-wrapper-body').exists()).toBe(true); }); it('no mask and no closable', () => { const wrapper = mount(<DrawerEventTester destroyOnClose />); wrapper.find('button.ant-btn').simulate('click'); expect(wrapper.instance().state.visible).toBe(true); wrapper.find('.ant-drawer-close').simulate('click'); expect(wrapper.instance().state.visible).toBe(false); }); });
JavaScript
4
vazhalomidze/ant-design
components/drawer/__tests__/DrawerEvent.test.js
[ "MIT" ]
<?xml version="1.0" encoding="UTF-8"?> <!-- ******************************************************************* --> <!-- --> <!-- Copyright IBM Corp. 2010, 2014 --> <!-- --> <!-- 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. --> <!-- --> <!-- ******************************************************************* --> <!-- DO NOT EDIT. THIS FILE IS GENERATED. --> <faces-config> <faces-config-extension> <namespace-uri>http://www.ibm.com/xsp/coreex</namespace-uri> <default-prefix>xe</default-prefix> <designer-extension> <control-subpackage-name>rpc</control-subpackage-name> </designer-extension> </faces-config-extension> <component> <description>%component.jsonRpcService.descr%</description> <display-name>%component.jsonRpcService.name%</display-name> <component-type>com.ibm.xsp.extlib.rpc.JsonRpcService</component-type> <component-class>com.ibm.xsp.extlib.component.rpc.UIJsonRpcService</component-class> <property> <description>%property.pathInfo.descr%</description> <display-name>%property.pathInfo.name%</display-name> <property-name>pathInfo</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>basics</category> </designer-extension> </property-extension> </property> <property> <description>%property.serviceName.descr%</description> <display-name>%property.serviceName.name%</display-name> <property-name>serviceName</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <category>basics</category> </designer-extension> </property-extension> </property> <property> <description>%property.methods.descr%</description> <display-name>%property.methods.name%</display-name> <property-name>methods</property-name> <property-class>java.util.List</property-class> <property-extension> <allow-run-time-binding>false</allow-run-time-binding> <collection-property>true</collection-property> <property-item-class>com.ibm.xsp.extlib.component.rpc.RemoteMethod</property-item-class> <property-add-method>addMethod</property-add-method> <designer-extension> <category>basics</category> </designer-extension> </property-extension> </property> <property> <description>%property.state.descr%</description> <display-name>%property.state.name%</display-name> <property-name>state</property-name> <property-class>boolean</property-class> <property-extension> <designer-extension> <category>basics</category> </designer-extension> </property-extension> </property> <component-extension> <component-family>com.ibm.xsp.extlib.JsonRpcService</component-family> <renderer-type>com.ibm.xsp.extlib.rpc.JsonRpcService</renderer-type> <tag-name>jsonRpcService</tag-name> <designer-extension> <in-palette>true</in-palette> <category>Data Access</category> <render-markup>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&#xd; &lt;xp:view xmlns:xp="http://www.ibm.com/xsp/core"&gt;&#xd; &lt;xp:image url="/extlib/designer/markup/RPC.png" id="image1"&gt;&lt;/xp:image&gt;&#xd; &lt;/xp:view&gt;&#xd; </render-markup> </designer-extension> </component-extension> </component> <complex-type> <description>%complex-type.remoteMethod.descr%</description> <display-name>%complex-type.remoteMethod.name%</display-name> <complex-id>com.ibm.xsp.extlib.component.rpc.RemoteMethod</complex-id> <complex-class>com.ibm.xsp.extlib.component.rpc.RemoteMethod</complex-class> <property> <description>%property.name.complex-type.remoteMethod.descr%</description> <display-name>%property.name.complex-type.remoteMethod.name%</display-name> <property-name>name</property-name> <property-class>java.lang.String</property-class> </property> <property> <description>%property.arguments.descr%</description> <display-name>%property.arguments.name%</display-name> <property-name>arguments</property-name> <property-class>java.util.List</property-class> <property-extension> <allow-run-time-binding>false</allow-run-time-binding> <collection-property>true</collection-property> <property-item-class>com.ibm.xsp.extlib.component.rpc.RemoteMethodArgument</property-item-class> <property-add-method>addArgument</property-add-method> </property-extension> </property> <property> <description>%property.script.descr%</description> <display-name>%property.script.name%</display-name> <property-name>script</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <editor>com.ibm.std.MultiLine</editor> </designer-extension> </property-extension> </property> <complex-extension> <tag-name>remoteMethod</tag-name> </complex-extension> </complex-type> <complex-type> <description>%complex-type.remoteMethodArg.descr%</description> <display-name>%complex-type.remoteMethodArg.name%</display-name> <complex-id>com.ibm.xsp.extlib.component.rpc.RemoteMethodArgument</complex-id> <complex-class>com.ibm.xsp.extlib.component.rpc.RemoteMethodArgument</complex-class> <property> <description>%property.name.complex-type.remoteMethodArg.descr%</description> <display-name>%property.name.complex-type.remoteMethodArg.name%</display-name> <property-name>name</property-name> <property-class>java.lang.String</property-class> </property> <property> <description>%property.type.descr%</description> <display-name>%property.type.name%</display-name> <property-name>type</property-name> <property-class>java.lang.String</property-class> <property-extension> <designer-extension> <editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor> <editor-parameter> string boolean number list </editor-parameter> </designer-extension> </property-extension> </property> <complex-extension> <tag-name>remoteMethodArg</tag-name> </complex-extension> </complex-type> </faces-config>
XPages
3
jesse-gallagher/XPagesExtensionLibrary
extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.controls/src/com/ibm/xsp/extlib/config/extlib-rpc.xsp-config
[ "Apache-2.0" ]
(* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) module Ast = Flow_ast module Flow = Flow_js open Reason open Type module Make (Env : Env_sig.S) (Destructuring : Destructuring_sig.S) (Statement : Statement_sig.S with module Env := Env) : Func_stmt_config_sig.S = struct type 'T ast = (ALoc.t, 'T) Ast.Function.Params.t type 'T param_ast = (ALoc.t, 'T) Ast.Function.Param.t type 'T rest_ast = (ALoc.t, 'T) Ast.Function.RestParam.t type 'T this_ast = (ALoc.t, 'T) Ast.Function.ThisParam.t type pattern = | Id of (ALoc.t, ALoc.t * Type.t) Ast.Pattern.Identifier.t | Object of { annot: (ALoc.t, ALoc.t * Type.t) Ast.Type.annotation_or_hint; properties: (ALoc.t, ALoc.t) Ast.Pattern.Object.property list; comments: (ALoc.t, ALoc.t Ast.Comment.t list) Ast.Syntax.t option; } | Array of { annot: (ALoc.t, ALoc.t * Type.t) Ast.Type.annotation_or_hint; elements: (ALoc.t, ALoc.t) Ast.Pattern.Array.element list; comments: (ALoc.t, ALoc.t Ast.Comment.t list) Ast.Syntax.t option; } type param = | Param of { t: Type.t; loc: ALoc.t; ploc: ALoc.t; pattern: pattern; default: (ALoc.t, ALoc.t) Ast.Expression.t option; has_anno: bool; } type rest = | Rest of { t: Type.t; loc: ALoc.t; ploc: ALoc.t; id: (ALoc.t, ALoc.t * Type.t) Ast.Pattern.Identifier.t; has_anno: bool; } type this_param = | This of { t: Type.t; loc: ALoc.t; annot: (ALoc.t, ALoc.t * Type.t) Ast.Type.annotation; } let param_type (Param { t; pattern; default; _ }) = match pattern with | Id id -> let { Ast.Pattern.Identifier.name = (_, { Ast.Identifier.name; _ }); optional; _ } = id in let t = if optional || default <> None then TypeUtil.optional t else t in (Some name, t) | _ -> let t = if default <> None then TypeUtil.optional t else t in (None, t) let rest_type (Rest { t; loc; id; _ }) = let { Ast.Pattern.Identifier.name = (_, { Ast.Identifier.name; _ }); _ } = id in (Some name, loc, t) let this_type (This { t; _ }) = t let subst_param cx map param = let (Param { t; loc; ploc; pattern; default; has_anno }) = param in let t = Flow.subst cx map t in Param { t; loc; ploc; pattern; default; has_anno } let subst_rest cx map rest = let (Rest { t; loc; ploc; id; has_anno }) = rest in let t = Flow.subst cx map t in Rest { t; loc; ploc; id; has_anno } let subst_this cx map (This { t; loc; annot }) = let t = Flow.subst cx map t in This { t; loc; annot } let bind cx name t loc = Scope.( if Context.enable_const_params cx then let kind = Entry.ConstParamBinding in Env.bind_implicit_const ~state:State.Initialized kind cx name t loc else Env.bind_implicit_let ~state:State.Initialized Entry.ParamBinding cx (OrdinaryName name) t loc ) let destruct cx ~use_op ~name_loc ~has_anno name default t = Base.Option.iter ~f:(fun d -> let reason = mk_reason (RIdentifier (OrdinaryName name)) name_loc in let default_t = Flow.mk_default cx reason d in Flow.flow cx (default_t, UseT (use_op, t))) default; let t_bound = if has_anno then Annotated t else Inferred t in bind cx name t_bound name_loc; t let eval_default cx = function | None -> None | Some e -> Some (Statement.expression cx ~hint:None e) let eval_param cx (Param { t; loc; ploc; pattern; default; has_anno }) = match pattern with | Id id -> let default = eval_default cx default in let () = match default with | None -> () | Some ((_, default_t), _) -> Flow.flow_t cx (default_t, t) in let () = let { Ast.Pattern.Identifier.name = ((loc, _), { Ast.Identifier.name; _ }); optional; _ } = id in let t = if optional && default = None then TypeUtil.optional t else t in let t = if has_anno then Annotated t else Inferred t in bind cx name t loc in (loc, { Ast.Function.Param.argument = ((ploc, t), Ast.Pattern.Identifier id); default }) | Object { annot; properties; comments } -> let default = eval_default cx default in let properties = let default = Base.Option.map default (fun ((_, t), _) -> Default.expr t) in let init = Destructuring.empty ?default t ~annot: (match annot with | Ast.Type.Missing _ -> false | Ast.Type.Available _ -> true) in let f = destruct cx ~has_anno in Destructuring.object_properties cx ~f init properties in ( loc, { Ast.Function.Param.argument = ((ploc, t), Ast.Pattern.Object { Ast.Pattern.Object.properties; annot; comments }); default; } ) | Array { annot; elements; comments } -> let default = eval_default cx default in let elements = let default = Base.Option.map default (fun ((_, t), _) -> Default.expr t) in let init = Destructuring.empty ?default t ~annot: (match annot with | Ast.Type.Missing _ -> false | Ast.Type.Available _ -> true) in let f = destruct cx ~has_anno in Destructuring.array_elements cx ~f init elements in ( loc, { Ast.Function.Param.argument = ((ploc, t), Ast.Pattern.Array { Ast.Pattern.Array.elements; annot; comments }); default; } ) let eval_rest cx (Rest { t; loc; ploc; id; has_anno }) = let () = let { Ast.Pattern.Identifier.name = ((loc, _), { Ast.Identifier.name; _ }); _ } = id in let t = if has_anno then Annotated t else Inferred t in bind cx name t loc in ( loc, { Ast.Function.RestParam.argument = ((ploc, t), Ast.Pattern.Identifier id); comments = None } ) let eval_this _ (This { t = _; annot; loc }) = (* this does not bind any parameters *) (loc, { Ast.Function.ThisParam.annot; comments = None }) end
OCaml
4
zhangmaijun/flow
src/typing/func_stmt_config.ml
[ "MIT" ]
CREATE TABLE public.message ( id uuid DEFAULT public.gen_random_uuid() NOT NULL, "timestamp" timestamp with time zone DEFAULT now() NOT NULL, title text NOT NULL, body text, device_token text NOT NULL ); ALTER TABLE ONLY public.message ADD CONSTRAINT message_pkey PRIMARY KEY (id);
SQL
4
gh-oss-contributor/graphql-engine-1
community/sample-apps/serverless-push/hasura/migrations/default/1613664119718_init/up.sql
[ "Apache-2.0", "MIT" ]
#lang scribble/manual @(require "defs.rkt") @title[#:style '(toc)]{Standard Library} Cur has a small standard library, primary for demonstration purposes. @local-table-of-contents[] @include-section{stdlib/datum.scrbl} @include-section{stdlib/sugar.scrbl} @include-section{stdlib/bool.scrbl} @include-section{stdlib/nat.scrbl} @include-section{stdlib/sigma.scrbl} @include-section{stdlib/maybe.scrbl} @include-section{stdlib/list.scrbl} @include-section{stdlib/equality.scrbl} @include-section{stdlib/ascii.scrbl} @include-section{stdlib/racket-ascii.scrbl} @include-section{stdlib/typeclass.scrbl}
Racket
4
bluephoenix47/cic-redex
cur-doc/cur/scribblings/stdlib.scrbl
[ "BSD-2-Clause" ]
# # # Nim's Runtime Library # (c) Copyright 2012 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. # when defined(nimdoc) and isMainModule: from std/compileSettings import nil when compileSettings.querySetting(compileSettings.SingleValueSetting.projectFull) == currentSourcePath: ## This is an include file that simply imports common modules for your convenience. runnableExamples: include std/prelude # same as: # import std/[os, strutils, times, parseutils, hashes, tables, sets, sequtils, parseopt] let x = 1 assert "foo $# $#" % [$x, "bar"] == "foo 1 bar" assert toSeq(1..3) == @[1, 2, 3] when not defined(js) or defined(nodejs): assert getCurrentDir().len > 0 assert ($now()).startsWith "20" # xxx `nim doc -b:js -d:nodejs --doccmd:-d:nodejs lib/pure/prelude.nim` fails for some reason # specific to `nim doc`, but the code otherwise works with nodejs. import std/[os, strutils, times, parseutils, hashes, tables, sets, sequtils, parseopt, strformat]
Nimrod
4
JohnAD/Nim
lib/pure/prelude.nim
[ "MIT" ]
BEGIN { # foo[10] = 0 # put this line in and it will work test(foo); print foo[1] test2(foo2); print foo2[1] } function test(foo) { test2(foo) } function test2(bar) { bar[1] = 1 }
Awk
3
Crestwave/goawk
testdata/gawk/arrayref.awk
[ "MIT" ]
# Aliases alias jrspec='jruby --debug -S rspec --debug' alias jprofile='jruby --profile.api -S rspec' alias jexec='jruby -S'
Shell
3
chensanle/ohmyzsh
plugins/jruby/jruby.plugin.zsh
[ "MIT" ]
[Files] Source: CompInstall.dll; DestDir: {app}; Flags: solidbreak [Code] type TIdeKind = (ikUnknown, ikDelphi, ikBCB); var LastInstalledIDEVersionNumber: Integer; function MapDesignPackage(IdeKind: TIdeKind; Version: Integer; const PackageName: string): string; forward; // user defined mapping function that maps the component name @PackageName to a full qualified DesignPackage file name function MapExpert(IdeKind: TIdeKind; Version: Integer; const ExpertName: string): string; forward; // user defined mapping function that maps the component name @PackageName to a full qualified IDE expert file name procedure GetSearchPaths(IdeKind: TIdeKind; Version: Integer; var SearchPaths, DebugPaths, BrowsePaths, IncludePaths: string); forward; // user defined function that returns a semicolon separated list of paths that the installer should add to the IDE paths procedure UserRegisterComponents(Components: TStrings); forward; // user defined function that does additional component registration. In Components[] is the list of selected wizard components procedure UserUnregisterComponents(Components: TStrings); forward; // user defined function that does additional component unregistration. In Components[] is the list of installed wizard components {----------------------------------------------------------} function GetDelphiDir(Version: string): string; begin Result := GetEnv('DELPHI' + Version); if Result = '' then Result := ExpandConstant('{app}') + '\bpl\d' + Version; end; function GetBCBBplDir(Version: string): string; begin Result := GetEnv('BCB' + Version + 'BPL'); if Result = '' then Result := ExpandConstant('{app}') + '\bpl\c' + Version; end; function GetDelphiBplDir(Version: string): string; begin Result := GetEnv('DELPHI' + Version + 'BPL'); if Result = '' then Result := ExpandConstant('{app}') + '\bpl\d' + Version; end; function GetBCBDir(Version: string): string; begin Result := GetEnv('BCB' + Version); if Result = '' then Result := ExpandConstant('{app}') + '\bpl\d' + Version; end; function GetDelphiRegKey(Version: string): string; begin Result := GetEnv('DELPHI' + Version + 'RegKey'); end; function GetBCBRegKey(Version: string): string; begin Result := GetEnv('BCB' + Version + 'RegKey'); end; function GetHPPDir(Version: string): string; begin Result := GetEnv('BDSCOMMONDIR' + Version); if Result = '' then Result := ExpandConstant('{app}') + '\HPP\d' + Version else Result := Result + '\HPP'; end; {----------------------------------------------------------} function StartsText(const SubStr, S: string): Boolean; begin Result := (Length(S) >= Length(SubStr)) and (CompareText(Copy(S, 1, Length(SubStr)), SubStr) = 0); end; function EndsText(const SubStr, S: string): Boolean; var Len: Integer; begin Len := Length(SubStr); Result := (Length(S) >= Len) and (CompareText(Copy(S, Length(S) - Len + 1, Len), SubStr) = 0); end; procedure GetSelectedList(List: TStrings; Prefix: string; Components: TStrings); var I, Len: Integer; begin Prefix := Prefix + '\'; Len := Length(Prefix); for I := 0 to Components.Count - 1 do if StartsText(Prefix, Components[I]) then List.Add(Copy(Components[I], Len + 1, Length(Components[I]))); end; procedure ExtractIdeInfo(const IdeName: string; var Kind: TIdeKind; var Version: Integer); begin Kind := ikUnknown; Version := 0; if StartsText('Delphi', IdeName) then begin Kind := ikDelphi; Version := StrToInt(Copy(IdeName, 7, Length(IdeName))); end else if StartsText('BCB', IdeName) then begin Kind := ikBCB; Version := StrToInt(Copy(IdeName, 4, Length(IdeName))); end; end; // ------------------- function compinst_init(): Integer; external 'compinst_init@files:CompInstall.dll stdcall'; function compinst_initUninstall(): Integer; external 'compinst_init@{app}\CompInstall.dll stdcall uninstallonly'; // install only function compinst_isDelphiInstalled(Version: Integer): Integer; external 'compinst_isDelphiInstalled@files:CompInstall.dll stdcall'; function compinst_isBCBInstalled(Version: Integer): Integer; external 'compinst_isBCBInstalled@files:CompInstall.dll stdcall'; function compinst_isBDSInstalled(IDEVersion: Integer): Integer; external 'compinst_isBDSInstalled@files:CompInstall.dll stdcall'; // design package function compinst_installDelphiDesignPackage(Version: Integer; BplFilename, Description: PChar): Integer; external 'compinst_installDelphiDesignPackage@files:CompInstall.dll stdcall'; function compinst_installBCBDesignPackage(Version: Integer; BplFilename, Description: PChar): Integer; external 'compinst_installBCBDesignPackage@files:CompInstall.dll stdcall'; // expert function compinst_installDelphiExpert(Version: Integer; Filename, Description: PChar): Integer; external 'compinst_installDelphiExpert@files:CompInstall.dll stdcall'; function compinst_installBCBExpert(Version: Integer; Filename, Description: PChar): Integer; external 'compinst_installBCBExpert@files:CompInstall.dll stdcall'; // search path function compinst_addDelphiSearchPaths(Version: Integer; SearchPaths, DebugPaths, BrowsePaths, IncludePaths: PChar): Integer; external 'compinst_addDelphiSearchPaths@files:CompInstall.dll stdcall'; function compinst_addBCBSearchPaths(Version: Integer; SearchPaths, DebugPaths, BrowsePaths, IncludePaths: PChar): Integer; external 'compinst_addBCBSearchPaths@files:CompInstall.dll stdcall'; // uninstall only // design package function compinst_uninstallDelphiDesignPackage(Version: Integer; BplFilename: PChar): Integer; external 'compinst_uninstallDelphiDesignPackage@{app}\CompInstall.dll stdcall uninstallonly'; function compinst_uninstallBCBDesignPackage(Version: Integer; BplFilename: PChar): Integer; external 'compinst_uninstallBCBDesignPackage@{app}\CompInstall.dll stdcall uninstallonly'; function compinst_uninstallDelphiDesignPackagesPrefixed(Version: Integer; BplFilenamePrefix: PChar): Integer; external 'compinst_uninstallDelphiDesignPackagesPrefixed@{app}\CompInstall.dll stdcall uninstallonly'; function compinst_uninstallBCBDesignPackagesPrefixed(Version: Integer; BplFilenamePrefix: PChar): Integer; external 'compinst_uninstallBCBDesignPackagesPrefixed@{app}\CompInstall.dll stdcall uninstallonly'; // expert function compinst_uninstallDelphiExpert(Version: Integer; Filename: PChar): Integer; external 'compinst_uninstallDelphiExpert@{app}\CompInstall.dll stdcall uninstallonly'; function compinst_uninstallBCBExpert(Version: Integer; Filename: PChar): Integer; external 'compinst_uninstallBCBExpert@{app}\CompInstall.dll stdcall uninstallonly'; function compinst_uninstallDelphiExpertsPrefixed(Version: Integer; FilenamePrefix: PChar): Integer; external 'compinst_uninstallDelphiExpertsPrefixed@{app}\CompInstall.dll stdcall uninstallonly'; function compinst_uninstallBCBExpertsPrefixed(Version: Integer; FilenamePrefix: PChar): Integer; external 'compinst_uninstallBCBExpertsPrefixed@{app}\CompInstall.dll stdcall uninstallonly'; // search path function compinst_removeDelphiSearchPaths(Version: Integer; SearchPaths, DebugPaths, BrowsePaths, IncludePaths: PChar): Integer; external 'compinst_removeDelphiSearchPaths@{app}\CompInstall.dll stdcall uninstallonly'; function compinst_removeBCBSearchPaths(Version: Integer; SearchPaths, DebugPaths, BrowsePaths, IncludePaths: PChar): Integer; external 'compinst_removeBCBSearchPaths@{app}\CompInstall.dll stdcall uninstallonly'; function IsDelphiInstalled(Version: Integer): Boolean; begin Result := compinst_isDelphiInstalled(Version) <> 0; end; function IsBCBInstalled(Version: Integer): Boolean; begin Result := compinst_isBCBInstalled(Version) <> 0; end; function IsStudioInstalled(Version: Integer): Boolean; begin Result := compinst_isBDSInstalled(Version) <> 0; end; function IsSourceInstall: Boolean; var List: TStrings; I: Integer; begin Result := False; List := TStringList.Create; try List.CommaText := WizardSelectedComponents(False); for I := 0 to List.Count - 1 do if StartsText('IDE\', List[I]) then Exit; finally List.Free; end; Result := True; end; // Design Packages procedure InstallDesignPackage(Kind: TIdeKind; Version: Integer; const BplFilename: string); begin if not FileExists(BplFilename) then Exit; Log('Register designtime package: ' + BplFilename); case Kind of ikDelphi: if compinst_installDelphiDesignPackage(Version, PChar(BplFilename), '') = 0 then MsgBox('Failed to install designtime package ' + ExtractFileName(BplFilename), mbError, MB_OK); ikBCB: if compinst_installBCBDesignPackage(Version, PChar(BplFilename), '') = 0 then MsgBox('Failed to install designtime package ' + ExtractFileName(BplFilename), mbError, MB_OK); end; end; function UninstallDesignPackage(Kind: TIdeKind; Version: Integer; const BplFilename: string): Boolean; begin Log('Unregister designtime package: ' + BplFilename); Result := False; case Kind of ikDelphi: Result := compinst_uninstallDelphiDesignPackage(Version, PChar(BplFilename)) <> 0; ikBCB: Result := compinst_uninstallBCBDesignPackage(Version, PChar(BplFilename)) <> 0; end; end; function UninstallDesignPackagesPrefixed(Kind: TIdeKind; Version: Integer; const BplFilenamePrefix: string): Boolean; begin Log('Unregister designtime packages that have the prefix: ' + BplFilenamePrefix); Result := False; case Kind of ikDelphi: Result := compinst_uninstallDelphiDesignPackagesPrefixed(Version, PChar(BplFilenamePrefix)) <> 0; ikBCB: Result := compinst_uninstallBCBDesignPackagesPrefixed(Version, PChar(BplFilenamePrefix)) <> 0; end; end; // Experts procedure InstallExpert(Kind: TIdeKind; Version: Integer; const Filename, Description: string); begin if not FileExists(Filename) then Exit; Log('Register IDE expert: ' + Filename); case Kind of ikDelphi: if compinst_installDelphiExpert(Version, PChar(Filename), Description) = 0 then MsgBox('Failed to install IDE expert ' + ExtractFileName(Filename), mbError, MB_OK); ikBCB: if compinst_installBCBExpert(Version, PChar(Filename), Description) = 0 then MsgBox('Failed to install IDE expert ' + ExtractFileName(Filename), mbError, MB_OK); end; end; function UninstallExpert(Kind: TIdeKind; Version: Integer; const Filename: string): Boolean; begin Log('Unregister IDE expert: ' + Filename); Result := False; case Kind of ikDelphi: Result := compinst_uninstallDelphiExpert(Version, PChar(Filename)) <> 0; ikBCB: Result := compinst_uninstallBCBExpert(Version, PChar(Filename)) <> 0; end; end; procedure InstallExpertEx(Kind: TIdeKind; Version: Integer; const Filename, Description: string); begin if not FileExists(Filename) then Exit; if EndsText('.bpl', Filename) then InstallDesignPackage(Kind, Version, Filename) else InstallExpert(Kind, Version, Filename, Description); end; function UninstallExpertEx(Kind: TIdeKind; Version: Integer; const Filename: string): Boolean; begin if EndsText('.bpl', Filename) then Result := UninstallDesignPackage(Kind, Version, Filename) else Result := UninstallExpert(Kind, Version, Filename); end; function UninstallExpertsPrefixed(Kind: TIdeKind; Version: Integer; const FilenamePrefix: string): Boolean; begin Log('Unregister IDE experts that have the prefix: ' + FilenamePrefix); Result := False; case Kind of ikDelphi: Result := compinst_uninstallDelphiExpertsPrefixed(Version, PChar(FilenamePrefix)) <> 0; ikBCB: Result := compinst_uninstallBCBExpertsPrefixed(Version, PChar(FilenamePrefix)) <> 0; end; end; // Search Paths procedure ChangeIdeSearchPaths(Kind: TIdeKind; Version: Integer; Installing: Boolean); var SearchPaths, DebugPaths, BrowsePaths, IncludePaths: string; Value: Integer; begin GetSearchPaths(Kind, Version, SearchPaths, DebugPaths, BrowsePaths, IncludePaths); if (SearchPaths = '') and (DebugPaths = '') and (BrowsePaths = '') then Exit; if Installing then begin Log('Adding search paths: ' + SearchPaths); Log('Adding debug paths: ' + DebugPaths); Log('Adding browsing paths: ' + BrowsePaths); if IncludePaths <> '' then Log('Adding include paths: ' + IncludePaths); end else begin Log('Removing search paths: ' + SearchPaths); Log('Removing debug paths: ' + DebugPaths); Log('Removing browsing paths: ' + BrowsePaths); if IncludePaths <> '' then Log('Removing include paths: ' + IncludePaths); end; case Kind of ikDelphi: if Installing then Value := compinst_addDelphiSearchPaths(Version, PChar(SearchPaths), PChar(DebugPaths), PChar(BrowsePaths), PChar(IncludePaths)) else Value := compinst_removeDelphiSearchPaths(Version, PChar(SearchPaths), PChar(DebugPaths), PChar(BrowsePaths), PChar(IncludePaths)); ikBCB: if Installing then Value := compinst_addBCBSearchPaths(Version, PChar(SearchPaths), PChar(DebugPaths), PChar(BrowsePaths), PChar(IncludePaths)) else Value := compinst_removeBCBSearchPaths(Version, PChar(SearchPaths), PChar(DebugPaths), PChar(BrowsePaths), PChar(IncludePaths)); end; end; procedure ChangeComponentRegistration(Installing: Boolean; Components: TStrings); var IdeList, PackageList, ExpertList, IdeExpertList: TStrings; IdeIndex, Index: Integer; DesignPackageName, ExpertName, Name: string; IdeKind: TIdeKind; Version: Integer; ComponentsFilename: string; begin // Register Packages into the IDEs IdeList := nil; PackageList := nil; ExpertList := nil; IdeExpertList := nil; try IdeList := TStringList.Create; PackageList := TStringList.Create; ExpertList := TStringList.Create; IdeExpertList := TStringList.Create; ComponentsFilename := ExpandConstant('{app}\uninscmp.dat'); if Installing then Components.CommaText := WizardSelectedComponents(False) else if FileExists(ComponentsFilename) then Components.LoadFromFile(ComponentsFilename); GetSelectedList(IdeList, 'IDE', Components); GetSelectedList(PackageList, 'Packages', Components); GetSelectedList(ExpertList, 'Experts', Components); GetSelectedList(IdeExpertList, 'IdeExperts', Components); // install per IDE for IdeIndex := 0 to IdeList.Count - 1 do begin ExtractIdeInfo(IdeList[IdeIndex], IdeKind, Version); // install per Package for Index := 0 to PackageList.Count - 1 do begin Name := ExtractFileName(PackageList[Index]); if Trim(Name) <> '' then begin DesignPackageName := MapDesignPackage(IdeKind, Version, Name); if Trim(DesignPackageName) <> '' then begin if Installing then InstallDesignPackage(IdeKind, Version, DesignPackageName) else UninstallDesignPackage(IdeKind, Version, DesignPackageName); end; end; end; // install per Expert for Index := 0 to ExpertList.Count - 1 do begin Name := ExtractFileName(ExpertList[Index]); if Trim(Name) <> '' then begin ExpertName := MapExpert(IdeKind, Version, Name); if Trim(ExpertName) <> '' then begin if Installing then InstallExpertEx(IdeKind, Version, ExpertName, Name) else UninstallExpertEx(IdeKind, Version, ExpertName); end; end; end; // install per IdeExpert for Index := 0 to IdeExpertList.Count - 1 do begin Name := ExtractFileName(IdeExpertList[Index]); if Trim(Name) <> '' then begin ExpertName := MapExpert(IdeKind, Version, Name); if Trim(ExpertName) <> '' then begin if Installing then InstallExpert(IdeKind, Version, ExpertName, Name) else UninstallExpert(IdeKind, Version, ExpertName); end; end; end; ChangeIdeSearchPaths(IdeKind, Version, Installing); end; if Installing then Components.SaveToFile(ComponentsFilename) else DeleteFile(ComponentsFilename); finally IdeList.Free; PackageList.Free; ExpertList.Free; IdeExpertList.Free; end; end; function InitComponentInstaller(): Boolean; var Version: Integer; begin LastInstalledIDEVersionNumber := compinst_init; // sets the "DELPHIx[|BPL|DCP|RegKey]" and "BCBx[|BPL|DCP|RegKey] environment variables // Check if there is any Delphi IDE installed Result := False; for Version := 6 to LastInstalledIDEVersionNumber do if IsDelphiInstalled(Version) then Result := True; if not Result then MsgBox('No supported Delphi IDE is installed. Installation aborted.', mbError, MB_OK); end; function InitComponentUninstaller(): Boolean; begin LastInstalledIDEVersionNumber := compinst_initUninstall; // sets the "DELPHIx[|BPL|DCP|RegKey]" and "BCBx[|BPL|DCP|RegKey] environment variables Result := True; end; procedure RegisterComponents(); var Components: TStrings; begin Components := TStringList.Create; try ChangeComponentRegistration(True, Components); UserRegisterComponents(Components); finally Components.Free; end; end; procedure UnregisterComponents(); var Components: TStrings; begin Components := TStringList.Create; try ChangeComponentRegistration(False, Components); UserUnregisterComponents(Components); finally Components.Free; UnloadDLL(ExpandConstant('{app}\CompInstall.dll')); // make the file deletable end; end;
Inno Setup
4
ycq323/alcinoe
references/jcl/thirdparty/InnoSetup/ComponentInstallerScript.iss
[ "Apache-2.0" ]
<!DOCTYPE html> <html> <head> <title>stagger | anime.js</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta property="og:title" content="anime.js"> <meta property="og:url" content="https://animejs.com"> <meta property="og:description" content="Javascript Animation Engine"> <meta property="og:image" content="https://animejs.com/documentation/assets/img/icons/og.png"> <meta name="twitter:card" content="summary"> <meta name="twitter:title" content="anime.js"> <meta name="twitter:site" content="@juliangarnier"> <meta name="twitter:description" content="Javascript Animation Engine"> <meta name="twitter:image" content="https://animejs.com/documentation/assets/img/icons/twitter.png"> <link rel="apple-touch-icon-precomposed" href="../assets/img/social-media-image.png"> <link rel="icon" type="image/png" href="../assets/img/favicon.png" > <link href="../assets/css/animejs.css" rel="stylesheet"> <link href="../assets/css/documentation.css" rel="stylesheet"> <style> :root { font-size: 20px; } body { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; background-color: #F6F4F2; } .keyframes-visualizer { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; width: 16rem; height: 16rem; } .keyframes-visualizer div { position: relative; width: .8rem; height: .8rem; margin: .1rem; border: 2px solid currentColor; background-color: #F6F4F2; color: #373535; border-radius: 50%; } </style> </head> <body> <div class="keyframes-visualizer"></div> </body> <script src="../../lib/anime.min.js"></script> <script> //import anime from '../../src/index.js'; const keyframesVisualizerEl = document.querySelector('.keyframes-visualizer'); const fragment = document.createDocumentFragment(); const numberOfElements = 256; for (let i = 0; i < numberOfElements; i++) { fragment.appendChild(document.createElement('div')); } keyframesVisualizerEl.appendChild(fragment); const animation = anime({ targets: '.keyframes-visualizer div', keyframes: [ { color: '#FF4B4B', translateX: anime.stagger('-.15rem', {grid: [16, 16], from: 'center', axis: 'x'}), translateY: anime.stagger('-.15rem', {grid: [16, 16], from: 'center', axis: 'y'}), duration: 300 }, { translateX: anime.stagger('.125rem', {grid: [16, 16], from: 'center', axis: 'x'}), translateY: anime.stagger('.125rem', {grid: [16, 16], from: 'center', axis: 'y'}), duration: 500 }, { color: '#373535', translateX: 0, translateY: 0, duration: 600, } ], delay: anime.stagger(2), easing: 'easeInOutQuad', loop: true }); console.log(animation); </script> </html>
HTML
4
HJ959/anime
documentation/examples/keyframes.html
[ "MIT" ]
/******************************************************************************** * Copyright (c) {date} Red Hat Inc. and/or its affiliates and others * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at * http://www.apache.org/licenses/LICENSE-2.0 * * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ import com.intellij.openapi.application { ApplicationAdapter } import com.intellij.openapi.application.ex { ApplicationManagerEx { application=applicationEx } } import com.intellij.openapi.progress { ProgressManager { progressManager=instance }, EmptyProgressIndicator, ProcessCanceledException } import com.intellij.openapi.project { Project, DumbService { dumbService=getInstance } } import com.intellij.openapi.util { Ref } import java.lang { Thread, InterruptedException, ThreadLocal, System } import org.eclipse.ceylon.ide.intellij.util { CeylonLogger } shared class NoIndexStrategy of useAlternateResolution | waitForIndexes | ousideDumbMode { String str; shared new useAlternateResolution { str = "useAlternateResolution"; } shared new waitForIndexes { str = "waitForIndexes"; } shared new ousideDumbMode { str = "ousideDumbMode"; } string => str; } shared abstract class ConcurrencyError(String? description=null, Throwable? cause=null) extends Exception(description, cause) {} shared class CannotWaitForIndexesInReadAccessError() extends ConcurrencyError("Waiting for up-to-date indexes inside a read-allowed section is dead-lock-prone.") {} shared class DumbModeNotSupported() extends ConcurrencyError("This code should never be called while Dumb mode is on.") {} String noIndexStrategyMessage = """Entering in a section that would need indexes, but no strategy has been specified. The strategy used when indexes are unavailable can be specified by one of the following methods: - concurrencyManager.withUpToDateIndexes() - concurrencyManager.withAlternateResolution() - concurrencyManager.outsideDumbMode()"""; shared class IndexNeededWithNoIndexStrategy() extends ConcurrencyError(noIndexStrategyMessage) {} shared object concurrencyManager { value logger = CeylonLogger<\IconcurrencyManager>(); shared Integer deadLockDetectionTimeout = 30000; value noIndexStrategy_ = ThreadLocal<NoIndexStrategy?>(); shared NoIndexStrategy? noIndexStrategy => noIndexStrategy_.get(); shared Return|ProcessCanceledException tryReadAccess<Return>(Return func()) { try { return needReadAccess(func, 0); } catch(ProcessCanceledException e) { return e; } } shared Return dontCancel<Return>(Return func()) { value ref = Ref<Return>(); ProgressManager.instance.executeNonCancelableSection(() => ref.set(func())); return ref.get(); } shared Return needReadAccess<Return>(Return func(), Integer timeout = deadLockDetectionTimeout) { value ref = Ref<Return>(); function funcRunnable() { value restoreCurrentPriority = withOriginalModelUpdatePriority(); try { return ref.set(func()); } finally { restoreCurrentPriority(); } } if (application.readAccessAllowed) { ProgressManager.instance.executeNonCancelableSection(funcRunnable); return ref.get(); } else { "This method is copied on [[com.intellij.openapi.progress.util::ProgressIndicatorUtils.runInReadActionWithWriteActionPriority]] but doesn't fail when a write action is only pending, since this would lead to deadlocks when another read action is preventing a pending write action to acquire its lock" Boolean runInReadActionWithWriteActionPriority(void action()) { value progressIndicator = object extends EmptyProgressIndicator() { // hashCode() seems to be quite slow when used in CoreProgressManager.threadsUnderIndicator hash => 42; }; value listener = object extends ApplicationAdapter() { shared actual void beforeWriteActionStart(Object action) { if (!progressIndicator.canceled) { progressIndicator.cancel(); } } }; value succeededWithAddingListener = application.tryRunReadAction(() => application.addApplicationListener(listener)); if (!succeededWithAddingListener) { // second catch: writeLock.lock() acquisition is in progress or already acquired if (!progressIndicator.canceled) { progressIndicator.cancel(); } return false; } value wasCancelled = Ref<Boolean>(); try { progressManager.runProcess(() { try { wasCancelled.set(!application.tryRunReadAction(action)); } catch (ProcessCanceledException ignore) { wasCancelled.set(true); } }, progressIndicator); } finally { application.removeApplicationListener(listener); } Boolean cancelled = wasCancelled.get(); return ! cancelled; } value allowedWaitingTime = System.currentTimeMillis() + timeout; while(!runInReadActionWithWriteActionPriority(funcRunnable)) { try { if (System.currentTimeMillis() > allowedWaitingTime) { if (timeout == deadLockDetectionTimeout) { logger.error(()=>"Stopped waiting for read access to avoid a deadlock", 15); } throw ProcessCanceledException(); } Thread.sleep(50); } catch(InterruptedException ie) { if (application.disposeInProgress) { throw ProcessCanceledException(ie); } else { try { Thread.sleep(200); } catch(InterruptedException ie2) { throw ProcessCanceledException(ie2); } } } logger.debug(()=>"Retrying the read action after a write action"); } return ref.get(); } } Return withIndexStrategy<Return>(NoIndexStrategy s, Return() func) { NoIndexStrategy? previousStrategy; if (exists currentStrategy = noIndexStrategy_.get()) { if (currentStrategy != s && s != NoIndexStrategy.ousideDumbMode) { logger.info(()=>"The current strategy (``currentStrategy``) when indexes are unavailable should overriden by a new one (``s``) with care", 10); } previousStrategy = currentStrategy; } else { previousStrategy = null; } try { if (s == NoIndexStrategy.waitForIndexes && application.readAccessAllowed) { throw CannotWaitForIndexesInReadAccessError(); } noIndexStrategy_.set(s); return func(); } finally { noIndexStrategy_.set(previousStrategy); } } "With this strategy applied to [[func()]], all the calls to [[needIndexes()]] (in descendant functions in the same thread), *while Dumb mode is on*, will *use the alternate resolution* method." see (`function DumbService.withAlternativeResolveEnabled`) shared Return withAlternateResolution<Return>(Return func()) => withIndexStrategy(NoIndexStrategy.useAlternateResolution, func); "With this strategy applied to [[func()]], all the calls to [[needIndexes()]] (in descendant functions in the same thread), *while Dumb mode is on*, will *wait for up-to-date indices* (the end of the Dumb mode), unless already in a read-access section (to avoid deadlocks), in which case a [[CannotWaitForIndexesInReadAccessError]] will be thrown." see (`function DumbService.repeatUntilPassesInSmartMode`) shared Return withUpToDateIndexes<Return>(Return func()) => withIndexStrategy(NoIndexStrategy.waitForIndexes, func); "With this strategy applied to [[func()]], all the calls to [[needIndexes()]] (in descendant functions in the same thread), are *expected to be called outside Dumb mode*. If a [[needIndexes()]] is made during dumb mode, this will throw will wait for up-to-date indices (the end of the Dumb mode), unless already in a read-access section (to avoid deadlocks), in which case a [[CannotWaitForIndexesInReadAccessError]] will be thrown." shared Return outsideDumbMode<Return>(Return func()) => withIndexStrategy(NoIndexStrategy.ousideDumbMode, func); shared Return needIndexes<Return>(Project p, Return func()) { value ds = dumbService(p); value ref = Ref<Return>(); function runnable() => ref.set(func()); switch(indexStragey = noIndexStrategy_.get()) case(NoIndexStrategy.useAlternateResolution) { // we are probably in the completion, or navigation, or local typechecking // so don't wait for indices, and if dumb mode is on, the alternate // resolution will be used. ds.withAlternativeResolveEnabled(runnable); return ref.get(); } case(NoIndexStrategy.waitForIndexes) { if (application.readAccessAllowed) { throw CannotWaitForIndexesInReadAccessError(); } ds.runReadActionInSmartMode(runnable); return ref.get(); } case (NoIndexStrategy.ousideDumbMode) { if (ds.dumb) { value exception = DumbModeNotSupported(); logger.errorThrowable(exception); throw exception; } else { return func(); } } case(null) { if (ds.dumb) { value exception = IndexNeededWithNoIndexStrategy(); logger.errorThrowable(exception); throw exception; } else { logger.debug(() => noIndexStrategyMessage, 20); return func(); } } } } //object concurrencyManagerForJava { // shared Anything needReadAccess(JCallable<Anything> func, Integer timeout) // => concurrencyManager.needReadAccess(func.call, timeout); // // shared Anything withAlternateResolution(JCallable<Anything> func) // => concurrencyManager.withAlternateResolution(func.call); // // shared Anything withUpToDateIndexes(JCallable<Anything> func) // => concurrencyManager.withUpToDateIndexes(func.call); // // shared Anything outsideDumbMode(JCallable<Anything> func) // => concurrencyManager.outsideDumbMode(func.call); //} //
Ceylon
4
Kopilov/ceylon-ide-intellij
source/org/eclipse/ceylon/ide/intellij/model/concurrencyManager.ceylon
[ "Apache-2.0" ]
# Extension API Reference ## APIs - [Common](modules/Common.md) - [Main](modules/Main.md) - [Renderer](modules/Renderer.md)
Smarty
0
pjsoni/lens
docs/extensions/typedoc-readme.md.tpl
[ "MIT" ]
Module: dylan-user Author: Peter S. Housel Copyright: Original Code is Copyright 2004-2009 Gwydion Dylan Maintainers All rights reserved. License: See License.txt in this distribution for details. Warranty: Distributed WITHOUT WARRANTY OF ANY KIND define library llvm-test-suite-app use testworks; use llvm-test-suite; end library llvm-test-suite-app; define module llvm-test-suite-app use testworks; use llvm-test-suite; end module llvm-test-suite-app;
Dylan
1
kryptine/opendylan
sources/lib/llvm/tests/llvm-test-suite-app-lib.dylan
[ "BSD-2-Clause" ]
' ********** Copyright 2016 Roku Corp. All Rights Reserved. ********** 'RAF implementation with Nielsen and ads being server stitched (Server-Side Ad Insertion) ' - Enable Nielsen. ' - Pass all parameters to Nielsen beacons with examples of genre, program id and content. ' - Use fireTrackingEvents() to pass ad structure with Nielsen beacons to RAF. ' - Nilsen APIs are updated for each content stream. '@param videoContent [AA] object that has valid data for playing video with roVideoScreen. Sub PlayContentWithServerSideAdInsertion() adIface = Roku_Ads() 'RAF initialize print "Roku_Ads library version: " + adIface.getLibVersion() adIface.setDebugOutput(true) 'for debug pupropse 'RAF content params adIface.setContentId(m.videoContent.contentId) adIface.SetContentGenre(m.videoContent.contentGenre) 'Nielsen content params adIface.enableNielsenDAR(true) adIface.setContentLength(m.videoContent.conntentLength) adIface.setNielsenProgramId(m.videoContent.nielsenProgramId) adIface.setNielsenGenre(m.videoContent.nielsenGenre) adIface.setNielsenAppId(m.videoContent.nielsenAppId) 'Normally, would set publisher's ad URL here. 'Otherwise uses default Roku ad server (with single preroll placeholder ad) adIface.setAdUrl(m.videoContent.adUrl) 'Returns available ad pod(s) scheduled for rendering or invalid, if none are available. adPods = adIface.getAds() 'initilaization m.loading.visible = false m.video.visible = true m.video.setFocus(true) m.video.control = "play" buffering = false curPos = 0 ctx = {type : "Impression"} 'adding fields of duration and render time to each ad 'in adPods data structure to ease processing of fireTracking EvaluateRenderTime(adPods) while (true) msg = wait(0, m.port) msgType = type(msg) if msg.GetNode() = "MainVideo" then if msg.GetField() = "position" then curPos = m.video.position ctx = {type : "Custom"} else if msg.GetField() = "state" then curState = m.video.state if curState = "finished" then ctx = {type : "Custom"} else if curState = "paused" then ctx = {type : "Pause"} buffering = false else if curState = "playing" then if buffering then 'we don't send any beacons after 'resuming after buffering ctx = {type : "None"} buffering = false else ctx = {type : "Resume"} end if else if curState = "buffering" then ctx = {type : "None" } buffering = true end if else if msg.GetField() = "navBack" then ctx = {type : "Close"} m.video.control = "stop" exit while end if end if 'parse all AdPods like: PreRolls, MidRolls, PostRolls 'for handling all firetracking events in it for each adPod in AdPods if not adPod.viewed and adPod.rendertime <= curPos then 'parse all ads in current pod for each ad in adPod.ads if not ad.viewed and ad.rendertime <= curPos then if ctx.type = "Custom" then 'Custom case is triggered when isStreamStarted or isPlaybackPosition 'events occurs on VideoScreen 'evaluate moment of time for aproriate 'fire tracking events Impression = ad.rendertime FirstQuartile = ad.rendertime + 0.25 * ad.duration Midpoint = ad.rendertime + 0.5 * ad.duration ThirdQuartile = ad.rendertime + 0.75 * ad.duration Complete = ad.rendertime + 1 * ad.duration if curPos >= Impression and curPos < FirstQuartile and not ad.started then ad.started = true ctx = {type: "Impression"} else if curPos >= FirstQuartile and curPos < Midpoint then ctx = {type: "FirstQuartile"} else if curPos >= Midpoint and curPos < ThirdQuartile then ctx = {type: "Midpoint"} else if curPos >= ThirdQuartile and curPos < Complete then ctx = {type: "ThirdQuartile"} else if curPos >= Complete then ctx = {type: "Complete"} end if if ctx.type <> "Custom" then 'firetrcakingevent call adIface.fireTrackingEvents(ad, ctx) end if else 'handles all other events from videoplayer like 'play, pause, stop, error etc excep from case of "Custom" 'firetrcakingevent call if ctx.type <> "None" then adIface.fireTrackingEvents(ad, ctx) end if end if print " type = "; ctx.type 'check and if, then mark ad 'as viewed and trecked ad.viewed = IsAdTracked(ad.tracking) end if end for 'check and if then mark adPod 'as viewed and trecked adPod.viewed = IsAdPodTracked(adPod.ads) end if end for'AdPods Parse loop end while'VideoScreen event loop End Sub 'adding fields of duration and render time to each ad 'in adPods data structure to ease processing of fireTracking '@param adPods [A] array of adPod objects that has valid data of adPod returned from Raf by GetAds() function sub EvaluateRenderTime(adPods as Object) for each adPod in adPods PodRenderTime = adPod.renderTime for i = 0 to adPod.ads.Count() - 1 ad = adPod.ads[i] if i = 0 then 'renderTime of first ad item is the same as in the whole AdPod ad.renderTime = PodRenderTime else 'render time of consequent ads is the total of 'duration and render timem of previous ad ad.renderTime = adPod.ads[i-1].renderTime + adPod.ads[i-1].duration end if 'add flag viewed as in whole AdPod to each ad ad.viewed = false 'needed for filtering fire tracking call 'because fireTrackingEvent call always this track 'despite on trigerred flag ad.started = false end for end for end sub 'checks is pod currently viewed 'by summarize all views of enclos ads '@param ads [A] array of ads objects function IsAdPodTracked(ads as object ) as Boolean isAllTriggered = true for each ad in ads isAllTriggered = isAllTriggered and ad.viewed end for return isAllTriggered end function 'checks is Ad tracked already '@param trackingArray [A] array of tracking data structure that is in each ad function IsAdTracked(trackingArray as Object ) as Boolean FinalTrackingEvents = { "complete" : true "error" : true "close" : true "skip" : true } if tracking.triggered AND FinalTrackingEvents.doesExist(tracking.event) then return true return false end function
Brightscript
4
khangh/samples
advertising/FullRAFSceneGraphSample/source/ServerSideAdInsertion.brs
[ "MIT" ]
C Copyright(c) 1998, Space Science and Engineering Center, UW-Madison C Refer to "McIDAS Software Acquisition and Distribution Policies" C in the file mcidas/data/license.txt C *** $Id: kbxvisr.dlm,v 1.22 1998/10/13 20:25:45 dglo Exp $ *** INTEGER FUNCTION KBXINI(CIN,COUT,IOPT) IMPLICIT NONE CHARACTER*4 CIN CHARACTER*4 COUT INTEGER IOPT(*) ! symbolic constants & shared data INCLUDE 'areaparm.inc' INTEGER JTYPE INTEGER ISOU INTEGER IDES INTEGER JOPT(NUMAREAOPTIONS) COMMON/VISRXX/JTYPE,ISOU,IDES,JOPT ! external functions ! local variables CALL MOVW(NUMAREAOPTIONS,IOPT,JOPT) JTYPE=0 ISOU=IOPT(1) IDES=IOPT(2) IF(CIN.EQ.'BRIT'.AND.COUT.EQ.'TEMP') JTYPE=1 IF(CIN.EQ.'BRIT'.AND.COUT.EQ.'MODB') JTYPE=2 IF(CIN.EQ.'BRIT'.AND.COUT.EQ.'RAW ') JTYPE=3 IF(JTYPE.EQ.0) GO TO 900 KBXINI=0 RETURN 900 CONTINUE KBXINI=-1 RETURN END INTEGER FUNCTION KBXCAL(CALB,IDIR,NVAL,IBAND,IBUF) IMPLICIT NONE INTEGER CALB(*) INTEGER IDIR(*) INTEGER NVAL INTEGER IBAND INTEGER IBUF(*) ! symbolic constants & shared data INCLUDE 'areaparm.inc' INTEGER JTYPE INTEGER ISOU INTEGER IDES INTEGER JOPT(NUMAREAOPTIONS) COMMON/VISRXX/JTYPE,ISOU,IDES,JOPT CHARACTER*4 CALTYP COMMON/BRKPNT/ CALTYP ! external functions CHARACTER*4 CLIT INTEGER BRKVAL LOGICAL ISIR integer mciydtocyd ! local variables INTEGER I INTEGER IDAY integer idir4 integer iret INTEGER ITAB(256) ! initialized variables INTEGER LASDAY INTEGER LASTYP DATA LASDAY / -1 / DATA LASTYP / -1 / c make sure we work with idir4 as ccyyddd if(idir(4).gt.1900000) then idir4=idir(4) else iret=mciydtocyd(idir(4),idir4) endif IF (.NOT.ISIR(IDIR(3),CLIT(IDIR(57)),IBAND)) THEN C IF(IAND(IDIR(3),1).EQ.0.AND.IDIR(3).NE.6) THEN IF((CALTYP.EQ.'BRIT'.OR.CALTYP.EQ.'RAW ') & .AND.JTYPE.EQ.2) THEN IF(LASDAY.NE.idir4.OR.LASTYP.NE.JTYPE) THEN DO 100 I=0,255 100 ITAB(I+1)=BRKVAL(REAL(I)) LASDAY = idir4 LASTYP = JTYPE ENDIF CALL MPIXTB(NVAL,ISOU,IDES,IBUF,ITAB) RETURN ELSE CALL MPIXEL(NVAL,ISOU,IDES,IBUF) RETURN ENDIF ENDIF IDAY=IDIR4 IF(LASDAY.NE.IDIR4.OR.LASTYP.NE.JTYPE) THEN IF(JTYPE.EQ.1) THEN CALL TEMPTB(IDAY,ITAB) ELSE IF(JTYPE.EQ.3) THEN DO 105 I=0,255 105 ITAB(I+1)=I ELSE IF(CALTYP.EQ.'BRIT'.OR.CALTYP.EQ.'RAW') THEN DO 110 I=0,255 110 ITAB(I+1)=BRKVAL(REAL(I)) ELSE IF(CALTYP.EQ.'TEMP') THEN CALL TEMPTB(IDAY,ITAB) DO 200 I=0,255 ITAB(I+1) = BRKVAL(REAL(ITAB(I+1))/10.) 200 CONTINUE ENDIF LASDAY = IDIR4 LASTYP = JTYPE ENDIF CALL MPIXTB(NVAL,ISOU,IDES,IBUF,ITAB) KBXCAL=0 RETURN END C--- ERROR CODE C -1 = INVALID OPTION CFUNC C -2 = INVALID BAND ('INFO') C -3 = ERROR IN BREAKPOINT TABLE (OR MISSING) ('KEYS', 'BRKP') INTEGER FUNCTION KBXOPT(CFUNC,IIN,IOUT) IMPLICIT NONE CHARACTER*4 CFUNC INTEGER IIN(*) INTEGER IOUT(*) ! symbolic constants & shared data INCLUDE 'areaparm.inc' INTEGER JTYPE INTEGER ISOU INTEGER IDES INTEGER JOPT(NUMAREAOPTIONS) COMMON/VISRXX/JTYPE,ISOU,IDES,JOPT CHARACTER*4 CALTYP COMMON/BRKPNT/ CALTYP ! external functions CHARACTER*4 CLIT INTEGER BRKSET INTEGER ISCHAR INTEGER LIT ! local variables CHARACTER*8 CFILE LOGICAL ISIR C--- CHECK FOR VALID CALIBRATION TYPES IF(CFUNC.EQ.'KEYS') THEN IF (.NOT.ISIR(IIN(1),CLIT(IIN(37)),IIN(4))) THEN C IF(IAND(IIN(1),1).EQ.0.AND.IIN(1).NE.6) THEN IOUT(1)=2 IOUT(2)=LIT('RAW ') IOUT(3)=LIT('BRIT') ELSE IOUT(1)=3 IOUT(2)=LIT('RAW ') IOUT(3)=LIT('TEMP') IOUT(4)=LIT('BRIT') ENDIF IF(ISCHAR(IIN(38)).EQ.1) THEN CALL MOVCW(IIN(38),CFILE) IF(BRKSET(CFILE,CALTYP).NE.0) THEN KBXOPT = -3 RETURN ENDIF ENDIF KBXOPT=0 C--- BREAKPOINT TABLE OPTION ELSE IF(CFUNC.EQ.'BRKP') THEN CALL MOVCW(IIN(1),CFILE) IF(BRKSET(CFILE,CALTYP).NE.0) THEN KBXOPT = -3 RETURN ENDIF KBXOPT = 0 C--- BAND INFO OPTION ELSE IF(CFUNC.EQ.'INFO') THEN IF (.NOT.ISIR(IIN(2),CLIT(IIN(3)),IIN(1))) THEN C IF(IAND(IIN(1),1).EQ.0.AND.IIN(1).NE.6) THEN IOUT(1)=2 IOUT(2)=LIT('RAW ') IOUT(3)=LIT('BRIT') IOUT(4)=LIT(' ') IOUT(5)=LIT(' ') IOUT(6)=1 IOUT(7)=1 ELSE IOUT(1)=3 IOUT(2)=LIT('RAW ') IOUT(3)=LIT('TEMP') IOUT(4)=LIT('BRIT') IOUT(5)=LIT(' ') IOUT(6)=LIT('K ') IOUT(7)=LIT(' ') IOUT(8)=1 IOUT(9)=10 IOUT(10)=1 ENDIF KBXOPT = 0 C--- INVALID OPTION ELSE KBXOPT = -1 ENDIF RETURN END C TEMPTB MOSHER 1074 WINLIB SMS IR BRIGHTNESS TO DEGREES KELVIN*10 C $ SUBROUTINE TEMPTB(IDAY, IRAD, ITEMP) (FM) C $ CONVERTS FROM INFRARED COUNT TO TEMPERATURE*10 C $ IDAY = (I) INPUT DAY (YYDDD) C $ IRAD = (I) INPUT IR BRIGHTNESS C $ ITEM = (I) OUTPUT TEMPERATURE*10 C $$ TEMP = CONVERT c iday is now ccyyddd, so the IRDAY array has to be changed c to ccyyddd C SUBROUTINE TEMPTB(IDAY,ITEM) IMPLICIT NONE INTEGER IDAY INTEGER ITEM(*) ! external functions character*12 cfi ! local variables INTEGER I INTEGER IR INTEGER IRAD INTEGER J INTEGER JTEMP REAL A REAL D REAL DT REAL T ! initialized variables INTEGER IRTOT INTEGER IRDAY(2) INTEGER ICNT(9) INTEGER ITGAT(9) INTEGER IRTEM1(256) DATA IRTOT / 2 / DATA IRDAY / 1974200,1974304 / DATA ICNT / 41, 60, 90, 120, 150, 180, 210, 230, 235/ DATA ITGAT /3297,3216,3079,2926,2751,2539,2223,1944,1819/ DATA IRTEM1/3300,3295,3290,3285,3280,3275,3270,3265,3260,3255, >3250,3245,3240,3235,3230,3225,3220,3215,3210,3205,3200,3195,3190, >3185,3180,3175,3170,3165,3160,3155,3150,3145,3140,3135,3130,3125, >3120,3115,3110,3105,3100,3095,3090,3085,3080,3075,3070,3065,3060, >3055,3050,3045,3040,3035,3030,3025,3020,3015,3010,3005,3000,2995, >2990,2985,2980,2975,2970,2965,2960,2955,2950,2945,2940,2935,2930, >2925,2920,2915,2910,2905,2900,2895,2890,2885,2880,2875,2870,2865, >2860,2855,2850,2845,2840,2835,2830,2825,2820,2815,2810,2805,2800, >2795,2790,2785,2780,2775,2770,2765,2760,2755,2750,2745,2740,2735, >2730,2725,2720,2715,2710,2705,2700,2695,2690,2685,2680,2675,2670, >2665,2660,2655,2650,2645,2640,2635,2630,2625,2620,2615,2610,2605, >2600,2595,2590,2585,2580,2575,2570,2565,2560,2555,2550,2545,2540, >2535,2530,2525,2520,2515,2510,2505,2500,2495,2490,2485,2480,2475, >2470,2465,2460,2455,2450,2445,2440,2435,2430,2425,2420,2410,2400, >2390,2380,2370,2360,2350,2340,2330,2320,2310,2300,2290,2280,2270, >2260,2250,2240,2230,2220,2210,2200,2190,2180,2170,2160,2150,2140, >2130,2120,2110,2100,2090,2080,2070,2060,2050,2040,2030,2020,2010, >2000,1990,1980,1970,1960,1950,1940,1930,1920,1910,1900,1890,1880, >1870,1860,1850,1840,1830,1820,1810,1800,1790,1780,1770,1760,1750, >1740,1730,1720,1710,1700,1690,1680,1670,1660,1650,1640,1630/ C C FIND WHICH CALIBRATION PERIOD TO USE C call mctrace(1,'AGETSERV',' in temptb') call mctrace(1,'AGETSERV',' date is'//cfi(iday)) DO 300 IRAD=0,255 DO 1 I=1,IRTOT J=I IF(IDAY.LT.IRDAY(I)) GO TO 2 1 CONTINUE J=3 2 GO TO (10,20,30),J C C CALIBRATION FOR 1ST GATE PERIOD 27 JUNE-16 JULY C 10 DO 11 I=2,9 J=I-1 11 IF(IRAD.LE.ICNT(I)) GO TO 12 J=8 12 JTEMP=((ITGAT(J+1)-ITGAT(J))*(IRAD-ICNT(J))/(ICNT(J+1)-ICNT(J))) > +ITGAT (J) ITEM(IRAD+1)=JTEMP GO TO 300 C C CALIBRATION FOR PERIOD 16 JULY - 30 OCT. 74 20 IR=IRAD+1 T=FLOAT(IRTEM1(IR))/10. D=FLOAT(IDAY-1974000) C C COMPUTE CORRECTION FACTOR C A=-31.97+D*(.3385+D*(-1.195E-3+1.443E-6*D)) DT=A*(3.8+T*(-.031-2.0E-5*T)) ITEM(IR)=IFIX((T+DT)*10.) GO TO 300 C C DATA AFTER 30 OCT. 74 C 30 IR=IRAD+1 ITEM(IR)=IRTEM1(IR) 300 CONTINUE RETURN END
IDL
4
oxelson/gempak
extlibs/AODT/v72/odtmcidas/navcal/navcal/kbxvisr.dlm
[ "BSD-3-Clause" ]
#AutoIt3Wrapper_Icon=favicon.ico #include <Array.au3> #include <GuiEdit.au3> #include <GUIConstantsEx.au3> #include <Date.au3> #include <InetConstants.au3> #NoTrayIcon OnAutoItExitRegister('_onExit') Global $wndConsole = 0 Global $hndConsole = 0 Global $pidConsole = 0 Global $installDir = @ScriptDir & '\..\..' Local $isSilence = False If $cmdLine[0] >= 1 Then $isSilence = $cmdLine[1] == '-silence' Or $cmdLine[1] == '-s' If StringInStr($isSilence, '?') Then Exit MsgBox(64, "Jigsaw Installer", "Usage: install [-silence / -s]") If Not $isSilence Then ; Create Console $pidConsole = Run('c:\windows\notepad.exe', '', @SW_HIDE) $wndConsole = WinWait("[CLASS:Notepad]") $hndConsole = ControlGetHandle($wndConsole, '', 'Edit1') WinSetTitle($wndConsole, '', 'Jigsaw Installer Console') _appendConsole("Jigsaw's dependencies are been installing...") _appendConsole("----------------------------------------------") WinMove($wndConsole, '', 0, 0, 650, 320) WinActivate($wndConsole) WinSetState($wndConsole, '', @SW_SHOW) EndIf If FileExists($installDir & '\node_modules') Then If Not $isSilence And MsgBox(292,"Jigsaw Installer", "Directory node_modules existed, are you sure to remove it?") == 7 Then Exit _appendConsole('Removing node_modules director ...') If Not DirRemove($installDir & '\node_modules', True) Then _error('Unable to remove directory ' & $installDir & '\node_modules' & @CRLF & _ 'Close your IDE or npm or reboot your computer and try again.') EndIf EndIf _appendConsole('Downloading dependency package...') If FileExists($installDir & '\install_tmp') Then DirRemove($installDir & '\install_tmp', True) _downloadPackage('http://rdk.zte.com.cn/jigsaw/misc/node_modules.zip') If Not FileExists($installDir & '\install_tmp\node_modules.zip') Then _error('Unable to download node_modules.zip, please check your network configuration.') EndIf _unzipPackage($installDir & '\install_tmp\node_modules.zip') If Not $isSilence And MsgBox(36, "Jigsaw Installer", "Installation done!" & @CRLF & _ 'Should I run "npm start" to check wheather everything is OK?' & @CRLF & _ 'Feel free to send us an issue if anything wrong.') == 6 Then Run(@ComSpec & " /c npm start", $installDir) EndIf ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _downloadPackage($url) DirCreate($installDir & '\install_tmp') Local $hDownload = InetGet($url, $installDir & '\install_tmp\node_modules.zip', $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) Do Sleep(3000) If InetGetInfo($hDownload, $INET_DOWNLOADSIZE) > 0 Then _appendConsole(' ' & InetGetInfo($hDownload, $INET_DOWNLOADREAD) & '/' & InetGetInfo($hDownload, $INET_DOWNLOADSIZE)) EndIf Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) Or InetGetInfo($hDownload, $INET_DOWNLOADERROR) EndFunc Func _unzipPackage($packagePath) _appendConsole('Unpackaging...') _appendConsole('This will take us about 3~10 minutes, please wait...') Local $zip = RegRead('HKEY_CURRENT_USER\Software\7-Zip\', 'Path') & '\7z.exe' If FileExists($zip) Then ; 7zip 解压速度更快 Local $cmd = '"' & $zip & '" x "' & $installDir & '\install_tmp\node_modules.zip" -o"' & $installDir & '"' If $isSilence Then RunWait($cmd, $installDir, @SW_HIDE) Else RunWait($cmd, $installDir) EndIf Else _Zip_UnzipAll($installDir & '\install_tmp\node_modules.zip', $installDir, $isSilence) EndIf EndFunc Func _appendConsole($msg) If $isSilence Then Return _GUICtrlEdit_AppendText($hndConsole, '[' & _Now() & '] ' & $msg & @CRLF) EndFunc Func _error($msg) If Not $isSilence Then ToolTip('') MsgBox(16, 'Jigsaw Installer', $msg) EndIf Exit EndFunc Func _onExit() If FileExists($installDir & '\install_tmp') Then DirRemove($installDir & '\install_tmp', True) ProcessClose($pidConsole) EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ZIP UDF: https://www.autoitscript.com/forum/topic/73425-zipau3-udf-in-pure-autoit/#entry534999 ;=============================================================================== ; ; Function Name: _Zip_UnzipAll() ; Description: Extract all files contained in a ZIP Archieve. ; Parameter(s): $hZipFile - Complete path to zip file that will be created (or handle if existant) ; $hDestPath - Complete path to where the files will be extracted ; $flag = 1 ; - 1 no progress box ; - 0 progress box ; Requirement(s): none. ; Return Value(s): On Success - 0 ; On Failure - sets @error 1~3 ; @error = 1 no Zip file ; @error = 2 no dll ; @error = 3 dll isn't registered ; Author(s): torels_ ; Notes: The return values will be given once the extracting process is ultimated... it takes some time with big files ;=============================================================================== Func _Zip_UnzipAll($hZipFile, $hDestPath, $flag = 1) Local $DLLChk = _Zip_DllChk() If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0);no dll If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path If Not FileExists($hZipFile) Then Return SetError(2, 0, 0) ;no zip file If Not FileExists($hDestPath) Then DirCreate($hDestPath) Local $aArray[1] $oApp = ObjCreate("Shell.Application") $oApp.Namespace($hDestPath).CopyHere($oApp.Namespace($hZipFile).Items) For $item In $oApp.Namespace($hZipFile).Items _ArrayAdd($aArray, $item) Next While 1 If $flag = 1 then _Hide() If FileExists($hDestPath & "\" & $aArray[UBound($aArray) - 1]) Then Return SetError(0, 0, 1) ExitLoop EndIf Sleep(500) WEnd EndFunc ;==>_Zip_UnzipAll ;=============================================================================== ; ; Function Name: _Zip_DllChk() ; Description: Internal error handler. ; Parameter(s): none. ; Requirement(s): none. ; Return Value(s): Failure - @extended = 1 ; Author(s): smashley ; ;=============================================================================== Func _Zip_DllChk() If Not FileExists(@SystemDir & "\zipfldr.dll") Then Return 2 If Not RegRead("HKEY_CLASSES_ROOT\CLSID\{E88DCCE0-B7B3-11d1-A9F0-00AA0060FA31}", "") Then Return 3 Return 0 EndFunc ;==>_Zip_DllChk ;=============================================================================== ; ; Function Name: _IsFullPath() ; Description: Internal Function. ; Parameter(s): $path - a zip path ; Requirement(s): none. ; Return Value(s): success - True. ; failure - False. ; Author(s): torels_ ; ;=============================================================================== Func _IsFullPath($path) if StringInStr($path,":\") then Return True Else Return False EndIf Endfunc ;=============================================================================== ; ; Function Name: _Hide() ; Description: Internal Function. ; Parameter(s): none ; Requirement(s): none. ; Return Value(s): none. ; Author(s): torels_ ; ;=============================================================================== Func _Hide() If ControlGetHandle("[CLASS:#32770]", "", "[CLASS:SysAnimate32; INSTANCE:1]") <> "" And WinGetState("[CLASS:#32770]") <> @SW_HIDE Then ;The Window Exists $hWnd = WinGetHandle("[CLASS:#32770]") WinSetState($hWnd, "", @SW_HIDE) EndIf EndFunc
AutoIt
4
npmmirror/jigsaw
build/install/install.au3
[ "MIT" ]
#go test -run=none -file bench_test.go -test.bench . -cpuprofile=bench_test.out go test -c ./go-restful.test -test.run=none -test.cpuprofile=tmp.prof -test.bench=BenchmarkMany ./go-restful.test -test.run=none -test.cpuprofile=curly.prof -test.bench=BenchmarkManyCurly #go tool pprof go-restful.test tmp.prof go tool pprof go-restful.test curly.prof
Shell
2
pkoushik/ARO-RP
vendor/github.com/emicklei/go-restful/bench_test.sh
[ "Apache-2.0" ]
def get_phi(N): phi = N for f in factor(N): phi = phi * (1 - 1 / f[0]) return phi def get_roots(r,c,mod): rems = [] if gcd( get_phi(mod), r) == 1: d = inverse_mod( r,get_phi(mod) ) rems.append(int(pow(c, d, mod))) else: g = GF(mod).multiplicative_generator() u = int(g ** ((mod-1)/r)) r1 = int(rth_root(r,c, mod)) for i in range(r): rems.append( int(r1 * pow(u, i, mod) % mod) ) return rems def rth_root(c,p,root): rems = get_roots(root, c%p, p) for m in rems : if pow(m,root,p) != c : print('%d = m^%d mod %d, m has no integer solutions.' % (c,root,p) ) exit() return rems if __name__ == "__main__": # # Debug # p = random_prime(2^512-1,False,2^511) # x = randint(2^511,2^512) % p # e = random_prime(15) # c = pow(x,e,p) # print(f"{x}^{e} mod {p} = {c}") # rems = rth_root(c,p,e) # print(f'x = {rems}') # assert x in rems # Example print("x^e mod p = c") c = int(input("c = ")) p = int(input("p = ")) e = int(input("e = ")) rems = rth_root(c,p,e) print(f"x = {rems}")
Sage
5
bearbear1100/Cryptools
cytro/sage/rth_root.sage
[ "MIT" ]
Class Vec3 Final 'Read only! ' Field x#,y#,z# Method New() End Method New( vx#,vy#,vz# ) x=vx;y=vy;z=vz End Method New( v:Vec3 ) x=v.x;y=v.y;z=v.z End Method Set:Void( vx#,vy#,vz# ) x=vx;y=vy;z=vz End Method Set:Void( v:Vec3 ) x=v.x;y=v.y;z=v.z End Method ToString$() Return "Vec3("+x+","+y+","+z+")" End Method ToArray#[]() Return [ x,y,z ] End Method ToArray:Void( v#[] ) v[0]=x;v[1]=y;v[2]=z End Method Negate:Vec3() Return Tmp( -x,-y,-z ) End Method Plus:Vec3( n# ) Return Tmp( x+n,y+n,z+n ) End Method Plus:Vec3( vx#,vy#,vz# ) Return Tmp( x+vx,y+vy,z+vz ) End Method Plus:Vec3( v:Vec3 ) Return Tmp( x+v.x,y+v.y,z+v.z ) End Method Minus:Vec3( n# ) Return Tmp( x-n,y-n,z-n ) End Method Minus:Vec3( vx#,vy#,vz# ) Return Tmp( x-vx,y-vy,z-vz ) End Method Minus:Vec3( v:Vec3 ) Return Tmp( x-v.x,y-v.y,z-v.z ) End Method Times:Vec3( n# ) Return Tmp( x*n,y*n,z*n ) End Method Times:Vec3( vx#,vy#,vz# ) Return Tmp( x*vx,y*vy,z*vz ) End Method Times:Vec3( v:Vec3 ) Return Tmp( x*v.x,y*v.y,z*v.z ) End Method DividedBy:Vec3( n# ) Return Tmp( x/n,y/n,z/n ) End Method DividedBy:Vec3( vx#,vy#,vz# ) Return Tmp( x/vx,y/vy,z/vz ) End Method DividedBy:Vec3( v:Vec3 ) Return Tmp( x/v.x,y/v.y,z/v.z ) End Method Cross:Vec3( vx#,vy#,vz# ) Return Tmp( y*vz-z*vy,z*vx-x*vz,x*vy-y*vx ) End Method Cross:Vec3( v:Vec3 ) Return Tmp( y*v.z-z*v.y,z*v.x-x*v.z,x*v.y-y*v.x ) End Method Dot#( vx#,vy#,vz# ) Return x*vx+y*vy+z*vz End Method Dot#( v:Vec3 ) Return x*v.x+y*v.y+z*v.z End Method Length#() Return Sqrt( x*x+y*y+z*z ) End Method Normalize:Vec3() Local l:=Length() Return Tmp( x/l,y/l,z/l ) End Function Tmp:Vec3() Local t:=AllocTmp() t.x=0;t.y=0;t.z=0 Return t End Function Tmp:Vec3( vx#,vy#,vz# ) Local t:=AllocTmp() t.x=vx;t.y=vy;t.z=vz Return t End Function Tmp:Vec3( v:Vec3 ) Local t:=AllocTmp() t.x=v.x;t.y=v.y;t.z=v.z Return t End 'Returns unitinitalized tmp! ' Function AllocTmp:Vec3() _tmp+=1 If _tmp=_tmps.Length _tmps=_tmps.Resize( _tmps.Length*2 ) For Local i=_tmp Until _tmps.Length _tmps[i]=New Vec3 Next Endif Return _tmps[_tmp] End 'Internal use... ' Function GetTmps() Return _tmp End 'Internal use... ' Function SetTmps( n ) _tmp=n End Private Global _tmp,_tmps:=InitTmps() Function InitTmps:Vec3[]() Local tmps:=New Vec3[256] For Local i=1 Until tmps.Length tmps[i]=New Vec3 Next Return tmps End End
Monkey
4
blitz-research/monkey
bananas/mak/gles20cube/vec3.monkey
[ "Zlib" ]
name: machine-code-hoare-logic version: 1.1 description: A Hoare logic for machine code author: HOL OpenTheory Packager <[email protected]> license: MIT requires: base requires: hol-base requires: hol-words show: "HOL4" show: "Data.Bool" show: "Data.List" show: "Data.Pair" show: "Function" show: "Number.Natural" show: "Relation" main { article: "machine-code-hoare-logic-unint.art" interpretation: "../../../src/opentheory/hol4.int" }
Isabelle
2
dwRchyngqxs/HOL
examples/machine-code/hoare-triple/machine-code-hoare-logic.thy
[ "BSD-3-Clause" ]
--TEST-- JIT ASSIGN: 029 --INI-- opcache.enable=1 opcache.enable_cli=1 opcache.file_update_protection=0 opcache.jit_buffer_size=1M opcache.protect_memory=1 ;opcache.jit_debug=257 --EXTENSIONS-- opcache --FILE-- <?php function foo() { $i = 1; var_dump($i=2); return $i; } var_dump(foo()); ?> --EXPECT-- int(2) int(2)
PHP
2
NathanFreeman/php-src
ext/opcache/tests/jit/assign_029.phpt
[ "PHP-3.01" ]
--- title: "Automated Model training: Binary classification" date: "`r format(Sys.time(), '%B %d, %Y')`" author: "Team Data Science Process by Microsoft" output: html_document: fig_caption: yes number_sections: yes toc: yes theme: journal highlight: espresso keep_md: false toc_float: true runtime: knit --- ## Introduction This R Markdown performs <b>exploratory</b> model training and evaluation for <b>binary classification</b> tasks using the <a href="http://topepo.github.io/caret/index.html" target="_blank">Caret package</a>, which has convenient functions for resampling, hyper-parameter sweeping, and model accuracy comparison. The user can use Caret with R machine learning packages (such as, <a href="https://cran.r-project.org/web/packages/glmnet/index.html" target="_blank">glmnet</a>, <a href="https://cran.r-project.org/web/packages/randomForest/index.html" target="_blank">RandomForest</a>, <a href="https://cran.r-project.org/web/packages/xgboost/index.html" target="_blank">xgboost</a>, etc.). We use these three algorithms with limited paraUsers can customize this template to create their own model training and evaluation process for binary classification tasks. <hr> ```{r Load Packages, message=FALSE, warning=FALSE, echo=FALSE} #rmarkdown::render("BinaryModelSelection.rmd") options(warn=-1) options(repos='http://cran.rstudio.com/') list.of.packages <- c('glmnet', 'yaml', 'randomForest', 'xgboost', 'lattice', 'shiny', 'gridExtra','lme4','pROC','ROCR','RODBC') new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,'Package'])] if(length(new.packages)) install.packages(new.packages) # Install pbkrtest, caret if (!'pbkrtest' %in% installed.packages()[,'Package']){ pbkrtesturl <- 'https://cran.r-project.org/src/contrib/Archive/pbkrtest/pbkrtest_0.4-5.tar.gz' install.packages(pbkrtesturl, repos=NULL, type='source') library(pbkrtest) } list.of.packages <- c('caret') new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,'Package'])] if(length(new.packages)) install.packages(new.packages) # Load packages library(yaml) library(shiny) library(lme4) library(glmnet) library(randomForest) library(xgboost) library(lattice) library(gridExtra) library(caret) library(pROC) library(ROCR) library(RODBC) ``` ## Specify YAML parameter file for input data and modeling Specify the file which contins the parameter set to train the ML models with. If there are multiple values for each parameter file, then modes ML algorithms will be run with a specified number of random combination of these parameters (currently set to 59). ```{r Read in model parameters from yaml file, message=FALSE, warning=FALSE, echo=FALSE} yamlFile <- file.choose() #yamlFile = "C:\\Users\\remoteuser\\Source\\Repos\\DGADSGeneralRepo\\Code\\Utilities\\Modeling\\BinaryClassification\\BinaryClassification.yaml"; print (paste0("Yaml file loc: ", yamlFile)); ``` <hr> <br> ## Input data, and splitting data into train/test Once the data is read in, it is split into training and testing. Modeling is run on training data (using CV/bootstrapping and parameter sweeping), and evaluated on the test data. ```{r Read and process data from SQL Source, message=FALSE, warning=FALSE, echo=FALSE} # Get data and split train/test config = yaml.load_file(yamlFile) description = eval(parse(text=config$InputData[1])); trainTestSplitFraction = eval(parse(text=config$InputData[2])); ## If RData is specified, load R data loadRData = eval(parse(text=config$RDataSource[1])); if (loadRData == TRUE) { RDatafileLoc = eval(parse(text=config$RDataSource[2])); load(RDatafileLoc); } ## Alternatively, if SQL data source is specified, pull data from SQL source loadSQLData = eval(parse(text=config$SQLSource[1])); if (loadSQLData == TRUE) { server = eval(parse(text=config$SQLSource[2])) database = eval(parse(text=config$SQLSource[3])) username = eval(parse(text=config$SQLSource[4])) password = eval(parse(text=config$SQLSource[5])) windriver = eval(parse(text=config$SQLSource[6])) linuxdriver = eval(parse(text=config$SQLSource[7])) query = eval(parse(text=config$SQLSource[8])) driver <- ifelse(length(grep('linux',tolower(sessionInfo()$platform))) > 0, linuxdriver, windriver); connStr <- paste0('driver=',driver,';server=',server,';database=',database,';Uid=',username,';Pwd=',password, sep=''); dbhandle <- odbcDriverConnect(connStr) trainDF <- sqlQuery(dbhandle, query) odbcClose(dbhandle) } ## SELECT RELVANT COLUMNS targetCol <- config$targetCol[1]; featureColsTmp <- eval(parse(text=config$featureCols[1])); if (is.null(featureColsTmp)) {featureCols <- setdiff(colnames(trainDF), targetCol)} else {featureCols = featureColsTmp} featureExclude <- eval(parse(text=config$featureCols[2])); if (!is.null(featureExclude)) {featureCols = setdiff(featureCols, featureExclude)} trainDF <- trainDF [,c(targetCol,featureCols)] ## CONVERT SOME COLUMNS TO FACTORS factorCols <- eval(parse(text=config$factorCols[1])); if (!is.null(factorCols)) {for (i in 1:length(factorCols)) { trainDF[, factorCols[i]] <- make.names(as.factor(trainDF[, factorCols[i]])) }} # NOTE: If above line gives an error, try this below. It is possible that trainDF[, factorCols[i]] does not work in some versions of R. # In that case, try this convention: trainDF$column (below) # if (!is.null(factorCols)) {for (i in 1:length(factorCols)) { trainDF$factorCols[i] <-as.factor(trainDF$factorCols[i]) }} ## Train test split inTrain = createDataPartition(as.integer(rownames(trainDF)), p = trainTestSplitFraction)$Resample1; trainData = trainDF[inTrain,]; testData = trainDF[-inTrain,]; print (paste0("Input data description: ", description)); print (paste0("Train/test split percent: ", trainTestSplitFraction)); head(trainData, 3); ``` <hr> ## Model training ### Define hyper-parameter sets for glmnet, randomForest and xgBoost Create the control object for cross validation and parameter sweeping. Here we can use <a href="http://www.inside-r.org/packages/cran/caret/docs/oneSE" target="_blank">OneSE</a> (one standard error) as selection function. By default, Caret's train uses 'best' model, i.e. the tuning parameters associated with the largest (or lowest for "RMSE") performance. oneSE is a rule in the spirit of the "one standard error" rule of Breiman et al. (1984), who suggest that the tuning parameter associated with the best performance may over fit. They suggest that the simplest model within one standard error of the empirically optimal model is the better choice. <br><br> Also, for hyper-parameter sweeping, within a fixed computational time, selecting a random set of parameters (or 'random' search option) is typically a better choise than entire grid search for identifying parameter-set that will provide an optimal model, <a href="http://www.jmlr.org/papers/volume13/bergstra12a/bergstra12a.pdf" target="_blank">Bergstra and Bengio, 2012</a>. Therefore, we use a 59 point random grid sample of hyper-parameters. Choosing 59 random points from a hyper-parameter grid will guarantee with 95% confidence that one of the hyper-parameter set will provide a model with accuracy that is within top 5% of the accuracy of all the grid hyper-parameters. ```{r Create parameter grids from yaml file, message=FALSE, warning=FALSE, echo=FALSE} # Create the control object for cross validation and hyper-parameter sweeping nFolds = config$nFolds[1] nGridstoSweep = config$nGridstoSweep[1] sweepStrategy = config$sweepStrategy[1] modelSelectionFunction = config$modelSelectionFunction[1] evaluationMetric = config$evaluationMetric[1] controlObject <- trainControl (method = sweepStrategy, number = nFolds, selectionFunction = modelSelectionFunction, search = "grid", summaryFunction=twoClassSummary, classProbs = TRUE); # Get glmnet parameters and create parameter grid runGlmnet <- eval(parse(text=config$glmnetParams[1])); if (runGlmnet == TRUE) { glmnetParamsAlpha <- eval(parse(text=config$glmnetParams[2])); glmnetParamsLambda <- eval(parse(text=config$glmnetParams[3])); eGrid <- expand.grid(.alpha = glmnetParamsAlpha, .lambda = glmnetParamsLambda); num_glmnetGrid <- min(nrow(eGrid), nGridstoSweep) set.seed(123) eGrid <- eGrid[sample(as.numeric(rownames(eGrid)), num_glmnetGrid),] glmnetStandardize <- eval(parse(text=config$glmnetParams[4])); glmnetFamily <- eval(parse(text=config$glmnetParams[5])); } # Get randomForest parameters and create parameter grid runRf <- eval(parse(text=config$rfParams[1])); if (runRf == TRUE) { mtryMultiplier <- eval(parse(text=config$rfParams[2])); mtryCenter <- ceiling(sqrt(ncol(trainData)-1)); mtrySeqeunce <- unique(ceiling(mtryCenter*mtryMultiplier)); rfGrid <- expand.grid(.mtry = mtrySeqeunce); num_rfGrid <- min(nrow(rfGrid), nGridstoSweep); set.seed(123) rfGrid <- data.frame(rfGrid[sample(as.numeric(rownames(rfGrid)), num_rfGrid),]); colnames(rfGrid) <- '.mtry'; rf_nTree = eval(parse(text=config$rfParams[3])); rf_nodeSize = eval(parse(text=config$rfParams[4])); } # Get xgBoost parameters and create parameter grid runXgBoost <- eval(parse(text=config$xgBoostParams[1])); if (runXgBoost == TRUE) { nrounds <- eval(parse(text=config$xgBoostParams[2])); eta <- eval(parse(text=config$xgBoostParams[3])); max_depth <- eval(parse(text=config$xgBoostParams[4])); gamma <- eval(parse(text=config$xgBoostParams[5])); colsample_bytree <- eval(parse(text=config$xgBoostParams[6])); min_child_weight <- eval(parse(text=config$xgBoostParams[7])); xgBoostObjective <- eval(parse(text=config$xgBoostParams[8])); subsample <- eval(parse(text=config$xgBoostParams[9])); xgBoostGrid = expand.grid(.nrounds = nrounds, .eta = eta, .max_depth = max_depth, .gamma = gamma, .colsample_bytree = colsample_bytree, .min_child_weight = min_child_weight, .subsample = subsample); n_xgBoostgrid <- min(nrow(xgBoostGrid), nGridstoSweep); set.seed(123) xgBoostGrid <- xgBoostGrid[sample(as.numeric(rownames(xgBoostGrid)), n_xgBoostgrid),] } ``` ```{r Construct trainFormula, message=FALSE, warning=FALSE, echo=FALSE} targetCol <- config$targetCol[1]; featureColsTmp <- eval(parse(text=config$featureCols[1])); if (is.null(featureColsTmp)) {featureCols <- setdiff(colnames(trainData), targetCol)} else {featureCols = featureColsTmp} features <- featureCols[1]; for (f in 2:length(featureCols)) {features <- paste(features, '+', featureCols[f])} trainFormula <- as.formula(paste(targetCol, "~", features)); ``` ### Define train formula based on target and features in parameters file ```{r Print trainFormula, message=FALSE, warning=FALSE, echo=FALSE} print (trainFormula) ``` ### Train glmnet, randomForest, and xgBoost with parameter sweeping ```{r Train models, message=FALSE, warning=FALSE, echo=FALSE} # Fit glmnet model if (runGlmnet == TRUE) { netFit <- train(trainFormula, data = trainData, family = glmnetFamily, method = "glmnet", standardize = glmnetStandardize, tuneGrid = eGrid, trControl = controlObject, metric = evaluationMetric); print (paste0("Train GlmNet Model: ", runGlmnet)); } # Fit randomForest model if (runRf == TRUE) { rfFit <- train (trainFormula, data = trainData, method = 'rf', ntree = rf_nTree, nodesize = rf_nodeSize, importance = TRUE, tuneGrid = rfGrid, trControl = controlObject, metric = evaluationMetric); print (paste0("Train RandomForest Model: ", runRf)); } # Fit xgBoost model if (runXgBoost == TRUE) { xgBTreeFit = train(trainFormula, data = trainData, method = "xgbTree", trControl = controlObject, tuneGrid = xgBoostGrid, objective = xgBoostObjective, metric = evaluationMetric) print (paste0("Train xgBoost Model: ", runXgBoost)); } ``` ## Model evaluation: Compare model accuracies of different algorithms, and examine variable importance ### Plot accuracy in test data vs. alogrithms ```{r Compare model accuracy, message=FALSE, warning=FALSE, fig.width=12, fig.height=4, echo=FALSE} if (runGlmnet == TRUE & runRf == TRUE & runXgBoost == TRUE) {allResamples <- resamples(list("glm-net" = netFit, "randomForest" = rfFit, "xgboost" = xgBTreeFit))} else if (runGlmnet == TRUE & runRf == TRUE) {allResamples <- resamples(list("glm-net" = netFit, "randomForest" = rfFit))} else if (runGlmnet == TRUE & runXgBoost == TRUE) {allResamples <- resamples(list("glm-net" = netFit, "xgboost" = xgBTreeFit))} else if (runRf == TRUE & runXgBoost == TRUE) {allResamples <- resamples(list("randomForest" = rfFit, "xgboost" = xgBTreeFit))} else if (runGlmnet == TRUE) {allResamples <- resamples(list("glm-net" = netFit))} else if (runRf == TRUE) {allResamples <- resamples(list("randomForest" = rfFit))} else if (runXgBoost == TRUE) {allResamples <- resamples(list("xgboost" = xgBTreeFit))} p1 <- bwplot(allResamples, metric='ROC', col='darkred', fill='lightblue', main = 'ROC vs. Algos', height=150, width=150) p2 <- bwplot(allResamples, metric='Sens', col='darkred', fill='lightgreen', main = 'Sensitivity vs. Algos', height=150, width=150) p3 <- bwplot(allResamples, metric='Spec', col='darkred', fill='gold', main = 'Specificty vs. Algos', height=150, width=150) grid.arrange(p1,p2,p3, ncol=3) ``` ### Visualize scatterplot of actual vs. predicted values in the <b>test data</b> from different models ```{r Visualize actual vs. predicted values in training data, message=FALSE, warning=FALSE, fig.width=10, fig.height=4, echo=FALSE} # Get predictions from models predictions <- data.frame(testData[,targetCol]); colnames(predictions) <- targetCol; par(mfrow = c(1, 3)) # Create scatterplot for actual vs. glmnet predictions if (runGlmnet == TRUE) { predictions$glmnet <- predict(netFit, testData, type='prob')$X1; pred <- prediction(predictions$glmnet, predictions[,targetCol]); auc <- round(performance(pred,"auc")@y.values[[1]][1], 2); perf <- performance(pred,'tpr','fpr'); plot(perf, col='darkgreen', main = "Glmnet"); legend("bottomright", inset = 0.01, legend=paste0("AUC: ", auc), cex=1, box.lty=0) } # Create scatterplot for actual vs. randomForest predictions if (runRf == TRUE) { predictions$rf <- predict(rfFit, testData, type='prob')$X1; pred <- prediction(predictions$rf, predictions[,targetCol]); auc <- round(performance(pred,"auc")@y.values[[1]][1], 2); perf <- performance(pred,'tpr','fpr'); plot(perf, col='darkgreen', main = "Random Forest"); legend("bottomright", inset = 0.01, legend=paste0("AUC: ", auc), cex=1, box.lty=0) } # Create scatterplot for actual vs. xgboost predictions if (runXgBoost == TRUE) { predictions$xgb <- predict(xgBTreeFit, testData, type='prob')$X1; pred <- prediction(predictions$xgb, predictions[,targetCol]); auc <- round(performance(pred,"auc")@y.values[[1]][1], 2); perf <- performance(pred,'tpr','fpr'); plot(perf, col='darkgreen', main = "xgBoost"); legend("bottomright", inset = 0.01, legend=paste0("AUC: ", auc), cex=1, box.lty=0) } ``` ### Variable importance: Plot top 10 relative variable importances for different models ```{r Variable importance, message=FALSE, warning=FALSE, fig.width=12, fig.height=6, echo=FALSE} if (runGlmnet == TRUE) {vI <- varImp(object=netFit, useModel = TRUE, scale=TRUE); p1 <- plot(vI, main = "glmNet", xlab='Relative Importance', ylab = 'Feature', top=10);} if (runRf == TRUE) {vI <- varImp(object=rfFit, useModel = TRUE, scale=TRUE); p2 <- plot(vI, main = "randomForest", xlab='Relative Importance', ylab = 'Feature', top=10);} if (runXgBoost == TRUE) {vI <- varImp(object=xgBTreeFit, useModel = TRUE, scale=TRUE); p3 <- plot(vI, main = "xgBoost", xlab='Relative Importance', ylab = 'Feature', top=10);} if (runGlmnet == TRUE & runRf == TRUE & runXgBoost == TRUE) {grid.arrange(p1,p2,p3, ncol=3)} else if (runGlmnet == TRUE & runRf == TRUE) {grid.arrange(p1,p2, ncol=2)} else if (runGlmnet == TRUE & runXgBoost == TRUE) {grid.arrange(p1,p3, ncol=2)} else if (runRf == TRUE & runXgBoost == TRUE) {grid.arrange(p2,p3, ncol=2)} else if (runGlmnet == TRUE) {p1} else if (runRf == TRUE) {p2} else if (runXgBoost == TRUE) {p3} ``` <hr> ## Summary Here we perform preliminary exploration of 3 algorithms with limited CV and parameter grid sweeping and compare the accuracy of the models in the test data. Based on these explorations, user may decide to use a limited number of algorithms for creating models with extensive parameters sweeping and evaluating those models in the test data-set. Users may modify the code to explore according to the needs of their data-sets or based on their experience with <a href="https://topepo.github.io/caret/modelList.html" target="_blank">other algorithms</a> available for use through Caret. The top 2-3 approaches could be taken for further model development and testing using the test data-set. Also, there are many alternative ways to run the algorithms, besides caret, and compare the results.
RMarkdown
5
bkuk69/Azure-TDSP-Utilities
DataScienceUtilities/Modeling/BinaryClassification/BinaryModelSelection.rmd
[ "CC-BY-4.0", "MIT" ]
//in order for experimental ABIEncoderV2 to be “stable” when passing structs as arguments we must //use at least version 0.4.19 of solidity pragma solidity ^0.6.5; pragma experimental ABIEncoderV2; contract ComplexStorage { struct Foo { string id; string name; } struct Bar { uint id; uint data; } struct Fuzz { Bar bar; uint data; } struct Baz { string id; uint data; } struct Boz { uint data; string id; } struct Nuu { Foo foo; } struct Nar { Nuu nuu; } struct Naz { Nar nar; uint data; } struct Wiz { Foo foo; string data; } struct Fizz { Fuzz fuzz; Foo foo; string data; } Foo foo; Bar bar; Fuzz fuzz; Baz baz; Boz boz; Nuu nuu; Naz naz; Nar nar; Wiz wiz; Fizz fizz; Foo[] multipleFoo; Foo[3] staticMultipleFoo; Foo[1] foo1; Foo[2] foo2; Nar[] multipleDynamicNar; Nar[3] multipleStaticNar; Bar[3] staticMultipleBar; constructor() public { Foo memory _foo = Foo("id", "name"); Bar memory _bar = Bar(123,123); foo = _foo; bar = _bar; multipleFoo.push(_foo); staticMultipleFoo[0] = _foo; staticMultipleFoo[1] = _foo; staticMultipleFoo[2] = _foo; foo1[0] = _foo; foo2[0] = _foo; foo2[1] = Foo("id2", "name2"); staticMultipleBar[1] = _bar; nar = Nar(Nuu(Foo("4", "nestedFoo"))); fizz = Fizz( fuzz, Foo("id", "name"), "fizz Data"); multipleDynamicNar.push(nar); multipleDynamicNar.push(nar); multipleDynamicNar.push(Nar(Nuu(Foo("", "")))); multipleStaticNar[0] = nar; multipleStaticNar[2] = nar; emit Access(msg.sender, _foo, _bar); emit StructArraysAccess(msg.sender, multipleFoo, staticMultipleBar); } function setFoo(Foo memory _toSet) public { foo = _toSet; } function setBar(Bar memory _toSet) public { bar = _toSet; } function setFuzz(Fuzz memory _toSet) public { fuzz = _toSet; } function setBaz(Baz memory _toSet) public { baz = _toSet; } function setBoz(Boz memory _toSet) public { boz = _toSet; } function setNuu(Nuu memory _toSet) public { nuu = _toSet; } function setNaz(Naz memory _naz) public { naz = _naz; } function setWiz(Wiz memory _toSet) public { wiz = _toSet; } function getFoo() public view returns (Foo memory) { return foo; } function getBar() public view returns (Bar memory) { return bar; } function getFuzz() public view returns (Fuzz memory) { return fuzz; } function getNaz() public view returns (Naz memory) { return naz; } function getWiz() public view returns (Wiz memory) { return wiz; } function getFooBar() public view returns (Foo memory, Bar memory) { return (foo, bar); } function getFooBarNaz() public view returns (Foo memory, Bar memory, Naz memory) { return (foo, bar, naz); } function getFooUint() public view returns (Foo memory, uint256) { return (foo, 1); } function getMultipleFoo() public view returns (Foo[] memory) { return multipleFoo; } function getEmpty3Foo() public pure returns (Foo[3] memory) { Foo[3] memory emptyFoo; return emptyFoo; } function getStaticMultipleFoo() public view returns (Foo[3] memory) { return staticMultipleFoo; } function getFoo1Foo2() public view returns (Foo[1] memory, Foo[2] memory) { return (foo1, foo2); } function idNarBarFooArrays(Nar[3] memory a, Bar[3] memory b, Foo[] memory c, Nar[] memory d, Foo[3] memory e) public pure returns (Nar[3] memory, Bar[3] memory, Foo[] memory, Nar[] memory, Foo[3] memory) { return (a, b, c, d, e); } function getNarBarFooArrays() public view returns (Nar[3] memory, Bar[3] memory, Foo[] memory, Nar[] memory, Foo[3] memory) { return (multipleStaticNar, staticMultipleBar, multipleFoo, multipleDynamicNar, staticMultipleFoo); } event Access(address indexed _address, Foo _foo, Bar _bar); event StructArraysAccess(address indexed _address, Foo[] _fooArray, Bar[3] _barArray); }
Solidity
5
kalinbas/web3j
codegen/src/test/resources/solidity/complexstorage/ComplexStorage.sol
[ "Apache-2.0" ]
@test-space-separated: #aaaaaa // Start with A #bbbbbb // then some B #cccccc; // and round it out with C @test-space-separated : #aaaaaa // Start with A #bbbbbb // then some B #cccccc; // and round it out with C @test-comma-separated: #aaaaaa, // Start with A #bbbbbb, // then some B #cccccc; // and round it out with C
Less
1
toplenboren/prettier
tests/less/comments/value-lists.less
[ "MIT" ]
\y -> Natural/fold 0 (\x -> x) y
Grace
2
DebugSteven/grace
tasty/data/unit/natural-fold-input.grace
[ "BSD-3-Clause" ]
const { files } = await Deno.emit("/mod.ts", { bundle: "classic", sources: { "/mod.ts": `import { hello } from "/hello.ts"; console.log(hello);`, "/hello.ts": `export const hello: string = "Hello, Compiler API!"`, }, compilerOptions: { sourceMap: false, }, }); eval(files["deno:///bundle.js"]);
TypeScript
3
petamoriken/deno
cli/tests/testdata/standalone_compiler_ops.ts
[ "MIT" ]
/** * Author......: See docs/credits.txt * License.....: MIT */ //#define NEW_SIMD_CODE #ifdef KERNEL_STATIC #include "inc_vendor.h" #include "inc_types.h" #include "inc_platform.cl" #include "inc_common.cl" #include "inc_simd.cl" #endif CONSTANT_VK u32a PE_CONST[256] = { 0, 49345, 49537, 320, 49921, 960, 640, 49729, 50689, 1728, 1920, 51009, 1280, 50625, 50305, 1088, 52225, 3264, 3456, 52545, 3840, 53185, 52865, 3648, 2560, 51905, 52097, 2880, 51457, 2496, 2176, 51265, 55297, 6336, 6528, 55617, 6912, 56257, 55937, 6720, 7680, 57025, 57217, 8000, 56577, 7616, 7296, 56385, 5120, 54465, 54657, 5440, 55041, 6080, 5760, 54849, 53761, 4800, 4992, 54081, 4352, 53697, 53377, 4160, 61441, 12480, 12672, 61761, 13056, 62401, 62081, 12864, 13824, 63169, 63361, 14144, 62721, 13760, 13440, 62529, 15360, 64705, 64897, 15680, 65281, 16320, 16000, 65089, 64001, 15040, 15232, 64321, 14592, 63937, 63617, 14400, 10240, 59585, 59777, 10560, 60161, 11200, 10880, 59969, 60929, 11968, 12160, 61249, 11520, 60865, 60545, 11328, 58369, 9408, 9600, 58689, 9984, 59329, 59009, 9792, 8704, 58049, 58241, 9024, 57601, 8640, 8320, 57409, 40961, 24768, 24960, 41281, 25344, 41921, 41601, 25152, 26112, 42689, 42881, 26432, 42241, 26048, 25728, 42049, 27648, 44225, 44417, 27968, 44801, 28608, 28288, 44609, 43521, 27328, 27520, 43841, 26880, 43457, 43137, 26688, 30720, 47297, 47489, 31040, 47873, 31680, 31360, 47681, 48641, 32448, 32640, 48961, 32000, 48577, 48257, 31808, 46081, 29888, 30080, 46401, 30464, 47041, 46721, 30272, 29184, 45761, 45953, 29504, 45313, 29120, 28800, 45121, 20480, 37057, 37249, 20800, 37633, 21440, 21120, 37441, 38401, 22208, 22400, 38721, 21760, 38337, 38017, 21568, 39937, 23744, 23936, 40257, 24320, 40897, 40577, 24128, 23040, 39617, 39809, 23360, 39169, 22976, 22656, 38977, 34817, 18624, 18816, 35137, 19200, 35777, 35457, 19008, 19968, 36545, 36737, 20288, 36097, 19904, 19584, 35905, 17408, 33985, 34177, 17728, 34561, 18368, 18048, 34369, 33281, 17088, 17280, 33601, 16640, 33217, 32897, 16448 }; KERNEL_FQ void m26200_mxx (KERN_ATTR_BASIC ()) { /** * modifier */ const u64 lid = get_local_id (0); const u64 gid = get_global_id (0); if (gid >= gid_max) return; /** * base */ u32 pw_buf0[4]; pw_buf0[0] = pws[gid].i[0]; pw_buf0[1] = pws[gid].i[1]; pw_buf0[2] = pws[gid].i[2]; pw_buf0[3] = pws[gid].i[3]; const u32 pw_l_len = pws[gid].pw_len & 63; /** * loop */ for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) { const u32 pw_r_len = pwlenx_create_combt (combs_buf, il_pos) & 63; const u32 pw_len = (pw_l_len + pw_r_len) & 63; /** * concat password candidate */ u32 wordl0[4] = { 0 }; u32 wordl1[4] = { 0 }; u32 wordl2[4] = { 0 }; u32 wordl3[4] = { 0 }; wordl0[0] = pw_buf0[0]; wordl0[1] = pw_buf0[1]; wordl0[2] = pw_buf0[2]; wordl0[3] = pw_buf0[3]; u32 wordr0[4] = { 0 }; u32 wordr1[4] = { 0 }; u32 wordr2[4] = { 0 }; u32 wordr3[4] = { 0 }; wordr0[0] = ix_create_combt (combs_buf, il_pos, 0); wordr0[1] = ix_create_combt (combs_buf, il_pos, 1); wordr0[2] = ix_create_combt (combs_buf, il_pos, 2); wordr0[3] = ix_create_combt (combs_buf, il_pos, 3); wordr1[0] = ix_create_combt (combs_buf, il_pos, 4); wordr1[1] = ix_create_combt (combs_buf, il_pos, 5); wordr1[2] = ix_create_combt (combs_buf, il_pos, 6); wordr1[3] = ix_create_combt (combs_buf, il_pos, 7); if (combs_mode == COMBINATOR_MODE_BASE_LEFT) { switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len); } else { switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len); } u32 w0[4]; u32 w1[4]; w0[0] = wordl0[0] | wordr0[0]; w0[1] = wordl0[1] | wordr0[1]; w0[2] = wordl0[2] | wordr0[2]; w0[3] = wordl0[3] | wordr0[3]; w1[0] = wordl1[0] | wordr1[0]; w1[1] = wordl1[1] | wordr1[1]; w1[2] = wordl1[2] | wordr1[2]; w1[3] = wordl1[3] | wordr1[3]; u32 w[8] = { 0 }; w[ 0] = w0[0]; w[ 1] = w0[1]; w[ 2] = w0[2]; w[ 3] = w0[3]; w[ 4] = w1[0]; w[ 5] = w1[1]; w[ 6] = w1[2]; w[ 7] = w1[3]; u32 hash = 17; u8 scratch[16] = { 0 }; u8 *input = (u8 *) w; for (u32 i = 0; i < 5; i++) { for (u32 j = 0; j < pw_len; j++) { int idx = 15 - (j & 15); scratch[idx] ^= input[j]; } for (u32 j = 0; j < 16; j += 2) { hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[15]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[14]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[13]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[12]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[11]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[10]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 9]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 8]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 7]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 6]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 5]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 4]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 3]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 2]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 1]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 0]]); scratch[j] = (unsigned char)( hash & 0xff); scratch[j + 1] = (unsigned char)((hash >> 8) & 0xff); } } u8 target[16] = { 0 }; for (u32 i = 0; i < 16; i++) { u8 lower = (scratch[i] & 0x7f); if ((lower >= 'A' && lower <= 'Z') || (lower >= 'a' && lower <= 'z')) { target[i] = lower; } else { target[i] = (u8)((scratch[i] >> 4) + 0x61); } } u32 *digest = (u32 *) target; const u32 r0 = digest[DGST_R0]; const u32 r1 = digest[DGST_R1]; const u32 r2 = digest[DGST_R2]; const u32 r3 = digest[DGST_R3]; COMPARE_M_SIMD (r0, r1, r2, r3); } } KERNEL_FQ void m26200_sxx (KERN_ATTR_BASIC ()) { /** * modifier */ const u64 lid = get_local_id (0); const u64 gid = get_global_id (0); if (gid >= gid_max) return; /** * digest */ const u32 search[4] = { digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0], digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1], digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2], digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3] }; /** * base */ u32 pw_buf0[4]; pw_buf0[0] = pws[gid].i[0]; pw_buf0[1] = pws[gid].i[1]; pw_buf0[2] = pws[gid].i[2]; pw_buf0[3] = pws[gid].i[3]; const u32 pw_l_len = pws[gid].pw_len & 63; /** * loop */ for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) { const u32 pw_r_len = pwlenx_create_combt (combs_buf, il_pos) & 63; const u32 pw_len = (pw_l_len + pw_r_len) & 63; /** * concat password candidate */ u32 wordl0[4] = { 0 }; u32 wordl1[4] = { 0 }; u32 wordl2[4] = { 0 }; u32 wordl3[4] = { 0 }; wordl0[0] = pw_buf0[0]; wordl0[1] = pw_buf0[1]; wordl0[2] = pw_buf0[2]; wordl0[3] = pw_buf0[3]; u32 wordr0[4] = { 0 }; u32 wordr1[4] = { 0 }; u32 wordr2[4] = { 0 }; u32 wordr3[4] = { 0 }; wordr0[0] = ix_create_combt (combs_buf, il_pos, 0); wordr0[1] = ix_create_combt (combs_buf, il_pos, 1); wordr0[2] = ix_create_combt (combs_buf, il_pos, 2); wordr0[3] = ix_create_combt (combs_buf, il_pos, 3); wordr1[0] = ix_create_combt (combs_buf, il_pos, 4); wordr1[1] = ix_create_combt (combs_buf, il_pos, 5); wordr1[2] = ix_create_combt (combs_buf, il_pos, 6); wordr1[3] = ix_create_combt (combs_buf, il_pos, 7); if (combs_mode == COMBINATOR_MODE_BASE_LEFT) { switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len); } else { switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len); } u32 w0[4]; u32 w1[4]; w0[0] = wordl0[0] | wordr0[0]; w0[1] = wordl0[1] | wordr0[1]; w0[2] = wordl0[2] | wordr0[2]; w0[3] = wordl0[3] | wordr0[3]; w1[0] = wordl1[0] | wordr1[0]; w1[1] = wordl1[1] | wordr1[1]; w1[2] = wordl1[2] | wordr1[2]; w1[3] = wordl1[3] | wordr1[3]; u32 w[8] = { 0 }; w[ 0] = w0[0]; w[ 1] = w0[1]; w[ 2] = w0[2]; w[ 3] = w0[3]; w[ 4] = w1[0]; w[ 5] = w1[1]; w[ 6] = w1[2]; w[ 7] = w1[3]; u32 hash = 17; u8 scratch[16] = { 0 }; u8 *input = (u8 *) w; for (u32 i = 0; i < 5; i++) { for (u32 j = 0; j < pw_len; j++) { int idx = 15 - (j & 15); scratch[idx] ^= input[j]; } for (u32 j = 0; j < 16; j += 2) { hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[15]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[14]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[13]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[12]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[11]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[10]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 9]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 8]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 7]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 6]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 5]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 4]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 3]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 2]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 1]]); hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 0]]); scratch[j] = (unsigned char)( hash & 0xff); scratch[j + 1] = (unsigned char)((hash >> 8) & 0xff); } } u8 target[16] = { 0 }; for (u32 i = 0; i < 16; i++) { u8 lower = (scratch[i] & 0x7f); if ((lower >= 'A' && lower <= 'Z') || (lower >= 'a' && lower <= 'z')) { target[i] = lower; } else { target[i] = (u8)((scratch[i] >> 4) + 0x61); } } u32 *digest = (u32 *) target; const u32 r0 = digest[DGST_R0]; const u32 r1 = digest[DGST_R1]; const u32 r2 = digest[DGST_R2]; const u32 r3 = digest[DGST_R3]; COMPARE_S_SIMD (r0, r1, r2, r3); } }
OpenCL
4
Masha/hashcat
OpenCL/m26200_a1-pure.cl
[ "MIT" ]
import React from 'react'; const Foo = () => <div className="foo" />; export default Foo;
JSX
2
Joel-LT/enzyme-2
packages/enzyme-example-mocha/src/Foo.jsx
[ "MIT" ]
class Proxies { class ProxyReceiver : Fancy BasicObject { """ A ProxyReceiver is an object which proxies all message sends to it to 2 other objects. It will send each message first to its @proxy instance variable and then to the @obj instance variable. """ def initialize: @proxy for: @obj { """ @proxy Proxy receiver for @obj. @obj Original receiver object. Initializes a new ProxyReceiver with @proxy for @obj. """ self } def unknown_message: msg with_params: params { """ @msg Incoming message name. @params Paremeters of incoming message send. Forwards all incoming messages to @self to @@proxy and then @@obj. """ @proxy receive_message: msg with_params: params @obj receive_message: msg with_params: params } } class RespondsToProxy : Fancy BasicObject { """ A RespondsToProxy is a Proxy that forwards any message sent to it to it's @target instance variable only if it responds to that message. Any messages that @target doesn't respond to simply won't be sent and @nil will be returned. """ def initialize: @target { """ @target Target receiver object. Initializes a new RespondsToProxy for @target. """ self } def unknown_message: msg with_params: params { """ @msg Incoming message name. @params Paremeters of incoming message send. Forwards all incoming message to @self to @@target only if @@target responds to them. """ if: (@target responds_to?: msg) then: { @target receive_message: msg with_params: params } } } class ActorProxy : Fancy BasicObject { """ An ActorProxy is a Proxy that forwards any message sent to it to it's @target object as a future send by default. If explicitly sent an async message, it will forward the async send to @target, returning @nil instead of a @FutureSend@, as expected. Example: ap = ActorProxy new: target_actor # this: f = ap some_future_send: an_arg # is the same as: f = target_actor @ some_future_send: an_arg # and this: ap @@ some_async_send: another_arg # is the same as: target_actor @@ some_async_send: another_arg """ def initialize: @target def send_future: m with_params: p { @target send_future: m with_params: p } def send_async: m with_params: p { @target send_async: m with_params: p } def unknown_message: m with_params: p { @target send_future: m with_params: p } } class DistributingProxy : Fancy BasicObject { """ DistributingProxy is a Proxy that round-robin distributes messages to objects in a @Fancy::Enumerable@ specified upon creation. Example: p = DistributingProxy new: [worker1, worker2, worker3, worker4] loop: { req = @input receive_request p handle_request: req # will be forwarded to worker1-4 } """ def initialize { ArgumentError raise: "Missing list of proxy targets" } def initialize: @targets { @free = @targets to_a dup @mutex = Mutex new @waiting = ConditionVariable new } def __with_target__: block { t = @mutex synchronize: { { @waiting wait: @mutex } until: { @free empty? not } @free shift } val = block call: [t] @mutex synchronize: { @free << t; @waiting broadcast } val } RemovedMethodsPattern = \ /^(:initialize|initialize:|__with_target__:|unknown_message:with_params:|send_async:with_params:|send_future:with_params:|__send__)$/ instance_methods reject: RemovedMethodsPattern . each: |m| { undef_method(m) } def unknown_message: m with_params: p { __with_target__: @{ receive_message: m with_params: p } } def send_async: m with_params: p { __with_target__: @{ send_async: m with_params: p } } def send_future: m with_params: p { __with_target__: @{ send_future: m with_params: p } } } }
Fancy
5
bakkdoor/fancy
lib/proxies.fy
[ "BSD-3-Clause" ]
<mat-slider thumbLabel [displayWith]="formatLabel" tickInterval="1000" step="1000" min="0" max="100000" aria-label="units"></mat-slider>
HTML
3
tungyingwaltz/components
src/components-examples/material/slider/slider-formatting/slider-formatting-example.html
[ "MIT" ]
@import "../css/variables.module"; .excalidraw { .Checkbox { margin: 4px 0.3em; display: flex; align-items: center; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; &:hover:not(.is-checked) .Checkbox-box:not(:focus) { box-shadow: 0 0 0 2px #{$oc-blue-4}; } &:hover:not(.is-checked) .Checkbox-box:not(:focus) { svg { display: block; opacity: 0.3; } } &:active { .Checkbox-box { box-shadow: 0 0 2px 1px inset #{$oc-blue-7} !important; } } &:hover { .Checkbox-box { background-color: fade-out($oc-blue-1, 0.8); } } &.is-checked { .Checkbox-box { background-color: #{$oc-blue-1}; svg { display: block; } } &:hover .Checkbox-box { background-color: #{$oc-blue-2}; } } .Checkbox-box { width: 22px; height: 22px; padding: 0; flex: 0 0 auto; margin: 0 1em; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px #{$oc-blue-7}; background-color: transparent; border-radius: 4px; color: #{$oc-blue-7}; &:focus { box-shadow: 0 0 0 3px #{$oc-blue-7}; } svg { display: none; width: 16px; height: 16px; stroke-width: 3px; } } .Checkbox-label { display: flex; align-items: center; } .excalidraw-tooltip-icon { width: 1em; height: 1em; } } }
SCSS
3
dineshondev/excalidraw
src/components/CheckboxItem.scss
[ "MIT" ]
# # Screenshot viewer... whee?!? # import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import javax.imageio.*; import java.io.File; import ui.*; import armitage.*; global('%screenshots %webcams %refreshcmd'); %screenshots = ohash(); %webcams = ohash(); sub image_viewer { local('$panel $viewer $buttons $refresh $watch'); $panel = [new JPanel]; [$panel setLayout: [new BorderLayout]]; $viewer = [new ZoomableImage]; [$panel add: [new JScrollPane: $viewer], [BorderLayout CENTER]]; $buttons = [new JPanel]; [$buttons setLayout: [new FlowLayout: [FlowLayout CENTER]]]; $refresh = [new JButton: "Refresh"]; [$refresh addActionListener: lambda({ m_cmd($sid, %refreshcmd[$title][$sid]); }, $sid => $2, \$command, \$title)]; [$buttons add: $refresh]; $watch = [new JButton: "Watch (10s)"]; [$watch addActionListener: lambda({ local('$timer'); $timer = [new SimpleTimer: 10000]; [$timer setRunnable: lambda({ if ($sid !in $container) { [$timer stop]; } else { m_cmd($sid, %refreshcmd[$title][$sid]); } }, \$sid, \$timer, \$container, \$title)]; }, $sid => $2, \$container, \$title)]; [$buttons add: $watch]; [$panel add: $buttons, [BorderLayout SOUTH]]; [$frame addTab: "$title $2", $panel, lambda({ $container[$key] = $null; size($container); }, $key => $2, \$container), "$title " . sessionToHost($2)]; return $viewer; } sub update_viewer { if ($0 eq "execute") { %refreshcmd[$title][$1] = $2; } else if ($0 eq "update" && "*Operation failed*" iswm $2) { showError($2); } else if ($0 eq "update" && $2 ismatch "$type saved to: (.*?)") { local('$file'); ($file) = matched(); [lambda({ local('$image $panel'); # we're collaborating, so download the file please... if ($client !is $mclient) { downloadFile($file, $null, $this); yield; $file = getFileProper(cwd(), $1); } logFile($file, sessionToHost($sid), $type); $image = [ImageIO read: [new File: $file]]; fire_event_async("user_" . lc(strrep($type, " ", "_")), $sid, $file); dispatchEvent(lambda({ [$container[$id] setIcon: [new ImageIcon: $image]]; }, \$container, \$image, $id => $sid)); if (-isFile $file && "*.jpeg" iswm $file) { deleteOnExit($file); } }, \$file, $sid => $1, \$type, \$title, \$container)]; } } setMissPolicy(%screenshots, lambda(&image_viewer, $title => "Screenshot", $container => %screenshots)); setMissPolicy(%webcams, lambda(&image_viewer, $title => "Webcam", $container => %webcams)); %handlers["screenshot"] = lambda(&update_viewer, $type => "Screenshot", $title => "Screenshot", $container => %screenshots); %handlers["webcam_snap"] = lambda(&update_viewer, $type => "Webcam shot", $title => "Webcam", $container => %webcams); sub createScreenshotViewer { return lambda({ m_cmd($sid, "screenshot -v false"); }, $sid => $1); } sub createWebcamViewer { return lambda({ m_cmd_callback($sid, "webcam_list", { if ($0 eq "end") { local('$cams $cam'); $cams = map({ return %(Camera => $1); }, split("\n", ["$2" trim])); # get rid of non-camera entries please foreach $cam ($cams) { if ($cam['Camera'] !ismatch '\d+: .*') { remove(); } } # no camera... do nothing. if (size($cams) == 0) { showError("Host does not have a camera"); return; } quickListDialog("Cameras", "Take Picture", @("Camera", "Camera"), $cams, $width => 320, $height => 200, lambda({ if ($1 !is $null) { local('$index'); ($index) = split(': ', $1); m_cmd($sid, "webcam_snap -i $index -v false"); } }, $sid => $1)); } }); }, $sid => $1); }
Slash
3
retr0-13/armitage
scripts/screenshot.sl
[ "BSD-3-Clause" ]
/*!40103 SET TIME_ZONE='+00:00' */; CREATE TABLE `t_access3` ( `accessKey` varchar(100) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
SQL
2
cuishuang/tidb
br/tests/lightning_issue_282/data/issue282.t_access3-schema.sql
[ "Apache-2.0" ]
# Copyright (c) 2022 Fyde Innovations Limited and the openFyde Authors. # Distributed under the license specified in the root directory of this project. # Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 inherit cmake flag-o-matic udev if [[ ${PV} == 9999* ]]; then inherit git-r3 EGIT_REPO_URI="https://github.com/${PN/-//}.git" SRC_URI="" else # We base our versioning on Raspbian # Go to https://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-userland/ # Example: # * libraspberrypi-bin-dbgsym_2+git20201022~151804+e432bc3-1_arm64.deb # * "e432bc3" is the first 7 hex digits of the commit hash. # * Go to https://github.com/raspberrypi/userland/commits/master and find the full hash GIT_COMMIT="e432bc3400401064e2d8affa5d1454aac2cf4a00" SRC_URI="https://github.com/raspberrypi/userland/archive/${GIT_COMMIT}.tar.gz -> ${P}.tar.gz" KEYWORDS="arm arm64" RESTRICT="mirror" S="${WORKDIR}/userland-${GIT_COMMIT}" fi DESCRIPTION="Raspberry Pi userspace tools and libraries" HOMEPAGE="https://github.com/raspberrypi/userland" LICENSE="BSD" SLOT="0" DEPEND="" RDEPEND=" !media-libs/raspberrypi-userland-bin" PATCHES=( # Install in $(get_libdir) # See https://github.com/raspberrypi/userland/pull/650 "${FILESDIR}/${PN}-libdir.patch" # Don't install includes that collide. "${FILESDIR}/${PN}-include.patch" # See https://github.com/raspberrypi/userland/pull/655 "${FILESDIR}/${PN}-libfdt-static.patch" # See https://github.com/raspberrypi/userland/pull/659 "${FILESDIR}/${PN}-pkgconf-arm64.patch" ) src_prepare() { cros_use_gcc cmake_src_prepare sed -i \ -e 's:DESTINATION ${VMCS_INSTALL_PREFIX}/src:DESTINATION ${VMCS_INSTALL_PREFIX}/'"share/doc/${PF}:" \ "${S}/makefiles/cmake/vmcs.cmake" || die "Failed sedding makefiles/cmake/vmcs.cmake" sed -i \ -e 's:^install(TARGETS EGL GLESv2 OpenVG WFC:install(TARGETS:' \ -e '/^install(TARGETS EGL_static GLESv2_static/d' \ "${S}/interface/khronos/CMakeLists.txt" || die "Failed sedding interface/khronos/CMakeLists.txt" } src_configure() { append-ldflags $(no-as-needed) mycmakeargs=( -DVMCS_INSTALL_PREFIX="${EPREFIX}/usr" -DARM64=$(usex arm64) ) cmake_src_configure } src_install() { cmake_src_install udev_dorules "${FILESDIR}/92-local-vchiq-permissions.rules" }
Gentoo Ebuild
3
FydeOS/chromium_os_for_raspberry_pi
baseboard-rpi3/media-libs/raspberrypi-userland/raspberrypi-userland-0_pre20201022.ebuild
[ "BSD-2-Clause" ]
[{:type :error, :file "/androidnative/src/main.cpp", :line 15, :column nil, :message "C3861: 'Hello': identifier not found"} {:type :error, :file "/androidnative/src/main.cpp", :line 17, :column nil, :message "C4430: missing type specifier - int assumed. Note: C++ does not support default-int"} {:type :error, :file "/androidnative/src/main.cpp", :line 17, :column nil, :message "C2146: syntax error: missing ';' before identifier 'g_foo'"} {:type :error, :file "/king_device_id/src/kdid.cpp", :line 4, :column nil, :message "C1083: Cannot open include file: 'unistd.h': No such file or directory"} {:type :error, :file "/var/extender/.wine/drive_c/ProgramFilesx86/WindowsKits/8.1/Include/shared/ws2def.h", :line 905, :column 16, :message "pasting formed '\"Use \"\"ADDRINFOEXW\"', an invalid preprocessing token [-Winvalid-token-paste]"} {:type :error, :file "/androidnative/ext.manifest", :message "/usr/local/bin/lld-link: error: 975380ca-f446-4945-87db-070ee587b91c.lib(dopenssl.cpp_0.o): undefined symbol: _RAND_poll"} {:type :error, :file "/androidnative/ext.manifest", :message "/usr/local/bin/lld-link: error: 975380ca-f446-4945-87db-070ee587b91c.lib(dopenssl.cpp_0.o): undefined symbol: _RAND_bytes"} {:type :warning, :file "/androidnative/ext.manifest", :message "/usr/local/bin/lld-link: warning: 222613a7-2aea-4afd-8498-68f39f62468f.lib(dsocket.cpp_1.o): locally defined symbol imported: ___std_terminate (defined in libvcruntime.lib(frame.obj))"} {:type :warning, :file "/androidnative/ext.manifest", :message "/usr/local/bin/lld-link: warning: 222613a7-2aea-4afd-8498-68f39f62468f.lib(dsocket.cpp_1.o): locally defined symbol imported: __CxxThrowException@8 (defined in libvcruntime.lib(throw.obj))"} {:type :error, :file "/androidnative/ext.manifest", :message "/usr/local/bin/lld-link: error: 222613a7-2aea-4afd-8498-68f39f62468f.lib(dsocket.cpp_1.o): undefined symbol: _ERR_reason_error_string"} {:type :error, :file "/androidnative/ext.manifest", :message "/usr/local/bin/lld-link: error: 222613a7-2aea-4afd-8498-68f39f62468f.lib(dsocket.cpp_1.o): undefined symbol: _ERR_clear_error"} {:type :error, :file "/androidnative/ext.manifest", :message "/usr/local/bin/lld-link: error: 222613a7-2aea-4afd-8498-68f39f62468f.lib(dsocket.cpp_1.o): undefined symbol: _BIO_new_mem_buf"} {:type :error, :file "/androidnative/ext.manifest", :message "/usr/local/bin/lld-link: error: could not open Crypt32.Lib.lib: No such file or directory"} {:type :error, :file "/androidnative/ext.manifest", :message "clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)"}]
edn
2
cmarincia/defold
editor/test/resources/native_extension_error_parsing/errorLogWin32_parsed.edn
[ "ECL-2.0", "Apache-2.0" ]
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 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. ==============================================================================*/ #include <memory> #include "absl/memory/memory.h" #include "tensorflow/lite/delegates/xnnpack/xnnpack_delegate.h" #include "tensorflow/lite/experimental/acceleration/configuration/configuration_generated.h" #include "tensorflow/lite/experimental/acceleration/configuration/delegate_registry.h" namespace tflite { namespace delegates { class XNNPackPlugin : public DelegatePluginInterface { public: TfLiteDelegatePtr Create() override { return TfLiteDelegatePtr(TfLiteXNNPackDelegateCreate(&options_), TfLiteXNNPackDelegateDelete); } int GetDelegateErrno(TfLiteDelegate* from_delegate) override { return 0; } static std::unique_ptr<DelegatePluginInterface> New( const TFLiteSettings& acceleration) { return absl::make_unique<XNNPackPlugin>(acceleration); } explicit XNNPackPlugin(const TFLiteSettings& tflite_settings) : options_(TfLiteXNNPackDelegateOptionsDefault()) { const auto* xnnpack_settings = tflite_settings.xnnpack_settings(); if (xnnpack_settings) { options_.num_threads = xnnpack_settings->num_threads(); } } private: TfLiteXNNPackDelegateOptions options_; }; TFLITE_REGISTER_DELEGATE_FACTORY_FUNCTION(XNNPackPlugin, XNNPackPlugin::New); } // namespace delegates } // namespace tflite
C++
4
EricRemmerswaal/tensorflow
tensorflow/lite/experimental/acceleration/configuration/xnnpack_plugin.cc
[ "Apache-2.0" ]
# Builtin Pastel Dark [colors] foreground = "#bbbbbb" background = "#000000" cursor_bg = "#ffa560" cursor_border = "#ffa560" cursor_fg = "#ffffff" selection_bg = "#363983" selection_fg = "#f2f2f2" ansi = ["#4f4f4f","#ff6c60","#a8ff60","#ffffb6","#96cbfe","#ff73fd","#c6c5fe","#eeeeee"] brights = ["#7c7c7c","#ffb6b0","#ceffac","#ffffcc","#b5dcff","#ff9cfe","#dfdffe","#ffffff"]
TOML
1
smartfish/iTerm2-Color-Schemes
wezterm/Builtin Pastel Dark.toml
[ "MIT" ]
var a = "a"; var b = "b"; var c = "c"; export { a, b, c };
JavaScript
2
1shenxi/webpack
test/statsCases/side-effects-simple-unused/node_modules/pmodule/a.js
[ "MIT" ]