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
|
---|---|---|---|---|---|
Released QAQ*1.7*7 SEQ #7
Extracted from mail message
**KIDS**:QAQ*1.7*7^
**INSTALL NAME**
QAQ*1.7*7
"BLD",2383,0)
QAQ*1.7*7^QUALITY ASSURANCE INTEGRATION^0^3000921^y
"BLD",2383,4,0)
^9.64PA^740^1
"BLD",2383,4,740,0)
740
"BLD",2383,4,740,2,0)
^9.641^740^1
"BLD",2383,4,740,2,740,0)
QUALITY ASSURANCE SITE PARAMETERS (File-top level)
"BLD",2383,4,740,2,740,1,0)
^9.6411^755^1
"BLD",2383,4,740,2,740,1,755,0)
QAN TIME REQUIRED
"BLD",2383,4,740,222)
y^n^p^^^^n
"BLD",2383,4,"APDD",740,740)
"BLD",2383,4,"APDD",740,740,755)
"BLD",2383,4,"B",740,740)
"BLD",2383,"ABNS",0)
^9.66A^^
"BLD",2383,"ABPKG")
n^n
"BLD",2383,"KRN",0)
^9.67PA^19^17
"BLD",2383,"KRN",.4,0)
.4
"BLD",2383,"KRN",.401,0)
.401
"BLD",2383,"KRN",.402,0)
.402
"BLD",2383,"KRN",.402,"NM",0)
^9.68A^1^1
"BLD",2383,"KRN",.402,"NM",1,0)
QAQA QAN SITE PARAMETERS FILE #740^740^0
"BLD",2383,"KRN",.402,"NM","B","QAQA QAN SITE PARAMETERS FILE #740",1)
"BLD",2383,"KRN",.403,0)
.403
"BLD",2383,"KRN",.5,0)
.5
"BLD",2383,"KRN",.84,0)
.84
"BLD",2383,"KRN",3.6,0)
3.6
"BLD",2383,"KRN",3.8,0)
3.8
"BLD",2383,"KRN",9.2,0)
9.2
"BLD",2383,"KRN",9.8,0)
9.8
"BLD",2383,"KRN",19,0)
19
"BLD",2383,"KRN",19.1,0)
19.1
"BLD",2383,"KRN",101,0)
101
"BLD",2383,"KRN",409.61,0)
409.61
"BLD",2383,"KRN",771,0)
771
"BLD",2383,"KRN",870,0)
870
"BLD",2383,"KRN",8994,0)
8994
"BLD",2383,"KRN","B",.4,.4)
"BLD",2383,"KRN","B",.401,.401)
"BLD",2383,"KRN","B",.402,.402)
"BLD",2383,"KRN","B",.403,.403)
"BLD",2383,"KRN","B",.5,.5)
"BLD",2383,"KRN","B",.84,.84)
"BLD",2383,"KRN","B",3.6,3.6)
"BLD",2383,"KRN","B",3.8,3.8)
"BLD",2383,"KRN","B",9.2,9.2)
"BLD",2383,"KRN","B",9.8,9.8)
"BLD",2383,"KRN","B",19,19)
"BLD",2383,"KRN","B",19.1,19.1)
"BLD",2383,"KRN","B",101,101)
"BLD",2383,"KRN","B",409.61,409.61)
"BLD",2383,"KRN","B",771,771)
"BLD",2383,"KRN","B",870,870)
"BLD",2383,"KRN","B",8994,8994)
"BLD",2383,"QUES",0)
^9.62^^
"BLD",2383,"REQB",0)
^9.611^^
"FIA",740)
QUALITY ASSURANCE SITE PARAMETERS
"FIA",740,0)
^QA(740,
"FIA",740,0,0)
740P
"FIA",740,0,1)
y^n^p^^^^n
"FIA",740,0,10)
"FIA",740,0,11)
"FIA",740,0,"RLRO")
"FIA",740,0,"VR")
1.7^QAQ
"FIA",740,740)
1
"FIA",740,740,755)
"KRN",.402,1594,-1)
0^1
"KRN",.402,1594,0)
QAQA QAN SITE PARAMETERS^3000509.1216^^740^^^3000921
"KRN",.402,1594,"DIAB",1,1,740.0752,0)
ALL
"KRN",.402,1594,"DR",1,740)
742.01;742.02;742.03;742.04;I $P($G(^QA(740,1,"QAN")),U,5)'=1 S Y="@752";752;@752;755;
"KRN",.402,1594,"DR",2,740.0752)
.01
"MBREQ")
0
"ORD",7,.402)
.402;7;;;EDEOUT^DIFROMSO(.402,DA,"",XPDA);FPRE^DIFROMSI(.402,"",XPDA);EPRE^DIFROMSI(.402,DA,$E("N",$G(XPDNEW)),XPDA,"",OLDA);;EPOST^DIFROMSI(.402,DA,"",XPDA);DEL^DIFROMSK(.402,"",%)
"ORD",7,.402,0)
INPUT TEMPLATE
"PKG",370,-1)
1^1
"PKG",370,0)
QUALITY ASSURANCE INTEGRATION^QAQ^UTILITIES USED IN ALL QUALITY ASSURANCE MODULES
"PKG",370,20,0)
^9.402P^^
"PKG",370,22,0)
^9.49I^1^1
"PKG",370,22,1,0)
1.7^2950725^2950914
"PKG",370,22,1,"PAH",1,0)
7^3000921
"QUES","XPF1",0)
Y
"QUES","XPF1","??")
^D REP^XPDH
"QUES","XPF1","A")
Shall I write over your |FLAG| File
"QUES","XPF1","B")
YES
"QUES","XPF1","M")
D XPF1^XPDIQ
"QUES","XPF2",0)
Y
"QUES","XPF2","??")
^D DTA^XPDH
"QUES","XPF2","A")
Want my data |FLAG| yours
"QUES","XPF2","B")
YES
"QUES","XPF2","M")
D XPF2^XPDIQ
"QUES","XPI1",0)
YO
"QUES","XPI1","??")
^D INHIBIT^XPDH
"QUES","XPI1","A")
Want KIDS to INHIBIT LOGONs during the install
"QUES","XPI1","B")
YES
"QUES","XPI1","M")
D XPI1^XPDIQ
"QUES","XPM1",0)
PO^VA(200,:EM
"QUES","XPM1","??")
^D MG^XPDH
"QUES","XPM1","A")
Enter the Coordinator for Mail Group '|FLAG|'
"QUES","XPM1","B")
"QUES","XPM1","M")
D XPM1^XPDIQ
"QUES","XPO1",0)
Y
"QUES","XPO1","??")
^D MENU^XPDH
"QUES","XPO1","A")
Want KIDS to Rebuild Menu Trees Upon Completion of Install
"QUES","XPO1","B")
YES
"QUES","XPO1","M")
D XPO1^XPDIQ
"QUES","XPZ1",0)
Y
"QUES","XPZ1","??")
^D OPT^XPDH
"QUES","XPZ1","A")
Want to DISABLE Scheduled Options, Menu Options, and Protocols
"QUES","XPZ1","B")
YES
"QUES","XPZ1","M")
D XPZ1^XPDIQ
"QUES","XPZ2",0)
Y
"QUES","XPZ2","??")
^D RTN^XPDH
"QUES","XPZ2","A")
Want to MOVE routines to other CPUs
"QUES","XPZ2","B")
NO
"QUES","XPZ2","M")
D XPZ2^XPDIQ
"VER")
8.0^22.0
"^DD",740,740,755,0)
QAN TIME REQUIRED^S^1:YES;0:NO;^QAN;6^Q
"^DD",740,740,755,3)
Enter '1' or 'Yes' if your site requires a time be entered in the Date of Incident field.
"^DD",740,740,755,21,0)
^.001^2^2^3000509^^
"^DD",740,740,755,21,1,0)
Field set to '1' or 'Yes' if site requires Date of Incident to include
"^DD",740,740,755,21,2,0)
time of day.
"^DD",740,740,755,"DT")
3000509
**END**
**END**
| Genshi | 0 | josephsnyder/VistA-1 | Packages/Quality Assurance Integration/Patches/QAQ_1.7_7/QAQ-1p7_SEQ-7_PAT-7.kid | [
"Apache-2.0"
] |
package MoreRegs;
import DReg::*;
// mkValidReg
// 只有在 _write 后的下一个周期, _read 方法的隐式条件才有效,读出上一周期写入的值。
module mkValidReg ( Reg#(td) )
provisos( Bits#(td, sz) );
Reg#(Maybe#(td)) self_reg <- mkDReg(tagged Invalid);
method Action _write(td wdata);
self_reg <= tagged Valid wdata;
endmethod
method td _read if(isValid(self_reg)) = fromMaybe(unpack('0), self_reg);
endmodule
// mkWireReg
// 调用 _write 写入的数据可以立即在当前周期被 _read 到;在不调用 _write 的周期,则 _read 到上次写入的数据。
// 具有一个初始值 init_data
module mkWireReg#(td init_data) ( Reg#(td) )
provisos( Bits#(td, sz) );
RWire#(td) self_rwire <- mkRWire;
Reg#(td) self_reg <- mkReg(init_data);
Wire#(td) self_wire <- mkBypassWire;
rule set_self_wire;
self_wire <= self_reg;
endrule
method Action _write(td wdata);
self_reg <= wdata;
self_rwire.wset(wdata);
endmethod
method td _read = fromMaybe(self_wire, self_rwire.wget);
endmodule
module mkTb();
Reg#(int) cnt <- mkReg(0);
rule up_counter;
cnt <= cnt + 1;
if(cnt > 10) $finish;
endrule
Reg#(int) valid_reg <- mkValidReg;
Reg#(int) wire_reg <- mkWireReg(0);
rule write_reg (cnt%3 == 0);
valid_reg <= cnt;
wire_reg <= cnt;
endrule
rule read_valid_reg;
$display("cnt=%2d valid_reg=%2d", cnt, valid_reg);
endrule
rule read_wire_reg;
$display("cnt=%2d wire_reg=%2d", cnt, wire_reg);
endrule
endmodule
endpackage
| Bluespec | 5 | Xiefengshang/BSV_Tutorial_cn | src/JpegEncoder/MoreRegs.bsv | [
"MIT"
] |
#!/bin/bash
# Copyright 2020 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -ex
cd "$(dirname "$0")"
mkdir -p ../../artifacts
# Collect the artifacts built by the previous build step
mkdir -p nativelibs
cp -r "${EXTERNAL_GIT_ROOT}"/input_artifacts/csharp_ext_* nativelibs || true
# Add current timestamp to dev nugets
./expand_dev_version.sh
# Extract current Grpc.Core version from build/dependencies.props
UNITYPACKAGE_VERSION="$(grep -o '<GrpcCsharpVersion>.*</GrpcCsharpVersion>' build/dependencies.props | sed 's/<GrpcCsharpVersion>//' | sed 's/<\/GrpcCsharpVersion>//')"
dotnet restore Grpc.sln
# To be able to build the Grpc.Core project, we also need to put grpc_csharp_ext to where Grpc.Core.csproj
# expects it.
mkdir -p ../../cmake/build
cp nativelibs/csharp_ext_linux_x64/libgrpc_csharp_ext.so ../../cmake/build
dotnet build --configuration Release Grpc.Core
# build HealthCheck to get hold of Google.Protobuf.dll assembly
dotnet build --configuration Release Grpc.HealthCheck
# copy Grpc assemblies to the unity package skeleton
# TODO(jtattermusch): Add Grpc.Auth assembly and its dependencies
cp Grpc.Core.Api/bin/Release/net45/Grpc.Core.Api.dll unitypackage/unitypackage_skeleton/Plugins/Grpc.Core.Api/lib/net45/Grpc.Core.Api.dll
cp Grpc.Core.Api/bin/Release/net45/Grpc.Core.Api.pdb unitypackage/unitypackage_skeleton/Plugins/Grpc.Core.Api/lib/net45/Grpc.Core.Api.pdb
cp Grpc.Core.Api/bin/Release/net45/Grpc.Core.Api.xml unitypackage/unitypackage_skeleton/Plugins/Grpc.Core.Api/lib/net45/Grpc.Core.Api.xml
cp Grpc.Core/bin/Release/net45/Grpc.Core.dll unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/lib/net45/Grpc.Core.dll
cp Grpc.Core/bin/Release/net45/Grpc.Core.pdb unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/lib/net45/Grpc.Core.pdb
cp Grpc.Core/bin/Release/net45/Grpc.Core.xml unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/lib/net45/Grpc.Core.xml
# copy desktop native libraries to the unity package skeleton
cp nativelibs/csharp_ext_linux_x64/libgrpc_csharp_ext.so unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/runtimes/linux/x64/libgrpc_csharp_ext.so
cp nativelibs/csharp_ext_macos_x64/libgrpc_csharp_ext.dylib unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/runtimes/osx/x64/grpc_csharp_ext.bundle
cp nativelibs/csharp_ext_windows_x86/grpc_csharp_ext.dll unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/runtimes/win/x86/grpc_csharp_ext.dll
cp nativelibs/csharp_ext_windows_x64/grpc_csharp_ext.dll unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/runtimes/win/x64/grpc_csharp_ext.dll
# add Android and iOS native libraries
cp nativelibs/csharp_ext_linux_android_armeabi-v7a/libgrpc_csharp_ext.so unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/runtimes/android/armeabi-v7a/libgrpc_csharp_ext.so
cp nativelibs/csharp_ext_linux_android_arm64-v8a/libgrpc_csharp_ext.so unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/runtimes/android/arm64-v8a/libgrpc_csharp_ext.so
cp nativelibs/csharp_ext_linux_android_x86/libgrpc_csharp_ext.so unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/runtimes/android/x86/libgrpc_csharp_ext.so
cp nativelibs/csharp_ext_macos_ios/libgrpc_csharp_ext.a unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/runtimes/ios/libgrpc_csharp_ext.a
cp nativelibs/csharp_ext_macos_ios/libgrpc.a unitypackage/unitypackage_skeleton/Plugins/Grpc.Core/runtimes/ios/libgrpc.a
# add gRPC dependencies
# TODO(jtattermusch): also include XMLdoc
cp Grpc.Core/bin/Release/net45/System.Runtime.CompilerServices.Unsafe.dll unitypackage/unitypackage_skeleton/Plugins/System.Runtime.CompilerServices.Unsafe/lib/net45/System.Runtime.CompilerServices.Unsafe.dll
cp Grpc.Core/bin/Release/net45/System.Buffers.dll unitypackage/unitypackage_skeleton/Plugins/System.Buffers/lib/net45/System.Buffers.dll
cp Grpc.Core/bin/Release/net45/System.Memory.dll unitypackage/unitypackage_skeleton/Plugins/System.Memory/lib/net45/System.Memory.dll
# add Google.Protobuf
# TODO(jtattermusch): also include XMLdoc
cp Grpc.HealthCheck/bin/Release/net45/Google.Protobuf.dll unitypackage/unitypackage_skeleton/Plugins/Google.Protobuf/lib/net45/Google.Protobuf.dll
# create a zipfile that will act as a Unity package
pushd unitypackage/unitypackage_skeleton
zip -r ../../grpc_unity_package.zip Plugins
popd
cp grpc_unity_package.zip ../../artifacts/grpc_unity_package.${UNITYPACKAGE_VERSION}.zip
| Shell | 4 | warlock135/grpc | src/csharp/build_unitypackage.sh | [
"Apache-2.0"
] |
import numpy as np
import pytest
from pandas import (
Series,
Timestamp,
)
import pandas._testing as tm
class TestCopy:
@pytest.mark.parametrize("deep", [None, False, True])
def test_copy(self, deep):
ser = Series(np.arange(10), dtype="float64")
# default deep is True
if deep is None:
ser2 = ser.copy()
else:
ser2 = ser.copy(deep=deep)
ser2[::2] = np.NaN
if deep is None or deep is True:
# Did not modify original Series
assert np.isnan(ser2[0])
assert not np.isnan(ser[0])
else:
# we DID modify the original Series
assert np.isnan(ser2[0])
assert np.isnan(ser[0])
@pytest.mark.parametrize("deep", [None, False, True])
def test_copy_tzaware(self, deep):
# GH#11794
# copy of tz-aware
expected = Series([Timestamp("2012/01/01", tz="UTC")])
expected2 = Series([Timestamp("1999/01/01", tz="UTC")])
ser = Series([Timestamp("2012/01/01", tz="UTC")])
if deep is None:
ser2 = ser.copy()
else:
ser2 = ser.copy(deep=deep)
ser2[0] = Timestamp("1999/01/01", tz="UTC")
# default deep is True
if deep is None or deep is True:
# Did not modify original Series
tm.assert_series_equal(ser2, expected2)
tm.assert_series_equal(ser, expected)
else:
# we DID modify the original Series
tm.assert_series_equal(ser2, expected2)
tm.assert_series_equal(ser, expected2)
def test_copy_name(self, datetime_series):
result = datetime_series.copy()
assert result.name == datetime_series.name
def test_copy_index_name_checking(self, datetime_series):
# don't want to be able to modify the index stored elsewhere after
# making a copy
datetime_series.index.name = None
assert datetime_series.index.name is None
assert datetime_series is datetime_series
cp = datetime_series.copy()
cp.index.name = "foo"
assert datetime_series.index.name is None
| Python | 4 | 13rianlucero/CrabAgePrediction | crabageprediction/venv/Lib/site-packages/pandas/tests/series/methods/test_copy.py | [
"MIT"
] |
function omf.xdg.config_home -d "Return the config directory based on XDG specs"
set -q XDG_CONFIG_HOME;
and echo "$XDG_CONFIG_HOME";
or echo "$HOME/.config"
end
| fish | 3 | codetriage-readme-bot/oh-my-fish | pkg/omf/functions/core/omf.xdg.config_home.fish | [
"MIT"
] |
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><%[email protected]_name%></title>
<!-- metadata -->
<meta name="generator" content="Instiki" />
<meta name="version" content="<%= "#{Instiki::VERSION::STRING}" %>" />
<meta name="author" content="<%[email protected]%>" />
<meta name="company" content="" />
<!-- configuration parameters -->
<meta name="defaultView" content="slideshow" />
<meta name="controlVis" content="hidden" />
<!-- style sheet links -->
<%= stylesheet_link_tag "/stylesheets/syntax.css", :media => 'all', :id => 'syntaxStyle' %>
<%= stylesheet_link_tag "/s5/ui/core/outline.css", :media => 'screen', :id => 'outlineStyle' %>
<%= stylesheet_link_tag "/s5/ui/core/print.css", :media => 'print', :id => 'slidePrint' %>
<%= stylesheet_link_tag "/s5/ui/core/opera.css", :media => 'projection', :id => 'operaFix' %>
<%= stylesheet_link_tag "/s5/ui/core/math.css", :media => 'all', :id => 'mathStyle' %>
<%= stylesheet_link_tag "/s5/themes/#{@s5_theme}/slides.css", :media => 'projection', :id => 'slideProj' %>
<!-- S5 JS -->
<%= javascript_include_tag 'prototype' %>
<%= javascript_include_tag 'page_helper' %>
<%- if @web.markup == :markdownMML -%>
<script type="text/x-mathjax-config">
<!--//--><![CDATA[//><!--
MathJax.Ajax.config.path["Contrib"] = "<%= compute_public_path('', 'MathJax').split('/?')[0] %>";
MathJax.Hub.Config({
MathML: { useMathMLspacing: true },
"HTML-CSS": { scale: 90,
noReflows: false,
extensions: ["handle-floats.js"]
}
});
MathJax.Hub.Queue( function () {
var fos = document.getElementsByTagName('foreignObject');
for (var i = 0; i < fos.length; i++) {
MathJax.Hub.Typeset(fos[i]);
}
});
//--><!]]>
</script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
window.addEventListener("DOMContentLoaded", function () {
var div = document.createElement('div');
var math = document.createElementNS('http://www.w3.org/1998/Math/MathML', 'math');
document.body.appendChild(div);
div.appendChild(math);
// Test for MathML support comparable to WebKit version https://trac.webkit.org/changeset/203640 or higher.
div.setAttribute('style', 'font-style: italic');
var mathml_unsupported = !(window.getComputedStyle(div.firstChild).getPropertyValue('font-style') === 'normal');
div.parentNode.removeChild(div);
if (mathml_unsupported) {
// MathML does not seem to be supported...
var s = document.createElement('script');
s.src = "<%= compute_public_path('MathJax.js', 'MathJax').split('?')[0] %>?config=MML_HTMLorMML";
document.querySelector('head').appendChild(s);
} else {
document.head.insertAdjacentHTML("beforeend", '<style>svg[viewBox] {max-width: 100%}</style>');
}
});
//--><!]]>
</script>
<%- end -%>
<%= javascript_include_tag "/s5/ui/core/slides.js" %>
</head>
<body xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:se="http://svg-edit.googlecode.com">
<%= @s5_content %>
</body>
</html>
| RHTML | 3 | taskforce/instiki | app/views/wiki/s5.rhtml | [
"Ruby"
] |
; Kovri Installer for Windows, 64 bit variant
; Copyright (c) 2017, The Kovri I2P Router Project
; See LICENSE
#define Bitness 64
#include "Common.iss"
| Inno Setup | 1 | byterubpay/kovri | pkg/installers/windows/Kovri64.iss | [
"BSD-3-Clause"
] |
#!/bin/csh
echo ${1} ${2} ${3}
setenv MYWORKDIR `pwd`
### Definitions
#setenv SRC /afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/RDMScript/CMSSW_5_3_21/src/RecoHcal/HcalPromptAnalysis/test
#setenv SCRIPTDIR ${SRC}/SHIFTER_VALIDATION/
setenv SRC ${3}
setenv SCRIPTDIR ${3}
##setenv SCRAM_ARCH slc6_amd64_gcc472
##setenv SCRAM_ARCH slc6_amd64_gcc491
#setenv SCRAM_ARCH slc6_amd64_gcc530
setenv SCRAM_ARCH slc6_amd64_gcc630
### Environment
cd ${SRC}
cmsenv
### Go back to WN
cd ${MYWORKDIR}
cp ${SRC}/PYTHON_${1}/Reco_${2}_cfg.py .
### Run CMSSW
cmsRun Reco_${2}_cfg.py > &log_${2}
ls -l * >> &log_${2}
### Copy output files to EOS
cmsStage -f log_${2} /store/group/dpg_hcal/comm_hcal/www/HcalRemoteMonitoring/CMT/histos/Logs/
cmsStage -f LogEleMapdb.h /store/group/dpg_hcal/comm_hcal/www/HcalRemoteMonitoring/CMT/histos/MAP/LogEleMapdb_${2}.h
##cp log_${2} /afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/RDMScript/CMSSW_7_4_5_STABLE/src/RecoHcal/HcalPromptAnalysis/test/SHIFTER_VALIDATION
cmsStage -f Global.root /store/group/dpg_hcal/comm_hcal/www/HcalRemoteMonitoring/CMT/histos/Global_${2}.root
## rm all unnesecery
#rm log_${2}
rm Global.root
| Tcsh | 3 | ckamtsikis/cmssw | DPGAnalysis/HcalTools/scripts/cmt/batchjobs.csh | [
"Apache-2.0"
] |
#tag Class
Protected Class UIActivity
Inherits NSObject
#tag Constant, Name = UIActivityTypeAddToReadingList, Type = Text, Dynamic = False, Default = \"com.apple.UIKit.activity.AddToReadingList", Scope = Public
#tag EndConstant
#tag Constant, Name = UIActivityTypeAirDrop, Type = Text, Dynamic = False, Default = \"com.apple.UIKit.activity.AirDrop", Scope = Public
#tag EndConstant
#tag Constant, Name = UIActivityTypeAssignToContact, Type = Text, Dynamic = False, Default = \"com.apple.UIKit.activity.AssignToContact", Scope = Public
#tag EndConstant
#tag Constant, Name = UIActivityTypeCopyToPasteboard, Type = Text, Dynamic = False, Default = \"com.apple.UIKit.activity.CopyToPasteboard", Scope = Public
#tag EndConstant
#tag Constant, Name = UIActivityTypeMail, Type = Text, Dynamic = False, Default = \"com.apple.UIKit.activity.Mail", Scope = Public
#tag EndConstant
#tag Constant, Name = UIActivityTypeMessage, Type = Text, Dynamic = False, Default = \"com.apple.UIKit.activity.Message", Scope = Public
#tag EndConstant
#tag Constant, Name = UIActivityTypePostToFacebook, Type = Text, Dynamic = False, Default = \"com.apple.UIKit.activity.PostToFacebook", Scope = Public
#tag EndConstant
#tag Constant, Name = UIActivityTypePostToFlickr, Type = Text, Dynamic = False, Default = \"com.apple.UIKit.activity.PostToFlickr", Scope = Public
#tag EndConstant
#tag Constant, Name = UIActivityTypePostToTencentWeibo, Type = Text, Dynamic = False, Default = \"com.apple.UIKit.activity.PostToTencentWeibo", Scope = Public
#tag EndConstant
#tag Constant, Name = UIActivityTypePostToTwitter, Type = Text, Dynamic = False, Default = \"com.apple.UIKit.activity.PostToTwitter", Scope = Public
#tag EndConstant
#tag Constant, Name = UIActivityTypePostToVimeo, Type = Text, Dynamic = False, Default = \"com.apple.UIKit.activity.PostToVimeo", Scope = Public
#tag EndConstant
#tag Constant, Name = UIActivityTypePostToWeibo, Type = Text, Dynamic = False, Default = \"com.apple.UIKit.activity.PostToWeibo", Scope = Public
#tag EndConstant
#tag Constant, Name = UIActivityTypePrint, Type = Text, Dynamic = False, Default = \"com.apple.UIKit.activity.Print", Scope = Public
#tag EndConstant
#tag Constant, Name = UIActivityTypeSaveToCameraRoll, Type = Text, Dynamic = False, Default = \"com.apple.UIKit.activity.SaveToCameraRoll", Scope = Public
#tag EndConstant
#tag Enum, Name = UIActivityCategory, Type = Integer, Flags = &h0
Action = 0
Share = 1
#tag EndEnum
#tag ViewBehavior
#tag ViewProperty
Name="Index"
Visible=true
Group="ID"
InitialValue="-2147483648"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Left"
Visible=true
Group="Position"
InitialValue="0"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Name"
Visible=true
Group="ID"
InitialValue=""
Type="String"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Super"
Visible=true
Group="ID"
InitialValue=""
Type="String"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Top"
Visible=true
Group="Position"
InitialValue="0"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag EndViewBehavior
End Class
#tag EndClass
| Xojo | 4 | jkleroy/Xojo-iOS-HTML2PDF | Extras/iOSKit/UIKit/UIActivity.xojo_code | [
"Unlicense"
] |
#BRL_GAMETARGET_IMPLEMENTED=True
#GLFW_VERSION=2
Import brl.gametarget
Import "native/wavloader.cpp"
Import "native/oggloader.cpp"
Import "native/glfwgame.cpp"
Import "native/monkeytarget.cpp"
Extern
Class GlfwVideoMode="BBGlfwVideoMode"
Field Width:Int
Field Height:Int
Field RedBits:Int
Field GreenBits:Int
Field BlueBits:Int
End
Class GlfwGame Extends BBGame="BBGlfwGame"
Function GetGlfwGame:GlfwGame()="GlfwGame"
Method GetGlfwDesktopMode:GlfwVideoMode()
Method GetGlfwVideoModes:GlfwVideoMode[]()
Method SetGlfwWindow:Void( width:Int,height:Int,red:Int,green:Int,blue:Int,alpha:Int,depth:Int,stencil:Int,fullscreen:Bool )
End
| Monkey | 4 | blitz-research/monkey | targets/__deprecated__/glfw/modules/monkeytarget.monkey | [
"Zlib"
] |
MODULE = Agar::MPane PACKAGE = Agar::MPane PREFIX = AG_
PROTOTYPES: ENABLE
VERSIONCHECK: DISABLE
Agar::MPane
new(package, parent, layout, ...)
const char * package
Agar::Widget parent
char * layout
PREINIT:
Uint flags = 0, wflags = 0;
enum ag_mpane_layout layout_enum = AG_MPANE4;
CODE:
if ((items == 4 && SvTYPE(SvRV(ST(3))) != SVt_PVHV) || items > 4) {
Perl_croak(aTHX_ "Usage: Agar::MPane->new(parent,layout,[{opts}])");
}
if (items == 4) {
AP_MapHashToFlags(SvRV(ST(3)), apMPaneFlagNames, &flags);
AP_MapHashToFlags(SvRV(ST(3)), apWidgetFlagNames, &wflags);
}
if (strlen(layout) > 1) {
layout[1] = toLOWER(layout[1]);
if (strlen(layout) > 3) {
layout[3] = toLOWER(layout[3]);
}
}
if (strEQ(layout, "1")) { layout_enum = AG_MPANE1; }
else if (strEQ(layout, "2v")) { layout_enum = AG_MPANE2V; }
else if (strEQ(layout, "2h")) { layout_enum = AG_MPANE2H; }
else if (strEQ(layout, "2l1r")) { layout_enum = AG_MPANE2L1R; }
else if (strEQ(layout, "1l2r")) { layout_enum = AG_MPANE1L2R; }
else if (strEQ(layout, "2t1b")) { layout_enum = AG_MPANE2T1B; }
else if (strEQ(layout, "1t2b")) { layout_enum = AG_MPANE1T2B; }
else if (strEQ(layout, "3l1r")) { layout_enum = AG_MPANE3L1R; }
else if (strEQ(layout, "1l3r")) { layout_enum = AG_MPANE1L3R; }
else if (strEQ(layout, "3t1b")) { layout_enum = AG_MPANE3T1B; }
else if (strEQ(layout, "1t3b")) { layout_enum = AG_MPANE1T3B; }
RETVAL = AG_MPaneNew(parent, layout_enum, flags);
if (RETVAL) { AGWIDGET(&(RETVAL->box))->flags |= wflags; }
OUTPUT:
RETVAL
Agar::Box
pane(self, index)
Agar::MPane self
Uint index
CODE:
if (index >= self->nPanes) {
Perl_croak(aTHX_ "Pane index out of bounds");
}
RETVAL = self->panes[index];
OUTPUT:
RETVAL
void
setFlag(self, name)
Agar::MPane self
const char * name
CODE:
if (AP_SetNamedFlag(name, apMPaneFlagNames, &(self->flags))) {
AP_SetNamedFlag(name, apWidgetFlagNames, &(AGWIDGET(&self->box)->flags));
}
void
unsetFlag(self, name)
Agar::MPane self
const char * name
CODE:
if (AP_UnsetNamedFlag(name, apMPaneFlagNames, &(self->flags))) {
AP_UnsetNamedFlag(name, apWidgetFlagNames, &(AGWIDGET(&self->box)->flags));
}
Uint
getFlag(self, name)
Agar::MPane self
const char * name
CODE:
if (AP_GetNamedFlag(name, apMPaneFlagNames, self->flags, &RETVAL)) {
if (AP_GetNamedFlag(name, apWidgetFlagNames, AGWIDGET(&self->box)->flags,
&RETVAL)) { XSRETURN_UNDEF; }
}
OUTPUT:
RETVAL
| XS | 3 | auzkok/libagar | p5-Agar/Agar/MPane.xs | [
"BSD-2-Clause"
] |
/*
* Various usage of shared
* Liao
* 6/10/2008
*/
shared[*] int p4[100*THREADS]; /* shared to shared */
shared[] int* shared p44; /* shared to shared */
int main()
{
shared int *p2;
shared[] int *p22;
/* shared[*] int *p222; */ /*Illegal, layout qualifier [*] shall not appear for a pointer type*/
/* int *shared p3;*/ /* shared variables must be static or extern */
return 0;
}
| Unified Parallel C | 3 | maurizioabba/rose | tests/CompileTests/UPC_tests/shared_2.upc | [
"BSD-3-Clause"
] |
module namespace a = 'a';
import module namespace b = 'b' at 'b.xqm';
declare variable $a:foo := 23;
declare function a:bar() { $b:bar * 2 };
| XQuery | 4 | JensErat/basex | basex-core/src/test/resources/recmod/a.xqm | [
"BSD-3-Clause"
] |
--TEST--
Test ArrayObject::uasort() function : wrong arg count
--FILE--
<?php
/* Sort the entries by values user defined function.
* Source code: ext/spl/spl_array.c
* Alias to functions:
*/
$ao = new ArrayObject();
try {
$ao->uasort();
} catch (ArgumentCountError $e) {
echo $e->getMessage() . "\n";
}
try {
$ao->uasort(1,2);
} catch (ArgumentCountError $e) {
echo $e->getMessage() . "\n";
}
?>
--EXPECT--
ArrayObject::uasort() expects exactly 1 argument, 0 given
ArrayObject::uasort() expects exactly 1 argument, 2 given
| PHP | 4 | NathanFreeman/php-src | ext/spl/tests/arrayObject_uasort_error1.phpt | [
"PHP-3.01"
] |
--TEST--
ReflectionAttribute::__toString
--FILE--
<?php
#[Foo, Bar(a: "foo", b: 1234), Baz("foo", 1234), X(NO_ERROR), Y(new stdClass)]
function foo() {}
$refl = new ReflectionFunction('foo');
echo $refl->getAttributes()[0];
echo $refl->getAttributes()[1];
echo $refl->getAttributes()[2];
echo $refl->getAttributes()[3];
echo $refl->getAttributes()[4];
?>
--EXPECT--
Attribute [ Foo ]
Attribute [ Bar ] {
- Arguments [2] {
Argument #0 [ a = 'foo' ]
Argument #1 [ b = 1234 ]
}
}
Attribute [ Baz ] {
- Arguments [2] {
Argument #0 [ 'foo' ]
Argument #1 [ 1234 ]
}
}
Attribute [ X ] {
- Arguments [1] {
Argument #0 [ NO_ERROR ]
}
}
Attribute [ Y ] {
- Arguments [1] {
Argument #0 [ new \stdClass() ]
}
}
| PHP | 4 | NathanFreeman/php-src | ext/reflection/tests/ReflectionAttribute_toString.phpt | [
"PHP-3.01"
] |
if (req.http.Rate-Limit) {
set bereq.method = req.http.X-Orig-Method;
}
| VCL | 3 | smaeda-ks/fastly-magento2 | etc/vcl_snippets_rate_limiting/miss.vcl | [
"BSD-3-Clause"
] |
<!DOCTYPE html>
<html lang="{{ page.lang | default: site.lang | default: " en " }}">
{%- include head.liquid -%}
<body>
{{ content }}
<script>
const ID = function () {
// Math.random should be unique because of its seeding algorithm.
// Convert it to base 36 (numbers + letters), and grab the first 9 characters
// after the decimal.
return '-' + Math.random().toString(36).substr(2, 9);
};
$('body .markdown-body').find("h1").each(function() {
const h1ID = this.id
let listItems = []
$(this).next("section").find("h2").each(function() {
this.id = this.id + ID()
listItems.push('<li><a href="#' + this.id + '">'+$(this).text()+'</a></li>')
})
$("#nav-" + h1ID + ' .nav-stacked').html(listItems.join(''))
})
$('body').scrollspy({
target: '#the-nav-bar',
offset: 140
})
</script>
</body>
</html> | Liquid | 4 | TommyTeaVee/training | docs/_layouts/base-guides.liquid | [
"MIT"
] |
// Copyright© Dokit for Flutter.
//
// color_pick.dart
// Flutter
//
// Created by linusflow on 2021/5/12
// Modified by linusflow on 2021/5/12 下午2:28
//
import 'dart:typed_data';
import 'dart:ui' as ui;
import 'package:dokit/dokit.dart';
import 'package:dokit/kit/visual/visual.dart';
import 'package:dokit/ui/dokit_btn.dart';
import 'package:dokit/util/screen_util.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:image/image.dart' as images;
/// 无法获取到overlay的截图信息,如悬浮窗
class ColorPickerKit extends VisualKit {
ColorPickerKit._privateConstructor() {
_initPosition =
ScreenUtil.instance.screenCenter - Offset(diameter / 2, diameter / 2);
_position = ValueNotifier<Offset>(initPosition);
_focusEntry = OverlayEntry(builder: (BuildContext context) {
return ColorPickerWidget();
});
_infoEntry = OverlayEntry(builder: (BuildContext context) {
return ColorPickerInfoWidget();
});
isShown = false;
}
static final ColorPickerKit _instance = ColorPickerKit._privateConstructor();
static ColorPickerKit get instance => _instance;
late bool isShown;
// 选中的颜色
final ValueNotifier<Color> color = ValueNotifier<Color>(Colors.white);
// 当前屏幕的截图快照
final ValueNotifier<ui.Image?> snapshot = ValueNotifier<ui.Image?>(null);
// 放大镜当前位置(左上角)
late ValueNotifier<Offset> _position;
ValueNotifier<Offset> get position => _position;
// 放大镜的直径
final double diameter = 170;
// 像素点放大的倍数
final double scale = 8;
late Offset _initPosition;
Offset get initPosition => _initPosition;
late OverlayEntry _focusEntry;
late OverlayEntry _infoEntry;
@override
String getIcon() {
return 'images/dk_color_pick.png';
}
@override
String getKitName() {
return VisualKitName.KIT_COLOR_PICK;
}
@override
void tabAction() {
final DoKitBtnState? state = DoKitBtn.doKitBtnKey.currentState;
state?.closeDebugPage();
show(DoKitBtn.doKitBtnKey.currentContext, state?.owner);
}
static void show(BuildContext? context, OverlayEntry? entrance) {
_instance._show(context, entrance);
}
void _show(BuildContext? context, OverlayEntry? entrance) {
if (isShown) {
return;
}
isShown = true;
doKitOverlayKey.currentState?.insert(_focusEntry, below: entrance);
doKitOverlayKey.currentState?.insert(_infoEntry, below: _focusEntry);
}
static bool hide(BuildContext context) {
return _instance._hide(context);
}
bool _hide(BuildContext context) {
if (!isShown) {
return false;
}
isShown = false;
_focusEntry.remove();
_infoEntry.remove();
return true;
}
}
class ColorPickerWidget extends StatefulWidget {
@override
State<StatefulWidget> createState() => ColorPickerWidgetState();
}
class ColorPickerWidgetState extends State<ColorPickerWidget> {
// 当前页面的截图快照
images.Image? _image;
Future<images.Image?> get image async {
if (_image != null) {
return _image!;
}
await _updateImage();
return _image;
}
// 是否做好显示颜色拾取器的准备
bool _ready = false;
Uint8List? _imageUint8List;
Future<Uint8List?> get imageUint8List async {
if (_imageUint8List != null) {
return _imageUint8List!;
}
final RenderRepaintBoundary? boundary =
_findCurrentPageRepaintBoundaryRenderObject();
final Uint8List? imageData = await _boundaryToImageUint8List(boundary);
_imageUint8List = imageData;
return _imageUint8List;
}
// 放大镜左上角的位置
Offset get position => ColorPickerKit.instance.position.value;
set position(Offset point) => ColorPickerKit.instance.position.value = point;
// 手指和屏幕接触的初始位置
Offset? _touchPoint;
// 手指和屏幕接触时,放大镜左上角的位置
Offset _lastPosition = ColorPickerKit.instance.position.value;
Offset get deltaOffset {
if (_touchPoint == null) {
return Offset.zero;
}
return _touchPoint! - _lastPosition;
}
// 放大镜的半径
double get _radius => ColorPickerKit.instance.diameter / 2;
@override
initState() {
super.initState();
WidgetsBinding.instance?.addPostFrameCallback((_) {
// 第一次内部会调用_updateImage方法
_updateColor();
});
}
@override
Widget build(BuildContext context) {
return Positioned(
top: position.dy,
left: position.dx,
child: Listener(
onPointerDown: (PointerDownEvent event) {
_touchPoint = event.position;
_lastPosition = position;
},
onPointerMove: (PointerMoveEvent event) {
position = event.position - deltaOffset;
_updateColor();
},
child: Draggable(
child: _buildMagnifier(context),
feedback: _buildMagnifier(context),
childWhenDragging: Container(),
onDragStarted: () {
// 开始拖动时,重新获取截图快照
_updateImage();
},
onDragEnd: (DraggableDetails detail) {
final Offset point = detail.offset;
double x = point.dx;
double y = point.dy;
final width = ScreenUtil.instance.screenWidth;
final height = ScreenUtil.instance.screenHeight;
bool refresh = false;
if (x < -_radius) {
x = -_radius;
refresh = true;
}
if (x > width - _radius) {
x = width - _radius;
refresh = true;
}
if (y < -_radius) {
y = -_radius;
refresh = true;
}
if (y > height - _radius) {
y = height - _radius;
refresh = true;
}
if (refresh) {
setState(() {
position = Offset(x, y);
_updateColor();
});
}
},
),
),
);
}
Widget _buildMagnifier(BuildContext context) {
return Offstage(
offstage: !_ready,
child: RepaintBoundary(
child: ClipOval(
child: Stack(
alignment: Alignment.center,
children: [
ValueListenableBuilder<Offset>(
valueListenable: ColorPickerKit.instance.position,
builder: (BuildContext context, Offset value, Widget? child) {
if (ColorPickerKit.instance.snapshot.value == null) {
return Container();
}
return ValueListenableBuilder<ui.Image?>(
valueListenable: ColorPickerKit.instance.snapshot,
builder:
(BuildContext context, ui.Image? value, Widget? child) {
return CustomPaint(
painter: GridsPainter(),
size: Size.fromRadius(_radius),
);
},
);
},
),
CustomPaint(
painter: MagnifierPainter(),
size: Size.fromRadius(_radius),
),
],
),
),
),
);
}
Future<void> _updateImage() async {
_imageUint8List = null;
final imageData = await imageUint8List;
if (imageData == null) {
return;
}
_image = images.decodeImage(imageData);
final codec = await ui.instantiateImageCodec(imageData);
final info = await codec.getNextFrame();
ColorPickerKit.instance.snapshot.value = info.image;
if (!_ready && mounted) {
// 第一次获取Image会有耗时
// 保证MagnifierPainter和GridsPainter同步出现
setState(() {
_ready = true;
});
}
}
Future<void> _updateColor() async {
final double dpr = ui.window.devicePixelRatio;
final center = (position + Offset(_radius, _radius)) * dpr;
final images.Image? image = await this.image;
final abgrPixel = image?.getPixelSafe(center.dx.toInt(), center.dy.toInt());
if (abgrPixel == null) {
return;
}
final int argbPixel = _abgrToArgb(abgrPixel);
ColorPickerKit.instance.color.value = Color(argbPixel);
}
RenderRepaintBoundary? _findCurrentPageRepaintBoundaryRenderObject() {
final owner = context.findRenderObject()?.owner;
assert(owner != null, '当前正在build,无法获取当前页面的RepaintBoundary!');
bool isRepaintBoundaryTo_ModalScopeStatus(String? desc) {
if (desc?.isEmpty ?? true) {
return false;
}
final creators = desc!.split(' ← ');
const sampleCreators = [
'RepaintBoundary',
'_FocusMarker',
'Semantics',
'FocusScope',
'PrimaryScrollController', // flutter2.0+特有
'_ActionsMarker',
'Actions',
'Builder', // flutter2.0+特有
'PageStorage',
'Offstage',
'_ModalScopeStatus',
'UnmanagedRestorationScope', // flutter2.0+特有
];
for (int i = 0; i < sampleCreators.length; i++) {
if (creators.length < i + 1) {
return false;
}
if (creators[i] != sampleCreators[i]) {
return false;
}
}
return true;
}
final ModalRoute<dynamic>? rootRoute =
ModalRoute.of<dynamic>(DoKitApp.appKey.currentContext!);
// 当前页面的_ModalScopeStatus下的RepaintBoundary的RenderObject
RenderRepaintBoundary? currentPageRepaintBoundary;
void filter(Element element) {
if (element is RenderObjectElement && element.renderObject is RenderBox) {
final ModalRoute<dynamic>? route = ModalRoute.of<dynamic>(element);
if (route != null && route != rootRoute) {
final RenderBox renderBox = element.renderObject as RenderBox;
if (renderBox.hasSize &&
renderBox.attached &&
renderBox.isRepaintBoundary) {
String? desc;
if (!kReleaseMode) {
desc = element.renderObject.debugCreator.toString();
}
if (isRepaintBoundaryTo_ModalScopeStatus(desc)) {
currentPageRepaintBoundary =
element.renderObject as RenderRepaintBoundary;
}
}
}
}
element.visitChildren(filter);
}
DoKitApp.appKey.currentContext?.visitChildElements(filter);
return currentPageRepaintBoundary;
}
Future<Uint8List?> _boundaryToImageUint8List(
RenderRepaintBoundary? boundary) async {
if (boundary == null) {
return null;
}
final double dpr = ui.window.devicePixelRatio;
final ui.Image image = await boundary.toImage(pixelRatio: dpr);
final ByteData? byteData =
await image.toByteData(format: ui.ImageByteFormat.png);
final Uint8List? pngBytes = byteData?.buffer.asUint8List();
return pngBytes;
}
/// Uint32 编码过的像素颜色值(#AABBGGRR)转为(#AARRGGBB)
int _abgrToArgb(int argbColor) {
int r = (argbColor >> 16) & 0xFF;
int b = argbColor & 0xFF;
return (argbColor & 0xFF00FF00) | (b << 16) | r;
}
}
class GridsPainter extends CustomPainter {
GridsPainter();
double get scale => ColorPickerKit.instance.scale;
ui.Image? get image => ColorPickerKit.instance.snapshot.value;
Offset get position => ColorPickerKit.instance.position.value;
double get radius => ColorPickerKit.instance.diameter / 2;
// 水平方向上显示多少个颜色格子
int get width => radius * 2 ~/ scale;
// 竖直方向上显示多少个颜色格子
int get height => radius * 2 ~/ scale;
@override
void paint(Canvas canvas, Size size) {
if (image == null) {
return;
}
final paint = Paint();
final double dpr = ui.window.devicePixelRatio;
final center = (position + Offset(radius, radius)) * dpr;
final left = center.dx - (width - 1) / 2;
final top = center.dy - (height - 1) / 2;
final srcRect =
Rect.fromLTWH(left, top, width.toDouble(), height.toDouble());
final distRect = Rect.fromLTWH(0, 0, size.width, size.height);
canvas.drawImageRect(image!, srcRect, distRect, paint);
}
@override
bool shouldRepaint(GridsPainter old) => true;
@override
bool hitTest(ui.Offset position) => true;
}
class MagnifierPainter extends CustomPainter {
MagnifierPainter();
final double strokeWidth = 1;
final Color color = Colors.black;
double gridSide = ColorPickerKit.instance.scale;
@override
void paint(Canvas canvas, Size size) {
assert(size.height == size.width);
_drawCircle(canvas, size);
_drawGrid(canvas, size);
}
void _drawCircle(Canvas canvas, Size size) {
final Paint paint = Paint()
..style = PaintingStyle.stroke
..strokeWidth = strokeWidth
..color = color;
canvas.drawCircle(
size.center(const Offset(0, 0)), size.longestSide / 2, paint);
}
void _drawGrid(Canvas canvas, Size size) {
final Paint crossPaint = Paint()
..strokeWidth = 1
..color = color;
final List<Offset> points = [
size.center(Offset(-gridSide / 2, -gridSide / 2)),
size.center(Offset(gridSide / 2, -gridSide / 2)),
size.center(Offset(gridSide / 2, gridSide / 2)),
size.center(Offset(-gridSide / 2, gridSide / 2)),
size.center(Offset(-gridSide / 2, -gridSide / 2)),
];
canvas.drawPoints(ui.PointMode.polygon, points, crossPaint);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) {
if (ColorPickerKit.instance.scale != gridSide) {
gridSide = ColorPickerKit.instance.scale;
return true;
}
return false;
}
@override
bool hitTest(ui.Offset position) => true;
}
class ColorPickerInfoWidget extends StatefulWidget {
@override
State<StatefulWidget> createState() => _ColorPickerInfoWidgetState();
}
class _ColorPickerInfoWidgetState extends State<ColorPickerInfoWidget> {
double top = infoWidgetTopMargin;
Color? color;
String get colorDesc =>
'#${color?.value.toRadixString(16).padLeft(8, '0').toUpperCase() ?? ''}';
@override
Widget build(BuildContext context) {
return Positioned(
left: infoWidgetHorizontalMargin,
top: top,
child: Draggable(
child: _buildInfoView(),
feedback: _buildInfoView(),
childWhenDragging: Container(),
onDragEnd: (DraggableDetails detail) {
final Offset offset = detail.offset;
setState(() {
top = offset.dy;
if (top < 0) {
top = 0;
}
});
},
onDraggableCanceled: (Velocity velocity, Offset offset) {}),
);
}
Widget _buildInfoView() {
final Size size = MediaQuery.of(context).size;
return Container(
width: size.width - 40,
padding:
const EdgeInsets.only(left: 16, right: 16, top: 20, bottom: 20),
decoration: BoxDecoration(
border: Border.all(color: const Color(0xffeeeeee), width: 0.5),
borderRadius: const BorderRadius.all(Radius.circular(4)),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black12,
offset: Offset(4, 4),
blurRadius: 15,
spreadRadius: 1,
)
]),
alignment: Alignment.centerLeft,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
ValueListenableBuilder<Color>(
valueListenable: ColorPickerKit.instance.color,
builder: (BuildContext context, Color value, Widget? child) {
color = value;
return Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
child: const SizedBox(height: 20, width: 20),
decoration: BoxDecoration(
border: Border.all(
color: const Color(0xffeeeeee), width: 0.5),
borderRadius:
const BorderRadius.all(Radius.circular(4)),
color: color),
),
const SizedBox(width: 26),
Text(
colorDesc,
style: const TextStyle(
color: Color(0xff333333),
fontSize: 16,
),
)
],
);
},
),
GestureDetector(
child: Image.asset(
'images/dokit_ic_close.png',
package: DK_PACKAGE_NAME,
height: 22,
width: 22,
),
onTap: () {
ColorPickerKit.hide(context);
},
)
],
));
}
}
| Dart | 5 | didichuxing/DoraemonKit | Flutter/lib/kit/visual/color_pick.dart | [
"Apache-2.0"
] |
global _start
%include "header.inc"
mov dword [esp], 0x03479aef
mov dword [esp+4], 0x03479aef
mov dword [esp+8], 0x03479aef
mov dword [esp+12], 0x03479aef
mov dword [esp+16], 0x03479aef
mov dword [esp+20], 0x03479aef
mov dword [esp+24], 0x03479aef
mov dword [esp+28], 0x03479aef
mov eax, 0
btc dword [esp], eax
mov eax, -5
btc dword [esp + 4], eax
mov eax, 1
btc dword [esp], eax
mov eax, 31
btc dword [esp], eax
mov eax, 32
btc dword [esp], eax
mov eax, 63
btc dword [esp], eax
mov eax, 99
btc dword [esp], eax
%include "footer.inc"
| Assembly | 3 | brenden7158/v86 | tests/nasm/btc-reg32.asm | [
"BSD-2-Clause"
] |
global _start
section .data
align 16
dq0:
dq 0x0102030405060708
dq 0xffffaaaabbbbcccc
dq1:
dq 0x8d0000ceadad00ff
dq 0x0123456789abcdef
mydword:
dd 0xcafebac0
align 16
shift1:
dq 0x07
dq 0
shift2:
dq -0x22
dq 0
%include "header.inc"
movq mm0, [dq0]
movq mm1, [dq0]
movq mm2, [dq0]
movq mm3, [dq1]
movq mm4, [dq1]
movq mm6, [dq1]
movq xmm0, [dq0]
movq xmm1, [dq0]
movq xmm2, [dq0]
movq xmm3, [dq1]
movq xmm4, [dq1]
movq xmm6, [dq1]
psllq mm0, [shift1]
psllq mm1, [shift2]
psllq mm2, 50
psllq mm3, 28
psllq mm4, 68
psllq mm6, 0x5
psllq xmm0, [shift1]
psllq xmm1, [shift2]
psllq xmm2, 50
psllq xmm3, 28
psllq xmm4, 68
psllq xmm6, 0x5
%include "footer.inc"
| Assembly | 3 | brenden7158/v86 | tests/nasm/psllq.asm | [
"BSD-2-Clause"
] |
# Implements managing trust relationships between types.
role Perl6::Metamodel::Trusting {
# Who do we trust?
has @!trustees;
# Adds a type that we trust.
method add_trustee($obj, $trustee) {
@!trustees[+@!trustees] := $trustee;
}
# Introspect the types that we trust.
method trusts($obj) {
@!trustees
}
# Checks if we trust a certain type. Can be used by the compiler
# to check if a private call is allowable.
method is_trusted($obj, $claimant) {
# Always trust ourself.
if $claimant.WHAT =:= $obj.WHAT {
return 1;
}
# Otherwise, look through our trustee list.
for @!trustees {
if $_.WHAT =:= $claimant.WHAT {
return 1;
}
}
# If we get here, not trusted.
0
}
}
# vim: expandtab sw=4
| Perl6 | 5 | raydiak/rakudo | src/Perl6/Metamodel/Trusting.nqp | [
"Artistic-2.0"
] |
defmodule ExUnit.CaptureIO do
@moduledoc ~S"""
Functionality to capture IO for testing.
## Examples
defmodule AssertionTest do
use ExUnit.Case
import ExUnit.CaptureIO
test "example" do
assert capture_io(fn -> IO.puts("a") end) == "a\n"
end
test "another example" do
assert with_io(fn ->
IO.puts("a")
IO.puts("b")
2 + 2
end) == {4, "a\nb\n"}
end
end
"""
@doc """
Captures IO generated when evaluating `fun`.
Returns the binary which is the captured output.
By default, `capture_io` replaces the `group_leader` (`:stdio`)
for the current process. Capturing the group leader is done per
process and therefore can be done concurrently.
However, the capturing of any other named device, such as `:stderr`,
happens globally and persists until the function has ended. While this means
it is safe to run your tests with `async: true` in many cases, captured output
may include output from a different test and care must be taken when using
`capture_io` with a named process asynchronously.
A developer can set a string as an input. The default input is an empty
string. If capturing a named device asynchronously, an input can only be given
to the first capture. Any further capture that is given to a capture on that
device will raise an exception and would indicate that the test should be run
synchronously.
Similarly, once a capture on a named device has begun, the encoding on that
device cannot be changed in a subsequent concurrent capture. An error will
be raised in this case.
## IO devices
You may capture the IO from any registered IO device. The device name given
must be an atom representing the name of a registered process. In addition,
Elixir provides two shortcuts:
* `:stdio` - a shortcut for `:standard_io`, which maps to
the current `Process.group_leader/0` in Erlang
* `:stderr` - a shortcut for the named process `:standard_error`
provided in Erlang
## Options
* `:input` - An input to the IO device, defaults to `""`.
* `:capture_prompt` - Define if prompts (specified as arguments to
`IO.get*` functions) should be captured. Defaults to `true`. For
IO devices other than `:stdio`, the option is ignored.
* `:encoding` (since v1.10.0) - encoding of the IO device. Allowed
values are `:unicode` (default) and `:latin1`.
## Examples
iex> capture_io(fn -> IO.write("john") end) == "john"
true
iex> capture_io(:stderr, fn -> IO.write(:stderr, "john") end) == "john"
true
iex> capture_io(:standard_error, fn -> IO.write(:stderr, "john") end) == "john"
true
iex> capture_io("this is input", fn ->
...> input = IO.gets("> ")
...> IO.write(input)
...> end) == "> this is input"
true
iex> capture_io([input: "this is input", capture_prompt: false], fn ->
...> input = IO.gets("> ")
...> IO.write(input)
...> end) == "this is input"
true
## Returning values
As seen in the examples above, `capture_io` returns the captured output.
If you want to also capture the result of the function executed,
use `with_io/2`.
"""
@spec capture_io((() -> any())) :: String.t()
def capture_io(fun) when is_function(fun, 0) do
{_result, capture} = with_io(fun)
capture
end
@doc """
Captures IO generated when evaluating `fun`.
See `capture_io/1` for more information.
"""
@spec capture_io(atom() | String.t() | keyword(), (() -> any())) :: String.t()
def capture_io(device_input_or_options, fun)
def capture_io(device, fun) when is_atom(device) and is_function(fun, 0) do
{_result, capture} = with_io(device, fun)
capture
end
def capture_io(input, fun) when is_binary(input) and is_function(fun, 0) do
{_result, capture} = with_io(input, fun)
capture
end
def capture_io(options, fun) when is_list(options) and is_function(fun, 0) do
{_result, capture} = with_io(options, fun)
capture
end
@doc """
Captures IO generated when evaluating `fun`.
See `capture_io/1` for more information.
"""
@spec capture_io(atom(), String.t() | keyword(), (() -> any())) :: String.t()
def capture_io(device, input_or_options, fun)
def capture_io(device, input, fun)
when is_atom(device) and is_binary(input) and is_function(fun, 0) do
{_result, capture} = with_io(device, input, fun)
capture
end
def capture_io(device, options, fun)
when is_atom(device) and is_list(options) and is_function(fun, 0) do
{_result, capture} = with_io(device, options, fun)
capture
end
@doc ~S"""
Invokes the given `fun` and returns the result and captured output.
It accepts the same arguments and options as `capture_io/1`.
## Examples
{result, output} =
assert with_io(fn ->
IO.puts("a")
IO.puts("b")
2 + 2
end)
assert result == 4
assert output == "a\nb\n"
"""
@doc since: "1.13.0"
@spec with_io((() -> any())) :: {any(), String.t()}
def with_io(fun) when is_function(fun, 0) do
with_io(:stdio, [], fun)
end
@doc """
Invokes the given `fun` and returns the result and captured output.
See `with_io/1` for more information.
"""
@doc since: "1.13.0"
@spec with_io(atom() | String.t() | keyword(), (() -> any())) :: {any(), String.t()}
def with_io(device_input_or_options, fun)
def with_io(device, fun) when is_atom(device) and is_function(fun, 0) do
with_io(device, [], fun)
end
def with_io(input, fun) when is_binary(input) and is_function(fun, 0) do
with_io(:stdio, [input: input], fun)
end
def with_io(options, fun) when is_list(options) and is_function(fun, 0) do
with_io(:stdio, options, fun)
end
@doc """
Invokes the given `fun` and returns the result and captured output.
See `with_io/1` for more information.
"""
@doc since: "1.13.0"
@spec with_io(atom(), String.t() | keyword(), (() -> any())) :: {any(), String.t()}
def with_io(device, input_or_options, fun)
def with_io(device, input, fun)
when is_atom(device) and is_binary(input) and is_function(fun, 0) do
with_io(device, [input: input], fun)
end
def with_io(device, options, fun)
when is_atom(device) and is_list(options) and is_function(fun, 0) do
do_with_io(map_dev(device), options, fun)
end
defp map_dev(:stdio), do: :standard_io
defp map_dev(:stderr), do: :standard_error
defp map_dev(other), do: other
defp do_with_io(:standard_io, options, fun) do
prompt_config = Keyword.get(options, :capture_prompt, true)
encoding = Keyword.get(options, :encoding, :unicode)
input = Keyword.get(options, :input, "")
original_gl = Process.group_leader()
{:ok, capture_gl} = StringIO.open(input, capture_prompt: prompt_config, encoding: encoding)
try do
Process.group_leader(self(), capture_gl)
do_capture_gl(capture_gl, fun)
after
Process.group_leader(self(), original_gl)
end
end
defp do_with_io(device, options, fun) do
input = Keyword.get(options, :input, "")
encoding = Keyword.get(options, :encoding, :unicode)
case ExUnit.CaptureServer.device_capture_on(device, encoding, input) do
{:ok, ref} ->
try do
result = fun.()
{result, ExUnit.CaptureServer.device_output(device, ref)}
after
ExUnit.CaptureServer.device_capture_off(ref)
end
{:error, :no_device} ->
raise "could not find IO device registered at #{inspect(device)}"
{:error, {:changed_encoding, current_encoding}} ->
raise ArgumentError, """
attempted to change the encoding for a currently captured device #{inspect(device)}.
Currently set as: #{inspect(current_encoding)}
Given: #{inspect(encoding)}
If you need to use multiple encodings on a captured device, you cannot \
run your test asynchronously
"""
{:error, :input_on_already_captured_device} ->
raise ArgumentError,
"attempted multiple captures on device #{inspect(device)} with input. " <>
"If you need to give an input to a captured device, you cannot run your test asynchronously"
end
end
defp do_capture_gl(string_io, fun) do
try do
fun.()
catch
kind, reason ->
_ = StringIO.close(string_io)
:erlang.raise(kind, reason, __STACKTRACE__)
else
result ->
{:ok, {_input, output}} = StringIO.close(string_io)
{result, output}
end
end
end
| Elixir | 5 | doughsay/elixir | lib/ex_unit/lib/ex_unit/capture_io.ex | [
"Apache-2.0"
] |
module YumVersionlock =
autoload xfm
let epoch = label "epoch" . store /[0-9]+/ . del ":" ":"
let name = key /[A-Za-z0-9_+.-]+/
let version = label "version" . store /[A-Za-z0-9_+.]+-[A-Za-z0-9_+.]+/
let dash = del "-" "-"
let wildcard = del /(\.\*)?/ ".*"
let entry = [ [ epoch ]? . name . dash . [ version ] . wildcard . Util.eol ]
let lns = ( Util.empty | Util.comment | entry )*
let filter = incl "/etc/yum/pluginconf.d/versionlock.list" . Util.stdexcl
let xfm = transform lns filter
| Augeas | 4 | swisscom/puppet-package_verifiable | lib/augeas/lenses/yumversionlock.aug | [
"MIT"
] |
"""Constants for scaffolding."""
from pathlib import Path
COMPONENT_DIR = Path("homeassistant/components")
TESTS_DIR = Path("tests/components")
| Python | 1 | domwillcode/home-assistant | script/scaffold/const.py | [
"Apache-2.0"
] |
theme.palette.type = isDark ? 'dark' : 'light';
({
color: palette.type === 'dark' ? '#fff' : palette.text.primary,
'&:hover': () => ({
color: palette.type === 'dark' ? palette.primary.light : palette.primary.main,
}),
boxShadow: `0 0 0 0.2rem ${Color(normalColor).fade(palette.type === 'dark' ? 0.48 : 0.75)}`,
});
{
palette: {
type: 'light';
}
}
{
palette: { type: 'light' }
} | JavaScript | 3 | dany-freeman/material-ui | packages/mui-codemod/src/v5.0.0/theme-palette-mode.test/actual.js | [
"MIT"
] |
<mt:Ignore>
# =======================
#
# パーツ-アイキャッチ画像
# アイキャッチ画像の情報を変数で返す
#
# モディファイアの基本値:
# print = 0
# square = 0
# width = 480
# height = 360
# alt = asset description
#
# 返す変数:
# ec_eye_alt
# ec_eye_thumb_url
# ec_eye_org_width
# ec_eye_org_height
# ec_eye_org_url
#
# 使い方1:
# <mt:If tag="EcPageEyecatch">
# <mt:EcPageEyecatchAsset>
# <mt:Include module="パーツ-アイキャッチ画像" print="1" />
# </mt:EcPageEyecatchAsset>
# </mt:If>
#
# 使い方2:
# <mt:If tag="EcCategoryEyecatch">
# <mt:EcPageEyecatchAsset>
# <mt:Include module="パーツ-アイキャッチ画像" width="960" height="540" />
# <div class="ec-cover" style="background-image: url('<mt:var name="ec_eye_url" />')">
# </mt:EcPageEyecatchAsset>
# </mt:If>
#
# 使い方3:
# <mt:If tag="EcEntryEyecatch">
# <mt:EcPageEyecatchAsset>
# <mt:Include module="パーツ-アイキャッチ画像" width="300" square="1" print="1" />
# </mt:EcPageEyecatchAsset>
# <mt:Else>
# (noimage)
# </mt:If>
#
# =======================
</mt:Ignore>
<mt:Unless name="print">
<mt:SetVar name="print" value="0" />
</mt:Unless>
<mt:Unless name="square">
<mt:SetVar name="square" value="0" />
</mt:Unless>
<mt:Unless name="width">
<mt:SetVar name="width" value="480" />
</mt:Unless>
<mt:Unless name="square">
<mt:Unless name="height">
<mt:SetVar name="height" value="360" />
</mt:Unless>
</mt:Unless>
<mt:If name="alt">
<mt:Var name="alt" setvar="ec_eye_alt" />
<mt:Else>
<mt:AssetProperty property="description" encode_html="1" setvar="ec_eye_alt" />
</mt:If>
<mt:AssetURL setvar="ec_eye_org_url" />
<mt:AssetProperty property="image_width" setvar="ec_eye_org_width" />
<mt:AssetProperty property="image_height" setvar="ec_eye_org_height" />
<mt:If name="square">
<mt:AssetThumbnailURL width="$width" square="1" setvar="ec_eye_thumb_url" />
<mt:Else>
<mt:If name="ec_eye_org_width" le="$ec_eye_org_height">
<mt:AssetThumbnailURL height="$height" setvar="ec_eye_thumb_url" />
<mt:Else>
<mt:AssetThumbnailURL width="$width" setvar="ec_eye_thumb_url" />
</mt:if>
</mt:if>
<mt:If name="print">
<img src="<mt:var name="ec_eye_url" />" width="<mt:var name="width" />" width="<mt:var name="height" />" class="img-responsive">
</mt:if>
| MTML | 4 | webbingstudio/mt_theme_echo_bootstrap | dist/themes/echo_bootstrap/templates/parts_entry_eyecatch.mtml | [
"MIT"
] |
sleep 2
t app appmode photo_burst
sleep 1
t app burst_settings 30-2
sleep 1
t app button shutter PR
sleep 9
poweroff yes
reboot yes | AGS Script | 2 | waltersgrey/autoexechack | BurstHacks/BurstAndTurnOff/30:2/Hero3PlusBlack/autoexec.ash | [
"MIT"
] |
drop table if exists alter_ttl;
create table alter_ttl(i Int) engine = MergeTree order by i ttl toDate('2020-05-05');
alter table alter_ttl add column s String;
alter table alter_ttl modify column s String ttl toDate('2020-01-01');
show create table alter_ttl;
drop table alter_ttl;
create table alter_ttl(d Date, s String) engine = MergeTree order by d ttl d + interval 1 month;
alter table alter_ttl modify column s String ttl d + interval 1 day;
show create table alter_ttl;
drop table alter_ttl;
| SQL | 3 | pdv-ru/ClickHouse | tests/queries/0_stateless/01070_alter_with_ttl.sql | [
"Apache-2.0"
] |
@prefix .eg : <http://www.w3.org/2013/TurtleTests/> .
.eg:s .eg:p .eg:o .
| Turtle | 2 | joshrose/audacity | lib-src/lv2/serd/tests/TurtleTests/turtle-syntax-bad-ns-dot-start.ttl | [
"CC-BY-3.0"
] |
<'
extend TB_NAME_T : [ ETRC ];
extend fifo {
keep soft testbench == ETRC;
};
extend ETRC fifo {
keep direction == POP;
keep soft type == CLASSIC;
keep PORT_DATAOUT == appendf("esa_data[%d]" , id);
keep PORT_POP_EMPTY == appendf("fifo_empty[%d]", id);
keep PORT_POP_ALMOST_EMPTY == appendf("ESA_PopAE[%d]" , id);
keep PORT_POP_ALMOST_FULL == appendf("ESA_PopAF[%d]" , id);
keep PORT_POP_FULL == "";
keep PORT_POP_ERROR == "";
keep PORT_POP_REQ == appendf("etrc_popreq_n[%d]" , id);
keep soft PORT_POP_CLK == "sysclk";
keep soft PORT_PUSH_CLK == "sysclk";
// keep logger.verbosity == HIGH;
reset_sig() is {
injector.reset_sig();
'(PORT_DATAOUT)' = 0;
'(PORT_POP_EMPTY)' = 0;
'(PORT_POP_ALMOST_EMPTY)' = 0;
'(PORT_POP_ALMOST_FULL)' = 0;
'(PORT_POP_REQ)' = 0;
'(PORT_POP_CLK)' = 0;
'(PORT_POP_CLK)' = 1;
};
event clkSys is rise('sysclk');
event bug001 is true('pkdescnt[0]' == 1)@clkSys;
on bug001
{
dut_error("Bug 001 found ... crash!");
};
};
extend ETRC FIFO_INJECTOR {
pkt_desc_if : pkt_desc_if is instance;
keep pkt_desc_if.MAC_uid == id;
add_new_pkt_desc() is also {
pkt_desc_if.indicate_one_pck_desc_is_come_in_FIFO();
};
reset_sig() is {
pkt_desc_if.reset_sig();
};
};
extend ETRC CLASSIC fifo
{
keep ae_seuil == 1;
keep af_seuil == 46;
keep fifo_size == 56;
setState() is also
{
if (fifo_plot &&(sys.time > 200000) && // avoid fifo plot before beginning of operation of RAMC
!((injector.generated_packet_nb == injector.max_generated_packets && injector.stream.size() == 0)
|| injector.generated_packet_nb == 0))
{
if (fifo_use_logger) {
messagef(HIGH, "ETRC[%d] : %d\n", id, fifo.size());
}
else {
out("__fifo_plot: ", sys.time, " ", fifo.size() );
};
};
};
};
'>
| Eiffel | 3 | subethaedit/SubEthaEd | Documentation/ModeDevelopment/Reference Files/hl/highlight.e | [
"MIT"
] |
--
-- Sample schema for testing vault database secrets
--
create schema fakebank;
use fakebank;
create table account(
id decimal(16,0),
name varchar(30),
branch_id decimal(16,0),
customer_id decimal(16,0),
primary key (id));
--
-- MySQL user that will be used by Vault to create other users on demand
--
create user 'fakebank-admin'@'%' identified by 'Sup&rSecre7!'
grant all privileges on fakebank.* to 'fakebank-admin'@'%' with grant option;
grant create user on *.* to 'fakebank-admin' with grant option;
flush privileges;
| SQL | 4 | DBatOWL/tutorials | spring-cloud/spring-cloud-vault/database-setup.sql | [
"MIT"
] |
import * as React from 'react';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import Link from 'docs/src/modules/components/Link';
import ROUTES from 'docs/src/route';
import FEATURE_TOGGLE from 'docs/src/featureToggle';
export default function AppHeaderBanner() {
return FEATURE_TOGGLE.enable_website_banner ? (
<Box
sx={{
p: 1.5,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
background: (theme) =>
theme.palette.mode === 'dark'
? `linear-gradient(90deg, ${theme.palette.primary[900]}, ${theme.palette.primary[600]} 120%)`
: `linear-gradient(-90deg, ${theme.palette.primary[700]}, ${theme.palette.primary[500]} 120%)`,
}}
>
<Typography
variant="body2"
fontWeight="medium"
sx={{
color: '#fff',
}}
>
Fix me!
<Link
href={ROUTES.home} // Fix me!
target="_blank"
data-ga-event-category="$event-category" // Fix me!
data-ga-event-action="click"
data-ga-event-label="header"
sx={{ color: '#fff', textDecoration: 'underline' }}
>
Fix me!
</Link>
</Typography>
</Box>
) : null;
}
| TypeScript | 3 | qwaszx7003/material-ui | docs/src/components/banner/AppHeaderBanner.tsx | [
"MIT"
] |
/**
*
* \file
* \brief [Insertion Sort Algorithm
* (Insertion Sort)](https://en.wikipedia.org/wiki/Insertion_sort)
*
* \details
* Insertion sort is a simple sorting algorithm that builds the final
* sorted array one at a time. It is much less efficient compared to
* other sorting algorithms like heap sort, merge sort or quick sort.
* However it has several advantages such as
* 1. Easy to implement
* 2. For small set of data it is quite efficient
* 3. More efficient that other Quadratic complexity algorithms like
* Selection sort or bubble sort.
* 4. It's stable that is it does not change the relative order of
* elements with equal keys
* 5. Works on hand means it can sort the array or list as it receives.
*
* It is based on the same idea that people use to sort the playing cards in
* their hands.
* the algorithms goes in the manner that we start iterating over the array
* of elements as soon as we find a unsorted element that is a misplaced
* element we place it at a sorted position.
*
* Example execution steps:
* 1. Suppose initially we have
* \f{bmatrix}{4 &3 &2 &5 &1\f}
* 2. We start traversing from 4 till we reach 1
* when we reach at 3 we find that it is misplaced so we take 3 and place
* it at a correct position thus the array will become
* \f{bmatrix}{3 &4 &2 &5 &1\f}
* 3. In the next iteration we are at 2 we find that this is also misplaced so
* we place it at the correct sorted position thus the array in this iteration
* becomes
* \f{bmatrix}{2 &3 &4 &5 &1\f}
* 4. We do not do anything with 5 and move on to the next iteration and
* select 1 which is misplaced and place it at correct position. Thus, we have
* \f{bmatrix}{1 &2 &3 &4 &5\f}
*/
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
/** \namespace sorting
* \brief Sorting algorithms
*/
namespace sorting {
/** \brief
* Insertion Sort Function
*
* @tparam T type of array
* @param [in,out] arr Array to be sorted
* @param n Size of Array
*/
template <typename T>
void insertionSort(T *arr, int n) {
for (int i = 1; i < n; i++) {
T temp = arr[i];
int j = i - 1;
while (j >= 0 && temp < arr[j]) {
arr[j + 1] = arr[j];
j--;
}
arr[j + 1] = temp;
}
}
/** Insertion Sort Function
*
* @tparam T type of array
* @param [in,out] arr pointer to array to be sorted
*/
template <typename T>
void insertionSort(std::vector<T> *arr) {
size_t n = arr->size();
for (size_t i = 1; i < n; i++) {
T temp = arr[0][i];
int32_t j = i - 1;
while (j >= 0 && temp < arr[0][j]) {
arr[0][j + 1] = arr[0][j];
j--;
}
arr[0][j + 1] = temp;
}
}
} // namespace sorting
/**
* @brief Create a random array objecthelper function to create a random array
*
* @tparam T type of array
* @param arr array to fill (must be pre-allocated)
* @param N number of array elements
*/
template <typename T>
static void create_random_array(T *arr, int N) {
while (N--) {
double r = (std::rand() % 10000 - 5000) / 100.f;
arr[N] = static_cast<T>(r);
}
}
/** Test Cases to test algorithm */
void tests() {
int arr1[10] = {78, 34, 35, 6, 34, 56, 3, 56, 2, 4};
std::cout << "Test 1... ";
sorting::insertionSort(arr1, 10);
assert(std::is_sorted(arr1, arr1 + 10));
std::cout << "passed" << std::endl;
int arr2[5] = {5, -3, 7, -2, 1};
std::cout << "Test 2... ";
sorting::insertionSort(arr2, 5);
assert(std::is_sorted(arr2, arr2 + 5));
std::cout << "passed" << std::endl;
float arr3[5] = {5.6, -3.1, -3.0, -2.1, 1.8};
std::cout << "Test 3... ";
sorting::insertionSort(arr3, 5);
assert(std::is_sorted(arr3, arr3 + 5));
std::cout << "passed" << std::endl;
std::vector<float> arr4({5.6, -3.1, -3.0, -2.1, 1.8});
std::cout << "Test 4... ";
sorting::insertionSort(&arr4);
assert(std::is_sorted(std::begin(arr4), std::end(arr4)));
std::cout << "passed" << std::endl;
int arr5[50];
std::cout << "Test 5... ";
create_random_array(arr5, 50);
sorting::insertionSort(arr5, 50);
assert(std::is_sorted(arr5, arr5 + 50));
std::cout << "passed" << std::endl;
float arr6[50];
std::cout << "Test 6... ";
create_random_array(arr6, 50);
sorting::insertionSort(arr6, 50);
assert(std::is_sorted(arr6, arr6 + 50));
std::cout << "passed" << std::endl;
}
/** Main Function */
int main() {
/// Running predefined tests to test algorithm
tests();
/// For user insteraction
size_t n;
std::cout << "Enter the length of your array (0 to exit): ";
std::cin >> n;
if (n == 0) {
return 0;
}
int *arr = new int[n];
std::cout << "Enter any " << n << " Numbers for Unsorted Array : ";
for (int i = 0; i < n; i++) {
std::cin >> arr[i];
}
sorting::insertionSort(arr, n);
std::cout << "\nSorted Array : ";
for (int i = 0; i < n; i++) {
std::cout << arr[i] << " ";
}
std::cout << std::endl;
delete[] arr;
return 0;
}
| C++ | 5 | icbdubey/C-Plus-Plus | sorting/insertion_sort.cpp | [
"MIT"
] |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf8">
<title>iframe nw test</title>
</head>
<body>
<h1 id='result'>iframe nw test</h1>
<h1 id='result2'>iframe nw test</h1>
<iframe id="iframe" src="iframe.html"></iframe>
<iframe id="iframe2" src="iframe.html" nwdisable></iframe>
<script type="text/javascript">
iframe.onload = function() {
document.getElementById('result').innerHTML = iframe.contentWindow.nw_type;
};
iframe2.onload = function() {
document.getElementById('result2').innerHTML = iframe2.contentWindow.nw_type;
};
</script>
</body>
</html>
| HTML | 3 | namaljayathunga/nw.js | test/remoting/iframe-nw/index.html | [
"MIT"
] |
/*
* Copyright (c) 2021, Tim Flynn <[email protected]>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Forward.h>
#include <LibWeb/Layout/ReplacedBox.h>
namespace Web::Layout {
class LabelableNode : public ReplacedBox {
public:
virtual void handle_associated_label_mousedown(Badge<Label>) { }
virtual void handle_associated_label_mouseup(Badge<Label>) { }
virtual void handle_associated_label_mousemove(Badge<Label>, [[maybe_unused]] bool is_inside_node_or_label) { }
protected:
LabelableNode(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style)
: ReplacedBox(document, element, move(style))
{
}
virtual ~LabelableNode() = default;
};
}
| C | 4 | r00ster91/serenity | Userland/Libraries/LibWeb/Layout/LabelableNode.h | [
"BSD-2-Clause"
] |
function isPromiseLike(thing) {
return !!thing && typeof thing.then === 'function';
}
function InMemoryCache(initialValue, reportError) {
if (typeof reportError !== 'function') {
throw new Error(
'No reportError function specified for this in-memory-cache'
);
}
const cacheKey = Symbol('cacheKey');
const cache = new Map();
cache.set(cacheKey, initialValue);
return {
get() {
const value = cache.get(cacheKey);
return typeof value !== 'undefined' ? value : null;
},
update(fn) {
try {
const value = fn();
if (isPromiseLike(value)) {
return value.then(value => cache.set(cacheKey, value));
} else {
cache.set(cacheKey, value);
}
} catch (e) {
const errMsg = `InMemoryCache > update > caught: ${e.message}`;
e.message = errMsg;
reportError(e);
}
return null;
},
clear() {
return cache.delete(cacheKey);
}
};
}
export default InMemoryCache;
| JavaScript | 4 | fcastillo-serempre/freeCodeCamp | api-server/src/server/utils/in-memory-cache.js | [
"BSD-3-Clause"
] |
# Copyright (c) 2018-2021, Carnegie Mellon University
# See LICENSE for details
CompareCodeMat := (sums, opts) ->
let(me := Try(CMatrix(CodeSums(Copy(sums), opts), opts)),
them := MatSPL(sums),
When(me[1] = false, false,
InfinityNormMat(me[2]-them) < 1e-5));
_RecursiveFindBug := function(ind, spl, opts, verify_func)
local c, ch, res, bugspl, origspl, seg, i, len;
Print(Blanks(ind), ObjId(spl), " - ");
res := verify_func(spl, opts);
Print(res, "\n");
# no bug, verification succeeded
if res = true then return true;
# bug, verification failed, now we will recurse and verify the children
else
origspl := spl;
# loops need to be unrolled to get rid of index variables
if IsBound(spl.unroll) then spl := spl.unroll(); fi;
for c in spl.children() do
bugspl := _RecursiveFindBug(ind+3, c, opts, verify_func);
if bugspl <> true then return bugspl; fi; # bug is in the child
od;
# verification succeeded for all of the children, but we will still try to
# narrow down the problem if the current node is Compose
if ObjId(spl)=Compose and spl.numChildren() > 2 then
ind := ind+3;
PrintLine(Blanks(ind), "Problematic multifactor Compose. Narrowing down the problem");
ch := spl.children();
while Length(ch) > 2 do
len := Length(ch)-1;
i:=1;
res := true;
# the loop terminates when res = false (verif failed) OR everything succeeded (ie no smaller bug)
while res and i <= Length(ch)-len+1 do
seg := ch{[i..i+len-1]};
res := verify_func(Compose(seg), opts);
PrintLine(Blanks(ind), "len=", len, " i=", i, " ", res);
i := i+1;
od;
if res=true then return Compose(ch);
else ch := seg;
fi;
od;
return Compose(ch);
else
return origspl; # bug is here and not in the children, and we could not narrow it down further
fi;
fi;
end;
# verify_func(spl, opts)
#
RecursiveFindBug := (spl, opts, verify_func) -> _RecursiveFindBug(0, spl, opts, verify_func);
_RecursiveFindBugExp := function(ind, spl, opts, verify_func)
local c, ch, res, bugspl, origspl, seg, i, len;
Print(Blanks(ind), ObjId(spl), " - ");
res := verify_func(spl, opts);
Print(res, "\n");
# no bug, verification succeeded
if res = true then return true;
# bug, verification failed, now we will recurse and verify the children
else
origspl := spl;
# loops need to be unrolled to get rid of index variables
if IsBound(spl.unroll) then spl := spl.unroll(); fi;
for c in spiral.rewrite._children(spl) do
bugspl := _RecursiveFindBugExp(ind+3, c, opts, verify_func);
if bugspl <> true then return bugspl; fi; # bug is in the child
od;
return origspl; # bug is here and not in the children
fi;
end;
RecursiveFindBugExp := (spl, opts, verify_func) -> _RecursiveFindBugExp(0, spl, opts, verify_func);
RecursiveFindBugRT := function (rt, opts)
local chk, s;
chk := (spl, opts) -> InfinityNormMat(CMatrix(CodeSumsOpts(spl, opts), opts) - MatSPL(spl)) < 1e-4;
s := SumsRuleTreeOpts(rt, opts);
return RecursiveFindBug(s, opts, chk);
end;
| GAP | 5 | sr7cb/spiral-software | namespaces/spiral/compiler/bug.gi | [
"BSD-2-Clause-FreeBSD"
] |
//Under-sampling based resonant Lowpass filter by Kassen
//Internal workings are explained in the source, for those who need that.
//let's have a look at how to use it in practice here.
chout <= "hi there! \n";
chout <= "Let's do some filtering! \n";
chout <= "Let's start with a simple example: \n";
chout <= "... \n";
chout.flush();
BlitSaw s => KasFilter kf => dac; //we use a BlitSaw because it doesn't alias.
220 => s.freq;
Envelope ramp => blackhole; //our modulation signal.
220 => ramp.value;
5::second => ramp.duration;
5000 => ramp.target;
while (ramp.value() < ramp.target())
{
ramp.value() => kf.freq;
samp => now;
}
0 => s.freq;
0 => s.op;
chout <= "That sounded a bit like a filter and a bit like under-sampling, right? \n";
chout <= "That's because that's exactly what's going on. \n";
chout <= "But we can do more, we can add resonance to it, like a normal filter. \n";
chout <= "Let's try the same sweep again, but now with some resonance. \n";
chout <= "... \n";
chout.flush();
2::second => now;
220 => s.freq;
1 => s.op;
220 => ramp.value;
5::second => ramp.duration;
5000 => ramp.target;
.85 => kf.resonance;
while (ramp.value() < ramp.target())
{
ramp.value() => kf.freq;
samp => now;
}
0 => s.freq;
0 => s.op;
chout <= "With resonance there is a lot more emphasis on the filter sweep. \n";
chout <= "It also brings the artefacts of this technique more to the foreground. \n";
chout <= "That might be good or it could be bad, depending on what you want... \n";
chout <= "I quite like it, so we can go one step further; \n";
chout <= "We can also add a overdrive effect to this resonance, let's try that, \n";
chout <= "we'll also turn the frequency of the input way down for the occasion.... \n";
chout <= "... \n";
chout.flush();
2::second => now;
8 => s.freq;
1 => s.op;
75 => ramp.value;
5::second => ramp.duration;
1000 => ramp.target;
.75 => kf.accent;
.95 => kf.resonance;
while (ramp.value() < ramp.target())
{
ramp.value() => kf.freq;
samp => now;
}
0 => s.freq;
0 => s.op;
chout <= "That's about it. \n";
chout <= "I found it's especially good for lo-fi acid techna, \n";
chout <= "it might be good for other things as well, \n";
chout <= "Have fun! \n";
chout.flush();
2::second => now;
/*
Documentation;
kf.freq(float) //sets the cutoff frequency.
This sets both the frequency at which the 2 sample&holds sample the input signal
and the frequency of the sine that crossfades between them.
kf.freq() //gets the cutoff frequency
kf.resonance(float) //sets the resonance, which is implemented as negative feedback.
accepts values between 0 and 0.95
kf.resonance() // gets the resonance.
kf.accent(float) //sets the amount of waveshaping on the crossfading sine.
Ranges from 0 to 1, where 1 is close to regular under-sampling
(if no resonance is used).
kf.accent() //gets the accent value.
Please report bugs, problems or confusing bits to the ChucK mailing list.
If that fails or you need me for some other reason try;
signal [dot] automatique [at] gmail [another dot] com
*/
| ChucK | 5 | mariobuoninfante/chugins | KasFilter/README-KasFilter.ck | [
"MIT"
] |
resource "google_container_cluster" "diem" {
provider = google-beta
name = "diem-${terraform.workspace}"
location = local.zone
network = google_compute_network.diem.id
remove_default_node_pool = true
initial_node_count = 1
logging_service = "none"
monitoring_service = "none"
release_channel {
channel = "REGULAR"
}
master_auth {
username = ""
password = ""
client_certificate_config {
issue_client_certificate = false
}
}
master_authorized_networks_config {
dynamic "cidr_blocks" {
for_each = var.k8s_api_sources
content {
cidr_block = cidr_blocks.value
}
}
}
private_cluster_config {
enable_private_nodes = true
enable_private_endpoint = false
master_ipv4_cidr_block = "172.16.0.0/28"
}
ip_allocation_policy {
cluster_ipv4_cidr_block = ""
}
workload_identity_config {
identity_namespace = "${var.project}.svc.id.goog"
}
addons_config {
network_policy_config {
disabled = false
}
}
network_policy {
enabled = true
provider = "CALICO"
}
pod_security_policy_config {
enabled = true
}
lifecycle {
prevent_destroy = true
}
}
resource "google_container_node_pool" "utilities" {
provider = google-beta
name = "utilities"
location = local.zone
cluster = google_container_cluster.diem.name
node_count = lookup(var.node_pool_sizes, "utilities", 3)
node_config {
machine_type = "e2-custom-2-4096"
image_type = "COS_CONTAINERD"
disk_size_gb = 20
service_account = google_service_account.gke.email
tags = ["utilities"]
shielded_instance_config {
enable_secure_boot = true
}
workload_metadata_config {
node_metadata = "GKE_METADATA_SERVER"
}
}
}
resource "google_container_node_pool" "validators" {
provider = google-beta
name = "validators"
location = local.zone
cluster = google_container_cluster.diem.name
node_count = lookup(var.node_pool_sizes, "validators", 3)
node_config {
machine_type = "c2-standard-4"
image_type = "COS_CONTAINERD"
disk_size_gb = 20
service_account = google_service_account.gke.email
tags = ["validators"]
shielded_instance_config {
enable_secure_boot = true
}
workload_metadata_config {
node_metadata = "GKE_METADATA_SERVER"
}
taint {
key = "diem.org/nodepool"
value = "validators"
effect = "NO_EXECUTE"
}
}
}
resource "google_container_node_pool" "trusted" {
provider = google-beta
name = "trusted"
location = local.zone
cluster = google_container_cluster.diem.name
node_count = lookup(var.node_pool_sizes, "trusted", 1)
node_config {
machine_type = "n2-custom-2-4096"
image_type = "COS_CONTAINERD"
disk_size_gb = 20
service_account = google_service_account.gke.email
tags = ["trusted"]
shielded_instance_config {
enable_secure_boot = true
}
workload_metadata_config {
node_metadata = "GKE_METADATA_SERVER"
}
taint {
key = "diem.org/nodepool"
value = "trusted"
effect = "NO_EXECUTE"
}
}
}
| HCL | 4 | PragmaTwice/diem | terraform/validator/gcp/cluster.tf | [
"Apache-2.0"
] |
package org.jetbrains.kotlin.aspects.navigation;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.internal.core.SourceMapper;
import org.jetbrains.kotlin.core.resolve.KotlinSourceIndex;
@SuppressWarnings("restriction")
public aspect KotlinFindSourceAspect {
pointcut findSource(SourceMapper mapper, IType type, String simpleSourceFileName) :
target(mapper) &&
args(type, simpleSourceFileName)
&& call(char[] findSource(IType, String));
char[] around(SourceMapper mapper, IType type, String simpleSourceFileName) : findSource(mapper, type, simpleSourceFileName) {
char[] result = proceed(mapper, type, simpleSourceFileName);
if (result == null && KotlinSourceIndex.isKotlinSource(simpleSourceFileName)) {
return KotlinSourceIndex.getSource(mapper, type, simpleSourceFileName);
}
return result;
}
}
| AspectJ | 4 | jan-zajic/kotlin-eclipse | kotlin-eclipse-aspects/src/org/jetbrains/kotlin/aspects/navigation/KotlinFindSourceAspect.aj | [
"Apache-2.0"
] |
/*
Author-Aastha Singh
FizzBuzz in Lolcode
*/
HAI 1.2
IM IN YR loop UPPIN YR var TIL BOTH SAEM var AN 101
DIFFRINT 0 AN var
O RLY?
YA RLY
I HAS A by3 ITZ BOTH SAEM 0 AN MOD OF var AN 3
I HAS A by5 ITZ BOTH SAEM 0 AN MOD OF var AN 5
BOTH OF by3 AN by5
O RLY?
YA RLY
VISIBLE "FizzBuzz"
NO WAI
by3
O RLY?
YA RLY
VISIBLE "Fizz"
NO WAI
by5
O RLY?
YA RLY
VISIBLE "Buzz"
NO WAI
VISIBLE var
OIC
OIC
OIC
OIC
IM OUTTA YR loop
KTHXBYE
| LOLCODE | 4 | GauravPoosarla/FizzBuzz-Hacktoberfest-2021 | Lolcode/fizzbuzz.lol | [
"Unlicense"
] |
<html>
<head>
<meta http-equiv="refresh" content="0; url=../versions/1/" />
</head>
<title>Blueprint v1 redirect</title>
</html>
| HTML | 1 | phungtuanhoang1996/blueprint | site/docs/v1/index.html | [
"Apache-2.0"
] |
package gw.lang.spec_old.enhancements
uses gw.testharness.DoNotVerifyResource
@DoNotVerifyResource
enhancement BadEnhancement : BadEnhancement
{
}
| Gosu | 1 | dmcreyno/gosu-lang | gosu-test/src/test/gosu/gw/lang/spec_old/enhancements/BadEnhancement.gsx | [
"Apache-2.0"
] |
// Copyright (c) 2020 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/common/language_util.h"
#import <Cocoa/Cocoa.h>
#include <string>
#include <vector>
#include "base/strings/sys_string_conversions.h"
namespace electron {
std::vector<std::string> GetPreferredLanguages() {
__block std::vector<std::string> languages;
[[NSLocale preferredLanguages]
enumerateObjectsUsingBlock:^(NSString* language, NSUInteger i,
BOOL* stop) {
languages.push_back(base::SysNSStringToUTF8(language));
}];
return languages;
}
} // namespace electron
| Objective-C++ | 3 | lingxiao-Zhu/electron | shell/common/language_util_mac.mm | [
"MIT"
] |
/*
* Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
#include "Alloc.h"
#include <array>
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "Types.h"
namespace {
class A : public KonanAllocatorAware {
public:
using DestructorHook = testing::StrictMock<testing::MockFunction<void(int)>>;
static THREAD_LOCAL_VARIABLE DestructorHook* destructorHook;
explicit A(int value = -1) : value_(value) {}
~A() { destructorHook->Call(value_); }
int value() const { return value_; }
bool operator==(const A& rhs) const { return value_ == rhs.value_; }
private:
int value_;
};
// static
THREAD_LOCAL_VARIABLE A::DestructorHook* A::destructorHook = nullptr;
struct B {
explicit B(int value) : a(value) {}
A a;
};
} // namespace
class KonanAllocatorAwareTest : public testing::Test {
public:
KStdUniquePtr<A::DestructorHook> destructorHook;
void SetUp() override {
Test::SetUp();
destructorHook = make_unique<A::DestructorHook>();
A::destructorHook = destructorHook.get();
}
void TearDown() override {
A::destructorHook = nullptr;
destructorHook.reset();
Test::TearDown();
}
};
TEST_F(KonanAllocatorAwareTest, AllocatedOnStack) {
A a(42);
EXPECT_THAT(a.value(), 42);
EXPECT_CALL(*destructorHook, Call(42));
}
TEST_F(KonanAllocatorAwareTest, AllocatedInAnotherObject) {
// We do not control how `B` is allocated.
B* b = new B(42);
EXPECT_THAT(b->a.value(), 42);
EXPECT_CALL(*destructorHook, Call(42));
delete b;
}
TEST_F(KonanAllocatorAwareTest, AllocatedByItself) {
A* a = new A(42);
EXPECT_THAT(a->value(), 42);
EXPECT_CALL(*destructorHook, Call(42));
delete a;
}
TEST_F(KonanAllocatorAwareTest, AllocateArray) {
constexpr size_t kCount = 5;
A* as = new A[kCount];
std::vector<int> actual;
for (A* a = as; a != as + kCount; ++a) {
actual.push_back(a->value());
}
std::array<int, kCount> expected;
for (int& element : expected) {
element = -1;
}
EXPECT_THAT(actual, testing::ElementsAreArray(expected));
EXPECT_CALL(*destructorHook, Call(-1)).Times(kCount);
delete[] as;
}
TEST_F(KonanAllocatorAwareTest, PlacementAllocated) {
std::array<uint8_t, sizeof(A)> buffer;
A* a = new (buffer.data()) A(42);
EXPECT_THAT(a->value(), 42);
EXPECT_CALL(*destructorHook, Call(42));
a->~A();
}
TEST_F(KonanAllocatorAwareTest, PlacementConstructedArray) {
constexpr size_t kCount = 5;
// TODO: Consider removing support for placement new[] altogether, since there's no
// portable way to know needed storage size ahead of time.
alignas(A) std::array<uint8_t, sizeof(A) * kCount + sizeof(size_t)> buffer;
A* as = new (buffer.data()) A[kCount];
std::vector<int> actual;
for (A* a = as; a != as + kCount; ++a) {
actual.push_back(a->value());
}
std::array<int, kCount> expected;
for (int& element : expected) {
element = -1;
}
EXPECT_THAT(actual, testing::ElementsAreArray(expected));
EXPECT_CALL(*destructorHook, Call(-1)).Times(kCount);
for (A* a = as; a != as + kCount; ++a) {
a->~A();
}
}
| C++ | 5 | Mu-L/kotlin | kotlin-native/runtime/src/main/cpp/AllocTest.cpp | [
"ECL-2.0",
"Apache-2.0"
] |
--TEST--
Bug #79468 SIGSEGV when closing stream handle with a stream filter appended
--SKIPIF--
<?php
$filters = stream_get_filters();
if(! in_array( "string.rot13", $filters )) die( "skip rot13 filter not available." );
?>
--FILE--
<?php
$fp = fopen('php://temp', 'rb');
$rot13_filter = stream_filter_append($fp, "string.rot13", STREAM_FILTER_WRITE);
fwrite($fp, "This is ");
fclose($fp);
try {
stream_filter_remove($rot13_filter);
} catch (\Throwable $e) {
var_dump($e->getMessage());
}
?>
--EXPECT--
string(79) "stream_filter_remove(): supplied resource is not a valid stream filter resource"
| PHP | 4 | NathanFreeman/php-src | ext/standard/tests/filters/bug79468.phpt | [
"PHP-3.01"
] |
9
4 0 1 4 5
4 1 2 5 6
4 2 3 6 7
4 4 5 8 9
4 5 6 9 10
4 6 7 10 11
4 8 9 12 13
4 9 10 13 14
4 10 11 14 15
| Rouge | 0 | aegelfand/GBP | GeneralizedBeliefPropagation/grid4x4.rg | [
"MIT"
] |
Definition build_vector {A: Set} (n: nat) := build_vector_aux n O (@nil A).
| Coq | 3 | LaudateCorpus1/RosettaCodeData | Task/Variadic-function/Coq/variadic-function-8.coq | [
"Info-ZIP"
] |
p, alice, data1, read, allow
p, data1_deny_group, data1, read, deny
p, data1_deny_group, data1, write, deny
p, alice, data1, write, allow
g, alice, data1_deny_group
p, data2_allow_group, data2, read, allow
p, bob, data2, read, deny
p, bob, data2, write, deny
g, bob, data2_allow_group | CSV | 2 | goodrain/pycasbin | examples/priority_policy.csv | [
"Apache-2.0"
] |
/**
* This file is part of the Phalcon Framework.
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/
namespace Phalcon\Db;
/**
* Interface for Phalcon\Db\Result objects
*/
interface ResultInterface
{
/**
* Moves internal resultset cursor to another position letting us to fetch a
* certain row
*/
public function dataSeek(int number);
/**
* Allows to execute the statement again. Some database systems don't
* support scrollable cursors. So, as cursors are forward only, we need to
* execute the cursor again to fetch rows from the beginning
*/
public function execute() -> bool;
/**
* Fetches an array/object of strings that corresponds to the fetched row,
* or FALSE if there are no more rows. This method is affected by the active
* fetch flag set using `Phalcon\Db\Result\Pdo::setFetchMode()`
*/
public function $fetch() -> var;
/**
* Returns an array of arrays containing all the records in the result. This
* method is affected by the active fetch flag set using
* `Phalcon\Db\Result\Pdo::setFetchMode()`
*/
public function fetchAll() -> array;
/**
* Returns an array of strings that corresponds to the fetched row, or FALSE
* if there are no more rows. This method is affected by the active fetch
* flag set using `Phalcon\Db\Result\Pdo::setFetchMode()`
*/
public function fetchArray() -> var;
/**
* Gets the internal PDO result object
*/
public function getInternalResult() -> <\PDOStatement>;
/**
* Gets number of rows returned by a resultset
*/
public function numRows() -> int;
/**
* Changes the fetching mode affecting Phalcon\Db\Result\Pdo::fetch()
*/
public function setFetchMode(int fetchMode) -> bool;
}
| Zephir | 5 | tidytrax/cphalcon | phalcon/Db/ResultInterface.zep | [
"BSD-3-Clause"
] |
(prn "Hello World")
| Clojure | 1 | PushpneetSingh/Hello-world | Clojure/Hello-World.clj | [
"MIT"
] |
/**
* This file is part of the Phalcon Framework.
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*
* Implementation of this file has been influenced by AtlasPHP
*
* @link https://github.com/atlasphp/Atlas.Pdo
* @license https://github.com/atlasphp/Atlas.Pdo/blob/1.x/LICENSE.md
*/
namespace Phalcon\DataMapper\Pdo\Profiler;
use Psr\Log\LoggerInterface;
/**
* Interface to send query profiles to a logger.
*/
interface ProfilerInterface
{
/**
* Finishes and logs a profile entry.
*
* @param string $statement
* @param array $values
*/
public function finish(string statement = null, array values = []) -> void;
/**
* Returns the underlying logger instance.
*
* @return LoggerInterface
*/
public function getLogger() -> <LoggerInterface>;
/**
* Returns the log message format string, with placeholders.
*
* @return string
*/
public function getLogFormat() -> string;
/**
* Returns the level at which to log profile messages.
*
* @return string
*/
public function getLogLevel() -> string;
/**
* Returns true if logging is active.
*
* @return bool
*/
public function isActive() -> bool;
/**
* Enable or disable profiler logging.
*
* @param bool $active
*
* @return ProfilerInterface
*/
public function setActive(bool active) -> <ProfilerInterface>;
/**
* Sets the log message format string, with placeholders.
*
* @param string $logFormat
*
* @return ProfilerInterface
*/
public function setLogFormat(string logFormat) -> <ProfilerInterface>;
/**
* Level at which to log profile messages.
*
* @param string $logLevel
*
* @return ProfilerInterface
*
*/
public function setLogLevel(string logLevel) -> <ProfilerInterface>;
/**
* Starts a profile entry.
*
* @param string $method
*/
public function start(string method) -> void;
}
| Zephir | 5 | tidytrax/cphalcon | phalcon/DataMapper/Pdo/Profiler/ProfilerInterface.zep | [
"BSD-3-Clause"
] |
set output "moduleSizePlotCombined.ps"
set terminal postscript
set style fill solid border -1
set boxwidth 0.5
set xrange [0:50]
set yrange [0:20000]
set ylabel "Size (KB)"
set title "Size distribution of 50 largest ITK Modules"
unset xtics
plot \
"./moduleSizeSortedNoThirdPartyBeta1Indexed.txt" using 1:2 with boxes fs solid 0.75 title "ITK Native", \
"./moduleSizeSortedNoThirdPartyBeta1Indexed.txt" using 1:2:4 with labels rotate by 90 font "Helvetica,8" left offset 0,0.5 notitle, \
"./moduleSizeSortedThirdPartyBeta1Indexed.txt" using 1:2 with boxes fs solid 0.25 title "Third Party", \
"./moduleSizeSortedThirdPartyBeta1Indexed.txt" using 1:2:4 with labels rotate by 90 font "Helvetica,8" left offset 0,0.5 notitle
| Gnuplot | 3 | melodylail/aosabook | v2/tex/images/itk/moduleSizePlotCombined.gnuplot | [
"CC-BY-3.0"
] |
/// <reference path="fourslash.ts" />
// @Filename: /project/tsconfig.json
////{
//// "compilerOptions": {
//// "jsx": "react",
//// "jsxFactory": "h"
//// }
////}
// @Filename: /project/app.tsx
////const state = useMemo(() => 'Hello', []);
// @Filename: /project/component.tsx
////import { useEffect } from "preact/hooks";
// @Filename: /project/node_modules/preact/package.json
////{ "name": "preact", "version": "10.3.4", "types": "src/index.d.ts" }
// @Filename: /project/node_modules/preact/hooks/package.json
////{ "name": "hooks", "version": "0.1.0", "types": "src/index.d.ts" }
// @Filename: /project/node_modules/preact/hooks/src/index.d.ts
////export function useEffect(): void;
////export function useMemo<T>(factory: () => T, inputs: ReadonlyArray<unknown> | undefined): T;
goTo.file("/project/app.tsx");
verify.importFixAtPosition([
getImportFixContent("preact/hooks"),
]);
function getImportFixContent(from: string) {
return `import { useMemo } from "${from}";
const state = useMemo(() => 'Hello', []);`;
}
| TypeScript | 4 | monciego/TypeScript | tests/cases/fourslash/importFixesWithPackageJsonInSideAnotherPackage.ts | [
"Apache-2.0"
] |
```{r echo=FALSE}
modules::import('./a')
```
| RMarkdown | 1 | pooranis/rmodules | tests/testthat/support/knitr/doc.rmd | [
"Apache-2.0"
] |
/*
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.reactive.server;
import java.net.URI;
import java.time.Duration;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.mock.http.client.reactive.MockClientHttpRequest;
import org.springframework.mock.http.client.reactive.MockClientHttpResponse;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.mockito.Mockito.mock;
/**
* Unit tests for {@link StatusAssertions}.
*
* @author Rossen Stoyanchev
*/
class StatusAssertionTests {
@Test
void isEqualTo() {
StatusAssertions assertions = statusAssertions(HttpStatus.CONFLICT);
// Success
assertions.isEqualTo(HttpStatus.CONFLICT);
assertions.isEqualTo(409);
// Wrong status
assertThatExceptionOfType(AssertionError.class).isThrownBy(() ->
assertions.isEqualTo(HttpStatus.REQUEST_TIMEOUT));
// Wrong status value
assertThatExceptionOfType(AssertionError.class).isThrownBy(() ->
assertions.isEqualTo(408));
}
@Test // gh-23630
void isEqualToWithCustomStatus() {
statusAssertions(600).isEqualTo(600);
}
@Test
void reasonEquals() {
StatusAssertions assertions = statusAssertions(HttpStatus.CONFLICT);
// Success
assertions.reasonEquals("Conflict");
// Wrong reason
assertThatExceptionOfType(AssertionError.class).isThrownBy(() ->
assertions.reasonEquals("Request Timeout"));
}
@Test
void statusSeries1xx() {
StatusAssertions assertions = statusAssertions(HttpStatus.CONTINUE);
// Success
assertions.is1xxInformational();
// Wrong series
assertThatExceptionOfType(AssertionError.class).isThrownBy(() ->
assertions.is2xxSuccessful());
}
@Test
void statusSeries2xx() {
StatusAssertions assertions = statusAssertions(HttpStatus.OK);
// Success
assertions.is2xxSuccessful();
// Wrong series
assertThatExceptionOfType(AssertionError.class).isThrownBy(() ->
assertions.is5xxServerError());
}
@Test
void statusSeries3xx() {
StatusAssertions assertions = statusAssertions(HttpStatus.PERMANENT_REDIRECT);
// Success
assertions.is3xxRedirection();
// Wrong series
assertThatExceptionOfType(AssertionError.class).isThrownBy(() ->
assertions.is2xxSuccessful());
}
@Test
void statusSeries4xx() {
StatusAssertions assertions = statusAssertions(HttpStatus.BAD_REQUEST);
// Success
assertions.is4xxClientError();
// Wrong series
assertThatExceptionOfType(AssertionError.class).isThrownBy(() ->
assertions.is2xxSuccessful());
}
@Test
void statusSeries5xx() {
StatusAssertions assertions = statusAssertions(HttpStatus.INTERNAL_SERVER_ERROR);
// Success
assertions.is5xxServerError();
// Wrong series
assertThatExceptionOfType(AssertionError.class).isThrownBy(() ->
assertions.is2xxSuccessful());
}
@Test
void matchesStatusValue() {
StatusAssertions assertions = statusAssertions(HttpStatus.CONFLICT);
// Success
assertions.value(equalTo(409));
assertions.value(greaterThan(400));
// Wrong status
assertThatExceptionOfType(AssertionError.class).isThrownBy(() ->
assertions.value(equalTo(200)));
}
@Test // gh-26658
void matchesCustomStatusValue() {
statusAssertions(600).value(equalTo(600));
}
private StatusAssertions statusAssertions(HttpStatus status) {
return statusAssertions(status.value());
}
private StatusAssertions statusAssertions(int status) {
MockClientHttpRequest request = new MockClientHttpRequest(HttpMethod.GET, URI.create("/"));
MockClientHttpResponse response = new MockClientHttpResponse(status);
ExchangeResult result = new ExchangeResult(
request, response, Mono.empty(), Mono.empty(), Duration.ZERO, null, null);
return new StatusAssertions(result, mock(WebTestClient.ResponseSpec.class));
}
}
| Java | 5 | spreoW/spring-framework | spring-test/src/test/java/org/springframework/test/web/reactive/server/StatusAssertionTests.java | [
"Apache-2.0"
] |
package com.alibaba.fastjson.validate;
import com.alibaba.fastjson.JSONValidator;
import junit.framework.TestCase;
import org.apache.commons.io.FileUtils;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.Reader;
public class JSONValidateTest_file extends TestCase
{
public void test_for_file() throws Exception {
for (int i = 0; i < 10; ++i) {
long start = System.currentTimeMillis();
File file = new File("/Users/wenshao/Downloads/000002_0.json");
FileInputStream is = new FileInputStream(file);
JSONValidator validator = JSONValidator.fromUtf8(is);
assertTrue(validator.validate());
validator.close();
// 642 335 796
System.out.println("millis " + (System.currentTimeMillis() - start));
}
}
public void test_for_file2() throws Exception {
File file = new File("/Users/wenshao/Downloads/000002_0.json");
byte[] bytes = FileUtils.readFileToByteArray(file);
for (int i = 0; i < 10; ++i) {
long start = System.currentTimeMillis();
ByteArrayInputStream is = new ByteArrayInputStream(bytes);
JSONValidator validator = JSONValidator.fromUtf8(is);
assertTrue(validator.validate());
validator.close();
// 642 335 796
System.out.println("millis " + (System.currentTimeMillis() - start));
}
}
public void test_for_fileReader() throws Exception {
for (int i = 0; i < 10; ++i) {
long start = System.currentTimeMillis();
File file = new File("/Users/wenshao/Downloads/000002_0.json");
Reader is = new InputStreamReader(new FileInputStream(file), "UTF8");
JSONValidator validator = JSONValidator.from(is);
assertTrue(validator.validate());
validator.close();
// 642 335 796
System.out.println("millis " + (System.currentTimeMillis() - start));
}
}
}
| Java | 4 | Czarek93/fastjson | src/test/java/com/alibaba/fastjson/validate/JSONValidateTest_file.java | [
"Apache-2.0"
] |
con
y = 10000
pub main
coginit(0, @entry, 0)
dat
org 0
entry
_gety
mov result1, imm_10000_
_gety_ret
ret
_userdef_spin_start
_userdef_spin_start_ret
ret
imm_10000_
long 10000
result1
long 0
COG_BSS_START
fit 496
org COG_BSS_START
fit 496
| Parrot Assembly | 2 | archivest/spin2cpp | Test/Expect/stest180.pasm | [
"MIT"
] |
{
// This file contains snippets that might be useful to you for Chrome
// development.
"Chrome Header": {
"prefix": "hdr",
"body": [
"// Copyright ${CURRENT_YEAR} 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.",
"${0:",
"#ifndef ${TM_FILEPATH/(^\\/.*\\/src\\/)|([^a-zA-Z0-9])|([a-zA-Z0-9])/${2:+_}${3:/upcase}/g}_",
"#define ${TM_FILEPATH/(^\\/.*\\/src\\/)|([^a-zA-Z0-9])|([a-zA-Z0-9])/${2:+_}${3:/upcase}/g}_",
"",
"#endif // ${TM_FILEPATH/(^\\/.*\\/src\\/)|([^a-zA-Z0-9])|([a-zA-Z0-9])/${2:+_}${3:/upcase}/g}_}",
]
},
"Chrome Copyright": {
"prefix": "copyright",
"body": [
"// Copyright ${CURRENT_YEAR} 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.",
]
},
"Chrome Log": {
"prefix": "log",
"body": "LOG(ERROR) << \"${1:message}\";",
"description": "Chrome Log output to console"
},
"Stack trace": {
"prefix": "st",
"body": "base::debug::StackTrace().Print();"
},
"Stack trace header": {
"prefix": "sth",
"body": "#include \"base/debug/stack_trace.h\""
}
}
| JSON5 | 3 | zealoussnow/chromium | tools/vscode/cpp.json5 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] |
<#setting url_escaping_charset='ISO-8859-1'>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>
<div class="main">
<#include "header.ftl" >
<div class="content">
${page_content}
</div>
<#include "footer.ftl" >
</div>
</body>
</html>
| FreeMarker | 3 | zeesh49/tutorials | java-lite/src/main/webapp/WEB-INF/views/layouts/default_layout.ftl | [
"MIT"
] |
import "std/test"
test.run("Non-existant import", fn(assert) {
assert.shouldThrow(fn() {
import './includes/_not_exist.ni'
})
})
test.run("Absolute import", fn(assert) {
import '../../testdata/math.ni'
assert.isTrue(isFunc(math.add))
assert.isEq(math.add(2, 4), 6)
})
| Inform 7 | 4 | lfkeitel/nitrogen | tests/imports/import_absolute.ni | [
"BSD-3-Clause"
] |
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# DEPRECATED
# Recent versions have begun deprecating this eclass.
# Do not use it in new series.
# @ECLASS: mysql_fx.eclass
# @MAINTAINER:
# - MySQL Team <[email protected]>
# - Luca Longinotti <[email protected]>
# @AUTHOR: Francesco Riosa (Retired) <[email protected]>
# @BLURB: This eclass provides some helper functions for mysql ebuilds
# @DESCRIPTION:
# This eclass providers helpers to build mysql servers including patching
# from an index and initializing certain variables as part of the build.
inherit multilib
# @FUNCTION: stripdots
# @DESCRIPTION:
# Helper function, version (integer) may have sections separated by dots
# for readability.
stripdots() {
local dotver=${1:-"0"}
local v=""
local ret=0
if [[ "${dotver/./}" != "${dotver}" ]] ; then
# dotted version number
for i in 1000000 10000 100 1 ; do
v=${dotver%%\.*}
# remove leading zeroes
while [[ ${#v} -gt 1 ]] && [[ ${v:0:1} == "0" ]] ; do v=${v#0} ; done
# increment integer version number
ret=$(( ${v} * ${i} + ${ret} ))
if [[ "${dotver}" == "${dotver/\.}" ]] ; then
dotver=0
else
dotver=${dotver#*\.}
fi
done
echo "${ret}"
else
# already an integer
v=${dotver}
while [[ ${#v} -gt 1 ]] && [[ ${v:0:1} == "0" ]] ; do v=${v#0} ; done
echo "${v}"
fi
}
# @FUNCTION: mysql_check_version_range
# @DESCRIPTION:
# Check if a version number falls inside a given range.
# The range includes the extremes and must be specified as
# "low_version to high_version" i.e. "4.1.2 to 5.1.99.99".
# Returns true if inside the range.
mysql_check_version_range() {
local lbound="${1%% to *}" ; lbound=$(stripdots "${lbound}")
local rbound="${1#* to }" ; rbound=$(stripdots "${rbound}")
local my_ver="${2:-"${MYSQL_VERSION_ID}"}"
[[ ${lbound} -le ${my_ver} ]] && [[ ${my_ver} -le ${rbound} ]] && return 0
return 1
}
# @FUNCTION: _mysql_test_patch_ver_pn
# @INTERNAL
# @DESCRIPTION:
# True if at least one applicable range is found for the patch.
_mysql_test_patch_ver_pn() {
local allelements=", version, package name"
# So that it fails the directory test if none of them exist
local filesdir="/dev/null"
for d in "${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}" \
"${WORKDIR}/mysql-extras" ; do
if [ -d "${d}" ]; then
filesdir="${d}"
break
fi
done
[[ -d "${filesdir}" ]] || die "Source dir must be a directory"
local flags=$1 pname=$2
if [[ $(( $flags & $(( 1 + 4 + 16 )) )) -eq 21 ]] ; then
einfo "using '${pname}'"
ln -sf "${filesdir}/${pname}" "${EPATCH_SOURCE}" || die "Couldn't move ${pname}"
return 0
fi
[[ $(( $flags & $(( 2 + 4 )) )) -gt 0 ]] \
&& allelements="${allelements//", version"}"
[[ $(( $flags & $(( 8 + 16 )) )) -gt 0 ]] \
&& allelements="${allelements//", package name"}"
[[ -n "${allelements}" ]] && [[ "${flags}" -gt 0 ]] \
&& ewarn "QA notice: ${allelements} missing in ${pname} patch"
return 1
}
# @FUNCTION: mysql_mv_patches
# @DESCRIPTION:
# Parse a "index_file" looking for patches to apply to the
# current MySQL version.
# If the patch applies, print its description.
#
mysql_mv_patches() {
# So that it fails the directory test if none of them exist
local filesdir="/dev/null"
if [[ -z "${1}" ]]; then
for d in "${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}" \
"${WORKDIR}/mysql-extras" ; do
if [ -d "${d}" ]; then
filesdir="${d}"
break
fi
done
[[ -d "${filesdir}" ]] || die "No patches directory found!"
fi
for i in "$1" "${filesdir}/0000_index.txt" "${filesdir}/000_index.txt" ; do
if [ -n "$i" -a -f "$i" ]; then
local index_file="$i"
break
fi
done
local my_ver="${2:-"${MYSQL_VERSION_ID}"}"
local my_test_fx=${3:-"_mysql_test_patch_ver_pn"}
_mysql_mv_patches "${index_file}" "${my_ver}" "${my_test_fx}"
}
# @FUNCTION: _mysql_mv_patches
# @INTERNAL
_mysql_mv_patches() {
local index_file="${1}"
local my_ver="${2}"
local my_test_fx="${3}"
local dsc ndsc=0 i
dsc=( )
# Values for flags are (2^x):
# 1 - one patch found
# 2 - at least one version range is wrong
# 4 - at least one version range is ok
# 8 - at least one ${PN} did not match
# 16 - at least one ${PN} has been matched
local flags=0 pname=""
while read row ; do
case "${row}" in
@patch\ *)
[[ -n "${pname}" ]] \
&& ${my_test_fx} ${flags} "${pname}" \
&& for (( i=0 ; $i < $ndsc ; i++ )) ; do einfo "> ${dsc[$i]}" ; done
flags=1 ; ndsc=0 ; dsc=( )
pname=${row#"@patch "}
;;
@ver\ *)
if mysql_check_version_range "${row#"@ver "}" "${my_ver}" ; then
flags=$(( ${flags} | 4 ))
else
flags=$(( ${flags} | 2 ))
fi
;;
@pn\ *)
if [[ ${row#"@pn "} == "${PN}" ]] ; then
flags=$(( ${flags} | 16 ))
else
flags=$(( ${flags} | 8 ))
fi
;;
# @use\ *) ;;
@@\ *)
dsc[$ndsc]="${row#"@@ "}"
(( ++ndsc ))
;;
esac
done < "${index_file}"
${my_test_fx} ${flags} "${pname}" \
&& for (( i=0 ; $i < $ndsc ; i++ )) ; do einfo "> ${dsc[$i]}" ; done
}
# @FUNCTION: mysql_version_is_at_least
# @DESCRIPTION:
# Is $2 (defaults to $MYSQL_VERSION_ID) at least version $1?
# (nice) idea from versionator.eclass
#
mysql_version_is_at_least() {
local want_s=$(stripdots "$1") have_s=$(stripdots "${2:-${MYSQL_VERSION_ID}}")
[[ -z "${want_s}" ]] && die "mysql_version_is_at_least missing value to check"
[[ ${want_s} -le ${have_s} ]] && return 0 || return 1
}
# @FUNCTION: mysql_lib_symlinks
# @DESCRIPTION:
# To be called on the live filesystem, reassigning symlinks of each MySQL
# library to the best version available. (Obsolete)
#
mysql_lib_symlinks() {
local d dirlist maxdots libname libnameln libsuffix reldir
libsuffix=$(get_libname)
einfo "libsuffix = ${libsuffix}"
einfo "Updating MySQL libraries symlinks"
reldir="${1}"
pushd "${reldir}/usr/$(get_libdir)" &> /dev/null
# dirlist must contain the less significative directory left
dirlist="mysql"
# waste some time in removing and recreating symlinks
for d in $dirlist ; do
for libname in $( find "${d}" -mindepth 1 -maxdepth 1 -name "*${libsuffix}*" -and -not -type "l" 2>/dev/null ) ; do
# maxdot is a limit versus infinite loop
maxdots=0
libnameln=${libname##*/}
# loop in version of the library to link it, similar to how
# libtool works
if [[ ${CHOST} == *-darwin* ]] ; then
# macho: libname.x.y.z.dylib
local libbasename=${libnameln%%.*} # libname
local libver=${libnameln#${libbasename}} # .x.y.z.dylib
libver=${libver%${libsuffix}} # .x.y.z
while [[ -n ${libver} ]] && [[ ${maxdots} -lt 6 ]] ; do
libnameln="${libbasename}${libver}${libsuffix}"
rm -f "${libnameln}"
ln -s "${libname}" "${libnameln}"
(( ++maxdots ))
libver=${libver%.*}
done
libnameln="${libbasename}${libsuffix}"
rm -f "${libnameln}"
ln -s "${libname}" "${libnameln}"
else
# elf: libname.so.x.y.z
while [[ ${libnameln:0-3} != '${libsuffix}' ]] && [[ ${maxdots} -lt 6 ]] ; do
rm -f "${libnameln}"
ln -s "${libname}" "${libnameln}"
(( ++maxdots ))
libnameln="${libnameln%.*}"
done
rm -f "${libnameln}"
ln -s "${libname}" "${libnameln}"
fi
done
done
popd &> /dev/null
}
# @FUNCTION: mysql_init_vars
# @DESCRIPTION:
# void mysql_init_vars()
# Initialize global variables
# 2005-11-19 <[email protected]>
mysql_init_vars() {
MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"}
MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
MY_INCLUDEDIR=${MY_INCLUDEDIR="${EPREFIX}/usr/include/mysql"}
MY_LIBDIR=${MY_LIBDIR="${EPREFIX}/usr/$(get_libdir)/mysql"}
if [[ -z "${MY_DATADIR}" ]] ; then
MY_DATADIR=""
if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
| sed -ne '/datadir/s|^--datadir=||p' \
| tail -n1`
if [[ -z "${MY_DATADIR}" ]] ; then
MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
| sed -e 's/.*=\s*//' \
| tail -n1`
fi
fi
if [[ -z "${MY_DATADIR}" ]] ; then
MY_DATADIR="${MY_LOCALSTATEDIR}"
einfo "Using default MY_DATADIR"
fi
elog "MySQL MY_DATADIR is ${MY_DATADIR}"
if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
if [[ -e "${MY_DATADIR}" ]] ; then
# If you get this and you're wondering about it, see bug #207636
elog "MySQL datadir found in ${MY_DATADIR}"
elog "A new one will not be created."
PREVIOUS_DATADIR="yes"
else
PREVIOUS_DATADIR="no"
fi
export PREVIOUS_DATADIR
fi
else
if [[ ${EBUILD_PHASE} == "config" ]]; then
local new_MY_DATADIR
new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
| sed -ne '/datadir/s|^--datadir=||p' \
| tail -n1`
if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
ewarn "MySQL MY_DATADIR has changed"
ewarn "from ${MY_DATADIR}"
ewarn "to ${new_MY_DATADIR}"
MY_DATADIR="${new_MY_DATADIR}"
fi
fi
fi
if [ "${MY_SOURCEDIR:-unset}" == "unset" ]; then
MY_SOURCEDIR=${SERVER_URI##*/}
MY_SOURCEDIR=${MY_SOURCEDIR%.tar*}
fi
export MY_SHAREDSTATEDIR MY_SYSCONFDIR
export MY_LIBDIR MY_LOCALSTATEDIR MY_LOGDIR
export MY_INCLUDEDIR MY_DATADIR MY_SOURCEDIR
}
| Gentoo Eclass | 4 | NighttimeDriver50000/Sabayon-Packages | local_overlay/eclass/mysql_fx.eclass | [
"MIT"
] |
set -ex
# sh /etc/init.d/xvfb start | Shell | 1 | stevepiercy/selenium | scripts/travis/before_script.sh | [
"Apache-2.0"
] |
/**
* @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
*/
declare global {
const ngJitMode: boolean;
}
// Make this an ES module to be able to augment the global scope
export {};
| TypeScript | 1 | raghavendramohan/angular | packages/core/src/util/ng_jit_mode.ts | [
"MIT"
] |
> module Main where
>
> import A
> import Other
>
> main = do
> print foo
> print bar
| Literate Haskell | 1 | cabalism/cabal | cabal-testsuite/PackageTests/ShowBuildInfo/Complex/app/Main.lhs | [
"BSD-3-Clause"
] |
/**
* This file is part of the Phalcon Framework.
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/
namespace Phalcon\Html\Link;
use Psr\Link\LinkInterface;
use Psr\Link\LinkProviderInterface;
/**
* @property LinkInterface[] links
*/
class LinkProvider implements LinkProviderInterface
{
/**
* @var LinkInterface[]
*/
protected links = [];
/**
* LinkProvider constructor.
*
* @param array links
*/
public function __construct(array links = [])
{
var link;
for link in links {
if link instanceof LinkInterface {
let this->links[this->getKey(link)] = link;
}
}
}
/**
* Returns an iterable of LinkInterface objects.
*
* The iterable may be an array or any PHP \Traversable object. If no links
* are available, an empty array or \Traversable MUST be returned.
*
* @return LinkInterface[]|\Traversable
*/
public function getLinks()
{
return this->links;
}
/**
* Returns an iterable of LinkInterface objects that have a specific
* relationship.
*
* The iterable may be an array or any PHP \Traversable object. If no links
* with that relationship are available, an empty array or \Traversable
* MUST be returned.
*
* @return LinkInterface[]|\Traversable
*/
public function getLinksByRel(var rel)
{
var link, links, rels;
let links = [];
for link in this->links {
let rels = link->getRels();
if true === in_array(rel, rels) {
let links[] = link;
}
}
return links;
}
/**
* Returns the object hash key
*
* @param LinkInterface link
*
* @return string
*/
protected function getKey(<LinkInterface> link) -> string
{
return spl_object_hash(link);
}
}
| Zephir | 4 | tidytrax/cphalcon | phalcon/Html/Link/LinkProvider.zep | [
"BSD-3-Clause"
] |
insert into Game (id, name) values (1, 'Game 1');
insert into Game (id, name) values (2, 'Game 2');
insert into Player (game_id, name, id) values (null, 'Player 1', 1);
insert into Player (game_id, name, id) values (null, 'Player 2', 2);
insert into Player (game_id, name, id) values (null, 'Player 3', 3); | SQL | 2 | DBatOWL/tutorials | persistence-modules/hibernate-jpa/src/main/resources/META-INF/data.sql | [
"MIT"
] |
"""
Prior to the resolution of issue 623, this would cause the gc to crash while
tracing SpeechOut from SpeechIn
"""
actor Main
new create(env: Env) =>
let talk = SpeechOut
let config = Config.create(talk)
SpeechIn.create(talk, config)
actor SpeechOut
new create() => None
actor SpeechIn
let talk: SpeechOut tag
new create(talk': SpeechOut, config: Config) =>
talk = config.talk
recover String(16000) end // trigger gc, happens around 14336
class val Config
let talk: SpeechOut tag
new val create(talk': SpeechOut tag) =>
talk = talk'
| Pony | 4 | presidentbeef/ponyc | minimal-cases/issue-623-2/623-2.pony | [
"BSD-2-Clause"
] |
$TTL 300
_dmarc IN TXT "v=DMARC1; p=reject; sp=reject; pct=100; rua=mailto:[email protected]; ruf=mailto:[email protected]; fo=1"
| DNS Zone | 2 | IT-Sumpfling/dnscontrol | pkg/js/parse_tests/016-backslash/foo.com.zone | [
"MIT"
] |
"A point with two coordinates."
shared class Point(x, y) {
// A comment.
shared Float x;
shared Float y;
}
| Ceylon | 3 | Kopilov/ceylon-ide-intellij | testdata/parsing/Class.ceylon | [
"Apache-2.0"
] |
role Encoding::Decoder {
method add-bytes(Blob:D $bytes --> Nil) { ... }
method consume-available-chars(--> Str:D) { ... }
method consume-all-chars(--> Str:D) { ... }
method consume-exactly-chars(int $chars, Bool:D :$eof = False --> Str) { ... }
method set-line-separators(@seps --> Nil) { ... }
method consume-line-chars(Bool:D :$chomp = False, Bool:D :$eof = False --> Str) { ... }
method is-empty(--> Bool) { ... }
method bytes-available(--> Int:D) { ... }
method consume-exactly-bytes(int $bytes --> Blob) { ... }
}
# vim: expandtab shiftwidth=4
| Perl6 | 3 | raydiak/rakudo | src/core.c/Encoding/Decoder.pm6 | [
"Artistic-2.0"
] |
use driver_arrays;
var x1: index(Dom1D);
var x2: index(Dom2D);
var x3: index(Dom3D);
var x4: index(Dom4D);
var x5: index(A1D.domain);
var x6: index(A2D.domain);
var x7: index(A3D.domain);
var x8: index(A4D.domain);
writeln(x1, " ", x1.type:string);
writeln(x2, " ", x2.type:string);
writeln(x3, " ", x3.type:string);
writeln(x4, " ", x4.type:string);
writeln(x5, " ", x5.type:string);
writeln(x6, " ", x6.type:string);
writeln(x7, " ", x7.type:string);
writeln(x8, " ", x8.type:string);
var x9: index(Dom2D32);
writeln(x9, " ", x9.type:string);
| Chapel | 3 | jhh67/chapel | test/distributions/robust/arithmetic/trivial/test_index_type.chpl | [
"ECL-2.0",
"Apache-2.0"
] |
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>Herman Melville - Moby-Dick</h1>
<div>
<p>
Availing himself of the mild, summer-cool weather that now reigned in these latitudes, and in preparation for the peculiarly active pursuits shortly to be anticipated, Perth, the begrimed, blistered old blacksmith, had not removed his portable forge to the hold again, after concluding his contributory work for Ahab's leg, but still retained it on deck, fast lashed to ringbolts by the foremast; being now almost incessantly invoked by the headsmen, and harpooneers, and bowsmen to do some little job for them; altering, or repairing, or new shaping their various weapons and boat furniture. Often he would be surrounded by an eager circle, all waiting to be served; holding boat-spades, pike-heads, harpoons, and lances, and jealously watching his every sooty movement, as he toiled. Nevertheless, this old man's was a patient hammer wielded by a patient arm. No murmur, no impatience, no petulance did come from him. Silent, slow, and solemn; bowing over still further his chronically broken back, he toiled away, as if toil were life itself, and the heavy beating of his hammer the heavy beating of his heart. And so it was.—Most miserable! A peculiar walk in this old man, a certain slight but painful appearing yawing in his gait, had at an early period of the voyage excited the curiosity of the mariners. And to the importunity of their persisted questionings he had finally given in; and so it came to pass that every one now knew the shameful story of his wretched fate. Belated, and not innocently, one bitter winter's midnight, on the road running between two country towns, the blacksmith half-stupidly felt the deadly numbness stealing over him, and sought refuge in a leaning, dilapidated barn. The issue was, the loss of the extremities of both feet. Out of this revelation, part by part, at last came out the four acts of the gladness, and the one long, and as yet uncatastrophied fifth act of the grief of his life's drama. He was an old man, who, at the age of nearly sixty, had postponedly encountered that thing in sorrow's technicals called ruin. He had been an artisan of famed excellence, and with plenty to do; owned a house and garden; embraced a youthful, daughter-like, loving wife, and three blithe, ruddy children; every Sunday went to a cheerful-looking church, planted in a grove. But one night, under cover of darkness, and further concealed in a most cunning disguisement, a desperate burglar slid into his happy home, and robbed them all of everything. And darker yet to tell, the blacksmith himself did ignorantly conduct this burglar into his family's heart. It was the Bottle Conjuror! Upon the opening of that fatal cork, forth flew the fiend, and shrivelled up his home. Now, for prudent, most wise, and economic reasons, the blacksmith's shop was in the basement of his dwelling, but with a separate entrance to it; so that always had the young and loving healthy wife listened with no unhappy nervousness, but with vigorous pleasure, to the stout ringing of her young-armed old husband's hammer; whose reverberations, muffled by passing through the floors and walls, came up to her, not unsweetly, in her nursery; and so, to stout Labor's iron lullaby, the blacksmith's infants were rocked to slumber. Oh, woe on woe! Oh, Death, why canst thou not sometimes be timely? Hadst thou taken this old blacksmith to thyself ere his full ruin came upon him, then had the young widow had a delicious grief, and her orphans a truly venerable, legendary sire to dream of in their after years; and all of them a care-killing competency.
</p>
</div>
</body>
</html>
| HTML | 2 | sonamsks/httpbin | httpbin/templates/moby.html | [
"ISC"
] |
"""Support for Fast.com internet speed testing sensor."""
from __future__ import annotations
from typing import Any
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import DATA_RATE_MEGABITS_PER_SECOND
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import DATA_UPDATED, DOMAIN as FASTDOTCOM_DOMAIN
ICON = "mdi:speedometer"
async def async_setup_platform(
hass: HomeAssistant,
config: ConfigType,
async_add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) -> None:
"""Set up the Fast.com sensor."""
async_add_entities([SpeedtestSensor(hass.data[FASTDOTCOM_DOMAIN])])
class SpeedtestSensor(RestoreEntity, SensorEntity):
"""Implementation of a FAst.com sensor."""
_attr_name = "Fast.com Download"
_attr_native_unit_of_measurement = DATA_RATE_MEGABITS_PER_SECOND
_attr_icon = ICON
_attr_should_poll = False
_attr_native_value = None
def __init__(self, speedtest_data: dict[str, Any]) -> None:
"""Initialize the sensor."""
self._speedtest_data = speedtest_data
async def async_added_to_hass(self) -> None:
"""Handle entity which will be added."""
await super().async_added_to_hass()
self.async_on_remove(
async_dispatcher_connect(
self.hass, DATA_UPDATED, self._schedule_immediate_update
)
)
if not (state := await self.async_get_last_state()):
return
self._attr_native_value = state.state
def update(self) -> None:
"""Get the latest data and update the states."""
if (data := self._speedtest_data.data) is None: # type: ignore[attr-defined]
return
self._attr_native_value = data["download"]
@callback
def _schedule_immediate_update(self) -> None:
self.async_schedule_update_ha_state(True)
| Python | 4 | MrDelik/core | homeassistant/components/fastdotcom/sensor.py | [
"Apache-2.0"
] |
# Authors: Robert Layton <[email protected]>
# Corey Lynch <[email protected]>
# License: BSD 3 clause
from libc.math cimport exp, lgamma
from scipy.special import gammaln
import numpy as np
cimport numpy as np
cimport cython
np.import_array()
ctypedef np.float64_t DOUBLE
def expected_mutual_information(contingency, int n_samples):
"""Calculate the expected mutual information for two labelings."""
cdef int R, C
cdef DOUBLE N, gln_N, emi, term2, term3, gln
cdef np.ndarray[DOUBLE] gln_a, gln_b, gln_Na, gln_Nb, gln_nij, log_Nnij
cdef np.ndarray[DOUBLE] nijs, term1
cdef np.ndarray[DOUBLE] log_a, log_b
cdef np.ndarray[np.int32_t] a, b
#cdef np.ndarray[int, ndim=2] start, end
R, C = contingency.shape
N = <DOUBLE>n_samples
a = np.ravel(contingency.sum(axis=1).astype(np.int32, copy=False))
b = np.ravel(contingency.sum(axis=0).astype(np.int32, copy=False))
# There are three major terms to the EMI equation, which are multiplied to
# and then summed over varying nij values.
# While nijs[0] will never be used, having it simplifies the indexing.
nijs = np.arange(0, max(np.max(a), np.max(b)) + 1, dtype='float')
nijs[0] = 1 # Stops divide by zero warnings. As its not used, no issue.
# term1 is nij / N
term1 = nijs / N
# term2 is log((N*nij) / (a * b)) == log(N * nij) - log(a * b)
log_a = np.log(a)
log_b = np.log(b)
# term2 uses log(N * nij) = log(N) + log(nij)
log_Nnij = np.log(N) + np.log(nijs)
# term3 is large, and involved many factorials. Calculate these in log
# space to stop overflows.
gln_a = gammaln(a + 1)
gln_b = gammaln(b + 1)
gln_Na = gammaln(N - a + 1)
gln_Nb = gammaln(N - b + 1)
gln_N = gammaln(N + 1)
gln_nij = gammaln(nijs + 1)
# start and end values for nij terms for each summation.
start = np.array([[v - N + w for w in b] for v in a], dtype='int')
start = np.maximum(start, 1)
end = np.minimum(np.resize(a, (C, R)).T, np.resize(b, (R, C))) + 1
# emi itself is a summation over the various values.
emi = 0.0
cdef Py_ssize_t i, j, nij
for i in range(R):
for j in range(C):
for nij in range(start[i,j], end[i,j]):
term2 = log_Nnij[nij] - log_a[i] - log_b[j]
# Numerators are positive, denominators are negative.
gln = (gln_a[i] + gln_b[j] + gln_Na[i] + gln_Nb[j]
- gln_N - gln_nij[nij] - lgamma(a[i] - nij + 1)
- lgamma(b[j] - nij + 1)
- lgamma(N - a[i] - b[j] + nij + 1))
term3 = exp(gln)
emi += (term1[nij] * term2 * term3)
return emi
| Cython | 5 | MaiRajborirug/scikit-learn | sklearn/metrics/cluster/_expected_mutual_info_fast.pyx | [
"BSD-3-Clause"
] |
/mob
see_invisible = 100
/world/view = 10
/mob/verb/spawn_lamp()
new/obj/lamp(loc)
/mob/verb/spawn_door()
new/obj/door(loc)
/mob/verb/change_turf_type(var/new_type as text)
var/turf/T = loc
T.change_turf(new_type)
| DM | 4 | PJB3005/GoonLight-Heist | ExampleProject/mob.dm | [
"MIT"
] |
#import <ATen/native/metal/mpscnn/MPSImage+Tensor.h>
@implementation MPSImage (Tensor)
- (std::vector<int64_t>)sizes {
int64_t N = self.numberOfImages;
int64_t C = self.featureChannels;
int64_t H = self.height;
int64_t W = self.width;
return {N, C, H, W};
}
- (BOOL)isTemporaryImage {
return [self isKindOfClass:[MPSTemporaryImage class]];
}
- (void)markRead {
if ([self isTemporaryImage]) {
MPSTemporaryImage* tmpImage = (MPSTemporaryImage*)self;
if (tmpImage.readCount > 0) {
tmpImage.readCount -= 1;
}
}
}
- (void)recycle {
if ([self isTemporaryImage]) {
MPSTemporaryImage* tmpImage = (MPSTemporaryImage*)self;
if (tmpImage.readCount > 0) {
tmpImage.readCount = 0;
}
}
}
- (int64_t)readCount {
if ([self isTemporaryImage]) {
MPSTemporaryImage* tmpImage = (MPSTemporaryImage*)self;
return (int64_t)tmpImage.readCount;
}
return -1;
}
@end
| Objective-C++ | 4 | Hacky-DH/pytorch | aten/src/ATen/native/metal/mpscnn/MPSImage+Tensor.mm | [
"Intel"
] |
/*
** Case Study Financial Econometrics 4.3
**
** Purpose:
** Estimate all Gaussian log-linear RealGARCH(1,1) model parameters (alpha, gamma, omega, xi, phi, tau_1, tau_2, sigma2_u and beta)
**
** Date:
** 17/01/2015
**
** Author:
** Tamer Dilaver, Koen de Man & Sina Zolnoor
**
** Supervisor:
** L.F. Hoogerheide & S.J. Koopman
**
*/
#include <oxstd.h>
#include <oxdraw.h>
#include <oxprob.h>
#include <maximize.h>
#import <modelbase>
#import <simula>
#include <oxfloat.h>
static decl iB; //Repeats
static decl iSIZE; //Size of time series
static decl iSTEPS; //#Steps to divide the size
static decl iSIMS; //# of Zt ~ N(0,1)
static decl dALPHA; //actually gamma in notes
static decl dBETA;
static decl dOMEGA;
static decl dGAMMA; //:=h_1
static decl dTAU_1;
static decl dTAU_2;
static decl dXI;
static decl dSIGMA2_U;
static decl dPHI; //denoted as \varphi in notes
static decl s_vY; //Simulated returns
static decl s_vX; //Simulated realized measure
static decl iSTD_ERROR; //0 or 1 binary
/*
** Function: Simulate Gaussian log-linear RealGARCH(1,1) returns for given parameters
**
** Input: dOmega, dBeta, dGamma, dXi, dPhi, dTau_1, dTau_2, dSigma2_u, avReturns, avRealMeasure [this is the realized measure]]
**
** Output: 1
**
*/
fSimLogRealGARCH(const dOmega, const dBeta, const dGamma, const dXi, const dPhi, const dTau_1, const dTau_2, const dSigma2_u, const avReturns, const avRealMeasure){
decl vTemp, vLogH, vLogX, dZ_Temp, dU_Temp;
vTemp = vLogH = vLogX = zeros(iSIZE+1, 1);
vLogH[0] = (dOmega +dGamma*dXi)/(1-dBeta-dPhi*dGamma); //by definition
for(decl i = 0; i < iSIZE; i++){
dZ_Temp = rann(1,1);
dU_Temp = rann(1,1);
vTemp[i] = sqrt(exp(vLogH[i]))*dZ_Temp;
vLogX[i] = dXi + dPhi*vLogH[i] + dTau_1*dZ_Temp + dTau_2*(dZ_Temp^2-1)+ sqrt(dSigma2_u)*dU_Temp;
vLogH[i+1] = dOmega + dBeta*vLogH[i]+ dGamma*vLogX[i];
}
vTemp = dropr(vTemp,iSIZE);
vLogX = dropr(vLogX,iSIZE);
avReturns[0] = vTemp;
avRealMeasure[0] = exp(vLogX);
return 1;
}
/*
** Function: Transform (start)parameters
**
** Input: vTheta [parametervalues]
**
** Output: vThetaStar
*/
fTransform(const avThetaStar, const vTheta){
avThetaStar[0]= vTheta;
avThetaStar[0][0] = vTheta[0];
avThetaStar[0][1] = log((vTheta[2]*vTheta[4])/(1-vTheta[2]*vTheta[4] - vTheta[1])); //aanpassen later
avThetaStar[0][2] = log((vTheta[1])/(1-vTheta[2]*vTheta[4] - vTheta[1])); //aanpassen later
avThetaStar[0][3] = vTheta[3];
avThetaStar[0][4] = log(vTheta[4]);
avThetaStar[0][5] = vTheta[5];
avThetaStar[0][6] = vTheta[6];
avThetaStar[0][7] = log(vTheta[7]);
return 1;
}
/*
** Function: Extract the parameters from vTheta
**
** Input: adOmega, adBeta, adGamma, adXi, adPhi, adTau_1, adTau_2, adSigma2_u, vTheta
** 0 1 2 3 4 5 6 7
** Output: 1
*/
fGetPars(const adOmega, const adBeta, const adGamma, const adXi, const adPhi, const adTau_1, const adTau_2, const adSigma2_u, const vTheta){
adOmega[0] = vTheta[0];
adBeta[0] = exp(vTheta[2])/(exp(vTheta[1])+exp(vTheta[2])+1);
adGamma[0] = exp(vTheta[1]-vTheta[4])/(exp(vTheta[1])+exp(vTheta[2])+1);
adXi[0] = vTheta[3];
adPhi[0] = exp(vTheta[4]);
adTau_1[0] = vTheta[5];
adTau_2[0] = vTheta[6];
adSigma2_u[0] = exp(vTheta[7]);
return 1;
}
/*
** Function: Calculates average value loglikelihood for log-linear Realized GARCH given parameter values
**
** Input: vTheta [parametervalues], adFunc [adres functievalue], avScore [the score], amHessian [hessianmatrix]
**
** Output: 1
**
*/
fLogLike_LogRealGARCH(const vTheta, const adFunc, const avScore, const amHessian){
decl dOmega, dBeta, dGamma, dXi, dPhi, dTau_1, dTau_2, dSigma2_u;
fGetPars(&dOmega, &dBeta, &dGamma, &dXi, &dPhi, &dTau_1, &dTau_2, &dSigma2_u, vTheta);
decl dlogH = (dOmega +dGamma*dXi)/(1-dBeta-dPhi*dGamma); //initialise with unconditional expectation of log conditional variance //initial condition by definition
decl vlogEta = zeros(sizerc(s_vY), 1);
for(decl i = 0; i < sizerc(s_vY); ++i){
//likelihood contribution
vlogEta[i] = 2*log(M_2PI) +dlogH + s_vY[i]^2 / exp(dlogH) + log(dSigma2_u) + (log(s_vX[i]) - dXi - dPhi*dlogH - dTau_1*s_vY[i]/sqrt(exp(dlogH)) - dTau_2*(s_vY[i]^2/exp(dlogH)-1))^2/dSigma2_u; //Gaussian
//log-linear Realized GARCH recursion
dlogH = dOmega + dBeta * dlogH + dGamma * log(s_vX[i]);
}
adFunc[0] = sumc(vlogEta)/(-2*sizerc(s_vY)); //Average
return 1;
}
/*
** Function: Transform parameters back
**
** Input: vThetaStar
**
** Output: vTheta [parametervalues]
*/
fTransformBack(const avTheta, const vThetaStar){
avTheta[0]= vThetaStar;
avTheta[0][0] = vThetaStar[0];
avTheta[0][1] = exp(vThetaStar[2])/(exp(vThetaStar[1])+exp(vThetaStar[2])+1);
avTheta[0][2] = exp(vThetaStar[1]-vThetaStar[4])/(exp(vThetaStar[1])+exp(vThetaStar[2])+1);
avTheta[0][3] = vThetaStar[3];
avTheta[0][4] = exp(vThetaStar[4]);
avTheta[0][5] = vThetaStar[5];
avTheta[0][6] = vThetaStar[6];
avTheta[0][7] = exp(vThetaStar[7]);
return 1;
}
/*
** Function: calculate standard errors
**
** Input: vThetaStar
**
** Output: vStdErrors
*/
fSigmaStdError(const vThetaStar){
decl iN, mHessian, mHess, mJacobian, vStdErrors, vP;
iN = sizerc(s_vY);
Num2Derivative(fLogLike_LogRealGARCH, vThetaStar, &mHessian);
NumJacobian(fTransformBack, vThetaStar, &mJacobian); //numerical Jacobian
mHessian = mJacobian*invert(-iN*mHessian)*mJacobian';
vStdErrors = sqrt(diagonal(mHessian)');
return vStdErrors;
}
/*
** Function: Estimate log-linear Realized GARCH parameters
**
** Input: vReturns, adAlpha_hat, adBeta_hat, adOmega_hat, adGamma_hat, adXi_hat, adPhi_hat, adTau_1_hat, adTau_2_hat, adSigma2_u_hat
**
** Output: vTheta [estimated parametervalues]
*/
fEstimateLogRealGARCH(const vReturns, const vRealMeasure, const adOmega_hat, const adBeta_hat, const adGamma_hat, const adXi_hat, const adPhi_hat, const adTau_1_hat, const adTau_2_hat, const adSigma2_u_hat){
//initialise parametervalues
decl vTheta = zeros(8,1);
vTheta = <0.2 ; 0.6 ; 0.4 ; -0.3 ; 0.8 ; -0.05 ; 0.10 ; 0.2>;
decl vThetaStart = vTheta;
//globalalize returns and vectorize true pars
s_vY = vReturns;
s_vX = vRealMeasure;
//transform parameters
decl vThetaStar;
fTransform(&vThetaStar, vTheta);
//Maximize the LL
decl dFunc;
decl iA;
iA=MaxBFGS(fLogLike_LogRealGARCH, &vThetaStar, &dFunc, 0, TRUE);
//Transform thetasStar back
fTransformBack(&vTheta, vThetaStar);
//return pars
adOmega_hat[0] = vTheta[0];
adBeta_hat[0] = vTheta[1];
adGamma_hat[0] = vTheta[2];
adXi_hat[0] = vTheta[3];
adPhi_hat[0] = vTheta[4];
adTau_1_hat[0] = vTheta[5];
adTau_2_hat[0] = vTheta[6];
adSigma2_u_hat[0] = vTheta[7];
if(iSTD_ERROR){ //only do this for fMonteCarlo2
decl vSigmaStdError = fSigmaStdError(vThetaStar);
return vSigmaStdError;
}else{
return 1;
}
}
/*
** Function: Simulates and Estimates log-linear Realized data and parameters many times
** to illustrate Asymptotic normality
**
** Input: amMonteCarlo [matrix of many estimated parameters];
**
** Output: 1
*/
fMonteCarlo(const amMonteCarlo){
decl mTemp;
mTemp = zeros(iB,8);
for(decl i = 0; i<iB ; i++){
decl vReturns, vRealMeasure;
fSimLogRealGARCH(dOMEGA, dBETA, dGAMMA, dXI, dPHI, dTAU_1, dTAU_2, dSIGMA2_U, &vReturns, &vRealMeasure);
decl dOmega_hat, dBeta_hat, dGamma_hat, dXi_hat, dPhi_hat, dTau_1_hat, dTau_2_hat, dSigma2_u_hat;
fEstimateLogRealGARCH(vReturns, vRealMeasure, &dOmega_hat, &dBeta_hat, &dGamma_hat, &dXi_hat, &dPhi_hat, &dTau_1_hat, &dTau_2_hat, &dSigma2_u_hat);
mTemp[i][0] = dOmega_hat;
mTemp[i][1] = dBeta_hat;
mTemp[i][2] = dGamma_hat;
mTemp[i][3] = dXi_hat;
mTemp[i][4] = dPhi_hat;
mTemp[i][5] = dTau_1_hat;
mTemp[i][6] = dTau_2_hat;
mTemp[i][7] = dSigma2_u_hat;
}
amMonteCarlo[0] = mTemp;
return 1;
}
/*
** Function: Simulated and Estimates log linear realized GARCH data and parameters many times
** to illustrate consistency it returns minimum, mean and maximum values for the estimated parameters
**
** Input: amOmega [matrix containing the min, max and mean of estimated omega],...
**
** Output: 1
*/
fMonteCarlo2(const amOmega, const amBeta, const amGamma, const amXi, const amPhi, const amTau_1, const amTau_2, const amSigma2_u, const amOmega2, const amBeta2, const amGamma2, const amXi2, const amPhi2, const amTau_12, const amTau_22, const amSigma2_u2){
decl mTemp, mTempOmega, mTempBeta, mTempGamma, mTempXi, mTempPhi, mTempTau_1, mTempTau_2, mTempSigma2_u;
decl mTemp2, mTempOmega2, mTempBeta2, mTempGamma2, mTempXi2, mTempPhi2, mTempTau_12, mTempTau_22, mTempSigma2_u2;
mTempOmega = mTempBeta = mTempGamma = mTempXi = mTempPhi = mTempTau_1 = mTempTau_2 = mTempSigma2_u = zeros((iSIZE/iSTEPS),3);
mTempOmega2 = mTempBeta2 = mTempGamma2 = mTempXi2 = mTempPhi2 = mTempTau_12 = mTempTau_22 = mTempSigma2_u2 = zeros((iSIZE/iSTEPS),3);
mTemp = mTemp2 = zeros(iB,8);
decl iSize = iSIZE;
for(decl j = 0; j<(iSize/iSTEPS) ; j++){
iSIZE = ((iSTEPS)*(j+1));
for(decl i = 0; i<iB ; i++){
decl vReturns, vRealMeasure;
fSimLogRealGARCH(dOMEGA, dBETA, dGAMMA, dXI, dPHI, dTAU_1, dTAU_2, dSIGMA2_U, &vReturns, &vRealMeasure);
decl dOmega_hat, dBeta_hat, dGamma_hat, dXi_hat, dPhi_hat, dTau_1_hat, dTau_2_hat, dSigma2_u_hat, vSE;
vSE = fEstimateLogRealGARCH(vReturns, vRealMeasure, &dOmega_hat, &dBeta_hat, &dGamma_hat, &dXi_hat, &dPhi_hat, &dTau_1_hat, &dTau_2_hat, &dSigma2_u_hat);
mTemp[i][0] = sqrt(iSIZE)*(dOmega_hat-dOMEGA);
mTemp[i][1] = sqrt(iSIZE)*(dBeta_hat-dBETA);
mTemp[i][2] = sqrt(iSIZE)*(dGamma_hat-dGAMMA);
mTemp[i][3] = sqrt(iSIZE)*(dXi_hat-dXI);
mTemp[i][4] = sqrt(iSIZE)*(dPhi_hat-dPHI);
mTemp[i][5] = sqrt(iSIZE)*(dTau_1_hat - dTAU_1);
mTemp[i][6] = sqrt(iSIZE)*(dTau_2_hat-dTAU_2);
mTemp[i][7] = sqrt(iSIZE)*(dSigma2_u_hat-dSIGMA2_U);
mTemp2[i][0] = (dOmega_hat-dOMEGA)/vSE[0];
mTemp2[i][1] = (dBeta_hat-dBETA)/vSE[1];
mTemp2[i][2] = (dGamma_hat-dGAMMA)/vSE[2];
mTemp2[i][3] = (dXi_hat-dXI)/vSE[3];
mTemp2[i][4] = (dPhi_hat-dPHI)/vSE[4];
mTemp2[i][5] = (dTau_1_hat - dTAU_1)/vSE[5];
mTemp2[i][6] = (dTau_2_hat-dTAU_2)/vSE[6];
mTemp2[i][7] = (dSigma2_u_hat-dSIGMA2_U)/vSE[7];
}
// v0.025_quantile, vMean, v0.975_quantile; We get 95%-intervals
mTempOmega[j][0] = quantilec(mTemp[][],0.025)'[0];
mTempOmega[j][1] = meanc(mTemp[][])'[0];
mTempOmega[j][2] = quantilec(mTemp[][],0.975)'[0];
mTempBeta[j][0] = quantilec(mTemp[][],0.025)'[1];
mTempBeta[j][1] = meanc(mTemp[][])'[1];
mTempBeta[j][2] = quantilec(mTemp[][],0.975)'[1];
mTempGamma[j][0] = quantilec(mTemp[][],0.025)'[2];
mTempGamma[j][1] = meanc(mTemp[][])'[2];
mTempGamma[j][2] = quantilec(mTemp[][],0.975)'[2];
mTempXi[j][0] = quantilec(mTemp[][],0.025)'[3];
mTempXi[j][1] = meanc(mTemp[][])'[3];
mTempXi[j][2] = quantilec(mTemp[][],0.975)'[3];
mTempPhi[j][0] = quantilec(mTemp[][],0.025)'[4];
mTempPhi[j][1] = meanc(mTemp[][])'[4];
mTempPhi[j][2] = quantilec(mTemp[][],0.975)'[4];
mTempTau_1[j][0] = quantilec(mTemp[][],0.025)'[5];
mTempTau_1[j][1] = meanc(mTemp[][])'[5];
mTempTau_1[j][2] = quantilec(mTemp[][],0.975)'[5];
mTempTau_2[j][0] = quantilec(mTemp[][],0.025)'[6];
mTempTau_2[j][1] = meanc(mTemp[][])'[6];
mTempTau_2[j][2] = quantilec(mTemp[][],0.975)'[6];
mTempSigma2_u[j][0] = quantilec(mTemp[][],0.025)'[7];
mTempSigma2_u[j][1] = meanc(mTemp[][])'[7];
mTempSigma2_u[j][2] = quantilec(mTemp[][],0.975)'[7];
// v0.025_quantile, v0.5_quantile, v0.975_quantile; We get 95%-intervals
mTempOmega2[j][0] = quantilec(mTemp2[][],0.025)'[0];
mTempOmega2[j][1] = quantilec(mTemp2[][],0.5)'[0];
mTempOmega2[j][2] = quantilec(mTemp2[][],0.975)'[0];
mTempBeta2[j][0] = quantilec(mTemp2[][],0.025)'[1];
mTempBeta2[j][1] = quantilec(mTemp2[][],0.5)'[1];
mTempBeta2[j][2] = quantilec(mTemp2[][],0.975)'[1];
mTempGamma2[j][0] = quantilec(mTemp2[][],0.025)'[2];
mTempGamma2[j][1] = quantilec(mTemp2[][],0.5)'[2];
mTempGamma2[j][2] = quantilec(mTemp2[][],0.975)'[2];
mTempXi2[j][0] = quantilec(mTemp2[][],0.025)'[3];
mTempXi2[j][1] = quantilec(mTemp2[][],0.5)'[3];
mTempXi2[j][2] = quantilec(mTemp2[][],0.975)'[3];
mTempPhi2[j][0] = quantilec(mTemp2[][],0.025)'[4];
mTempPhi2[j][1] = quantilec(mTemp2[][],0.5)'[4];
mTempPhi2[j][2] = quantilec(mTemp2[][],0.975)'[4];
mTempTau_12[j][0] = quantilec(mTemp2[][],0.025)'[5];
mTempTau_12[j][1] = quantilec(mTemp2[][],0.5)'[5];;
mTempTau_12[j][2] = quantilec(mTemp2[][],0.975)'[5];
mTempTau_22[j][0] = quantilec(mTemp2[][],0.025)'[6];
mTempTau_22[j][1] = quantilec(mTemp2[][],0.5)'[6];
mTempTau_22[j][2] = quantilec(mTemp2[][],0.975)'[6];
mTempSigma2_u2[j][0] = quantilec(mTemp2[][],0.025)'[7];
mTempSigma2_u2[j][1] = quantilec(mTemp2[][],0.5)'[7];
mTempSigma2_u2[j][2] = quantilec(mTemp2[][],0.975)'[7];
}
amOmega[0] = mTempOmega;
amBeta[0] = mTempBeta;
amGamma[0] = mTempGamma;
amXi[0] = mTempXi;
amPhi[0] = mTempPhi;
amTau_1[0] = mTempTau_1;
amTau_2[0] = mTempTau_2;
amSigma2_u[0] = mTempSigma2_u;
amOmega2[0] = mTempOmega2;
amBeta2[0] = mTempBeta2;
amGamma2[0] = mTempGamma2;
amXi2[0] = mTempXi2;
amPhi2[0] = mTempPhi2;
amTau_12[0] = mTempTau_12;
amTau_22[0] = mTempTau_22;
amSigma2_u2[0] = mTempSigma2_u2;
return 1;
}
/*
** MAIN PROGRAM
**
** Purpose: Simulate Log-linear Realized GARCH returns
** Estimate Log-linear Realized GARCH parameters
**
** Input: dOMEGA, dBETA, dGAMMA, dXI, dPHI, dTAU_1, dTAU_2, dSIGMA2_U, iB, iSIZE, iSIMS, iSTEPS
**
** Output: Figures
*/
main()
{
//we don't simulate the startparameter here (too much computation)
//we don't simulate the mean here (too much computation)
//SET PARAMETERS
dOMEGA = 0.2;
dBETA = 0.6;
dGAMMA = 0.4;
dXI = -0.3;
dPHI = 0.8;
dTAU_1 = -0.05;
dTAU_2 = 0.10;
dSIGMA2_U = 0.2;
/*
** ..................................................................................
** ASYMPTOTIC NORMALITY
**..................................................................................
*/
//SET # OF SIMULATIONS
iB = 500; //max 5000
iSIZE = 5000; //max 5000
iSIMS = iB*iSIZE;
iSTD_ERROR = 0;
//DO MANY SIMULATIONS AND ESITMATIONS
decl mMonteCarlo;
fMonteCarlo(&mMonteCarlo);
//DRAW GRAPHS
SetDrawWindow("CS_SIM_3_asymptotic normality");
DrawDensity(0, (mMonteCarlo[][0])', {"(i) Density omega"});
DrawDensity(1, (mMonteCarlo[][1])', {"(ii) Density beta"});
DrawDensity(2, (mMonteCarlo[][2])', {"(iii) Density gamma"});
DrawDensity(3, (mMonteCarlo[][3])', {"(iv) Density xi"});
DrawDensity(4, (mMonteCarlo[][4])', {"(v) Density phi"});
DrawDensity(5, (mMonteCarlo[][5])', {"(vi) Density tau_1"});
DrawDensity(6, (mMonteCarlo[][6])', {"(vii) Density tau_2"});
DrawDensity(7, (mMonteCarlo[][7])', {"(viii) Density sigma2_u"});
ShowDrawWindow();
print("\nFirst Graph Finished at ",time(),"\n");
/*
** ..................................................................................
** CONSISTENCY
** Check consistency for alpha and beta
** ..................................................................................
*/
//SET # OF SIMULATIONS
iB = 100; //100
iSIZE = 10000; //10000
iSIMS = iB*iSIZE;
iSTD_ERROR = 1;
//DO MANY SIMULATIONS AND ESITMATIONS
decl mOmega, mBeta, mGamma, mXi, mPhi, mTau_1, mTau_2, mSigma2_u, mOmega2, mBeta2, mGamma2, mXi2, mPhi2, mTau_12, mTau_22, mSigma2_u2;
iSTEPS = iSIZE/10; //steps of iSIZE/100 takes a while (steps of iSIZE/10 is faster)
fMonteCarlo2(&mOmega, &mBeta, &mGamma, &mXi, &mPhi, &mTau_1, &mTau_2, &mSigma2_u, &mOmega2, &mBeta2, &mGamma2, &mXi2, &mPhi2, &mTau_12, &mTau_22, &mSigma2_u2);
//DRAW GRAPHS
SetDrawWindow("CS_SIM_3_Consistency");
Draw(0, (mOmega)',iSTEPS,iSTEPS);
Draw(1, (mBeta)',iSTEPS,iSTEPS);
Draw(2, (mGamma)',iSTEPS,iSTEPS);
Draw(3, (mXi)',iSTEPS,iSTEPS);
Draw(4, (mPhi)',iSTEPS,iSTEPS);
Draw(5, (mTau_1)',iSTEPS,iSTEPS);
Draw(6, (mTau_2)',iSTEPS,iSTEPS);
Draw(7, (mSigma2_u)',iSTEPS,iSTEPS);
DrawTitle(0,"(i) omega");
DrawTitle(1,"(ii) beta");
DrawTitle(2,"(ii) gamma");
DrawTitle(3,"(iv) xi");
DrawTitle(4,"(v) phi");
DrawTitle(5,"(vi) tau_1");
DrawTitle(6,"(vii) tau_2");
DrawTitle(7,"(viii) sigma2_u");
ShowDrawWindow();
print("\nSecond Graph Finished at ",time(),"\n");
SetDrawWindow("CS_SIM_3_Check_Normality_Consistency");
Draw(0, mOmega2',iSTEPS,iSTEPS);
Draw(1, mBeta2',iSTEPS,iSTEPS);
Draw(2, mGamma2',iSTEPS,iSTEPS);
Draw(3, mXi2',iSTEPS,iSTEPS);
Draw(4, mPhi2',iSTEPS,iSTEPS);
Draw(5, mTau_12',iSTEPS,iSTEPS);
Draw(6, mTau_22',iSTEPS,iSTEPS);
Draw(7, mSigma2_u2',iSTEPS,iSTEPS);
DrawTitle(0,"(i) omega");
DrawTitle(1,"(ii) beta");
DrawTitle(2,"(ii) gamma");
DrawTitle(3,"(iv) xi");
DrawTitle(4,"(v) phi");
DrawTitle(5,"(vi) tau_1");
DrawTitle(6,"(vii) tau_2");
DrawTitle(7,"(viii) sigma2_u");
ShowDrawWindow();
print("\nThird Graph Finished at ",time(),"\n");
} | Ox | 5 | tamerdilaver/Group4_Code_Data | CS_SIM_3_log_linear_RealGARCH.ox | [
"MIT"
] |
// Copyright 2010-2012 RethinkDB, all rights reserved.
#include "unittest/gtest.hpp"
#include "http/http.hpp"
namespace unittest {
TEST(HTTPEscaping, HTTPEscaping) {
EXPECT_EQ("abc", percent_escaped_string("abc"));
EXPECT_EQ("Hello%2C%20world%21", percent_escaped_string("Hello, world!"));
std::string out;
EXPECT_TRUE(percent_unescape_string("Hello%2C%20world%21", &out));
EXPECT_EQ("Hello, world!", out);
out.clear();
EXPECT_FALSE(percent_unescape_string("%", &out));
EXPECT_EQ("", out);
EXPECT_FALSE(percent_unescape_string("%6y", &out));
EXPECT_EQ("", out);
EXPECT_FALSE(percent_unescape_string("!", &out));
EXPECT_EQ("", out);
}
}//namespace unittest
| C++ | 4 | zadcha/rethinkdb | src/unittest/http_escaping.cc | [
"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.
*/
#include "ABI42_0_0ImageManager.h"
#import <ABI42_0_0React/ABI42_0_0RCTImageLoaderWithAttributionProtocol.h>
#import <ABI42_0_0React/ABI42_0_0RCTUtils.h>
#import <ABI42_0_0React/utils/ManagedObjectWrapper.h>
#import "ABI42_0_0RCTImageManager.h"
#import "ABI42_0_0RCTSyncImageManager.h"
namespace ABI42_0_0facebook {
namespace ABI42_0_0React {
ImageManager::ImageManager(ContextContainer::Shared const &contextContainer)
{
id<ABI42_0_0RCTImageLoaderWithAttributionProtocol> imageLoader =
(id<ABI42_0_0RCTImageLoaderWithAttributionProtocol>)unwrapManagedObject(
contextContainer->at<std::shared_ptr<void>>("ABI42_0_0RCTImageLoader"));
if (ABI42_0_0RCTRunningInTestEnvironment()) {
self_ = (__bridge_retained void *)[[ABI42_0_0RCTSyncImageManager alloc] initWithImageLoader:imageLoader];
} else {
self_ = (__bridge_retained void *)[[ABI42_0_0RCTImageManager alloc] initWithImageLoader:imageLoader];
}
}
ImageManager::~ImageManager()
{
CFRelease(self_);
self_ = nullptr;
}
ImageRequest ImageManager::requestImage(const ImageSource &imageSource, SurfaceId surfaceId) const
{
ABI42_0_0RCTImageManager *imageManager = (__bridge ABI42_0_0RCTImageManager *)self_;
return [imageManager requestImage:imageSource surfaceId:surfaceId];
}
} // namespace ABI42_0_0React
} // namespace ABI42_0_0facebook
| Objective-C++ | 4 | zakharchenkoAndrii/expo | ios/versioned-react-native/ABI42_0_0/ReactNative/ReactCommon/fabric/imagemanager/platform/ios/ABI42_0_0ImageManager.mm | [
"Apache-2.0",
"MIT"
] |
f(x) = m*x+n
fit f(x) 'stats.csv' using 2:1 via m,n
set term png size 1920,1080
set output "stats_linear_plot.png"
set title "Time versus RLimit"
set xlabel "Time in seconds"
set xtics 2.5
set ylabel "RLimit"
set ytics 10000000
set grid
set timestamp
plot 'stats.csv' using 2:1 with points, f(x)
quit
| Gnuplot | 4 | SwampertX/FStar | .scripts/statistics_linear_plot.gnu | [
"Apache-2.0"
] |
CREATE TABLE `tb_zjdvakwwwv` (
`col_bytftanpdh` mediumint(56) unsigned DEFAULT '1',
`col_zwyhucxxkr` year(4) NOT NULL,
`col_desbhtchpe` text(3076914288) CHARACTER SET latin1,
`col_figelwsuqt` set('enum_or_set_0','enum_or_set_1','enum_or_set_2') CHARACTER SET latin1 DEFAULT 'enum_or_set_0',
UNIQUE `col_desbhtchpe` (`col_desbhtchpe`(5)),
UNIQUE `col_bytftanpdh` (`col_bytftanpdh`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
RENAME TABLE `tb_zjdvakwwwv` TO `tb_unztlaanoa`;
RENAME TABLE `tb_unztlaanoa` TO `tb_wxywfqcvkr`;
ALTER TABLE `tb_wxywfqcvkr` ADD COLUMN (`col_hikfliwljt` varchar(14), `col_vrnocgbjsc` mediumtext CHARACTER SET utf8);
ALTER TABLE `tb_wxywfqcvkr` ADD COLUMN (`col_gudluixdai` char, `col_adpuaqjrtd` numeric(22,2) NOT NULL);
ALTER TABLE `tb_wxywfqcvkr` ADD COLUMN `col_vjvhvsxmoi` bigint zerofill AFTER `col_desbhtchpe`;
ALTER TABLE `tb_wxywfqcvkr` ADD COLUMN (`col_whowxgsfzl` blob(1844532465), `col_mzdqafxiqx` bigint(161) unsigned DEFAULT '1');
ALTER TABLE `tb_wxywfqcvkr` ADD `col_spyfsutunk` bit DEFAULT b'0' AFTER `col_zwyhucxxkr`;
ALTER TABLE `tb_wxywfqcvkr` ADD `col_iqugcuomsl` numeric(9) NOT NULL;
ALTER TABLE `tb_wxywfqcvkr` ADD PRIMARY KEY (`col_zwyhucxxkr`,`col_adpuaqjrtd`);
ALTER TABLE `tb_wxywfqcvkr` CHANGE `col_zwyhucxxkr` `col_sixmujutpp` smallint zerofill NOT NULL AFTER `col_hikfliwljt`;
ALTER TABLE `tb_wxywfqcvkr` CHANGE COLUMN `col_hikfliwljt` `col_oftatmlkzc` set('enum_or_set_0','enum_or_set_1','enum_or_set_2') NOT NULL FIRST;
ALTER TABLE `tb_wxywfqcvkr` CHANGE COLUMN `col_spyfsutunk` `col_wwaeohiyto` timestamp FIRST;
ALTER TABLE `tb_wxywfqcvkr` DROP `col_adpuaqjrtd`;
ALTER TABLE `tb_wxywfqcvkr` DROP `col_iqugcuomsl`, DROP `col_sixmujutpp`;
ALTER TABLE `tb_wxywfqcvkr` DROP `col_vrnocgbjsc`;
ALTER TABLE `tb_wxywfqcvkr` DROP `col_wwaeohiyto`;
ALTER TABLE `tb_wxywfqcvkr` DROP `col_bytftanpdh`;
ALTER TABLE `tb_wxywfqcvkr` DROP `col_desbhtchpe`;
ALTER TABLE `tb_wxywfqcvkr` DROP COLUMN `col_gudluixdai`;
| SQL | 1 | yuanweikang2020/canal | parse/src/test/resources/ddl/alter/test_20.sql | [
"Apache-2.0"
] |
module Baz (baz) where
#include <zlib.h>
baz :: Int
baz = {# sizeof gz_header_s #}
| C2hs Haskell | 1 | ghuntley/rules_haskell | tests/c2hs/repo/Baz.chs | [
"Apache-2.0"
] |
plz foo with much n
rly n smaller 0
amaze 0
wow
amaze n
wow& | Dogescript | 0 | erinkeith/dogescript | test/spec/amaze/in-lambda/source.djs | [
"MIT"
] |
module top (input logic clock, ctrl);
logic read = 0, write = 0, ready = 0;
always @(posedge clock) begin
read <= !ctrl;
write <= ctrl;
ready <= write;
end
endmodule
module top_properties (input logic clock, read, write, ready);
a_rw: assert property ( @(posedge clock) !(read && write) );
`ifdef FAIL
a_wr: assert property ( @(posedge clock) write |-> ready );
`else
a_wr: assert property ( @(posedge clock) write |=> ready );
`endif
endmodule
bind top top_properties properties_inst (.*);
| SystemVerilog | 4 | kallisti5/yosys | tests/sva/basic02.sv | [
"ISC"
] |
namespace Ryujinx.HLE.HOS.Services.Audio
{
enum ResultCode
{
ModuleId = 153,
ErrorCodeShift = 9,
Success = 0,
DeviceNotFound = (1 << ErrorCodeShift) | ModuleId,
UnsupportedRevision = (2 << ErrorCodeShift) | ModuleId,
UnsupportedSampleRate = (3 << ErrorCodeShift) | ModuleId,
BufferSizeTooSmall = (4 << ErrorCodeShift) | ModuleId,
OpusInvalidInput = (6 << ErrorCodeShift) | ModuleId,
TooManyBuffersInUse = (8 << ErrorCodeShift) | ModuleId,
InvalidChannelCount = (10 << ErrorCodeShift) | ModuleId,
InvalidOperation = (513 << ErrorCodeShift) | ModuleId,
InvalidHandle = (1536 << ErrorCodeShift) | ModuleId,
OutputAlreadyStarted = (1540 << ErrorCodeShift) | ModuleId
}
}
| C# | 3 | BSoDGamingYT/Ryujinx | Ryujinx.HLE/HOS/Services/Audio/ResultCode.cs | [
"MIT"
] |
#layer::outline {
line-color: whitesmoke;
line-width: 10;
}
#layer::inline {
line-color: mintcream;
line-width: 5;
} | CartoCSS | 3 | nimix/carto | test/rendering-mss/basic_attachment_separate_double.mss | [
"Apache-2.0"
] |
namespace go common
struct A {
1: optional string a
}
| Thrift | 2 | Jimexist/thrift | lib/go/test/common/a.thrift | [
"Apache-2.0"
] |
a(k T, x1, x2, x3, x4, x5) ->
b = raw () -> T
if k <= 0 ? x4() + x5() : (b = () -> k -= 1; a k, b, x1, x2, x3, x4)()
say a 10, ()-> 1, ()-> -1, ()-> -1, ()-> 1, ()-> 0
| Ox | 3 | ozra/onyx-lang | samples/man-or-boy.ox | [
"Apache-2.0"
] |
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ILocalizationsService } from 'vs/platform/localizations/common/localizations';
import { registerSharedProcessRemoteService } from 'vs/platform/ipc/electron-sandbox/services';
registerSharedProcessRemoteService(ILocalizationsService, 'localizations', { supportsDelayedInstantiation: true });
| TypeScript | 4 | sbj42/vscode | src/vs/workbench/services/localizations/electron-sandbox/localizationsService.ts | [
"MIT"
] |
parser grammar CiscoNxos_ntp;
import CiscoNxos_common;
options {
tokenVocab = CiscoNxosLexer;
}
ntp_poll_interval
:
// 4-16
uint8
;
s_ntp
:
NTP
(
ntp_access_group
| ntp_authenticate
| ntp_authentication_key
| ntp_commit
| ntp_distribute
| ntp_peer
| ntp_server
| ntp_source_interface
)
;
ntp_access_group
:
ACCESS_GROUP
(
ntpag_match_all
| ntpag_peer
| ntpag_query_only
| ntpag_serve
| ntpag_serve_only
)
;
ntp_authenticate
:
AUTHENTICATE NEWLINE
;
ntp_authentication_key
:
AUTHENTICATION_KEY num = ntp_authentication_key_number MD5 md5 = md5_string md5_string_type? NEWLINE
;
md5_string_type
:
// 0 or 7
uint8
;
ntp_authentication_key_number
:
// 1-65535
uint16
;
ntpag_match_all
:
MATCH_ALL NEWLINE
;
ntpag_peer
:
PEER name = ip_access_list_name NEWLINE
;
ntpag_query_only
:
QUERY_ONLY name = ip_access_list_name NEWLINE
;
ntpag_serve
:
SERVE name = ip_access_list_name NEWLINE
;
ntpag_serve_only
:
SERVE_ONLY name = ip_access_list_name NEWLINE
;
ntp_commit
:
COMMIT NEWLINE
;
ntp_distribute
:
DISTRIBUTE NEWLINE
;
ntp_peer
:
PEER host = ntp_host NEWLINE
;
ntp_host
:
ip_address
| ipv6_address
| WORD
;
ntp_server
:
SERVER host = ntp_host
(
ntps_key
| ntps_maxpoll
| ntps_minpoll
| ntps_prefer
| ntps_use_vrf
)* NEWLINE
;
ntps_key
:
KEY ntp_authentication_key_number
;
ntps_maxpoll
:
MAXPOLL ntp_poll_interval
;
ntps_minpoll
:
MINPOLL ntp_poll_interval
;
ntps_prefer
:
PREFER
;
ntps_use_vrf
:
USE_VRF vrf = vrf_name
;
ntp_source_interface
:
SOURCE_INTERFACE name = interface_name NEWLINE
;
| ANTLR | 3 | zabrewer/batfish | projects/batfish/src/main/antlr4/org/batfish/grammar/cisco_nxos/CiscoNxos_ntp.g4 | [
"Apache-2.0"
] |
{
"type": "File",
"start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":26}},
"program": {
"type": "Program",
"start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":26}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ForOfStatement",
"start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}},
"await": false,
"left": {
"type": "VariableDeclaration",
"start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}},
"declarations": [
{
"type": "VariableDeclarator",
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}},
"id": {
"type": "Identifier",
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"},
"name": "x"
},
"init": null
}
],
"kind": "var"
},
"right": {
"type": "RegExpLiteral",
"start":14,"end":20,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":20}},
"extra": {
"raw": "/foo/g"
},
"pattern": "foo",
"flags": "g"
},
"body": {
"type": "EmptyStatement",
"start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22}}
}
},
{
"type": "ForStatement",
"start":24,"end":50,"loc":{"start":{"line":3,"column":0},"end":{"line":3,"column":26}},
"init": {
"type": "VariableDeclaration",
"start":29,"end":46,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":22}},
"declarations": [
{
"type": "VariableDeclarator",
"start":33,"end":46,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":22}},
"id": {
"type": "Identifier",
"start":33,"end":34,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"x"},
"name": "x"
},
"init": {
"type": "BinaryExpression",
"start":37,"end":46,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":22}},
"left": {
"type": "BinaryExpression",
"start":37,"end":44,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":20}},
"left": {
"type": "Identifier",
"start":37,"end":39,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":15},"identifierName":"of"},
"name": "of"
},
"operator": "/",
"right": {
"type": "Identifier",
"start":41,"end":44,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":20},"identifierName":"foo"},
"name": "foo"
}
},
"operator": "/",
"right": {
"type": "Identifier",
"start":45,"end":46,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":22},"identifierName":"g"},
"name": "g"
}
}
}
],
"kind": "var"
},
"test": null,
"update": null,
"body": {
"type": "EmptyStatement",
"start":49,"end":50,"loc":{"start":{"line":3,"column":25},"end":{"line":3,"column":26}}
}
}
],
"directives": []
}
} | JSON | 1 | fatash89/babel | packages/babel-parser/test/fixtures/es2015/for-of/right-regex/output.json | [
"MIT"
] |
@media (max-width: 1) {}
a {
// element.style */
}
| CSS | 1 | fuelingtheweb/prettier | tests/css_comments/trailing_star_slash.css | [
"MIT"
] |
# RUN: llc -O0 -run-pass=avr-expand-pseudo %s -o - | FileCheck %s
# TODO: Write this test.
# This instruction isn't expanded by the pseudo expansion passs, but
# rather AVRRegisterInfo::eliminateFrameIndex.
--- |
target triple = "avr--"
define void @test() {
entry:
ret void
}
...
---
name: test
registers:
- { id: 0, class: _ }
body: |
bb.0.entry:
; CHECK-LABEL: test
$r29r28 = FRMIDX $r31r30, 0, implicit-def $sreg
...
| Mirah | 3 | medismailben/llvm-project | llvm/test/CodeGen/AVR/pseudo/FRMIDX.mir | [
"Apache-2.0"
] |
module namespace ns1="ns1";
declare function ns1:test2() as xs:string {
"pkg2mod1"
}; | XQuery | 2 | JensErat/basex | basex-core/src/test/resources/repo/pkg2/pkg2/pkg2mod1.xql | [
"BSD-3-Clause"
] |
-- Copyright 2018 Stanford University
--
-- 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.
import "regent"
local c = regentlib.c
fspace Node
{
id : int64,
}
fspace Edge(r : region(ispace(int1d), Node))
{
source_node : int1d,
dest_node : int1d(Node, r),
}
task main()
var Num_Parts = 4
var Num_Elements = 20
var nodes = region(ispace(int1d, Num_Elements), Node)
var edges = region(ispace(int1d, Num_Elements - 1), Edge(nodes))
for i = 0, Num_Elements do
nodes[i].id = i
end
for j = 0, Num_Elements - 1 do
edges[j].source_node = [int1d](j)
edges[j].dest_node = dynamic_cast(int1d(Node, nodes), [int1d](j + 1))
end
var colors = ispace(int1d, Num_Parts)
var edge_partition = partition(equal, edges, colors)
for color in edge_partition.colors do
c.printf("Edge subregion %ld: ", color)
for e in edge_partition[color] do
c.printf("(%2ld, %2ld) ", nodes[e.source_node].id, e.dest_node.id)
end
c.printf("\n")
end
var node_partition = image(nodes, edge_partition, edges.source_node)
for color in node_partition.colors do
c.printf("Node subregion %ld: ", color)
for n in node_partition[color] do
c.printf("%2ld ", n.id)
end
c.printf("\n")
end
end
regentlib.start(main)
| Rouge | 4 | elliottslaughter/regent-tutorial | DependentPartitioning/x3.rg | [
"Apache-2.0"
] |
:::
6 /dev/rrp3: :::
:::
6 :::
:::
6 17379 mel :::
:::
6 16693 bwk me :::
:::
6 16116 ken him someone else :::
:::
6 15713 srb :::
:::
6 11895 lem :::
:::
6 10409 scj :::
:::
6 10252 rhm :::
:::
6 9853 shen :::
:::
6 9748 a68 :::
:::
6 9492 sif :::
:::
6 9190 pjw :::
:::
6 8912 nls :::
:::
6 8895 dmr :::
:::
6 8491 cda :::
:::
6 8372 bs :::
:::
6 8252 llc :::
:::
6 7450 mb :::
:::
6 7360 ava :::
:::
6 7273 jrv :::
:::
6 7080 bin :::
:::
6 7063 greg :::
:::
6 6567 dict :::
:::
6 6462 lck :::
:::
6 6291 rje :::
:::
6 6211 lwf :::
:::
6 5671 dave :::
:::
6 5373 jhc :::
:::
6 5220 agf :::
:::
6 5167 doug :::
:::
6 5007 valerie :::
:::
6 3963 jca :::
:::
6 3895 bbs :::
:::
6 3796 moh :::
:::
6 3481 xchar :::
:::
6 3200 tbl :::
:::
6 2845 s :::
:::
6 2774 tgs :::
:::
6 2641 met :::
:::
6 2566 jck :::
:::
6 2511 port :::
:::
6 2479 sue :::
:::
6 2127 root :::
:::
6 1989 bsb :::
:::
6 1989 jeg :::
:::
6 1933 eag :::
:::
6 1801 pdj :::
:::
6 1590 tpc :::
:::
6 1385 cvw :::
:::
6 1370 rwm :::
:::
6 1316 avg :::
:::
6 1205 eg :::
:::
6 1194 jam :::
:::
6 1153 dl :::
:::
6 1150 lgm :::
:::
6 1031 cmb :::
:::
6 1018 jwr :::
:::
6 950 gdb :::
:::
6 931 marc :::
:::
6 898 usg :::
:::
6 865 ggr :::
:::
6 822 daemon :::
:::
6 803 mihalis :::
:::
6 700 honey :::
:::
6 624 tad :::
:::
6 559 acs :::
:::
6 541 uucp :::
:::
6 523 raf :::
:::
6 495 adh :::
:::
6 456 kec :::
:::
6 414 craig :::
:::
6 386 donmac :::
:::
6 375 jj :::
:::
6 348 ravi :::
:::
6 344 drw :::
:::
6 327 stars :::
:::
6 288 mrg :::
:::
6 272 jcb :::
:::
6 263 ralph :::
:::
6 253 tom :::
:::
6 251 sjb :::
:::
6 248 haight :::
:::
6 224 sharon :::
:::
6 222 chuck :::
:::
6 213 dsj :::
:::
6 201 bill :::
:::
6 184 god :::
:::
6 176 sys :::
:::
6 166 meh :::
:::
6 163 jon :::
:::
6 144 dan :::
:::
6 143 fox :::
:::
6 123 dale :::
:::
6 116 kab :::
:::
6 95 buz :::
:::
6 80 asc :::
:::
6 79 jas :::
:::
6 79 trt :::
:::
6 64 wsb :::
:::
6 62 dwh :::
:::
6 56 ktf :::
:::
6 54 lr :::
:::
6 47 dlc :::
:::
6 45 dls :::
:::
6 45 jwf :::
:::
6 44 mash :::
:::
6 43 ars :::
:::
6 43 vgl :::
:::
6 37 jfo :::
:::
6 32 rab :::
:::
6 31 pd :::
:::
6 29 jns :::
:::
6 25 spm :::
:::
6 22 rob :::
:::
6 15 egb :::
:::
6 10 hm :::
:::
6 10 mhb :::
:::
6 6 aed :::
:::
6 6 cpb :::
:::
6 5 evp :::
:::
6 4 ber :::
:::
6 4 men :::
:::
6 4 mitch :::
:::
6 3 ast :::
:::
6 3 jfr :::
:::
6 3 lax :::
:::
6 3 nel :::
:::
6 2 blue :::
:::
6 2 jfk :::
:::
6 2 njas :::
:::
6 1 122sec :::
:::
6 1 ddwar :::
:::
6 1 gopi :::
:::
6 1 jk :::
:::
6 1 learn :::
:::
6 1 low :::
:::
6 1 nac :::
:::
6 1 sidor :::
:::
6 1root:EMpNB8Zp56:0:0:Super-User,,,,,,,:/:/bin/sh :::
:::
6 2roottcsh:*:0:0:Super-User running tcsh [cbm]:/:/bin/tcsh :::
:::
6 3sysadm:*:0:0:System V Administration:/usr/admin:/bin/sh :::
:::
6 4diag:*:0:996:Hardware Diagnostics:/usr/diags:/bin/csh :::
:::
6 5daemon:*:1:1:daemons:/:/bin/sh :::
:::
6 6bin:*:2:2:System Tools Owner:/bin:/dev/null :::
:::
6 7nuucp:BJnuQbAo:6:10:UUCP.Admin:/usr/spool/uucppublic:/usr/lib/uucp/uucico :::
:::
6 8uucp:*:3:5:UUCP.Admin:/usr/lib/uucp: :::
:::
6 9sys:*:4:0:System Activity Owner:/usr/adm:/bin/sh :::
:::
6 10adm:*:5:3:Accounting Files Owner:/usr/adm:/bin/sh :::
:::
6 11lp:*:9:9:Print Spooler Owner:/var/spool/lp:/bin/sh :::
:::
6 12auditor:*:11:0:Audit Activity Owner:/auditor:/bin/sh :::
:::
6 13dbadmin:*:12:0:Security Database Owner:/dbadmin:/bin/sh :::
:::
6 14bootes:dcon:50:1:Tom Killian (DO NOT REMOVE):/tmp: :::
:::
6 15cdjuke:dcon:51:1:Tom Killian (DO NOT REMOVE):/tmp: :::
:::
6 16rfindd:*:66:1:Rfind Daemon and Fsdump:/var/rfindd:/bin/sh :::
:::
6 17EZsetup:*:992:998:System Setup:/var/sysadmdesktop/EZsetup:/bin/csh :::
:::
6 18demos:*:993:997:Demonstration User:/usr/demos:/bin/csh :::
:::
6 19tutor:*:994:997:Tutorial User:/usr/tutor:/bin/csh :::
:::
6 20tour:*:995:997:IRIS Space Tour:/usr/people/tour:/bin/csh :::
:::
6 21guest:nfP4/Wpvio/Rw:998:998:Guest Account:/usr/people/guest:/bin/csh :::
:::
6 224Dgifts:0nWRTZsOMt.:999:998:4Dgifts Account:/usr/people/4Dgifts:/bin/csh :::
:::
6 23nobody:*:60001:60001:SVR4 nobody uid:/dev/null:/dev/null :::
:::
6 24noaccess:*:60002:60002:uid no access:/dev/null:/dev/null :::
:::
6 25nobody:*:-2:-2:original nobody uid:/dev/null:/dev/null :::
:::
6 26rje:*:8:8:RJE Owner:/usr/spool/rje: :::
:::
6 27changes:*:11:11:system change log:/: :::
:::
6 28dist:sorry:9999:4:file distributions:/v/adm/dist:/v/bin/sh :::
:::
6 29man:*:99:995:On-line Manual Owner:/: :::
:::
6 30phoneca:*:991:991:phone call log [tom]:/v/adm/log:/v/bin/sh :::
:::
8 1r oot EMpNB8Zp56 0 0 ::: / /bin/sh
:::
11 2r oottcsh * 0 0 ::: running tcsh [cbm] / /bin/tcsh
:::
10 3s ysadm * 0 0 ::: V Administration /usr/admin /bin/sh
:::
9 4d iag * 0 996 ::: Diagnostics /usr/diags /bin/csh
:::
8 5d aemon * 1 1 ::: / /bin/sh
:::
10 6b in * 2 2 ::: Tools Owner /bin /dev/null
:::
8 7n uucp BJnuQbAo 6 10 ::: /usr/spool/uucppublic /usr/lib/uucp/uucico
:::
7 8u ucp * 3 5 ::: /usr/lib/uucp
:::
10 9s ys * 4 0 ::: Activity Owner /usr/adm /bin/sh
:::
10 10 adm * 5 3 ::: Files Owner /usr/adm /bin/sh
:::
10 11 lp * 9 9 ::: Spooler Owner /var/spool/lp /bin/sh
:::
10 12 auditor * 11 0 ::: Activity Owner /auditor /bin/sh
:::
10 13 dbadmin * 12 0 ::: Database Owner /dbadmin /bin/sh
:::
11 14 bootes dcon 50 1 ::: Killian (DO NOT REMOVE) /tmp
:::
11 15 cdjuke dcon 51 1 ::: Killian (DO NOT REMOVE) /tmp
:::
11 16 rfindd * 66 1 ::: Daemon and Fsdump /var/rfindd /bin/sh
:::
9 17 EZsetup * 992 998 ::: Setup /var/sysadmdesktop/EZsetup /bin/csh
:::
9 18 demos * 993 997 ::: User /usr/demos /bin/csh
:::
9 19 tutor * 994 997 ::: User /usr/tutor /bin/csh
:::
10 20 tour * 995 997 ::: Space Tour /usr/people/tour /bin/csh
:::
9 21 guest nfP4/Wpvio/Rw 998 998 ::: Account /usr/people/guest /bin/csh
:::
9 22 4Dgifts 0nWRTZsOMt. 999 998 ::: Account /usr/people/4Dgifts /bin/csh
:::
10 23 nobody * 60001 60001 ::: nobody uid /dev/null /dev/null
:::
10 24 noaccess * 60002 60002 ::: no access /dev/null /dev/null
:::
10 25 nobody * -2 -2 ::: nobody uid /dev/null /dev/null
:::
8 26 rje * 8 8 ::: Owner /usr/spool/rje
:::
9 27 changes * 11 11 ::: change log /
:::
9 28 dist sorry 9999 4 ::: distributions /v/adm/dist /v/bin/sh
:::
9 29 man * 99 995 ::: Manual Owner /
:::
11 30 phoneca * 991 991 ::: call log [tom] /v/adm/log /v/bin/sh
| Logos | 0 | Crestwave/goawk | testdata/output/t.b.x | [
"MIT"
] |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0">
<title>xml文本预览</title>
<#include "*/commonHeader.ftl">
<link rel="stylesheet" href="css/xmlTreeViewer.css"/>
<script src="js/xmlTreeViewer.js" type="text/javascript"></script>
</head>
<body>
<input hidden id="textData" value="${textData}"/>
<div class="container">
<div class="panel panel-default">
<div id="xml_btn" class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
${file.name}
</a>
</h4>
</div>
<div id="text_btn" class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
${file.name}
</a>
</h4>
</div>
<div class="panel-body">
<div id="xml"></div>
</div>
</div>
</div>
<script>
/**
* 初始化
*/
window.onload = function () {
$("#xml_btn").hide()
initWaterMark();
loadXmlData()
}
/**
* 加载xml数据
*/
function loadXmlData() {
var textData = Base64.decode($("#textData").val())
window.textPreData = "<xmp style='background-color: #FFFFFF;overflow-y: scroll;border:none'>" + textData + "</xmp>";
var xmlNode = xmlTreeViewer.parseXML(textData);
window.retNode = xmlTreeViewer.getXMLViewerNode(xmlNode.xml);
$("#xml").html(window.retNode);
}
$(function () {
$("#xml_btn").click(function () {
$("#xml").html(window.retNode);
$("#text_btn").show()
$("#xml_btn").hide()
});
$("#text_btn").click(function () {
$("#xml_btn").show()
$("#text_btn").hide();
$("#xml").html(window.textPreData);
});
});
</script>
</body>
</html>
| FreeMarker | 4 | jerrykcode/kkFileView | server/src/main/resources/web/xml.ftl | [
"Apache-2.0"
] |
module.exports = {
experimental: {
images: {
remotePatterns: [{ hostname: 'image-optimization-test.vercel.app' }],
},
},
}
| JavaScript | 3 | nazarepiedady/next.js | test/integration/image-component/unicode/next.config.js | [
"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.compiler {
CompileContext,
CompilerMessageCategory
}
import java.io {
Writer
}
import java.lang {
CharArray,
Str=String
}
shared class MessageWriter(CompileContext context) extends Writer() {
write(CharArray cbuf, Integer off, Integer len)
=> context.addMessage(CompilerMessageCategory.information,
Str(cbuf, off, len).string, null, -1, -1);
shared actual void flush() {}
shared actual void close() {}
}
| Ceylon | 4 | Kopilov/ceylon-ide-intellij | source/org/eclipse/ceylon/ide/intellij/build/MessageWriter.ceylon | [
"Apache-2.0"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.