hexsha stringlengths 40 40 | size int64 5 1.05M | ext stringclasses 98
values | lang stringclasses 21
values | max_stars_repo_path stringlengths 3 945 | max_stars_repo_name stringlengths 4 118 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 368k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 3 945 | max_issues_repo_name stringlengths 4 118 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 134k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 945 | max_forks_repo_name stringlengths 4 135 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 5 1.05M | avg_line_length float64 1 1.03M | max_line_length int64 2 1.03M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
23e665bf2af9a3966e969da3963b2c502ee10ab2 | 2,427 | sql | SQL | _sql/init-oauth.sql | MRzhuyeye/IBaseCloud | 5f559ffca21dc2d451fd10d0fd4210a4657d9fc5 | [
"MIT"
] | 1 | 2020-03-21T03:12:54.000Z | 2020-03-21T03:12:54.000Z | _sql/init-oauth.sql | xing-jiajun/IBaseCloud | 5f559ffca21dc2d451fd10d0fd4210a4657d9fc5 | [
"MIT"
] | null | null | null | _sql/init-oauth.sql | xing-jiajun/IBaseCloud | 5f559ffca21dc2d451fd10d0fd4210a4657d9fc5 | [
"MIT"
] | null | null | null | # noinspection SqlNoDataSourceInspectionForFile
/*
Navicat Premium Data Transfer
Source Server : localhost-root
Source Server Type : MySQL
Source Server Version : 80018
Source Host : localhost:3306
Source Schema : ibasecloud_security
Target Server Type : MySQL
Target Server Version : 80018
File Encoding : 65001
Date: 18/03/2020 23:29:12
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for tb_role
-- ----------------------------
DROP TABLE IF EXISTS `tb_role`;
CREATE TABLE `tb_role`
(
`id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色名称',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci
ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for tb_user
-- ----------------------------
DROP TABLE IF EXISTS `tb_user`;
CREATE TABLE `tb_user`
(
`id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键',
`username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '账户',
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '密码',
`status` int(4) NOT NULL DEFAULT 0 COMMENT '用户状态(0正常、1禁用、99注销)',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci
ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of tb_user
-- ----------------------------
INSERT INTO `tb_user`
VALUES ('0', 'admin', '123', 0);
-- ----------------------------
-- Table structure for tb_user_role
-- ----------------------------
DROP TABLE IF EXISTS `tb_user_role`;
CREATE TABLE `tb_user_role`
(
`id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键',
`user_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户id(tb_user)',
`role_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色id(tb_role)',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci
ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
| 32.797297 | 125 | 0.63494 |
b0d0b4694b5670745aca8e4fc0247bd9a44f9317 | 20,383 | ps1 | PowerShell | Security/createAllForestDomainPermsReport.ps1 | IMULMUL/ADPoSh | 592f078b709410a88822b034e0c7acbb452f016b | [
"MIT"
] | 22 | 2019-11-11T07:41:08.000Z | 2022-03-28T14:40:42.000Z | Security/createAllForestDomainPermsReport.ps1 | IMULMUL/ADPoSh | 592f078b709410a88822b034e0c7acbb452f016b | [
"MIT"
] | 2 | 2018-07-23T14:52:36.000Z | 2018-11-13T02:31:31.000Z | Security/createAllForestDomainPermsReport.ps1 | chadmcox/ADPoSh | dd397ff85cf91bff8616a1791e319664ba8b4401 | [
"MIT"
] | 6 | 2018-07-03T12:17:24.000Z | 2019-08-30T02:56:52.000Z | #Requires -Module ActiveDirectory, GroupPolicy
#Requires -version 3.0
#Requires -RunAsAdministrator
<#PSScriptInfo
.VERSION 2021.5.19
.GUID 5e7bfd24-88b9-4e4d-99fd-c4ffbfcf5be6
.AUTHOR Chad.Cox@microsoft.com
https://blogs.technet.microsoft.com/chadcox/
https://github.com/chadmcox
.COMPANYNAME
.COPYRIGHT This Sample Code is provided for the purpose of illustration only and is not
intended to be used in a production environment. THIS SAMPLE CODE AND ANY
RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. We grant You a
nonexclusive, royalty-free right to use and modify the Sample Code and to
reproduce and distribute the object code form of the Sample Code, provided
that You agree: (i) to not use Our name, logo, or trademarks to market Your
software product in which the Sample Code is embedded; (ii) to include a valid
copyright notice on Your software product in which the Sample Code is embedded;
and (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and
against any claims or lawsuits, including attorneys` fees, that arise or result
from the use or distribution of the Sample Code..
.RELEASENOTES
.DESCRIPTION
this helps locate most permission end points and expands group membership
#>
Param($reportpath = "$env:userprofile\Documents")
cd $reportpath
function getAllDomains{
get-adforest | select -expandproperty domains -PipelineVariable domain | where {get-addomain -server $domain}
get-adforest | select -expandproperty domains -PipelineVariable domain | foreach {(get-adtrust -filter * -Server $domain).name} | where {try{get-addomain -server $_}catch{$false}}
}
function getAllPrivgroups{
param()
foreach($domain in $domains){
#try{get-adgroup -filter 'admincount -eq 1 -and iscriticalsystemobject -notlike "*"' `
# -server $domain -Properties * | select $hash_domain,distinguishedname,SamAccountName,objectSid,admincount,iscriticalsystemobject,Members}
# catch{write-host "error connecting to $domain" -ForegroundColor Red}
try{get-adgroup -filter '(admincount -eq 1 -and iscriticalsystemobject -like "*") -or samaccountname -eq "Cert Publishers"' `
-server $domain -Properties * | select $hash_domain,distinguishedname,SamAccountName,objectSid,admincount,iscriticalsystemobject, `
Members,@{name='RelationShip';expression={"Privileged Group Membership"}}}
catch{write-host "error connecting to $domain" -ForegroundColor Red}
try{get-adgroup -filter 'samaccountname -eq "Schema Admins" -or samaccountname -eq "Group Policy Creator Owners" -or samaccountname -eq "Key Admins" -or samaccountname -eq "Enterprise Key Admins" -or samaccountname -eq "Remote Desktop Users" -or samaccountname -eq "Cryptographic Operators"' `
-server $domain -Properties * | select $hash_domain,distinguishedname,SamAccountName,objectSid,admincount,iscriticalsystemobject, `
Members,@{name='RelationShip';expression={"Privileged Group Membership"}}}
catch{write-host "error connecting to $domain" -ForegroundColor Red}
try{get-adgroup -filter '(iscriticalsystemobject -like "*") -and (samaccountname -ne "Domain Users") -and (samaccountname -ne "Users") -and (samaccountname -ne "Domain Controllers")' `
-server $domain -Properties * | select $hash_domain,distinguishedname,SamAccountName,objectSid,admincount,iscriticalsystemobject, `
Members,@{name='RelationShip';expression={"Privileged Group Membership"}}}
catch{write-host "error connecting to $domain" -ForegroundColor Red}
}
if(test-path .\pgpo.tmp){
write-host "attempting: $($_.samaccountname)"
import-csv .\pgpo.tmp -pv perm | where {$_.objectClass -eq "Group"} | select domain, samaccountname -unique | foreach{
try{get-adgroup -identity $_.samaccountname -server $_.domain -Properties * | `
select @{name='Domain';expression={$perm.domain}},distinguishedname,SamAccountName,objectSid,admincount,iscriticalsystemobject, `
Members,@{name='RelationShip';expression={"GPO ACL Group Membership"}}}
catch{write-host "error connecting to $domain" -ForegroundColor Red}
}
}
if(test-path .\dacl.tmp){
import-csv .\dacl.tmp -pv perm | select domain, samaccountname -unique | foreach{
write-host "attempting: $($_.samaccountname)"
try{get-adgroup -identity $_.samaccountname -server $_.domain -Properties * | `
select @{name='Domain';expression={$perm.domain}},distinguishedname,SamAccountName,objectSid,admincount,iscriticalsystemobject, `
Members,@{name='RelationShip';expression={"AD ACL Group Membership"}}}
catch{write-host "error connecting to $domain" -ForegroundColor Red}
}
}
if(test-path .\dcura.tmp){
import-csv .\dcura.tmp -pv perm | select domain, samaccountname -unique | foreach{
write-host "attempting: $($_.samaccountname)"
try{get-adgroup -identity $_.samaccountname -server $_.domain -Properties * | `
select @{name='Domain';expression={$perm.domain}},distinguishedname,SamAccountName,objectSid,admincount,iscriticalsystemobject, `
Members,@{name='RelationShip';expression={"DC User Right Group Membership"}}}
catch{write-host "error connecting to $domain" -ForegroundColor Red}
}
}
}
function getschemaguids{
foreach($domain in $domains){
write-host "$domain"
try{Get-ADObject -SearchBase (Get-ADRootDSE -Server $domain).schemaNamingContext -LDAPFilter '(schemaIDGUID=*)' -Properties name, schemaIDGUID -server $domain | `
ForEach-Object {try{$global:schemaIDGUID.add([System.GUID]$_.schemaIDGUID,$_.name)}catch{}}}
catch{write-host "error connecting to $domain" -ForegroundColor Red}
try{Get-ADObject -SearchBase "CN=Extended-Rights,$((Get-ADRootDSE -Server $domain).configurationNamingContext)" -LDAPFilter '(objectClass=controlAccessRight)' `
-Properties name, rightsGUID -server $domain | `
ForEach-Object {try{$global:schemaIDGUID.add([System.GUID]$_.rightsGUID,$_.name)}catch{}}}
catch{write-host "error connecting to $domain" -ForegroundColor Red}
}
}
function getADPermissions{
param()
foreach($domain in $domains){
write-host "$domain"
try{Get-ADObject "CN=AdminSDHolder,$((get-addomain -Server $domain).SystemsContainer)" -server $domain -Properties "msds-approx-immed-subordinates",nTSecurityDescriptor -pv container | `
select DistinguishedName -ExpandProperty nTSecurityDescriptor | select @{name='Domain';expression={$domain}},distinguishedname -expandproperty access -pv perm }
catch{write-host "error connecting to $domain" -ForegroundColor Red}
try{Get-ADObject "$((get-addomain -Server $domain).DistinguishedName)" -server $domain -Properties "msds-approx-immed-subordinates",nTSecurityDescriptor -pv container | `
select DistinguishedName -ExpandProperty nTSecurityDescriptor | select @{name='Domain';expression={$domain}},distinguishedname -expandproperty access -pv perm }
catch{write-host "error connecting to $domain" -ForegroundColor Red}
try{Get-ADObject "$((get-addomain -Server $domain).DomainControllersContainer)" -server $domain -Properties "msds-approx-immed-subordinates",nTSecurityDescriptor -pv container | `
select DistinguishedName -ExpandProperty nTSecurityDescriptor | select @{name='Domain';expression={$domain}},distinguishedname -expandproperty access -pv perm }
catch{write-host "error connecting to $domain" -ForegroundColor Red}
Get-ADReplicationSite -filter * -server $domain -pv site | foreach{
try{Get-ADObject "$($site.DistinguishedName)" -server $domain -Properties "msds-approx-immed-subordinates",nTSecurityDescriptor -pv container | `
select DistinguishedName -ExpandProperty nTSecurityDescriptor | select @{name='Domain';expression={$domain}},distinguishedname -expandproperty access -pv perm }
catch{write-host "error connecting to $domain" -ForegroundColor Red}
}
}
}
function getADAcls{
getADPermissions | select @{name='ScopeDomain';expression={$_.domain}}, `
@{name='ScopeSAM';expression={if ($_.objectType.ToString() -eq '00000000-0000-0000-0000-000000000000') {'All'} Else {$global:schemaIDGUID.Item($_.objectType)}}}, `
@{name='ScopeDN';expression={$_.DistinguishedName}},@{name='ScopeSID';expression={}},@{name='RelationShip';expression={"ADPermission"}}, `
@{name='Domain';expression={if((($_.IdentityReference -split "\\").count -gt 1) -and (($_.IdentityReference -split "\\")[0] -notin "NT AUTHORITY","Everyone","BUILTIN")){($_.IdentityReference -split "\\")[0]}else{$_.domain}}}, @{name='distinguishedname';expression={}}, `
@{name='samAccountname';expression={if(($_.IdentityReference -split "\\").count -gt 1){($_.IdentityReference -split "\\")[1]}else{$_.IdentityReference}}}, `
objectClass, @{name='Permission';expression={$_.ActiveDirectoryRights}}
}
function getGpoPermissions{
foreach($domain in $domains){
write-host "$domain"
try{Get-GPO -all -domain $domain -Server $domain -pv gpo | foreach{
Get-GPPermissions -Name $gpo.DisplayName -all -DomainName $gpo.DomainName -server $gpo.domainname -pv gpp
} | select @{name='ScopeDomain';expression={$domain}}, `
@{name='ScopeSAM';expression={$gpo.DisplayName}},@{name='ScopeDN';expression={$gpo.path}}, `
@{name='ScopeSID';expression={}},@{name='RelationShip';expression={"GPOPermission"}}, `
@{name='Domain';expression={if($gpp.trustee.domain -eq "NT AUTHORITY"){$domain}else{$gpp.trustee.domain}}},distinguishedname, `
@{name='samAccountname';expression={$gpp.trustee.name}}, `
@{name='objectClass';expression={$gpp.trustee.SidType}},@{name='objectSid';expression={$gpp.trustee.sid}}, `
@{name='Permission';expression={$gpp.Permission}} | where {$_.permission -notin "gporead","gpoapply"}}
catch{write-host "error connecting to $domain" -ForegroundColor Red}
}
}
function getDCGPOURA{
foreach($domain in $domains){
get-adorganizationalunit "$((get-addomain -Server $domain).DomainControllersContainer)" -server $domain -Properties gplink | select -ExpandProperty gplink | foreach{
$_ -split "," | foreach{if($_ -match "[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}"){
#$matches[0]
[xml]$report = Get-GPOReport -guid $matches[0] -ReportType Xml -Domain $domain -ErrorAction SilentlyContinue
foreach($userright in ($report.GPO.Computer.extensiondata.extension.UserRightsAssignment)){
$userright | select -ExpandProperty member | foreach{
$_.name.'#text' | select @{name='ScopeDomain';expression={$domain}}, `
@{name='ScopeSAM';expression={$report.GPO.Name}},@{name='ScopeDN';expression={}}, `
@{name='ScopeSID';expression={$matches[0]}}, `
@{name='RelationShip';expression={"Domain Controller User Right Assignment"}}, `
@{name='Domain';expression={if((($_ -split "\\").count -gt 1) -and (($_ -split "\\")[0] -notin "NT AUTHORITY","Everyone","BUILTIN","NT SERVICE")){
($_ -split "\\")[0]}else{$domain}}}, distinguishedname , `
@{name='samAccountname';expression={if(($_ -split "\\").count -gt 1){($_ -split "\\")[1]}else{$_}}}, `
@{name='objectClass';expression={}},@{name='objectSid';expression={}}, `
@{name='Permission';expression={$userright.Name}}
}}}}}}}
function getsidhistory{
foreach($group in ($groups | select samaccountname, objectsid -Unique)){
$objsid = $null; $objsid = $group.objectsid.value
foreach($domain in $domains){
write-host "$domain"
try{get-adobject -filter {sidhistory -eq $objsid} -Properties * -server $domain | select @{name='ScopeDomain';expression={}}, `
@{name='ScopeSAM';expression={$group.SamAccountName}},@{name='ScopeDN';expression={}}, `
@{name='ScopeSID';expression={$group.objectsid}},@{name='RelationShip';expression={"SidHistory"}}, `
@{name='Domain';expression={$domain}},distinguishedname, samaccountname,ObjectClass,objectsid, `
@{name='enabled';expression={if($_.useraccountcontrol -band 2){$false}else{$true}}}}
catch{write-host "error connecting to $domain" -ForegroundColor Red}
}
}
import-csv .\pgm.tmp | select Domain,distinguishedname,samaccountname,objectsid -unique -pv obj | `
where {$_.objectsid -notin $groups.objectsid} | foreach{$objsid = $null; $objsid = $obj.objectsid
foreach($domain in $domains){
#write-host "looking for sid: $objsid in $domain"
try{get-adobject -filter {sidhistory -eq $objsid} -Properties * -server $domain | select @{name='ScopeDomain';expression={$obj.domain}}, `
@{name='ScopeSAM';expression={$obj.SamAccountName}},@{name='ScopeDN';expression={$obj.distinguishedname}}, `
@{name='ScopeSID';expression={$obj.objectsid}},@{name='RelationShip';expression={"SidHistory"}}, `
@{name='Domain';expression={$domain}},distinguishedname, samaccountname,ObjectClass,objectsid, `
@{name='enabled';expression={if($_.useraccountcontrol -band 2){$false}else{$true}}}}
catch{write-host "error connecting to $domain" -ForegroundColor Red}
}}
}
function getPrimaryGroup{
import-csv .\pgm.tmp | select Domain,distinguishedname,samaccountname,objectsid -unique -pv obj | foreach{
$rid = $null; $rid = ($obj.objectsid -split "-")[-1]
try{get-adobject -filter {primaryGroupID -eq $rid} -Properties * -server $obj.domain | select @{name='ScopeDomain';expression={$obj.domain}}, `
@{name='ScopeSAM';expression={$obj.SamAccountName}},@{name='ScopeDN';expression={$obj.distinguishedname}}, `
@{name='ScopeSID';expression={$obj.objectsid}},@{name='RelationShip';expression={"PrimaryGroup"}}, `
@{name='Domain';expression={$obj.domain}},distinguishedname, samaccountname,ObjectClass,objectsid, `
@{name='enabled';expression={if($_.useraccountcontrol -band 2){$false}else{$true}}}}
catch{write-host "error connecting to $domain" -ForegroundColor Red}
}
foreach($group in ($groups | select Domain,distinguishedname,samaccountname,objectsid -Unique)){
$objsid = $null; $objsid = $group.objectsid.value
foreach($domain in $domains){
#write-host "$domain"
try{get-adobject -filter {sidhistory -eq $objsid} -Properties * -server $domain | select @{name='ScopeDomain';expression={$group.Domain}}, `
@{name='ScopeSAM';expression={$group.SamAccountName}},@{name='ScopeDN';expression={$group.distinguishedname}}, `
@{name='ScopeSID';expression={$group.objectsid}},@{name='RelationShip';expression={"PrimaryGroup"}}, `
@{name='Domain';expression={$domain}},distinguishedname, samaccountname,ObjectClass,objectsid, `
@{name='enabled';expression={if($_.useraccountcontrol -band 2){$false}else{$true}}}}
catch{write-host "error connecting to $domain" -ForegroundColor Red}
}
}
}
function findObject{
param($odn, $domain)
#Write-Host "Starting $odn in $domain"
if(!($script:alreadyEnumerated.containskey($odn))){
$script:alreadyEnumerated.add($odn,$true)
$found_obj = try{get-adobject $odn -Properties * -server $domain | select @{name='Domain';expression={$domain}}, *}catch{}
for($i=0; $found_obj -eq $null ; $i++){
#write-host "looking in $($domains[$i]) for $odn"
$found_obj = try{get-adobject $odn -Properties * -server $domains[$i] | select @{name='Domain';expression={$domains[$i]}}, *}catch{}
}
if($found_obj.ObjectClass -eq "Group"){
write-host "Expanding: $($found_obj.samaccountname)"
$found_obj
$found_obj | select -ExpandProperty member | foreach{
findObject -odn $_ -domain $found_obj.domain
}
}else{$found_obj}
}
}
function expandGroups{
foreach($group in $groups){
$group | select -expandProperty members | foreach{
$script:alreadyEnumerated = @{}
findObject -odn $_ -domain $group.domain | select @{name='ScopeDomain';expression={$group.domain}}, `
@{name='ScopeSAM';expression={$group.SamAccountName}},@{name='ScopeDN';expression={$group.distinguishedname}}, `
@{name='ScopeSID';expression={$group.objectsid}},@{name='Relationship';expression={$group.RelationShip}}, `
domain,distinguishedname, samaccountname,ObjectClass,objectsid, `
@{name='enabled';expression={if($_.useraccountcontrol -band 2){$false}else{$true}}}, `
@{Name="pwdLastSet";
Expression={if($_.PwdLastSet -ne 0 -and $_.objectclass -eq "user"){([datetime]::FromFileTime($_.pwdLastSet).ToString('MM/dd/yyyy'))}}}, `
@{Name="PwdAgeinDays";
Expression={if($_.PwdLastSet -ne 0){(new-TimeSpan([datetime]::FromFileTimeUTC($_.PwdLastSet)) $(Get-Date)).days}else{0}}}, `
@{Name="LastLogonTimeStamp";
Expression={if($_.LastLogonTimeStamp -like "*"){if($_.objectclass -ne "group"){([datetime]::FromFileTime($_.LastLogonTimeStamp).ToString('MM/dd/yyyy'))}}}}, `
@{name='CannotBeDelegated';expression={if($_.useraccountcontrol -band 1048576){$true}}}, `
@{name='inProtectUsersGroup';expression={if($_.objectclass -eq "user"){isinProtectedUsers -udn $_.distinguishedname}}}, `
@{Name="PasswordNeverExpires";Expression={if($_.objectclass -ne "group"){if($_.UserAccountControl -band 65536){$True}else{$False}}}}, `
@{name='EncryptionType';expression={if($_.useraccountcontrol -band 2097152){"DES"}
else{if($_."msds-supportedencryptiontypes" -band 16){"AES256-HMAC"}
elseif($_."msds-supportedencryptiontypes" -band 8){"AES128-HMAC"}
else{if($_.objectclass -ne "group"){"RC4-HMAC"}}}}}
}
}
}
$hash_domain = @{name='Domain';expression={$domain}}
cls
write-host "Gathering all Domains in Forest and Trusted Domains"
$domains = getAllDomains | select -unique
write-host "Gathering GPO Permissions"
getGpoPermissions | export-csv .\pgpo.tmp -NoTypeInformation
write-host "Gathering GPO Settings"
getDCGPOURA | export-csv .\dcura.tmp -NoTypeInformation
write-host "Gathering Schema guids to translate AD Acls"
$global:schemaIDGUID = @{}
getSchemaGuids
write-host "Gathering Important AD ACLS"
getADAcls | export-csv .\dacl.tmp -NoTypeInformation
write-host "Gathering all Privileged Groups"
$groups = getAllPrivgroups | select * -unique
#$groups | export-csv .\gp.tmp -notypeinformation
write-host "Getting all Group Members"
expandGroups | export-csv .\pgm.tmp -notypeinformation
write-host "Looking for sid history"
getsidhistory | export-csv .\pgsid.tmp -NoTypeInformation
write-host "Looking for non domain user primary group assignment"
getPrimaryGroup | export-csv .\pgsp.tmp -NoTypeInformation
import-csv @(dir *.tmp) | select ScopeDomain,ScopeSAM,ScopeDN,ScopeSID,RelationShip,Domain,DistinguishedName,sAMAccountName,ObjectClass, `
objectSid,enabled,permission,pwdLastSet,PwdAgeinDays,LastLogonTimeStamp,CannotBeDelegated,inProtectUsersGroup,PasswordNeverExpires,EncryptionType | `
export-csv ".\ImportantADPermissions_$(get-date -Format yyyyMMdd).csv" -notypeinformation
dir *.tmp | Compress-Archive -DestinationPath ".\privileged_$(get-date -Format yyyyMMdd).zip" -force
dir *.tmp | remove-item -force
write-host "Report found here: $reportpath\ImportantADPermissions_$(get-date -Format yyyyMMdd).csv "
write-host "Archive here: $reportpath\privileged_$(get-date -Format yyyyMMdd).zip"
| 67.717608 | 301 | 0.675955 |
e3443032f928b0f7b95054505bdaec201ba8798c | 9,273 | dart | Dart | lib/icons_list.dart | nramirez/flutter_cupertino_icons | 4cbb013fe0fdaccaa3c5f52a0632956808b48553 | [
"MIT"
] | null | null | null | lib/icons_list.dart | nramirez/flutter_cupertino_icons | 4cbb013fe0fdaccaa3c5f52a0632956808b48553 | [
"MIT"
] | null | null | null | lib/icons_list.dart | nramirez/flutter_cupertino_icons | 4cbb013fe0fdaccaa3c5f52a0632956808b48553 | [
"MIT"
] | null | null | null | // I wish we could use reflection to get all the icons from CupertinoIcons, sadly
// dart:mirrors is not supported in flutter anymore see https://github.com/flutter/flutter/issues/1150
// and this is not feasible with the current version of reflectable https://github.com/google/reflectable.dart
// in the meantime the easiest is to have the list all all the icons
// with some selection kunfu we can easily build the list from https://api.flutter.dev/flutter/cupertino/CupertinoIcons-class.html
import 'package:flutter/cupertino.dart';
class IconRowData {
const IconRowData(this.name, this.icon);
final IconData icon;
final String name;
static List<IconRowData> search(String term) => IconRowData.allIcons
.where((element) => element.name.contains(term))
.toList();
static List<IconRowData> get allIcons {
return const [
IconRowData('left_chevron', CupertinoIcons.left_chevron),
IconRowData('right_chevron', CupertinoIcons.right_chevron),
IconRowData('share', CupertinoIcons.share),
IconRowData('share_solid', CupertinoIcons.share_solid),
IconRowData('book', CupertinoIcons.book),
IconRowData('book_solid', CupertinoIcons.book_solid),
IconRowData('bookmark', CupertinoIcons.bookmark),
IconRowData('bookmark_solid', CupertinoIcons.bookmark_solid),
IconRowData('info', CupertinoIcons.info),
IconRowData('reply', CupertinoIcons.reply),
IconRowData('conversation_bubble', CupertinoIcons.conversation_bubble),
IconRowData('profile_circled', CupertinoIcons.profile_circled),
IconRowData('plus_circled', CupertinoIcons.plus_circled),
IconRowData('minus_circled', CupertinoIcons.minus_circled),
IconRowData('flag', CupertinoIcons.flag),
IconRowData('search', CupertinoIcons.search),
IconRowData('check_mark', CupertinoIcons.check_mark),
IconRowData('check_mark_circled', CupertinoIcons.check_mark_circled),
IconRowData(
'check_mark_circled_solid', CupertinoIcons.check_mark_circled_solid),
IconRowData('circle', CupertinoIcons.circle),
IconRowData('circle_filled', CupertinoIcons.circle_filled),
IconRowData('back', CupertinoIcons.back),
IconRowData('forward', CupertinoIcons.forward),
IconRowData('home', CupertinoIcons.home),
IconRowData('shopping_cart', CupertinoIcons.shopping_cart),
IconRowData('ellipsis', CupertinoIcons.ellipsis),
IconRowData('phone', CupertinoIcons.phone),
IconRowData('phone_solid', CupertinoIcons.phone_solid),
IconRowData('down_arrow', CupertinoIcons.down_arrow),
IconRowData('up_arrow', CupertinoIcons.up_arrow),
IconRowData('battery_charging', CupertinoIcons.battery_charging),
IconRowData('battery_empty', CupertinoIcons.battery_empty),
IconRowData('battery_full', CupertinoIcons.battery_full),
IconRowData('battery_75_percent', CupertinoIcons.battery_75_percent),
IconRowData('battery_25_percent', CupertinoIcons.battery_25_percent),
IconRowData('bluetooth', CupertinoIcons.bluetooth),
IconRowData('restart', CupertinoIcons.restart),
IconRowData('reply_all', CupertinoIcons.reply_all),
IconRowData('reply_thick_solid', CupertinoIcons.reply_thick_solid),
IconRowData('share_up', CupertinoIcons.share_up),
IconRowData('shuffle', CupertinoIcons.shuffle),
IconRowData('shuffle_medium', CupertinoIcons.shuffle_medium),
IconRowData('shuffle_thick', CupertinoIcons.shuffle_thick),
IconRowData('photo_camera', CupertinoIcons.photo_camera),
IconRowData('photo_camera_solid', CupertinoIcons.photo_camera_solid),
IconRowData('video_camera', CupertinoIcons.video_camera),
IconRowData('video_camera_solid', CupertinoIcons.video_camera_solid),
IconRowData('switch_camera', CupertinoIcons.switch_camera),
IconRowData('switch_camera_solid', CupertinoIcons.switch_camera_solid),
IconRowData('collections', CupertinoIcons.collections),
IconRowData('collections_solid', CupertinoIcons.collections_solid),
IconRowData('folder', CupertinoIcons.folder),
IconRowData('folder_solid', CupertinoIcons.folder_solid),
IconRowData('folder_open', CupertinoIcons.folder_open),
IconRowData('delete', CupertinoIcons.delete),
IconRowData('delete_solid', CupertinoIcons.delete_solid),
IconRowData('delete_simple', CupertinoIcons.delete_simple),
IconRowData('pen', CupertinoIcons.pen),
IconRowData('pencil', CupertinoIcons.pencil),
IconRowData('create', CupertinoIcons.create),
IconRowData('create_solid', CupertinoIcons.create_solid),
IconRowData('refresh', CupertinoIcons.refresh),
IconRowData('refresh_circled', CupertinoIcons.refresh_circled),
IconRowData(
'refresh_circled_solid', CupertinoIcons.refresh_circled_solid),
IconRowData('refresh_thin', CupertinoIcons.refresh_thin),
IconRowData('refresh_thick', CupertinoIcons.refresh_thick),
IconRowData('refresh_bold', CupertinoIcons.refresh_bold),
IconRowData('clear_thick', CupertinoIcons.clear_thick),
IconRowData('clear_thick_circled', CupertinoIcons.clear_thick_circled),
IconRowData('clear', CupertinoIcons.clear),
IconRowData('clear_circled', CupertinoIcons.clear_circled),
IconRowData('clear_circled_solid', CupertinoIcons.clear_circled_solid),
IconRowData('add', CupertinoIcons.add),
IconRowData('add_circled', CupertinoIcons.add_circled),
IconRowData('add_circled_solid', CupertinoIcons.add_circled_solid),
IconRowData('gear', CupertinoIcons.gear),
IconRowData('gear_solid', CupertinoIcons.gear_solid),
IconRowData('gear_big', CupertinoIcons.gear_big),
IconRowData('settings', CupertinoIcons.settings),
IconRowData('settings_solid', CupertinoIcons.settings_solid),
IconRowData('music_note', CupertinoIcons.music_note),
IconRowData('double_music_note', CupertinoIcons.double_music_note),
IconRowData('play_arrow', CupertinoIcons.play_arrow),
IconRowData('play_arrow_solid', CupertinoIcons.play_arrow_solid),
IconRowData('pause', CupertinoIcons.pause),
IconRowData('pause_solid', CupertinoIcons.pause_solid),
IconRowData('loop', CupertinoIcons.loop),
IconRowData('loop_thick', CupertinoIcons.loop_thick),
IconRowData('volume_down', CupertinoIcons.volume_down),
IconRowData('volume_mute', CupertinoIcons.volume_mute),
IconRowData('volume_off', CupertinoIcons.volume_off),
IconRowData('volume_up', CupertinoIcons.volume_up),
IconRowData('fullscreen', CupertinoIcons.fullscreen),
IconRowData('fullscreen_exit', CupertinoIcons.fullscreen_exit),
IconRowData('mic_off', CupertinoIcons.mic_off),
IconRowData('mic', CupertinoIcons.mic),
IconRowData('mic_solid', CupertinoIcons.mic_solid),
IconRowData('clock', CupertinoIcons.clock),
IconRowData('clock_solid', CupertinoIcons.clock_solid),
IconRowData('time', CupertinoIcons.time),
IconRowData('time_solid', CupertinoIcons.time_solid),
IconRowData('padlock', CupertinoIcons.padlock),
IconRowData('padlock_solid', CupertinoIcons.padlock_solid),
IconRowData('eye', CupertinoIcons.eye),
IconRowData('eye_solid', CupertinoIcons.eye_solid),
IconRowData('person', CupertinoIcons.person),
IconRowData('person_solid', CupertinoIcons.person_solid),
IconRowData('person_add', CupertinoIcons.person_add),
IconRowData('person_add_solid', CupertinoIcons.person_add_solid),
IconRowData('group', CupertinoIcons.group),
IconRowData('group_solid', CupertinoIcons.group_solid),
IconRowData('mail', CupertinoIcons.mail),
IconRowData('mail_solid', CupertinoIcons.mail_solid),
IconRowData('location', CupertinoIcons.location),
IconRowData('location_solid', CupertinoIcons.location_solid),
IconRowData('tag', CupertinoIcons.tag),
IconRowData('tag_solid', CupertinoIcons.tag_solid),
IconRowData('tags', CupertinoIcons.tags),
IconRowData('tags_solid', CupertinoIcons.tags_solid),
IconRowData('bus', CupertinoIcons.bus),
IconRowData('car', CupertinoIcons.car),
IconRowData('car_detailed', CupertinoIcons.car_detailed),
IconRowData('train_style_one', CupertinoIcons.train_style_one),
IconRowData('train_style_two', CupertinoIcons.train_style_two),
IconRowData('paw', CupertinoIcons.paw),
IconRowData('paw_solid', CupertinoIcons.paw_solid),
IconRowData('game_controller', CupertinoIcons.game_controller),
IconRowData(
'game_controller_solid', CupertinoIcons.game_controller_solid),
IconRowData('lab_flask', CupertinoIcons.lab_flask),
IconRowData('lab_flask_solid', CupertinoIcons.lab_flask_solid),
IconRowData('heart', CupertinoIcons.heart),
IconRowData('heart_solid', CupertinoIcons.heart_solid),
IconRowData('bell', CupertinoIcons.bell),
IconRowData('bell_solid', CupertinoIcons.bell_solid),
IconRowData('news', CupertinoIcons.news),
IconRowData('news_solid', CupertinoIcons.news_solid),
IconRowData('brightness', CupertinoIcons.brightness),
IconRowData('brightness_solid', CupertinoIcons.brightness_solid),
];
}
}
| 56.889571 | 130 | 0.749703 |
7c4e4c4c6ee9297dc95f74e9f4344c3b2d786b27 | 761 | swift | Swift | Source/PIX/Effects/Merger/PIXMergerEffect.swift | jinjorge/pixels | 065fbab8aeca99c21170619da7eef28aec0cf369 | [
"MIT"
] | null | null | null | Source/PIX/Effects/Merger/PIXMergerEffect.swift | jinjorge/pixels | 065fbab8aeca99c21170619da7eef28aec0cf369 | [
"MIT"
] | null | null | null | Source/PIX/Effects/Merger/PIXMergerEffect.swift | jinjorge/pixels | 065fbab8aeca99c21170619da7eef28aec0cf369 | [
"MIT"
] | null | null | null | //
// PIXMergerEffect.swift
// Pixels
//
// Created by Hexagons on 2018-07-31.
// Copyright © 2018 Hexagons. All rights reserved.
//
import CoreGraphics
open class PIXMergerEffect: PIXEffect, PIXInMerger {
public var inPixA: (PIX & PIXOut)? { didSet { setNeedsConnect() } }
public var inPixB: (PIX & PIXOut)? { didSet { setNeedsConnect() } }
override var connectedIn: Bool { return pixInList.count == 2 }
public var fillMode: FillMode = .aspectFit { didSet { setNeedsRender() } }
// MARK: - Life Cycle
public override init() {
super.init()
}
required public init(from decoder: Decoder) throws {
super.init()
// fatalError("init(from:) has not been implemented")
}
}
| 24.548387 | 78 | 0.622865 |
83b2b41aa7b9e44733ef54bd3bb9ffc7f38d3e99 | 1,980 | ps1 | PowerShell | Tests/Unit/Private/Measure-FunctionTrapCatchCodePath.Tests.ps1 | livianaf/PSCodeHealth | b31bec45858b38e6f3890f99e65c2db81c824db2 | [
"MIT"
] | 113 | 2017-03-21T04:58:06.000Z | 2022-01-26T09:12:19.000Z | Tests/Unit/Private/Measure-FunctionTrapCatchCodePath.Tests.ps1 | livianaf/PSCodeHealth | b31bec45858b38e6f3890f99e65c2db81c824db2 | [
"MIT"
] | 28 | 2017-03-12T12:46:04.000Z | 2020-11-26T04:59:56.000Z | Tests/Unit/Private/Measure-FunctionTrapCatchCodePath.Tests.ps1 | livianaf/PSCodeHealth | b31bec45858b38e6f3890f99e65c2db81c824db2 | [
"MIT"
] | 23 | 2017-10-05T20:18:38.000Z | 2021-05-18T08:06:55.000Z | $ModuleName = 'PSCodeHealth'
Import-Module "$PSScriptRoot\..\..\..\$ModuleName\$($ModuleName).psd1" -Force
Describe 'Measure-FunctionTrapCatchCodePath' {
InModuleScope $ModuleName {
$Mocks = ConvertFrom-Json (Get-Content -Path "$($PSScriptRoot)\..\..\TestData\MockObjects.json" -Raw )
Context 'There is no Trap statement or Catch clause in the specified function' {
$FunctionText = ($Mocks.'Get-FunctionDefinition'.NoTrapOrCatch.Extent.Text | Out-String)
$ScriptBlock = [System.Management.Automation.Language.Parser]::ParseInput($FunctionText, [ref]$null, [ref]$null)
$FunctionDefinition = $ScriptBlock.FindAll({ $args[0] -is [System.Management.Automation.Language.FunctionDefinitionAst] }, $False)
$Result = Measure-FunctionTrapCatchCodePath -FunctionDefinition $FunctionDefinition[0]
It 'Should return an object of the type [System.Int32]' {
$Result | Should BeOfType [System.Int32]
}
It 'Should return the value 0' {
$Result | Should Be 0
}
}
Context 'There is a Trap statement and 4 Catch clauses in the specified function' {
$FunctionText = ($Mocks.'Get-FunctionDefinition'.TrapAndCatch.Extent.Text | Out-String)
$ScriptBlock = [System.Management.Automation.Language.Parser]::ParseInput($FunctionText, [ref]$null, [ref]$null)
$FunctionDefinition = $ScriptBlock.FindAll({ $args[0] -is [System.Management.Automation.Language.FunctionDefinitionAst] }, $False)
$Result = Measure-FunctionTrapCatchCodePath -FunctionDefinition $FunctionDefinition[0]
It 'Should return an object of the type [System.Int32]' {
$Result | Should BeOfType [System.Int32]
}
It 'Should count the Trap statement and every Catch clauses, including the nested one' {
$Result | Should Be 5
}
}
}
} | 50.769231 | 142 | 0.645455 |
fee0bcd661e1fa45e6a4fa36846824f1d90476b9 | 2,842 | html | HTML | pipermail/antlr-interest/2008-March/027467.html | hpcc-systems/website-antlr3 | aa6181595356409f8dc624e54715f56bd10707a8 | [
"BSD-3-Clause"
] | null | null | null | pipermail/antlr-interest/2008-March/027467.html | hpcc-systems/website-antlr3 | aa6181595356409f8dc624e54715f56bd10707a8 | [
"BSD-3-Clause"
] | null | null | null | pipermail/antlr-interest/2008-March/027467.html | hpcc-systems/website-antlr3 | aa6181595356409f8dc624e54715f56bd10707a8 | [
"BSD-3-Clause"
] | null | null | null | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [antlr-interest] catching custom exceptions thrown from actions
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:antlr-interest%40antlr.org?Subject=Re:%20%5Bantlr-interest%5D%20catching%20custom%20exceptions%20thrown%20from%20actions&In-Reply-To=%3C47ED395D.9090601%40web.de%3E">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="027470.html">
<LINK REL="Next" HREF="027469.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[antlr-interest] catching custom exceptions thrown from actions</H1>
<B>Felix Dorner</B>
<A HREF="mailto:antlr-interest%40antlr.org?Subject=Re:%20%5Bantlr-interest%5D%20catching%20custom%20exceptions%20thrown%20from%20actions&In-Reply-To=%3C47ED395D.9090601%40web.de%3E"
TITLE="[antlr-interest] catching custom exceptions thrown from actions">felix_do at web.de
</A><BR>
<I>Fri Mar 28 11:30:53 PDT 2008</I>
<P><UL>
<LI>Previous message: <A HREF="027470.html">[antlr-interest] accessing parent attributes
</A></li>
<LI>Next message: <A HREF="027469.html">[antlr-interest] JavaScript grammar
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#27467">[ date ]</a>
<a href="thread.html#27467">[ thread ]</a>
<a href="subject.html#27467">[ subject ]</a>
<a href="author.html#27467">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Hey,
when one of the methods called in an Action throws an Exception, I catch
this with
..
;
catch [MyCustomException]{...}
but then the usually inserted
catch (RecognitionException e)
..
}
gets lost. So every time I catch a custom Exception do I also need to
insert a catch for the RecognitionException, if I want to preserve the
default behavior:
catch[MyCustomException e] { ... }
catch[RecognitionException e] { //manually insert what antlr would
otherwise do himself???; }
I'm lost..
Felix
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="027470.html">[antlr-interest] accessing parent attributes
</A></li>
<LI>Next message: <A HREF="027469.html">[antlr-interest] JavaScript grammar
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#27467">[ date ]</a>
<a href="thread.html#27467">[ thread ]</a>
<a href="subject.html#27467">[ subject ]</a>
<a href="author.html#27467">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://www.antlr.org/mailman/listinfo/antlr-interest">More information about the antlr-interest
mailing list</a><br>
</body></html>
| 30.234043 | 199 | 0.642857 |
4bbcd1ef203ce8ef893e007f2cecdf12e99ef736 | 1,185 | swift | Swift | LeetCode-0003.playground/Pages/Method 1 Page.xcplaygroundpage/Contents.swift | mizu-bai/LeetCode-Notes | cf2a7bea48d70452a60a2f8ddd3ab469f9f2dcbb | [
"BSD-2-Clause"
] | 1 | 2021-06-27T12:01:53.000Z | 2021-06-27T12:01:53.000Z | LeetCode-0003.playground/Pages/Method 1 Page.xcplaygroundpage/Contents.swift | mizu-bai/LeetCode-Notes | cf2a7bea48d70452a60a2f8ddd3ab469f9f2dcbb | [
"BSD-2-Clause"
] | null | null | null | LeetCode-0003.playground/Pages/Method 1 Page.xcplaygroundpage/Contents.swift | mizu-bai/LeetCode-Notes | cf2a7bea48d70452a60a2f8ddd3ab469f9f2dcbb | [
"BSD-2-Clause"
] | null | null | null | //: [Previous](@previous)
/*:
# 滑动窗口(双指针)
1. 我们使用两个指针表示字符串中的某个子串(或窗口)的左右边界,其中左指针代表着「枚举子串的起始位置」,而右指针即为「枚举子串的结束位置」
2. 在每一步的操作中,将左指针向右移动一格,表示__开始枚举下一个字符作为起始位置__,然后不断地向右移动右指针,但需要保证这两个指针对应的子串中没有重复的字符。在移动结束后,这个子串就对应着__以左指针开始的,不包含重复字符的最长子串__。记录下这个子串的长度;
3. 在枚举结束后,找到的最长的子串的长度即为答案。
作者:LeetCode-Solution
链接:https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/solution/wu-zhong-fu-zi-fu-de-zui-chang-zi-chuan-by-leetc-2/
来源:力扣(LeetCode)
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
*/
class Solution {
func lengthOfLongestSubstring(_ s: String) -> Int {
var result = 0
// 使用 dict 存储子串中的字符,确保不重复
var dict = [Character: Int]()
// 子串起始
var start = 0
for (index, char) in s.enumerated() {
// 字典中不存在 char 时,preIndex = -1,永远小于 start
let preIndex = dict[char] ?? -1
if preIndex >= start {
// 存在重复字符,重新选取 start
start = preIndex + 1
}
let length = index - start + 1
result = max(result, length)
// 记录字符 char 在字符串中上次出现的索引 index
dict[char] = index
}
return result
}
}
| 28.902439 | 144 | 0.612658 |
d26fb3f6143af25c89ac7abf02dbda7cc4258129 | 1,101 | kt | Kotlin | core/src/main/java/com/bottle/core/arch/density/AutoDensityConfig.kt | Hbottle/AutoDensity | ce5781c6ca65b4b453309f10614be37d63ed8d26 | [
"Apache-2.0"
] | 3 | 2020-07-17T08:50:51.000Z | 2021-12-10T06:40:50.000Z | core/src/main/java/com/bottle/core/arch/density/AutoDensityConfig.kt | Hbottle/AutoDensity | ce5781c6ca65b4b453309f10614be37d63ed8d26 | [
"Apache-2.0"
] | null | null | null | core/src/main/java/com/bottle/core/arch/density/AutoDensityConfig.kt | Hbottle/AutoDensity | ce5781c6ca65b4b453309f10614be37d63ed8d26 | [
"Apache-2.0"
] | null | null | null | package com.bottle.core.arch.density
import android.app.Application
/**
* @Date: 2020/4/20
* @Author: hugo
* @Description: 全局的配置
*/
class AutoDensityConfig(application: Application, designDraft: DesignDraft) {
var isEnableAutoDensity = true // 是否启用适配,如果否,则不适配,可以应急
var isEnableCustomAdapt = true // 是否允许Activity自定义设计稿大小,如果否则使用全局的配置
var isEnableScaledFont = true // 字体是否跟着适配
var appDesignDraft: DesignDraft = designDraft // 全局的设计参数
var scaledDensity: Float // 控制字体
// density、widthPixels、heightPixels是设备原始值,width、height的单位是dp
@JvmField
val density: Float
@JvmField
val widthPixels: Int
@JvmField
val heightPixels: Int
@JvmField
val width: Float
@JvmField
val height: Float
init {
val displayMetrics = application.resources.displayMetrics
density = displayMetrics.density
scaledDensity = displayMetrics.scaledDensity
widthPixels = displayMetrics.widthPixels
heightPixels = displayMetrics.heightPixels
width = widthPixels / density
height = heightPixels / density
}
} | 28.973684 | 77 | 0.708447 |
0448d2ffa3e1c07a24f025c314042ae9aeb5a9b2 | 2,991 | java | Java | PCS/Infrastructure/inf-poss-client/src/main/java/com/idealunited/dto/ChannelOrder.java | IdealUnited/JAVA-2017 | 75cbc068ea399ff0e9c7690419fdb0b5e215e337 | [
"Apache-2.0"
] | 2 | 2017-09-11T06:08:03.000Z | 2018-08-08T03:27:40.000Z | PCS/Infrastructure/inf-poss-client/src/main/java/com/idealunited/dto/ChannelOrder.java | IdealUnited/JAVA-2017 | 75cbc068ea399ff0e9c7690419fdb0b5e215e337 | [
"Apache-2.0"
] | 16 | 2020-04-27T03:21:18.000Z | 2022-02-01T00:57:31.000Z | PCS/Infrastructure/inf-poss-client/src/main/java/com/idealunited/dto/ChannelOrder.java | IdealUnited/JAVA-2017 | 75cbc068ea399ff0e9c7690419fdb0b5e215e337 | [
"Apache-2.0"
] | 1 | 2021-01-10T10:39:46.000Z | 2021-01-10T10:39:46.000Z | package com.idealunited.dto;
import java.util.Date;
public class ChannelOrder {
/**
* 渠道订单号
*/
private String channelOrderNo;
/**
* 渠道编号
*/
private Integer channelId;
/**
* 通道编号
*/
private Integer channelItemId;
/**
* 创建时间
*/
private Date createDate;
/**
* 完成时间
*/
private Date completeDate;
/**
* 0-创建,1-成功,2-失败
*/
private Integer status;
/**
* 物流单号
*/
private String expressOrderNo;
/**
*
*/
private Date expressUpdateDate;
/**
*
* @return the value of t_channel_order.CHANNEL_ORDER_NO
*/
public String getChannelOrderNo() {
return channelOrderNo;
}
/**
*
*/
public void setChannelOrderNo(String channelOrderNo) {
this.channelOrderNo = channelOrderNo;
}
/**
*
* @return the value of t_channel_order.CHANNEL_ID
*/
public Integer getChannelId() {
return channelId;
}
/**
*
*/
public void setChannelId(Integer channelId) {
this.channelId = channelId;
}
/**
*
* @return the value of t_channel_order.CHANNEL_ITEM_ID
*/
public Integer getChannelItemId() {
return channelItemId;
}
/**
*
*/
public void setChannelItemId(Integer channelItemId) {
this.channelItemId = channelItemId;
}
/**
*
* @return the value of t_channel_order.CREATE_DATE
*/
public Date getCreateDate() {
return createDate;
}
/**
*
*/
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
/**
*
* @return the value of t_channel_order.COMPLETE_DATE
*/
public Date getCompleteDate() {
return completeDate;
}
/**
*
*/
public void setCompleteDate(Date completeDate) {
this.completeDate = completeDate;
}
/**
*
* @return the value of t_channel_order.STATUS
*/
public Integer getStatus() {
return status;
}
/**
*
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
*
* @return the value of t_channel_order.EXPRESS_ORDER_NO
*/
public String getExpressOrderNo() {
return expressOrderNo;
}
/**
*
*/
public void setExpressOrderNo(String expressOrderNo) {
this.expressOrderNo = expressOrderNo;
}
/**
*
* @return the value of t_channel_order.EXPRESS_UPDATE_DATE
*/
public Date getExpressUpdateDate() {
return expressUpdateDate;
}
/**
*
*/
public void setExpressUpdateDate(Date expressUpdateDate) {
this.expressUpdateDate = expressUpdateDate;
}
} | 18.127273 | 64 | 0.523236 |
2d7ea5557cc7a94d1a59679f6e75d1fc9198e69f | 8,047 | htm | HTML | plugins/indikator/filemanager/controllers/index/index.htm | kentucky-roberts/lkncleaning.com | 5ee96da2195c9805fb0b93013f2523c03c07a9dc | [
"MIT"
] | null | null | null | plugins/indikator/filemanager/controllers/index/index.htm | kentucky-roberts/lkncleaning.com | 5ee96da2195c9805fb0b93013f2523c03c07a9dc | [
"MIT"
] | null | null | null | plugins/indikator/filemanager/controllers/index/index.htm | kentucky-roberts/lkncleaning.com | 5ee96da2195c9805fb0b93013f2523c03c07a9dc | [
"MIT"
] | null | null | null | <div class="scoreboard">
<div class="container-flush">
<?= $this->makeHintPartial('indikator_filemanager_hint', 'hint') ?>
</div>
<?php
use Backend\Models\UserPreferences;
use System\Classes\PluginManager;
$preferences = UserPreferences::forUser()->get('backend::backend.preferences');
$stat = $this->fmStat();
if (PluginManager::instance()->exists('AnandPatel.WysiwygEditors')):
if (!isset($preferences['fm_hide_stat']) || !$preferences['fm_hide_stat']):
?>
<div data-control="toolbar">
<div class="scoreboard-item title-value">
<h4><?= e(trans('indikator.filemanager::lang.widget.basic.folders')) ?></h4>
<p><?= $stat['folders'] ?></p>
<p class="description"><?= e(trans_choice('indikator.filemanager::lang.widget.pieces', $stat['folders'])) ?></p>
</div>
<div class="scoreboard-item title-value">
<h4><?= e(trans('indikator.filemanager::lang.widget.basic.files')) ?></h4>
<p><?= $stat['files'] ?></p>
<p class="description"><?= e(trans_choice('indikator.filemanager::lang.widget.pieces', $stat['files'])) ?></p>
</div>
<div class="scoreboard-item title-value">
<h4><?= e(trans('indikator.filemanager::lang.widget.basic.size')) ?></h4>
<p><?= $this->fmSize($stat['size']) ?></p>
<p class="description"><?= $this->fmSize($stat['size'], true) ?></p>
</div>
<div class="scoreboard-item title-value">
<h4><?= e(trans('indikator.filemanager::lang.widget.limit')) ?></h4>
<p><?= substr(ini_get('upload_max_filesize'), 0, -1) ?></p>
<p class="description">MB</p>
</div>
<div class="scoreboard-item control-chart" data-control="chart-pie">
<ul>
<li data-color="#2a5696"><?= e(trans('indikator.filemanager::lang.widget.type.doc')) ?> <span><?= $stat['doc'] ?></span></li>
<li data-color="#1c6f44"><?= e(trans('indikator.filemanager::lang.widget.type.table')) ?> <span><?= $stat['table'] ?></span></li>
<li data-color="#d04424"><?= e(trans('indikator.filemanager::lang.widget.type.prezi')) ?> <span><?= $stat['prezi'] ?></span></li>
</ul>
</div>
<div class="scoreboard-item control-chart" data-control="chart-pie">
<ul>
<li data-color="#95b753"><?= e(trans('indikator.filemanager::lang.widget.type.image')) ?> <span><?= $stat['image'] ?></span></li>
<li data-color="#c07949"><?= e(trans('indikator.filemanager::lang.widget.type.video')) ?> <span><?= $stat['video'] ?></span></li>
<li data-color="#30b4da"><?= e(trans('indikator.filemanager::lang.widget.type.audio')) ?> <span><?= $stat['audio'] ?></span></li>
</ul>
</div>
<div class="scoreboard-item control-chart" data-control="chart-pie">
<ul>
<li data-color="#ac5e91"><?= e(trans('indikator.filemanager::lang.widget.type.text')) ?> <span><?= $stat['text'] ?></span></li>
<li data-color="#ff940a"><?= e(trans('indikator.filemanager::lang.widget.type.archive')) ?> <span><?= $stat['archive'] ?></span></li>
<li data-color="#787878"><?= e(trans('indikator.filemanager::lang.widget.type.code')) ?> <span><?= $stat['code'] ?></span></li>
</ul>
</div>
</div>
<?php endif; ?>
<script type="text/javascript">
$().ready(function() {
$('#elfinder').elfinder({
<?php if ($preferences['locale'] != 'en' && File::exists('plugins/anandpatel/wysiwygeditors/resources/assets/js/i18n/elfinder.'.$preferences['locale'].'.js')): ?>
lang: '<?= $preferences['locale'] ?>',
<?php endif; ?>
url: '<?= URL::action('Barryvdh\Elfinder\ElfinderController@showConnector') ?>'
}).elfinder('instance');
});
</script>
<div id="elfinder"></div>
<?php if (!isset($preferences['fm_hide_help']) || !$preferences['fm_hide_help']): ?>
<p><div class="row">
<div class="col-sm-4 col-md-3 col-lg-2">
CTRL + X <strong><?= e(trans('indikator.filemanager::lang.shortcuts.cut')) ?></strong><br>
CTRL + C <strong><?= e(trans('indikator.filemanager::lang.shortcuts.copy')) ?></strong><br>
CTRL + V <strong><?= e(trans('indikator.filemanager::lang.shortcuts.paste')) ?></strong><br>
CTRL + A <strong><?= e(trans('indikator.filemanager::lang.shortcuts.select')) ?></strong><p>
CTRL + U <strong><?= e(trans('indikator.filemanager::lang.shortcuts.upload')) ?></strong><br>
CTRL + I <strong><?= e(trans('indikator.filemanager::lang.shortcuts.info')) ?></strong><br>
CTRL + F <strong><?= e(trans('indikator.filemanager::lang.shortcuts.search')) ?></strong></p>
</div>
<div class="col-sm-4 col-md-3 col-lg-3">
CTRL + HOME <strong><?= e(trans('indikator.filemanager::lang.shortcuts.main_folder')) ?></strong><br>
CTRL + INSERT <strong><?= e(trans('indikator.filemanager::lang.shortcuts.copy')) ?></strong><br>
CTRL + BACKSPACE <strong><?= e(trans('indikator.filemanager::lang.shortcuts.delete')) ?></strong><p>
SHIFT + ENTER <strong><?= e(trans('indikator.filemanager::lang.shortcuts.download')) ?></strong><br>
SHIFT + INSERT <strong><?= e(trans('indikator.filemanager::lang.shortcuts.cut')) ?></strong></p>
</div>
<div class="col-sm-4 col-md-3 col-lg-3">
CTRL + <?= e(trans('indikator.filemanager::lang.shortcuts.up')) ?> <strong><?= e(trans('indikator.filemanager::lang.shortcuts.parent_folder')) ?></strong><br>
CTRL + <?= e(trans('indikator.filemanager::lang.shortcuts.down')) ?> <strong><?= e(trans('indikator.filemanager::lang.shortcuts.open')) ?></strong><br>
CTRL + <?= e(trans('indikator.filemanager::lang.shortcuts.left')) ?> <strong><?= e(trans('indikator.filemanager::lang.shortcuts.back')) ?></strong><br>
CTRL + <?= e(trans('indikator.filemanager::lang.shortcuts.right')) ?> <strong><?= e(trans('indikator.filemanager::lang.shortcuts.forward')) ?></strong><p>
CTRL + SHIFT + N <strong><?= e(trans('indikator.filemanager::lang.shortcuts.new_folder')) ?></strong><br>
CTRL + SHIFT + R <strong><?= e(trans('indikator.filemanager::lang.shortcuts.reload')) ?></strong></p>
</div>
<div class="col-sm-4 col-md-3 col-lg-2">
ENTER <strong><?= e(trans('indikator.filemanager::lang.shortcuts.open')) ?></strong><br>
SPACE <strong><?= e(trans('indikator.filemanager::lang.shortcuts.view')) ?></strong><br>
BACKSPACE <strong><?= e(trans('indikator.filemanager::lang.shortcuts.back')) ?></strong><br>
DELETE <strong><?= e(trans('indikator.filemanager::lang.shortcuts.delete')) ?></strong><p>
HOME <strong><?= e(trans('indikator.filemanager::lang.shortcuts.first_item')) ?></strong><br>
END <strong><?= e(trans('indikator.filemanager::lang.shortcuts.last_item')) ?></strong></p>
</div>
<div class="col-sm-4 col-md-3 col-lg-2">
F2 <strong><?= e(trans('indikator.filemanager::lang.shortcuts.rename')) ?></strong><br>
F3 <strong><?= e(trans('indikator.filemanager::lang.shortcuts.search')) ?></strong><br>
F5 <strong><?= e(trans('indikator.filemanager::lang.shortcuts.reload')) ?></strong>
</div>
</div></p>
<?php endif; ?>
<?php else: ?>
<p><?= str_replace(array('<b>', '</b>'), array('<strong>', '</strong>'), e(trans('indikator.filemanager::lang.error.text'))) ?> <a href="https://octobercms.com/plugin/anandpatel-wysiwygeditors" target="_blank"><?= e(trans('indikator.filemanager::lang.error.plugin')) ?></a></p>
<?php endif; ?>
</div>
| 68.194915 | 293 | 0.578476 |
909ab0b96b338d54ac14df4e14bdb86fe32e099f | 7,550 | py | Python | tools/mirax_slide_importer.py | lucalianas/ome_seadragon | 3f4c0e66b93459e6d6b915c555c8b0151769a5a2 | [
"MIT"
] | 4 | 2017-10-04T16:52:39.000Z | 2020-06-15T19:56:13.000Z | tools/mirax_slide_importer.py | lucalianas/ome_seadragon | 3f4c0e66b93459e6d6b915c555c8b0151769a5a2 | [
"MIT"
] | null | null | null | tools/mirax_slide_importer.py | lucalianas/ome_seadragon | 3f4c0e66b93459e6d6b915c555c8b0151769a5a2 | [
"MIT"
] | null | null | null | # Copyright (c) 2021, CRS4
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import requests
from argparse import ArgumentParser
from os import path, listdir
from hashlib import sha1
import sys
from urllib.parse import urljoin
import logging
from requests.models import Response
class ServerError(Exception):
pass
class MiraxImporter(object):
def __init__(self, mirax_file, ome_base_url, chunk_size, log_level='INFO', log_file=None):
self.mirax_file = mirax_file
self.ome_save_url = urljoin(ome_base_url, 'mirax/register_file/')
self.ome_delete_url = urljoin(ome_base_url, 'mirax/delete_files/')
self.INDEX_FILE_MT = 'mirax/index'
self.DATA_FOLDER_MT = 'mirax/datafolder'
self.big_files_chunk_size = chunk_size * 1024 * 1024
self.logger = self.get_logger(log_level, log_file)
def get_logger(self, log_level='INFO', log_file=None, mode='a'):
LOG_FORMAT = '%(asctime)s|%(levelname)-8s|%(message)s'
LOG_DATEFMT = '%Y-%m-%d %H:%M:%S'
logger = logging.getLogger('mirax_importer')
if not isinstance(log_level, int):
try:
log_level = getattr(logging, log_level)
except AttributeError:
raise ValueError(
'Unsupported literal log level: %s' % log_level)
logger.setLevel(log_level)
logger.handlers = []
if log_file:
handler = logging.FileHandler(log_file, mode=mode)
else:
handler = logging.StreamHandler()
formatter = logging.Formatter(LOG_FORMAT, datefmt=LOG_DATEFMT)
handler.setFormatter(formatter)
logger.addHandler(handler)
return logger
def _check_mirax_dataset(self, mirax_file_path):
if path.isfile(mirax_file_path):
if path.isdir(path.splitext(mirax_file_path)[0]):
return path.splitext(mirax_file_path)[0]
else:
raise ValueError(
'Cannot find MIRAX data folder for file %s', mirax_file_path)
else:
raise ValueError('%s is not a valid file', mirax_file_path)
def _get_sha1(self, file_name):
hasher = sha1()
if path.isfile(file_name):
with open(file_name, 'rb') as f:
hasher.update(f.read())
elif path.isdir(file_name):
for f in listdir(file_name):
with open(path.join(file_name, f), 'rb') as fp:
for chunk in iter(lambda: fp.read(self.big_files_chunk_size), b''):
hasher.update(chunk)
return hasher.hexdigest()
def _get_file_details(self, file_name):
label = None
details = {
'path': path.realpath(file_name),
'sha1': self._get_sha1(file_name)
}
if path.isfile(file_name):
label, ext = path.splitext(path.basename(file_name))
if ext.lower() == '.mrxs':
details.update({
'name': label,
'mimetype': self.INDEX_FILE_MT,
'size': path.getsize(file_name)
})
else:
label, details = None, None
elif path.isdir(file_name):
label = path.basename(file_name)
details.update({
'name': label,
'mimetype': self.DATA_FOLDER_MT,
'size': sum([path.getsize(path.join(file_name, f))
for f in listdir(file_name)]),
})
self.logger.debug('Details for file %s: %r', file_name, details)
return label, details
def _save(self, file_details):
self.logger.debug('Saving data for file %s', file_details['name'])
response = requests.get(self.ome_save_url, params=file_details)
if response.status_code == requests.codes.ok:
self.logger.debug('File saved, assigned ID: %s',
response.json()['omero_id'])
return True, response.json()['omero_id']
else:
self.logger.debug('Status code: %d', response.status_code)
return False, response.status_code
def _clear(self, base_label):
response = requests.get(urljoin(self.ome_delete_url, base_label))
return response.status_code
def run(self):
self.logger.info('Importing file %s', self.mirax_file)
mirax_data_folder = self._check_mirax_dataset(self.mirax_file)
mirax_file_label, mirax_file_details = self._get_file_details(self.mirax_file)
mirax_df_label, mirax_df_details = self._get_file_details(mirax_data_folder)
r0_status, r0_response = self._save(mirax_file_details)
if r0_status:
r1_status, r1_response = self._save(mirax_df_details)
if not r1_status:
self.logger.warning(
'Error while saving MIRAX data folder, removing MIRAX file from database')
d0_status = self._clear(mirax_file_label)
if d0_status != requests.codes.ok:
raise ServerError('MIRAX file %s not cleaned properly' % mirax_file_label)
else:
raise ServerError(
'Unable to save MIRAX file, server returned error code %s', r0_response)
self.logger.info('Job completed')
def get_parser():
parser = ArgumentParser('Import a dingle MIRAX file and related data folder to OMERO')
parser.add_argument('--mirax-file', type=str, required=True,
help='the path to MIRAX file to be imported, MIRAX data folder with the same name must be in the same path')
parser.add_argument('--ome-base-url', type=str, required=True,
help='the base URL of the OMERO.web server')
parser.add_argument('--chunk-size', type=int, default=50,
help='size in MB of chunks that will be read to calculate the SHA1 for big files (default 50MB)')
parser.add_argument('--log-level', type=str, default='INFO',
help='log level (default=INFO)')
parser.add_argument('--log-file', type=str, default=None,
help='log file (default=stderr)')
return parser
def main(argv):
parser = get_parser()
args = parser.parse_args(argv)
importer = MiraxImporter(args.mirax_file, args.ome_base_url, args.chunk_size,
args.log_level, args.log_file)
importer.run()
if __name__ == '__main__':
main(sys.argv[1:])
| 43.142857 | 132 | 0.629669 |
324b7f6db22cb71dca6773f7aa9f6f955e3bb540 | 1,006 | swift | Swift | 015-WorkingWithList/WorkingWithList/WorkingWithList/Views/02_DynamicList/WeatherRow.swift | fx-studio/swiftui-notes | 3afc7850ed516ac22759b89abcbdd681cb816f42 | [
"Apache-2.0"
] | 9 | 2021-02-18T04:10:35.000Z | 2022-03-21T02:07:58.000Z | 015-WorkingWithList/WorkingWithList/WorkingWithList/Views/02_DynamicList/WeatherRow.swift | wafulasam/swiftui-notes | 3afc7850ed516ac22759b89abcbdd681cb816f42 | [
"Apache-2.0"
] | null | null | null | 015-WorkingWithList/WorkingWithList/WorkingWithList/Views/02_DynamicList/WeatherRow.swift | wafulasam/swiftui-notes | 3afc7850ed516ac22759b89abcbdd681cb816f42 | [
"Apache-2.0"
] | 5 | 2021-04-07T03:41:15.000Z | 2022-01-14T12:48:34.000Z | //
// WeatherRow.swift
// WorkingWithList
//
// Created by Tien Le P. VN.Danang on 8/6/21.
//
import SwiftUI
struct WeatherRow: View {
var weather: Weather
var body: some View {
HStack {
Image(weather.getStatusInfo())
.resizable()
.padding()
.frame(width: 80.0, height: 80.0)
VStack(alignment: .leading, content: {
Text(weather.city)
.font(.title)
Text(weather.country)
.fontWeight(.thin)
})
Spacer()
Text("\(weather.temperature)°C")
.font(.largeTitle)
.fontWeight(.bold)
.multilineTextAlignment(.center)
.padding()
}
}
}
struct WeatherRow_Previews: PreviewProvider {
static var previews: some View {
WeatherRow(weather: Weather(city: "Hà Nội", country: "Việt Nam", temperature: 30, status: .sun))
}
}
| 24.536585 | 104 | 0.501988 |
3261013b0eabde0e30b59b33053f7b7701e45f5a | 1,586 | dart | Dart | lib/mollie.dart | lantis-web/fluttermollie | da0a01a48cfd3a030ce32a47a046d5059a038c1d | [
"BSD-2-Clause"
] | null | null | null | lib/mollie.dart | lantis-web/fluttermollie | da0a01a48cfd3a030ce32a47a046d5059a038c1d | [
"BSD-2-Clause"
] | null | null | null | lib/mollie.dart | lantis-web/fluttermollie | da0a01a48cfd3a030ce32a47a046d5059a038c1d | [
"BSD-2-Clause"
] | null | null | null | library molli;
export 'package:mollie/src/mollieaddress.dart';
export 'package:mollie/src/mollieorder.dart';
export 'package:mollie/src/mollieproduct.dart';
export 'package:mollie/src/mollieamount.dart';
export 'package:mollie/src/molliecheckout.dart';
export 'package:mollie/src/mollieorderstatus.dart';
export 'package:mollie/src/molliecustomer.dart';
export 'package:mollie/src/molliesubscription.dart';
export 'package:mollie/src/mollieshipment.dart';
export 'package:mollie/src/mollieorderline.dart';
export 'package:mollie/src/molliepayment.dart';
export 'package:mollie/src/mollieinvoice.dart';
export 'package:mollie/src/mollieinvoiceline.dart';
import 'package:mollie/src/mollieclient.dart';
import 'package:mollie/src/mollieorder.dart';
import 'dart:async';
import 'package:flutter/services.dart';
MollieClient client = new MollieClient();
class Mollie {
final klarnaPayNow = "sofort";
final creditCard = "creditcard";
final payPal = "paypal";
final sepa = "branktransfer";
final applePay = "applePay";
final ideal = "ideal";
static const MethodChannel _channel = const MethodChannel('mollie');
/// Opens the browser to process the payment. Returns after payment is done.
static Future<void> startPayment(String checkoutUrl) async {
return await _channel
.invokeMethod('startPayment', {"checkoutUrl": checkoutUrl});
}
static MollieOrderResponse? _currentOrder;
static MollieOrderResponse? getCurrentOrder() => _currentOrder;
static MollieOrderResponse setCurrentOrder(MollieOrderResponse order) =>
_currentOrder = order;
}
| 33.744681 | 78 | 0.773014 |
f9fa3bb181d25e3b8e207de4fe71ddab89a1a55e | 2,536 | go | Go | cmd/img/main.go | lusingander/rgb-to-256-colors | ed3c0ac8b29cdb3eca3ac5b1dd1c779686e01987 | [
"MIT"
] | null | null | null | cmd/img/main.go | lusingander/rgb-to-256-colors | ed3c0ac8b29cdb3eca3ac5b1dd1c779686e01987 | [
"MIT"
] | null | null | null | cmd/img/main.go | lusingander/rgb-to-256-colors | ed3c0ac8b29cdb3eca3ac5b1dd1c779686e01987 | [
"MIT"
] | null | null | null | package main
import (
"fmt"
"image"
"image/color"
"image/png"
"log"
"math/rand"
"os"
"time"
"golang.org/x/image/font"
"golang.org/x/image/font/basicfont"
"golang.org/x/image/math/fixed"
"github.com/lusingander/rgbto256colors-go"
)
const output = "./output.png"
const (
cellW = 80
cellWBuf = 30
cellH = 50
cellHBuf = 20
marginX = 10
marginY = 10
row = 10
col = 3
width = (marginX * (col - 1)) + (cellWBuf * (col - 1)) + ((cellW * 2) * col)
height = marginY + (cellH+cellHBuf)*row
)
var (
white = color.RGBA{255, 255, 255, 255}
)
func fill(i *image.RGBA, c color.Color) {
rect := i.Rect
for y := rect.Min.Y; y < rect.Max.Y; y++ {
for x := rect.Min.X; x < rect.Max.X; x++ {
i.Set(x, y, c)
}
}
}
func paintPattern(i *image.RGBA, r, c int, c1, c2 color.Color) {
baseY := marginY + (cellH+cellHBuf)*r
baseX := marginX + (cellW*2+cellWBuf)*c
for y := baseY; y < baseY+cellH; y++ {
for x := baseX; x < baseX+cellW; x++ {
i.Set(x, y, c1)
}
for x := baseX + cellW; x < baseX+(cellW*2); x++ {
i.Set(x, y, c2)
}
}
drawColorCodeString(i, baseX, baseY, c1, c2)
}
func drawColorCodeString(i *image.RGBA, baseX, baseY int, c1, c2 color.Color) {
d := &font.Drawer{
Dst: i,
Src: image.NewUniform(color.Black),
Face: basicfont.Face7x13,
}
d.Dot.X = (fixed.I(baseX))
d.Dot.Y = fixed.I(baseY + cellH + d.Face.Metrics().Height.Floor())
d.DrawString(hexColorString(c1))
d.Dot.X = (fixed.I(baseX + cellW))
d.Dot.Y = fixed.I(baseY + cellH + d.Face.Metrics().Height.Floor())
d.DrawString(hexColorString(c2))
}
func hexColorString(c color.Color) string {
rgba := color.RGBAModel.Convert(c).(color.RGBA)
return fmt.Sprintf("#%.2X%.2X%.2X", rgba.R, rgba.G, rgba.B)
}
func uint8RandGen() func() uint8 {
rand.Seed(time.Now().UnixNano())
return func() uint8 { return uint8(rand.Intn(255)) }
}
func draw(img *image.RGBA) {
fill(img, white)
var randN = uint8RandGen()
for c := 0; c < col; c++ {
for r := 0; r < row; r++ {
c1 := color.RGBA{randN(), randN(), randN(), 255}
c2 := rgbto256colors.FromRGB(c1.R, c1.G, c1.B).ToColor()
paintPattern(img, r, c, c1, c2)
}
}
}
func save(img *image.RGBA) error {
file, err := os.Create(output)
if err != nil {
return err
}
defer file.Close()
err = png.Encode(file, img)
if err != nil {
return err
}
return nil
}
func run(args []string) error {
img := image.NewRGBA(image.Rect(0, 0, width, height))
draw(img)
return save(img)
}
func main() {
if err := run(os.Args); err != nil {
log.Fatal(err)
}
}
| 19.968504 | 79 | 0.611199 |
fbb2228517dec93541ef68f75491ffbdcc29897c | 1,166 | java | Java | restaraunt/restaraunt-common/src/main/java/com/wisencrazy/common/ApplicationConstants.java | ShekharWNC/wisencrazy-services | 059877c41e3770a30fe6fcc4480eb382614ee677 | [
"MIT"
] | null | null | null | restaraunt/restaraunt-common/src/main/java/com/wisencrazy/common/ApplicationConstants.java | ShekharWNC/wisencrazy-services | 059877c41e3770a30fe6fcc4480eb382614ee677 | [
"MIT"
] | null | null | null | restaraunt/restaraunt-common/src/main/java/com/wisencrazy/common/ApplicationConstants.java | ShekharWNC/wisencrazy-services | 059877c41e3770a30fe6fcc4480eb382614ee677 | [
"MIT"
] | null | null | null | package com.wisencrazy.common;
public class ApplicationConstants {
public static final String GENERAL_EXCEPTION = "GENERAL_EXCEPTION";
public static final String CONSTRAINT_VIOLATION = "CONSTRAINT_EXCEPTION";
public static final String DUPLICATE_ENTRY = "DUPLICATE_ENTRY";
public static final String NO_RESULT = "NO_RESULT";
public static final String NULL_KEY = "NULL_KEY";
public static final String ILLEGAL_ARG = "ILLEGAL_ARG";
public static final Integer RECORD_SIZE_DEFAULT = 10;
public static final String DATE_FORMAT_EXP = "DATE_FORMAT_EXP";
public static final String DOZER_MAP_EXP = "DOZER_MAP_EXP";
public static final String SIGNUP_NAME = "SIGNUP_NAME_MISSING";
public static final String SIGNUP_EMAIL = "SIGNUP_EMAIL_MISSING";
public static final String SIGNUP_PASSWORD = "SIGNUP_PASSWORD";
public static final String PHONE = "PHONE";
public static final String ACCESS_TOKEN = "ACCESS_TOKEN";
public static final String INVALID_ACCESS_TOKEN = "INVALID_ACCESS_TOKEN";
public static final String GMAIL_LOGIN = "GMAIL_LOGIN";
public static final String FB_LOGIN = "FB_LOGIN";
public static final String INCORRECT_PWD = "INCORRECT_PWD";
}
| 50.695652 | 74 | 0.805317 |
486f366c208000df0e2c605029fbfc096480fcbf | 3,344 | lua | Lua | ESX/utils/Instructional_Buttons.lua | 0resmon/0R-admin | 25c6e0a1c0b9befdee372c50c7cb33cb28363ed1 | [
"MIT"
] | 8 | 2021-09-27T19:24:56.000Z | 2022-03-19T00:10:46.000Z | ESX/utils/Instructional_Buttons.lua | 0resmon/0R-admin | 25c6e0a1c0b9befdee372c50c7cb33cb28363ed1 | [
"MIT"
] | 1 | 2021-10-03T18:41:12.000Z | 2021-10-03T18:41:12.000Z | QBCore/utils/Instructional_Buttons.lua | 0resmon/0R-admin | 25c6e0a1c0b9befdee372c50c7cb33cb28363ed1 | [
"MIT"
] | 9 | 2021-09-27T19:38:32.000Z | 2022-03-13T19:38:54.000Z | function ButtonMessage(text)
BeginTextCommandScaleformString("STRING")
AddTextComponentScaleform(text)
EndTextCommandScaleformString()
end
function Button(ControlButton)
N_0xe83a3e3557a56640(ControlButton)
end
function setupScaleform(scaleform)
local scaleform = RequestScaleformMovie(scaleform)
while not HasScaleformMovieLoaded(scaleform) do
Citizen.Wait(1)
end
PushScaleformMovieFunction(scaleform, "CLEAR_ALL")
PopScaleformMovieFunctionVoid()
PushScaleformMovieFunction(scaleform, "SET_CLEAR_SPACE")
PushScaleformMovieFunctionParameterInt(200)
PopScaleformMovieFunctionVoid()
PushScaleformMovieFunction(scaleform, "SET_DATA_SLOT")
PushScaleformMovieFunctionParameterInt(5)
Button(GetControlInstructionalButton(2, config.controls.openKey, true))
ButtonMessage("Disable Noclip")
PopScaleformMovieFunctionVoid()
PushScaleformMovieFunction(scaleform, "SET_DATA_SLOT")
PushScaleformMovieFunctionParameterInt(4)
Button(GetControlInstructionalButton(2, config.controls.goUp, true))
ButtonMessage("Go Up")
PopScaleformMovieFunctionVoid()
PushScaleformMovieFunction(scaleform, "SET_DATA_SLOT")
PushScaleformMovieFunctionParameterInt(3)
Button(GetControlInstructionalButton(2, config.controls.goDown, true))
ButtonMessage("Go Down")
PopScaleformMovieFunctionVoid()
PushScaleformMovieFunction(scaleform, "SET_DATA_SLOT")
PushScaleformMovieFunctionParameterInt(2)
Button(GetControlInstructionalButton(1, config.controls.turnRight, true))
Button(GetControlInstructionalButton(1, config.controls.turnLeft, true))
ButtonMessage("Turn Left/Right")
PopScaleformMovieFunctionVoid()
PushScaleformMovieFunction(scaleform, "SET_DATA_SLOT")
PushScaleformMovieFunctionParameterInt(1)
Button(GetControlInstructionalButton(1, config.controls.goBackward, true))
Button(GetControlInstructionalButton(1, config.controls.goForward, true))
ButtonMessage("Go Forwards/Backwards")
PopScaleformMovieFunctionVoid()
PushScaleformMovieFunction(scaleform, "SET_DATA_SLOT")
PushScaleformMovieFunctionParameterInt(0)
Button(GetControlInstructionalButton(2, config.controls.changeSpeed, true))
ButtonMessage("Change Speed ("..config.speeds[index].label..")")
PopScaleformMovieFunctionVoid()
PushScaleformMovieFunction(scaleform, "DRAW_INSTRUCTIONAL_BUTTONS")
PopScaleformMovieFunctionVoid()
PushScaleformMovieFunction(scaleform, "SET_BACKGROUND_COLOUR")
PushScaleformMovieFunctionParameterInt(config.bgR)
PushScaleformMovieFunctionParameterInt(config.bgG)
PushScaleformMovieFunctionParameterInt(config.bgB)
PushScaleformMovieFunctionParameterInt(config.bgA)
PopScaleformMovieFunctionVoid()
return scaleform
end
function DisableControls()
DisableControlAction(0, 30, true)
DisableControlAction(0, 31, true)
DisableControlAction(0, 32, true)
DisableControlAction(0, 33, true)
DisableControlAction(0, 34, true)
DisableControlAction(0, 35, true)
DisableControlAction(0, 266, true)
DisableControlAction(0, 267, true)
DisableControlAction(0, 268, true)
DisableControlAction(0, 269, true)
DisableControlAction(0, 44, true)
DisableControlAction(0, 20, true)
DisableControlAction(0, 74, true)
end
| 36.347826 | 79 | 0.786782 |
a4d9df1cc92df8c6d18cab755ecc57d67bc4516b | 306 | asm | Assembly | programs/oeis/044/A044242.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/044/A044242.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/044/A044242.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A044242: Numbers n such that string 6,7 occurs in the base 8 representation of n but not of n-1.
; 55,119,183,247,311,375,439,503,567,631,695,759,823,887,951,1015,1079,1143,1207,1271,1335,1399,1463,1527,1591,1655,1719,1783,1847,1911,1975,2039,2103,2167,2231,2295,2359,2423,2487,2551
mul $0,64
add $0,55
| 51 | 185 | 0.751634 |
50b627501a665d7eb7928e7afeb42e7eff7a1187 | 11,890 | dart | Dart | lib/src/sub_views/likes_page.dart | Betoso99/Goutu | 3f53a81af7f58a12037ed6432d8f300218d71aa2 | [
"MIT"
] | null | null | null | lib/src/sub_views/likes_page.dart | Betoso99/Goutu | 3f53a81af7f58a12037ed6432d8f300218d71aa2 | [
"MIT"
] | null | null | null | lib/src/sub_views/likes_page.dart | Betoso99/Goutu | 3f53a81af7f58a12037ed6432d8f300218d71aa2 | [
"MIT"
] | null | null | null | import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
import 'package:geolocator/geolocator.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:goutu/models/places.dart';
import 'package:goutu/models/user.dart';
import 'package:goutu/src/controllers/user_controller.dart';
import 'package:goutu/src/views/info_page.dart';
import 'package:goutu/src/views/map_home_page.dart';
/*final List<Places> fav_spots = <Places>[
Places(entries: 'Jardin Botanico', km: '1.5km', price: 'DOP 95', image: "https://images.visitarepublicadominicana.org/jardin-botanico-santo-domingo.jpg"),
Places(entries: 'Marbella', km: '2.5km', price: 'DOP 120', image: "https://www.marbella-hills-homes.com/cms/wp-content/uploads/2020/12/1.jpg"),
Places(entries: 'Los Tres Ojos', km: '1km', price: 'DOP 75', image: "https://images.visitarepublicadominicana.org/los-tres-ojos-santo-domingo.jpg"),
];*/
List<Places> fav_spots = <Places>[];
List<Places> objs = <Places>[];
List<List<double>> polylinesarr = [
/* [18.472425, -69.926299],
[18.470187, -69.931642],
[18.468640, -69.926063]*/
];
var polylinesdef = polylinesarr.map((e) => LatLng(e[0],e[1])).toList();
class LikesPage extends StatefulWidget {
final User user;
const LikesPage({Key? key, required this.user}) : super(key: key);
@override
_LikesPage createState() => _LikesPage();
}
class _LikesPage extends State<LikesPage> {
PolylinePoints polylinePoints = PolylinePoints();
String googleAPiKey = "AIzaSyB_iMzzl__vncphopqHr8r51Frw5H_q2eU";
List<LatLng> polylineCoordinates = [];
late LatLng startLocation;
late LatLng endLocation;
void getSpotsData () async{
var body = await getTouristSpotsByUser(widget.user.username!);
fav_spots = json.decode(utf8.decode(body.bodyBytes))['favorite_tourist_spots'].map<Places>((value) => Places.fromJson(value)).toList();
fav_spots.forEach((element) {print(element.name);});
objs.clear();
objs.addAll(fav_spots);
setState(() {});
}
@override
void initState(){
super.initState();
WidgetsBinding.instance
?.addPostFrameCallback((_) {getSpotsData();
});
setState(() {});
}
getDirections() async {
PolylineResult result = await polylinePoints.getRouteBetweenCoordinates(
googleAPiKey,
PointLatLng(startLocation.latitude, startLocation.longitude),
PointLatLng(endLocation.latitude, endLocation.longitude),
travelMode: TravelMode.transit,
);
if (result.points.isNotEmpty) {
result.points.forEach((PointLatLng point) {
polylineCoordinates.add(LatLng(point.latitude, point.longitude));
});
} else {
print(result.errorMessage);
}
//addPolyLine(polylineCoordinates);
}
void filterSearchResults(String query) {
List<Places>? dummySearchList = <Places>[];
dummySearchList.addAll(fav_spots);
if(query.isNotEmpty) {
List<Places>? dummyListData = <Places>[];
for (var item in dummySearchList) {
if(item.name!.toLowerCase().contains(query.toLowerCase())) {
dummyListData.add(item);
}
}
setState(() {
objs.clear();
objs.addAll(dummyListData);
});
return;
}
else {
setState(() {
objs.clear();
objs.addAll(fav_spots);
});
}
}
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
appBar: AppBar(
title: const Text('Tourist Spots'),
backgroundColor: const Color.fromRGBO(16, 16, 20, 1),
actions: <Widget>[
Padding(
padding: const EdgeInsets.only(top: 12, bottom: 12),
child: GestureDetector(
onTap: () async {
polylineCoordinates = [const LatLng(0,0)];
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => MapSample(poly: polylineCoordinates, user: widget.user,)));
},
child: Image.asset(
'images/tempsnip.png',
height: 400,
alignment: Alignment.bottomRight,
),
),
)
],
),
body: Stack(
children: [
const SizedBox(height: 100),
Padding(
padding: const EdgeInsets.only(
top: 10, left: 16, right: 16, bottom: 10),
child: Container(
color: Colors.grey,
child: TextField(
onChanged: (String str) {
//Logica de Filtro
filterSearchResults(str);
},
style: const TextStyle(
color: Colors.white
),
decoration: InputDecoration(
icon: Container(
margin: const EdgeInsets.only(left: 20, bottom: 15),
width: 10,
height: 10,
child: const Icon(
Icons.location_on,
color: Colors.white54,
),
),
hintText: "Where to go?",
hintStyle: const TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.bold),
border: InputBorder.none,
contentPadding: const EdgeInsets.all(15),
),
),
),
),
Padding(
padding: const EdgeInsets.only(top: 60),
child: ListView.separated(
padding: const EdgeInsets.all(15),
itemCount: objs.length,
itemBuilder: (BuildContext context, int index) {
return Container(
height: 100,
color: Colors.white12,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: () async {
var position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
startLocation = LatLng(position.latitude, position.longitude);
endLocation = LatLng(double.parse(objs[index].latitude!),double.parse(objs[index].longitude!));
getDirections();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => MapSample(poly: polylineCoordinates, user: widget.user,)));
},
child: Row(
children: [
const SizedBox(width: 5),
Container(
width: 100,
height: 70,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: NetworkImage(objs[index].image_urls![0].toString()),
),
),
),
const SizedBox(width: 20),
SizedBox(
width: 125,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 10),
Text(
objs[index].name.toString(),
style: const TextStyle(color: Colors.white),
),
const SizedBox(height: 10),
/*Text(
spots[index].province.toString(),
style: const TextStyle(color: Colors.white),
),
Text(
spots[index].price.toString(),
style: const TextStyle(color: Colors.white),
),*/
],
),
)
],
),
),
GestureDetector(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
GestureDetector(
onTap: () async {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
InfoPage(place: objs[index])));
},
child: Container(
child: const Icon(
Icons.info_outline,
color: Colors.white,
size: 30,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color:
const Color.fromRGBO(253, 175, 1, 1)),
),
),
const SizedBox(width: 10),
GestureDetector(
onTap: () async {
deleteTouristSpotsByUser(widget.user.username!, objs[index].id!);
objs.removeAt(index);
setState(() {
});
},
child: Container(
child: const Icon(
Icons.delete_forever,
color: Colors.white,
size: 30,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color:
const Color.fromRGBO(255, 80, 47, 1)),
),
),
const SizedBox(width: 20),
],
),
)
],
),
);
},
separatorBuilder: (BuildContext context, int index) =>
const Divider(
height: 15,
),
),
),
],
),
backgroundColor: const Color.fromRGBO(16, 16, 20, 1),
),
);
}
}
| 39.501661 | 156 | 0.430362 |
50c23591361e09194715043d65388395c40863cb | 2,431 | lua | Lua | Scripts/clouds.lua | scotty007/trAInsported | e0ed49e73ffd447ba1024c8f08bcc0fb24bf3cdb | [
"WTFPL"
] | 101 | 2015-01-06T17:26:45.000Z | 2022-02-10T15:17:34.000Z | Scripts/clouds.lua | trcjr/trAInsported | 283cc51d40feb04c7767d875666f8b6e8e519e25 | [
"WTFPL"
] | 32 | 2015-01-03T10:54:49.000Z | 2021-08-31T12:48:37.000Z | Scripts/clouds.lua | trcjr/trAInsported | 283cc51d40feb04c7767d875666f8b6e8e519e25 | [
"WTFPL"
] | 35 | 2015-02-21T10:19:56.000Z | 2022-02-09T21:36:23.000Z | local clouds = {}
local IMAGE_CLOUD01 = love.graphics.newImage("Images/Cloud01.png")
local IMAGE_CLOUD01_SHADOW = love.graphics.newImage("Images/Cloud01_Shadow.png")
local MAX_NUM_CLOUDS = 10
local cloudList = {}
local nextCloudIn = 0
local numClouds = 0
function clouds.restart()
cloudList = {}
numClouds = 0
local width, height = 0,0
if curMap then
width = curMap.width
height = curMap.height
elseif simulationMap then
width = simulationMap.width
height = simulationMap.height
end
MAX_NUM_CLOUDS = 2*math.floor(width+height-3)
for i = 1, MAX_NUM_CLOUDS do
s = 2+math.random()*2
cloudList[i] = {a=0.5+math.random()*0.5, alpha=0, r=math.random()*math.pi, x=math.random(-2, width+2)*TILE_SIZE, y=math.random(-2, height+2)*TILE_SIZE, scale=2.5+math.random(), height=math.random()*3+1, img=IMAGE_CLOUD01, imgShadow=IMAGE_CLOUD01_SHADOW}
numClouds = numClouds + 1
end
end
function clouds.renderShadows(dt)
if not curMap and not simulationMap then return
elseif curMap then
width = curMap.width
height = curMap.height
else
width = simulationMap.width
height = simulationMap.height
end
if nextCloudIn <= 0 then
while numClouds < MAX_NUM_CLOUDS do
nextCloudIn = math.random(3)
s = 2+math.random()*2
for j = 1, MAX_NUM_CLOUDS do
if cloudList[j] == nil then
cloudList[j] = {a=0.5+math.random()*0.5, alpha=0, r=math.random()*math.pi, x=-TILE_SIZE*2, y=math.random(-2, height+2)*TILE_SIZE, scale=s, height=math.random()*3+1, img=IMAGE_CLOUD01, imgShadow=IMAGE_CLOUD01_SHADOW}
numClouds = numClouds + 1
break
end
end
end
else
nextCloudIn = nextCloudIn - dt
end
for k, cl in pairs(cloudList) do
if not roundEnded then cl.x = cl.x + dt*cl.height*15 end
if cl.x >= (width+2)*TILE_SIZE then
cloudList[k] = nil
numClouds = numClouds - 1
else
cl.alpha = math.min(0.8, 1+cl.x/(TILE_SIZE*2), 1+(width*TILE_SIZE-cl.x)/(TILE_SIZE*2))
love.graphics.setColor(0,0,0,35*cl.alpha*cl.a)
love.graphics.draw(cl.imgShadow, cl.x-30-cl.height*30, cl.y+30+cl.height*30, cl.r, cl.scale, cl.scale, cl.img:getWidth()/2, cl.img:getHeight()/2)
end
end
end
local fade = 0
function clouds.render()
fade = math.max(0.6-camZ,0)
for k, cl in pairs(cloudList) do
love.graphics.setColor(255,255,255,135*cl.alpha*fade*cl.a)
love.graphics.draw(cl.img, cl.x,cl.y, cl.r, cl.scale, cl.scale, cl.img:getWidth()/2, cl.img:getHeight()/2)
end
end
return clouds
| 29.646341 | 255 | 0.703826 |
1665798397c9fb459eceb36d4b9413a774d762e4 | 70 | ts | TypeScript | src/services/utils/factories/index.ts | AlexandreMPDias/test-npm-cli-pkg | a2bcea04e8968319de07a5b229197027d15aef38 | [
"MIT"
] | null | null | null | src/services/utils/factories/index.ts | AlexandreMPDias/test-npm-cli-pkg | a2bcea04e8968319de07a5b229197027d15aef38 | [
"MIT"
] | null | null | null | src/services/utils/factories/index.ts | AlexandreMPDias/test-npm-cli-pkg | a2bcea04e8968319de07a5b229197027d15aef38 | [
"MIT"
] | null | null | null | import selection from './selection';
export default {
selection,
};
| 11.666667 | 36 | 0.714286 |
fd2ff4ac54c51f17038ce4fcbcb43f8588285918 | 1,074 | lua | Lua | EmmyLua/API/System/SplashScreenDocumentation.lua | Wutname1/vscode-wow-api | 2371af5405d7d7f97b93c17638d191fb3988d56e | [
"MIT"
] | 42 | 2020-05-26T01:26:09.000Z | 2022-03-30T18:42:47.000Z | EmmyLua/API/System/SplashScreenDocumentation.lua | Wutname1/vscode-wow-api | 2371af5405d7d7f97b93c17638d191fb3988d56e | [
"MIT"
] | 20 | 2021-03-03T21:50:14.000Z | 2022-03-30T21:59:23.000Z | EmmyLua/API/System/SplashScreenDocumentation.lua | Wutname1/vscode-wow-api | 2371af5405d7d7f97b93c17638d191fb3988d56e | [
"MIT"
] | 12 | 2021-03-06T20:06:03.000Z | 2022-03-31T03:19:51.000Z | C_SplashScreen = {}
---[Documentation](https://wowpedia.fandom.com/wiki/API_C_SplashScreen.AcknowledgeSplash)
function C_SplashScreen.AcknowledgeSplash() end
---[Documentation](https://wowpedia.fandom.com/wiki/API_C_SplashScreen.CanViewSplashScreen)
---@return boolean canView
function C_SplashScreen.CanViewSplashScreen() end
---[Documentation](https://wowpedia.fandom.com/wiki/API_C_SplashScreen.RequestLatestSplashScreen)
---@param fromGameMenu boolean
function C_SplashScreen.RequestLatestSplashScreen(fromGameMenu) end
---@class SplashScreenInfo
---@field textureKit string
---@field minDisplayCharLevel number
---@field minQuestDisplayLevel number
---@field soundKitID number
---@field allianceQuestID number|nil
---@field hordeQuestID number|nil
---@field header string
---@field topLeftFeatureTitle string
---@field topLeftFeatureDesc string
---@field bottomLeftFeatureTitle string
---@field bottomLeftFeatureDesc string
---@field rightFeatureTitle string
---@field rightFeatureDesc string
---@field shouldShowQuest boolean
---@field screenType SplashScreenType
| 35.8 | 97 | 0.810987 |
d11203f11a5d1eac9c642ec79541008eaa19d316 | 365 | sql | SQL | sql/V9.8.1__fixed_permissions.sql | sr-2020/sr-2020-db | 1a7dcb5153fcf7fca471655c3a853e2faefe4ad8 | [
"Apache-2.0"
] | null | null | null | sql/V9.8.1__fixed_permissions.sql | sr-2020/sr-2020-db | 1a7dcb5153fcf7fca471655c3a853e2faefe4ad8 | [
"Apache-2.0"
] | 3 | 2020-11-15T10:53:20.000Z | 2021-06-19T02:38:54.000Z | sql/V9.8.1__fixed_permissions.sql | sr-2020/sr-2020-db | 1a7dcb5153fcf7fca471655c3a853e2faefe4ad8 | [
"Apache-2.0"
] | null | null | null | alter table metatype_feature owner to backend;
alter table general_feature owner to backend;
alter table build_gf owner to backend;
alter table build_mf owner to backend;
alter table feature owner to backend;
alter table implant owner to backend;
alter table pill owner to backend;
alter table drone owner to backend;
alter table reagent owner to backend;
| 36.5 | 47 | 0.80274 |
5ffe74558c6527e82b24a0984ebc99f958a202be | 70 | css | CSS | frontend/src/main/web/src/app/components/task/task.component.css | vdvorak83/taskManager | cde490082fcc0bdebb0ff991bd78fff891f68372 | [
"Apache-2.0"
] | 1 | 2020-10-10T18:07:17.000Z | 2020-10-10T18:07:17.000Z | frontend/src/main/web/src/app/modules/tasks/components/task/task.component.css | VardanMatevosyan/taskManager | bd920ecfbb065f78f5fcdb63c1c24f022913dcf1 | [
"Apache-2.0"
] | 11 | 2020-04-30T07:40:53.000Z | 2022-03-02T04:39:15.000Z | frontend/src/main/web/src/app/components/task/task.component.css | vdvorak/taskManager | cde490082fcc0bdebb0ff991bd78fff891f68372 | [
"Apache-2.0"
] | 1 | 2020-07-30T13:40:20.000Z | 2020-07-30T13:40:20.000Z | .line_through_when_completed {
text-decoration-line: line-through;
}
| 17.5 | 36 | 0.8 |
b53addb87ed8ad358427ab924695787f93f955c7 | 460 | swift | Swift | SummerMediaFileInfo/Base/SummerExtractor.swift | superbderrick/SummerFileInfo | 10e21770ba8f3d35fc129c36b024723dae51e2e3 | [
"MIT"
] | 2 | 2017-10-05T08:51:29.000Z | 2017-10-06T09:16:24.000Z | SummerMediaFileInfo/Base/SummerExtractor.swift | superbderrick/SummerFileInfo | 10e21770ba8f3d35fc129c36b024723dae51e2e3 | [
"MIT"
] | null | null | null | SummerMediaFileInfo/Base/SummerExtractor.swift | superbderrick/SummerFileInfo | 10e21770ba8f3d35fc129c36b024723dae51e2e3 | [
"MIT"
] | 1 | 2017-10-06T08:31:56.000Z | 2017-10-06T08:31:56.000Z | //
// SummerExtractor.swift
// SummerMediaFileInfo
//
// Created by Kang Jinyeoung on 05/10/2017.
// Copyright © 2017 SuperbDerrick. All rights reserved.
//
import Foundation
class SummerExtractor : Extractable {
var processor:SummerProcessor!
init() {
}
func setup(fileType: FileTypes , isBringUnknownFile: Bool) {
}
func getFileInfo() {
}
func getFiles() -> [SummerFile]? {
return nil
}
}
| 13.142857 | 62 | 0.621739 |
11921a2aaf846e64eea1158ffd5fb52e67b0b0e7 | 3,042 | dart | Dart | lib/monero/get_height_by_date.dart | narecoin/nare_smart_wallet | b3f6ea800b6152c9808ff5d67cc0f89325aa88be | [
"MIT"
] | 188 | 2020-01-05T15:09:05.000Z | 2022-03-30T15:12:14.000Z | lib/monero/get_height_by_date.dart | narecoin/nare_smart_wallet | b3f6ea800b6152c9808ff5d67cc0f89325aa88be | [
"MIT"
] | 115 | 2020-01-10T08:56:24.000Z | 2022-03-25T02:02:02.000Z | lib/monero/get_height_by_date.dart | narecoin/nare_smart_wallet | b3f6ea800b6152c9808ff5d67cc0f89325aa88be | [
"MIT"
] | 62 | 2020-01-07T19:20:13.000Z | 2022-03-28T07:10:27.000Z | import 'package:intl/intl.dart';
// FIXME: Hardcoded values; Works only for monero
final dateFormat = DateFormat('yyyy-MM');
final dates = {
"2014-5": 18844,
"2014-6": 65406,
"2014-7": 108882,
"2014-8": 153594,
"2014-9": 198072,
"2014-10": 241088,
"2014-11": 285305,
"2014-12": 328069,
"2015-1": 372369,
"2015-2": 416505,
"2015-3": 456631,
"2015-4": 501084,
"2015-5": 543973,
"2015-6": 588326,
"2015-7": 631187,
"2015-8": 675484,
"2015-9": 719725,
"2015-10": 762463,
"2015-11": 806528,
"2015-12": 849041,
"2016-1": 892866,
"2016-2": 936736,
"2016-3": 977691,
"2016-4": 1015848,
"2016-5": 1037417,
"2016-6": 1059651,
"2016-7": 1081269,
"2016-8": 1103630,
"2016-9": 1125983,
"2016-10": 1147617,
"2016-11": 1169779,
"2016-12": 1191402,
"2017-1": 1213861,
"2017-2": 1236197,
"2017-3": 1256358,
"2017-4": 1278622,
"2017-5": 1300239,
"2017-6": 1322564,
"2017-7": 1344225,
"2017-8": 1366664,
"2017-9": 1389113,
"2017-10": 1410738,
"2017-11": 1433039,
"2017-12": 1454639,
"2018-1": 1477201,
"2018-2": 1499599,
"2018-3": 1519796,
"2018-4": 1542067,
"2018-5": 1562861,
"2018-6": 1585135,
"2018-7": 1606715,
"2018-8": 1629017,
"2018-9": 1651347,
"2018-10": 1673031,
"2018-11": 1695128,
"2018-12": 1716687,
"2019-1": 1738923,
"2019-2": 1761435,
"2019-3": 1781681,
"2019-4": 1803081,
"2019-5": 1824671,
"2019-6": 1847005,
"2019-7": 1868590,
"2019-8": 1890552,
"2019-9": 1912212,
"2019-10": 1932200,
"2019-11": 1957040,
"2019-12": 1978090,
"2020-1": 2001290,
"2020-2": 2022688,
"2020-3": 2043987,
"2020-4": 2066536,
"2020-5": 2090797,
"2020-6": 2111633,
"2020-7": 2131433,
"2020-8": 2153983,
"2020-9": 2176466,
"2020-10": 2198453,
"2020-11": 2220000
};
int getHeigthByDate({DateTime date}) {
final raw = '${date.year}' + '-' + '${date.month}';
final lastHeight = dates.values.last;
int startHeight;
int endHeight;
int height = 0;
try {
if ((dates[raw] == null)||(dates[raw] == lastHeight)) {
startHeight = dates.values.toList()[dates.length - 2];
endHeight = dates.values.toList()[dates.length - 1];
final heightPerDay = (endHeight - startHeight) / 31;
final endDateRaw = dates.keys.toList()[dates.length - 1].split('-');
final endYear = int.parse(endDateRaw[0]);
final endMonth = int.parse(endDateRaw[1]);
final endDate = DateTime(endYear, endMonth);
final differenceInDays = date.difference(endDate).inDays;
final daysHeight = (differenceInDays * heightPerDay).round();
height = endHeight + daysHeight;
} else {
startHeight = dates[raw];
final index = dates.values.toList().indexOf(startHeight);
endHeight = dates.values.toList()[index + 1];
final heightPerDay = ((endHeight - startHeight) / 31).round();
final daysHeight = (date.day - 1) * heightPerDay;
height = startHeight + daysHeight - heightPerDay;
}
} catch (e) {
print(e.toString());
}
return height;
}
| 25.140496 | 74 | 0.60355 |
d2651e2aa5af200c2cc400aab045a1134f1919e4 | 2,383 | php | PHP | tests/ImmutableCollectionTest.php | phpsuit/collections | 1d083de27af151435575cbdc289b111091231261 | [
"MIT"
] | null | null | null | tests/ImmutableCollectionTest.php | phpsuit/collections | 1d083de27af151435575cbdc289b111091231261 | [
"MIT"
] | null | null | null | tests/ImmutableCollectionTest.php | phpsuit/collections | 1d083de27af151435575cbdc289b111091231261 | [
"MIT"
] | null | null | null | <?php
/**
* PHPSuit
*
* @author Oleg Bronzov <oleg.bronzov@gmail.com>
* @copyright 2017 PHPSuit
* @license https://opensource.org/licenses/MIT
*/
declare(strict_types=1);
namespace PS\Collections;
use PHPUnit\Framework\TestCase;
/**
* Test for ImmutableCollection.
*
* @author Oleg Bronzov <oleg.bronzov@gmail.com>
* @copyright 2017 PHPSuit
* @license https://opensource.org/licenses/MIT
*/
class ImmutableCollectionTest extends TestCase
{
private function getCollection(): ImmutableCollection
{
$o1 = new \stdClass();
$o2 = new \stdClass();
$o1->x = 1;
$o2->x = 2;
return new ImmutableCollection([$o1, $o2]);
}
public function testInitAndGet(): void
{
$imCollection = $this->getCollection();
$this->assertEquals(1, $imCollection->get(0)->x);
$this->assertEquals(2, $imCollection->get(1)->x);
}
public function testCount(): void
{
$imCollection = $this->getCollection();
$this->assertEquals(2, $imCollection->count());
}
public function testEmpty(): void
{
$imCollection = $this->getCollection();
$this->assertFalse($imCollection->isEmpty());
}
public function testContains(): void
{
$imCollection = $this->getCollection();
$o = new \stdClass();
$o->x = 1;
$this->assertTrue($imCollection->contains($o));
$o->x = 3;
$this->assertFalse($imCollection->contains($o));
}
public function testIndexOf(): void
{
$imCollection = $this->getCollection();
$o = new \stdClass();
$o->x = 1;
$this->assertEquals(0, $imCollection->indexOf($o));
$o->x = 2;
$this->assertEquals(1, $imCollection->indexOf($o));
}
public function testHasIndex(): void
{
$imCollection = $this->getCollection();
$this->assertTrue($imCollection->hasIndex(1));
$this->assertFalse($imCollection->hasIndex(3));
}
public function testToArray(): void
{
$imCollection = $this->getCollection();
$this->assertTrue(is_array($imCollection->toArray()));
}
public function testIterate(): void
{
$imCollection = $this->getCollection();
foreach ($imCollection as $item) {
$this->assertTrue($item instanceof \stdClass);
}
}
} | 25.084211 | 62 | 0.587495 |
6e416857ca2b5ae7f0be1601977fdd579c74f810 | 14,762 | html | HTML | documentation/genindex.html | AdamPesci/diveR | ae7fe415bbdbb008fadd2b96a0a3a5092b04fdc7 | [
"MIT"
] | null | null | null | documentation/genindex.html | AdamPesci/diveR | ae7fe415bbdbb008fadd2b96a0a3a5092b04fdc7 | [
"MIT"
] | null | null | null | documentation/genindex.html | AdamPesci/diveR | ae7fe415bbdbb008fadd2b96a0a3a5092b04fdc7 | [
"MIT"
] | null | null | null |
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Index — DiveR documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="#" />
<link rel="search" title="Search" href="search.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home"> DiveR
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="main.html">main package</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">DiveR</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home"></a> »</li>
<li>Index</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<h1 id="index">Index</h1>
<div class="genindex-jumpbox">
<a href="#A"><strong>A</strong></a>
| <a href="#B"><strong>B</strong></a>
| <a href="#C"><strong>C</strong></a>
| <a href="#D"><strong>D</strong></a>
| <a href="#F"><strong>F</strong></a>
| <a href="#G"><strong>G</strong></a>
| <a href="#H"><strong>H</strong></a>
| <a href="#I"><strong>I</strong></a>
| <a href="#L"><strong>L</strong></a>
| <a href="#M"><strong>M</strong></a>
| <a href="#N"><strong>N</strong></a>
| <a href="#O"><strong>O</strong></a>
| <a href="#P"><strong>P</strong></a>
| <a href="#T"><strong>T</strong></a>
| <a href="#W"><strong>W</strong></a>
| <a href="#Z"><strong>Z</strong></a>
</div>
<h2 id="A">A</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="main.html#Calculations.Calculations.ambient_pressures">ambient_pressures() (Calculations.Calculations method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="main.html#FileLoader.ANSLoader">ANSLoader (class in FileLoader)</a>
</li>
</ul></td>
</tr></table>
<h2 id="B">B</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="main.html#Parser.BuhlmannParser">BuhlmannParser (class in Parser)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="main.html#Parser.BuzzacotParser">BuzzacotParser (class in Parser)</a>
</li>
</ul></td>
</tr></table>
<h2 id="C">C</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
Calculations
<ul>
<li><a href="main.html#module-Calculations">module</a>
</li>
</ul></li>
<li><a href="main.html#Calculations.Calculations">Calculations (class in Calculations)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="main.html#Calculations.Calculations.compartment_pressures">compartment_pressures() (Calculations.Calculations method)</a>
</li>
<li><a href="main.html#FileLoader.CSVLoader">CSVLoader (class in FileLoader)</a>
</li>
<li><a href="main.html#FileWriter.CSVWriter">CSVWriter (class in FileWriter)</a>
</li>
</ul></td>
</tr></table>
<h2 id="D">D</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
DiveConstants
<ul>
<li><a href="main.html#module-DiveConstants">module</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="main.html#DiveConstants.DSAT_N_M_NAUGHT">DSAT_N_M_NAUGHT (in module DiveConstants)</a>
</li>
</ul></td>
</tr></table>
<h2 id="F">F</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
FileLoader
<ul>
<li><a href="main.html#module-FileLoader">module</a>
</li>
</ul></li>
<li><a href="main.html#FileLoader.FileLoader">FileLoader (class in FileLoader)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
FileWriter
<ul>
<li><a href="main.html#module-FileWriter">module</a>
</li>
</ul></li>
<li><a href="main.html#FileWriter.FileWriter">FileWriter (class in FileWriter)</a>
</li>
</ul></td>
</tr></table>
<h2 id="G">G</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="main.html#FileLoader.ANSLoader.generate_gas_list">generate_gas_list() (FileLoader.ANSLoader method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="main.html#Parser.Parser.get_list_json">get_list_json() (Parser.Parser method)</a>
</li>
<li><a href="main.html#Calculations.Calculations.gradient_factors">gradient_factors() (Calculations.Calculations method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="H">H</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="main.html#DiveConstants.HALDANE_M_NAUGHT">HALDANE_M_NAUGHT (in module DiveConstants)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="main.html#Parser.HaldaneParser">HaldaneParser (class in Parser)</a>
</li>
<li><a href="main.html#Calculations.Calculations.helium_inert_pressure">helium_inert_pressure() (Calculations.Calculations method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="I">I</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="main.html#Calculations.Calculations.initialise_dive">initialise_dive() (Calculations.Calculations method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="L">L</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="main.html#FileLoader.ANSLoader.load">load() (FileLoader.ANSLoader method)</a>
<ul>
<li><a href="main.html#FileLoader.CSVLoader.load">(FileLoader.CSVLoader method)</a>
</li>
<li><a href="main.html#FileLoader.FileLoader.load">(FileLoader.FileLoader method)</a>
</li>
</ul></li>
</ul></td>
</tr></table>
<h2 id="M">M</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
Main
<ul>
<li><a href="main.html#module-Main">module</a>
</li>
</ul></li>
<li><a href="main.html#Main.main">main() (in module Main)</a>
</li>
<li><a href="main.html#Calculations.Calculations.max_ascent">max_ascent() (Calculations.Calculations method)</a>
</li>
<li><a href="main.html#Calculations.Calculations.max_values">max_values() (Calculations.Calculations method)</a>
</li>
<li>
module
<ul>
<li><a href="main.html#module-Calculations">Calculations</a>
</li>
<li><a href="main.html#module-DiveConstants">DiveConstants</a>
</li>
<li><a href="main.html#module-FileLoader">FileLoader</a>
</li>
<li><a href="main.html#module-FileWriter">FileWriter</a>
</li>
<li><a href="main.html#module-Main">Main</a>
</li>
<li><a href="main.html#module-Parser">Parser</a>
</li>
</ul></li>
</ul></td>
</tr></table>
<h2 id="N">N</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="main.html#Calculations.Calculations.nitrogen_inert_pressure">nitrogen_inert_pressure() (Calculations.Calculations method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="O">O</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="main.html#Calculations.Calculations.o2_tox">o2_tox() (Calculations.Calculations method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="P">P</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="main.html#Parser.BuhlmannParser.parse_json">parse_json() (Parser.BuhlmannParser method)</a>
<ul>
<li><a href="main.html#Parser.BuzzacotParser.parse_json">(Parser.BuzzacotParser method)</a>
</li>
<li><a href="main.html#Parser.HaldaneParser.parse_json">(Parser.HaldaneParser method)</a>
</li>
<li><a href="main.html#Parser.Parser.parse_json">(Parser.Parser method)</a>
</li>
<li><a href="main.html#Parser.WorkmanParser.parse_json">(Parser.WorkmanParser method)</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
Parser
<ul>
<li><a href="main.html#module-Parser">module</a>
</li>
</ul></li>
<li><a href="main.html#Parser.Parser">Parser (class in Parser)</a>
</li>
</ul></td>
</tr></table>
<h2 id="T">T</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="main.html#Calculations.Calculations.totalIPP">totalIPP() (Calculations.Calculations method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="main.html#Calculations.Calculations.trimix_list">trimix_list() (Calculations.Calculations method)</a>
</li>
</ul></td>
</tr></table>
<h2 id="W">W</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="main.html#DiveConstants.WORKMAN_N_DELTA">WORKMAN_N_DELTA (in module DiveConstants)</a>
</li>
<li><a href="main.html#DiveConstants.WORKMAN_N_M_NAUGHT">WORKMAN_N_M_NAUGHT (in module DiveConstants)</a>
</li>
<li><a href="main.html#Parser.WorkmanParser">WorkmanParser (class in Parser)</a>
</li>
<li><a href="main.html#FileWriter.CSVWriter.write">write() (FileWriter.CSVWriter method)</a>
<ul>
<li><a href="main.html#FileWriter.FileWriter.write">(FileWriter.FileWriter method)</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="main.html#FileLoader.FileLoader.write_log">write_log() (FileLoader.FileLoader method)</a>
<ul>
<li><a href="main.html#FileWriter.FileWriter.write_log">(FileWriter.FileWriter method)</a>
</li>
<li><a href="main.html#Main.write_log">(in module Main)</a>
</li>
</ul></li>
</ul></td>
</tr></table>
<h2 id="Z">Z</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="main.html#DiveConstants.ZHL16A_N_DELTA">ZHL16A_N_DELTA (in module DiveConstants)</a>
</li>
<li><a href="main.html#DiveConstants.ZHL16A_N_M_NAUGHT">ZHL16A_N_M_NAUGHT (in module DiveConstants)</a>
</li>
<li><a href="main.html#DiveConstants.ZHL16B_HE_DELTA">ZHL16B_HE_DELTA (in module DiveConstants)</a>
</li>
<li><a href="main.html#DiveConstants.ZHL16B_HE_M_NAUGHT">ZHL16B_HE_M_NAUGHT (in module DiveConstants)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="main.html#DiveConstants.ZHL16B_N_DELTA">ZHL16B_N_DELTA (in module DiveConstants)</a>
</li>
<li><a href="main.html#DiveConstants.ZHL16B_N_M_NAUGHT">ZHL16B_N_M_NAUGHT (in module DiveConstants)</a>
</li>
<li><a href="main.html#DiveConstants.ZHL16C_N_DELTA">ZHL16C_N_DELTA (in module DiveConstants)</a>
</li>
<li><a href="main.html#DiveConstants.ZHL16C_N_M_NAUGHT">ZHL16C_N_M_NAUGHT (in module DiveConstants)</a>
</li>
</ul></td>
</tr></table>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>
© Copyright 2021, Alex B, Adam C, Augustine I, Ryan F, Ryan P.
</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html> | 29.059055 | 144 | 0.609538 |
048f7290f2ef214948687f44627c07a42c95cf6e | 295 | java | Java | HSN-gui/src/main/java/com/crawl/jpa/dao/impl/ConfigCategoriaDaoImpl.java | anvilmon/GIT_Repositorio | 09269c24d1c4333d2420848d62d7020e491ebcf5 | [
"Apache-2.0"
] | null | null | null | HSN-gui/src/main/java/com/crawl/jpa/dao/impl/ConfigCategoriaDaoImpl.java | anvilmon/GIT_Repositorio | 09269c24d1c4333d2420848d62d7020e491ebcf5 | [
"Apache-2.0"
] | null | null | null | HSN-gui/src/main/java/com/crawl/jpa/dao/impl/ConfigCategoriaDaoImpl.java | anvilmon/GIT_Repositorio | 09269c24d1c4333d2420848d62d7020e491ebcf5 | [
"Apache-2.0"
] | null | null | null | package com.crawl.jpa.dao.impl;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import com.crawl.jpa.dao.ConfigCategoriaDaoCustom;
public class ConfigCategoriaDaoImpl implements ConfigCategoriaDaoCustom{
@PersistenceContext
private EntityManager em;
}
| 22.692308 | 72 | 0.850847 |
7fd82224781f748a5b8ca29488928f9c1ba78719 | 473 | go | Go | doc.go | ajamshed/go-pfcp | 2435c5c3996a0243ef9e6600e9198fb12da82c54 | [
"MIT"
] | 1 | 2021-01-15T06:48:02.000Z | 2021-01-15T06:48:02.000Z | doc.go | ajamshed/go-pfcp | 2435c5c3996a0243ef9e6600e9198fb12da82c54 | [
"MIT"
] | null | null | null | doc.go | ajamshed/go-pfcp | 2435c5c3996a0243ef9e6600e9198fb12da82c54 | [
"MIT"
] | null | null | null | // Copyright 2019-2020 go-pfcp authors. All rights reserved.
// Use of this source code is governed by a MIT-style license that can be
// found in the LICENSE file.
// Package pfcp provides simple and painless handling of PFCP(Packet Forwarding Control Protocol),
// implemented in the Go Programming Language.
//
// THIS PROJECT IS STILL WIP.
// It has only a few messages and IEs definitions.
// Networking functionality would be implemented in the future.
package pfcp
| 39.416667 | 98 | 0.769556 |
dfb17869503820184f1dcb7ec6eb345b63512240 | 718 | ts | TypeScript | coordinator-service/src/authenticate.ts | mrsmkl/snark-setup-coordinator | e24a9fe1cf3bbaee1071a68fe0894ceaa445637d | [
"Apache-2.0"
] | null | null | null | coordinator-service/src/authenticate.ts | mrsmkl/snark-setup-coordinator | e24a9fe1cf3bbaee1071a68fe0894ceaa445637d | [
"Apache-2.0"
] | null | null | null | coordinator-service/src/authenticate.ts | mrsmkl/snark-setup-coordinator | e24a9fe1cf3bbaee1071a68fe0894ceaa445637d | [
"Apache-2.0"
] | null | null | null | import express = require('express')
export interface AuthenticateStrategy {
/**
* Verify a request. Return the Participant ID or throw an Error.
*/
verify(req: express.Request): string
verifyMessage(data: object, signature: string, address: string): boolean
}
export function authenticate(
strategy: AuthenticateStrategy,
): (req, res, next) => void {
return function (req, res, next): void {
try {
req.participantId = strategy.verify(req)
} catch (error) {
res.status(401).json({
status: 'error',
message: error.message,
})
next(error)
return
}
next()
}
}
| 24.758621 | 76 | 0.56546 |
20d6754964997e33f201c1643a0329058331474c | 5,456 | dart | Dart | lib/MyHomePage.dart | Haffshah/Wrap-Stack-Example | 63bbcbf8df605e6369bd0976a3f7ce13bbf359c4 | [
"Apache-2.0"
] | null | null | null | lib/MyHomePage.dart | Haffshah/Wrap-Stack-Example | 63bbcbf8df605e6369bd0976a3f7ce13bbf359c4 | [
"Apache-2.0"
] | null | null | null | lib/MyHomePage.dart | Haffshah/Wrap-Stack-Example | 63bbcbf8df605e6369bd0976a3f7ce13bbf359c4 | [
"Apache-2.0"
] | null | null | null | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'StackScreen.dart';
class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key);
BoxDecoration borderDeco() {
return BoxDecoration(
borderRadius: BorderRadius.circular(30.0),
color: Colors.orange,
border: Border.all(
color: Colors.white,
width: 2.0,
));
}
EdgeInsets padding() {
return EdgeInsets.symmetric(horizontal: 30.0, vertical: 15.0);
}
TextStyle textColor() {
return TextStyle(color: Colors.white, fontSize: 16.0);
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.black,
appBar: AppBar(
backgroundColor: Colors.black,
title: Text('Wrap Example '),
actions: [
Container(
child: TextButton(
style: TextButton.styleFrom(
primary: Colors.white,
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => StackScreen(),
),
);
},
child: const Text(
'Stack Screen',
style: TextStyle(fontSize: 20.0),
),
),
),
Container(
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => StackScreen(),
),
);
},
child: Padding(
padding: const EdgeInsets.only(right: 10.0),
child: Icon(
Icons.arrow_forward,
// size: 25.0,
),
),
),
),
],
),
body: Padding(
padding: const EdgeInsets.all(20.0),
child: Wrap(
runSpacing: 30.0,
spacing: 15.0,
children: [
Container(
padding: padding(),
child: Text(
'Harsh',
style: textColor(),
),
decoration: borderDeco(),
),
Container(
padding: padding(),
child: Text(
'Dhruv',
style: textColor(),
),
decoration: borderDeco(),
),
Container(
padding: padding(),
child: Text(
'Om',
style: textColor(),
),
decoration: borderDeco(),
),
Container(
padding: padding(),
child: Text(
'Naman Sir',
style: textColor(),
),
decoration: borderDeco(),
),
Container(
padding: padding(),
child: Text(
'Bhargav sir',
style: textColor(),
),
decoration: borderDeco(),
),
Container(
padding: padding(),
child: Text(
'Devang',
style: textColor(),
),
decoration: borderDeco(),
),
Container(
padding: padding(),
child: Text(
'Shajid',
style: textColor(),
),
decoration: borderDeco(),
),
Container(
padding: padding(),
child: Text(
'Manjeet',
style: textColor(),
),
decoration: borderDeco(),
),
Container(
padding: padding(),
child: Text(
'Ami',
style: textColor(),
),
decoration: borderDeco(),
),
Container(
padding: padding(),
child: Text(
'Jahanvi',
style: textColor(),
),
decoration: borderDeco(),
),
Container(
padding: padding(),
child: Text(
'Nikunj sir',
style: textColor(),
),
decoration: borderDeco(),
),
Container(
padding: padding(),
child: Text(
'Mehul sir',
style: textColor(),
),
decoration: borderDeco(),
),
Container(
padding: padding(),
child: Text(
'Ashtosh',
style: textColor(),
),
decoration: borderDeco(),
),
Container(
padding: padding(),
child: Text(
'Farhan',
style: textColor(),
),
decoration: borderDeco(),
),
Container(
padding: padding(),
child: Text(
'Harsh Kanani',
style: textColor(),
),
decoration: borderDeco(),
),
],
),
),
);
}
}
| 26.230769 | 66 | 0.380499 |
df5ce169a8dae41b38a6eaf8867a4d3b12c2a7a3 | 177 | jbuilder | Ruby | app/views/productos/_producto.json.jbuilder | Jorge575/inventario_computadoras | 7bff1d398fb08fb11e0dc06a3a50cedb1ae63964 | [
"MIT"
] | null | null | null | app/views/productos/_producto.json.jbuilder | Jorge575/inventario_computadoras | 7bff1d398fb08fb11e0dc06a3a50cedb1ae63964 | [
"MIT"
] | null | null | null | app/views/productos/_producto.json.jbuilder | Jorge575/inventario_computadoras | 7bff1d398fb08fb11e0dc06a3a50cedb1ae63964 | [
"MIT"
] | null | null | null | json.extract! producto, :id, :nombre, :precio, :detalle, :cantidad, :fecha, :empresa_id, :componente_id, :created_at, :updated_at
json.url producto_url(producto, format: :json)
| 59 | 129 | 0.751412 |
8644b7e8f6414aa762f8c865495cf8dabb59afc4 | 1,473 | lua | Lua | .config/nvim/lua/plugins/telescope.lua | hkupty/dotfiles | 467df355284dc6013b4d01607fc5478a4778d7bd | [
"MIT"
] | 23 | 2016-03-14T18:03:31.000Z | 2021-09-01T05:29:50.000Z | .config/nvim/lua/plugins/telescope.lua | hkupty/dotfiles | 467df355284dc6013b4d01607fc5478a4778d7bd | [
"MIT"
] | 1 | 2016-06-15T22:20:48.000Z | 2016-06-15T22:20:48.000Z | .config/nvim/lua/plugins/telescope.lua | hkupty/dotfiles | 467df355284dc6013b4d01607fc5478a4778d7bd | [
"MIT"
] | 3 | 2016-06-15T21:46:24.000Z | 2021-06-28T22:35:46.000Z | local actions = require("telescope.actions")
local action_state = require("telescope.actions.state")
local pickers = require("telescope.pickers")
local finders = require("telescope.finders")
local conf = require("telescope.config").values
local project_folders = function(opts)
opts = opts or {}
local find_command = {
"fd", ".git$", vim.fn.expand("$CODE"), "-td", "-H", "-x", "echo", "{//}"
}
pickers.new(opts, {
prompt_title = "Select project folder",
finder = finders.new_oneshot_job(find_command, opts),
previewer = conf.file_previewer(opts),
sorter = conf.file_sorter(opts),
attach_mappings = function(prompt_bufnr, map)
actions.select_default:replace(function()
actions.close(prompt_bufnr)
local selection = action_state.get_selected_entry()
vim.api.nvim_command("tcd ".. selection[1])
end)
return true
end,
}):find()
end
require("telescope").setup{
defaults = {
}
}
require('telescope').load_extension('fzy_native')
require("astronauta.keymap")
local mapper = function(opt)
vim.keymap.nnoremap { opt.lhs or opt[1], function()
(opt.fn or opt[2])(opt.arg or opt[3] or {})
end
}
end
local ivy = require('telescope.themes').get_ivy({})
mapper{"<C-p>", require'telescope.builtin'.find_files, ivy}
mapper{"<C-l>", require'telescope.builtin'.buffers, ivy}
mapper{"<C-g>", require'telescope.builtin'.git_status, ivy}
mapper{"<C-M-p>", project_folders, ivy}
| 28.326923 | 76 | 0.672098 |
7a32f450c48d834a0434047f33e4afedca465e10 | 53 | sql | SQL | pkg/parser/testdata/input/query/select_union_chain.sql | git-hulk/memefish | db9e008141b6a8280eaa1762c87f9181556e5b98 | [
"MIT"
] | 33 | 2019-09-14T07:11:35.000Z | 2021-08-05T03:53:25.000Z | pkg/parser/testdata/input/query/select_union_chain.sql | git-hulk/memefish | db9e008141b6a8280eaa1762c87f9181556e5b98 | [
"MIT"
] | 26 | 2019-09-14T14:53:53.000Z | 2021-09-03T01:03:17.000Z | pkg/parser/testdata/input/query/select_union_chain.sql | git-hulk/memefish | db9e008141b6a8280eaa1762c87f9181556e5b98 | [
"MIT"
] | 11 | 2019-09-27T12:44:00.000Z | 2021-06-21T12:32:09.000Z | (select 1) union all (select 2) union all (select 3)
| 26.5 | 52 | 0.698113 |
81400fa213c149656ceb3cd134d425ea8cbbb4bf | 664 | go | Go | vendor/github.com/itchio/wharf/wrand/wrand.go | sjml/butler | da6f84f801fd9cbd525f23a641e2370a27780a59 | [
"MIT"
] | null | null | null | vendor/github.com/itchio/wharf/wrand/wrand.go | sjml/butler | da6f84f801fd9cbd525f23a641e2370a27780a59 | [
"MIT"
] | null | null | null | vendor/github.com/itchio/wharf/wrand/wrand.go | sjml/butler | da6f84f801fd9cbd525f23a641e2370a27780a59 | [
"MIT"
] | 1 | 2018-08-06T21:55:18.000Z | 2018-08-06T21:55:18.000Z | package wrand
import "math/rand"
// RandReader reads from rand.Source optimizedly
type RandReader struct {
rand.Source
}
func (rr RandReader) Read(sink []byte) (int, error) {
var tail, head int
buf := make([]byte, 8)
var r uint64
for {
head = min(tail+8, len(sink))
if tail == head {
return head, nil
}
r = (uint64)(rr.Int63())
buf[0] = (byte)(r)
buf[1] = (byte)(r >> 8)
buf[2] = (byte)(r >> 16)
buf[3] = (byte)(r >> 24)
buf[4] = (byte)(r >> 32)
buf[5] = (byte)(r >> 40)
buf[6] = (byte)(r >> 48)
buf[7] = (byte)(r >> 56)
tail += copy(sink[tail:head], buf)
}
}
func min(a, b int) int {
if a < b {
return a
}
return b
}
| 16.6 | 53 | 0.554217 |
af2b1dfc42b75c22d49744f47f93a81ee320c5a8 | 918 | rb | Ruby | lib/biz/week.rb | apexdp/biz | f12e02a441a4ace3b164947113fec692d13ff9d3 | [
"Apache-2.0"
] | 487 | 2015-02-17T19:50:28.000Z | 2022-03-14T07:45:55.000Z | lib/biz/week.rb | apexdp/biz | f12e02a441a4ace3b164947113fec692d13ff9d3 | [
"Apache-2.0"
] | 106 | 2015-02-17T22:31:09.000Z | 2021-09-14T08:06:35.000Z | lib/biz/week.rb | apexdp/biz | f12e02a441a4ace3b164947113fec692d13ff9d3 | [
"Apache-2.0"
] | 31 | 2015-02-18T02:23:29.000Z | 2022-03-25T08:58:04.000Z | # frozen_string_literal: true
module Biz
class Week
include Comparable
def self.from_date(date)
new((date - Date.epoch).to_i / Time.week_days)
end
def self.from_time(time)
from_date(time.to_date)
end
class << self
alias since_epoch from_time
end
def initialize(week)
@week = Integer(week)
end
def start_date
Date.from_day(week * Time.week_days)
end
def succ
self.class.new(week.succ)
end
def downto(final_week)
return enum_for(:downto, final_week) unless block_given?
week.downto(final_week.week).each do |raw_week|
yield self.class.new(raw_week)
end
end
def +(other)
self.class.new(week + other.week)
end
protected
attr_reader :week
private
def <=>(other)
return unless other.is_a?(self.class)
week <=> other.week
end
end
end
| 15.3 | 62 | 0.618736 |
c214c4cd98b1498310c0bc79a2520cb5163c95ab | 575 | go | Go | http/middleware/bench_test.go | hamba/pkg | 96070580e14fa5c6017468ecb19281b66a39afc3 | [
"MIT"
] | 4 | 2019-02-09T10:15:12.000Z | 2022-02-10T06:06:02.000Z | http/middleware/bench_test.go | hamba/pkg | 96070580e14fa5c6017468ecb19281b66a39afc3 | [
"MIT"
] | 5 | 2019-08-24T07:00:36.000Z | 2022-03-17T00:10:03.000Z | http/middleware/bench_test.go | hamba/pkg | 96070580e14fa5c6017468ecb19281b66a39afc3 | [
"MIT"
] | 1 | 2020-11-21T15:05:01.000Z | 2020-11-21T15:05:01.000Z | package middleware_test
import (
"net/http"
"net/http/httptest"
"testing"
"time"
"github.com/hamba/pkg/v2/http/middleware"
"github.com/hamba/statter/v2"
)
func BenchmarkWithStats(b *testing.B) {
s := statter.New(statter.DiscardReporter, time.Second)
h := middleware.WithStats("test", s, http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {}),
)
resp := httptest.NewRecorder()
req, _ := http.NewRequest("GET", "/", nil)
b.ReportAllocs()
b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
h.ServeHTTP(resp, req)
}
})
}
| 19.166667 | 55 | 0.678261 |
096b554ff4501fd996918c0be3d4d901ff011bb7 | 3,658 | ps1 | PowerShell | Create-Certificate.ps1 | ravensorb/LetsEncryptUtils | 2cbfa44410dd5cbc5d7e4a39b6ef9332e57eab87 | [
"MIT"
] | 1 | 2019-09-16T14:11:00.000Z | 2019-09-16T14:11:00.000Z | Create-Certificate.ps1 | ravensorb/LetsEncryptUtils | 2cbfa44410dd5cbc5d7e4a39b6ef9332e57eab87 | [
"MIT"
] | null | null | null | Create-Certificate.ps1 | ravensorb/LetsEncryptUtils | 2cbfa44410dd5cbc5d7e4a39b6ef9332e57eab87 | [
"MIT"
] | null | null | null | [
CmdletBinding(SupportsShouldProcess=$true)
]
param(
[Parameter(Mandatory=$true)][string[]]$domainNames,
[string]$contactEmail = $null,
[string]$friendlyName = $null,
[Parameter(Mandatory=$true)][string]$PluginName,
[System.Management.Automation.PSObject]$PluginArgs,
[string]$pfxPassword = $null,
[SecureString]$pfxPasswordSecure = $null,
[string]$letsEncrypServerUrl = "https://acme-v02.api.letsencrypt.org/directory"
)
BEGIN
{
if (-not $PSBoundParameters.ContainsKey('Verbose'))
{
$VerbosePreference = $PSCmdlet.GetVariableValue('VerbosePreference')
}
# $ErrorPreference = 'Stop'
# if ( $PSBoundParameters.ContainsKey('ErrorAction')) {
# $ErrorPreference = $PSBoundParameters['ErrorAction']
# }
Write-Verbose "Entering script $($MyInvocation.MyCommand.Name)"
Write-Verbose "Parameter Values"
$PSBoundParameters.Keys | ForEach-Object { Write-Verbose "$_ = '$($PSBoundParameters[$_])'" }
}
PROCESS
{
if ($null -eq $PluginArgs) {
Write-Host "Loading Settings file" -ForegroundColor Yellow
$PluginArgs = (Get-Content -Raw -Path ".\settings.$($PluginName).json" | ConvertFrom-Json)
}
# Do we have at least one domain name?
if ($null -eq $domainNames -or $domainNames.Count -eq 0 -or $domainNames[0].Length -eq 0) {
Write-Warning "At least one Domain Name must be specfiied"
exit
}
# If the first one is a wildcard lets get a version without the *. to use later
$safeDomainName = $domainNames[0]
$safeDomainName = $safeDomainName.Replace("*.", "");
# Do we have online 1 domain name and is it a wildcard?
if ($domainNames.Count -eq 1) {
if ($domainNames[0].StartsWith("*.")) {
# if so, lets add in the base domain name to the certificate
$domainNames += $safeDomainName
}
}
# Do we have a friendly name? If not lets use the safe domain as the friendly Name
if ($friendlyName -eq $null -or $friendlyName.Length -eq 0) {
$friendlyName = $safeDomainName
}
# Do we have a contact email, if not lets set a default one
if ($contactEmail -eq $null -or $contactEmail.Length -eq 0) {
$contactEmail = "certs@$($safeDomainName)"
}
if ($null -ne $pfxPasswordSecure -and $pfxPasswordSecure.Length -ne 0) {
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pfxPasswordSecure)
$pfxPassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
}
# Do we have a valid pfx password?
if ($pfxPassword -eq $null -or $pfxPassword.Length -eq 0) {
# If not, lets use the contact email address
$pfxPassword = $contactEmail
}
Import-Module Posh-ACME
Write-Host "Creating Certificate for $domainNames" -ForegroundColor Green
Write-Host "`tContact Email: $contactEmail" -ForegroundColor Yellow
Write-Host "`tFriendly Name: $friendlyName" -ForegroundColor Yellow
Write-Host "`tPlugin Name: $PluginName" -ForegroundColor Yellow
Write-Debug "`tPlugin Args:"
Write-Debug (ConvertTo-Json $PluginArgs -Compress)
Write-Host "Setting Lets Encrypt to use $letsEncrypServerUrl" -ForegroundColor Green
if ($PSCmdlet.ShouldProcess("$letsEncrypServerUrl", "Setting Lets Encrypt Server Url")) {
Set-PAServer -DirectoryUrl $letsEncrypServerUrl -Verbose:$VerbosePreference
}
if ($PSCmdlet.ShouldProcess("$domainNames", "Creating actual Certificate")) {
$htPluginArgs = ($PluginArgs.psobject.properties | ForEach-Object -begin {$h=@{}} -process {$h.$($_.Name) = $_.Value} -end {$h})
New-PACertificate $domainNames -AcceptTOS -Install -Contact $contactEmail -FriendlyName $friendlyName -DnsPlugin $PluginName -PluginArgs $htPluginArgs -PfxPass $pfxPassword -Verbose:$VerbosePreference
}
}
END
{
Write-Verbose "Leaving script $($MyInvocation.MyCommand.Name)"
} | 36.58 | 202 | 0.73018 |
131f8dd06ebe638b0cf46f3f9a78520936234eab | 4,858 | sql | SQL | ORACLE_SQL/SHARED_TABLES/21_SCM/21T023_scm_sales_invc_det.sql | rhomicom-systems-tech-gh/Rhomicom-DB-Scripts | ac36d96a5883097a1f0c86909cb516e456f154f9 | [
"MIT"
] | 1 | 2022-01-12T06:39:23.000Z | 2022-01-12T06:39:23.000Z | ORACLE_SQL/SHARED_TABLES/21_SCM/21T023_scm_sales_invc_det.sql | rhomicom-systems-tech-gh/Rhomicom-DB-Scripts | ac36d96a5883097a1f0c86909cb516e456f154f9 | [
"MIT"
] | null | null | null | ORACLE_SQL/SHARED_TABLES/21_SCM/21T023_scm_sales_invc_det.sql | rhomicom-systems-tech-gh/Rhomicom-DB-Scripts | ac36d96a5883097a1f0c86909cb516e456f154f9 | [
"MIT"
] | 1 | 2020-12-19T15:27:29.000Z | 2020-12-19T15:27:29.000Z | /* Formatted on 10/6/2014 9:00:00 PM (QP5 v5.126.903.23003) */
-- TABLE: SCM.SCM_SALES_INVC_DET
-- DROP TABLE SCM.SCM_SALES_INVC_DET;
CREATE TABLE SCM.SCM_SALES_INVC_DET (
INVC_DET_LN_ID NUMBER NOT NULL,
INVC_HDR_ID NUMBER,
ITM_ID NUMBER,
STORE_ID NUMBER,
DOC_QTY NUMBER,
UNIT_SELLING_PRICE NUMBER,
TAX_CODE_ID NUMBER,
CREATED_BY NUMBER,
CREATION_DATE VARCHAR2 (50 BYTE),
LAST_UPDATE_BY NUMBER,
LAST_UPDATE_DATE VARCHAR2 (50 BYTE),
DSCNT_CODE_ID NUMBER,
CHRG_CODE_ID NUMBER,
SRC_LINE_ID NUMBER DEFAULT -1 NOT NULL,
QTY_TRNSCTD_IN_DEST_DOC NUMBER DEFAULT 0 NOT NULL,
CRNCY_ID NUMBER,
RTRN_REASON CLOB DEFAULT '' NOT NULL,
CONSGMNT_IDS CLOB,
CNSGMNT_QTY_DIST CLOB DEFAULT ',' NOT NULL,
ORGNL_SELLING_PRICE NUMBER DEFAULT 0 NOT NULL
)
TABLESPACE RHODB
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;
ALTER TABLE SCM.SCM_SALES_INVC_DET
ADD( CONSTRAINT PK_INVC_DET_LN_ID PRIMARY KEY (INVC_DET_LN_ID ));
-- INDEX: SCM.IDX_CHRG_CODE_ID
-- DROP INDEX SCM.SCM.IDX_CHRG_CODE_ID;
CREATE INDEX SCM.IDX_CHRG_CODE_ID
ON SCM.SCM_SALES_INVC_DET (CHRG_CODE_ID)
LOGGING
TABLESPACE RHODB
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
NOPARALLEL;
-- INDEX: SCM.SCM.IDX_D_INVC_HDR_ID
-- DROP INDEX SCM.SCM.IDX_D_INVC_HDR_ID;
CREATE INDEX SCM.IDX_D_INVC_HDR_ID
ON SCM.SCM_SALES_INVC_DET (INVC_HDR_ID)
LOGGING
TABLESPACE RHODB
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
NOPARALLEL;
-- INDEX: SCM.SCM.IDX_DSCNT_CODE_ID
-- DROP INDEX SCM.SCM.IDX_DSCNT_CODE_ID;
CREATE INDEX SCM.IDX_DSCNT_CODE_ID
ON SCM.SCM_SALES_INVC_DET (DSCNT_CODE_ID)
LOGGING
TABLESPACE RHODB
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
NOPARALLEL;
-- INDEX: SCM.SCM.IDX_INVC_CREATED_BY
-- DROP INDEX SCM.SCM.IDX_INVC_CREATED_BY;
CREATE INDEX SCM.IDX_INVC_CREATED_BY
ON SCM.SCM_SALES_INVC_DET (CREATED_BY)
LOGGING
TABLESPACE RHODB
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
NOPARALLEL;
/*
-- INDEX: SCM.SCM.IDX_INVC_DET_LN_ID
-- DROP INDEX SCM.SCM.IDX_INVC_DET_LN_ID;
CREATE UNIQUE INDEX SCM.IDX_INVC_DET_LN_ID
ON SCM.SCM_SALES_INVC_DET (INVC_DET_LN_ID)
LOGGING
TABLESPACE RHODB
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
NOPARALLEL;
*/
-- INDEX: SCM.SCM.IDX_INVC_ITM_ID
-- DROP INDEX SCM.SCM.IDX_INVC_ITM_ID;
CREATE INDEX SCM.IDX_INVC_ITM_ID
ON SCM.SCM_SALES_INVC_DET (ITM_ID)
LOGGING
TABLESPACE RHODB
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
NOPARALLEL;
-- INDEX: SCM.SCM.IDX_INVC_SRC_LINE_ID
-- DROP INDEX SCM.SCM.IDX_INVC_SRC_LINE_ID;
CREATE INDEX SCM.IDX_INVC_SRC_LINE_ID
ON SCM.SCM_SALES_INVC_DET (SRC_LINE_ID)
LOGGING
TABLESPACE RHODB
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
NOPARALLEL;
-- INDEX: SCM.SCM.IDX_IVD_LAST_UPDATE_BY
-- DROP INDEX SCM.SCM.IDX_IVD_LAST_UPDATE_BY;
CREATE INDEX SCM.IDX_IVD_LAST_UPDATE_BY
ON SCM.SCM_SALES_INVC_DET (LAST_UPDATE_BY)
LOGGING
TABLESPACE RHODB
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
NOPARALLEL;
-- INDEX: SCM.SCM.IDX_STORE_ID
-- DROP INDEX SCM.SCM.IDX_STORE_ID;
CREATE INDEX SCM.IDX_STORE_ID
ON SCM.SCM_SALES_INVC_DET (STORE_ID)
LOGGING
TABLESPACE RHODB
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
NOPARALLEL;
-- INDEX: SCM.SCM.IDX_TAX_CODE_ID
-- DROP INDEX SCM.SCM.IDX_TAX_CODE_ID;
CREATE INDEX SCM.IDX_TAX_CODE_ID
ON SCM.SCM_SALES_INVC_DET (TAX_CODE_ID)
LOGGING
TABLESPACE RHODB
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
NOPARALLEL;
CREATE SEQUENCE SCM.SCM_ITM_SALES_ORDRS_DET_ID_SEQ
START WITH 1
MAXVALUE 9223372036854775807
MINVALUE 1
NOCYCLE
CACHE 20
ORDER;
CREATE OR REPLACE TRIGGER SCM.SCM_ITM_SALES_ORDRS_DET_ID_TRG
BEFORE INSERT
ON SCM.SCM_SALES_INVC_DET
FOR EACH ROW
-- OPTIONALLY RESTRICT THIS TRIGGER TO FIRE ONLY WHEN REALLY NEEDED
WHEN (NEW.INVC_DET_LN_ID IS NULL)
DECLARE
V_ID SCM.SCM_SALES_INVC_DET.INVC_DET_LN_ID%TYPE;
BEGIN
SELECT SCM.SCM_ITM_SALES_ORDRS_DET_ID_SEQ.NEXTVAL INTO V_ID FROM DUAL;
:NEW.INVC_DET_LN_ID := V_ID;
END SCM_ITM_SALES_ORDRS_DET_ID_TRG; | 23.468599 | 75 | 0.722725 |
ae354227f7e894c2ee11cce630036c9b2ab6a34a | 2,372 | kt | Kotlin | app/src/main/java/com/razeware/emitron/notifications/NotificationChannels.kt | hashimshafiq/emitron-Android | 4269e17c4f523a1c554f1d81fd6f41ee624b3360 | [
"Apache-2.0"
] | 54 | 2020-06-24T20:19:55.000Z | 2022-03-07T18:51:56.000Z | app/src/main/java/com/razeware/emitron/notifications/NotificationChannels.kt | hashimshafiq/emitron-Android | 4269e17c4f523a1c554f1d81fd6f41ee624b3360 | [
"Apache-2.0"
] | 44 | 2020-08-02T21:06:17.000Z | 2021-09-03T19:52:53.000Z | app/src/main/java/com/razeware/emitron/notifications/NotificationChannels.kt | hashimshafiq/emitron-Android | 4269e17c4f523a1c554f1d81fd6f41ee624b3360 | [
"Apache-2.0"
] | 30 | 2020-07-20T17:30:19.000Z | 2022-01-29T16:55:59.000Z | package com.razeware.emitron.notifications
import android.annotation.TargetApi
import android.app.Application
import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.Context
import android.content.ContextWrapper
import android.os.Build
import androidx.annotation.RequiresApi
import com.razeware.emitron.R
class NotificationChannels
/**
* Constructor
*
* @param context The application context
*/
@RequiresApi(api = Build.VERSION_CODES.O)
private constructor(context: Context, private val notificationManager: NotificationManager) :
ContextWrapper(context) {
/**
* Registers notification channels, which can be used later by individual notifications.
*/
@RequiresApi(api = Build.VERSION_CODES.O)
fun createNotificationChannels() {
createLowImpChannel(
channelIdPlayback,
getString(R.string.notification_channel_playback)
)
createLowImpChannel(channelIdOther, getString(R.string.notification_channel_others))
}
/**
* This method creates a channel of Default Importance
*/
@RequiresApi(api = Build.VERSION_CODES.O)
private fun createLowImpChannel(
channelId: String,
channelName: String
) {
val notificationChannel =
NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_LOW)
.apply {
enableLights(false)
setShowBadge(false)
setBypassDnd(false)
enableVibration(false)
lockscreenVisibility = Notification.VISIBILITY_PUBLIC
}
notificationManager.createNotificationChannel(notificationChannel)
}
companion object {
/**
* Channel id playback
*/
const val channelIdPlayback: String = "notification.channel.playback"
/**
* Channel id others
*/
const val channelIdOther: String = "notification.channel.others"
/**
* Channel id others
*/
const val channelIdDownloads: String = "notification.channel.downloads"
/**
* Create new instance of NotificationChannels
*
* @return NotificationChannels
*/
@TargetApi(Build.VERSION_CODES.O)
fun newInstance(context: Application): NotificationChannels =
NotificationChannels(
context,
(context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager)
)
}
}
| 27.264368 | 93 | 0.728078 |
3be8b0f5e21d42e121dcfb6c31d013d26320df45 | 274 | swift | Swift | test/Interpreter/SDK/Foundation_NSLog.swift | YogeshBharate/Swift | a14a836caa42b1652f8f30b725370eff2ad6d799 | [
"Apache-2.0"
] | 825 | 2015-12-09T05:44:26.000Z | 2021-11-13T15:01:11.000Z | test/Interpreter/SDK/Foundation_NSLog.swift | YogeshBharate/Swift | a14a836caa42b1652f8f30b725370eff2ad6d799 | [
"Apache-2.0"
] | 19 | 2015-12-10T00:57:59.000Z | 2021-05-25T15:57:05.000Z | test/Interpreter/SDK/Foundation_NSLog.swift | YogeshBharate/Swift | a14a836caa42b1652f8f30b725370eff2ad6d799 | [
"Apache-2.0"
] | 45 | 2015-12-10T14:21:43.000Z | 2017-05-26T02:43:30.000Z | // RUN: %target-run-simple-swift 2>&1 | FileCheck %s
// REQUIRES: executable_test
// REQUIRES: objc_interop
import Foundation
// CHECK: 1 is the loneliest number that you'll ever do
NSLog(
"%@ is the loneliest number that you'll ever %@",
NSNumber(value: 1), "do"
)
| 21.076923 | 55 | 0.689781 |
3d7a04c748ffb9a89cec1ccd709e3d20e822916d | 2,952 | rs | Rust | src/features.rs | regexident/trybuild | a6b3b2cba3f7b3fc426721b4aabfd8093254cc78 | [
"Apache-2.0",
"MIT"
] | 433 | 2019-05-06T16:58:27.000Z | 2022-03-31T15:06:16.000Z | src/features.rs | regexident/trybuild | a6b3b2cba3f7b3fc426721b4aabfd8093254cc78 | [
"Apache-2.0",
"MIT"
] | 108 | 2019-05-07T11:13:51.000Z | 2022-03-25T06:51:07.000Z | src/features.rs | regexident/trybuild | a6b3b2cba3f7b3fc426721b4aabfd8093254cc78 | [
"Apache-2.0",
"MIT"
] | 63 | 2019-06-15T12:07:14.000Z | 2022-03-30T08:21:43.000Z | use serde::de::DeserializeOwned;
use serde::{de, Deserialize, Deserializer};
use std::env;
use std::error::Error;
use std::ffi::OsStr;
use std::fs;
use std::path::PathBuf;
pub fn find() -> Option<Vec<String>> {
try_find().ok()
}
struct Ignored;
impl<E: Error> From<E> for Ignored {
fn from(_error: E) -> Self {
Ignored
}
}
#[derive(Deserialize)]
struct Build {
#[serde(deserialize_with = "from_json")]
features: Vec<String>,
}
fn try_find() -> Result<Vec<String>, Ignored> {
// This will look something like:
// /path/to/crate_name/target/debug/deps/test_name-HASH
let test_binary = env::args_os().next().ok_or(Ignored)?;
// The hash at the end is ascii so not lossy, rest of conversion doesn't
// matter.
let test_binary_lossy = test_binary.to_string_lossy();
let hash_range = if cfg!(windows) {
// Trim ".exe" from the binary name for windows.
test_binary_lossy.len() - 21..test_binary_lossy.len() - 4
} else {
test_binary_lossy.len() - 17..test_binary_lossy.len()
};
let hash = test_binary_lossy.get(hash_range).ok_or(Ignored)?;
if !hash.starts_with('-') || !hash[1..].bytes().all(is_lower_hex_digit) {
return Err(Ignored);
}
let binary_path = PathBuf::from(&test_binary);
// Feature selection is saved in:
// /path/to/crate_name/target/debug/.fingerprint/*-HASH/*-HASH.json
let up = binary_path
.parent()
.ok_or(Ignored)?
.parent()
.ok_or(Ignored)?;
let fingerprint_dir = up.join(".fingerprint");
if !fingerprint_dir.is_dir() {
return Err(Ignored);
}
let mut hash_matches = Vec::new();
for entry in fingerprint_dir.read_dir()? {
let entry = entry?;
let is_dir = entry.file_type()?.is_dir();
let matching_hash = entry.file_name().to_string_lossy().ends_with(hash);
if is_dir && matching_hash {
hash_matches.push(entry.path());
}
}
if hash_matches.len() != 1 {
return Err(Ignored);
}
let mut json_matches = Vec::new();
for entry in hash_matches[0].read_dir()? {
let entry = entry?;
let is_file = entry.file_type()?.is_file();
let is_json = entry.path().extension() == Some(OsStr::new("json"));
if is_file && is_json {
json_matches.push(entry.path());
}
}
if json_matches.len() != 1 {
return Err(Ignored);
}
let build_json = fs::read_to_string(&json_matches[0])?;
let build: Build = serde_json::from_str(&build_json)?;
Ok(build.features)
}
fn is_lower_hex_digit(byte: u8) -> bool {
byte >= b'0' && byte <= b'9' || byte >= b'a' && byte <= b'f'
}
fn from_json<'de, T, D>(deserializer: D) -> Result<T, D::Error>
where
T: DeserializeOwned,
D: Deserializer<'de>,
{
let json = String::deserialize(deserializer)?;
serde_json::from_str(&json).map_err(de::Error::custom)
}
| 28.114286 | 80 | 0.610434 |
414debccbeb68a80ce3479ffc2429b233ada6f2c | 2,805 | c | C | framework/private/integration-test/test_launcher/src/launcher.c | rwalraven343/celix | 353ac0d2e0f819f8f59d4cdf8ea1dfd701201d74 | [
"Apache-2.0"
] | 1 | 2019-03-17T06:06:19.000Z | 2019-03-17T06:06:19.000Z | framework/private/integration-test/test_launcher/src/launcher.c | rwalraven343/celix | 353ac0d2e0f819f8f59d4cdf8ea1dfd701201d74 | [
"Apache-2.0"
] | 13 | 2019-02-21T21:27:44.000Z | 2019-02-28T22:47:13.000Z | framework/private/integration-test/test_launcher/src/launcher.c | rwalraven343/celix | 353ac0d2e0f819f8f59d4cdf8ea1dfd701201d74 | [
"Apache-2.0"
] | null | null | null | /**
*Licensed to the Apache Software Foundation (ASF) under one
*or more contributor license agreements. See the NOTICE file
*distributed with this work for additional information
*regarding copyright ownership. The ASF licenses this file
*to you under the Apache License, Version 2.0 (the
*"License"); you may not use this file except in compliance
*with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*Unless required by applicable law or agreed to in writing,
*software distributed under the License is distributed on an
*"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
*specific language governing permissions and limitations
*under the License.
*/
/*
* launcher.c
*
* \date Mar 23, 2010
* \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <signal.h>
#include <apr_general.h>
#include <unistd.h>
#include "framework_private.h"
#include "properties.h"
#include "bundle_context.h"
#include "bundle.h"
#include "linked_list_iterator.h"
#include "celix_log.h"
int main(void) {
apr_status_t rv = APR_SUCCESS;
apr_status_t s = APR_SUCCESS;
properties_pt config = NULL;
char *autoStart = NULL;
apr_pool_t *pool = NULL;
bundle_pt fwBundle = NULL;
rv = apr_initialize();
if (rv != APR_SUCCESS) {
return CELIX_START_ERROR;
}
apr_pool_t *memoryPool;
s = apr_pool_create(&memoryPool, NULL);
if (s != APR_SUCCESS) {
return CELIX_START_ERROR;
}
struct framework * framework = NULL;
celix_status_t status = CELIX_SUCCESS;
status = framework_create(&framework, memoryPool, config);
if (status == CELIX_SUCCESS) {
status = fw_init(framework);
if (status == CELIX_SUCCESS) {
// Start the system bundle
framework_getFrameworkBundle(framework, &fwBundle);
bundle_start(fwBundle);
bundle_context_pt context = NULL;
bundle_getContext(fwBundle, &context);
// do some stuff
bundle_pt bundle = NULL;
status = CELIX_DO_IF(status, bundleContext_installBundle(context, "../test_bundle1/test_bundle1.zip", &bundle));
status = CELIX_DO_IF(status, bundle_start(bundle));
// Stop the system bundle, sleep a bit to let stuff settle down
sleep(5);
bundle_stop(fwBundle);
framework_destroy(framework);
}
}
if (status != CELIX_SUCCESS) {
printf("Problem creating framework\n");
}
apr_pool_destroy(memoryPool);
apr_terminate();
printf("LAUNCHER: Exit\n");
return 0;
}
| 29.526316 | 124 | 0.678431 |
f02486bcf13432de9a097041e6bbb09657874641 | 604 | js | JavaScript | public/assets/js/customjs.js | Otavioensa/pagarme-checkout | fe6142a0fb568f7cd76813ddeb4ef12cf790c2c9 | [
"MIT"
] | null | null | null | public/assets/js/customjs.js | Otavioensa/pagarme-checkout | fe6142a0fb568f7cd76813ddeb4ef12cf790c2c9 | [
"MIT"
] | null | null | null | public/assets/js/customjs.js | Otavioensa/pagarme-checkout | fe6142a0fb568f7cd76813ddeb4ef12cf790c2c9 | [
"MIT"
] | null | null | null | /* eslint-disable */
$(function() {
var pop = $('.popbtn');
var row = $('.row:not(:first):not(:last)');
pop.popover({
trigger: 'manual',
html: true,
container: 'body',
placement: 'bottom',
animation: false,
content: function() {
return $('#popover').html();
}
});
pop.on('click', function(e) {
pop.popover('toggle');
pop.not(this).popover('hide');
});
$(window).on('resize', function() {
pop.popover('hide');
});
row.on('touchend', function(e) {
$(this).find('.popbtn').popover('toggle');
row.not(this).find('.popbtn').popover('hide');
return false;
});
});
| 17.257143 | 48 | 0.571192 |
906cb24430368bbd0d42d9772bc9288f1d819d12 | 3,400 | py | Python | simeng/ioutil.py | wstlabs/similarity-engine | fde4dd31b0f1738573513159f950823cb2d4a7ce | [
"Apache-2.0"
] | null | null | null | simeng/ioutil.py | wstlabs/similarity-engine | fde4dd31b0f1738573513159f950823cb2d4a7ce | [
"Apache-2.0"
] | null | null | null | simeng/ioutil.py | wstlabs/similarity-engine | fde4dd31b0f1738573513159f950823cb2d4a7ce | [
"Apache-2.0"
] | null | null | null | import csv
from copy import deepcopy
import simplejson as json
"""
A few simple idioms for slurping + saving to/from CSV/JSON, to cut down on boilerplate
in our test + demo suites (and avoid dependencies on much heavier external packages
that provide similar conveniences).
"""
class TinyFrame(object):
"""
An extremely primitive "data frame"-like object, which projects just
enough abstraction to make our CSV i/o a little bit easier, for our needs.
Namely: reads from a row iterator (most like a csv.reader instance);
expects header (or not) as the row yielded by that iterator; and stashes
a list of types to apply on emitted rows (on the way out).
"""
def __init__(self,stream,types=None,expect_header=True):
"""
Creates a dataframe instance, fully ingesting the rowset of interest (from the
given :stream object) at instantiation time.
:stream: - a row iterator from our input source (most likely a csv.reader object)
:types: - a list of types to apply to logical row values (on the way out, via self.rows)
:expect_header: - a directive specifying whether to skip the first row from our
input source (presumably a header) upon ingestion. Note that the 'header' as
such is simply skipped, and not kept or made use of in any functional way.
"""
self._rowset = None
self._types = deepcopy(types)
self._ingest(stream,expect_header)
def _ingest(self,stream,expect_header):
if expect_header:
next(stream)
self._rowset = list(stream)
def rows(self):
"""Yields from our rowset of interest, applying the type list (supplied to
the constructor) to emitted values the way out."""
types = self._types
if types is None:
yield from self._rowset
else:
for row in self._rowset:
yield list(apply_types(types,row))
def apply_types(types,values):
"""Applies an iterable of :types to an iterable of :values (unless they
already match, in which case we pass the value through, to spare the expense
of copying)."""
if types is None:
raise ValueError("need a types list")
for t,v in zip(types,values):
if type(v) is t:
yield v
else:
yield t(v)
def _load_csv(path,encoding='utf-8',types=None,expect_header=True,csvargs=None):
if csvargs is None:
csvargs = {}
with open(path,"rt",encoding=encoding) as f:
reader = csv.reader(f,**csvargs)
return TinyFrame(reader,types=types,expect_header=expect_header)
#
# These are the functions you'd actually want to export.
#
def slurp_csv(*args,**kwargs):
tiny = _load_csv(*args,**kwargs)
return list(tiny.rows())
def save_csv(path,rowset,encoding='utf-8',header=None,csvargs=None):
if csvargs is None:
csvargs = {}
with open(path,"wt",encoding=encoding) as f:
writer = csv.writer(f,**csvargs)
if header:
writer.writerow(header)
for row in rowset:
writer.writerow(row)
def save_json(path,obj,sort_keys=True,indent=4):
with open(path,"wt",encoding="utf-8") as f:
f.write(json.dumps(obj,sort_keys=sort_keys,indent=indent))
def slurp_json(path,encoding='utf-8'):
f = open(path,"rt",encoding=encoding)
return json.load(f)
| 34.693878 | 96 | 0.658529 |
9f70ab94f63f81ea1b2d09cccd7b56743a2a1c85 | 2,741 | sql | SQL | sql/stored_procedures.sql | glichfalls/covid-19-charts | 52e9b78632388d3459bdc04f91513c00eaee000c | [
"MIT"
] | null | null | null | sql/stored_procedures.sql | glichfalls/covid-19-charts | 52e9b78632388d3459bdc04f91513c00eaee000c | [
"MIT"
] | null | null | null | sql/stored_procedures.sql | glichfalls/covid-19-charts | 52e9b78632388d3459bdc04f91513c00eaee000c | [
"MIT"
] | null | null | null |
use Covid19;
if(OBJECT_ID(N'create_continent') IS NOT NULL)
begin
drop procedure create_continent;
end
go
create procedure create_continent
@name varchar(50),
@new_identity int = null output
as begin
set nocount on;
insert into Continent (con_name) values (@name);
set @new_identity = SCOPE_IDENTITY();
end
go
if(OBJECT_ID(N'create_country') IS NOT NULL)
begin
drop procedure create_country;
end
go
create procedure create_country
@continent int,
@iso_code varchar(20),
@name varchar(50),
@population int,
@new_identity int = null output
as begin
set nocount on;
insert into Country (con_id, cty_iso_code, cty_location, cty_population) values (@continent, @iso_code, @name, @population);
set @new_identity = SCOPE_IDENTITY();
end
go
if(OBJECT_ID(N'create_cases') IS NOT NULL)
begin
drop procedure create_cases;
end
go
create procedure create_cases
@country int,
@date date,
@total_cases int,
@new_cases int,
@total_deaths int,
@new_deaths int,
@reproduction_rate float
as begin
set nocount on;
insert into Cases (
cty_id,
cas_date,
cas_total_cases,
cas_new_cases,
cas_total_deaths,
cas_new_deaths,
cas_reproduction_rate
) values (
@country,
@date,
@total_cases,
@new_cases,
@total_deaths,
@new_deaths,
@reproduction_rate
);
end
go
if(OBJECT_ID(N'create_tests') IS NOT NULL)
begin
drop procedure create_tests;
end
go
create procedure create_tests
@country int,
@date date,
@new_tests int,
@total_tests int,
@positive_rate int
as begin
set nocount on;
insert into Tests (
cty_id,
tes_date,
tes_new_tests,
tes_total_tests,
tes_positive_rate
) values (
@country,
@date,
@new_tests,
@total_tests,
@positive_rate
);
end
go
if(OBJECT_ID(N'create_vaccinations') IS NOT NULL)
begin
drop procedure create_vaccinations;
end
go
create procedure create_vaccinations
@country int,
@date date,
@total_vaccinations int,
@people_vaccinated int,
@people_fully_vaccinated int,
@new_vaccinations int
as begin
set nocount on;
insert into Vaccinations (
cty_id,
vac_date,
vac_total_vaccinations,
vac_people_vaccinated,
vac_people_fully_vaccinated,
vac_new_vaccinations
) values (
@country,
@date,
@total_vaccinations,
@people_vaccinated,
@people_fully_vaccinated,
@new_vaccinations
);
end
go | 20.154412 | 128 | 0.634075 |
a0f4860071e7a2fe301e8b7d2e0f8b0777150847 | 3,169 | swift | Swift | Sources/HeaderMapCore/HeaderMapError.swift | milend/hmap | ccc2484de27cfca1f80ae6d865f65bd14faa5bb0 | [
"MIT"
] | 233 | 2017-08-21T09:53:35.000Z | 2022-03-31T11:47:55.000Z | Sources/HeaderMapCore/HeaderMapError.swift | milend/hmap | ccc2484de27cfca1f80ae6d865f65bd14faa5bb0 | [
"MIT"
] | 1 | 2018-07-23T22:08:17.000Z | 2018-07-24T20:31:35.000Z | Sources/HeaderMapCore/HeaderMapError.swift | milend/hmap | ccc2484de27cfca1f80ae6d865f65bd14faa5bb0 | [
"MIT"
] | 29 | 2017-11-12T19:39:05.000Z | 2022-03-22T07:39:46.000Z | // MIT License
//
// Copyright (c) 2017 Milen Dzhumerov
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
import Foundation
public enum HeaderMapError: LocalizedError {
case unencodableString
}
public enum HeaderMapParseError: LocalizedError {
case missingDataHeader
case unknownFileMagic
case invalidVersion(expected: UInt16, found: UInt16)
case reservedValueMismatch(expected: UInt16, found: UInt16)
case outOfBoundsStringSectionOffset
case bucketCountNotPowerOf2(found: UInt32)
case bucketsSectionOverflow
}
public enum HeaderMapCreateError: LocalizedError {
case invalidStringSectionOffset
case stringWithoutOffsetInTable
case hashTableFull
case unhashableKey
case emptyDataBuffer
}
extension HeaderMapError {
public var errorDescription: String? {
switch self {
case .unencodableString:
return "String cannot be encoded"
}
}
}
extension HeaderMapParseError {
public var errorDescription: String? {
switch self {
case .missingDataHeader:
return "File is missing a header section"
case .unknownFileMagic:
return "File magic is unknown"
case .invalidVersion(let expected, let found):
return "Found invalid version \(found), expected \(expected)"
case .reservedValueMismatch(let expected, let found):
return "Found invalid reserved value \(found), expected \(expected)"
case .outOfBoundsStringSectionOffset:
return "String offset is out of bounds"
case .bucketCountNotPowerOf2(let buckets):
return "Bucket count is not a power of 2, found \(buckets) buckets"
case .bucketsSectionOverflow:
return "Bucket section overflows"
}
}
}
extension HeaderMapCreateError {
public var errorDescription: String? {
switch self {
case .invalidStringSectionOffset:
return "The string section offset is invalid"
case .stringWithoutOffsetInTable:
return "String not present in string section"
case .hashTableFull:
return "Header map is full"
case .unhashableKey:
return "Key cannot be hashed"
case .emptyDataBuffer:
return "Failed to allocate data buffer"
}
}
}
| 34.075269 | 81 | 0.746608 |
b09c7f631469fca602093145b4265224a0135034 | 1,145 | swift | Swift | solutions/Problems/Easy/125_Valid_Palindrome.swift | atereshkov/leetcode-swift | 002ff15e6fb1a01d62c4fa54adbc2fbd0271bda2 | [
"MIT"
] | 2 | 2022-01-30T19:22:36.000Z | 2022-03-12T09:19:22.000Z | solutions/Problems/Easy/125_Valid_Palindrome.swift | atereshkov/leetcode-swift | 002ff15e6fb1a01d62c4fa54adbc2fbd0271bda2 | [
"MIT"
] | null | null | null | solutions/Problems/Easy/125_Valid_Palindrome.swift | atereshkov/leetcode-swift | 002ff15e6fb1a01d62c4fa54adbc2fbd0271bda2 | [
"MIT"
] | null | null | null | /*
A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers.
Given a string s, return true if it is a palindrome, or false otherwise.
Example 1:
Input: s = "A man, a plan, a canal: Panama"
Output: true
Explanation: "amanaplanacanalpanama" is a palindrome.
Example 2:
Input: s = "race a car"
Output: false
Explanation: "raceacar" is not a palindrome.
Example 3:
Input: s = " "
Output: true
Explanation: s is an empty string "" after removing non-alphanumeric characters.
Since an empty string reads the same forward and backward, it is a palindrome.
Constraints:
1 <= s.length <= 2 * 105
s consists only of printable ASCII characters.
*/
import Foundation
func isPalindrome(_ s: String) -> Bool {
let str = s
.components(separatedBy: CharacterSet.alphanumerics.inverted).joined()
.lowercased()
if str.isEmpty {
return true
}
if str == String(str.reversed()) {
return true
}
return false
}
| 26.022727 | 230 | 0.704803 |
2631a35a1edadefc8f2e772b112883461220d442 | 1,775 | java | Java | rspl-service-persistence-redis/src/test/java/org/flowninja/persistence/rspl/redis/components/CIDR4AddressRedisSerializerTest.java | rbieniek/flow-ninja | dcc0e23514e455dfdce666093e2cac3772c7e7e5 | [
"Apache-2.0"
] | null | null | null | rspl-service-persistence-redis/src/test/java/org/flowninja/persistence/rspl/redis/components/CIDR4AddressRedisSerializerTest.java | rbieniek/flow-ninja | dcc0e23514e455dfdce666093e2cac3772c7e7e5 | [
"Apache-2.0"
] | null | null | null | rspl-service-persistence-redis/src/test/java/org/flowninja/persistence/rspl/redis/components/CIDR4AddressRedisSerializerTest.java | rbieniek/flow-ninja | dcc0e23514e455dfdce666093e2cac3772c7e7e5 | [
"Apache-2.0"
] | null | null | null | /**
*
*/
package org.flowninja.persistence.rspl.redis.components;
import static org.fest.assertions.api.Assertions.*;
import java.nio.charset.Charset;
import org.flowninja.types.net.CIDR4Address;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.serializer.SerializationException;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author rainer
*
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes=CIDR4AddressRedisSerializerTest.Config.class)
public class CIDR4AddressRedisSerializerTest {
@Configuration
public static class Config {
@Bean
public CIDR4AddressRedisSerializer serializer() {
return new CIDR4AddressRedisSerializer();
}
}
@Autowired
private CIDR4AddressRedisSerializer serializer;
@Test
public void serialize() {
assertThat(serializer.serialize(new CIDR4Address(new byte[] {(byte)0xc0, (byte)0xa8, (byte)0x00, (byte)0x00}, 16)))
.isEqualTo((new String("cidr:c0a80000/16")).getBytes(Charset.forName("ASCII")));
}
@Test
public void deserialize() {
assertThat(serializer.deserialize((new String("cidr:c0a80000/16")).getBytes(Charset.forName("ASCII"))))
.isEqualTo(new CIDR4Address(new byte[] {(byte)0xc0, (byte)0xa8, (byte)0x00, (byte)0x00}, 16));
}
@Test(expected=SerializationException.class)
public void deserializeNull() {
serializer.deserialize(null);
}
@Test(expected=SerializationException.class)
public void serializeNull() {
serializer.serialize(null);
}
}
| 28.629032 | 117 | 0.778028 |
5f4845be12bb87857a282a0baf9c452097557ba1 | 1,146 | ts | TypeScript | src/app/pages/tags/tags.component.ts | igorosabel/Logger | e2ef8407dfc2ded3d0783e498f2daf4e7f6dfe06 | [
"MIT"
] | null | null | null | src/app/pages/tags/tags.component.ts | igorosabel/Logger | e2ef8407dfc2ded3d0783e498f2daf4e7f6dfe06 | [
"MIT"
] | 1 | 2022-03-29T21:15:37.000Z | 2022-03-29T21:15:37.000Z | src/app/pages/tags/tags.component.ts | igorosabel/Logger | e2ef8407dfc2ded3d0783e498f2daf4e7f6dfe06 | [
"MIT"
] | null | null | null | import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute, Params} from '@angular/router';
import { ApiService } from '../../services/api.service';
import { ClassMapperService } from '../../services/class-mapper.service';
import { DataShareService } from '../../services/data-share.service';
import { Tag } from '../../model/tag.model';
@Component({
selector: 'app-tags',
templateUrl: './tags.component.html',
styleUrls: []
})
export class TagsComponent implements OnInit {
loading: boolean = true;
username: string;
tagList: Tag[];
constructor(private activatedRoute: ActivatedRoute, private router: Router, private dss: DataShareService, private as: ApiService, private cms: ClassMapperService) {
this.tagList = [];
}
ngOnInit() {
this.dss.setGlobal('where', 'tags');
this.activatedRoute.params.subscribe((params: Params) => {
this.username = params.username;
this.loadTags();
});
}
loadTags() {
this.as.getTags().subscribe(response => {
if (response.status=='ok') {
this.tagList = this.cms.getTags(response);
this.loading = false;
}
});
}
} | 30.157895 | 166 | 0.668412 |
7fa049d4ed7a16599070c2f6723aa71fdcdc432b | 2,078 | swift | Swift | Example/SOXSegmentControl/Example View Controllers/RainbowSegmentControlViewController.swift | twilightDD/SOXSegmentControl | 0117ccac0ac2b0a749a617ada449f7195059652d | [
"MIT"
] | 1 | 2020-04-29T18:40:53.000Z | 2020-04-29T18:40:53.000Z | Example/SOXSegmentControl/Example View Controllers/RainbowSegmentControlViewController.swift | twilightDD/SOXSegmentControl | 0117ccac0ac2b0a749a617ada449f7195059652d | [
"MIT"
] | null | null | null | Example/SOXSegmentControl/Example View Controllers/RainbowSegmentControlViewController.swift | twilightDD/SOXSegmentControl | 0117ccac0ac2b0a749a617ada449f7195059652d | [
"MIT"
] | null | null | null | //
// RainbowSegmentControlViewController.swift
// SOXSegmentControl
//
// Created by Peter Hauke on 25.04.20.
// Copyright © 2020 CocoaPods. All rights reserved.
//
import UIKit
import SOXSegmentControl
class RainbowSegmentControlViewController: UIViewController {
//MARK: - Properties
//MARK: - IBOutlets
@IBOutlet private weak var segmentControl: SOXSegmentControl!
//MARK: - Init&Co.
override func viewDidLoad() {
super.viewDidLoad()
setupSegmentControl()
}
//MARK: - Action Methods
@IBAction func segmentControllAction(_ sender: SOXSegmentControl) {
print("Selected segment with index \(sender.selectedSegmentIndex)")
}
}
//MARK: - Setup
extension RainbowSegmentControlViewController {
private func setupSegmentControl() {
segmentControl.backgroundColor = .clear
segmentControl.textPosition = .bottom
segmentControl.selectorType = .underlineBar
let segments = [SOXSegmentDescriptor(title: "A",
imageName: "a.circle",
color: .systemPurple),
SOXSegmentDescriptor(title: "B",
imageName: "b.circle",
color: .systemBlue),
SOXSegmentDescriptor(title: "C",
imageName: "c.circle",
color: .systemGreen),
SOXSegmentDescriptor(title: "D",
imageName: "d.circle",
color: .systemYellow),
SOXSegmentDescriptor(title: "E",
imageName: "e.circle",
color: .systemRed)
]
segmentControl.setSegmentDescriptors([segments])
segmentControl.selectedSegmentPath = SOXIndexPath(row: 0, column: 2)
}
}
| 30.558824 | 76 | 0.517806 |
98e0050de01e5766ab0ffae5cb760bec1d8d5e68 | 2,229 | html | HTML | web/src/template.html | brunesto/icesat2webview | c310986ceb8efb1f3a9937ca6b9eb29b020cb0ec | [
"MIT"
] | null | null | null | web/src/template.html | brunesto/icesat2webview | c310986ceb8efb1f3a9937ca6b9eb29b020cb0ec | [
"MIT"
] | 1 | 2020-12-11T23:37:26.000Z | 2020-12-11T23:37:26.000Z | web/src/template.html | brunesto/icesat2webview | c310986ceb8efb1f3a9937ca6b9eb29b020cb0ec | [
"MIT"
] | 2 | 2020-11-13T10:35:27.000Z | 2021-03-07T10:24:47.000Z | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- hack to load egm96 from cdn -->
<!-- 1 load dependency -->
<xxxscript src="site/rfc4648.js"></xxxscript>
<script>
</script>
<!-- 3 load egm96 from cdn-->>
<xxxscript defer async src="https://unpkg.com/egm96-universal@1.0.2/dist/egm96-universal.cjs.js"></xxscript>
<!-- retrieve egm96 object from fake module-->
<script>
</script>
<!-- end of egm96 cdn hack-->
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<div id="root">
<div id="crossHair">⌖</div>
<div id="alertInfoWrap">
<div id="alertInfo" class="alert alert-info" role="alert"></div>
</div>
<div id="btnBar" style="display:none">
<div class="button" id="switchLayerBtn" title="Switch map layer">
<div id="switchLayerBtnLabel"> <i class="material-icons">map</i>Change map</div>
<div id="switchLayerBtnPreview"></div>
</div>
<div class="button" id="locateBtn" title="Center the map around your position">
<i class="material-icons">face</i>Where am I?</div>
<div class="button" id="gotoCoordsBtn" title="Center the map around given coordinates"> <i
class="material-icons">location_on</i>Goto...</div>
<div class="button" id="polygonBtn" title="Show the visible area coordinates">Bbox</div>
<div class="button toggle-button" class="btn btn-primary" id="atl08Btn" title="Toggle ATL08">
<div><i class="material-icons">nature</i>ATL08
<div class="toggle-button-marker"></div>
</div>
</div>
<div class="button" id="egm96Btn" title="Download geoid altitude (~3Mb the 1st time)">
<i class="material-icons">terrain</i><span>EGM96<span></div>
<div class="button btn btn-primary" id="helpBtn" title="Help"> <i class="material-icons">help_outline</i>Help
</div>
</div>
<div id="mapContainer">
<div id="map"></div>
</div>
</div>
</body>
</html> | 31.394366 | 115 | 0.62629 |
94b79e9d40d47dc8200ff7fa249f664e3587002a | 2,245 | sql | SQL | views & indexes & grants/Example_8_sol.sql | gbouzon/sql_test | 9ea7cccf8a81ef238712bb370d68945e3f617e17 | [
"MIT"
] | null | null | null | views & indexes & grants/Example_8_sol.sql | gbouzon/sql_test | 9ea7cccf8a81ef238712bb370d68945e3f617e17 | [
"MIT"
] | null | null | null | views & indexes & grants/Example_8_sol.sql | gbouzon/sql_test | 9ea7cccf8a81ef238712bb370d68945e3f617e17 | [
"MIT"
] | null | null | null | -- 1.Create a sequence named rent_num_seq to start with 1100, increment by 10,
-- and do not cache any values.
CREATE SEQUENCE RENT_NUM_SEQ
START WITH 1100
INCREMENT BY 10
NOCACHE;
--2. Insert a new row in the rental table using the sequence created in #1
-- above to generate the value for RENT_NUM, the current system date for
-- the value for RENT_DATE, and the membership number MEM_NUM.
INSERT INTO RENTAL VALUES(RENT_NUM_SEQ.NEXTVAL, SYSDATE, '103');
ROLLBACK;
SELECT * FROM RENTAL;
COMMIT;
-- 3. Check the next value after the new row is inserted?
SELECT * FROM USER_SEQUENCES;
--4. The RENTAL and DETAILRENTAL tables are related in a one-to-many relationship
-- through the RENT_NUM attribute. Use the CURRVAL method in the rent_num_seq
-- sequence to get the latest Rent_num used and assign it to the related Rent_num
-- foreign key attribute in the DETAILRENTAL table.
SELECT * FROM DETAILRENTAL;
INSERT INTO DETAILRENTAL VALUES (RENT_NUM_SEQ.CURRVAL, 54324, NULL,NULL,NULL, NULL);
-- 5. Create a sequence named mem_num_seq. Test your sequence by inserting
-- a new row in MEMBERSHIP table
SELECT * FROM MEMBERSHIP ;
CREATE SEQUENCE mem_num_seq
START WITH 110;
INSERT INTO MEMBERSHIP VALUES(mem_num_seq.NEXTVAL, 'John', 'Smith', '5327 West 145th Avenue', 'Norene', 'TN', '76439', 10);
-- 6. Check all of the sequences you have created
SELECT * FROM USER_SEQUENCES;
-- 7. Alter rent_num_seq to pre_allocate sequence 100 numbers in memory.
ALTER SEQUENCE RENT_NUM_SEQ
CACHE 100;
-- INVALID ALTER WHY???
ALTER SEQUENCE RENT_NUM_SEQ
START WITH 100;
-- INVALID ALTER WHY???
ALTER SEQUENCE RENT_NUM_SEQ
MAXVALUE 100;
--8. Drop the sequence created earlier
DROP SEQUENCE RENT_NUM_SEQ;
--9. Create a view to display the membership number, last name, first name,
-- and total rental fees earned from that membership.
-- The total rental fee is the sum of all of the detail fees (without
-- the late fees) from all movies that the membership has rented
CREATE VIEW MEMBER_VIEW
AS SELECT M.MEM_NUM, MEM_LNAME, MEM_FNAME, SUM(DETAIL_FEE) DETAIL_FEE
FROM MEMBERSHIP M, RENTAL R, DETAILRENTAL D
WHERE M.MEM_NUM = R.MEM_NUM
AND R.RENT_NUM = D.RENT_NUM
GROUP BY M.MEM_NUM, MEM_LNAME, MEM_FNAME;
SELECT * FROM MEMBER_VIEW;
| 31.180556 | 123 | 0.766592 |
fb49859af3b58240ab93cd123480631c791f4d02 | 919 | java | Java | MarvelTest/src/main/java/com/marveltest/RestClient.java | AlexOblizin/Repo.Homework | b5bc745084ae68d2d466b9f576747c507bc30d84 | [
"Unlicense"
] | null | null | null | MarvelTest/src/main/java/com/marveltest/RestClient.java | AlexOblizin/Repo.Homework | b5bc745084ae68d2d466b9f576747c507bc30d84 | [
"Unlicense"
] | null | null | null | MarvelTest/src/main/java/com/marveltest/RestClient.java | AlexOblizin/Repo.Homework | b5bc745084ae68d2d466b9f576747c507bc30d84 | [
"Unlicense"
] | null | null | null | package com.marveltest;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import org.apache.commons.codec.digest.DigestUtils;
import us.monoid.web.Resty;
public class ConnectionManager {
public static void main(String[] args) throws IOException {
String publicKey = "d0a2017f2ba25cd9f2d8f74a61bb1c98";
String privateKey = "bf68fa8c68d2b3ccbb6f51d35d57b971928ab615";
long timeStamp = System.currentTimeMillis();
int limit = 5;
String stringToHash = timeStamp + privateKey + publicKey;
String hash = DigestUtils.md5Hex(stringToHash);
String url = String.format("http://gateway.marvel.com/v1/public/characters?ts=%d&apikey=%s&hash=%s&limit=%d", timeStamp, publicKey, hash, limit);
String output = new Resty().text(url).toString();
System.out.println(output);
}
}
| 36.76 | 157 | 0.677911 |
28538600466c761a011bfd17fd66522cbf03562b | 3,720 | swift | Swift | DKHelper/DKHelperTests/CGSizeTests.swift | tschob/DKHelper | 8c452a974500a63f13554391e9d3f4197d971abd | [
"MIT"
] | null | null | null | DKHelper/DKHelperTests/CGSizeTests.swift | tschob/DKHelper | 8c452a974500a63f13554391e9d3f4197d971abd | [
"MIT"
] | null | null | null | DKHelper/DKHelperTests/CGSizeTests.swift | tschob/DKHelper | 8c452a974500a63f13554391e9d3f4197d971abd | [
"MIT"
] | null | null | null | //
// CGSizeTests.swift
// DKHelper
//
// Created by kevin delord on 05/11/15.
// Copyright © 2015 Kevin Delord. All rights reserved.
//
import XCTest
@testable import DKHelper
class CGSizeTests: XCTestCase {
private func checkSizeValues(size: CGSize, width: CGFloat, height: CGFloat) {
XCTAssertEqual(size.height, height)
XCTAssertEqual(size.width, width)
}
}
// MARK: - CGSizeFitToCGRect
extension CGSizeTests {
func test_ShouldFitToRectSquare() {
let size = CGSize(width: 200, height: 200)
let container = CGSize(width: 100, height: 100)
self.checkSizeValues(CGSizeFitToCGSize(size, container), width: 100, height: 100)
}
func test_ShouldFitToRectWidth() {
let size = CGSize(width: 100, height: 200)
let container = CGSize(width: 60, height: 80)
self.checkSizeValues(CGSizeFitToCGSize(size, container), width: 40, height: 80)
}
func test_ShouldFitToRectSameWidth() {
let size = CGSize(width: 60, height: 200)
let container = CGSize(width: 60, height: 80)
self.checkSizeValues(CGSizeFitToCGSize(size, container), width: 24, height: 80)
}
func test_ShouldFitToRectHeight() {
let size = CGSize(width: 200, height: 200)
let container = CGSize(width: 100, height: 80)
self.checkSizeValues(CGSizeFitToCGSize(size, container), width: 80, height: 80)
}
func test_ShouldFitToRectSameHeight() {
let size = CGSize(width: 200, height: 80)
let container = CGSize(width: 100, height: 80)
self.checkSizeValues(CGSizeFitToCGSize(size, container), width: 100, height: 40)
}
func test_ShouldNotFitToRectSmallerSize() {
let size = CGSize(width: 20, height: 20)
let container = CGSize(width: 100, height: 100)
self.checkSizeValues(CGSizeFitToCGSize(size, container), width: 20, height: 20)
}
func test_ShouldFitToDifferentRatio() {
let size = CGSize(width: 20, height: 200)
let container = CGSize(width: 100, height: 80)
self.checkSizeValues(CGSizeFitToCGSize(size, container), width: 8, height: 80)
}
}
// MARK: - CGSizeAdjustToCGSize
extension CGSizeTests {
func test_ShouldAdjustToSmallerRectSquare() {
let size = CGSize(width: 200, height: 200)
let container = CGSize(width: 100, height: 100)
let fitSize = CGSizeAdjustToCGSize(size, container)
XCTAssertEqual(fitSize.width, 100)
XCTAssertEqual(fitSize.height, 100)
}
func test_ShouldAdjustToBiggerRectSquare() {
let size = CGSize(width: 200, height: 200)
let container = CGSize(width: 1000, height: 1000)
let fitSize = CGSizeAdjustToCGSize(size, container)
XCTAssertEqual(fitSize.width, 1000)
XCTAssertEqual(fitSize.height, 1000)
}
func test_ShouldAdjustToSameRatio() {
let size = CGSize(width: 100, height: 200)
let container = CGSize(width: 400, height: 800)
let fitSize = CGSizeAdjustToCGSize(size, container)
XCTAssertEqual(fitSize.width, 400)
XCTAssertEqual(fitSize.height, 800)
}
func test_ShouldAdjustToDifferentRatio() {
let size = CGSize(width: 20, height: 200)
let container = CGSize(width: 100, height: 80)
let fitSize = CGSizeAdjustToCGSize(size, container)
XCTAssertEqual(fitSize.width, 8)
XCTAssertEqual(fitSize.height, 80)
}
func test_ShouldAdjustToRectSmallerRatio() {
let size = CGSize(width: 200, height: 200)
let container = CGSize(width: 210, height: 10)
let fitSize = CGSizeAdjustToCGSize(size, container)
XCTAssertEqual(fitSize.width, 10)
XCTAssertEqual(fitSize.height, 10)
}
}
// MARK: - CGSizeMultiply
extension CGSizeTests {
func test_ShouldMultiplyCGSize() {
let size = CGSize(width: 100, height: 100)
let scaleFactor = CGFloat(1.5)
let expectedResult = CGSize(width: 150, height: 150)
let multipliedSize = CGSizeMultiply(size, scaleFactor)
XCTAssertEqual(multipliedSize, expectedResult)
}
}
| 29.291339 | 83 | 0.737634 |
d61adb8325892fdd3db9838444977ba5cdc2f258 | 808 | sql | SQL | jcf-data/jcf-query/src/test/resources/db-script/hsql-sql-db-script.sql | wall72/JavaCoreFramework | 91d9fa9966d058ed8bc7dc5a8bc5d8ec0f621d8b | [
"MIT"
] | null | null | null | jcf-data/jcf-query/src/test/resources/db-script/hsql-sql-db-script.sql | wall72/JavaCoreFramework | 91d9fa9966d058ed8bc7dc5a8bc5d8ec0f621d8b | [
"MIT"
] | null | null | null | jcf-data/jcf-query/src/test/resources/db-script/hsql-sql-db-script.sql | wall72/JavaCoreFramework | 91d9fa9966d058ed8bc7dc5a8bc5d8ec0f621d8b | [
"MIT"
] | null | null | null | DROP TABLE JCF_SQL IF EXISTS;
CREATE TABLE JCF_SQL(
QUERY_ID VARCHAR(20),
QUERY VARCHAR(512),
PRIMARY KEY(QUERY_ID)
)
INSERT INTO JCF_SQL VALUES ('SELECT', 'SELECT QUERY FROM JCF_SQL WHERE QUERY_ID = :queryid');
--INSERT INTO PRODUCT_TYPE VALUES('SHT', '���� Ÿ��', '���� ��');
--INSERT INTO PRODUCT VALUES(1001, 'SHT', '�칰��', '� ������ ����ź ��; �������� �ʰ� �״�� ��â�� �ư� ����ϴ� ȭ����', sysdate);
--INSERT INTO PRODUCT VALUES(1002, 'SHT', '/v��', '��/���/����С����ֿ�ס�ȭ���ǰ �� ��ȭ��/����(LPG)����ȭõ������(LNG) �� ��üȭ��; �� ���� ��: ������ ���·� �����Ͽ� �뷮����ϴ� ����', sysdate);
--INSERT INTO PRODUCT VALUES(1003, 'SHT', '�����̳ʼ�', '�����̳ʸ� ����ϴ� ����', sysdate);
--INSERT INTO PRODUCT VALUES(1004, 'SHT', 'FPSO��', 'Floating Production Storage Offloading, ��/�� ��/������� ����', sysdate);
| 44.888889 | 183 | 0.508663 |
a4549decf96047bc7e5997b3d1b0d2843987beef | 177 | asm | Assembly | libsrc/_DEVELOPMENT/arch/ts2068/misc/c/sdcc_iy/tshr_cls_attr_fastcall.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/arch/ts2068/misc/c/sdcc_iy/tshr_cls_attr_fastcall.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/arch/ts2068/misc/c/sdcc_iy/tshr_cls_attr_fastcall.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z | ; void tshr_cls_attr(uchar ink)
SECTION code_clib
SECTION code_arch
PUBLIC _tshr_cls_attr_fastcall
EXTERN asm_tshr_cls_attr
defc _tshr_cls_attr_fastcall = asm_tshr_cls_attr
| 16.090909 | 48 | 0.864407 |
a616da929d3076a68efca7b32972d760fa8bbfa7 | 4,428 | sql | SQL | lab06/lab06-seed.sql | WhatTheFar/2190422-database-system | 5cbcb5dd10c15996666d4fe9093b01bd1c106589 | [
"MIT"
] | null | null | null | lab06/lab06-seed.sql | WhatTheFar/2190422-database-system | 5cbcb5dd10c15996666d4fe9093b01bd1c106589 | [
"MIT"
] | null | null | null | lab06/lab06-seed.sql | WhatTheFar/2190422-database-system | 5cbcb5dd10c15996666d4fe9093b01bd1c106589 | [
"MIT"
] | null | null | null | CREATE DATABASE REGISTRATION_DB;
DROP TABLE IF EXISTS `Course`;
CREATE TABLE Course (
cid varchar(8) NOT NULL,
title varchar(256) NOT NULL,
dept_name varchar(256) NOT NULL,
credits int(11) NOT NULL,
PRIMARY KEY (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
LOCK TABLES Course WRITE;
INSERT INTO Course VALUES ('101001','Physics','Science',3),('101002','Mathematics','Science',3),('201001','Programming','Computer Engineering',2),('201002','Database Systems','Computer Engineering',3),('301001','Software Engineering','Computer Engineering',3);
UNLOCK TABLES;
DROP TABLE IF EXISTS `Professor`;
CREATE TABLE Professor (
pid varchar(8) NOT NULL,
pname varchar(256) NOT NULL,
salary int(11) NOT NULL,
PRIMARY KEY (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
LOCK TABLES Professor WRITE;
INSERT INTO Professor VALUES ('001','Michael',35000),('002','Simon',40000),('003','William',25000),('004','Ken',40000),('005','Steve',50000);
UNLOCK TABLES;
DROP TABLE IF EXISTS `Section`;
CREATE TABLE Section (
cid varchar(8) NOT NULL,
sect_id varchar(8) NOT NULL,
semester varchar(16) NOT NULL,
year year(4) NOT NULL,
building varchar(256) NOT NULL,
room varchar(16) NOT NULL,
timeslot_id varchar(8) NOT NULL,
PRIMARY KEY (`cid`,`sect_id`,`semester`,`year`),
CONSTRAINT Section_ibfk_1 FOREIGN KEY (`cid`) REFERENCES Course (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
LOCK TABLES Section WRITE;
INSERT INTO Section VALUES ('101001','1','1',2015,'SCI 03','512','1'),('101002','1','1',2015,'SCI 28','418','2'),('101002','2','1',2015,'SCI 28','317','3'),('201001','1','Summer',2015,'Eng 3','305','3'),('201001','2','Summer',2015,'Eng 3','405','3'),('201001','3','Summer',2015,'Eng 3','309','1'),('201002','1','2',2015,'Eng 100','405','2'),('301001','1','2',2015,'Eng 3','309','2'),('301001','2','2',2015,'Eng 3','305','1');
UNLOCK TABLES;
DROP TABLE IF EXISTS `Student`;
CREATE TABLE Student (
student_id varchar(16) NOT NULL,
name varchar(256) NOT NULL,
year int(11) NOT NULL,
email varchar(256) DEFAULT NULL,
PRIMARY KEY (`student_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
LOCK TABLES Student WRITE;
INSERT INTO Student VALUES ('55489317','Zinnia',3,'55489317@student.chula.ac.th'),('55748896','Tulip',3,'55748896@student.chula.ac.th'),('56717931','Rose',2,'56717931@student.chula.ac.th'),('56756421','Orchid',2,'56756421@student.chula.ac.th'),('57712358','Lotus',1,'57712358@student.chula.ac.th'),('57723547','Jasmine',1,'57723547@student.chula.ac.th');
UNLOCK TABLES;
DROP TABLE IF EXISTS `Takes`;
CREATE TABLE Takes (
student_id varchar(16) NOT NULL,
cid varchar(8) NOT NULL,
sect_id varchar(8) NOT NULL,
semester varchar(16) NOT NULL,
year year(4) NOT NULL,
grade varchar(8) NOT NULL,
PRIMARY KEY (`student_id`,`cid`,`sect_id`,`semester`,`year`),
KEY cid (`cid`,`sect_id`,`semester`,`year`),
CONSTRAINT Takes_ibfk_1 FOREIGN KEY (`student_id`) REFERENCES Student (`student_id`),
CONSTRAINT Takes_ibfk_2 FOREIGN KEY (`cid`, `sect_id`, `semester`, `year`) REFERENCES Section (`cid`, `sect_id`, `semester`, `year`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
LOCK TABLES Takes WRITE;
INSERT INTO Takes VALUES ('55489317','301001','2','2',2015,'C'),('55748896','201002','1','2',2015,'A'),('56717931','201001','3','Summer',2015,'B'),('56756421','201001','1','Summer',2015,'A'),('57712358','101001','1','1',2015,'A'),('57712358','101002','2','1',2015,'B'),('57723547','101001','1','1',2015,'A'),('57723547','101002','1','1',2015,'B+');
UNLOCK TABLES;
DROP TABLE IF EXISTS `Teaches`;
CREATE TABLE Teaches (
pid varchar(8) NOT NULL,
cid varchar(8) NOT NULL,
sect_id varchar(8) NOT NULL,
semester varchar(16) NOT NULL,
year year(4) NOT NULL,
PRIMARY KEY (`pid`,`cid`,`sect_id`,`semester`,`year`),
KEY cid (`cid`,`sect_id`,`semester`,`year`),
CONSTRAINT Teaches_ibfk_1 FOREIGN KEY (`pid`) REFERENCES Professor (`pid`),
CONSTRAINT Teaches_ibfk_2 FOREIGN KEY (`cid`, `sect_id`, `semester`, `year`) REFERENCES Section (`cid`, `sect_id`, `semester`, `year`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
LOCK TABLES Teaches WRITE;
INSERT INTO Teaches VALUES ('001','101001','1','1',2015),('002','101002','1','1',2015),('002','101002','2','1',2015),('003','201001','1','Summer',2015),('003','201001','2','Summer',2015),('003','201001','3','Summer',2015),('004','201002','1','2',2015),('005','301001','1','2',2015),('005','301001','2','2',2015);
UNLOCK TABLES; | 48.659341 | 425 | 0.676603 |
745a4713126499771d636dabcf59b84a2e53085c | 3,414 | h | C | UIKit/Classes/UIImageAppKitIntegration.h | pondok-programmer/Chameleon | 84605ede274bd82b330d72dd6ac41e64eb925fd7 | [
"BSD-3-Clause"
] | 1,656 | 2015-01-01T01:16:58.000Z | 2022-03-24T08:33:59.000Z | UIKit/Classes/UIImageAppKitIntegration.h | wangmingfu/Chameleon | 84605ede274bd82b330d72dd6ac41e64eb925fd7 | [
"BSD-3-Clause"
] | 7 | 2015-01-15T01:32:24.000Z | 2018-05-06T20:41:50.000Z | UIKit/Classes/UIImageAppKitIntegration.h | wangmingfu/Chameleon | 84605ede274bd82b330d72dd6ac41e64eb925fd7 | [
"BSD-3-Clause"
] | 404 | 2015-01-01T01:17:01.000Z | 2022-03-24T08:33:47.000Z | /*
* Copyright (c) 2011, The Iconfactory. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of The Iconfactory nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "UIImage.h"
@class NSImage;
@interface UIImage (AppKitIntegration)
+ (id)imageWithNSImage:(NSImage *)theImage;
- (id)initWithNSImage:(NSImage *)theImage;
- (NSImage *)NSImage;
/*
this is a hack to support screen scale factor changes (retina) which iOS doesn't
have a decent way to support as far as I can tell.
these will build a UIImage object from multiple source UIImages that are already
at different scales and when the resulting UIImage is drawn, it should choose the
correct one based on the scale of the underlying context at the time it is drawn.
pass an array of UIImage objects at different scales that represent the same image.
each image must have a different .scale property value, no duplicates allowed!
each image must be the same size as compared to the others:
- eg: <scale=2, size=100x100> and <scale=1, size=50x50>
NOTE: internally, UIImage already loads both @1x and @2x versions of image files if
they are present (-initWithNSImage: does something similar), so for the most part you
probably don't need this. the primary purpose of this is if you are custom drawing
something using something like UIGraphicsBeginImageContext() and don't know what the
scale factor of the window might currently be now or in the future.
EXAMPLE:
// render @1x
UIGraphicsBeginImageContextWithOptions(size, NO, 1);
.. draw stuff ..
UIImage *image1x = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
// render @2x
UIGraphicsBeginImageContextWithOptions(size, NO, 2);
.. draw stuff ..
UIImage *image2x = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
// put them together
UIImage *finalImage = [UIImage imageWithScaledImages:@[image1, image2]];
*/
+ (id)imageWithScaledImages:(NSArray *)images;
- (id)initWithScaledImages:(NSArray *)images;
@end
| 42.148148 | 86 | 0.765378 |
438d99e58bee92a5265234b89aa09e248b3010ba | 3,385 | go | Go | internal/cmd/gocdk/internal/static/_assets/demo/demo_runtimevar.go | clausti/go-cloud | fa8c32ca7b0e89f2e3df5cf71ed6d0c24e8ad877 | [
"Apache-2.0"
] | 1 | 2019-05-31T20:59:26.000Z | 2019-05-31T20:59:26.000Z | internal/cmd/gocdk/internal/static/_assets/demo/demo_runtimevar.go | polinasok/go-cloud | cbeb51129fa5d385cca86807128d12335b3273c8 | [
"Apache-2.0"
] | null | null | null | internal/cmd/gocdk/internal/static/_assets/demo/demo_runtimevar.go | polinasok/go-cloud | cbeb51129fa5d385cca86807128d12335b3273c8 | [
"Apache-2.0"
] | null | null | null | // This file demonstrates basic usage of the runtimevvar.Variable portable type.
//
// It initializes a runtimevar.Variable URL based on the environment variable
// RUNTIMEVAR_VARIABLE_URL, and then registers handlers for "/demo/runtimevar"
// on http.DefaultServeMux.
package main
import (
"context"
"html/template"
"net/http"
"os"
"time"
"gocloud.dev/runtimevar"
_ "gocloud.dev/runtimevar/awsparamstore"
_ "gocloud.dev/runtimevar/blobvar"
_ "gocloud.dev/runtimevar/constantvar"
_ "gocloud.dev/runtimevar/filevar"
_ "gocloud.dev/runtimevar/gcpruntimeconfig"
_ "gocloud.dev/runtimevar/httpvar"
)
// Package variables for the runtimevar.Variable URL, and the initialized
// runtimevar.Variable.
var (
variableURL string
variable *runtimevar.Variable
variableErr error
)
func init() {
// Register the handler. See https://golang.org/pkg/net/http/.
http.HandleFunc("/demo/runtimevar/", runtimevarHandler)
// Initialize the runtimevar.Variable using a URL from the environment,
// defaulting to an in-memory constant driver.
variableURL = os.Getenv("RUNTIMEVAR_VARIABLE_URL")
if variableURL == "" {
variableURL = "constant://?val=my-variable&decoder=string"
}
variable, variableErr = runtimevar.OpenVariable(context.Background(), variableURL)
}
// runtimevarData holds the input for the demo page. The page handler will
// initialize the struct and pass it to the template.
type runtimevarData struct {
URL string
Err error
Snapshot *runtimevar.Snapshot
}
// runtimevarTemplate is the template for /demo/runtimevar. See runtimevarHandler.
// Input: *runtimevarData.
const runtimevarTemplate = `
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>gocloud.dev/runtimevar demo</title>
</head>
<body>
<p>
This page demonstrates the use of Go CDK's <a href="https://gocloud.dev/howto/runtimevar">runtimevar</a> package.
</p>
<p>
It is currently using a runtimevar.Variable based on the URL "{{ .URL }}", which
can be configured via the environment variable "RUNTIMEVAR_VARIABLE_URL".
</p>
{{if .Err}}
<p><strong>{{ .Err }}</strong></p>
{{end}}
{{if .Snapshot}}
<p><label>
The current value of the variable is:
<br/>
<textarea rows="5" cols="40" readonly="true">{{ .Snapshot.Value }}</textarea>
</label></p>
<p><label>
It was last modified at: {{ .Snapshot.UpdateTime }}.
</label></p>
{{end}}
</body>
</html>`
var runtimevarTmpl = template.Must(template.New("runtimevar").Parse(runtimevarTemplate))
// runtimevarHandler is the handler for /demo/runtimevar.
func runtimevarHandler(w http.ResponseWriter, req *http.Request) {
data := &runtimevarData{
URL: variableURL,
}
defer func() {
if err := runtimevarTmpl.Execute(w, data); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}()
// Verify that variable initialization succeeded.
if variableErr != nil {
data.Err = variableErr
return
}
// Use Latest to get the current value of the variable. It will block if
// there's never been a good value, so use a ctx with a timeout to make the
// page render quickly.
ctx, cancel := context.WithTimeout(req.Context(), 100*time.Millisecond)
defer cancel()
snapshot, err := variable.Latest(ctx)
if err != nil {
// We never had a good value; show an error.
data.Err = err
return
}
data.Snapshot = &snapshot
}
| 28.445378 | 117 | 0.709897 |
7583cc9d8efdbe6a28f75f29f2dafeb3a2d25d61 | 1,040 | c | C | tools-src/gnu/binutils/gas/testsuite/gas/mips/elf_e_flags.c | enfoTek/tomato.linksys.e2000.nvram-mod | 2ce3a5217def49d6df7348522e2bfda702b56029 | [
"FSFAP"
] | 80 | 2015-01-02T10:14:04.000Z | 2021-06-07T06:29:49.000Z | tools-src/gnu/binutils/gas/testsuite/gas/mips/elf_e_flags.c | unforgiven512/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 9 | 2015-05-14T11:03:12.000Z | 2018-01-04T07:12:58.000Z | tools-src/gnu/binutils/gas/testsuite/gas/mips/elf_e_flags.c | unforgiven512/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 69 | 2015-01-02T10:45:56.000Z | 2021-09-06T07:52:13.000Z | /* This file isn't directly used by the test suite; it uses
elf_e_flags.s. However, I figured it would be nice to provide the
source code from which the .s file was generated.
It was compiled as follows:
mips64-elf-gcc -m4650 -S -O elf_e_flags.c
We use the -m4650 flag to get the 4650-specific 'mul' instruction
in there; the test suite wants to be sure that GAS's -m4650 flag
will indeed cause it to generate the 4650 mul instruction, and not
expand it as a macro.
Ian 10 June 1999: I tweaked the resulting assembler file so that it
would generate the same code when gas was configured for mips-elf
and for mips64-elf.
18 October 2000: Chris Demetriou <cgd@sibyte.com> tweaked the code so
that it would always generate enough zero-padding at the end to make
objdump print "...", so that the test would be successful even on
machines that pad results to cache line or other boundaries
(e.g. mips-linux). */
int
foo (int a, int b)
{
return (a * b) + 1;
}
int
main ()
{
return 0;
}
| 29.714286 | 72 | 0.709615 |
fb3f41ec2fb63ffcc1139bf11d91b0d012246175 | 2,025 | java | Java | src/gui/Sprite.java | adam-wolfson/Gold-Digger | b71b2aa6b765a4521072f3716fa947103404a4e3 | [
"MIT"
] | null | null | null | src/gui/Sprite.java | adam-wolfson/Gold-Digger | b71b2aa6b765a4521072f3716fa947103404a4e3 | [
"MIT"
] | null | null | null | src/gui/Sprite.java | adam-wolfson/Gold-Digger | b71b2aa6b765a4521072f3716fa947103404a4e3 | [
"MIT"
] | null | null | null | package gui;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
/** Maintains\ information about a sprite for the GUI. A sprite is defined by a spritesheet,
* the information to interpret it (size of each image, etc), and information necessary to
* animate the sprite. */
public class Sprite {
private BufferedImage spriteSheet; //The entire spritesheet
private int tileWidth; //Width of a single image on the spritesheet
private int tileHeight; //Height of a single image on the spritesheet
private int cycleSize; //How many images make up a single animation?
private int cycle= 0; //Which cycle of the animation are we at now? (in [0, cycleSize - 1])
/** Constructor: an instance with image at imageLoc, of size (width, height),
* and number of frames in the animation cycleSize. */
public Sprite(String imageLoc, int width, int height, int cycleSize){
tileWidth= width;
tileHeight= height;
this.cycleSize= cycleSize;
try {
spriteSheet= ImageIO.read(new File(imageLoc));
}
catch (IOException e) {
throw new IllegalArgumentException("Creating sprite failed. " + imageLoc + " not found.");
}
}
/** Update the spritesheet's animation by a single frame. */
public void tick(){
cycle= (cycle + 1) % cycleSize;
}
/** Return offset (dRow, dCol) into the spritesheet. Assumes that (dRow, dCol) is the base offset,
* and subsequent animations are at (dRow, dCol + 1), (dRow, dCol + 2) ... (dRow, dCol + cycleSize - 1)
*
* @param dRow the number of rows to offset into the spritesheet for the first animation
* @param dCol the number of columns to offset into the spritesheet for the first animation */
public BufferedImage getSprite(int dRow, int dCol){
if (spriteSheet == null) {
throw new IllegalArgumentException("Can't get sprite until you've initialized sprite sheet.");
}
return spriteSheet.getSubimage((dCol + cycle) * tileWidth, dRow * tileHeight, tileWidth, tileHeight);
}
}
| 39.705882 | 104 | 0.72 |
85d71aa26dfbcf3e018c0dd9750a78d2f986674f | 1,992 | js | JavaScript | node_modules/@react-icons/all-files/gi/GiChainMail.js | syazwanirahimin/dotcom | 162acf4500655ec965d27bd1e45ef0415963d346 | [
"MIT"
] | null | null | null | node_modules/@react-icons/all-files/gi/GiChainMail.js | syazwanirahimin/dotcom | 162acf4500655ec965d27bd1e45ef0415963d346 | [
"MIT"
] | null | null | null | node_modules/@react-icons/all-files/gi/GiChainMail.js | syazwanirahimin/dotcom | 162acf4500655ec965d27bd1e45ef0415963d346 | [
"MIT"
] | null | null | null | // THIS FILE IS AUTO GENERATED
var GenIcon = require('../lib').GenIcon
module.exports.GiChainMail = function GiChainMail (props) {
return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 512 512"},"child":[{"tag":"path","attr":{"d":"M174.688 61.094L144.125 78.75 43.53 136.813l-10.124 5.843-10.718 6.188-5.47 3.156 65.407 113.375 2.03-1.156 4.97-2.876 9.188-5.313V256l55.874-32.438-8.625 195.938-.156 3.22-1.125 24.03h222.126l-.125-2.688-.31-7.343-.783-17.22-8.593-195.53 55.22 32.06-.033.033 13.283 7.656.843.5 2.063 1.186L493.874 152l-5.47-3.156-10.717-6.188-94.438-54.5-16.28-9.406-22.408-12.938-8.156-4.687c-11.456 23.492-43.573 40.594-81.156 40.594-37.564 0-69.075-17.103-80.53-40.595l-.032-.03zm-17.313 31.562c38.33 35.412 91.103 46.482 137.03 34.563l-7.717 14.25 13.125 24.25 13.125-24.25-9.22-17.032c18.97-6.366 36.472-16.805 50.876-31.25l113.75 65.656-46.72 81L392 222.624l12.156-22.468-13.125-24.25-13.124 24.25L389.186 221l-19.31-11.22-33.563-19.874.5 8.5-12.938-23.906-13.156 24.25L323.874 223l12.97-23.97 1.467 24.626h.032l2.187 49.406-10.655-19.656-13.125 24.25L326.688 296h-60.22l9-16.625-13.124-24.25-13.125 24.25 9 16.625h-88l3.405-77.25h-.03l1.155-28.875-33.53 19.875-51.75 30.063-46.72-80.97 114.625-66.187zm4.563 16.78l-13.125 24.25 13.125 24.25 13.125-24.25-13.125-24.25zm270.093 39.626l-13.124 24.25 13.125 24.25 13.126-24.25-13.125-24.25zM128.69 166.72l-13.125 24.25 13.124 24.25 13.125-24.25-13.125-24.25zm113.843 38.186l-13.124 24.25 13.125 24.25 13.126-24.25-13.125-24.25zm55.876 19.813l-13.125 24.25 13.126 24.25 13.125-24.25-13.124-24.25zm-99.72 9.186l-13.124 24.25 13.125 24.25 13.157-24.25-13.156-24.25zm142.22 47.625l.625 14.47h-8.467l7.843-14.47zM169.47 312.97h172.81l.876 19.967H168.594l.875-19.968zm-1.626 36.936H207l-10.844 19.97 13.156 24.25 13.125-24.25-10.812-19.97h120.563l-11.563 21.375 13.125 24.25L345 374.75l1.97 44.75h-53.44l8.095-14.97-13.125-24.25-13.125 24.25 8.094 14.97H164.78l3.064-69.594zm167.47 0h8.592l.75 17.28-9.344-17.28z"}}]})(props);
};
| 332 | 1,857 | 0.710341 |
6e38a04d7cfe88bae4ef9210f6a4f3e697ba1e15 | 473 | html | HTML | src/main/resources/index.html | alzahm/wordmemorizer | f5389cc3a8bee3b77bd07a30c174a05ec97eda8f | [
"Apache-2.0"
] | null | null | null | src/main/resources/index.html | alzahm/wordmemorizer | f5389cc3a8bee3b77bd07a30c174a05ec97eda8f | [
"Apache-2.0"
] | null | null | null | src/main/resources/index.html | alzahm/wordmemorizer | f5389cc3a8bee3b77bd07a30c174a05ec97eda8f | [
"Apache-2.0"
] | null | null | null | <!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hello, Kotlin/JS!</title>
<script src="https://cdn.tailwindcss.com"></script>
<!-- <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.13.0/css/all.css">-->
<script defer src="https://use.fontawesome.com/releases/v5.13.0/js/all.js"></script> <!--load all styles -->
</head>
<body>
<div id="root"></div>
<script src="confexplorer.js"></script>
</body>
</html> | 31.533333 | 112 | 0.627907 |
c7ba00792c1312603437c8b0917fd74235632e02 | 3,226 | py | Python | day13/python/run.py | SlivTime/aoc2021 | 4ce4fc6326f8d2c1269233c6b4b94a07a7c9c167 | [
"MIT"
] | null | null | null | day13/python/run.py | SlivTime/aoc2021 | 4ce4fc6326f8d2c1269233c6b4b94a07a7c9c167 | [
"MIT"
] | null | null | null | day13/python/run.py | SlivTime/aoc2021 | 4ce4fc6326f8d2c1269233c6b4b94a07a7c9c167 | [
"MIT"
] | null | null | null | from collections import Counter, defaultdict
from typing import List, Tuple, Dict, Set, Callable
from pprint import pprint
PART1_TEST_ANSWER = 17
PART2_TEST_ANSWER = '#####\n# #\n# #\n# #\n#####\n \n \n'
def _parse_dot(s):
x, y = s.strip().split(",")
return int(x), int(y)
def _parse_fold(s):
value = s.strip().split()[-1]
xy, coord = value.split("=")
if xy == "x":
return int(coord), 0
else:
return 0, int(coord)
def _get_data(filename):
with open(filename) as f:
paper = []
folds = []
for line in f:
line = line.strip()
if not line:
break
item = _parse_dot(line)
paper.append(item)
for line in f:
item = _parse_fold(line)
folds.append(item)
return paper, folds
def get_data():
return _get_data("../input/input.txt")
def get_test_data():
return _get_data("../input/test_input.txt")
def create_paper(raw_data: List[Tuple[int, int]]) -> List[List[int]]:
size_x = 0
size_y = 0
for x, y in raw_data:
size_x = max(size_x, x)
size_y = max(size_y, y)
field = []
for _ in range(size_y + 1):
field.append([0 for _ in range(size_x + 1)])
for y, x in raw_data:
field[x][y] = 1
return field
def sum_ones(paper):
return sum([sum(row) for row in paper])
def fold_vert(paper, fold_row):
new_paper = paper[:fold_row]
folded = paper[fold_row + 1 :]
paper_cursor = len(new_paper) - 1
folded_cursor = 0
while paper_cursor >= 0:
if folded_cursor >= len(folded):
break
paper_row = new_paper[paper_cursor]
folded_row = folded[folded_cursor]
for idx, val in enumerate(paper_row):
paper_row[idx] = val or folded_row[idx]
paper_cursor -= 1
folded_cursor += 1
return new_paper
def fold_hor(paper, fold_col):
new_paper = []
for row in paper:
new_row = row[:fold_col]
folded_row = row[fold_col + 1 :]
for folded_idx, val in enumerate(folded_row):
new_idx = fold_col - folded_idx - 1
if new_idx >= 0:
new_val = val or new_row[new_idx]
new_row[new_idx] = new_val
new_paper.append(new_row)
return new_paper
def count_part1(data):
dots, folds = data
paper = create_paper(dots)
folds = folds[:1]
for x, y in folds:
if x:
paper = fold_hor(paper, x)
elif y:
paper = fold_vert(paper, y)
return sum_ones(paper)
def count_part2(data):
dots, folds = data
paper = create_paper(dots)
for x, y in folds:
if x:
paper = fold_hor(paper, x)
elif y:
paper = fold_vert(paper, y)
word = ""
for row in paper:
for _, item in enumerate(row):
ch = "#" if item else " "
word += ch
word += "\n"
return word
if __name__ == "__main__":
assert count_part1(get_test_data()) == PART1_TEST_ANSWER
assert count_part2(get_test_data()) == PART2_TEST_ANSWER
print(count_part1(get_data()))
print(count_part2(get_data()))
| 22.879433 | 71 | 0.564476 |
762e471d42340b9041eae7f22247830be9c4845e | 4,701 | ps1 | PowerShell | src/Cloners/WorkerCloner.ps1 | OctopusDeployLabs/SpaceCloner | a6963868f09903c37009945f907d9faeff85d297 | [
"Apache-2.0"
] | 18 | 2020-06-23T00:18:06.000Z | 2021-10-07T06:23:05.000Z | src/Cloners/WorkerCloner.ps1 | OctopusDeployLabs/SpaceCloner | a6963868f09903c37009945f907d9faeff85d297 | [
"Apache-2.0"
] | 27 | 2020-06-22T20:40:54.000Z | 2022-03-25T16:57:36.000Z | src/Cloners/WorkerCloner.ps1 | OctopusDeployLabs/SpaceCloner | a6963868f09903c37009945f907d9faeff85d297 | [
"Apache-2.0"
] | 20 | 2020-07-01T12:19:07.000Z | 2022-03-25T17:12:36.000Z | function Copy-OctopusWorkers
{
param(
$sourceData,
$destinationData,
$cloneScriptOptions
)
if ($sourceData.HasWorkers -eq $false -or $destinationData.HasWorkers -eq $false)
{
Write-OctopusWarning "The source or destination Octopus instance doesn't have workers, skipping cloning workers"
return
}
$filteredList = Get-OctopusFilteredList -itemList $sourceData.WorkerList -itemType "Worker List" -filters $cloneScriptOptions.WorkersToClone
Write-OctopusChangeLog "Workers"
if ($filteredList.length -eq 0)
{
Write-OctopusChangeLog " - No Workers found to clone matching the filters"
return
}
if ($sourceData.OctopusUrl -ne $destinationData.OctopusUrl -and $destinationData.WhatIf -eq $false)
{
Write-OctopusCritical "You are cloning workers from one instance to another, the server thumbprints will not be accepted by the workers until you run Tentacle.exe configure --trust='your server thumbprint'"
}
foreach ($worker in $filteredList)
{
Write-OctopusVerbose "Starting Clone of Worker $($worker.Name)"
if ($worker.Endpoint.CommunicationStyle -eq "TentacleActive")
{
Write-OctopusVerbose " - $($worker.Name) is unsupported tentacle type."
Write-OctopusWarning "The worker $($worker.Name) is a polling tentacle, this script cannot clone polling tentacles, skipping."
continue
}
$matchingItem = Get-OctopusItemByName -ItemName $worker.Name -ItemList $destinationData.WorkerList
If ($null -eq $matchingItem)
{
Write-OctopusVerbose "Worker $($worker.Name) was not found in destination, creating new record."
Write-OctopusChangeLog " - Add $($worker.Name)"
$copyOfItemToClone = Copy-OctopusObject -ItemToCopy $worker -SpaceId $destinationData.SpaceId -ClearIdValue $true
$copyOfItemToClone.WorkerPoolIds = @(Get-OctopusFilteredWorkerPoolIdList -sourceData $sourceData -destinationData $destinationData -worker $worker)
Write-OctopusChangeLogListDetails -prefixSpaces " " -listType "Worker Pool Scoping" -idList $copyOfItemToClone.WorkerPoolIds -destinationList $DestinationData.WorkerPoolList
$copyOfItemToClone.MachinePolicyId = Convert-SourceIdToDestinationId -SourceList $sourceData.MachinePolicyList -DestinationList $destinationData.MachinePolicyList -IdValue $worker.MachinePolicyId
$copyOfItemToClone.Status = "Unknown"
$copyOfItemToClone.HealthStatus = "Unknown"
$copyOfItemToClone.StatusSummary = ""
$copyOfItemToClone.IsInProcess = $false
if ($copyOfItemToClone.WorkerPoolIds.Length -eq 0)
{
Write-OctopusWarning "The worker $($worker.Name) is tied to a pool that is not allowed to be cloned and there are no other pools for it. Skipping the worker."
continue
}
$newOctopusWorker = Save-OctopusWorker -worker $copyOfItemToClone -destinationData $destinationData
$destinationData.WorkerList += $newOctopusWorker
}
else
{
Write-OctopusVerbose "Worker $($worker.Name) already exists in destination, skipping"
Write-OctopusChangeLog " - $($worker.Name) already exists, skipping"
}
}
Write-OctopusSuccess "Workers successfully cloned"
}
function Get-OctopusFilteredWorkerPoolIdList
{
param (
$sourceData,
$destinationData,
$worker)
$workerPoolIdsToReturn = @()
foreach ($workerPoolId in $worker.WorkerPoolIds)
{
$workerPool = Get-OctopusItemById -itemList $sourceData.WorkerPoolList -itemId $workerPoolId
if ($DestinationData.OctopusUrl -like "*.octopus.app" -and $SourceData.OctopusUrl -notlike "*.octopus.app" -and $workerPool.IsDefault -eq $true)
{
Write-OctopusVerbose "The worker is assigned to the default worker pool, but we are going from self-hosted to the cloud. This is not allowed. Removing this worker pool reference"
continue
}
$destinationWorkerPoolId = Convert-SourceIdToDestinationId -SourceList $sourceData.WorkerPoolList -DestinationList $destinationData.WorkerPoolList -IdValue $workerPoolId
$workerPoolIdsToReturn += $destinationWorkerPoolId
}
return $workerPoolIdsToReturn
} | 46.088235 | 215 | 0.651989 |
5bd7ba377cbad759b0cd105f798bb07135f51851 | 661 | asm | Assembly | oeis/246/A246467.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/246/A246467.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/246/A246467.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A246467: G.f.: 1 / AGM(1-5*x, sqrt((1-x)*(1-25*x))).
; Submitted by Christian Krause
; 1,9,121,2025,38025,762129,15912121,341621289,7484845225,166549691025,3751508008161,85341068948529,1957289174870121,45199191579030225,1049893021288265625,24510327614556266025,574726636455361317225,13528549573868347823025,319541915502909478890625,7570612218970745545280625,179856109268731452330783025,4283459364689561008700271225,102244444245992536010991713025,2445535617656726929739348480625,58603299374415210179005279575625,1406752662576397066106369454654129,33822257746087690819315161260028961
seq $0,26375 ; a(n) = Sum_{k=0..n} binomial(n,k)*binomial(2*k,k).
pow $0,2
| 94.428571 | 496 | 0.853253 |
b465bdfed84bdaf18c59b3763a8f57c27e9a5db3 | 3,929 | lua | Lua | modulefiles/Core/SitePackage.lua | lcnja/modulefiles-1 | 2bbaf48089ef55f0a8247e6c365103f2b852feec | [
"Apache-2.0"
] | 6 | 2016-03-17T13:59:43.000Z | 2021-07-08T06:15:33.000Z | modulefiles/Core/SitePackage.lua | lcnja/modulefiles-1 | 2bbaf48089ef55f0a8247e6c365103f2b852feec | [
"Apache-2.0"
] | null | null | null | modulefiles/Core/SitePackage.lua | lcnja/modulefiles-1 | 2bbaf48089ef55f0a8247e6c365103f2b852feec | [
"Apache-2.0"
] | 2 | 2016-08-10T16:04:15.000Z | 2016-10-13T17:38:24.000Z | require("strict")
local hook = require("Hook")
local http = require("socket.http")
http.TIMEOUT = 30
function url_quote(str)
if (str) then
str = string.gsub (str, "\n", "\r\n")
str = string.gsub (str, "([^%w %-%_%.%~])",
function (c) return string.format ("%%%02X", string.byte(c)) end)
str = string.gsub (str, " ", "+")
end
return str
end
function get_project(str)
if (str) then
for match in string.gmatch(str, "ProjectName%s+=%s+\"(.-)\"") do
return match
end
end
return ''
end
function get_username(str)
if (str) then
for match in string.gmatch(str, "Owner%s+=%s+\"(%S-)\"") do
return match
end
for match in string.gmatch(str, "Owner%s+=%s+\"(%S-)@%S-\"") do
return match
end
end
return ''
end
function get_site(str)
if (str) then
for match in string.gmatch(str, "JOBGLIDEIN_ResourceName%s+=%s+\"(%S-)\"") do
return match
end
for match in string.gmatch(str, "GLIDEIN_Site%s+=%s+\"(%S-)\"") do
return match
end
end
return ''
end
-- By using the hook.register function, this function "load_hook" is called
-- ever time a module is loaded with the file name and the module name.
function load_hook(t)
-- the arg t is a table:
-- t.modFullName: the module full name: (i.e: gcc/4.7.2)
-- t.fn: The file name: (i.e /apps/modulefiles/Core/gcc/4.7.2.lua)
-- Your site can use this any way that suits. Here are some possibilities:
-- a) Write this information into a file in your users directory (say ~/.lmod.d/.save).
-- Then once a month collect this data.
-- b) have this function call syslogd to register that this module was loaded by this
-- user
-- c) Write the same information directly to some database.
-- This is the directory in which this script resides, and it pulls the rest
-- of the required scripts and config from this same directory. (It would
-- be better to compute this, but my lua skills are lacking.)
local dirname = os.getenv("LMOD_PACKAGE_PATH")
local username = os.getenv("OSGVO_SUBMITTER")
if username == nil then
username = 'UNAVAILABLE'
end
local project = os.getenv("OSGVO_PROJECT_NAME")
if project == nil then
project = 'UNAVAILABLE'
end
local site = os.getenv("OSG_SITE_NAME")
if site == nil then
site = 'UNAVAILABLE'
end
local fhandle = io.popen('/bin/hostname -f', 'r')
local host = fhandle:read()
fhandle:close()
if host == nil then
host = 'UNAVAILABLE'
end
local classads = ''
local condor_classad_file = os.getenv('_CONDOR_JOB_AD')
if condor_classad_file ~= nil then
local f = io.open(condor_classad_file, 'r')
classads = f:read("*all")
end
condor_classad_file = os.getenv('_CONDOR_MACHINE_AD')
if condor_classad_file ~= nil then
local f = io.open(condor_classad_file, 'r')
classads = classads .. f:read("*all")
end
if classads ~= nil then
username = get_username(classads)
if site == 'UNAVAILABLE' then
site = get_site(classads)
end
if project == 'UNAVAILABLE' then
project = get_project(classads)
end
end
if dirname ~= '' and username ~= '' and t.modFullName ~= '' then
-- We don't want failure to log to block jobs or give errors. Make an
-- effort to log things, but ignore anything that goes wrong. Also do
-- not wait on the subprocess.
local uri = 'http://modules.ci-connect.net/register_module.wsgi?'
uri = uri .. 'user=' .. url_quote(username)
uri = uri .. '&project=' .. url_quote(project)
uri = uri .. '&module=' .. url_quote(t.modFullName)
uri = uri .. '&site=' .. url_quote(site)
uri = uri .. '&host=' .. url_quote(host)
http.request(uri)
end
end
hook.register("load",load_hook)
| 30.937008 | 90 | 0.616442 |
772201e3817485b60c455f8b94e90a8a3ab7af44 | 1,118 | rs | Rust | tests/spec/libsass_closed_issues/issue_2156/mod.rs | alvra/rsass | 96cf819b733b2c27aaad5e0b79cceb767a7dcfa8 | [
"Apache-2.0"
] | null | null | null | tests/spec/libsass_closed_issues/issue_2156/mod.rs | alvra/rsass | 96cf819b733b2c27aaad5e0b79cceb767a7dcfa8 | [
"Apache-2.0"
] | null | null | null | tests/spec/libsass_closed_issues/issue_2156/mod.rs | alvra/rsass | 96cf819b733b2c27aaad5e0b79cceb767a7dcfa8 | [
"Apache-2.0"
] | null | null | null | //! Tests auto-converted from "sass-spec/spec/libsass-closed-issues/issue_2156"
#[allow(unused)]
use super::rsass;
// From "sass-spec/spec/libsass-closed-issues/issue_2156/debug.hrx"
#[test]
fn debug() {
assert_eq!(
rsass(
"@debug \"\\\"foo\\\"\" + \"\";\r\
\n@debug \"\" + \"\\\"foo\\\"\";\r\
\n@debug \"\" + \"\\\"foo\";\r\
\n@debug \"\\\"foo\\\"\" + \"bar\";\r\
\n@debug unquote(\"\\\"foo\\\" and \\\"bar\\\"\");\r\
\n"
)
.unwrap(),
""
);
}
// From "sass-spec/spec/libsass-closed-issues/issue_2156/error.hrx"
// Ignoring "error", error tests are not supported yet.
// From "sass-spec/spec/libsass-closed-issues/issue_2156/warn.hrx"
#[test]
fn warn() {
assert_eq!(
rsass(
"@warn \"\\\"foo\\\"\" + \"\";\r\
\n@warn \"\" + \"\\\"foo\\\"\";\r\
\n@warn \"\" + \"\\\"foo\";\r\
\n@warn \"\\\"foo\\\"\" + \"bar\";\r\
\n@warn unquote(\"\\\"foo\\\" and \\\"bar\\\"\");\r\
\n"
)
.unwrap(),
""
);
}
| 26.619048 | 79 | 0.423971 |
d327c6e7cee1aeb59fb78f2ae6cf916ebbc8d519 | 33 | lua | Lua | websocket/client.lua | Tangkysin/skynet-lua-websocket | 4b9b8613ff8f33d2e189f93f84c34b3ea21793d7 | [
"MIT"
] | 26 | 2019-06-21T11:32:03.000Z | 2021-05-21T08:51:17.000Z | websocket/client.lua | Tangkysin/skynet-lua-websocket | 4b9b8613ff8f33d2e189f93f84c34b3ea21793d7 | [
"MIT"
] | 2 | 2019-07-02T01:10:36.000Z | 2019-10-30T02:55:44.000Z | websocket/client.lua | Tangkysin/skynet-lua-websocket | 4b9b8613ff8f33d2e189f93f84c34b3ea21793d7 | [
"MIT"
] | 5 | 2019-07-18T06:09:47.000Z | 2021-08-19T01:32:38.000Z | -- TODO Add Lua Websocket client
| 16.5 | 32 | 0.757576 |
573d92d1980bcd74a124be15ad406a2c587bdf67 | 1,732 | c | C | entity_auth.c | hyu-iot/SST- | 6134effae790d5c53b99d9729428c931e80536a0 | [
"MIT"
] | null | null | null | entity_auth.c | hyu-iot/SST- | 6134effae790d5c53b99d9729428c931e80536a0 | [
"MIT"
] | null | null | null | entity_auth.c | hyu-iot/SST- | 6134effae790d5c53b99d9729428c931e80536a0 | [
"MIT"
] | null | null | null | #include "entity_auth.h"
distribution_key dist_key;
sessionkey sess_key[10];
nonce entity_nonce;
int Entity_Auth(unsigned char * msg, size_t size)
{
if(msg[0] == AUTH_HELLO)
{
print_buf(msg, 14);
unsigned char sender[] = "net1.client";
unsigned char purpose[] = "{\"group\":\"Servers\"}";
int num_key = 3;
Nonce_sort(msg,size);
nonce_generator(msg,NONCE_SIZE);
slice(entity_nonce.nonce,msg,0,8);
print_buf(entity_nonce.nonce,8);
num_key_to_buffer(msg, NONCE_SIZE*2,num_key);
int msg_len = save_senpup(msg,NONCE_SIZE*2+NUMKEY, sender,strlen(sender),purpose,strlen(purpose));
int total_len = encrypt_sign(msg,msg_len);
msg[0] = SESSION_KEY_REQ_IN_PUB_ENC;
return total_len;
}
else if(msg[0] == SESSION_KEY_RESP_WITH_DIST_KEY)
{
printf("\nreceived session key response with distribution key attached! \n");
int payload_len = payload_length(msg,1);
int buf_len = payload_buf_length(payload_len);
printf("payload len: %d, buf len: %d\n",payload_len,buf_len );
unsigned char *s1 = malloc(payload_len - DIST_ENC_SIZE);
slice(s1,msg,DIST_ENC_SIZE+1+buf_len,1+buf_len+payload_len);
dist_key_decrypt(msg, 1+buf_len, &dist_key);
sess_key_decrypt(s1, payload_len - DIST_ENC_SIZE, sess_key, &dist_key);
if(strncmp((char *)s1, (char *) entity_nonce.nonce, NONCE_SIZE) == 0 )
{
printf("Nonce is consistent. \n");
}
else
printf("auth nonce NOT verified\n");
return 0;
free(s1);
}
}
int Entity_Entity(unsigned char * msg, size_t size)
{
msg[0] = ENTITY_HELLO; //1
}
| 30.928571 | 106 | 0.628753 |
8a3fe390290fe4f4c8313404135ad69773883cc0 | 10,834 | rs | Rust | src/main.rs | ryan0n/quad-image | f43ab924d317d2c49c0274e70f82683ef79ce5dc | [
"Apache-2.0"
] | null | null | null | src/main.rs | ryan0n/quad-image | f43ab924d317d2c49c0274e70f82683ef79ce5dc | [
"Apache-2.0"
] | null | null | null | src/main.rs | ryan0n/quad-image | f43ab924d317d2c49c0274e70f82683ef79ce5dc | [
"Apache-2.0"
] | null | null | null | mod gallery;
pub mod ingest;
#[cfg(test)]
mod tests;
mod thumbs;
use std::fs;
use std::io;
use std::io::Read;
use std::io::Write;
use std::path;
use std::sync::Arc;
use std::sync::Mutex;
use anyhow::anyhow;
use anyhow::Context;
use anyhow::Error;
use lazy_static::lazy_static;
use rand::RngCore;
use rouille::input::json::JsonError;
use rouille::input::json_input;
use rouille::input::post;
use rouille::post_input;
use rouille::router;
use rouille::Request;
use rouille::Response;
use serde_json::json;
const BAD_REQUEST: u16 = 400;
type Conn = Arc<Mutex<rusqlite::Connection>>;
lazy_static! {
static ref IMAGE_ID: regex::Regex =
regex::Regex::new("^e/[a-zA-Z0-9]{10}\\.(?:png|jpg|gif)$").unwrap();
static ref GALLERY_SPEC: regex::Regex =
regex::Regex::new("^([a-zA-Z][a-zA-Z0-9]{3,9})!(.{4,99})$").unwrap();
}
fn upload(request: &Request) -> Response {
let params = match post_input!(request, {
image: Vec<post::BufferedFile>,
return_json: Option<String>,
}) {
Ok(params) => params,
Err(_) => return bad_request("invalid / missing parameters"),
};
let image = match params.image.len() {
1 => ¶ms.image[0],
_ => return bad_request("exactly one upload required"),
};
let return_json = match params.return_json {
Some(string) => match string.parse() {
Ok(val) => val,
Err(_) => return bad_request("invalid return_json value"),
},
None => false,
};
match ingest::store(&image.data) {
Ok(image_id) => {
let remote_addr = request.remote_addr();
let remote_forwarded = request.header("X-Forwarded-For");
println!("{:?} {:?}: {}", remote_addr, remote_forwarded, image_id);
if let Err(e) = thumbs::thumbnail(&image_id) {
return log_error("thumbnailing just written", request, &e);
}
if return_json {
data_response(resource_object(image_id, "image"))
} else {
// relative to api/upload
Response::redirect_303(format!("../{}", image_id))
}
}
Err(e) => log_error("storing image", request, &e),
}
}
/// http://jsonapi.org/format/#errors
fn error_object(message: &str) -> Response {
println!("error: {}", message);
Response::json(&json!({ "errors": [
{ "title": message }
] }))
}
fn json_api_validate_obj(obj: &serde_json::Map<String, serde_json::Value>) {
assert!(obj.contains_key("id"), "id is mandatory in {:?}", obj);
assert!(obj.contains_key("type"), "type is mandatory in {:?}", obj);
}
/// panic if something isn't valid json-api.
/// panic is fine because the structure should be static in code
/// could be only tested at debug time..
fn json_api_validate(obj: &serde_json::Value) {
if let Some(obj) = obj.as_object() {
json_api_validate_obj(obj)
} else if let Some(list) = obj.as_array() {
for obj in list {
if let Some(obj) = obj.as_object() {
json_api_validate_obj(obj)
} else {
panic!("array item must be obj, not {:?}", obj);
}
}
} else {
panic!("data response contents must be obj, not {:?}", obj);
}
}
/// http://jsonapi.org/format/#document-top-level
fn data_response(inner: serde_json::Value) -> Response {
json_api_validate(&inner);
Response::json(&json!({ "data": inner }))
}
/// http://jsonapi.org/format/#document-resource-objects
fn resource_object<I: AsRef<str>>(id: I, type_: &'static str) -> serde_json::Value {
json!({ "id": id.as_ref(), "type": type_ })
}
fn bad_request(message: &str) -> Response {
error_object(message).with_status_code(BAD_REQUEST)
}
fn log_error(location: &str, request: &Request, error: &Error) -> Response {
let remote_addr = request.remote_addr();
let remote_forwarded = request.header("X-Forwarded-For");
println!(
"{:?} {:?}: failed: {}: {:?}",
remote_addr, remote_forwarded, location, error
);
error_object(location).with_status_code(500)
}
fn gallery_put(conn: Conn, global_secret: &[u8], request: &Request) -> Response {
let body: serde_json::Value = match json_input(request) {
Ok(body) => body,
Err(JsonError::WrongContentType) => return bad_request("missing/invalid content type"),
Err(other) => {
println!("invalid request: {:?}", other);
return bad_request("missing/invalid content type");
}
};
let body = match body.as_object() {
Some(body) => body,
None => return bad_request("non-object body"),
};
if body.contains_key("errors") {
return bad_request("'errors' must be absent");
}
let body = match body.get("data").and_then(|data| data.as_object()) {
Some(body) => body,
None => return bad_request("missing/invalid data attribute"),
};
if !body
.get("type")
.and_then(|ty| ty.as_str())
.map(|ty| "gallery" == ty)
.unwrap_or(false)
{
return bad_request("missing/invalid type: gallery");
}
let body = match body.get("attributes").and_then(|body| body.as_object()) {
Some(body) => body,
None => return bad_request("missing/invalid type: attributes"),
};
let gallery_input = match body.get("gallery").and_then(|val| val.as_str()) {
Some(string) => string,
None => return bad_request("missing/invalid type: gallery attribute"),
};
let raw_images = match body.get("images").and_then(|val| val.as_array()) {
Some(raw_images) => raw_images,
None => return bad_request("missing/invalid type: images"),
};
let mut images = Vec::with_capacity(raw_images.len());
for image in raw_images {
let image = match image.as_str() {
Some(image) => image,
None => return bad_request("non-string image in list"),
};
if !IMAGE_ID.is_match(image) {
return bad_request("invalid image id");
}
if !path::Path::new(image).exists() {
return bad_request("no such image");
}
images.push(image);
}
let (gallery, private) = match GALLERY_SPEC.captures(gallery_input) {
Some(captures) => (
captures.get(1).unwrap().as_str(),
captures.get(2).unwrap().as_str(),
),
None => {
return bad_request(concat!(
"gallery format: name!password, ",
"4-10 letters, pass: 4+ anything"
));
}
};
match gallery::gallery_store(conn, global_secret, gallery, private, &images) {
Ok(public) => data_response(resource_object(public, "gallery")),
Err(e) => log_error("saving gallery item", request, &e),
}
}
#[test]
fn validate_image_id() {
assert!(IMAGE_ID.is_match("e/abcdefghij.png"));
assert!(!IMAGE_ID.is_match(" e/abcdefghij.png"));
assert!(!IMAGE_ID.is_match("e/abcdefghi.png"));
}
fn gallery_get(request: &Request, conn: Conn, public: &str) -> Response {
if public.len() > 32 || public.find(|c: char| !c.is_ascii_graphic()).is_some() {
return bad_request("invalid gallery id");
}
let mut conn = match conn.lock() {
Ok(conn) => conn,
Err(_posion) => {
println!("poisoned! {:?}", _posion);
return error_object("internal error").with_status_code(500);
}
};
match gallery::gallery_list_all(&mut *conn, public) {
Ok(resp) => {
let values: Vec<_> = resp
.into_iter()
.map(|id| json!({"id": id, "type": "image"}))
.collect();
data_response(json!(values))
}
Err(e) => log_error("listing gallery", request, &e),
}
}
fn app_secret() -> Result<[u8; 32], Error> {
let mut buf = [0u8; 32];
let path = path::Path::new(".secret");
if path.exists() {
fs::File::open(path)?.read_exact(&mut buf)?;
} else {
rand::thread_rng().fill_bytes(&mut buf);
fs::File::create(path)?.write_all(&buf)?;
}
Ok(buf)
}
fn gallery_db() -> Result<rusqlite::Connection, Error> {
Ok(rusqlite::Connection::open("gallery.db")?)
}
fn main() -> anyhow::Result<()> {
fs::create_dir_all("e").with_context(|| {
anyhow!(
"creating storage directory inside {:?}",
std::env::current_dir()
)
})?;
let mut conn = gallery_db()?;
gallery::migrate_gallery(&mut conn)?;
thumbs::generate_all_thumbs()?;
let secret = app_secret()?;
let conn = Arc::new(Mutex::new(conn));
rouille::start_server("0.0.0.0:6699", move |request| {
rouille::log(&request, io::stdout(), || {
if let Some(e) = request.remove_prefix("/e") {
return rouille::match_assets(&e, "e");
}
router!(request,
(GET) ["/"] => { static_html("web/index.html") },
(GET) ["/dumb/"] => { static_html("web/dumb/index.html") },
(GET) ["/terms/"] => { static_html("web/terms/index.html") },
(GET) ["/gallery/"] => { static_html("web/gallery/index.html") },
(GET) ["/root.css"] => { static_css ("web/root.css") },
(GET) ["/user.svg"] => { static_svg ("web/user.svg") },
(GET) ["/bundle.js" ] => { static_js ("web/bundle.js") },
(GET) ["/gallery/gallery.css"] => { static_css ("web/gallery/gallery.css") },
(GET) ["/jquery-3.3.1.min.js"] => { static_js ("web/jquery-3.3.1.min.js") },
(POST) ["/api/upload"] => { upload(request) },
(PUT) ["/api/gallery"] => {
gallery_put(conn.clone(), &secret, request)
},
(GET) ["/api/gallery/{public}", public: String] => {
gallery_get(request, conn.clone(), &public)
},
_ => rouille::Response::empty_404()
)
})
});
}
fn static_html(path: &'static str) -> Response {
static_file("text/html", path)
}
fn static_css(path: &'static str) -> Response {
static_file("text/css", path)
}
fn static_js(path: &'static str) -> Response {
static_file("application/javascript", path)
}
fn static_svg(path: &'static str) -> Response {
static_file("image/svg+xml", path)
}
fn static_file(content_type: &'static str, path: &'static str) -> Response {
Response::from_file(content_type, fs::File::open(path).expect("static"))
}
| 31.586006 | 95 | 0.55492 |
2f0e3694580b2bdd76f60fdbb24d4c950dc1f97d | 1,718 | swift | Swift | AppSyncRealTimeClientTests/Interceptor/AppSyncJSONHelperTests.swift | DanOxlade/aws-appsync-realtime-client-ios | c26f5cf97cbabafebffb0f34f5d7283150123369 | [
"Apache-2.0"
] | null | null | null | AppSyncRealTimeClientTests/Interceptor/AppSyncJSONHelperTests.swift | DanOxlade/aws-appsync-realtime-client-ios | c26f5cf97cbabafebffb0f34f5d7283150123369 | [
"Apache-2.0"
] | null | null | null | AppSyncRealTimeClientTests/Interceptor/AppSyncJSONHelperTests.swift | DanOxlade/aws-appsync-realtime-client-ios | c26f5cf97cbabafebffb0f34f5d7283150123369 | [
"Apache-2.0"
] | null | null | null | //
// Copyright 2018-2021 Amazon.com,
// Inc. or its affiliates. All Rights Reserved.
//
// SPDX-License-Identifier: Apache-2.0
//
import XCTest
@testable import AppSyncRealTimeClient
class AppSyncJSONHelperTests: XCTestCase {
/// Test if we get the right base 64 value
///
/// - Given: A valid auth header
/// - When:
/// - I invoke the method `base64AuthenticationBlob`
/// - Then:
/// - I should get a valid base64 value
///
func testJSONParsing() {
let authHeader = AuthenticationHeader(host: "http://asd.com")
let result = AppSyncJSONHelper.base64AuthenticationBlob(authHeader)
XCTAssertNotNil(result, "Result should not be nil")
XCTAssertEqual(result, "eyJob3N0IjoiaHR0cDpcL1wvYXNkLmNvbSJ9", "Base 64 encoded result should match")
}
/// Test to check invalid json returns empty string
///
/// - Given: An invalid auth header
/// - When:
/// - I invoke the method `base64AuthenticationBlob`
/// - Then:
/// - I should get back an empty string
///
func testInValidJSONParsing() {
let authHeader = MockInvalidHeader(host: "http://asd.com")
let result = AppSyncJSONHelper.base64AuthenticationBlob(authHeader)
XCTAssertNotNil(result, "Result should not be nil")
XCTAssertEqual(result, "", "Base 64 encoded result should be empty")
}
}
private class MockInvalidHeader: AuthenticationHeader {
private enum CodingKeys: String, CodingKey {
case apiKey = "x-api-key"
}
override func encode(to encoder: Encoder) throws {
throw EncodingError.invalidValue("Error", EncodingError.Context(codingPath: [], debugDescription: ""))
}
}
| 31.814815 | 110 | 0.662398 |
d5521f7a39bc6d47207fafd28596e1a9b62f05a3 | 743 | sql | SQL | source/org.ohdsi.cdm.framework.etl/org.ohdsi.cdm.framework.etl.optumpanther/ETL/OPTUMPANTHER/Lookups/CMSPlaceOfService.sql | angujo/ETL-CDMBuilder | 6f26708622633095b439079e8f859ee8217aa41b | [
"Apache-2.0"
] | 41 | 2015-01-11T04:54:13.000Z | 2022-01-10T18:26:32.000Z | source/org.ohdsi.cdm.framework.etl/org.ohdsi.cdm.framework.etl.optumpanther/ETL/OPTUMPANTHER/Lookups/CMSPlaceOfService.sql | angujo/ETL-CDMBuilder | 6f26708622633095b439079e8f859ee8217aa41b | [
"Apache-2.0"
] | 34 | 2015-01-22T14:02:06.000Z | 2021-12-13T10:19:10.000Z | source/org.ohdsi.cdm.framework.etl/org.ohdsi.cdm.framework.etl.optumpanther/ETL/OPTUMPANTHER/Lookups/CMSPlaceOfService.sql | angujo/ETL-CDMBuilder | 6f26708622633095b439079e8f859ee8217aa41b | [
"Apache-2.0"
] | 41 | 2015-01-08T20:48:15.000Z | 2022-01-10T14:22:35.000Z | WITH top_level
AS
(SELECT concept_id, concept_name
FROM {sc}.concept
LEFT JOIN {sc}.concept_ancestor
ON concept_id=descendant_concept_id
AND ancestor_concept_id!=descendant_concept_id
WHERE domain_id='Visit'
AND standard_concept='S'
AND ancestor_concept_id IS NULL
)
/*Find all descendants of those ancestors*/
SELECT distinct descendant.concept_id, top_level.concept_id as terminal_ancestor_concept_id, 'None' as Domain, cast('1900/1/1' as date) as VALID_START_DATE, cast('2100/1/1' as date) as VALID_END_DATE
FROM {sc}.concept_ancestor
JOIN top_level
ON top_level.concept_id = ancestor_concept_id
JOIN {sc}.concept descendant
ON descendant.concept_id = descendant_concept_id
WHERE descendant.domain_id = 'Visit'; | 37.15 | 199 | 0.794078 |
045b80d0e91fa520ca51b4428349070d32d04fd9 | 1,457 | java | Java | mongodb-orm-master/src/main/java/com/mongodb/orm/MqlMapConfiguration.java | williamjie/sprintboot_test | 8f18c70304a694496e09a684a1116f14a0cceb4a | [
"Apache-2.0"
] | 2 | 2018-04-26T03:04:46.000Z | 2018-11-14T11:48:27.000Z | mongodb-orm-master/src/main/java/com/mongodb/orm/MqlMapConfiguration.java | williamjie/sprintboot_test | 8f18c70304a694496e09a684a1116f14a0cceb4a | [
"Apache-2.0"
] | 1 | 2018-11-14T02:59:37.000Z | 2018-11-14T02:59:37.000Z | mongodb-orm-master/src/main/java/com/mongodb/orm/MqlMapConfiguration.java | williamjie/sprintboot_test | 8f18c70304a694496e09a684a1116f14a0cceb4a | [
"Apache-2.0"
] | null | null | null | package com.mongodb.orm;
import java.util.HashMap;
import java.util.Map;
import com.mongodb.exception.StatementException;
import com.mongodb.orm.engine.Config;
/**
* Mongo QL configuration. Transfer xml config.
*
* @author: xiangping_yu
* @data : 2013-6-4
* @since : 1.5
*/
public class MqlMapConfiguration {
/**
* Mongodb mql configuration.
*/
private Map<String, Config> configs;
/**
* Mongodb orm configuration
*/
private Map<String, Config> mappings;
public MqlMapConfiguration() {
configs = new HashMap<String, Config>();
mappings = new HashMap<String, Config>();
}
public Config getConfig(String key) {
return configs.get(key);
}
public MqlMapConfiguration addConfig(String key, Config value) {
if (configs.containsKey(key)) {
throw new StatementException("Alias name conflict occurred. This mql '"+key+"' is already exists.");
}
configs.put(key, value);
return this;
}
public Config getMapping(String key) {
return mappings.get(key);
}
public MqlMapConfiguration addMapping(String key, Config value) {
if (mappings.containsKey(key)) {
throw new StatementException("Alias name conflict occurred. This mapping '"+key+"' is already exists.");
}
mappings.put(key, value);
return this;
}
public Map<String, Config> getConfigs() {
return configs;
}
public Map<String, Config> getMappings() {
return mappings;
}
}
| 22.075758 | 111 | 0.673988 |
0e46b2cb532a6536e4baf30d253e2b059dd7b128 | 1,423 | sql | SQL | Plants/compara_sanity_check.sql | EnsemblGenomes/personal-dbolser | 8abca40e2078bd2b1dad74e4b3fbe2c84e984a23 | [
"Apache-2.0"
] | 1 | 2019-02-27T09:08:39.000Z | 2019-02-27T09:08:39.000Z | Plants/compara_sanity_check.sql | EnsemblGenomes/personal-dbolser | 8abca40e2078bd2b1dad74e4b3fbe2c84e984a23 | [
"Apache-2.0"
] | null | null | null | Plants/compara_sanity_check.sql | EnsemblGenomes/personal-dbolser | 8abca40e2078bd2b1dad74e4b3fbe2c84e984a23 | [
"Apache-2.0"
] | null | null | null |
SELECT
COUNT(*),
COUNT(DISTINCT species_set_id)
FROM
method_link_species_set mlss
INNER JOIN
species_set_header ssh USING (species_set_id)
WHERE
COALESCE(mlss.first_release, 0) =
COALESCE( ssh.first_release, 0)
AND
COALESCE(mlss.last_release, 0) =
COALESCE( ssh.last_release, 0)
;
SELECT
COUNT(*),
COUNT(DISTINCT species_set_id)
FROM
method_link_species_set mlss
INNER JOIN
species_set_header ssh USING (species_set_id)
;
-- And so...
SELECT
method_link_species_set_id,
species_set_id,
mlss.first_release, ssh.first_release,
mlss.last_release, ssh.last_release
FROM
method_link_species_set mlss
INNER JOIN
species_set_header ssh USING (species_set_id)
WHERE
COALESCE(mlss.first_release, 0) !=
COALESCE( ssh.first_release, 0)
OR
COALESCE(mlss.last_release, 0) !=
COALESCE( ssh.last_release, 0)
LIMIT
10
;
-- Fix 1
UPDATE
method_link_species_set mlss
INNER JOIN
species_set_header ssh USING (species_set_id)
SET
ssh.first_release = mlss.first_release
WHERE
mlss.first_release IS NOT NULL
AND
ssh.first_release IS NULL
;
SELECT * FROM method_link_species_set WHERE first_release IS NULL;
-- Identify duplicate species sets
SELECT x, GROUP_CONCAT(species_set_id), COUNT(*)
FROM (
SELECT species_set_id, GROUP_CONCAT(genome_db_id ORDER BY genome_db_id) AS x
FROM species_set
GROUP BY species_set_id
) AS xxx GROUP BY x HAVING COUNT(*) > 1
LIMIT 03;
| 18.24359 | 78 | 0.767393 |
bb534a70f5a6b4f284dd6ccb20fa55fa58877f9c | 264 | asm | Assembly | audio/sfx/intro_lunge.asm | etdv-thevoid/pokemon-rgb-enhanced | 5b244c1cf46aab98b9c820d1b7888814eb7fa53f | [
"MIT"
] | 1 | 2022-01-09T05:28:52.000Z | 2022-01-09T05:28:52.000Z | audio/sfx/intro_lunge.asm | ETDV-TheVoid/pokemon-rgb-enhanced | 5b244c1cf46aab98b9c820d1b7888814eb7fa53f | [
"MIT"
] | null | null | null | audio/sfx/intro_lunge.asm | ETDV-TheVoid/pokemon-rgb-enhanced | 5b244c1cf46aab98b9c820d1b7888814eb7fa53f | [
"MIT"
] | null | null | null | SFX_Intro_Lunge_Ch7:
unknownnoise0x20 6, 32, 16
unknownnoise0x20 6, 47, 64
unknownnoise0x20 6, 79, 65
unknownnoise0x20 6, 143, 65
unknownnoise0x20 6, 207, 66
unknownnoise0x20 8, 215, 66
unknownnoise0x20 15, 231, 67
unknownnoise0x20 15, 242, 67
endchannel
| 24 | 29 | 0.772727 |
51a01e31a324934e5ead9543830b8456c3906874 | 632 | lua | Lua | states/intro.lua | MIfeanyi/LoveJoust | b2cc82e7ad2d92ad8af081ae616fc16be8474def | [
"MIT"
] | null | null | null | states/intro.lua | MIfeanyi/LoveJoust | b2cc82e7ad2d92ad8af081ae616fc16be8474def | [
"MIT"
] | 6 | 2017-02-17T10:26:05.000Z | 2017-09-26T04:03:41.000Z | states/intro.lua | MIfeanyi/LoveJoust | b2cc82e7ad2d92ad8af081ae616fc16be8474def | [
"MIT"
] | null | null | null | local state = {}
function state:new()
return lovelyMoon.new(self)
end
function state:load()
end
function state:close()
end
function state:enable()
end
function state:disable()
end
function state:update(dt)
end
function state:draw()
love.graphics.print("Love Joust", 400, 300)
love.graphics.print("Press space to begin!", 400, 400)
end
function state:keypressed(key, unicode)
end
function state:keyreleased(key, unicode)
if key == "space" then
lovelyMoon.switchState("intro", "game")
end
end
function state:mousepressed(x, y, button)
end
function state:mousereleased(x, y, button)
end
return state
| 12.392157 | 56 | 0.724684 |
0496299e004b6209e8f74f24b36da0692d6be4ba | 9,313 | java | Java | folding-android/app/src/main/java/com/sonymobile/androidapp/gridcomputing/assets/CopyAssets.java | FoldingAtHome/FAHAndroid | dfee3a9aa4540babf7a920ff8b10f93363903ebc | [
"MIT"
] | 14 | 2019-05-30T04:47:25.000Z | 2021-07-06T02:59:31.000Z | folding-android/app/src/main/java/com/sonymobile/androidapp/gridcomputing/assets/CopyAssets.java | FoldingAtHome/FAHAndroid | dfee3a9aa4540babf7a920ff8b10f93363903ebc | [
"MIT"
] | null | null | null | folding-android/app/src/main/java/com/sonymobile/androidapp/gridcomputing/assets/CopyAssets.java | FoldingAtHome/FAHAndroid | dfee3a9aa4540babf7a920ff8b10f93363903ebc | [
"MIT"
] | 9 | 2019-06-21T07:33:56.000Z | 2021-09-15T00:17:49.000Z | /*
* Licensed under the LICENSE.
* Copyright 2017, Sony Mobile Communications Inc.
*/
package com.sonymobile.androidapp.gridcomputing.assets;
import android.content.Context;
import com.sonymobile.androidapp.gridcomputing.log.Log;
import com.sonymobile.androidapp.gridcomputing.utils.ApplicationData;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.List;
/**
* Helper class which asynchronously copies the runtime data for script
* execution to a private mutable location.
*/
public final class CopyAssets implements Runnable {
/**
* Execution file directory path.
*/
public static final String EXEC_DIR = "execdir";
/**
* Openmm plugins dir namee.
*/
public static final String LIB_OPENMM_PLUGIN_DIR = "plugins";
public static final String GCOMP = "libgcomp_node.so";
public static final String CLIENT_JS_FILE = "client.js";
private static final String[] ASSETS_FILES = {
"fsm.js", "environment.js", "consts_client.js", "script_prepend.js", CLIENT_JS_FILE
};
/**
* The OpenMM Plugin Libraries.
*/
private static final String[] LIB_OPENMM_PLUGIN_FILES = {
"libOpenMMPME.so", "libOpenMMRPMDReference.so", "libOpenMMDrudeReference.so"
};
/**
* Size of the buffer to use when copying files.
*/
private static final int BUFFER_SIZE = 65535;
/**
* A context used to read from the assets and create a private dir.
*/
private final Context mContext;
/**
* A callback that will be called when the assets are copied.
*/
private final AssetCopyListener mListener;
/**
* Constructs a CopyAssets.
*
* @param context Execution context.
* @param listener the callback that will be called when the assets are
* copied.
*/
public CopyAssets(final Context context, final AssetCopyListener listener) {
this.mContext = context;
this.mListener = listener;
}
/**
* Checks if all files were copied.
*
* @return true if all files were copied.
*/
public static boolean filesCopied() {
final Context context = ApplicationData.getAppContext();
final File dir = context.getFilesDir();
final File execDir = new File(dir, EXEC_DIR);
final File pluginsDir = new File(execDir, LIB_OPENMM_PLUGIN_DIR);
if (execDir.exists() && execDir.isDirectory()
&& pluginsDir.exists() && pluginsDir.isDirectory()) {
final String[] fileNames = execDir.list();
if (fileNames != null) {
final List<String> execFiles = Arrays.asList(fileNames);
for (String file : ASSETS_FILES) {
if (!execFiles.contains(file)) {
return false;
}
}
}
final String[] pluginFileNames = pluginsDir.list();
if (pluginFileNames != null) {
final List<String> pluginFiles = Arrays.asList(pluginFileNames);
for (String file : LIB_OPENMM_PLUGIN_FILES) {
if (!pluginFiles.contains(file)) {
return false;
}
}
}
return true;
}
return false;
}
/**
* Deletes all files from exec dir.
*/
public static void deleteFiles() {
final Context context = ApplicationData.getAppContext();
final File execDir = context.getDir(EXEC_DIR, Context.MODE_PRIVATE);
deleteFilesRecursive(execDir);
}
/**
* Deletes a file recursively.
*
* @param fileOrDirectory the file to delete.
*/
private static void deleteFilesRecursive(final File fileOrDirectory) {
final File[] filesList = fileOrDirectory.listFiles();
if (filesList != null) {
for (File child : filesList) {
deleteFilesRecursive(child);
}
}
final boolean delete = fileOrDirectory.delete();
if (!delete) {
Log.d("failed to delete files!");
}
}
/**
* Copies a file from assets to a private directory (maintaining the name)
* if the file is not required, ignore it in case of Exception.
*
* @param filename the name of the file from the assets.
* @param optional flag indicating if this file is optional or required.
* @throws IOException in case any IOException occurs when copying the file.
*/
private void copyAssetsFile(final String filename, final boolean optional) throws IOException {
try {
final InputStream inputStream = mContext.getAssets().open(filename);
copyFile(inputStream, filename, false);
} catch (IOException exception) {
if (!optional) {
throw exception;
}
}
}
/**
* Copies a native lib file to a private directory and sets the file to be
* executable (or not).
*
* @param libName the name of the file from the lib folder.
* @param outputFile the name of the output file.
* @param exec flag indicating if this file is executable or not.
* @throws IOException in case any IOException occurs when copying the file.
*/
private void copyLibFile(final String libName, final String outputFile, final boolean exec)
throws IOException {
final InputStream inputStream = getInputStreamFromNativeLib(libName);
copyFile(inputStream, outputFile, exec);
}
/**
* Copies a file from assets to a private directory and sets the file to be
* executable (or not).
*
* @param fileInputStream the input stream of the file.
* @param outputFile the name of the output file.
* @param exec flag indicating if this file is executable or not.
* @throws IOException in case any IOException occurs when copying the file.
*/
private void copyFile(final InputStream fileInputStream, final String outputFile,
final boolean exec)
throws IOException {
File file = null;
File directory = null;
OutputStream out = null;
try {
file = new File(mContext.getDir(EXEC_DIR,
Context.MODE_PRIVATE), outputFile);
// Create directories if needed
directory = file.getParentFile();
if (directory == null) {
throw new IOException("Could not create directory.");
} else if (!directory.isDirectory() && !directory.mkdirs()) {
throw new IOException("Could not create directory.");
}
out = new FileOutputStream(file);
final byte[] byteArray = new byte[BUFFER_SIZE];
int size = 0;
while ((size = fileInputStream.read(byteArray)) > 0) {
out.write(byteArray, 0, size);
}
} finally {
try {
if (fileInputStream != null) {
fileInputStream.close();
}
} catch (final IOException eIn) {
if (out != null) {
out.close();
}
throw eIn;
}
if (out != null) {
out.close();
}
if (file == null || !file.setExecutable(exec, true)) {
throw new IOException("set executable failure");
}
}
}
/**
* Gets the input stream from a file inside the native library dir.
*
* @param libName the name of the lib.
* @return the input stream.
* @throws FileNotFoundException if the specified file doesn't exists.
*/
private InputStream getInputStreamFromNativeLib(final String libName)
throws FileNotFoundException {
final String nativeLibraryDir = ApplicationData.getAppContext()
.getApplicationInfo().nativeLibraryDir;
final File libraryFolder = new File(nativeLibraryDir);
final File[] files = libraryFolder.listFiles();
if (files != null) {
for (final File curr : files) {
if (curr.isFile() && curr.getName().contains(libName)) {
return new FileInputStream(curr);
}
}
}
throw new FileNotFoundException(
"The specified file doesn't exists inside the native library dir: " + libName);
}
@Override
public void run() {
try {
for (String file : ASSETS_FILES) {
copyAssetsFile(file, false);
}
for (String file : LIB_OPENMM_PLUGIN_FILES) {
copyLibFile(file, LIB_OPENMM_PLUGIN_DIR + File.separator + file, false);
}
mListener.onAssetCopySuccess();
} catch (final IOException exception) {
Log.e(exception.getLocalizedMessage());
exception.printStackTrace();
mListener.onAssetCopyError();
}
}
}
| 34.113553 | 99 | 0.590358 |
3ab2dd976b8b648e084c11db6a4da08ea555c051 | 385 | lua | Lua | fsm/fsm.lua | shuimu98/behaviourtree | b2122f5b13e92d4d9311deef6c93c140b4df8d0a | [
"MIT"
] | 2 | 2022-01-10T02:22:56.000Z | 2022-03-31T14:19:02.000Z | fsm/fsm.lua | shuimu98/behaviourtree | b2122f5b13e92d4d9311deef6c93c140b4df8d0a | [
"MIT"
] | null | null | null | fsm/fsm.lua | shuimu98/behaviourtree | b2122f5b13e92d4d9311deef6c93c140b4df8d0a | [
"MIT"
] | 2 | 2021-08-25T12:00:53.000Z | 2022-01-10T02:22:50.000Z | oo.class('FSM')
function FSM:__init()
self._actions = {}
self._firstState = nil
end
function FSM:addState(action, state)
state = state or action:getActionState()
if self._actions[state] then return -1 end
self._actions[state] = action
if not self._firstState then self._firstState = state end
end
function FSM:getFirstState()
return self._firstState
end
| 21.388889 | 61 | 0.716883 |
fb04b0558013287571b381177181cdf39a2a3b6d | 69 | sql | SQL | src/db/postgres/sql/verification-done.sql | thylacine/websub-hub | 3bc885c4b6ef8e5ced2ee9708194523a41ebfe7a | [
"0BSD"
] | 1 | 2021-11-04T06:37:43.000Z | 2021-11-04T06:37:43.000Z | src/db/postgres/sql/verification-done.sql | thylacine/websub-hub | 3bc885c4b6ef8e5ced2ee9708194523a41ebfe7a | [
"0BSD"
] | null | null | null | src/db/postgres/sql/verification-done.sql | thylacine/websub-hub | 3bc885c4b6ef8e5ced2ee9708194523a41ebfe7a | [
"0BSD"
] | null | null | null | --
DELETE FROM verification_in_progress
WHERE id = $(verificationId)
| 17.25 | 36 | 0.797101 |
2f3eb8a6d5f8a423c0f7ce3258e3f0434256163f | 189 | php | PHP | vendor/RaulFraile/Ladybug/examples/dump_and_die.php | rpcabrera/networld | 0c6e9d4f623344b4f5ed108c2ca35a7f63947dcd | [
"MIT"
] | null | null | null | vendor/RaulFraile/Ladybug/examples/dump_and_die.php | rpcabrera/networld | 0c6e9d4f623344b4f5ed108c2ca35a7f63947dcd | [
"MIT"
] | null | null | null | vendor/RaulFraile/Ladybug/examples/dump_and_die.php | rpcabrera/networld | 0c6e9d4f623344b4f5ed108c2ca35a7f63947dcd | [
"MIT"
] | null | null | null | <?php
require_once __DIR__.'/../vendor/autoload.php';
Ladybug\Loader::loadHelpers();
$var1 = 'hello world!';
ladybug_dump_die($var1); // or ldd($var1)
echo 'This code is unreachable!';
| 17.181818 | 47 | 0.693122 |
25831b37b531fade718f12b8be7600df80d050f8 | 213 | dart | Dart | lib/gateway/common/api_routes.dart | AndX2/iron-bank | dd2ca245b6984503c1af603ce8f40ad1fffbbce4 | [
"CC0-1.0"
] | null | null | null | lib/gateway/common/api_routes.dart | AndX2/iron-bank | dd2ca245b6984503c1af603ce8f40ad1fffbbce4 | [
"CC0-1.0"
] | null | null | null | lib/gateway/common/api_routes.dart | AndX2/iron-bank | dd2ca245b6984503c1af603ce8f40ad1fffbbce4 | [
"CC0-1.0"
] | null | null | null | /// Path API
class ApiRoutes {
static const settingsUrl = '/settings';
static const _apiPrefix = '/api';
static const statement = '$_apiPrefix/statement';
static const scoring = '$_apiPrefix/scoring';
}
| 21.3 | 51 | 0.699531 |
e06b328e94b5e0b01a0e7d98af80283544204331 | 58,751 | sql | SQL | docs/sourcecodes/OpenBridge-passos-ui/ob-paasos-web/install/sql/openbridge-db-schema.sql | gavin2lee/incubator-gl | c95623af811195c3e89513ec30e52862d6562add | [
"Apache-2.0"
] | 3 | 2016-07-25T03:47:06.000Z | 2019-11-18T08:42:00.000Z | docs/sourcecodes/OpenBridge-passos-ui/ob-paasos-web/install/sql/openbridge-db-schema.sql | gavin2lee/incubator-gl | c95623af811195c3e89513ec30e52862d6562add | [
"Apache-2.0"
] | null | null | null | docs/sourcecodes/OpenBridge-passos-ui/ob-paasos-web/install/sql/openbridge-db-schema.sql | gavin2lee/incubator-gl | c95623af811195c3e89513ec30e52862d6562add | [
"Apache-2.0"
] | 2 | 2019-11-18T08:41:53.000Z | 2020-09-11T08:53:18.000Z | -- MySQL dump 10.13 Distrib 5.7.12, for Win64 (x86_64)
--
-- Host: 192.168.10.82 Database: openbridge
-- ------------------------------------------------------
-- Server version 5.5.47-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE openbridge
DEFAULT CHARACTER SET utf8
DEFAULT COLLATE utf8_general_ci;
USE openbridge;
SET NAMES utf8;
--
-- Table structure for table `mod_app`
--
DROP TABLE IF EXISTS `mod_app`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_app` (
`app_id` varchar(32) NOT NULL,
`app_name` varchar(128) NOT NULL,
`app_desc` varchar(1024) DEFAULT NULL,
`app_type` varchar(10) NOT NULL,
`app_logo` varchar(45) DEFAULT NULL,
`app_leader` varchar(32) NOT NULL,
`creator` varchar(32) NOT NULL,
`creation_time` datetime NOT NULL,
`category_id` varchar(32) DEFAULT NULL,
`app_information` varchar(2000) DEFAULT NULL,
`secure_key` varchar(32) DEFAULT NULL COMMENT '动态token',
`project_code` varchar(50) DEFAULT NULL,
PRIMARY KEY (`app_id`),
UNIQUE KEY `unique_project_code` (`project_code`),
KEY `i_category_id` (`category_id`) USING BTREE,
CONSTRAINT `mod_app_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `mod_app_category` (`category_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_app_category`
--
DROP TABLE IF EXISTS `mod_app_category`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_app_category` (
`category_id` varchar(32) NOT NULL,
`category_name` varchar(100) DEFAULT NULL,
`c_order` int(4) DEFAULT NULL,
`hierarchy_id` varchar(300) DEFAULT NULL,
`parent_id` varchar(32) DEFAULT NULL,
`service_count` int(11) DEFAULT NULL,
PRIMARY KEY (`category_id`),
KEY `parent_id` (`parent_id`) USING BTREE,
CONSTRAINT `mod_app_category_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `mod_app_category` (`category_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_app_comment`
--
DROP TABLE IF EXISTS `mod_app_comment`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_app_comment` (
`id` varchar(32) NOT NULL DEFAULT '',
`content` varchar(3000) DEFAULT NULL COMMENT '内容',
`score` int(11) DEFAULT NULL COMMENT '分数',
`version_id` varchar(32) DEFAULT NULL,
`app_id` varchar(32) DEFAULT NULL,
`create_user` varchar(32) DEFAULT NULL,
`create_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`subject` varchar(1000) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_app_comment_help`
--
DROP TABLE IF EXISTS `mod_app_comment_help`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_app_comment_help` (
`id` varchar(32) NOT NULL DEFAULT '',
`comment_id` varchar(3000) DEFAULT NULL,
`comment_help` varchar(1) DEFAULT NULL,
`create_user` varchar(32) DEFAULT NULL,
`create_date` date DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_app_dashboard_data`
--
DROP TABLE IF EXISTS `mod_app_dashboard_data`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_app_dashboard_data` (
`app_id` varchar(32) DEFAULT NULL,
`app_name` varchar(2000) DEFAULT NULL,
`double_value` float DEFAULT NULL,
`string_value` varchar(200) DEFAULT NULL,
`data_type` int(11) DEFAULT NULL COMMENT '1访问次数 2 访问耗时 3成功率 4ip数 5开发人员数 6 实例数量 7需求数 8 bug数量 9代码行数 10开始时间 11结束时间',
`time_type` int(11) DEFAULT NULL COMMENT '0 最近半天 1最近一天 2最近半个月 3最近1个月 4最近3个月 5最近1年',
UNIQUE KEY `app_dashbord` (`app_id`,`data_type`,`time_type`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_app_dashboard_data_t`
--
DROP TABLE IF EXISTS `mod_app_dashboard_data_t`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_app_dashboard_data_t` (
`app_id` varchar(32) DEFAULT NULL,
`app_name` varchar(2000) DEFAULT NULL,
`double_value` float DEFAULT NULL,
`string_value` varchar(200) DEFAULT NULL,
`data_type` int(11) DEFAULT NULL COMMENT '1访问次数 2 访问耗时 3成功率 4ip数 5开发人员数 6 实例数量 7需求数 8 bug数量 9代码行数',
`time_type` int(11) DEFAULT NULL COMMENT '0 最近半天 1最近一天 2最近半个月 3最近1个月 4最近3个月 5最近1年',
UNIQUE KEY `app_dashbord` (`app_id`,`data_type`,`time_type`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='先往这个表里面插入数据 然后统一copy到主表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_app_dev`
--
DROP TABLE IF EXISTS `mod_app_dev`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_app_dev` (
`app_id` varchar(32) DEFAULT NULL,
`user_id` varchar(32) DEFAULT NULL,
`rec_id` varchar(32) NOT NULL,
PRIMARY KEY (`rec_id`),
UNIQUE KEY `a_u_un` (`user_id`,`app_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_app_logs`
--
DROP TABLE IF EXISTS `mod_app_logs`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_app_logs` (
`log_id` varchar(32) NOT NULL,
`app_id` varchar(45) NOT NULL COMMENT 'appID',
`version_id` varchar(45) NOT NULL COMMENT '版本ID',
`oper_time` int(11) NOT NULL COMMENT '操作耗时,秒为单位',
`oper_success` bit(1) NOT NULL,
`operation` varchar(45) NOT NULL COMMENT '操作类型',
`log_time` datetime NOT NULL COMMENT '日志产生时间',
`log_user` varchar(32) NOT NULL COMMENT '执行用户',
`log_text` mediumtext NOT NULL COMMENT '日志内容',
`log_param1` varchar(45) NOT NULL,
`log_param2` varchar(45) NOT NULL,
PRIMARY KEY (`log_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_app_source`
--
DROP TABLE IF EXISTS `mod_app_source`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_app_source` (
`app_id` varchar(32) NOT NULL,
`project_name` varchar(128) DEFAULT NULL,
`project_package` varchar(256) DEFAULT NULL,
`scm_type` varchar(45) DEFAULT NULL,
`scm_url` varchar(255) DEFAULT NULL,
`dev_lang` varchar(45) DEFAULT NULL,
`dev_framework` varchar(45) DEFAULT NULL,
`maven_group_id` varchar(45) DEFAULT NULL,
`maven_artifact_id` varchar(45) DEFAULT NULL,
`maven_version` varchar(45) DEFAULT NULL,
PRIMARY KEY (`app_id`),
UNIQUE KEY `u_group_artifact` (`maven_group_id`,`maven_artifact_id`) USING BTREE,
UNIQUE KEY `u_project_name` (`project_name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_app_version`
--
DROP TABLE IF EXISTS `mod_app_version`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_app_version` (
`version_id` varchar(32) NOT NULL,
`app_id` varchar(32) NOT NULL,
`version_status` varchar(20) NOT NULL,
`version_code` varchar(45) NOT NULL,
`scm_url` varchar(255) DEFAULT NULL,
`creator` varchar(32) NOT NULL,
`creation_time` datetime NOT NULL,
`v_enabled` bit(1) NOT NULL,
`version_desc` varchar(1024) DEFAULT NULL,
`last_build_time` datetime DEFAULT NULL,
`last_build_log` mediumtext,
`last_build_success` bit(1) DEFAULT NULL,
`last_build_success_file` varchar(255) DEFAULT NULL,
PRIMARY KEY (`version_id`),
UNIQUE KEY `versionCode_UN` (`app_id`,`version_code`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_app_version_api`
--
DROP TABLE IF EXISTS `mod_app_version_api`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_app_version_api` (
`ref_id` varchar(32) NOT NULL,
`app_id` varchar(32) NOT NULL,
`version_id` varchar(32) NOT NULL,
`service_id` varchar(32) NOT NULL,
`service_name` varchar(255) NOT NULL,
`service_version_id` varchar(32) NOT NULL,
`service_version_code` varchar(255) NOT NULL,
PRIMARY KEY (`ref_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_dashboard_data`
--
DROP TABLE IF EXISTS `mod_dashboard_data`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_dashboard_data` (
`id` varchar(32) NOT NULL,
`service_id` varchar(32) DEFAULT NULL COMMENT '业务主键',
`data_type` varchar(32) DEFAULT NULL COMMENT '数据类型 app api',
`date_time` date DEFAULT NULL COMMENT '数据日期 2015-03-21 格式',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建日期',
`bug_count` double DEFAULT NULL COMMENT 'bug数量',
`demand_count` double DEFAULT NULL COMMENT '需求数',
`taskelapse_count` double DEFAULT NULL COMMENT 'bug和需求总耗时 秒',
`complete_count` double DEFAULT NULL COMMENT '完成数',
`visits_count` double DEFAULT NULL COMMENT '访问次数',
`elapse_count` double DEFAULT NULL COMMENT '访问耗时 秒',
`success_count` double DEFAULT NULL COMMENT '访问成功次数',
`ip_count` double DEFAULT NULL COMMENT '访问ip数量',
`complete_time_count` double DEFAULT NULL,
`codeline` double DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='看板数据 每日收集';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_dashboard_hist`
--
DROP TABLE IF EXISTS `mod_dashboard_hist`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_dashboard_hist` (
`id` varchar(32) NOT NULL,
`date_time` date DEFAULT NULL,
`result` varchar(1) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_external_app`
--
DROP TABLE IF EXISTS `mod_external_app`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_external_app` (
`id` varchar(32) NOT NULL COMMENT '主键',
`name` varchar(128) NOT NULL COMMENT '应用名称',
`create_time` datetime NOT NULL COMMENT '创建时间',
`creater` varchar(32) NOT NULL COMMENT '创建者',
`secure_key` varchar(32) DEFAULT NULL COMMENT '动态token',
PRIMARY KEY (`id`),
UNIQUE KEY `uniqueName` (`name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='外部应用';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_preset_category`
--
DROP TABLE IF EXISTS `mod_preset_category`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_preset_category` (
`category_id` varchar(32) NOT NULL,
`category_name` varchar(100) NOT NULL,
`c_order` int(11) DEFAULT NULL,
`parent_id` varchar(32) DEFAULT NULL,
PRIMARY KEY (`category_id`),
KEY `FK_mod_preset_category_parent_idx` (`parent_id`) USING BTREE,
CONSTRAINT `mod_preset_category_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `mod_preset_category` (`category_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='预置服务分类';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_process_log`
--
DROP TABLE IF EXISTS `mod_process_log`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_process_log` (
`log_id` varchar(32) NOT NULL,
`create_user` varchar(32) NOT NULL,
`create_time` datetime NOT NULL,
`content` varchar(100) NOT NULL,
`process_id` varchar(32) NOT NULL COMMENT '流程id',
PRIMARY KEY (`log_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='流程日志表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_process_node`
--
DROP TABLE IF EXISTS `mod_process_node`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_process_node` (
`node_id` varchar(32) NOT NULL,
`process_log` varchar(32) NOT NULL COMMENT '流程日志id',
`node_name` varchar(50) NOT NULL COMMENT '环节名称',
`p_time` datetime DEFAULT NULL COMMENT '审批时间',
`p_user` varchar(32) DEFAULT NULL COMMENT '审批人',
`p_comments` varchar(255) DEFAULT NULL COMMENT '审批意见',
`p_result` char(1) DEFAULT NULL COMMENT '审批结果,1:通过,2:驳回',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`node_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='流程节点表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_project_jira_relation`
--
DROP TABLE IF EXISTS `mod_project_jira_relation`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_project_jira_relation` (
`id` varchar(32) NOT NULL,
`project_id` varchar(32) NOT NULL COMMENT '项目ID',
`jira_project_key` varchar(32) NOT NULL COMMENT 'jira项目ID',
`source` tinyint(4) NOT NULL COMMENT '1:APPFactory 2:APIManager',
`creator` varchar(32) NOT NULL,
`creation_time` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `IDX_JIRA_RELATION_PROJECT_ID` (`project_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='项目与jira中项目关联表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_project_jira_story_favorite`
--
DROP TABLE IF EXISTS `mod_project_jira_story_favorite`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_project_jira_story_favorite` (
`id` varchar(32) NOT NULL,
`user_id` varchar(32) DEFAULT NULL COMMENT '关联用户',
`story_key` varchar(32) DEFAULT NULL COMMENT '故事key',
`project_key` varchar(32) DEFAULT NULL COMMENT 'jira项目key',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='收藏的故事';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_project_jira_story_relation`
--
DROP TABLE IF EXISTS `mod_project_jira_story_relation`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_project_jira_story_relation` (
`id` varchar(32) NOT NULL,
`story_key` varchar(32) NOT NULL COMMENT '故事key',
`jira_relation_id` varchar(32) NOT NULL COMMENT 'jira项目关联记录ID',
`creator` varchar(32) NOT NULL,
`creation_time` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_mod_project_jira_relation_story` (`jira_relation_id`) USING BTREE,
CONSTRAINT `mod_project_jira_story_relation_ibfk_1` FOREIGN KEY (`jira_relation_id`) REFERENCES `mod_project_jira_relation` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='项目与jira中故事关联表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_service`
--
DROP TABLE IF EXISTS `mod_service`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_service` (
`service_id` varchar(32) NOT NULL,
`project_name` varchar(45) DEFAULT NULL,
`project_package` varchar(255) DEFAULT NULL,
`service_name` varchar(100) NOT NULL,
`service_desc` varchar(500) DEFAULT NULL,
`service_leader` varchar(32) DEFAULT NULL,
`create_time` datetime NOT NULL,
`create_user` varchar(32) NOT NULL,
`s_logo` varchar(50) DEFAULT NULL,
`s_protocol` varchar(20) NOT NULL,
`update_time` datetime DEFAULT NULL,
`scm_type` varchar(45) DEFAULT NULL,
`scm_url` varchar(255) DEFAULT NULL,
`store_category` varchar(32) DEFAULT NULL COMMENT '服务分类',
`use_amount` int(11) DEFAULT NULL COMMENT '使用量',
`update_flag` int(1) DEFAULT NULL COMMENT '更新标志,用于统计使用量',
`market_type` int(1) DEFAULT NULL COMMENT '0:默认值,1:预置服务标识,2:企业服务或本地服务标识',
`preset_category` varchar(32) DEFAULT NULL COMMENT '预置服务分类',
`service_source` varchar(1) DEFAULT NULL COMMENT '服务来源,1保存,2导入',
`service_public` varchar(1) DEFAULT NULL COMMENT '服务是否公开,0公开,1或者null不公开',
`dev_lang` varchar(45) DEFAULT NULL COMMENT '服务开发语言',
`dev_framework` varchar(45) DEFAULT NULL COMMENT '服务开发框架',
`secure_key` varchar(32) DEFAULT NULL COMMENT '动态token',
`project_code` varchar(50) DEFAULT NULL,
PRIMARY KEY (`service_id`),
UNIQUE KEY `project_name_UNIQUE` (`project_name`) USING BTREE,
UNIQUE KEY `unique_project_code` (`project_code`),
KEY `i_service_leader` (`service_leader`) USING BTREE,
KEY `i_server_user` (`create_user`) USING BTREE,
KEY `FK_mod_service_category_idx` (`store_category`) USING BTREE,
KEY `FK_mod_service_preset_category_idx` (`preset_category`) USING BTREE,
CONSTRAINT `mod_service_ibfk_1` FOREIGN KEY (`preset_category`) REFERENCES `mod_preset_category` (`category_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_service_comment`
--
DROP TABLE IF EXISTS `mod_service_comment`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_service_comment` (
`comment_id` varchar(32) NOT NULL,
`user_id` varchar(32) NOT NULL,
`create_date` datetime DEFAULT NULL,
`content` varchar(500) DEFAULT NULL,
`version_id` varchar(32) DEFAULT NULL,
PRIMARY KEY (`comment_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='服务评论';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_service_dependency`
--
DROP TABLE IF EXISTS `mod_service_dependency`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_service_dependency` (
`ref_id` varchar(32) NOT NULL,
`service_id` varchar(32) NOT NULL,
`version_id` varchar(32) NOT NULL,
`ref_service_id` varchar(32) NOT NULL,
`ref_version_id` varchar(32) NOT NULL,
PRIMARY KEY (`ref_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_service_dev`
--
DROP TABLE IF EXISTS `mod_service_dev`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_service_dev` (
`rec_id` varchar(32) NOT NULL,
`service_id` varchar(32) NOT NULL,
`user_id` varchar(32) NOT NULL,
PRIMARY KEY (`rec_id`),
KEY `i_service_id` (`service_id`) USING BTREE,
KEY `i_user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_service_logs`
--
DROP TABLE IF EXISTS `mod_service_logs`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_service_logs` (
`log_id` varchar(32) NOT NULL,
`service_id` varchar(45) NOT NULL COMMENT '服务ID',
`version_id` varchar(45) NOT NULL COMMENT '版本ID',
`oper_time` int(11) NOT NULL COMMENT '操作耗时,秒为单位',
`oper_success` bit(1) NOT NULL,
`operation` varchar(45) NOT NULL COMMENT '操作类型',
`log_time` datetime NOT NULL COMMENT '日志产生时间',
`log_user` varchar(32) NOT NULL COMMENT '执行用户',
`log_text` mediumtext NOT NULL COMMENT '日志内容',
`log_param1` varchar(45) NOT NULL,
`log_param2` varchar(45) NOT NULL,
PRIMARY KEY (`log_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_service_possession`
--
DROP TABLE IF EXISTS `mod_service_possession`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_service_possession` (
`possession_id` varchar(32) NOT NULL,
`application_user` varchar(32) NOT NULL COMMENT '申请人',
`version_id` varchar(32) NOT NULL COMMENT '版本',
`application_date` datetime NOT NULL COMMENT '申请时间',
`reason` varchar(200) DEFAULT NULL COMMENT '申请原因',
`process_id` varchar(32) DEFAULT NULL COMMENT '流程id',
`business_type` varchar(32) DEFAULT NULL COMMENT '申请服务的业务类型',
`business_key` varchar(32) DEFAULT NULL COMMENT '申请服务的业务id',
PRIMARY KEY (`possession_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='服务版本占有';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_service_tag`
--
DROP TABLE IF EXISTS `mod_service_tag`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_service_tag` (
`rec_id` varchar(32) NOT NULL,
`tag_id` varchar(32) NOT NULL,
`service_id` varchar(32) NOT NULL,
PRIMARY KEY (`rec_id`),
KEY `i_tag_id` (`tag_id`) USING BTREE,
KEY `i_service_id` (`service_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_service_v_process`
--
DROP TABLE IF EXISTS `mod_service_v_process`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_service_v_process` (
`process_id` varchar(32) NOT NULL,
`version_id` varchar(32) NOT NULL,
`create_time` datetime NOT NULL,
`result` char(1) DEFAULT NULL COMMENT '1:审批中,2:驳回,3:通过',
`service_id` varchar(32) NOT NULL COMMENT '服务id',
`create_user` varchar(32) NOT NULL COMMENT '创建人',
`process_log` varchar(32) DEFAULT NULL COMMENT '流程日志id',
`process_type` varchar(45) DEFAULT NULL COMMENT '流程类型',
PRIMARY KEY (`process_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='服务版本的审批流程';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_service_version`
--
DROP TABLE IF EXISTS `mod_service_version`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_service_version` (
`version_id` varchar(32) NOT NULL,
`service_id` varchar(32) NOT NULL,
`version_code` varchar(45) NOT NULL COMMENT '版本号例如1.0.1',
`version_status` int(11) NOT NULL DEFAULT '1' COMMENT '1:创建,2:定义,3:开发,4:测试,5:生产,6:审批,7:上架',
`v_enabled` bit(1) NOT NULL COMMENT '是否启用',
`v_leader` varchar(32) DEFAULT NULL COMMENT '版本负责',
`v_desc` varchar(500) DEFAULT NULL COMMENT '版本描述',
`create_time` datetime NOT NULL COMMENT '创建时间',
`create_user` varchar(32) NOT NULL COMMENT '创建者',
`process_status` int(11) NOT NULL COMMENT 'null:未启动,1:待审批,2:已审批,3:已终止',
`v_process` varchar(32) DEFAULT NULL COMMENT '当前流程ID',
`v_maven` varchar(1024) DEFAULT NULL COMMENT '客户端开发时MAVEN信息',
`v_url` varchar(300) DEFAULT NULL COMMENT '客户端调用时的url',
`v_doc` varchar(40) DEFAULT NULL COMMENT '上传的SDK和文档ID',
`last_build_time` datetime DEFAULT NULL,
`last_build_success_file` varchar(500) DEFAULT NULL,
`last_build_log` varchar(32) DEFAULT NULL,
`last_build_success` bit(1) DEFAULT NULL,
`on_state` bit(1) DEFAULT NULL COMMENT '版本上架状态,0:下架 1:上架',
`test_url` varchar(100) DEFAULT NULL,
`live_url` varchar(100) DEFAULT NULL,
`version_type` mediumtext COMMENT '服务版本自定义类型',
`scm_url` varchar(255) DEFAULT NULL COMMENT '版本的源码分支地址',
`update_api_status` int(11) DEFAULT NULL COMMENT 'API定义编译状态: 0:默认值,-1:编译失败,1:编译中,2:编译成功',
`update_api_message` mediumtext COMMENT '编译日志',
PRIMARY KEY (`version_id`),
UNIQUE KEY `i_service_code` (`service_id`,`version_code`) USING BTREE,
KEY `i_v_process` (`v_process`) USING BTREE,
KEY `i_v_leader` (`v_leader`) USING BTREE,
KEY `i_create_time` (`create_user`) USING BTREE,
KEY `i_service_id` (`service_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_service_version_ip`
--
DROP TABLE IF EXISTS `mod_service_version_ip`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_service_version_ip` (
`id` varchar(32) NOT NULL,
`version_id` varchar(32) DEFAULT NULL,
`address_` varchar(20) DEFAULT NULL,
`port_` varchar(6) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_service_version_protocol`
--
DROP TABLE IF EXISTS `mod_service_version_protocol`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_service_version_protocol` (
`protocol_id` varchar(32) NOT NULL,
`version_id` varchar(32) NOT NULL,
`protocol_type` varchar(45) NOT NULL,
`protocol_api` mediumtext NOT NULL,
`last_modify_time` datetime NOT NULL,
`last_modify_user` varchar(32) NOT NULL,
`protocol_name` varchar(128) DEFAULT NULL,
`test_case` mediumtext COMMENT '接口的测试用例',
PRIMARY KEY (`protocol_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_service_version_protocol_comments`
--
DROP TABLE IF EXISTS `mod_service_version_protocol_comments`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_service_version_protocol_comments` (
`id` varchar(32) NOT NULL,
`version_id` varchar(32) DEFAULT NULL COMMENT '版本id',
`protocol_id` varchar(32) NOT NULL COMMENT '接口id',
`participant` varchar(255) NOT NULL COMMENT '批审参与者',
`comments` mediumtext NOT NULL COMMENT '评审意见',
`creater` varchar(32) NOT NULL COMMENT '创建者',
`create_time` datetime NOT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='服务接口评审意见表\r\n';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_store_category`
--
DROP TABLE IF EXISTS `mod_store_category`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_store_category` (
`category_id` varchar(32) NOT NULL,
`category_name` varchar(100) DEFAULT NULL,
`c_order` int(4) DEFAULT NULL,
`hierarchy_id` varchar(300) DEFAULT NULL,
`parent_id` varchar(32) DEFAULT NULL,
`service_count` int(11) DEFAULT NULL,
PRIMARY KEY (`category_id`),
KEY `FK_store_category_idx` (`parent_id`) USING BTREE,
CONSTRAINT `mod_store_category_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `mod_store_category` (`category_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `mod_user_service`
--
DROP TABLE IF EXISTS `mod_user_service`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_user_service` (
`follow_id` varchar(32) NOT NULL,
`user_id` varchar(32) NOT NULL,
`service_id` varchar(32) NOT NULL,
`f_order` int(11) DEFAULT NULL,
PRIMARY KEY (`follow_id`),
UNIQUE KEY `s_u_s` (`user_id`,`service_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `paas_docker_container`
--
DROP TABLE IF EXISTS `paas_docker_container`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `paas_docker_container` (
`container_id` varchar(32) NOT NULL COMMENT '容器自己的ID,唯一ID,也是docker 中容器的 —name',
`host_id` varchar(32) NOT NULL COMMENT '容器运行在那个主机上',
`container_cpu` int(11) NOT NULL,
`container_mem` int(11) NOT NULL,
`container_ip` varchar(15) NOT NULL,
`container_port` varchar(100) NOT NULL COMMENT '容器开启的端口',
`image_name` varchar(45) NOT NULL COMMENT '容器使用的镜像名称',
`create_time` datetime NOT NULL,
`business_id` varchar(32) NOT NULL COMMENT '外部业务ID,例如 服务、版本、测试环境 申请的容器。一个业务ID可以有多个容器。',
`business_type` varchar(45) NOT NULL COMMENT '业务类型,例如:APP Factory|app 或 API Manager|api',
`env_type` varchar(45) NOT NULL,
`version_id` varchar(32) DEFAULT NULL,
`sandbox_id` varchar(32) DEFAULT NULL,
`deploy_time` datetime DEFAULT NULL,
`deploy_user` varchar(32) DEFAULT NULL,
`assembly` varchar(255) DEFAULT NULL,
`container_name` varchar(32) DEFAULT NULL,
`build_file` varchar(255) DEFAULT NULL COMMENT '构建文件路径',
`env_id` varchar(32) DEFAULT NULL,
PRIMARY KEY (`container_id`),
UNIQUE KEY `i_host_port_u` (`host_id`,`container_port`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `paas_docker_image`
--
DROP TABLE IF EXISTS `paas_docker_image`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `paas_docker_image` (
`image_id` varchar(21) NOT NULL,
`image_name` varchar(45) NOT NULL,
`image_port` varchar(45) NOT NULL,
`image_version` varchar(45) NOT NULL,
`opt_bean` varchar(255) NOT NULL,
PRIMARY KEY (`image_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `paas_env`
--
DROP TABLE IF EXISTS `paas_env`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `paas_env` (
`env_id` varchar(32) NOT NULL,
`env_name` varchar(45) DEFAULT NULL,
`env_type` varchar(10) DEFAULT NULL,
`business_id` varchar(32) DEFAULT NULL,
`business_type` varchar(10) DEFAULT NULL,
`creator` varchar(32) DEFAULT NULL,
`creation_time` datetime DEFAULT NULL,
PRIMARY KEY (`env_id`),
KEY `envName_UN` (`business_id`,`env_type`,`env_name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `paas_env_res`
--
DROP TABLE IF EXISTS `paas_env_res`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `paas_env_res` (
`record_id` varchar(32) NOT NULL,
`env_id` varchar(32) NOT NULL,
`resource_id` varchar(45) NOT NULL COMMENT '资源ID',
`apply_config` mediumtext COMMENT '界面上填写的信息',
`result_config` mediumtext COMMENT '申请之后审批返回的参数',
`res_addition` varchar(1024) DEFAULT NULL COMMENT '复用: 数据库为数据库名称,nfs为挂载目录',
`paasos_res_id` varchar(32) DEFAULT NULL COMMENT 'paasos 资源id',
PRIMARY KEY (`record_id`),
UNIQUE KEY `uniqueEnvResource` (`env_id`,`resource_id`) USING BTREE,
KEY `i_b_r` (`env_id`,`resource_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `paas_framework`
--
DROP TABLE IF EXISTS `paas_framework`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `paas_framework` (
`fw_id` varchar(32) NOT NULL,
`fw_lang` varchar(45) NOT NULL,
`fw_key` varchar(45) NOT NULL,
`fw_name` varchar(128) NOT NULL,
`image_id` varchar(45) NOT NULL,
`sys_type` varchar(45) NOT NULL,
`docker_file` mediumtext,
PRIMARY KEY (`fw_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `paas_mysql_allocation`
--
DROP TABLE IF EXISTS `paas_mysql_allocation`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `paas_mysql_allocation` (
`allo_id` varchar(32) NOT NULL,
`host_id` varchar(32) NOT NULL,
`db_user` varchar(45) NOT NULL,
`db_name` varchar(45) NOT NULL,
`db_pwd` varchar(45) NOT NULL,
`config` mediumtext,
`allo_date` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`business_id` varchar(45) DEFAULT NULL COMMENT '资源ID',
PRIMARY KEY (`allo_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `paas_mysql_host`
--
DROP TABLE IF EXISTS `paas_mysql_host`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `paas_mysql_host` (
`host_id` varchar(32) NOT NULL,
`host_ip` varchar(45) NOT NULL,
`host_user` varchar(45) DEFAULT NULL,
`host_key_prv` varchar(2048) DEFAULT NULL,
`host_key_pub` varchar(1024) DEFAULT NULL,
`host_pwd` varchar(45) DEFAULT NULL,
`host_port` varchar(10) DEFAULT NULL,
`mysql_pwd` varchar(45) NOT NULL,
`mysql_user` varchar(45) NOT NULL,
`mysql_port` varchar(10) NOT NULL,
`env_type` varchar(45) NOT NULL,
`host_desc` mediumtext,
PRIMARY KEY (`host_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `paas_nginx_conf`
--
DROP TABLE IF EXISTS `paas_nginx_conf`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `paas_nginx_conf` (
`conf_id` varchar(32) NOT NULL,
`host_id` varchar(45) NOT NULL,
`conf_content` mediumtext,
`service_id` varchar(32) NOT NULL,
`version_id` varchar(32) NOT NULL,
`env_type` varchar(10) NOT NULL,
`nginx_name` varchar(32) DEFAULT NULL,
`env_id` varchar(32) DEFAULT NULL,
`business_type` varchar(10) DEFAULT NULL,
`skip_auth` bit(1) DEFAULT b'0',
`is_support_ssl` bit(1) DEFAULT b'0',
`ssl_crt_id` varchar(255) DEFAULT NULL,
`ssl_key_id` varchar(255) DEFAULT NULL,
PRIMARY KEY (`conf_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `paas_resource_template`
--
DROP TABLE IF EXISTS `paas_resource_template`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `paas_resource_template` (
`template_id` varchar(32) NOT NULL,
`template_name` varchar(45) NOT NULL,
`template_content` mediumtext NOT NULL,
`desc` mediumtext,
`creater_id` varchar(32) DEFAULT NULL,
`create_date` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`template_id`),
UNIQUE KEY `template_name_index` (`template_name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `quartz_job_log`
--
DROP TABLE IF EXISTS `quartz_job_log`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `quartz_job_log` (
`log_id` varchar(32) NOT NULL,
`job_name` varchar(255) NOT NULL,
`start_time` datetime NOT NULL,
`end_time` datetime NOT NULL,
`success` bit(1) NOT NULL,
`job_class` varchar(255) NOT NULL,
`error_info` mediumtext,
`server_ip` varchar(128) DEFAULT NULL,
PRIMARY KEY (`log_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `sys_attachment`
--
DROP TABLE IF EXISTS `sys_attachment`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `sys_attachment` (
`att_id` varchar(32) NOT NULL,
`att_name` varchar(128) NOT NULL,
`file_path` varchar(255) DEFAULT NULL,
`att_size` int(11) DEFAULT NULL,
`create_time` datetime DEFAULT NULL,
`business_id` varchar(32) DEFAULT NULL,
`business_key` varchar(80) DEFAULT NULL,
`business_type` varchar(45) DEFAULT NULL,
PRIMARY KEY (`att_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `sys_config`
--
DROP TABLE IF EXISTS `sys_config`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `sys_config` (
`conf_id` varchar(32) NOT NULL,
`conf_key` varchar(255) DEFAULT NULL,
`conf_value` varchar(4096) DEFAULT NULL,
PRIMARY KEY (`conf_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `sys_core_config`
--
DROP TABLE IF EXISTS `sys_core_config`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `sys_core_config` (
`key` varchar(255) NOT NULL COMMENT '系统核心配置--key',
`value` varchar(4096) NOT NULL COMMENT '系统核心配置--value',
PRIMARY KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Temporary view structure for view `sys_department`
--
DROP TABLE IF EXISTS `sys_department`;
/*!50001 DROP VIEW IF EXISTS `sys_department`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `sys_department` AS SELECT
1 AS `dept_id`,
1 AS `dept_name`,
1 AS `parent_id`,
1 AS `hierarchy_id`,
1 AS `create_time`,
1 AS `create_user`,
1 AS `d_order`*/;
SET character_set_client = @saved_cs_client;
--
-- Temporary view structure for view `sys_func`
--
DROP TABLE IF EXISTS `sys_func`;
/*!50001 DROP VIEW IF EXISTS `sys_func`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `sys_func` AS SELECT
1 AS `func_id`,
1 AS `func_name`,
1 AS `func_desc`,
1 AS `func_system`,
1 AS `func_module`*/;
SET character_set_client = @saved_cs_client;
--
-- Temporary view structure for view `sys_group`
--
DROP TABLE IF EXISTS `sys_group`;
/*!50001 DROP VIEW IF EXISTS `sys_group`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `sys_group` AS SELECT
1 AS `group_id`,
1 AS `group_name`,
1 AS `create_time`,
1 AS `create_user`*/;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `sys_host`
--
DROP TABLE IF EXISTS `sys_host`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `sys_host` (
`host_id` varchar(32) NOT NULL,
`host_ip` varchar(45) NOT NULL,
`host_user` varchar(45) NOT NULL,
`host_key_prv` varchar(2048) DEFAULT NULL,
`host_key_pub` varchar(1024) DEFAULT NULL,
`host_port` varchar(45) NOT NULL,
`env_type` varchar(10) NOT NULL,
`host_type` varchar(45) NOT NULL,
`host_platform` varchar(10) DEFAULT NULL COMMENT '应用的类型,api or app',
`backup_host` varchar(45) NOT NULL COMMENT '备用服务器',
`virtual_host` varchar(45) NOT NULL COMMENT 'used for dns resolver for HA',
`directory_name` varchar(45) NOT NULL COMMENT 'used for store .conf file',
PRIMARY KEY (`host_id`),
UNIQUE KEY `i_host_ip` (`host_ip`,`host_type`) USING BTREE,
UNIQUE KEY `unq_platform_dir` (`host_platform`,`directory_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Temporary view structure for view `sys_login_logs`
--
DROP TABLE IF EXISTS `sys_login_logs`;
/*!50001 DROP VIEW IF EXISTS `sys_login_logs`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `sys_login_logs` AS SELECT
1 AS `log_id`,
1 AS `login_name`,
1 AS `login_param`,
1 AS `login_time`,
1 AS `login_type`,
1 AS `client_ip`,
1 AS `user_agent`,
1 AS `login_sys`,
1 AS `user_id`*/;
SET character_set_client = @saved_cs_client;
--
-- Temporary view structure for view `sys_role`
--
DROP TABLE IF EXISTS `sys_role`;
/*!50001 DROP VIEW IF EXISTS `sys_role`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `sys_role` AS SELECT
1 AS `role_id`,
1 AS `role_name`,
1 AS `role_desc`,
1 AS `role_system`*/;
SET character_set_client = @saved_cs_client;
--
-- Temporary view structure for view `sys_role_func`
--
DROP TABLE IF EXISTS `sys_role_func`;
/*!50001 DROP VIEW IF EXISTS `sys_role_func`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `sys_role_func` AS SELECT
1 AS `id`,
1 AS `role_id`,
1 AS `func_id`*/;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `sys_tag`
--
DROP TABLE IF EXISTS `sys_tag`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `sys_tag` (
`tag_id` varchar(32) NOT NULL,
`tag_text` varchar(45) NOT NULL COMMENT '标签文字',
`create_time` datetime NOT NULL COMMENT '创建时间',
`hot` bit(1) DEFAULT b'0' COMMENT '是否属于热门标签',
PRIMARY KEY (`tag_id`),
UNIQUE KEY `tag_text_unique` (`tag_text`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Temporary view structure for view `sys_tenant`
--
DROP TABLE IF EXISTS `sys_tenant`;
/*!50001 DROP VIEW IF EXISTS `sys_tenant`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `sys_tenant` AS SELECT
1 AS `tenant_id`,
1 AS `tenant_name`,
1 AS `description`,
1 AS `admin_id`,
1 AS `create_time`*/;
SET character_set_client = @saved_cs_client;
--
-- Temporary view structure for view `sys_tenant_relation`
--
DROP TABLE IF EXISTS `sys_tenant_relation`;
/*!50001 DROP VIEW IF EXISTS `sys_tenant_relation`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `sys_tenant_relation` AS SELECT
1 AS `rel_id`,
1 AS `tenant_id`,
1 AS `user_id`*/;
SET character_set_client = @saved_cs_client;
--
-- Temporary view structure for view `sys_user`
--
DROP TABLE IF EXISTS `sys_user`;
/*!50001 DROP VIEW IF EXISTS `sys_user`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `sys_user` AS SELECT
1 AS `user_id`,
1 AS `user_name`,
1 AS `login_name`,
1 AS `login_password`,
1 AS `roles`,
1 AS `create_time`,
1 AS `activate`,
1 AS `email`,
1 AS `token`,
1 AS `sys_user`,
1 AS `api_auth_key`,
1 AS `mobile`*/;
SET character_set_client = @saved_cs_client;
--
-- Temporary view structure for view `sys_user_dept`
--
DROP TABLE IF EXISTS `sys_user_dept`;
/*!50001 DROP VIEW IF EXISTS `sys_user_dept`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `sys_user_dept` AS SELECT
1 AS `relation_id`,
1 AS `user_id`,
1 AS `dep_id`*/;
SET character_set_client = @saved_cs_client;
--
-- Temporary view structure for view `sys_user_group`
--
DROP TABLE IF EXISTS `sys_user_group`;
/*!50001 DROP VIEW IF EXISTS `sys_user_group`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `sys_user_group` AS SELECT
1 AS `relation_id`,
1 AS `user_id`,
1 AS `group_id`*/;
SET character_set_client = @saved_cs_client;
--
-- Temporary view structure for view `sys_user_role`
--
DROP TABLE IF EXISTS `sys_user_role`;
/*!50001 DROP VIEW IF EXISTS `sys_user_role`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `sys_user_role` AS SELECT
1 AS `id`,
1 AS `role_id`,
1 AS `user_id`*/;
SET character_set_client = @saved_cs_client;
--
-- Final view structure for view `sys_department`
--
/*!50001 DROP VIEW IF EXISTS `sys_department`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8 */;
/*!50001 SET character_set_results = utf8 */;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `sys_department` AS select `paasos`.`sys_department`.`dept_id` AS `dept_id`,`paasos`.`sys_department`.`dept_name` AS `dept_name`,`paasos`.`sys_department`.`parent_id` AS `parent_id`,`paasos`.`sys_department`.`hierarchy_id` AS `hierarchy_id`,`paasos`.`sys_department`.`create_time` AS `create_time`,`paasos`.`sys_department`.`create_user` AS `create_user`,`paasos`.`sys_department`.`d_order` AS `d_order` from `paasos`.`sys_department` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
--
-- Final view structure for view `sys_func`
--
/*!50001 DROP VIEW IF EXISTS `sys_func`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8 */;
/*!50001 SET character_set_results = utf8 */;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `sys_func` AS select `paasos`.`sys_func`.`func_id` AS `func_id`,`paasos`.`sys_func`.`func_name` AS `func_name`,`paasos`.`sys_func`.`func_desc` AS `func_desc`,`paasos`.`sys_func`.`func_system` AS `func_system`,`paasos`.`sys_func`.`func_module` AS `func_module` from `paasos`.`sys_func` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
--
-- Final view structure for view `sys_group`
--
/*!50001 DROP VIEW IF EXISTS `sys_group`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8 */;
/*!50001 SET character_set_results = utf8 */;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `sys_group` AS select `paasos`.`sys_group`.`group_id` AS `group_id`,`paasos`.`sys_group`.`group_name` AS `group_name`,`paasos`.`sys_group`.`create_time` AS `create_time`,`paasos`.`sys_group`.`create_user` AS `create_user` from `paasos`.`sys_group` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
--
-- Final view structure for view `sys_login_logs`
--
/*!50001 DROP VIEW IF EXISTS `sys_login_logs`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8 */;
/*!50001 SET character_set_results = utf8 */;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `sys_login_logs` AS select `paasos`.`sys_login_logs`.`log_id` AS `log_id`,`paasos`.`sys_login_logs`.`login_name` AS `login_name`,`paasos`.`sys_login_logs`.`login_param` AS `login_param`,`paasos`.`sys_login_logs`.`login_time` AS `login_time`,`paasos`.`sys_login_logs`.`login_type` AS `login_type`,`paasos`.`sys_login_logs`.`client_ip` AS `client_ip`,`paasos`.`sys_login_logs`.`user_agent` AS `user_agent`,`paasos`.`sys_login_logs`.`login_sys` AS `login_sys`,`paasos`.`sys_login_logs`.`user_id` AS `user_id` from `paasos`.`sys_login_logs` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
--
-- Final view structure for view `sys_role`
--
/*!50001 DROP VIEW IF EXISTS `sys_role`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8 */;
/*!50001 SET character_set_results = utf8 */;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `sys_role` AS select `paasos`.`sys_role`.`role_id` AS `role_id`,`paasos`.`sys_role`.`role_name` AS `role_name`,`paasos`.`sys_role`.`role_desc` AS `role_desc`,`paasos`.`sys_role`.`role_system` AS `role_system` from `paasos`.`sys_role` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
--
-- Final view structure for view `sys_role_func`
--
/*!50001 DROP VIEW IF EXISTS `sys_role_func`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8 */;
/*!50001 SET character_set_results = utf8 */;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `sys_role_func` AS select `paasos`.`sys_role_func`.`id` AS `id`,`paasos`.`sys_role_func`.`role_id` AS `role_id`,`paasos`.`sys_role_func`.`func_id` AS `func_id` from `paasos`.`sys_role_func` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
--
-- Final view structure for view `sys_tenant`
--
/*!50001 DROP VIEW IF EXISTS `sys_tenant`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8 */;
/*!50001 SET character_set_results = utf8 */;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `sys_tenant` AS select `paasos`.`sys_tenant`.`tenant_id` AS `tenant_id`,`paasos`.`sys_tenant`.`tenant_name` AS `tenant_name`,`paasos`.`sys_tenant`.`description` AS `description`,`paasos`.`sys_tenant`.`admin_id` AS `admin_id`,`paasos`.`sys_tenant`.`create_time` AS `create_time` from `paasos`.`sys_tenant` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
--
-- Final view structure for view `sys_tenant_relation`
--
/*!50001 DROP VIEW IF EXISTS `sys_tenant_relation`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8 */;
/*!50001 SET character_set_results = utf8 */;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `sys_tenant_relation` AS select `paasos`.`sys_tenant_relation`.`rel_id` AS `rel_id`,`paasos`.`sys_tenant_relation`.`tenant_id` AS `tenant_id`,`paasos`.`sys_tenant_relation`.`user_id` AS `user_id` from `paasos`.`sys_tenant_relation` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
--
-- Final view structure for view `sys_user`
--
/*!50001 DROP VIEW IF EXISTS `sys_user`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8 */;
/*!50001 SET character_set_results = utf8 */;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `sys_user` AS (select `paasos`.`sys_user`.`user_id` AS `user_id`,`paasos`.`sys_user`.`user_name` AS `user_name`,`paasos`.`sys_user`.`login_name` AS `login_name`,`paasos`.`sys_user`.`login_password` AS `login_password`,`paasos`.`sys_user`.`roles` AS `roles`,`paasos`.`sys_user`.`create_time` AS `create_time`,`paasos`.`sys_user`.`activate` AS `activate`,`paasos`.`sys_user`.`email` AS `email`,`paasos`.`sys_user`.`token` AS `token`,`paasos`.`sys_user`.`sys_user` AS `sys_user`,`paasos`.`sys_user`.`api_auth_key` AS `api_auth_key`,`paasos`.`sys_user`.`mobile` AS `mobile` from `paasos`.`sys_user`) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
--
-- Final view structure for view `sys_user_dept`
--
/*!50001 DROP VIEW IF EXISTS `sys_user_dept`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8 */;
/*!50001 SET character_set_results = utf8 */;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `sys_user_dept` AS select `paasos`.`sys_user_dept`.`relation_id` AS `relation_id`,`paasos`.`sys_user_dept`.`user_id` AS `user_id`,`paasos`.`sys_user_dept`.`dep_id` AS `dep_id` from `paasos`.`sys_user_dept` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
--
-- Final view structure for view `sys_user_group`
--
/*!50001 DROP VIEW IF EXISTS `sys_user_group`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8 */;
/*!50001 SET character_set_results = utf8 */;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `sys_user_group` AS select `paasos`.`sys_user_group`.`relation_id` AS `relation_id`,`paasos`.`sys_user_group`.`user_id` AS `user_id`,`paasos`.`sys_user_group`.`group_id` AS `group_id` from `paasos`.`sys_user_group` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
--
-- Final view structure for view `sys_user_role`
--
/*!50001 DROP VIEW IF EXISTS `sys_user_role`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8 */;
/*!50001 SET character_set_results = utf8 */;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `sys_user_role` AS select `paasos`.`sys_user_role`.`id` AS `id`,`paasos`.`sys_user_role`.`role_id` AS `role_id`,`paasos`.`sys_user_role`.`user_id` AS `user_id` from `paasos`.`sys_user_role` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2016-08-11 11:30:52
INSERT INTO `paas_framework` VALUES ('dubbox', 'java', 'dubbox', 'Dubbox', 'base/dubbo:2.0', 'api', 'FROM ${paasos_docker_registry}/${imageId}\n\nMAINTAINER remoting <remoting@qq.com>\n\nCOPY /tools/${fileName} /data/app.zip\n\nRUN unzip -o /data/app.zip -d /data/\n\n');
INSERT INTO `paas_framework` VALUES ('jersey', 'java', 'jersey', 'Jersey', 'base/tomcat:2.0', 'api', 'FROM ${paasos_docker_registry}/${imageId}\n\nMAINTAINER remoting <remoting@qq.com>\n\nCOPY /tools/${fileName} /data/webapps/ROOT.war\n\n');
INSERT INTO `paas_framework` VALUES ('springboot+jersey', 'java', 'springboot+jersey', 'Spring Boot + Jersey', 'base/springboot:2.0', 'api', 'FROM ${paasos_docker_registry}/${imageId}\r\n\r\nMAINTAINER weiyujia <315593147@qq.com>\r\n\r\nCOPY /tools/${fileName} /opt/app.jar');
INSERT INTO `paas_framework` VALUES ('springmvc+mybatis', 'java', 'springmvc+mybatis', 'SpringMVC+Mybatis', 'base/tomcat:2.0', 'app', 'FROM ${paasos_docker_registry}/${imageId}\n\nMAINTAINER remoting <remoting@qq.com>\n\nCOPY /tools/${fileName} /data/webapps/ROOT.war\n\n');
| 40.185363 | 613 | 0.72232 |
7ba9472579435aa6884a6f1678e90797b8a1d0ab | 120 | ps1 | PowerShell | ♥ Hearts/10 - Powershell.ps1 | LoyaltyGamer72/Programmers-Playing-Cards | 391b03462c690871540ff865606b1df0a31df18b | [
"MIT"
] | 80 | 2016-06-26T01:12:45.000Z | 2022-02-16T23:31:11.000Z | ♥ Hearts/10 - Powershell.ps1 | LoyaltyGamer72/Programmers-Playing-Cards | 391b03462c690871540ff865606b1df0a31df18b | [
"MIT"
] | 33 | 2016-06-26T01:19:11.000Z | 2019-02-07T20:01:23.000Z | ♥ Hearts/10 - Powershell.ps1 | LoyaltyGamer72/Programmers-Playing-Cards | 391b03462c690871540ff865606b1df0a31df18b | [
"MIT"
] | 22 | 2016-06-26T01:09:09.000Z | 2021-09-13T22:54:57.000Z | function card(
[int] $rank,
[string] $suit) {
Wscript.Echo rank
Wscript.Echo suit
}
card(10, "hearts")
| 15 | 23 | 0.591667 |
12a43c98c30ee0752c6f9ba9cf91189684bb0c48 | 1,021 | h | C | include/prototyping/trigger/Event.h | xzrunner/prototyping | 66d6b66e7b62dccd48b4960325975837fe27e94c | [
"MIT"
] | null | null | null | include/prototyping/trigger/Event.h | xzrunner/prototyping | 66d6b66e7b62dccd48b4960325975837fe27e94c | [
"MIT"
] | null | null | null | include/prototyping/trigger/Event.h | xzrunner/prototyping | 66d6b66e7b62dccd48b4960325975837fe27e94c | [
"MIT"
] | null | null | null | #pragma once
#include "prototyping/trigger/typedef.h"
#include <cpputil/ClassInfo.h>
#include <vector>
#include <memory>
namespace pt
{
namespace trigger
{
class Event
{
public:
virtual ~Event() {}
virtual const char* LuaFuncName() const = 0;
std::string GenLuaFunc() const;
void Do();
protected:
virtual const char* LuaFuncParams() const = 0;
public:
struct Case
{
std::string name = "case";
ConditionPtr condition = nullptr;
std::vector<ActionPtr> actions;
};
Case& GetFirstCase();
private:
std::vector<Case> m_cases;
DECLARE_BASE_CLASS_INFO(Event)
}; // Event
}
}
#define DECLARE_PT_EVENT \
public: \
virtual const char* LuaFuncName() const override { \
return LUA_FUNC_NAME; \
} \
static const char* LUA_FUNC_NAME;
#define IMPLEMENT_PT_EVENT(type, name) \
const char* type::LUA_FUNC_NAME = #name;
| 17.305085 | 58 | 0.581783 |
76a722102f8efcc81055818c87c858e495fef0d1 | 849 | lua | Lua | experimental/ETWSession.lua | CoderAldrich/TINN | f4e2555fe49261285ff0db79fdd932bb708f530a | [
"MS-PL"
] | 70 | 2015-02-02T02:32:42.000Z | 2022-01-18T15:17:58.000Z | experimental/ETWSession.lua | CoderAldrich/TINN | f4e2555fe49261285ff0db79fdd932bb708f530a | [
"MS-PL"
] | 1 | 2019-06-04T13:46:20.000Z | 2019-06-06T04:34:27.000Z | experimental/ETWSession.lua | CoderAldrich/TINN | f4e2555fe49261285ff0db79fdd932bb708f530a | [
"MS-PL"
] | 12 | 2015-05-22T05:23:17.000Z | 2021-02-17T11:50:21.000Z | -- ETWSession.lua
local ffi = require("ffi")
local eventing_provider = require("eventing_provider_l1_1_0")
ffi.cdef[[
typedef struct {
PTRACEHANDLE Handle;
} ETWSession_t;
]]
local ETWSession_t = ffi.typeof("ETWSession_t")
local ETWSession = {}
setmetatable(ETWSession, {
__call = function(self, ...)
return self:create(...)
end,
})
local ETWSession_mt = {
__index = ETWSession;
}
ETWSession.init = function(self, rawhandle)
local obj = {
Handle = ETWSession_t(rawhandle)
}
setmetatable(obj, ETWSession_mt)
return obj;
end
ETWSession.create = function(self, SessionName, Properties)
if not SessionName then
return nil, "no session name specified"
end
local SessionHandle = ffi.new("TRACEHANDLE[1]")
local res = eventing_provider.StartTrace(SessionHandle, SessionName, Properties)
return self:init(SessionHandle[0])
end
| 19.295455 | 81 | 0.742049 |
e99f1d1c99f037b0fb5773a63f0594d115d20636 | 1,735 | rb | Ruby | spikes/cucumber-api-flare/features/support/myenv.rb | OpenGov/bubble-wrap | 1b43dd5db298f9285bfaa41ec339c2a3c32dfa62 | [
"MIT"
] | null | null | null | spikes/cucumber-api-flare/features/support/myenv.rb | OpenGov/bubble-wrap | 1b43dd5db298f9285bfaa41ec339c2a3c32dfa62 | [
"MIT"
] | null | null | null | spikes/cucumber-api-flare/features/support/myenv.rb | OpenGov/bubble-wrap | 1b43dd5db298f9285bfaa41ec339c2a3c32dfa62 | [
"MIT"
] | null | null | null | # create a json file in the flare.json format
# this can be used for multiple d3 visualizations
require 'ostruct'
require 'json'
require 'pry'
publisher = File.open('flare.json', "w+")
# create a d3 json!
d3_hash = {}
flare = OpenStruct.new(d3_hash)
flare.name = 'flare'
flare.children = []
AfterConfiguration do |config|
config.on_event :test_run_started do |event|
end
config.on_event :test_case_started do |event|
end
config.on_event :test_case_finished do |event|
scenario_array = event.test_case.location.file.split('/')[1..-1]
current_child = []
scenario_array.each do | child |
# create the flare children array if it has not been done so already
flare.children = [ ] unless flare.children
if current_child.count == 0
if flare.children.select { |i| i[:name] == child }.count > 0
current_child = flare.children.select { |i| i[:name] == child }
else
current_child = flare.children.push( { name: child, children: [] })
end
else
if current_child.last[:children].select { |i| i[:name] == child }.count > 0
current_child = current_child.last[:children].select { |i| i[:name] == child }
else
current_child = current_child.last[:children].push( { name: child, children: []})
end
end
end
current_child.last[:children].push( { name: event.test_case.name, size: 200, result: event.result })
end
config.on_event :test_run_finished do |event|
end
end
at_exit {
publisher.puts( flare.to_h.to_json )
publisher.close
puts flare.to_h.to_json
} | 32.12963 | 108 | 0.608069 |
04a35855d9a3dbf8dc739d7408f9eba51edfcd24 | 2,356 | java | Java | projects/OG-MasterDB/src/com/opengamma/masterdb/security/hibernate/fx/FXForwardSecurityBean.java | gsteri1/OG-Platform | e682c31e69cadde06dd3776544913dde17fe41ba | [
"Apache-2.0"
] | 1 | 2021-02-27T21:05:05.000Z | 2021-02-27T21:05:05.000Z | projects/OG-MasterDB/src/com/opengamma/masterdb/security/hibernate/fx/FXForwardSecurityBean.java | gsteri1/OG-Platform | e682c31e69cadde06dd3776544913dde17fe41ba | [
"Apache-2.0"
] | null | null | null | projects/OG-MasterDB/src/com/opengamma/masterdb/security/hibernate/fx/FXForwardSecurityBean.java | gsteri1/OG-Platform | e682c31e69cadde06dd3776544913dde17fe41ba | [
"Apache-2.0"
] | null | null | null | /**
* Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.masterdb.security.hibernate.fx;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import com.opengamma.financial.security.fx.FXForwardSecurity;
import com.opengamma.masterdb.security.hibernate.ExternalIdBean;
import com.opengamma.masterdb.security.hibernate.SecurityBean;
import com.opengamma.masterdb.security.hibernate.ZonedDateTimeBean;
/**
* A bean representation of {@link FXForwardSecurity}.
*/
public class FXForwardSecurityBean extends SecurityBean {
private ZonedDateTimeBean _forwardDate;
private ExternalIdBean _region;
private ExternalIdBean _underlying;
/**
* Gets the forwardDate.
* @return the forwardDate
*/
public ZonedDateTimeBean getForwardDate() {
return _forwardDate;
}
/**
* Sets the forwardDate.
* @param forwardDate the forwardDate
*/
public void setForwardDate(ZonedDateTimeBean forwardDate) {
_forwardDate = forwardDate;
}
/**
* Gets the underlying.
* @return the underlying
*/
public ExternalIdBean getUnderlying() {
return _underlying;
}
/**
* Sets the underlying.
* @param underlying the underlying
*/
public void setUnderlying(ExternalIdBean underlying) {
_underlying = underlying;
}
/**
* Gets the region.
* @return the region
*/
public ExternalIdBean getRegion() {
return _region;
}
/**
* Sets the region.
* @param region the region
*/
public void setRegion(ExternalIdBean region) {
_region = region;
}
@Override
public boolean equals(final Object other) {
if (!(other instanceof FXForwardSecurityBean)) {
return false;
}
FXForwardSecurityBean fxForward = (FXForwardSecurityBean) other;
return new EqualsBuilder()
.append(getId(), fxForward.getId())
.append(getForwardDate(), fxForward.getForwardDate())
.append(getUnderlying(), fxForward.getUnderlying())
.append(getRegion(), fxForward.getRegion())
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder()
.append(getForwardDate())
.append(getUnderlying())
.append(getRegion())
.toHashCode();
}
}
| 24.28866 | 86 | 0.702462 |
864b82e914dbdca690f530466e5dd7db54020685 | 27,161 | rs | Rust | src/macros.rs | storance/krpc-bindings-rs | 5f29a04c9feb6190c5e983d3c69a35c7e00631d9 | [
"Apache-2.0"
] | 1 | 2019-06-04T14:35:38.000Z | 2019-06-04T14:35:38.000Z | src/macros.rs | storance/krpc-bindings-rs | 5f29a04c9feb6190c5e983d3c69a35c7e00631d9 | [
"Apache-2.0"
] | null | null | null | src/macros.rs | storance/krpc-bindings-rs | 5f29a04c9feb6190c5e983d3c69a35c7e00631d9 | [
"Apache-2.0"
] | 1 | 2019-06-04T14:35:49.000Z | 2019-06-04T14:35:49.000Z | #[macro_export]
macro_rules! remote_type {
//
// Service
//
(
$(#[$meta:meta])*
service $service: ident {
properties: {
$( { $( $property: tt)+ } )*
}
methods: {
$( { $( $method: tt)+ } )*
}
}
) => {
$(#[$meta])*
#[derive(Clone)]
pub struct $service<'a> {
connection: &'a $crate::client::Connection,
}
impl<'a> $service<'a> {
/// Creates a new service using the given `connection`.
pub fn new(connection: &'a $crate::client::Connection) -> Self {
Self { connection }
}
// Properties
$(
remote_type!(@property(service=$service) $( $property )+ );
)*
// Methods
$(
remote_type!(@method(service=$service) $( $method )+ );
)*
}
impl<'a> std::fmt::Debug for $service<'a> {
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
write!(f, "{}", stringify!($service))
}
}
remote_type!(
@stream_service(service=$service)
properties: {
$( { $( $property)+ } )*
}
methods: {
$( { $( $method)+ } )*
}
);
remote_type!(
@call_service(service=$service)
properties: {
$( { $( $property)+ } )*
}
methods: {
$( { $( $method)+ } )*
}
);
};
//
// Properties
//
(
@property(service=$service:tt)
$prop_name: ident {
$(#[$getter_meta:meta])*
get: $getter_name: ident -> $getter_type: ty $(,
$(#[$setter_meta:meta])*
set: $setter_name: ident ($setter_type: ty) )?
}
) => {
remote_type!(@method(service=$service, prefix=get_)
$( #[$getter_meta] )*
fn $getter_name() -> $getter_type {
$prop_name()
}
);
$(
remote_type!(@method(service=$service, prefix=set_)
$( #[$setter_meta] )*
fn $setter_name(value: $setter_type) {
$prop_name(value)
}
);
)?
};
(
@property(service=$service:tt)
$( $props: tt)*
) => {
compile_error!(concat!("Invalid Service property definition:\n", stringify!($($props)*)));
};
//
// Methods
//
(
@method(service=$service:tt $(, prefix=$prefix:tt)?)
$(#[$meta:meta])*
fn $method_name: ident ($( $arg_name: ident : $arg_type: ty), *) -> $return_type: ty {
$rpc_name: tt($( $arg_expr: expr ),* )
}
) => {
$(#[$meta])*
pub fn $method_name(&self $(, $arg_name : $arg_type)*) -> $crate::client::KrpcResult<$return_type> {
let args: Vec<Vec<u8>> = vec![$($arg_expr.encode()?),*];
let response = self.connection.invoke(stringify!($service),
concat!( $( stringify!($prefix), )? stringify!($rpc_name)),
&args)?;
Ok(<$return_type>::decode(&response, self.connection)?)
}
};
(
@method(service=$service:tt $(, prefix=$prefix:tt)?)
$(#[$meta:meta])*
fn $method_name: ident ($( $arg_name: ident : $arg_type: ty), *) {
$rpc_name: tt($( $arg_expr: expr ),* )
}
) => {
$(#[$meta])*
pub fn $method_name(&self $(, $arg_name : $arg_type)*) -> $crate::client::KrpcResult<()> {
let args: Vec<Vec<u8>> = vec![$($arg_expr.encode()?),*];
self.connection.invoke(stringify!($service),
concat!( $( stringify!($prefix), )? stringify!($rpc_name)),
&args)?;
Ok(())
}
};
(
@method(service=$service:tt $(, prefix=$prefix:tt)?)
$( $methods: tt)*
) => {
compile_error!(concat!("Invalid Service method definition:\n", stringify!($($methods)*)));
};
//
// Service Stream
//
(
@stream_service(service=$service: ident)
properties: {}
methods: {}
) => {
};
(
@stream_service(service=$service: ident)
properties: {
$( { $( $property: tt)+ } )*
}
methods: {
$( { $( $method: tt)+ } )*
}
) => {
paste::item! {
#[derive(Debug, Clone)]
pub struct [<$service Stream>]<'a> {
connection: &'a $crate::client::Connection,
}
impl<'a> $service<'a> {
/// Returns a stream instance that provides streaming versions of the
/// property getters and methods with return values.
pub fn stream(&self) -> [<$service Stream>]<'a> {
[<$service Stream>]::new(self.connection)
}
}
impl<'a> [<$service Stream>]<'a> {
pub fn new(connection: &'a $crate::client::Connection) -> Self {
Self { connection }
}
// Properties
$(
remote_type!(@stream_property(service=$service) $( $property )+ );
)*
// Methods
$(
remote_type!(@stream_method(service=$service) $( $method )+ );
)*
}
}
};
//
// Stream Properties
//
(
@stream_property(service=$service:tt)
$prop_name: ident {
$(#[$getter_meta:meta])*
get: $getter_name: ident -> $getter_type: ty $(,
$(#[$setter_meta:meta])*
set: $setter_name: ident ($setter_type: ty) )?
}
) => {
remote_type!(@stream_method(service=$service, prefix=get_)
$( #[$getter_meta] )*
fn $getter_name() -> $getter_type {
$prop_name()
});
};
(
@stream_property(service=$service:tt)
$( $props: tt)*
) => {
};
//
// Stream Methods
//
(
@stream_method(service=$service:tt $(, prefix=$prefix:tt)?)
$(#[$meta:meta])*
fn $method_name: ident ($( $arg_name: ident : $arg_type: ty), *) -> $return_type: ty {
$rpc_name: tt($( $arg_expr: expr ),* )
}
) => {
$(#[$meta])*
pub fn $method_name(&self $(, $arg_name : $arg_type)*) -> $crate::client::KrpcResult<$crate::client::Stream<$return_type>> {
let args: Vec<Vec<u8>> = vec![$($arg_expr.encode()?),*];
Ok(self.connection.add_stream(
stringify!($service),
concat!( $( stringify!($prefix), )? stringify!($rpc_name)),
&args
)?)
}
};
(
@stream_method(service=$service:tt $(, prefix=$prefix:tt)?)
$(#[$meta:meta])*
fn $method_name: ident ($( $arg_name: ident : $arg_type: ty), *) {
$rpc_name: tt($( $arg_expr: expr ),* )
}
) => {
// This space intentionally left blank
};
(
@stream_method(service=$service:tt $(, prefix=$prefix:tt)?)
$( $methods: tt)*
) => {
};
//
// Service Call
//
(
@call_service(service=$service: ident)
properties: {}
methods: {}
) => {
};
(
@call_service(service=$service: ident)
properties: {
$( { $( $property: tt)+ } )*
}
methods: {
$( { $( $method: tt)+ } )*
}
) => {
paste::item! {
#[derive(Debug, Clone)]
pub struct [<$service Call>]<'a> {
connection: &'a $crate::client::Connection,
}
impl<'a> $service<'a> {
/// Returns a call instance that provides versions of the properties
/// and methods as `ProcedureCall`s.
pub fn call(&self) -> [<$service Call>] {
[<$service Call>]::new(self.connection)
}
}
impl<'a> [<$service Call>]<'a> {
pub fn new(connection: &'a $crate::client::Connection) -> Self {
Self { connection }
}
// Properties
$(
remote_type!(@call_property(service=$service) $( $property )+ );
)*
// Methods
$(
remote_type!(@call_method(service=$service) $( $method )+ );
)*
}
}
};
//
// Call Properties
//
(
@call_property(service=$service:tt)
$prop_name: ident {
$(#[$getter_meta:meta])*
get: $getter_name: ident -> $getter_type: ty $(,
$(#[$setter_meta:meta])*
set: $setter_name: ident ($setter_type: ty) )?
}
) => {
remote_type!(
@call_method(service=$service, prefix=get_)
$( #[$getter_meta] )*
fn $getter_name() -> $getter_type {
$prop_name()
}
);
$(
remote_type!(
@call_method(service=$service, prefix=set_)
$( #[$setter_meta] )*
fn $setter_name(value: $setter_type) {
$prop_name(value)
}
);
)?
};
(
@call_property(service=$service:tt)
$( $props: tt)*
) => {
};
//
// Call Methods
//
(
@call_method(service=$service:tt $(, prefix=$prefix:tt)?)
$(#[$meta:meta])*
fn $method_name: ident ($( $arg_name: ident : $arg_type: ty), *) $( -> $return_type: ty )? {
$rpc_name: tt($( $arg_expr: expr ),* )
}
) => {
$(#[$meta])*
pub fn $method_name(&self $(, $arg_name : $arg_type)*) -> $crate::client::KrpcResult<$crate::client::ProcedureCall> {
let args: Vec<Vec<u8>> = vec![$($arg_expr.encode()?),*];
Ok(self.connection.procedure_call(
stringify!($service),
concat!( $( stringify!($prefix), )? stringify!($rpc_name)),
&args
))
}
};
(
@call_method(service=$service:tt $(, prefix=$prefix:tt)?)
$( $methods: tt)*
) => {
};
//
// Remote Object
//
(
$(#[$meta:meta])*
object $service: tt.$object_name: ident {
$(properties: {
$( { $( $property: tt)+ } )*
})?
$(methods: {
$( { $( $method: tt)+ } )*
})?
$(static_methods: {
$( { $( $static_method: tt)+ } )*
})?
}
) => {
$(#[$meta])*
#[derive(Clone)]
pub struct $object_name<'a> {
#[allow(dead_code)]
connection: &'a $crate::client::Connection,
id: u64
}
impl<'a> $crate::RemoteObject<'a> for $object_name<'a> {
fn new(connection: &'a $crate::client::Connection, id: u64) -> Self {
Self { connection, id }
}
fn id(&self) -> u64 { self.id }
}
impl<'a> $crate::codec::Decode<'a> for $object_name<'a> {
fn decode(bytes: &Vec<u8>, connection: &'a $crate::client::Connection) -> $crate::codec::CodecResult<Self> {
let id = u64::decode(bytes, connection)?;
if id == 0 {
Err(failure::Error::from($crate::codec::CodecError::NullValue))
} else {
Ok($object_name::new(connection, id))
}
}
}
impl<'a> $crate::codec::Decode<'a> for Option<$object_name<'a>> {
fn decode(bytes: &Vec<u8>, connection: &'a $crate::client::Connection) -> $crate::codec::CodecResult<Self> {
let id = u64::decode(bytes, connection)?;
if id == 0 {
Ok(None)
} else {
Ok(Some($object_name::new(connection, id)))
}
}
}
impl<'a> $crate::codec::Encode for $object_name<'a> {
fn encode(&self) -> $crate::codec::CodecResult<Vec<u8>> {
self.id().encode()
}
}
impl<'a> $crate::codec::Encode for Option<$object_name<'a>> {
fn encode(&self) -> $crate::codec::CodecResult<Vec<u8>> {
match self {
None => (0 as u64).encode(),
Some(obj) => obj.id().encode()
}
}
}
impl<'a> $crate::codec::Encode for Option<&$object_name<'a>> {
fn encode(&self) -> $crate::codec::CodecResult<Vec<u8>> {
match self {
None => (0 as u64).encode(),
Some(ref obj) => obj.id().encode()
}
}
}
impl<'a> std::fmt::Debug for $object_name<'a> {
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
write!(f, "{}.{}{{ id: {} }}", stringify!($service), stringify!($object_name), self.id)
}
}
impl<'a> $object_name<'a> {
// Properties
$(
$(
remote_type!(@property(service=$service, class=$object_name) $( $property )+ );
)*
)?
// Methods
$(
$(
remote_type!(@method(service=$service, class=$object_name, separator=_) $( $method )+ );
)*
)?
// Static Methods
$(
$(
remote_type!(@static_method(service=$service, class=$object_name) $( $static_method )+ );
)*
)?
}
remote_type!(
@stream_remote_object(service=$service, class=$object_name)
properties: {
$( $( { $( $property)+ } )* )?
}
methods: {
$( $( { $( $method)+ } )* )?
}
);
remote_type!(
@call_remote_object(service=$service, class=$object_name)
properties: {
$( $( { $( $property)+ } )* )?
}
methods: {
$( $( { $( $method)+ } )* )?
}
);
};
//
// Properties
//
(
@property(service=$service:tt, class=$class:tt)
$prop_name: ident {
$(#[$getter_meta:meta])*
get: $getter_name: ident -> $getter_type: ty $(,
$(#[$setter_meta:meta])*
set: $setter_name: ident ($setter_type: ty) )?
}
) => {
remote_type!(@method(service=$service, class=$class, separator=_get_)
$( #[$getter_meta] )*
fn $getter_name() -> $getter_type {
$prop_name()
}
);
$(
remote_type!(@method(service=$service, class=$class, separator=_set_)
$( #[$setter_meta] )*
fn $setter_name(value: $setter_type) {
$prop_name(value)
}
);
)?
};
(
@property(service=$service:tt, class=$class:tt)
$( $props: tt)*
) => {
compile_error!(concat!("Invalid Remote Object property definition:\n", stringify!($($props)*)));
};
//
// Methods
//
(
@method(service=$service:tt, class=$class:tt, separator=$separator:tt)
$(#[$meta:meta])*
fn $method_name: ident ($( $arg_name: ident : $arg_type: ty), *) -> $return_type: ty {
$rpc_name: tt($( $arg_expr: expr ),* )
}
) => {
$(#[$meta])*
pub fn $method_name(&self $(, $arg_name : $arg_type)*) -> $crate::client::KrpcResult<$return_type> {
let args: Vec<Vec<u8>> = vec![self.encode()? $(, $arg_expr.encode()?)*];
let response = self.connection.invoke(stringify!($service),
concat!( stringify!($class), stringify!($separator), stringify!($rpc_name)),
&args)?;
Ok(<$return_type>::decode(&response, self.connection)?)
}
};
(
@method(service=$service:tt, class=$class:tt, separator=$separator:tt)
$(#[$meta:meta])*
fn $method_name: ident ($( $arg_name: ident : $arg_type: ty), *) {
$rpc_name: tt($( $arg_expr: expr ),* )
}
) => {
$(#[$meta])*
pub fn $method_name(&self $(, $arg_name : $arg_type)*) -> $crate::client::KrpcResult<()> {
let args: Vec<Vec<u8>> = vec![self.encode()? $(, $arg_expr.encode()?)*];
self.connection.invoke(stringify!($service),
concat!( stringify!($class), stringify!($separator), stringify!($rpc_name)),
&args)?;
Ok(())
}
};
(
@method(service=$service:tt, class=$class:tt, separator=$separator:tt)
$( $methods: tt)*
) => {
compile_error!(concat!("Invalid Remote Object method definition:\n", stringify!($($methods)*)));
};
//
// Static Methods
//
(
@static_method(service=$service:tt, class=$class:tt)
$(#[$meta:meta])*
fn $method_name: ident ($( $arg_name: ident : $arg_type: ty), *) -> $return_type: ty {
$rpc_name: tt($( $arg_expr: expr ),* )
}
) => {
$(#[$meta])*
pub fn $method_name(connection: &'a $crate::client::Connection $(, $arg_name : $arg_type)*) -> $crate::client::KrpcResult<$return_type> {
let args: Vec<Vec<u8>> = vec![$($arg_expr.encode()?),*];
let response = connection.invoke(stringify!($service),
concat!( stringify!($class), "_static_", stringify!($rpc_name)),
&args)?;
Ok(<$return_type>::decode(&response, connection)?)
}
};
(
@static_method(service=$service:tt, class=$class:tt)
$( $methods: tt)*
) => {
compile_error!(concat!("Invalid Remote Object static method definition:\n", stringify!($($methods)*)));
};
//
// Remote Object Stream
//
(
@stream_remote_object(service=$service: ident, class=$object_name: ident)
properties: {}
methods: {}
) => {
};
(
@stream_remote_object(service=$service: ident, class=$object_name: ident)
properties: {
$( { $( $property: tt)+ } )*
}
methods: {
$( { $( $method: tt)+ } )*
}
) => {
paste::item! {
#[derive(Debug, Clone)]
pub struct [<$object_name Stream>]<'a> {
connection: &'a $crate::client::Connection,
id: u64
}
impl<'a> $object_name<'a> {
/// Returns a stream instance that provides streaming versions of the
/// property getters and methods with return values.
pub fn stream(&self) -> [<$object_name Stream>]<'a> {
[<$object_name Stream>]::new(self)
}
}
impl<'a> [<$object_name Stream>]<'a> {
pub fn new(remote_object: &$object_name<'a>) -> Self {
Self {
connection: remote_object.connection,
id: remote_object.id
}
}
// Properties
$(
remote_type!(@stream_property(service=$service, class=$object_name) $( $property )+ );
)*
// Methods
$(
remote_type!(@stream_method(service=$service, class=$object_name, separator=_) $( $method )+ );
)*
}
}
};
//
// Stream Properties
//
(
@stream_property(service=$service:tt, class=$class:tt)
$prop_name: ident {
$(#[$getter_meta:meta])*
get: $getter_name: ident -> $getter_type: ty $(,
$(#[$setter_meta:meta])*
set: $setter_name: ident ($setter_type: ty) )?
}
) => {
remote_type!(@stream_method(service=$service, class=$class, separator=_get_)
$( #[$getter_meta] )*
fn $getter_name() -> $getter_type {
$prop_name()
});
};
(
@stream_property(service=$service:tt, class=$class:tt)
$( $props: tt)*
) => {
// silently ignore since it should be caught by the normal property definition
};
//
// Stream Methods
//
(
@stream_method(service=$service:tt, class=$class:tt, separator=$separator:tt)
$(#[$meta:meta])*
fn $method_name: ident ($( $arg_name: ident : $arg_type: ty), *) -> $return_type: ty {
$rpc_name: tt($( $arg_expr: expr ),* )
}
) => {
$(#[$meta])*
pub fn $method_name(&self $(, $arg_name : $arg_type)*) -> $crate::client::KrpcResult<$crate::client::Stream<$return_type>> {
let args: Vec<Vec<u8>> = vec![self.id.encode()? $(, $arg_expr.encode()?)*];
Ok(self.connection.add_stream(
stringify!($service),
concat!( stringify!($class), stringify!($separator), stringify!($rpc_name)),
&args
)?)
}
};
(
@stream_method(service=$service:tt, class=$class:tt, separator=$separator:tt)
$(#[$meta:meta])*
fn $method_name: ident ($( $arg_name: ident : $arg_type: ty), *) {
$rpc_name: tt($( $arg_expr: expr ),* )
}
) => {
// This space intentionally left blank
};
(
@stream_method(service=$service:tt, class=$class:tt, separator=$separator:tt)
$( $methods: tt)*
) => {
};
//
// Remote Object Call
//
(
@call_remote_object(service=$service: ident, class=$object_name: ident)
properties: {}
methods: {}
) => {
};
(
@call_remote_object(service=$service: ident, class=$object_name: ident)
properties: {
$( { $( $property: tt)+ } )*
}
methods: {
$( { $( $method: tt)+ } )*
}
) => {
paste::item! {
#[derive(Debug, Clone)]
pub struct [<$object_name Call>]<'a> {
connection: &'a $crate::client::Connection,
id: u64
}
impl<'a> $object_name<'a> {
/// Returns a call instance that provides versions of the properties
/// and methods as `ProcedureCall`s.
pub fn call(&self) -> [<$object_name Call>] {
[<$object_name Call>]::new(self)
}
}
impl<'a> [<$object_name Call>]<'a> {
pub fn new(remote_object: &$object_name<'a>) -> Self {
Self {
connection: remote_object.connection,
id: remote_object.id
}
}
// Propertie
$(
remote_type!(@call_property(service=$service, class=$object_name) $( $property )+ );
)*
// Methods
$(
remote_type!(@call_method(service=$service, class=$object_name, separator=_) $( $method )+ );
)*
}
}
};
//
// Call Properties
//
(
@call_property(service=$service:tt, class=$class:tt)
$prop_name: ident {
$(#[$getter_meta:meta])*
get: $getter_name: ident -> $getter_type: ty $(,
$(#[$setter_meta:meta])*
set: $setter_name: ident ($setter_type: ty) )?
}
) => {
remote_type!(
@call_method(service=$service, class=$class, separator=_get_)
$( #[$getter_meta] )*
fn $getter_name() -> $getter_type {
$prop_name()
}
);
$(
remote_type!(
@call_method(service=$service, class=$class, separator=_set_)
$( #[$setter_meta] )*
fn $setter_name(value: $setter_type) {
$prop_name(value)
}
);
)?
};
(
@call_property(service=$service:tt, class=$class:tt)
$( $props: tt)*
) => {
// silently ignore since it should be caught by the normal property definition
};
//
// Call Methods
//
(
@call_method(service=$service:tt, class=$class:tt, separator=$separator:tt)
$(#[$meta:meta])*
fn $method_name: ident ($( $arg_name: ident : $arg_type: ty), *) $( -> $return_type: ty )? {
$rpc_name: tt($( $arg_expr: expr ),* )
}
) => {
$(#[$meta])*
pub fn $method_name(&self $(, $arg_name : $arg_type)*) -> $crate::client::KrpcResult<$crate::client::ProcedureCall> {
let args: Vec<Vec<u8>> = vec![self.id.encode()? $(, $arg_expr.encode()?)*];
Ok(self.connection.procedure_call(
stringify!($service),
concat!( stringify!($class), stringify!($separator), stringify!($rpc_name)),
&args,
))
}
};
(
@call_method(service=$service:tt, class=$class:tt, separator=$separator:tt)
$( $methods: tt)*
) => {
};
//
// Remote Enum
//
( $(#[$enum_meta:meta])*
enum $enum_name: ident {
$( $(#[$variant_meta:meta])* $value_name: ident = $value_int : expr),+ $(,)?
}) => {
$(#[$enum_meta])*
#[derive(Debug, Copy, Clone, PartialEq, PartialOrd)]
pub enum $enum_name {
$(
$(#[$variant_meta])*
$value_name = $value_int
),+
}
impl $crate::RemoteEnum for $enum_name {
fn from_value(value: i64) -> Option<Self> {
match value {
$( $value_int => Some($enum_name::$value_name)),+,
_ => None
}
}
fn value(&self) -> i64 {
*self as i64
}
}
impl<'a> $crate::codec::Decode<'a> for $enum_name {
fn decode(bytes: &Vec<u8>, connection: &'a $crate::client::Connection) -> $crate::codec::CodecResult<Self> {
let value = i64::decode(bytes, connection)?;
Ok(Self::from_value(value)
.ok_or($crate::codec::CodecError::InvalidEnumValue(value))?)
}
}
impl $crate::codec::Encode for $enum_name {
fn encode(&self) -> $crate::codec::CodecResult<Vec<u8>> {
self.value().encode()
}
}
}
}
| 29.749179 | 145 | 0.438386 |
d9c51b3491ec7dfed7132769759421a70ab9d717 | 11,852 | rs | Rust | src/api/api.rs | mjarkk/wotnlclans | 11f21221d6625d5608c68df36e7f36dc3e8d7d46 | [
"Apache-2.0"
] | 2 | 2019-01-31T09:46:30.000Z | 2019-08-21T05:21:59.000Z | src/api/api.rs | mjarkk/wotnlclans | 11f21221d6625d5608c68df36e7f36dc3e8d7d46 | [
"Apache-2.0"
] | 6 | 2019-01-21T06:49:57.000Z | 2021-02-04T09:15:34.000Z | src/api/api.rs | mjarkk/wotnlclans | 11f21221d6625d5608c68df36e7f36dc3e8d7d46 | [
"Apache-2.0"
] | 1 | 2020-03-05T21:21:58.000Z | 2020-03-05T21:21:58.000Z | use super::routes::{call_route, Routes};
use super::types::{
ClanData, ClanDataData, ClanDiscription, ClanRating, ClanRatingData, Response, TopClans,
};
use crate::db;
use crate::other::{remove_all_quotes, ConfAndFlags};
use futures::Future;
use std::collections::HashMap;
use std::pin::Pin;
pub async fn search_for_clan_ids(config: &ConfAndFlags) -> Result<(), String> {
let mut clans = get_all_clan_ids(config).await?;
println!("Fetched {} clan ids", clans.len());
clans = filter_out_clans(config, clans).await;
println!("Filtered clans, output = {} clans", clans.len());
// // TODO: Removes blacklisted clans and add extra clans to the clans list
clans = remove_duplicates(clans);
println!("Removed duplicate clans, output = {} clans", clans.len());
db::set_clan_ids(&clans);
// when this is ran for the first time make sure to get clan list
get_clan_data(config, Some(clans)).await?;
Ok(())
}
// GetClanData returns all needed information about clans
// includedClans is not required
pub async fn get_clan_data(
config: &ConfAndFlags,
included_clans: Option<Vec<String>>,
) -> Result<(), String> {
let mut clan_ids: HashMap<String, ()> = if let Some(ids) = included_clans {
let mut res: HashMap<String, ()> = HashMap::new();
for id in ids {
res.insert(id, ());
}
res
} else {
db::get_clan_ids().clone()
};
let blocked_clans = db::get_blocked_clans_ids().clone();
let mut extra_clans = db::get_extra_clans_ids().clone();
for (clan_id, _) in &clan_ids {
extra_clans.remove(clan_id);
}
for (id, _) in extra_clans {
clan_ids.insert(id, ());
}
let mut to_save: Vec<db::ClanStats> = Vec::new();
let to_fetch = split_map_to_chucks(clan_ids);
for chunk in to_fetch {
let res = get_clan_data_try(config.clone(), chunk, None).await;
let (info, rating, clans_to_remove_from_ids) = match res {
Ok(v) => v,
Err(e) => {
println!("get_clan_data error check get_clan_data_try: error: {}", e);
continue;
}
};
db::remove_clan_ids(clans_to_remove_from_ids);
for (id, item) in info {
let rating = if let Some(rating) = rating.get(&id) {
rating
} else {
continue;
};
let is_blocked = blocked_clans.get(&id).is_some();
if item.tag.len() < 2 {
continue;
}
let emblems = db::ClanStatsEmblems {
x256_wowp: item.emblems.x256.wowp,
x195_portal: item.emblems.x195.portal,
x64_portal: item.emblems.x64.portal,
x64_wot: item.emblems.x64.wot,
x32_portal: item.emblems.x32.portal,
x24_portal: item.emblems.x24.portal,
};
let stats = db::HistoryClanStats {
tag: item.tag.clone(),
name: item.name.clone(),
id: id.clone(),
members: item.members_count,
battles: rating.battles_count_avg.value,
daily_battles: rating.battles_count_avg_daily.value,
efficiency: rating.efficiency.value,
fb_elo10: rating.fb_elo_rating_10.value,
fb_elo8: rating.fb_elo_rating_8.value,
fb_elo6: rating.fb_elo_rating_6.value,
fb_elo: rating.fb_elo_rating.value,
gm_elo10: rating.gm_elo_rating_10.value,
gm_elo8: rating.gm_elo_rating_8.value,
gm_elo6: rating.gm_elo_rating_6.value,
gm_elo: rating.gm_elo_rating.value,
glob_rating: rating.global_rating_avg.value,
glob_rating_weighted: rating.global_rating_weighted_avg.value,
win_ratio: rating.wins_ratio_avg.value,
v10l: rating.v10l_avg.value,
};
to_save.push(db::ClanStats {
blocked: is_blocked,
tag: item.tag,
name: item.name,
color: item.color,
members: item.members_count,
description: item.description_html,
motto: item.motto,
id: id.clone(),
emblems: emblems,
stats: stats,
});
}
}
db::set_current_clans_data(to_save)?;
Ok(())
}
fn get_clan_data_try_re(
config: ConfAndFlags,
chunk_input: Vec<String>,
removed_ids: Option<Vec<String>>,
) -> Pin<
Box<
dyn Future<
Output = Result<
(
HashMap<String, ClanDataData>,
HashMap<String, ClanRatingData>,
Vec<String>,
),
String,
>,
> + Send,
>,
> {
Box::pin(
async move { get_clan_data_try(config, chunk_input.clone(), removed_ids.clone()).await },
)
}
// GetClanDataTry is a helper function that retries when the api reports on invalid clan IDs
async fn get_clan_data_try(
config: ConfAndFlags,
chunk_input: Vec<String>,
removed_ids: Option<Vec<String>>,
) -> Result<
(
HashMap<String, ClanDataData>,
HashMap<String, ClanRatingData>,
Vec<String>,
),
String,
> {
let chunk = remove_all_quotes(chunk_input);
let clan_data_route = Routes::ClanData(chunk.clone());
let info: Response<ClanData> = call_route(clan_data_route, &config).await?;
let info_data = match info.get_data() {
Ok(v) => v,
Err(e) => {
if let Some(meta) = info.error {
match (meta.field, meta.value) {
(Some(field), Some(value)) => {
if field == "clan_id" && meta.message == "INVALID_CLAN_ID" && value != "" {
let mut new_chunk: Vec<String> = Vec::new();
let mut to_exclude: Vec<String> =
value.split(",").map(|id_str| id_str.to_string()).collect();
'outer: for clan_id in chunk {
for item in &to_exclude {
if item == &clan_id {
continue 'outer;
}
}
new_chunk.push(clan_id);
}
let mut new_removed_ids = removed_ids.unwrap_or(Vec::new());
new_removed_ids.append(&mut to_exclude);
return get_clan_data_try_re(config, new_chunk, Some(new_removed_ids))
.await;
}
}
_ => {}
}
}
return Err(e);
}
};
let clan_rating_route = Routes::ClanRating(chunk);
let rating: Response<ClanRating> = call_route(clan_rating_route, &config).await?;
let rating_data = rating.get_data()?;
if info_data.len() != rating_data.len() {
Err(String::from("No clans in response"))
} else {
Ok((info_data, rating_data, removed_ids.unwrap_or(Vec::new())))
}
}
// removes duplicates from an array
fn remove_duplicates(input: Vec<String>) -> Vec<String> {
let mut output: Vec<String> = Vec::new();
for input_item in input {
let mut exsists = false;
for output_item in output.iter() {
if &input_item == output_item {
exsists = true;
break;
}
}
if !exsists {
output.push(input_item);
}
}
output
}
// FilterOutClans filters out all not dutch clans out of a input list
async fn filter_out_clans(config: &ConfAndFlags, clan_ids: Vec<String>) -> Vec<String> {
let tofetch = split_to_chucks(clan_ids);
let mut to_return: Vec<String> = Vec::new();
for ids in tofetch {
let route = Routes::ClanDiscription(ids);
let out: Response<ClanDiscription> = match call_route(route, config).await {
Ok(v) => v,
Err(e) => {
println!("filter_out_clans api call failed, error: {}", e);
continue;
}
};
let data = match out.get_data() {
Ok(v) => v,
Err(e) => {
println!("filter_out_clans api call failed, error: {}", e);
continue;
}
};
for (clan_id, clan) in data {
let (description, tag) = match (clan.description, clan.tag) {
(Some(des), Some(tag)) => (des, tag),
_ => continue,
};
if !is_spesified_lang(config, description) {
continue;
}
to_return.push(clan_id);
println!("found clan: {}", tag);
}
}
to_return
}
// SplitToChucks splits up a input list in arrays of 100
// This makes it easy to request a lot of things at the same time from the wargaming api
fn split_to_chucks(list: Vec<String>) -> Vec<Vec<String>> {
let mut res: Vec<Vec<String>> = vec![];
for item in list {
if let Some(out) = res.last_mut() {
if out.len() < 100 {
out.push(item);
continue;
}
}
res.push(vec![item]);
}
res
}
fn split_map_to_chucks<T>(list: HashMap<String, T>) -> Vec<Vec<String>> {
let mut res: Vec<Vec<String>> = vec![];
for (item, _) in list {
if let Some(out) = res.last_mut() {
if out.len() < 100 {
out.push(item);
continue;
}
}
res.push(vec![item]);
}
res
}
// GetAllClanIds returns all clan ids
async fn get_all_clan_ids(config: &ConfAndFlags) -> Result<Vec<String>, String> {
let mut ids: Vec<String> = Vec::new();
let mut page = 0;
loop {
page += 1;
if page > config.flags().get_max_index_pages() {
break;
}
let out: Response<TopClans> = call_route(Routes::TopClans(page), config).await?;
let data = out.get_data()?;
if data.len() == 0 {
break;
}
for clan in data {
ids.push(clan.clan_id.to_string());
}
if config.is_dev() {
if page % 10 == 1 {
println!("Fetched {} clans", ids.len());
}
} else {
if page % 50 == 1 {
println!("Fetched {} clans", ids.len());
}
}
}
Ok(ids)
}
// IsSpesifiedLang checks a setence for allowed and disallowed words
fn is_spesified_lang(config: &ConfAndFlags, input: String) -> bool {
if input.len() == 0 {
return false;
}
let formatted_input = input
.to_lowercase()
.replace("\n", " ")
.replace("\t", " ")
.replace("\r", " ")
.replace(" ", " ");
let formatted_input_parts: Vec<&str> = formatted_input.split(" ").collect();
let inner_conf = config.conf();
let mut res = false;
for mut word in formatted_input_parts {
word = word.trim();
if word == "" {
continue;
}
for disallowed_word in &inner_conf.disallowed_words {
if word.contains(disallowed_word.trim()) {
return false;
}
}
if !res {
for allowed_word in &inner_conf.allowed_words {
if word.contains(allowed_word.trim()) {
res = true;
break;
}
}
}
}
return res;
}
| 31.271768 | 99 | 0.51755 |
c4578fe09682d39873f4f04e11be621768301f33 | 298 | dart | Dart | lib/data/helpers/dialog_helper.dart | iamnijat/code-quizzy | cda7690c3f53f597de6af5320596d4aa7508ec44 | [
"MIT"
] | 9 | 2022-02-01T10:01:00.000Z | 2022-02-18T10:12:27.000Z | lib/data/helpers/dialog_helper.dart | iamnijat/code-quizzy | cda7690c3f53f597de6af5320596d4aa7508ec44 | [
"MIT"
] | null | null | null | lib/data/helpers/dialog_helper.dart | iamnijat/code-quizzy | cda7690c3f53f597de6af5320596d4aa7508ec44 | [
"MIT"
] | 1 | 2022-02-02T17:32:02.000Z | 2022-02-02T17:32:02.000Z | import 'package:flutter/material.dart';
import '../../presentation/dialogs/index.dart';
Future<void> showGestureSuggestionDialog(
context,
) {
return showDialog(
context: context,
barrierDismissible: true,
builder: (BuildContext context) => const GestureSuggestionDialog(),
);
}
| 22.923077 | 71 | 0.724832 |
5da9cbeb3acc3b21b98ec9a23e3fb80c05181488 | 1,632 | kt | Kotlin | src/main/kotlin/io/georocket/ServerAPIException.kt | tobias93/georocket | 5e498d97e0c05df68392befa43d3e7e00b32fc94 | [
"Apache-2.0"
] | null | null | null | src/main/kotlin/io/georocket/ServerAPIException.kt | tobias93/georocket | 5e498d97e0c05df68392befa43d3e7e00b32fc94 | [
"Apache-2.0"
] | null | null | null | src/main/kotlin/io/georocket/ServerAPIException.kt | tobias93/georocket | 5e498d97e0c05df68392befa43d3e7e00b32fc94 | [
"Apache-2.0"
] | null | null | null | package io.georocket
import io.vertx.core.impl.NoStackTraceThrowable
import io.vertx.core.json.JsonObject
import io.vertx.kotlin.core.json.jsonObjectOf
/**
* An exception that will be created if an API exception has happened
* on the server side
* @author Tim Hellhake
* @since 1.1.0
*/
class ServerAPIException(
/**
* A unique machine readable type for the API exception
*/
val type: String,
/**
* the reason for the exception
*/
private val reason: String?
) : NoStackTraceThrowable(reason) {
/**
* Serialize exception
* @return a JSON object with the type and the reason of this error
*/
fun toJson(): JsonObject =
Companion.toJson(type, reason)
companion object {
private const val serialVersionUID = -4139618811295918617L
/**
* The syntax of a property command is not valid
* @since 1.1.0
*/
const val INVALID_PROPERTY_SYNTAX_ERROR = "invalid_property_syntax_error"
/**
* The server issued an HTTP request which failed
* @since 1.1.0
*/
const val HTTP_ERROR = "http_error"
/**
* A generic error occurred, see reason for details
* @since 1.1.0
*/
const val GENERIC_ERROR = "generic_error"
/**
* Create a JSON object from a type and a reason
* @param type the type
* @param reason the reason
* @return a JSON object with the specified type and the specified reason
*/
fun toJson(type: String, reason: String?): JsonObject {
return jsonObjectOf(
"error" to jsonObjectOf(
"type" to type,
"reason" to reason
)
)
}
}
}
| 23.314286 | 77 | 0.647672 |
85790bb351b6327cdca696fd1357451be3131246 | 4,167 | js | JavaScript | pcOPPO/routes/commodity.js | sijingru/copyOppomobile | 89173f2ab111998024f055fcad3f9a9a3c8fd4cd | [
"MIT"
] | 1 | 2017-01-16T06:12:19.000Z | 2017-01-16T06:12:19.000Z | pcOPPO/routes/commodity.js | sijingru/copyOppomobile | 89173f2ab111998024f055fcad3f9a9a3c8fd4cd | [
"MIT"
] | null | null | null | pcOPPO/routes/commodity.js | sijingru/copyOppomobile | 89173f2ab111998024f055fcad3f9a9a3c8fd4cd | [
"MIT"
] | null | null | null | var express = require('express');
var router = express.Router();
var CommService = require('../service/CommService.js');
//添加商品
router.post('/addComm', function(req, res, next) {
// console.log("ion")
var commodity = JSON.parse(req.body.commodity)
CommService.addComm(commodity, function(data) {
res.send(data);
})
});
//添加商品图片
router.post('/addCommImgs', function(req, res, next) {
var commodityImgs = JSON.parse(req.body.commodityImgs)
CommService.addCommImgs(commodityImgs, function(data) {
res.send(data);
})
});
//改变商品信息
router.post('/changeComm', function(req, res, next) {
var data = JSON.parse(req.body.data)
CommService.changeComm(data, function(data) {
res.send(data);
})
});
//获取商品图片
router.post('/getCommImgs', function(req, res, next) {
var commodityImgs = JSON.parse(req.body.commodityImgs)
CommService.getCommImgs(commodityImgs, function(data) {
res.send(data);
})
});
router.get('/getCommImgsByType', function(req, res, next) {
CommService.getCommImgsByType(req.query.imgType, function(data) {
res.setHeader("Access-Control-Allow-Origin","*")
res.jsonp(data);
})
});
router.get('/getcommDetail', function(req, res, next) {
CommService.getcommDetail(req.query.commId,req.query.imgType, function(data) {
res.setHeader("Access-Control-Allow-Origin","*")
res.jsonp(data);
})
});
router.post('/getAllCommImgs', function(req, res, next) {
CommService.getAllCommImgs(req.body._id,function(data) {
res.send(data);
})
});
router.post('/getAllCommImgs', function(req, res, next) {
CommService.getAllCommImgs(req.body._id,function(data) {
res.send(data);
})
});
// 接口用于通过管理员账号查询商品
router.post('/getCommByUsername', function(req, res, next) {
CommService.getCommByUsername(req.body.username, function(data) {
res.send(data);
})
});
// 接口用于通过超级管理员查询商品
router.post('/getAllComm', function(req, res, next) {
CommService.getAllComm(function(data) {
res.send(data);
})
});
router.get('/getAllComm', function(req, res, next) {
CommService.getAllComm(function(data) {
res.setHeader("Access-Control-Allow-Origin","*")
res.jsonp(data);
})
});
//delComm 接口用于删除商品
router.post('/delComm', function(req, res, next) {
CommService.delComm(req.body._id, function(data) {
res.send(data);
})
});
//delCommImg 接口用于删除商品图片
router.post('/delCommImg', function(req, res, next) {
CommService.delCommImg(req.body._id, function(data) {
res.send(data);
})
});
//getCommColorImgs接口用于通过颜色获取商品图片
router.post('/getCommColorImgs', function(req, res, next) {
var commodityImgs = JSON.parse(req.body.commodityImgs)
CommService.getCommColorImgs(commodityImgs, function(data) {
res.send(data);
})
});
router.get('/getCommIdImgs', function(req, res, next) {
// var commodityImgs = JSON.parse(req.body.commodityImgs)
CommService.getCommIdImgs(req.query.commId,req.query.imgColor, function(data) {
res.setHeader("Access-Control-Allow-Origin","*")
res.jsonp(data);
})
});
// getSingleComm接口用商品名获取单独的商品信息
router.post('/getSingleComm', function(req, res, next) {
CommService.getSingleComm(req.body.commName, function(data) {
res.send(data);
})
});
router.get("/getCommById",function(req,res,next){
CommService.getCommById(req.query.commId, function(data) {
res.setHeader("Access-Control-Allow-Origin","*")
res.jsonp(data);
})
})
// getCommBySeries接口用于获取商品系列数据
// router.post('/getCommBySeries', function(req, res, next) {
// CommService.getCommBySeries(req.body.curPage, req.body.eachPage, function(data) {
// // res.send(data);
// })
// });
// router.post('/getCommodityImgsByPage', function(req, res, next) {
// CommService.getCommodityImgsByPage(req.body.commId, function(data) {
// res.send(data);
// })
// });
router.post('/getAddCommID', function(req, res, next) {
var _id = req.body._id;
CommService.getAddCommID(_id, function(data) {
res.send(data);
})
});
module.exports = router; | 29.553191 | 88 | 0.655628 |
0482f0e107fb5736dc60c46846cd9864bf9d59a9 | 116 | java | Java | src/package-info.java | danielbalaz/bTB_indiv | 6396e874c1000f5851b4832140e98f44b3b1fc04 | [
"Apache-2.0"
] | null | null | null | src/package-info.java | danielbalaz/bTB_indiv | 6396e874c1000f5851b4832140e98f44b3b1fc04 | [
"Apache-2.0"
] | null | null | null | src/package-info.java | danielbalaz/bTB_indiv | 6396e874c1000f5851b4832140e98f44b3b1fc04 | [
"Apache-2.0"
] | null | null | null | /**
* Btb transmission dynamics in clusters of farms using aggregated movements.
*/
package btbcluster.dynamics;
| 19.333333 | 77 | 0.767241 |
dd913e165a127dd7b5e82768682c4cb8f94728d4 | 3,504 | go | Go | integration-test/app/helm/helm_client.go | yesitsme007/potter-controller | bb50cf6aabdb1ab8dbd0f0452415393482a3c477 | [
"Apache-2.0",
"MIT"
] | 2 | 2021-05-19T01:01:18.000Z | 2021-07-02T02:29:10.000Z | integration-test/app/helm/helm_client.go | yesitsme007/potter-controller | bb50cf6aabdb1ab8dbd0f0452415393482a3c477 | [
"Apache-2.0",
"MIT"
] | 1 | 2021-03-09T13:35:06.000Z | 2021-03-09T13:35:06.000Z | integration-test/app/helm/helm_client.go | yesitsme007/potter-controller | bb50cf6aabdb1ab8dbd0f0452415393482a3c477 | [
"Apache-2.0",
"MIT"
] | 1 | 2021-02-16T08:09:44.000Z | 2021-02-16T08:09:44.000Z | package helm
import (
"context"
"fmt"
"os"
"github.com/gardener/potter-controller/integration-test/app/util"
"github.com/pkg/errors"
grpcStatus "google.golang.org/grpc/status"
"helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/kube"
"helm.sh/helm/v3/pkg/release"
"helm.sh/helm/v3/pkg/storage"
"helm.sh/helm/v3/pkg/storage/driver"
"k8s.io/client-go/kubernetes"
"sigs.k8s.io/controller-runtime/pkg/client"
)
type HelmClient struct { // nolint
targetKubeConfig string
}
func NewHelmClient(ctx context.Context, config *util.IntegrationTestConfig, gardenClient client.Client) *HelmClient {
return &HelmClient{
targetKubeConfig: util.GetTargetKubeConfig(ctx, gardenClient, config),
}
}
func (p *HelmClient) GetDeployedValues(ctx context.Context, installName, namespace string) map[string]interface{} {
helmrelease, err := p.getRelease(ctx, installName, namespace, p.targetKubeConfig)
if err != nil {
util.Write(err, "Unable to get release")
os.Exit(1)
}
return helmrelease.Config
}
func (p *HelmClient) getRelease(ctx context.Context, name, namespace, kubeconfig string) (*release.Release, error) {
config, err := initActionConfig(ctx, kubeconfig, namespace)
if err != nil {
return nil, err
}
rls, err := action.NewGet(config).Run(name)
if err != nil {
return nil, errors.New(prettyError(err).Error())
}
// We check that the release found is from the provided namespace.
// If `namespace` is an empty string we do not do that check
// This check check is to prevent users of for example updating releases that might be
// in namespaces that they do not have access to.
if namespace != "" && rls.Namespace != namespace {
return nil, errors.Errorf("release %q not found in namespace %q", name, namespace)
}
return rls, err
}
func initActionConfig(ctx context.Context, kubeconfig, namespace string) (*action.Configuration, error) {
logf := createLogFunc(ctx)
restClientGetter := newRemoteRESTClientGetter([]byte(kubeconfig), namespace)
kc := kube.New(restClientGetter)
kc.Log = logf
clientset, err := kc.Factory.KubernetesClientSet()
if err != nil {
return nil, err
}
store := getStorageType(ctx, clientset, namespace)
actionConfig := action.Configuration{
RESTClientGetter: restClientGetter,
Releases: store,
KubeClient: kc,
Log: logf,
}
return &actionConfig, nil
}
func prettyError(err error) error {
// Add this check can prevent the object creation if err is nil.
if err == nil {
return nil
}
// If it's grpc's error, make it more user-friendly.
if s, ok := grpcStatus.FromError(err); ok {
return fmt.Errorf(s.Message())
}
// Else return the original error.
return err
}
func createLogFunc(ctx context.Context) func(format string, v ...interface{}) {
return func(format string, v ...interface{}) {
}
}
func getStorageType(ctx context.Context, clientset *kubernetes.Clientset, namespace string) *storage.Storage {
logf := createLogFunc(ctx)
var store *storage.Storage
switch os.Getenv("HELM_DRIVER") {
case "secret", "secrets", "":
d := driver.NewSecrets(clientset.CoreV1().Secrets(namespace))
d.Log = logf
store = storage.Init(d)
case "configmap", "configmaps":
d := driver.NewConfigMaps(clientset.CoreV1().ConfigMaps(namespace))
d.Log = logf
store = storage.Init(d)
case "memory":
d := driver.NewMemory()
store = storage.Init(d)
default:
// Not sure what to do here.
panic("Unknown driver in HELM_DRIVER: " + os.Getenv("HELM_DRIVER"))
}
return store
}
| 27.590551 | 117 | 0.715753 |
9c25d01f2657423d7461d8d672dfd957c1b17833 | 1,015 | js | JavaScript | node_modules/@twilio/video-processors/es5/types.js | osama294/doctorportal | fbbf71db1d679f699daabdef83e828555ce8a6fc | [
"MIT"
] | null | null | null | node_modules/@twilio/video-processors/es5/types.js | osama294/doctorportal | fbbf71db1d679f699daabdef83e828555ce8a6fc | [
"MIT"
] | null | null | null | node_modules/@twilio/video-processors/es5/types.js | osama294/doctorportal | fbbf71db1d679f699daabdef83e828555ce8a6fc | [
"MIT"
] | null | null | null | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ImageFit = void 0;
/**
* ImageFit specifies the positioning of an image inside a viewport.
*/
var ImageFit;
(function (ImageFit) {
/**
* Scale the image up or down to fill the viewport while preserving the aspect ratio.
* The image will be fully visible but will add empty space in the viewport if
* aspect ratios do not match.
*/
ImageFit["Contain"] = "Contain";
/**
* Scale the image to fill both height and width of the viewport while preserving
* the aspect ratio, but will crop the image if aspect ratios do not match.
*/
ImageFit["Cover"] = "Cover";
/**
* Stretches the image to fill the viewport regardless of aspect ratio.
*/
ImageFit["Fill"] = "Fill";
/**
* Ignore height and width and use the original size.
*/
ImageFit["None"] = "None";
})(ImageFit = exports.ImageFit || (exports.ImageFit = {}));
//# sourceMappingURL=types.js.map | 35 | 89 | 0.653202 |
0416b4357fc5ffcbee1882c13cf728758d2a2c34 | 3,697 | js | JavaScript | src/Program.js | Donorhan/Lemon-JS | 6300c5a1d7c6a80ba6b128f48bdd8221aad05a50 | [
"MIT"
] | 52 | 2017-11-29T08:31:22.000Z | 2021-09-07T16:34:59.000Z | src/Program.js | DonoSybrix/Lemon-JS | 6300c5a1d7c6a80ba6b128f48bdd8221aad05a50 | [
"MIT"
] | 4 | 2016-02-07T17:10:32.000Z | 2016-02-13T10:29:38.000Z | src/Program.js | Donorhan/Lemon-JS | 6300c5a1d7c6a80ba6b128f48bdd8221aad05a50 | [
"MIT"
] | 3 | 2019-02-17T03:42:39.000Z | 2020-03-06T14:44:17.000Z | import ContextResource from './ContextResource';
import FileLoader from './Loaders/FileLoader';
/**
* A program
*
* @category Shaders
* @extends {ContextResource}
*/
export class Program extends ContextResource {
/**
* Constructor
*
* @constructor
*/
constructor() {
super();
/**
* Attributes
*
* @type {Array.<ProgramElement>}
* @private
*/
this.attributes = [];
/**
* Shader sources
*
* - First index is for the vertex shader
* - Second index is for the fragment shader
*
* @type {Array.<string>}
* @private
*/
this.sources = [null, null];
/**
* Uniforms
*
* @type {Array.<Program.Element>}
* @private
*/
this.uniforms = [];
}
/**
* Load program from shader files
*
* @param {string} vertexFile Path to the vertex shader file
* @param {string} fragmentFile Path to the fragment shader file
*/
async loadFromFiles(vertexFile, fragmentFile) {
const vertexReponse = await FileLoader.load(vertexFile);
this.sources[0] = vertexReponse.data;
const fragmentResponse = await FileLoader.load(fragmentFile);
this.sources[1] = fragmentResponse.data;
}
/**
* Load program from data
*
* @param {string} vertexSource Vertex shader code
* @param {string} fragmentSource Fragment shader code
*/
loadFromData(vertexSource, fragmentSource) {
this.sources[0] = vertexSource;
this.sources[1] = fragmentSource;
}
/**
* Get attributes
*
* @return {Array.<ProgramElement>} An array of attribute
*/
getAttributes() {
return this.attributes;
}
/**
* Get program's sources
*
* @return {Array.<string>} Index 0: Vertex shader, Index 1: Fragment shader
*/
getSources() {
return this.sources;
}
/**
* Get uniform
*
* @param {string} name Name of the uniform
* @return {?ProgramElement} A program Element or null if uniform doesn't exist
*/
getUniform(name) {
return this.uniforms[name] || null;
}
/**
* Get uniforms
*
* @return {Array.<ProgramElement>} An array of uniforms
*/
getUniforms() {
return this.uniforms;
}
/**
* Say if program is ready to be use
*
* Source array must have two elements: the fragment and the vertex shaders
* @return {boolean} True if program is ready, otherwise false
*/
isReady() {
return (this.sources.length === 2 && this.sources[0] !== null && this.sources[1] !== null);
}
}
/**
* An element from the shader
*
* @category Shaders
* @constructor
*/
export class ProgramElement {
/**
* Constructor
*
* @param {number} location Location in the shader
* @param {string} name His name
* @param {Type} type Element's type (float, vec, …)
* @param {number} size Element's size
*/
constructor(location, name, type, size) {
/**
* Location in the shader
*
* @type {number}
* @public
*/
this.location = location;
/**
* Name
*
* @type {string}
* @public
*/
this.name = name;
/**
* Type
*
* @type {Type}
* @public
*/
this.type = type;
/**
* Size/Count
*
* @type {number}
* @public
*/
this.size = size;
}
}
| 21.87574 | 99 | 0.522045 |
15b0dfcd9d28035add5a20c5c9f0653ce5a63dbc | 2,846 | lua | Lua | generation/interpolate.lua | shuizhilinxin/IcGAN | c4dfebc8c5a912ceacb9088d9ab0fa08b1ec6143 | [
"BSD-3-Clause"
] | 1 | 2018-03-16T04:50:42.000Z | 2018-03-16T04:50:42.000Z | generation/interpolate.lua | pranjalAI/IcGAN | 0c73cf846850ab8c4bdad9da56bce985e31fd21e | [
"BSD-3-Clause"
] | null | null | null | generation/interpolate.lua | pranjalAI/IcGAN | 0c73cf846850ab8c4bdad9da56bce985e31fd21e | [
"BSD-3-Clause"
] | null | null | null | require 'image'
require 'nn'
optnet = require 'optnet'
disp = require 'display'
torch.setdefaulttensortype('torch.FloatTensor')
assert(loadfile("cfg/generateConfig.lua"))(3)
-- one-line argument parser. Parses environment variables to override the defaults
for k,v in pairs(opt) do opt[k] = tonumber(os.getenv(k)) or os.getenv(k) or opt[k] end
local function applyThreshold(Y, th)
-- Takes a matrix Y and thresholds, given th, to -1 and 1
assert(th>=-1 and th<=1, "Error: threshold must be between -1 and 1")
for i=1,Y:size(1) do
for j=1,Y:size(2) do
local val = Y[{{i},{j}}][1][1]
if val > th then
Y[{{i},{j}}] = 1
else
Y[{{i},{j}}] = -1
end
end
end
return Y
end
if opt.gpu > 0 then
require 'cunn'
require 'cudnn'
end
local ny = 18 -- Y label length. This depends on the dataset. 18 for CelebA
-- Load nets
local generator = torch.load(opt.decNet)
local encZ = torch.load(opt.encZnet)
local encY = torch.load(opt.encYnet)
local inputX = torch.Tensor(2, opt.loadSize[1], opt.loadSize[2], opt.loadSize[3])
local Z = torch.Tensor(opt.nInterpolations+2, opt.nz, 1, 1)
local Y = torch.Tensor(opt.nInterpolations+2, ny):fill(-1)
inputX[{{1}}] = image.load(opt.im1Path)
inputX[{{2}}] = image.load(opt.im2Path)
inputX:mul(2):add(-1) -- change [0, 1] to [-1, 1]
-- Load to GPU
if opt.gpu > 0 then
inputX = inputX:cuda(); Z = Z:cuda(); Y = Y:cuda()
cudnn.convert(generator, cudnn)
cudnn.convert(encZ, cudnn); cudnn.convert(encY, cudnn)
generator:cuda(); encZ:cuda(); encY:cuda()
else
generator:float(); encZ:float(); encY:float()
end
generator:evaluate()
encZ:evaluate(); encY:evaluate()
-- Encode real images to Z and Y
local tmpZ = encZ:forward(inputX)
local tmpY = encY:forward(inputX)
applyThreshold(tmpY,0)
tmpZ:resize(tmpZ:size(1), tmpZ:size(2), 1, 1)
local im1Z = tmpZ[{{1}}]; local im2Z = tmpZ[{{2}}]
local im1Y = tmpY[{{1}}]; local im2Y = tmpY[{{2}}]
-- Interpolate Z and Y
-- do a linear interpolation in Z and Y space between point A and point B
local weight = torch.linspace(1, 0, opt.nInterpolations+2)
for i = 1, opt.nInterpolations+2 do
Z:select(1, i):copy(im1Z * weight[i] + im2Z * (1 - weight[i]))
Y:select(1, i):copy(im1Y * weight[i] + im2Y * (1 - weight[i]))
end
-- Generate interpolations
local outX = generator:forward{Z, Y}:float()
local container = torch.Tensor(opt.nInterpolations+4, opt.loadSize[1], opt.loadSize[2], opt.loadSize[3])
container[{{1}}]:copy(inputX[{{1}}])
container[{{container:size(1)}}]:copy(inputX[{{2}}])
for i=1,opt.nInterpolations+2 do
container[{{i+1}}]:copy(outX[{{i}}])
end
disp.image(image.toDisplayTensor(container,0,container:size(1)))
image.save('interpolations.png', image.toDisplayTensor(container,0,container:size(1)))
| 30.602151 | 104 | 0.652495 |
d6f058df61709709366377ce94f1991147d5189f | 1,307 | asm | Assembly | examples/microblaze/crt0.asm | rakati/ppci-mirror | 8f5b0282fd1122d7c389b39c86fcf5d9352b7bb2 | [
"BSD-2-Clause"
] | 161 | 2020-05-31T03:29:42.000Z | 2022-03-07T08:36:19.000Z | examples/microblaze/crt0.asm | rakati/ppci-mirror | 8f5b0282fd1122d7c389b39c86fcf5d9352b7bb2 | [
"BSD-2-Clause"
] | 74 | 2020-05-26T18:05:48.000Z | 2021-02-13T21:55:39.000Z | examples/microblaze/crt0.asm | rakati/ppci-mirror | 8f5b0282fd1122d7c389b39c86fcf5d9352b7bb2 | [
"BSD-2-Clause"
] | 19 | 2020-05-27T19:22:11.000Z | 2022-02-17T18:53:52.000Z |
section reset
; Reset vector:
; 0x0 = reset
bri _start
; 0x08 - break
; 0x10 - IRQ
; 0x18 - IRQ
; 0x20 - HW exceptions
_start:
; Setup stack
addik r1, r0, __data_start
; mts rslr, r1
; addik r1, r0, _sdata + 0x8000
; mts rshr, r1
;; Output 'A':
;imm 0x8400
;addik r6, r0, 4
;addik r5, r0, 0x41
;sw r5, r6, r0
;; Output 'E':
;addik r5, r0, 0x45
;brlid r15, bsp_putc
;or r0,r0,r0 ; fill delay slot
;; Output 'Z':
;brlid r15, emitZ
;or r0,r0,r0 ; fill delay slot
; Copy .data from ROM to RAM:
global __data_load_start
global __data_start
global __data_end
addik r5, r0, __data_start
addik r6, r0, __data_load_start
addik r7, r0, __data_end
global bsp_memcpy
brlid r15, bsp_memcpy
rsub r7, r5, r7 ; Note that this instruction is in the delay slot, so it is actually executed before the memcpy branch
;; call main:
global main_main
brlid r15, main_main
or r0,r0,r0 ; fill delay slot
; Call bsp exit:
global bsp_exit
brlid r15, bsp_exit
or r0,r0,r0 ; fill delay slot
;; Output 'B':
;imm 0x8400
;addik r6, r0, 4
;addik r5, r0, 0x42
;sw r5, r6, r0
end_label:
bri end_label ; Endless loop!
emitZ:
;; Output 'Z':
; prologue:
addik r1, r1, -4
swi r15, r1, 0
imm 0x8400
addik r6, r0, 4
addik r5, r0, 0x5a
sw r5, r6, r0
; epiloque:
lwi r15, r1, 0
addik r1, r1, 4
rtsd r15, 8
or r0,r0,r0
| 15.746988 | 119 | 0.683244 |