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
040738e93ea1e8e47107974c80f4933e0c5646ee
648
js
JavaScript
src/api/components/customer/customer.js
imReCoder/Housy-internship-task
bc6329c5846adbef7c7c48884c1eec878db764ad
[ "MIT" ]
null
null
null
src/api/components/customer/customer.js
imReCoder/Housy-internship-task
bc6329c5846adbef7c7c48884c1eec878db764ad
[ "MIT" ]
null
null
null
src/api/components/customer/customer.js
imReCoder/Housy-internship-task
bc6329c5846adbef7c7c48884c1eec878db764ad
[ "MIT" ]
null
null
null
import { Router } from 'express'; import { validateAddCustomer, validateSendNotification } from '../../validators/customer.validator.js'; import { addCustomer, deleteCustomer, getAllCustomers, getCustomer, sendNotification, updateCustomer } from './customer.model.js'; const router = Router(); router.post('/add', validateAddCustomer, addCustomer); router.post('/:customerId/update', updateCustomer); router.delete('/:customerId/delete', deleteCustomer); router.post('/send-notification',validateSendNotification,sendNotification); router.get('/:customerId/fetch', getCustomer); router.get('/fetchAll', getAllCustomers); export default router
38.117647
130
0.779321
9a43838cf58299feb60d32af6a7ff74bf7e35d67
1,451
css
CSS
src/components/PersonCard/styles.css
chasepoirier/design
b85ba8acd3ce776c127d20cd081274dd7c3d9a4b
[ "Unlicense" ]
2
2017-07-30T19:06:54.000Z
2017-08-11T15:34:11.000Z
src/components/PersonCard/styles.css
chasepoirier/design
b85ba8acd3ce776c127d20cd081274dd7c3d9a4b
[ "Unlicense" ]
28
2017-08-09T02:18:30.000Z
2018-07-18T03:01:05.000Z
src/components/PersonCard/styles.css
chasepoirier/design
b85ba8acd3ce776c127d20cd081274dd7c3d9a4b
[ "Unlicense" ]
5
2017-08-04T13:36:49.000Z
2018-07-16T16:51:57.000Z
/** * PersonCard Styles */ @import '../../shared/styles/variables.css'; .person-card { flex-shrink: 0; position: relative; width: $person-card-width; height: $person-card-height; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04); border-radius: 2px; margin: 1px; background-color: white; overflow: hidden; text-decoration: none; transition: box-shadow 0.3s; animation: person-card 0.3s; &::before { z-index: 2; content: ''; position: absolute; left: 0; top: 0; width: $person-card-width; height: $person-card-width; background-image: linear-gradient(132deg, #4cfde9 -20%, rgba(251, 201, 84, 0.1) 30%, rgba(251, 201, 84, 0.1) 60%, #4435f7 120%); opacity: 0; transition: opacity 0.15s; } &:hover, &:active { z-index: 10; box-shadow: 0 10px 40px -5px rgba(0, 0, 0, 0.3); &::before { opacity: 1; } } &-avatar { z-index: 1; position: relative; width: $person-card-width; height: $person-card-width; overflow: hidden; background-size: cover; background-repeat: no-repeat; background-position: 50% 50%; } &-name { z-index: 2; position: relative; font-size: 13px; font-weight: bold; color: $color-text-default; text-align: center; text-decoration: none; margin: 10px 0; padding: 0 10px; overflow: hidden; } } @keyframes person-card { 0% { opacity: 0; } 100% { opacity: 1; } }
19.608108
132
0.596141
63e8bdcac948f522fc1028055fa852ac3e5d007d
351
asm
Assembly
programs/oeis/102/A102303.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/102/A102303.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/102/A102303.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A102303: a(n) = (1/6) * (7^(n+1) - 3*(-1)^n + 2). ; 1,9,57,401,2801,19609,137257,960801,6725601,47079209,329554457,2306881201,16148168401,113037178809,791260251657,5538821761601,38771752331201,271402266318409,1899815864228857,13298711049602001,93090977347214001,651636841430498009 add $0,2 mov $1,7 pow $1,$0 div $1,336 mul $1,8 add $1,1 mov $0,$1
31.909091
230
0.746439
b0c42d5b6a4081683402782a0890d8cf955a1553
8,322
sql
SQL
ufsi (4).sql
ssabit/uiufsi
b0615798b5eb48dc300e87782248374c045def09
[ "MIT" ]
null
null
null
ufsi (4).sql
ssabit/uiufsi
b0615798b5eb48dc300e87782248374c045def09
[ "MIT" ]
null
null
null
ufsi (4).sql
ssabit/uiufsi
b0615798b5eb48dc300e87782248374c045def09
[ "MIT" ]
null
null
null
-- phpMyAdmin SQL Dump -- version 4.5.1 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Dec 27, 2017 at 09:30 PM -- Server version: 10.1.13-MariaDB -- PHP Version: 5.6.20 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!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 utf8mb4 */; -- -- Database: `ufsi` -- -- -------------------------------------------------------- -- -- Table structure for table `counseling` -- CREATE TABLE `counseling` ( `faculty_id` varchar(255) NOT NULL, `time_slot` varchar(40) NOT NULL, `day` varchar(3) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `counseling` -- INSERT INTO `counseling` (`faculty_id`, `time_slot`, `day`) VALUES ('admin', '2:20min - 4:30min', 'Tue'), ('admin', '1:0min - 3:35min', 'Mon'), ('admin', '9:20min - 4:45min', 'Wed'); -- -------------------------------------------------------- -- -- Table structure for table `courses` -- CREATE TABLE `courses` ( `course_id` varchar(10) NOT NULL, `course_name` varchar(30) DEFAULT NULL, `department_name` varchar(30) DEFAULT NULL, `credits` decimal(1,0) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `courses` -- INSERT INTO `courses` (`course_id`, `course_name`, `department_name`, `credits`) VALUES ('cse011', 'DLD', 'CSE', '3'), ('cse012', 'DLD LAB', 'CSE', '3'), ('cse013', 'DBMS', 'CSE', '3'), ('cse014', 'DBMS LAB', 'CSE', '3'), ('cse015', 'OS', 'CSE', '3'); -- -------------------------------------------------------- -- -- Table structure for table `faculties` -- CREATE TABLE `faculties` ( `faculty_id` varchar(6) NOT NULL, `user_first` varchar(256) NOT NULL, `user_last` varchar(256) NOT NULL, `user_email` varchar(256) NOT NULL, `user_uid` varchar(256) NOT NULL, `user_pwd` varchar(256) NOT NULL, `gender` varchar(6) NOT NULL, `department_name` varchar(20) NOT NULL, `room_number` varchar(30) NOT NULL, `phone` varchar(14) NOT NULL, `about` varchar(1000) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `faculties` -- INSERT INTO `faculties` (`faculty_id`, `user_first`, `user_last`, `user_email`, `user_uid`, `user_pwd`, `gender`, `department_name`, `room_number`, `phone`, `about`) VALUES ('admin', 'admin', 'admin', 'admin@gmail.com', 'admin', '$2y$10$zaz3t7qIMDjNC/lQehchYO/QzJAqosTFRYjHd6w/0.fifDy8Tv5AO', 'Male', 'CSE', 'PCR41', '1671764444', 'i am admin'), ('haider', 'haider', 'ali', 'haider@gmail.com', 'haider', '$2y$10$msnRtYP5StSopA74kXL8lOHyBbBo.x85mWUn.jcAWABfyYMsPS7vy', 'Female', 'CSE', 'PCR05', '987654', 'dsfafgg'), ('mahmud', 'Mahmudur', 'Rahman', 'mahmudur@cse.uiu.ac.bd', 'mahmudur', '$2y$10$uceJosvxGASGAQbrzVblpez3/BnIWxWhUrFWyRCHl8l2/B7pMJYv2', 'Male', 'CSE', 'Select Room', '01714386942', 'i am Md.Mahmudur Rahman'), ('saadsa', 'saad', 'sabit', 'sabit.cseuiu@gmail.com', 'sabit', '$2y$10$EMjFx799AIKDHR7xQfViRuJwx75kB/DE5vpfBgtwgdA5y4X3c57qm', 'Male', 'CSE', 'PCR54', '123456789', ''), ('skba', 'skba', 'arnob', 'skba@gmail.com', 'skba', '$2y$10$Y5CzASUrXuF4D1pqq3/3Gu4UmhrvO8fL1hjAscO026YwB5YsZRNgW', 'Male', 'CSE', 'PCR09', '123456798', 'lkjsfj '); -- -------------------------------------------------------- -- -- Table structure for table `facultycoursebridge` -- CREATE TABLE `facultycoursebridge` ( `faculty_id` varchar(255) DEFAULT NULL, `course_name` varchar(30) DEFAULT NULL, `day` varchar(3) NOT NULL, `section` varchar(1) NOT NULL, `slot_id` varchar(2) NOT NULL, `room_number` varchar(30) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `facultycoursebridge` -- INSERT INTO `facultycoursebridge` (`faculty_id`, `course_name`, `day`, `section`, `slot_id`, `room_number`) VALUES ('admin', 'OS', 'Wed', 'B', '05', 'PC Phy/Chem Lab1'), ('admin', 'DBMS', 'Sun', 'B', '02', 'PC Phy/Chem Lab4'); -- -------------------------------------------------------- -- -- Table structure for table `questions` -- CREATE TABLE `questions` ( `id` int(3) NOT NULL, `course_name` varchar(40) NOT NULL, `section` varchar(1) NOT NULL, `trimester` varchar(20) NOT NULL, `path` varchar(400) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `questions` -- INSERT INTO `questions` (`id`, `course_name`, `section`, `trimester`, `path`) VALUES (5, 'DLD', 'B', 'Fall-17', 'documents/Linux Shell Scripts.pdf'), (6, 'DLD', 'C', 'Fall-14', 'documents/Course-offerings_Spring-2018-CSE-1.xlsx'), (7, 'DLD', 'F', 'Spring-18', 'documents/kjhk.txt'), (8, 'OOP', 'A', 'Summer-18', 'documents/Screenshot from 2017-10-24 00-30-46.png'), (9, 'OOP', 'B', 'Spring-15', 'documents/New-Microsoft-Word-Document.docx'), (13, 'OOP', 'H', 'Spring-17', 'documents/Linux Shell Scripts (1).pdf'), (14, 'DBMS', 'A', 'Summer-18', 'documents/Screenshot from 2017-10-24 00-30-46 (1).png'), (15, 'DBMS Lab', 'C', 'Fall-19', 'documents/kjhk.txt'), (16, 'DLD LAB', 'B', 'Fall-17 ', 'documents/main.PNG'); -- -------------------------------------------------------- -- -- Table structure for table `studentcoursebridge` -- CREATE TABLE `studentcoursebridge` ( `student_id` varchar(9) DEFAULT NULL, `course_name` varchar(40) DEFAULT NULL, `section` varchar(1) NOT NULL, `day` varchar(3) NOT NULL, `slot_id` varchar(2) NOT NULL, `room_number` varchar(30) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `studentcoursebridge` -- INSERT INTO `studentcoursebridge` (`student_id`, `course_name`, `section`, `day`, `slot_id`, `room_number`) VALUES ('011133056', 'DLD LAB', 'C', 'Sun', '05', 'PC Phy/Chem Lab2'); -- -------------------------------------------------------- -- -- Table structure for table `students` -- CREATE TABLE `students` ( `student_first` varchar(256) NOT NULL, `student_last` varchar(255) NOT NULL, `student_uid` varchar(9) NOT NULL, `gender` varchar(6) NOT NULL, `department_name` varchar(20) NOT NULL, `password` varchar(256) NOT NULL, `email` varchar(100) NOT NULL, `phone` int(12) NOT NULL, `address` varchar(256) NOT NULL, `credit` int(3) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `students` -- INSERT INTO `students` (`student_first`, `student_last`, `student_uid`, `gender`, `department_name`, `password`, `email`, `phone`, `address`, `credit`) VALUES ('saad', 'sabit', '011133056', 'Male', 'CSE', '$2y$10$VH10f81sWuGS4u7FQrfpH.PCzA.BTEMDHb7QzEiH8TxINhUGJHwNK', 'sabit.cseuiu@gmail.com', 123456, 'mirpur 12', 123); -- -------------------------------------------------------- -- -- Table structure for table `time_slot` -- CREATE TABLE `time_slot` ( `slot_id` varchar(2) NOT NULL, `start_hour` decimal(2,0) DEFAULT NULL, `start_minute` decimal(2,0) DEFAULT NULL, `end_hour` decimal(2,0) DEFAULT NULL, `end_minute` decimal(2,0) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `time_slot` -- INSERT INTO `time_slot` (`slot_id`, `start_hour`, `start_minute`, `end_hour`, `end_minute`) VALUES ('01', '9', '0', '10', '20'), ('02', '10', '25', '11', '45'), ('03', '11', '50', '1', '10'), ('04', '1', '15', '2', '35'), ('05', '2', '40', '4', '0'), ('06', '9', '0', '11', '10'), ('07', '11', '20', '1', '30'), ('08', '1', '40', '3', '50'); -- -- Indexes for dumped tables -- -- -- Indexes for table `courses` -- ALTER TABLE `courses` ADD PRIMARY KEY (`course_id`); -- -- Indexes for table `faculties` -- ALTER TABLE `faculties` ADD PRIMARY KEY (`user_uid`); -- -- Indexes for table `questions` -- ALTER TABLE `questions` ADD PRIMARY KEY (`id`); -- -- Indexes for table `students` -- ALTER TABLE `students` ADD PRIMARY KEY (`student_uid`); -- -- Indexes for table `time_slot` -- ALTER TABLE `time_slot` ADD PRIMARY KEY (`slot_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `questions` -- ALTER TABLE `questions` MODIFY `id` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17; /*!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 */;
30.483516
207
0.628335
6a4e21c6da455c3f6f458873846bdc97ae618881
903
swift
Swift
Core/Models-Components/ModelComponent.swift
dlpigpen/SwiftyJSONAccelerator
6491d56e5b5bdd31227cfe401bfc9c63b6a1db9a
[ "MIT" ]
1
2019-03-27T06:24:55.000Z
2019-03-27T06:24:55.000Z
Core/Models-Components/ModelComponent.swift
dlpigpen/SwiftyJSONAccelerator
6491d56e5b5bdd31227cfe401bfc9c63b6a1db9a
[ "MIT" ]
null
null
null
Core/Models-Components/ModelComponent.swift
dlpigpen/SwiftyJSONAccelerator
6491d56e5b5bdd31227cfe401bfc9c63b6a1db9a
[ "MIT" ]
null
null
null
// // ModelComponent.swift // SwiftyJSONAccelerator // // Created by Karthik on 09/07/2016. // Copyright © 2016 Karthikeya Udupa K M. All rights reserved. // import Foundation /** * A strcture to store the various components of a model file. */ internal struct ModelComponent { /// Declaration of properties. var declarations: [String] /// String constants to store the keys. var stringConstants: [String] /// Initialisers for the properties. var initialisers: [String] /// Encoders for NSCoding support. var encoders: [String] /// Decoders for NSCoding support. var decoders: [String] /// Description printer for each of the properties. var description: [String] /** Initialise a blank model component structure. */ init() { declarations = [] stringConstants = [] initialisers = [] encoders = [] decoders = [] description = [] } }
22.02439
63
0.671096
e7e1bb740dbdc4fa4590ec9965b89e5acbe1474f
2,593
kt
Kotlin
libraries/physics/src/geometry/decompose/DoubleEdgeListFace.kt
FeatureaEngine/featurea
1cbb242255a0f52dc6f44ef7b83bdf444509f110
[ "MIT" ]
23
2021-07-24T14:03:41.000Z
2022-02-12T20:42:46.000Z
libraries/physics/src/geometry/decompose/DoubleEdgeListFace.kt
FeatureaEngine/featurea
1cbb242255a0f52dc6f44ef7b83bdf444509f110
[ "MIT" ]
31
2021-11-23T13:06:13.000Z
2022-01-14T18:04:36.000Z
libraries/physics/src/geometry/decompose/DoubleEdgeListFace.kt
FeatureaEngine/featurea
1cbb242255a0f52dc6f44ef7b83bdf444509f110
[ "MIT" ]
3
2021-11-18T12:22:14.000Z
2021-12-01T20:52:28.000Z
/* * Copyright (c) 2010-2016 William Bittle http://www.dyn4j.org/ * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted * provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this list of conditions * and the following disclaimer. * * 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. * * Neither the name of dyn4j 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 COPYRIGHT OWNER OR * CONTRIBUTORS 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. */ package org.dyn4j.geometry.decompose /** * Represents a face in the [DoubleEdgeList]. * @author William Bittle * @version 3.2.0 * @since 2.2.0 */ class DoubleEdgeListFace { /** An edge of the edge list enclosing this face */ var edge: DoubleEdgeListHalfEdge? = null /* (non-Javadoc) * @see java.lang.Object#toString() */ override fun toString(): String { val sb: StringBuilder = StringBuilder() sb.append("Face[Edge=") .append(edge) .append("]") return sb.toString() } /** * Returns the number of edges on this face. * @return int */ val edgeCount: Int get() { var edge: DoubleEdgeListHalfEdge? = edge var count = 0 if (edge != null) { count++ while (edge!!.next !== this.edge) { count++ edge = edge!!.next } } return count } }
39.892308
105
0.661782
74299bc9da9e5b475bdfb9e59a5842e8781c3e86
843
dart
Dart
test/model_test/character_model_test.dart
tsonnen/InitiativeTracker
f28b1fc87298d56c170a05ac1117a8c2191f736e
[ "MIT" ]
null
null
null
test/model_test/character_model_test.dart
tsonnen/InitiativeTracker
f28b1fc87298d56c170a05ac1117a8c2191f736e
[ "MIT" ]
17
2019-06-15T19:19:32.000Z
2021-04-18T04:21:44.000Z
test/model_test/character_model_test.dart
tsonnen/InitiativeTracker
f28b1fc87298d56c170a05ac1117a8c2191f736e
[ "MIT" ]
1
2021-02-16T08:50:22.000Z
2021-02-16T08:50:22.000Z
import 'package:flutter/material.dart'; import 'package:initiative_tracker/models/character_model.dart'; import 'package:test/test.dart'; void main() { group('Character Model Test', () { late CharacterModel character; const charName = 'TEST'; setUp(() { character = CharacterModel(characterName: charName, color: Colors.blue); }); test('Test Copy With CharcterModel - NOTHING', () { expect(character.copyWith(), character); }); test('Test Copy With Character - Changing Variable', () { var copied = character.copyWith(characterName: 'Copy'); expect('Copy', copied.characterName); expect(charName, character.characterName); }); test('Test JSON IO', () { var jsonCopy = CharacterModel.fromJson(character.toJson()); expect(jsonCopy, character); }); }); }
28.1
78
0.657177
99a343e18df7c5d2ca62674b4ec8745f81f0d591
1,141
asm
Assembly
week_7/dataset/Assembly/056576.asm
Dumebi35/DumebiCSC102
56985f4852bc01c94dce2ee368c9612ad368f619
[ "MIT" ]
null
null
null
week_7/dataset/Assembly/056576.asm
Dumebi35/DumebiCSC102
56985f4852bc01c94dce2ee368c9612ad368f619
[ "MIT" ]
null
null
null
week_7/dataset/Assembly/056576.asm
Dumebi35/DumebiCSC102
56985f4852bc01c94dce2ee368c9612ad368f619
[ "MIT" ]
null
null
null
;smallest of three numbers .model small .stack 100h .data msg1 db "Enter 1st number: ","$" msg2 db "Enter 2nd number: ","$" msg3 db "Enter 3rd number: ","$" msg4 db "The smallest number is: $" small db ? .code extrn readint:proc, writeint:proc, crlf:proc main proc mov ax,@data mov ds,ax ; mov al,10 mov ah,9 mov dx,offset msg1 int 21h call readint call crlf mov bl,al mov ah,9 mov dx,offset msg2 int 21h call readint call crlf mov cl,al mov ah,9 mov dx,offset msg3 int 21h call readint call crlf mov dl,al ; mov bl,4 ; mov cl,6 mov small,bl ;assume bl is smallest cmp small,cl ;if small <= cl then jbe L1 ;jump to L1 (jmp if op1<=op2) mov small,cl ;else move cl to small L1: cmp small,dl ;if small <= dl then jbe L2 ;jump to L2 (jmp if op1<=op2) mov small,dl ;else move dl to small L2: mov ah,9 mov dx,offset msg4 int 21h mov ax,0 mov al,small mov bx,10 call writeint mov ax,4c00h int 21h main endp end main
19.016667
44
0.571429
2031dbac5904f96e0f0fe0338b3acfdef51b0cb9
3,547
dart
Dart
lib/src/resolver/iterable_resolver.dart
youngchan1988/dartfx
01c313fe12965ca5f4e5b05496d8eaefc8165880
[ "BSD-3-Clause" ]
2
2022-02-21T09:42:43.000Z
2022-02-22T09:17:45.000Z
lib/src/resolver/iterable_resolver.dart
youngchan1988/dartfx
01c313fe12965ca5f4e5b05496d8eaefc8165880
[ "BSD-3-Clause" ]
null
null
null
lib/src/resolver/iterable_resolver.dart
youngchan1988/dartfx
01c313fe12965ca5f4e5b05496d8eaefc8165880
[ "BSD-3-Clause" ]
1
2022-03-25T03:49:59.000Z
2022-03-25T03:49:59.000Z
// Copyright (c) 2022, the dartfx project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. import 'package:dartfx/src/runtime/ast_context.dart'; import 'package:dartfx/src/runtime/ast_runtime_node.dart'; import 'package:dartfx/src/runtime/ast_resolver.dart'; import 'package:dartfx/src/runtime/ast_runtime.dart'; import 'package:dartfx/src/runtime/ast_runtime_executor.dart'; import 'package:dartfx/src/util/logger.dart'; class IterableResolver extends AstResolver { static const _tag = "IterableParser"; @override dynamic resolve(AstContext astContext, AstRuntimeExecutor executor, target, {String? property, List<AstRuntimeNode?>? arguments}) { if (target == null) { return null; } var realTarget = target as Iterable; switch (property) { case "toList": return realTarget.toList(); case "reduce": var arg = arguments![0]; if (arg is FunctionExpression) { var func = AstFunction.fromAstNode(astContext, executor, arg); realTarget = realTarget.cast<dynamic>(); return realTarget .reduce((value, element) => func?.call(params: [value, element])); } else { var func = executor.execute(astContext, arg); return realTarget.reduce(func); } case "map": var arg = arguments![0]; if (arg is FunctionExpression) { var func = AstFunction.fromAstNode(astContext, executor, arg); return realTarget.map((element) => func?.call(params: [element])); } else { var func = executor.execute(astContext, arg); return realTarget.map(func); } case "where": var arg = arguments![0]; if (arg is FunctionExpression) { var func = AstFunction.fromAstNode(astContext, executor, arg); return realTarget.where((element) => func?.call(params: [element])); } else { var func = executor.execute(astContext, arg); return realTarget.where(func); } case 'first': return realTarget.first; case 'last': return realTarget.last; case 'single': return realTarget.single; case 'isNotEmpty': return realTarget.isNotEmpty; case 'isEmpty': return realTarget.isEmpty; case 'length': return realTarget.length; case 'elementAt': return realTarget .elementAt(executor.execute(astContext, arguments!.first)); case 'contains': return realTarget .contains(executor.execute(astContext, arguments!.first)); case 'forEach': var arg = arguments![0]; if (arg is FunctionExpression) { var func = AstFunction.fromAstNode(astContext, executor, arg); return realTarget.forEach((element) => func?.call(params: [element])); } else { var func = executor.execute(astContext, arg); return realTarget.forEach(func); } case 'join': if (arguments?.isNotEmpty == true) { var joinStr = executor.execute(astContext, arguments![0]); return target.join(joinStr); } logError(_tag, "list join方法参数不为空"); break; default: logError(_tag, "undefine method $property for $target"); } return null; } @override bool canResolve(target, {String? property}) { return target is Iterable; } }
35.47
80
0.624753
e9d3f5d930c6e8fbe2a712fc75ee8e623c9b3dcb
816
go
Go
go_gin/main.go
BENMFeng/go_learning
da81562346e6998630e03ae6e180d79a3c954715
[ "MIT" ]
null
null
null
go_gin/main.go
BENMFeng/go_learning
da81562346e6998630e03ae6e180d79a3c954715
[ "MIT" ]
null
null
null
go_gin/main.go
BENMFeng/go_learning
da81562346e6998630e03ae6e180d79a3c954715
[ "MIT" ]
null
null
null
package main import ( "log" "net/http" "github.com/gin-gonic/gin" ) func MiddlewareA() gin.HandlerFunc { return func(c *gin.Context) { log.Println("MiddlewareA before request") // before request c.Next() // after request log.Println("MiddlewareA after request") } } func MiddlewareB() gin.HandlerFunc { return func(c *gin.Context) { log.Println("MiddlewareB before request") // before request c.Next() // after request log.Println("MiddlewareB after request") } } // This function's name is a must. App Engine uses it to drive the requests properly. func main() { // Starts a new Gin instance with no middle-ware r := gin.New() r.Use(MiddlewareA(), MiddlewareB()) r.GET("/ping", func(c *gin.Context) { c.String(http.StatusOK, "pong") log.Println("pong") }) r.Run(":8080") }
19.902439
85
0.676471
3846d5af99fc987012341b58c7528ca5065dd6b9
5,537
dart
Dart
lib/blocs/template/template_bloc.dart
Foodload/foodload_flutter
1519ecf3e1ebf8535556d01d41a34bf7cfd6c3db
[ "Apache-2.0" ]
null
null
null
lib/blocs/template/template_bloc.dart
Foodload/foodload_flutter
1519ecf3e1ebf8535556d01d41a34bf7cfd6c3db
[ "Apache-2.0" ]
null
null
null
lib/blocs/template/template_bloc.dart
Foodload/foodload_flutter
1519ecf3e1ebf8535556d01d41a34bf7cfd6c3db
[ "Apache-2.0" ]
null
null
null
import 'dart:async'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:foodload_flutter/blocs/template/template_event.dart'; import 'package:foodload_flutter/blocs/template/template_state.dart'; import 'package:foodload_flutter/data/repositories/template_repository.dart'; import 'package:foodload_flutter/data/repositories/user_repository.dart'; import 'package:foodload_flutter/helpers/error_handler/core/error_handler.dart'; import 'package:foodload_flutter/helpers/error_handler/model/exceptions.dart'; import 'package:foodload_flutter/models/enums/status.dart'; import 'package:foodload_flutter/models/exceptions/api_exception.dart'; import 'package:foodload_flutter/models/template.dart'; import 'package:foodload_flutter/models/template_item.dart'; import 'package:meta/meta.dart'; class TemplateBloc extends Bloc<TemplateEvent, TemplateState> { final UserRepository _userRepository; final TemplateRepository _templateRepository; TemplateBloc({ @required templateId, @required templateRepository, @required userRepository, }) : assert(templateId != null && templateRepository != null && userRepository != null), _userRepository = userRepository, _templateRepository = templateRepository, super(TemplateStateLoading()) { add(FetchTemplate(templateId)); } @override Stream<TemplateState> mapEventToState(TemplateEvent event) async* { if (event is FetchTemplate) { yield* _mapFetchTemplateToState(event); } else if (event is TemplateItemAdded) { yield* _mapTemplateItemAddedToState(event); } else if (event is DeleteTemplateItemFromState) { yield* _mapDeleteTemplateItemFromStateToState(event); } else if (event is DeleteTemplateItem) { yield* _mapDeleteTemplateItemToState(event); } else if (event is UndoDeleteTemplateItem) { yield* _mapUndoDeleteTemplateItemToState(event); } else if (event is UpdateTemplateItem) { yield* _mapUpdateTemplateItemToState(event); } } Stream<TemplateState> _mapFetchTemplateToState(FetchTemplate event) async* { try { final template = await _templateRepository.getTemplate(event.templateId); yield TemplateState(template: template); } on ApiException catch (apiException) { yield* _handleApiException(apiException); } catch (error, stackTrace) { yield* _handleError(error, stackTrace); } } Stream<TemplateState> _mapTemplateItemAddedToState( TemplateItemAdded event) async* { try { final updatedTemplate = await _templateRepository.getTemplate(state.template.id); yield TemplateState(template: updatedTemplate); } on ApiException catch (apiException) { yield* _handleApiException(apiException); } catch (error, stackTrace) { yield* _handleError(error, stackTrace); } } Stream<TemplateState> _mapDeleteTemplateItemFromStateToState( DeleteTemplateItemFromState event) async* { try { final List<TemplateItem> updatedTemplateItems = state .template.templateItems .where((templateItem) => templateItem.id != event.templateItemId) .toList(); final Template updatedTemplate = state.template.copyWith(templateItems: updatedTemplateItems); yield state.copyWith(template: updatedTemplate); } catch (error, stackTrace) { yield* _handleError(error, stackTrace); } } Stream<TemplateState> _mapDeleteTemplateItemToState( DeleteTemplateItem event) async* { try { await _templateRepository.deleteTemplateItem( await _userRepository.getToken(), state.template.id, event.templateItemId); } on ApiException catch (apiException) { yield* _handleApiException(apiException); } catch (error, stackTrace) { yield* _handleError(error, stackTrace); } } Stream<TemplateState> _mapUndoDeleteTemplateItemToState( UndoDeleteTemplateItem event) async* { try { final Template prevTemplate = await _templateRepository.getTemplate(state.template.id); yield state.copyWith(template: prevTemplate); } on ApiException catch (apiException) { yield* _handleApiException(apiException); } catch (error, stackTrace) { yield* _handleError(error, stackTrace); } } Stream<TemplateState> _mapUpdateTemplateItemToState( UpdateTemplateItem event) async* { try { await _templateRepository.updateTemplateItem( token: await _userRepository.getToken(), templateId: state.template.id, templateItemId: event.templateItemId, newAmount: event.newAmount); final updatedTemplate = await _templateRepository.getTemplate(state.template.id); yield state.copyWith(template: updatedTemplate); } on ApiException catch (apiException) { yield* _handleApiException(apiException); } catch (error, stackTrace) { yield* _handleError(error, stackTrace); } } Stream<TemplateState> _handleApiException(ApiException apiException) async* { yield state.copyWith( status: Status.ERROR, errorMessage: apiException.getMessage() ?? apiException.getPrefix(), ); } Stream<TemplateState> _handleError(error, stackTrace) async* { ErrorHandler.reportCheckedError( SilentLogException(error.message), stackTrace); yield state.copyWith( status: Status.ERROR, errorMessage: 'Something went wrong. Please try again later.'); } }
37.412162
80
0.721871
a9beeb6a83ff31c782e27b3b1ae9253aa754d824
917
kt
Kotlin
src/test/kotlin/com/github/dreamylost/TestUtils.kt
jxnu-liguobin/leetcode-helper
19e47a96ca3c98eccdd7b3f245a465ce845b23d8
[ "Apache-2.0" ]
null
null
null
src/test/kotlin/com/github/dreamylost/TestUtils.kt
jxnu-liguobin/leetcode-helper
19e47a96ca3c98eccdd7b3f245a465ce845b23d8
[ "Apache-2.0" ]
null
null
null
src/test/kotlin/com/github/dreamylost/TestUtils.kt
jxnu-liguobin/leetcode-helper
19e47a96ca3c98eccdd7b3f245a465ce845b23d8
[ "Apache-2.0" ]
null
null
null
/* Licensed under Apache-2.0 @梦境迷离 */ package com.github.dreamylost import com.kobylynskyi.graphql.codegen.utils.Utils import java.io.File import java.io.FileNotFoundException import java.io.IOException import java.util.* import kotlin.test.assertEquals object TestUtils { @kotlin.jvm.Throws(FileNotFoundException::class) fun getFileByName(files: Array<File>?, fileName: String): File { return Arrays.stream(files) .filter { f: File -> f.name.equals(fileName, ignoreCase = true) } .findFirst() .orElseThrow { FileNotFoundException() } } @Throws(IOException::class) fun assertSameTrimmedContent(expected: File, file: File) { val expectedContent = Utils.getFileContent(expected.path).trim { it <= ' ' } val actualContent = Utils.getFileContent(file.path).trim { it <= ' ' } assertEquals(expectedContent, actualContent) } }
32.75
84
0.691385
77c9bbe49de720502fc84c62bba85f1c6e25bf1e
1,251
kt
Kotlin
data/src/main/java/namnh/clean/data/executor/JobExecutor.kt
namnh-0652/CleanAndroid
d69bdc56e0e032dcb242a1f92e85a1c513ccf799
[ "Apache-2.0" ]
null
null
null
data/src/main/java/namnh/clean/data/executor/JobExecutor.kt
namnh-0652/CleanAndroid
d69bdc56e0e032dcb242a1f92e85a1c513ccf799
[ "Apache-2.0" ]
null
null
null
data/src/main/java/namnh/clean/data/executor/JobExecutor.kt
namnh-0652/CleanAndroid
d69bdc56e0e032dcb242a1f92e85a1c513ccf799
[ "Apache-2.0" ]
null
null
null
package namnh.clean.data.executor import namnh.clean.domain.executor.ThreadExecutor import java.util.concurrent.LinkedBlockingQueue import java.util.concurrent.ThreadFactory import java.util.concurrent.ThreadPoolExecutor import java.util.concurrent.TimeUnit import javax.inject.Inject class JobExecutor @Inject constructor() : ThreadExecutor { private val workQueue = LinkedBlockingQueue<Runnable>() private val threadFactory = JobThreadFactory() private val threadPoolExecutor = ThreadPoolExecutor( CORE_POOL_SIZE, MAX_POOL_SIZE, KEEP_ALIVE_TIME, TimeUnit.SECONDS, workQueue, threadFactory ) override fun execute(command: Runnable) { threadPoolExecutor.execute(command) } private class JobThreadFactory : ThreadFactory { private var counter = 0 override fun newThread(runnable: Runnable): Thread { return Thread(runnable, "$THREAD_NAME${counter++}") } companion object { private const val THREAD_NAME = "clean_thread_" } } companion object { private const val CORE_POOL_SIZE = 3 private const val MAX_POOL_SIZE = 5 private const val KEEP_ALIVE_TIME = 10L } }
28.431818
63
0.697042
e760e2ae9c32b5c1ffd40490ae0e5b48fb4653e7
736
swift
Swift
Sources/DataReadonly/FunctionsURL/URLCached.swift
ObjectAlchemist/OOFoundation
b4908911ef04becd69e710dd7637b23197fcf534
[ "MIT" ]
null
null
null
Sources/DataReadonly/FunctionsURL/URLCached.swift
ObjectAlchemist/OOFoundation
b4908911ef04becd69e710dd7637b23197fcf534
[ "MIT" ]
null
null
null
Sources/DataReadonly/FunctionsURL/URLCached.swift
ObjectAlchemist/OOFoundation
b4908911ef04becd69e710dd7637b23197fcf534
[ "MIT" ]
null
null
null
// // URLCached.swift // OOSwift // // Created by Karsten Litsche on 01.09.17. // // import Foundation import OOBase public final class URLCached: OOURL { // MARK: - init public init(cache decorated: OOURL, in store: OOWritableURL = WritableURLMemory()) { self.decorated = decorated self.store = store } // MARK: - protocol: OOURL public var value: URL { let result: URL if store.hasValue { result = store.value } else { result = decorated.value store.value = result } return result } // MARK: - private private let decorated: OOURL private let store: OOWritableURL }
18.4
88
0.559783
b8e0ff7f49fc5a57d80ee1311d354340d4239c43
3,066
swift
Swift
Iconizer/Controller/LaunchImageViewController.swift
wallisch/iconizer
f7896698ef9d733a0787df2174ee3bf5f6658229
[ "MIT" ]
null
null
null
Iconizer/Controller/LaunchImageViewController.swift
wallisch/iconizer
f7896698ef9d733a0787df2174ee3bf5f6658229
[ "MIT" ]
null
null
null
Iconizer/Controller/LaunchImageViewController.swift
wallisch/iconizer
f7896698ef9d733a0787df2174ee3bf5f6658229
[ "MIT" ]
null
null
null
// // LaunchImageViewController.swift // Iconizer // https://github.com/raphaelhanneken/iconizer // import Cocoa /// Controller for the LaunchImageView. class LaunchImageViewController: NSViewController, IconizerViewControllerProtocol { /// Holds the image view for the image to generate /// the horizontal Launch Image from. @IBOutlet weak var landscape: NSImageView! /// Holds the image view for the image to generate /// the portrait Launch Image from. @IBOutlet weak var portrait: NSImageView! /// Checkbox to create a Launch Image for iPhone. @IBOutlet weak var iphone: NSButton! /// Checkbox to create a Launch Image for iPad. @IBOutlet weak var ipad: NSButton! /// Select the fill mode for the launch image. @IBOutlet weak var aspectMode: NSPopUpButton! /// Return the platforms selected by the user. var enabledPlatforms: [String] { var tmp: [String] = [] if iphone.state == NSControl.StateValue.on { tmp.append(iPhonePlatformName) } if ipad.state == NSControl.StateValue.on { tmp.append(iPadPlatformName) } return tmp } /// Responsible for creating and saving the asset catalog. let launchImage = LaunchImage() /// Manage the user's preferences. let userPrefs = PreferenceManager() /// The name of the corresponding nib file. override var nibName: NSNib.Name { return NSNib.Name("LaunchImageView") } // MARK: View Controller override func viewDidLoad() { super.viewDidLoad() iphone.state = NSControl.StateValue(rawValue: userPrefs.generateLaunchImageForIPhone) ipad.state = NSControl.StateValue(rawValue: userPrefs.generateLaunchImageForIPad) } override func viewWillDisappear() { userPrefs.generateLaunchImageForIPad = ipad.state.rawValue userPrefs.generateLaunchImageForIPhone = iphone.state.rawValue } // MARK: Iconizer View Controller func generateRequiredImages() throws { guard enabledPlatforms.count > 0 else { throw IconizerViewControllerError.missingPlatform } if let selectedAspectMode = aspectMode.selectedItem?.identifier?.rawValue { try launchImage.generateImagesForPlatforms(enabledPlatforms, fromPortrait: self.portrait.image, andLandscape: self.landscape.image, mode: AspectMode(rawValue: selectedAspectMode)) } } func saveAssetCatalog(named name: String, toURL url: URL) throws { try launchImage.saveAssetCatalogNamed(name, toURL: url) } func openSelectedImage(_ image: NSImage?) throws { guard let img = image else { throw LaunchImageError.selectedImageNotFound } let ratio = img.height / img.width if 1 <= ratio { portrait.image = img } if 1 >= ratio { landscape.image = img } } }
32.967742
102
0.643836
b188a12e0c8446c744ed1c4a28566fb8fc80bea6
2,771
h
C
AlgAE361/hashprobe/src/main/data/hashset.h
sjzeil/AlgAE---data-structures---Weiss
92643559e38f022e7566b124800f3d25b5b05165
[ "ECL-1.0" ]
1
2020-07-16T18:07:39.000Z
2020-07-16T18:07:39.000Z
AlgAE361/hashprobe/src/main/data/hashset.h
sjzeil/AlgAE---data-structures---Weiss
92643559e38f022e7566b124800f3d25b5b05165
[ "ECL-1.0" ]
null
null
null
AlgAE361/hashprobe/src/main/data/hashset.h
sjzeil/AlgAE---data-structures---Weiss
92643559e38f022e7566b124800f3d25b5b05165
[ "ECL-1.0" ]
1
2015-02-18T16:11:59.000Z
2015-02-18T16:11:59.000Z
#ifndef HASHSET_H #define HASHSET_H // // Hash table implementation of set // // Described in Chapter 17 of // Data Structures in C++ using the STL // Published by Addison-Wesley, 1997 // Written by Tim Budd, budd@cs.orst.edu // Oregon State University // // SJZ: Heavily modified, combined two classes, // used list for set container, added erase function, // added comparison template parameter, const's #include <utils/vislist.h> #include <utils/visint.h> #include <utils/visvectr.h> #include <utils/whitebox.h> #include <algorithm> #include <functional> enum HashStatus { Occupied, Empty, Deleted }; template <class T> struct HashEntry { T data; HashStatus info; HashEntry(): info(Empty) {} HashEntry(const T& v, HashStatus status) : data(v), info(status) {} }; template <class T, int hSize, class HashFun, class CompareEQ=std::equal_to<T> > class hash_set { typedef list<T> Container; public: hash_set (): table(hSize), theSize(0) {} bool empty() const {return theSize == 0;} int size() const {return theSize;} bool insert (const T& element) { unsigned h0 = hash(element); unsigned h = find(element, h0); if (h == hSize) { unsigned count = 0; h = h0; while (table[h].info == Occupied && count < hSize) { ++count; h = (h0 + /*f(count)*/ count) % hSize; } if (count >= hSize) return false; // could not add else { table[h].info = Occupied; table[h].data = element; return true; } } else { // replace table[h].data = element; return true; } } int count (const T& element) { unsigned h0 = hash(element); unsigned h = find(element, h0); return (h != hSize) ? 1 : 0; } void erase (const T& element) { unsigned h0 = hash(element); unsigned h = find(element, h0); if (h != hSize) table[h].info = Deleted; } void clear() { table.clear(); table.resize(hSize); } private: int find (const T& element, int h0) const { unsigned h = h0 % hSize; unsigned count = 0; while ((table[h].info == Deleted || (table[h].info == Occupied && (!compare(table[h].data, element)))) && count < hSize) { ++count; h = (h0 + /*f(count)*/ count) % hSize; } if (count >= hSize || table[h].info == Empty) return hSize; else return h; } vector<HashEntry<T> > table; HashFun hash; CompareEQ compare; int theSize; }; #endif
19.652482
79
0.537712
395dc7aa10618164c0397ee1b2abe3f60e2ceca9
698
html
HTML
web_messaging/blueprints/user/templates/index.html
Pierre-Alexandre35/messaging-service-mousset
820b648a705810b6d67b3144c139ee6b0d0b8708
[ "MIT" ]
null
null
null
web_messaging/blueprints/user/templates/index.html
Pierre-Alexandre35/messaging-service-mousset
820b648a705810b6d67b3144c139ee6b0d0b8708
[ "MIT" ]
null
null
null
web_messaging/blueprints/user/templates/index.html
Pierre-Alexandre35/messaging-service-mousset
820b648a705810b6d67b3144c139ee6b0d0b8708
[ "MIT" ]
null
null
null
{% extends 'layouts/base.html' %} {% block body %} <div class="container"> <div class="row"> <div class="col-md-5 mx-md-auto pt-5"> <h1>Vêtements Mousset - Outil Marketing </h1> <div class="my-3"> {% if current_user.is_authenticated %} <p>Vous êtes connecté.</p> <p>Voici votre addresse email: {{current_user.email}}</p> {% else %} <p>Vous n'êtes pas connecté.</p> <a class="btn btn-primary my-3 w-100" href="{{ url_for('user.login') }}">Connection</a> {% endif %} </div> </div> </div> </div> {% endblock %}
31.727273
107
0.468481
46e85115afc4569d18c119276314ef15d20c8618
12,531
html
HTML
docs/org.odftoolkit.odfdom.incubator.doc.text/OdfTextList.java.html
svanteschubert/odfdom-coverage-data
8a032ce894e734226dac1ec7c62192b7fbc07f92
[ "Apache-2.0" ]
null
null
null
docs/org.odftoolkit.odfdom.incubator.doc.text/OdfTextList.java.html
svanteschubert/odfdom-coverage-data
8a032ce894e734226dac1ec7c62192b7fbc07f92
[ "Apache-2.0" ]
null
null
null
docs/org.odftoolkit.odfdom.incubator.doc.text/OdfTextList.java.html
svanteschubert/odfdom-coverage-data
8a032ce894e734226dac1ec7c62192b7fbc07f92
[ "Apache-2.0" ]
null
null
null
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="de"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>OdfTextList.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">ODFDOM</a> &gt; <a href="index.source.html" class="el_package">org.odftoolkit.odfdom.incubator.doc.text</a> &gt; <span class="el_source">OdfTextList.java</span></div><h1>OdfTextList.java</h1><pre class="source lang-java linenums">/** * ********************************************************************** * * &lt;p&gt;DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER * * &lt;p&gt;Copyright 2008, 2010 Oracle and/or its affiliates. All rights reserved. * * &lt;p&gt;Use is subject to license terms. * * &lt;p&gt;Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); 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. You can also obtain a copy of the License at * http://odftoolkit.org/docs/license.txt * * &lt;p&gt;Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. * * &lt;p&gt;See the License for the specific language governing permissions and limitations under the * License. * * &lt;p&gt;********************************************************************** */ package org.odftoolkit.odfdom.incubator.doc.text; import java.util.logging.Logger; import org.odftoolkit.odfdom.dom.OdfContentDom; import org.odftoolkit.odfdom.dom.OdfSchemaDocument; import org.odftoolkit.odfdom.dom.OdfStylesDom; import org.odftoolkit.odfdom.dom.element.text.TextListElement; import org.odftoolkit.odfdom.dom.element.text.TextListItemElement; import org.odftoolkit.odfdom.dom.element.text.TextListLevelStyleElementBase; import org.odftoolkit.odfdom.incubator.doc.office.OdfOfficeAutomaticStyles; import org.odftoolkit.odfdom.incubator.doc.office.OdfOfficeStyles; import org.odftoolkit.odfdom.pkg.OdfFileDom; import org.w3c.dom.Node; /** Convenient functionalty for the parent ODF OpenDocument element */ public class OdfTextList extends TextListElement { /** * Creates a new instance of OdfList. * * @param ownerDoc */ public OdfTextList(OdfFileDom ownerDoc) { <span class="nc" id="L47"> super(ownerDoc);</span> <span class="nc" id="L48"> }</span> /** * Creates a new instance of OdfList. * * @param ownerDoc The document to which the list belongs * @param itemList An array of the list items, each preceded by delimiters that indicate nesting * level. * @param indentDelim The character used as level nesting delimiter. * @param listStyleName Name to be applied to each &lt;code&gt;text:list&lt;/code&gt; element. */ public OdfTextList( OdfFileDom ownerDoc, String[] itemList, char indentDelim, String listStyleName) { <span class="nc" id="L61"> super(ownerDoc);</span> <span class="nc" id="L62"> OdfTextList[] listArray = new OdfTextList[10];</span> TextListItemElement listItem; OdfTextParagraph para; String item; <span class="nc" id="L66"> int level = 0;</span> <span class="nc" id="L67"> int lastLevel = 0;</span> int lev; // loop counter <span class="nc" id="L70"> listArray[0] = this;</span> <span class="nc bnc" id="L71" title="All 2 branches missed."> for (int i = 0; i &lt; itemList.length; i++) {</span> <span class="nc" id="L72"> level = 0;</span> <span class="nc" id="L73"> item = itemList[i];</span> // determine level of indenting by counting delimiters, // then get rid of the delimiters <span class="nc bnc" id="L77" title="All 4 branches missed."> while (level &lt; item.length() &amp;&amp; item.charAt(level) == indentDelim) {</span> <span class="nc" id="L78"> level++;</span> } <span class="nc" id="L80"> item = item.substring(level);</span> <span class="nc bnc" id="L82" title="All 2 branches missed."> if (level &gt; lastLevel) // open the sub-levels</span> { <span class="nc bnc" id="L84" title="All 2 branches missed."> for (lev = lastLevel + 1; lev &lt;= level; lev++) {</span> <span class="nc" id="L85"> listArray[lev] = new OdfTextList(ownerDoc);</span> <span class="nc" id="L86"> listArray[lev].setTextStyleNameAttribute(listStyleName);</span> } <span class="nc bnc" id="L88" title="All 2 branches missed."> } else if (level &lt; lastLevel) // close off the intervening lists</span> { <span class="nc" id="L90"> closeLevels(ownerDoc, listArray, lastLevel, level);</span> } // now that we are at the proper level, add the item. <span class="nc" id="L93"> listArray[level].setTextStyleNameAttribute(listStyleName);</span> <span class="nc" id="L94"> listItem = new TextListItemElement(ownerDoc);</span> <span class="nc" id="L95"> para = new OdfTextParagraph(ownerDoc);</span> <span class="nc" id="L96"> para.setTextContent(item);</span> <span class="nc" id="L97"> listItem.appendChild(para);</span> <span class="nc" id="L98"> listArray[level].appendChild(listItem);</span> <span class="nc" id="L99"> lastLevel = level;</span> } // close off any remaining open lists <span class="nc" id="L103"> closeLevels(ownerDoc, listArray, lastLevel, 0);</span> <span class="nc" id="L104"> }</span> private void closeLevels( OdfFileDom ownerDoc, OdfTextList[] listArray, int fromLevel, int toLevel) { <span class="nc bnc" id="L108" title="All 2 branches missed."> for (int level = fromLevel; level &gt; toLevel; level--) {</span> <span class="nc bnc" id="L109" title="All 2 branches missed."> if (!listArray[level - 1].hasChildNodes()) {</span> /* Force a list item */ <span class="nc" id="L111"> listArray[level - 1].appendChild(new TextListItemElement(ownerDoc));</span> } <span class="nc" id="L113"> listArray[level - 1].getLastChild().appendChild(listArray[level]);</span> } <span class="nc" id="L115"> }</span> /** * Retrieves Odf Text List Style * * @return the &lt;code&gt;OdfTextListStyle&lt;/code&gt; element */ public OdfTextListStyle getListStyle() { <span class="nc" id="L123"> OdfTextListStyle style = null;</span> <span class="nc" id="L125"> String listName = getTextStyleNameAttribute();</span> <span class="nc bnc" id="L126" title="All 4 branches missed."> if (listName != null &amp;&amp; listName.length() &gt; 0) {</span> <span class="nc" id="L127"> OdfFileDom fileDom = (OdfFileDom) this.ownerDocument;</span> <span class="nc" id="L128"> OdfOfficeAutomaticStyles autoStyles = null;</span> <span class="nc bnc" id="L129" title="All 2 branches missed."> if (fileDom instanceof OdfContentDom) {</span> <span class="nc" id="L130"> autoStyles = ((OdfContentDom) fileDom).getAutomaticStyles();</span> <span class="nc bnc" id="L131" title="All 2 branches missed."> } else if (fileDom instanceof OdfStylesDom) {</span> <span class="nc" id="L132"> autoStyles = ((OdfStylesDom) fileDom).getAutomaticStyles();</span> } <span class="nc bnc" id="L134" title="All 2 branches missed."> if (autoStyles != null) {</span> <span class="nc" id="L135"> style = autoStyles.getListStyle(listName);</span> } <span class="nc bnc" id="L137" title="All 2 branches missed."> if (style == null) {</span> <span class="nc" id="L138"> OdfOfficeStyles styles = ((OdfSchemaDocument) fileDom.getDocument()).getDocumentStyles();</span> <span class="nc bnc" id="L139" title="All 2 branches missed."> if (styles != null) {</span> <span class="nc" id="L140"> style = styles.getListStyle(listName);</span> } } <span class="nc" id="L143"> } else {</span> // if no style is specified at this particular list element, we // ask the parent list (if any) <span class="nc" id="L146"> OdfTextList parentList = getParentList();</span> <span class="nc bnc" id="L147" title="All 2 branches missed."> if (parentList != null) {</span> <span class="nc" id="L148"> style = parentList.getListStyle();</span> } } <span class="nc" id="L152"> return style;</span> } /** * Retrieves the list level count * * @return the level count */ public int getListLevel() { <span class="nc" id="L161"> int level = 1;</span> <span class="nc" id="L162"> Node parent = getParentNode();</span> <span class="nc bnc" id="L163" title="All 2 branches missed."> while (parent != null) {</span> <span class="nc bnc" id="L164" title="All 2 branches missed."> if (parent instanceof TextListElement) {</span> <span class="nc" id="L165"> level++;</span> } <span class="nc" id="L167"> parent = parent.getParentNode();</span> } <span class="nc" id="L169"> return level;</span> } /** * Retrieves the List Level Style * * @return the &lt;code&gt;TextListLevelStyleElementBase&lt;/code&gt; */ public TextListLevelStyleElementBase getListLevelStyle() { <span class="nc" id="L178"> TextListLevelStyleElementBase odfListLevelStyle = null;</span> <span class="nc" id="L179"> OdfTextListStyle style = getListStyle();</span> <span class="nc" id="L180"> int level = getListLevel();</span> <span class="nc bnc" id="L181" title="All 2 branches missed."> if (style != null) {</span> <span class="nc" id="L182"> odfListLevelStyle = style.getLevel(level);</span> } else { <span class="nc" id="L184"> Logger.getLogger(OdfTextList.class.getName()).warning(&quot;No ListLevelStyle found!&quot;);</span> } <span class="nc" id="L186"> return odfListLevelStyle;</span> } /** * Retrieves or create local list style * * @return the &lt;code&gt;OdfTextListStyle&lt;/code&gt; element */ public OdfTextListStyle getOrCreateLocalListStyle() { <span class="nc" id="L195"> OdfTextListStyle listStyle = getListStyle();</span> <span class="nc bnc" id="L196" title="All 2 branches missed."> if (listStyle == null) {</span> <span class="nc" id="L197"> OdfOfficeAutomaticStyles autoStyles = null;</span> <span class="nc" id="L198"> OdfFileDom fileDom = ((OdfFileDom) this.ownerDocument);</span> <span class="nc bnc" id="L199" title="All 2 branches missed."> if (fileDom instanceof OdfContentDom) {</span> <span class="nc" id="L200"> autoStyles = ((OdfContentDom) fileDom).getOrCreateAutomaticStyles();</span> <span class="nc bnc" id="L201" title="All 2 branches missed."> } else if (fileDom instanceof OdfStylesDom) {</span> <span class="nc" id="L202"> autoStyles = ((OdfStylesDom) fileDom).getOrCreateAutomaticStyles();</span> } <span class="nc bnc" id="L204" title="All 2 branches missed."> if (autoStyles != null) {</span> <span class="nc" id="L205"> listStyle = autoStyles.newListStyle();</span> } } <span class="nc" id="L208"> return listStyle;</span> } /** * Retrieves the parent list of text list * * @return The &lt;code&gt;OdfTextList&lt;/code&gt; */ public OdfTextList getParentList() { <span class="nc" id="L217"> Node parent = getParentNode();</span> <span class="nc bnc" id="L218" title="All 2 branches missed."> while (parent != null) {</span> <span class="nc bnc" id="L219" title="All 2 branches missed."> if (parent instanceof OdfTextList) {</span> <span class="nc" id="L220"> return (OdfTextList) parent;</span> } <span class="nc" id="L222"> parent = parent.getParentNode();</span> } <span class="nc" id="L224"> return null;</span> } } </pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.7.202105040129</span></div></body></html>
55.202643
1,089
0.659883
bd56dbc87ee2e872fc3496c423df41c610f093b8
283
asm
Assembly
Working Disassembly/Levels/HCZ/Misc Object Data/Map - Water Splash.asm
TeamASM-Blur/Sonic-3-Blue-Balls-Edition
7e8a2c5df02271615ff4cae529521e6b1560d6b1
[ "Apache-2.0" ]
5
2021-07-09T08:17:56.000Z
2022-02-27T19:57:47.000Z
Working Disassembly/Levels/HCZ/Misc Object Data/Map - Water Splash.asm
TeamASM-Blur/Sonic-3-Blue-Balls-Edition
7e8a2c5df02271615ff4cae529521e6b1560d6b1
[ "Apache-2.0" ]
null
null
null
Working Disassembly/Levels/HCZ/Misc Object Data/Map - Water Splash.asm
TeamASM-Blur/Sonic-3-Blue-Balls-Edition
7e8a2c5df02271615ff4cae529521e6b1560d6b1
[ "Apache-2.0" ]
null
null
null
Map_237C60: dc.w Frame_237C6A-Map_237C60 dc.w Frame_237C6A-Map_237C60 dc.w Frame_237C6A-Map_237C60 dc.w Frame_237C6A-Map_237C60 dc.w Frame_237C86-Map_237C60 Frame_237C6A: dc.w 2 dc.b $F0, $B, 0, 0,$FF,$E8 dc.b $F0, $B, 0, $C, 0, 0 Frame_247C78: dc.b 0 dc.b 0
25.727273
40
0.681979
627275c94abde2064b0d514fb810e77e6849b7e3
9,700
rs
Rust
src/lib.rs
ohke/sqstransfer
5074cd0c3161546e3885bd2db34ca0c7aa68ab46
[ "MIT" ]
null
null
null
src/lib.rs
ohke/sqstransfer
5074cd0c3161546e3885bd2db34ca0c7aa68ab46
[ "MIT" ]
null
null
null
src/lib.rs
ohke/sqstransfer
5074cd0c3161546e3885bd2db34ca0c7aa68ab46
[ "MIT" ]
null
null
null
extern crate clap; use std::{thread, env, fmt, process}; use std::collections::HashMap; use std::sync::{mpsc}; use clap::{App, Arg}; use rusoto_sqs::{ SqsClient, Sqs, Message, ReceiveMessageRequest, SendMessageBatchRequest, SendMessageBatchRequestEntry, DeleteMessageBatchRequest, DeleteMessageBatchRequestEntry }; use std::thread::JoinHandle; pub struct Config { source: String, destination: String, threads: usize, region: String, } impl fmt::Display for Config { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "(source:{}, destination:{}, threads:{}, region:{})", self.source, self.destination, self.threads, self.region ) } } pub fn parse() -> Config { let app = App::new("sqstransfer") .version("0.1.0") .about("CLI tool that transfers Amazon SQS messages to another SQS.") .arg( Arg::with_name("source") .help("Source SQS url") .short("s") .long("source") .takes_value(true) .required(true) ) .arg( Arg::with_name("destination") .help("Destination SQS url") .short("d") .long("destination") .takes_value(true) .required(false) ) .arg( Arg::with_name("region") .help("AWS region url") .short("r") .long("region") .takes_value(true) .required(false) ) .arg( Arg::with_name("delete") .help("Delete messages") .long("delete") .takes_value(false) .required(false) ) .arg( Arg::with_name("threads") .help("Number of threads") .short("t") .long("threads") .takes_value(true) .required(false) .default_value("16") ); let matches = app.get_matches(); let source = matches.value_of("source").unwrap().to_string(); let destination = match matches.value_of("destination") { Some(destination) => destination.to_string(), None => "".to_string(), }; let has_delete = matches.is_present("delete"); if (destination != "" && has_delete) || (destination == "" && !has_delete) { eprintln!("Set `--destination` or `--delete`."); process::exit(1); } let threads = matches.value_of("threads").unwrap().parse::<usize>().unwrap(); let default_region = &env::var("AWS_DEFAULT_REGION").unwrap_or("".to_string()); let region = match matches.value_of("region") { Some(region) => region.to_string(), None => default_region.to_string(), }; if region == "" { eprintln!("Set `--region` option or AWS_DEFAULT_REGION environment value."); process::exit(1); } Config {source, destination, threads, region} } pub fn run(config: &Config) { let mut transferer = Transferer::new(&config.source, &config.destination, config.threads, &config.region); let message_count = transferer.execute(); println!( "Transferred messages count: {} (from: {}, to: {}) ", message_count, &config.source, &config.destination ); } struct Transferer { handles: Vec<Option<JoinHandle<usize>>>, senders: Vec<mpsc::Sender<TransfererCommand>>, } #[derive(Debug, Clone, PartialEq, Eq, Hash)] enum TransfererError { Dequeue, Enqueue, Delete, } enum TransfererCommand { Terminate, } impl Transferer { fn new(source: &str, destination: &str, threads: usize, region: &str) -> Transferer { let mut handles = vec![]; let mut senders = vec![]; let region: rusoto_core::Region = match region.parse() { Ok(region) => region, Err(_) => { eprintln!("Invalid region identifier: {}", region); process::exit(1); } }; let client = SqsClient::new(region); for _ in 0..threads { let source = source.to_string(); let destination = destination.to_string(); let client = client.clone(); let (sender, receiver) = mpsc::channel(); senders.push(sender); let handle = thread::spawn(move || { // TODO: async/await (rusoto 0.43.0~) let mut message_count :usize = 0; loop { match receiver.try_recv() { Ok(TransfererCommand::Terminate) => { break; }, _ => {} } let n = match transfer_message(&client, &source, &destination) { Ok(n) => n, Err(_) => { break; }, }; if n <= 0 { break; } message_count += n; } message_count }); handles.push(Some(handle)); } Transferer { handles, senders, } } fn execute(&mut self) -> usize { (&mut self.handles).into_iter().map(|h| { if let Some(handle) = h.take() { handle.join().unwrap() } else { 0 } }).sum() } } impl Drop for Transferer { fn drop(&mut self) { for sender in &mut self.senders { let _ = sender.send(TransfererCommand::Terminate); } (&mut self.handles).into_iter().for_each(|h| { if let Some(handle) = h.take() { handle.join().unwrap(); } }); } } fn transfer_message(client: &SqsClient, source: &str, destination: &str) -> Result<usize, TransfererError> { let messages = dequeue(client, source)?; if messages.len() >= 1 { if destination != "" { let handles = enqueue(client, &messages, destination)?; delete(client, &handles, source)?; } else { let mut handles: Vec<String> = vec![]; for message in &messages { handles.push(match &message.receipt_handle { Some(receipt_handle) => receipt_handle.to_string(), None => "".to_string(), }); } delete(client, &handles, source)?; } } Ok(messages.len()) } fn dequeue(client: &SqsClient, source: &str) -> Result<Vec<Message>, TransfererError> { match client.receive_message(ReceiveMessageRequest { queue_url: source.to_string(), max_number_of_messages: Some(10), // TODO: https://github.com/rusoto/rusoto/issues/1444 (rusoto 0.44~) // message_attribute_names: Some(vec!["key.*".to_string()]), ..Default::default() }).sync() { Ok(result) => Ok(match result.messages { Some(messages) => messages, None => vec![], }), Err(e) => { eprintln!("Dequeue error: {:?}", e); Err(TransfererError::Dequeue) } } } fn enqueue(client: &SqsClient, messages: &Vec<Message>, destination: &str) -> Result<Vec<String>, TransfererError> { let mut entries: Vec<SendMessageBatchRequestEntry> = vec![]; let mut handle_map = HashMap::new(); for (i, message) in messages.iter().enumerate() { entries.push(SendMessageBatchRequestEntry { id: i.to_string(), message_body: match &message.body { Some(body) => body.to_string(), None => "".to_string(), }, message_attributes: match &message.message_attributes { Some(message_attributes) => Some(message_attributes.clone()), None => None, }, ..Default::default() }); handle_map.insert(i.to_string(), match &message.receipt_handle { Some(receipt_handle) => receipt_handle.to_string(), None => { eprintln!("Enqueue error: be able to get `ReceiptHandle`."); return Err(TransfererError::Enqueue); } }); } match client.send_message_batch(SendMessageBatchRequest { queue_url: destination.to_string(), entries, }) .sync() { Ok(result) => { for f in result.failed { handle_map.remove(&f.id); } let mut handles = vec![]; for (_, v) in handle_map.iter() { handles.push(v.to_string()); } Ok(handles) }, Err(e) => { eprintln!("Enqueue error: {:?}", e); Err(TransfererError::Enqueue) } } } fn delete(client: &SqsClient, handles: &Vec<String>, source: &str) -> Result<(), TransfererError> { let mut entries: Vec<DeleteMessageBatchRequestEntry> = vec![]; for (i, handle) in handles.iter().enumerate() { entries.push(DeleteMessageBatchRequestEntry { id: i.to_string(), receipt_handle: handle.to_string(), }); } match client.delete_message_batch(DeleteMessageBatchRequest { queue_url: source.to_string(), entries, }) .sync() { Ok(_) => Ok(()), Err(e) => { eprintln!("Delete error: {:?}", e); Err(TransfererError::Delete) } } }
29.483283
116
0.506907
881f6f93121b670db93d91940d79646195a218f7
1,650
lua
Lua
Lua/AutoAttack.lua
sumneko/project_index_v2.0_editor
685506a6adfa8f2d32ced12f8e7862405ec91657
[ "Apache-2.0" ]
2
2019-03-27T15:04:40.000Z
2021-03-20T05:26:48.000Z
Lua/AutoAttack.lua
sumneko/project_index_v2.0_editor
685506a6adfa8f2d32ced12f8e7862405ec91657
[ "Apache-2.0" ]
null
null
null
Lua/AutoAttack.lua
sumneko/project_index_v2.0_editor
685506a6adfa8f2d32ced12f8e7862405ec91657
[ "Apache-2.0" ]
2
2015-01-22T11:11:42.000Z
2015-12-02T02:57:52.000Z
local stop = OrderId("stop") local attack = OrderId("attack") local move = OrderId("move") local mark local StopAttack = function(u, b) if b then UnitAddType(u, UNIT_TYPE_PEON) SetUnitAcquireRange(u, GetUnitState(u, ConvertUnitState(0x16))) mark = true IssuePointOrderById(u, move, GetUnitX(u), GetUnitY(u)) IssueImmediateOrderById(u, stop) mark = false else UnitRemoveType(u, UNIT_TYPE_PEON) SetUnitAcquireRange(u, math.max(GetUnitState(u, ConvertUnitState(0x16)), 800)) end end local oldIssueImmediateOrder = IssueImmediateOrder local orderflag IssueImmediateOrder = function(u, o) orderflag = true local r = oldIssueImmediateOrder(u, o) orderflag = false return r end local trg = CreateTrigger() TriggerAddCondition(trg, Condition( function() if mark or orderflag then return end local s = GetIssuedOrderId() if s == stop then StopAttack(GetTriggerUnit(), true) elseif s == attack or s == move then StopAttack(GetTriggerUnit(), false) end end )) Event("创建英雄", function(this) StopAttack(this.unit, true) TriggerRegisterUnitEvent(trg, this.unit, EVENT_UNIT_ISSUED_ORDER) TriggerRegisterUnitEvent(trg, this.unit, EVENT_UNIT_ISSUED_POINT_ORDER) TriggerRegisterUnitEvent(trg, this.unit, EVENT_UNIT_ISSUED_TARGET_ORDER) end )
29.464286
90
0.589091
cb900ee140b01951b0cf8b2dd6e8ef45209b1606
219
swift
Swift
WorldMotion/Classes/Sources/Double+Degree.swift
ahmedAlmasri/WorldMotion
2a65997d16ce5a72a234abfb09993f33ccb7d231
[ "MIT" ]
16
2021-05-14T11:48:04.000Z
2022-01-04T11:06:20.000Z
WorldMotion/Classes/Sources/Double+Degree.swift
ahmedAlmasri/WorldMotion
2a65997d16ce5a72a234abfb09993f33ccb7d231
[ "MIT" ]
null
null
null
WorldMotion/Classes/Sources/Double+Degree.swift
ahmedAlmasri/WorldMotion
2a65997d16ce5a72a234abfb09993f33ccb7d231
[ "MIT" ]
4
2021-06-10T12:52:46.000Z
2021-06-28T10:13:39.000Z
// // Double+Degree.swift // WorldMotion // // Created by Ahmad Almasri on 12/05/2021. // import Foundation public extension Double { func toDegrees() -> Double { self * 180 / .pi } }
12.882353
43
0.56621
fbe8142ab98956712be88ff0cea5c5b52f66c1eb
4,548
java
Java
src/main/java/net/haesleinhuepf/clijx/stardist/StarDist2DVersatileFluorescentNuclei.java
haesleinhuepf/clijx-incubator-stardist
d2199d4925fa4f04a06989bf8654978e54afe391
[ "BSD-3-Clause" ]
null
null
null
src/main/java/net/haesleinhuepf/clijx/stardist/StarDist2DVersatileFluorescentNuclei.java
haesleinhuepf/clijx-incubator-stardist
d2199d4925fa4f04a06989bf8654978e54afe391
[ "BSD-3-Clause" ]
null
null
null
src/main/java/net/haesleinhuepf/clijx/stardist/StarDist2DVersatileFluorescentNuclei.java
haesleinhuepf/clijx-incubator-stardist
d2199d4925fa4f04a06989bf8654978e54afe391
[ "BSD-3-Clause" ]
null
null
null
package net.haesleinhuepf.clijx.stardist; import de.csbdresden.stardist.Opt; import de.csbdresden.stardist.StarDist2D; import ij.IJ; import ij.ImagePlus; import net.haesleinhuepf.clij.clearcl.ClearCLBuffer; import net.haesleinhuepf.clij.macro.CLIJMacroPlugin; import net.haesleinhuepf.clij.macro.CLIJOpenCLProcessor; import net.haesleinhuepf.clij.macro.documentation.OffersDocumentation; import net.haesleinhuepf.clij2.AbstractCLIJ2Plugin; import net.haesleinhuepf.clij2.CLIJ2; import net.haesleinhuepf.clij2.utilities.IsCategorized; import net.imagej.Dataset; import net.imagej.DefaultDataset; import net.imagej.ImageJ; import net.imagej.ImgPlus; import net.imglib2.img.display.imagej.ImageJFunctions; import org.scijava.Context; import org.scijava.command.CommandModule; import org.scijava.command.CommandService; import org.scijava.plugin.Plugin; import java.util.concurrent.ExecutionException; import java.util.concurrent.FutureTask; @Plugin(type = CLIJMacroPlugin.class, name = "CLIJx_starDist2DVersatileFluorescentNuclei") public class StarDist2DVersatileFluorescentNuclei extends AbstractCLIJ2Plugin implements CLIJMacroPlugin, CLIJOpenCLProcessor, OffersDocumentation, IsCategorized { private static CommandService cmdService; private static Context ctx; static { try { ctx = (Context) IJ.runPlugIn("org.scijava.Context", ""); } catch (ExceptionInInitializerError e ) { } if (ctx == null) ctx = new Context(CommandService.class); cmdService = ctx.service(CommandService.class); } public StarDist2DVersatileFluorescentNuclei() { super(); System.out.println("Init star dist"); } @Override public String getParameterHelpText() { return "Image input, ByRef Image destination"; } /* @Override public Object[] getDefaultValues() { return new Object[]{}; } */ @Override public boolean executeCL() { System.out.println("Exec star dist"); boolean result = starDist2DVersatileFluorescentNuclei(getCLIJ2(), (ClearCLBuffer) (args[0]), (ClearCLBuffer) (args[1])); return result; } public static boolean starDist2DVersatileFluorescentNuclei(CLIJ2 clij2, ClearCLBuffer input1, ClearCLBuffer output) { try { de.csbdresden.stardist.StarDist2D.class.newInstance(); } catch (Exception e) { e.printStackTrace(); IJ.log("Failed to initialize StartDist2D.\n" + "Please check if the 'CSBDeep' and 'StarDist' update sites are activated."); } ImagePlus input = clij2.pull(input1); Dataset dataset = new DefaultDataset(ctx, new ImgPlus<>(ImageJFunctions.convertFloat(input))); System.out.println("Made context"); FutureTask res = (FutureTask) cmdService.run(de.csbdresden.stardist.StarDist2D.class, false, "input", dataset, "modelChoice", "Versatile (fluorescent nuclei)", "outputType", "Label Image" ); try { System.out.println(((CommandModule)res.get()).getClass().getName()); DefaultDataset label = (DefaultDataset) ((CommandModule)res.get()).getOutput("label"); //System.out.println(label.getClass().getName()); ClearCLBuffer result = clij2.push(label.getImgPlus().getImg()); clij2.copy(result, output); result.close(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } //IJ.log(res.getClass().getName()); System.out.println("Done."); return true; } @Override public String getDescription() { return "Apply StarDist 2D 'Versatile (Fluorescent Nuclei)' to an image to create a label map."; } @Override public String getAvailableForDimensions() { return "2D"; } public static void main(String[] args) { new ImageJ(); //new net.imagej.ImageJ().ui().showUI(); ImagePlus imp = IJ.openImage("C:/structure/data/blobs.tif"); CLIJ2 clij2 = CLIJ2.getInstance(); ClearCLBuffer input = clij2.push(imp); ClearCLBuffer output = clij2.create(input); StarDist2DVersatileFluorescentNuclei.starDist2DVersatileFluorescentNuclei(clij2, input, output); clij2.show(output, "output"); } @Override public String getCategories() { return "Labeling"; } }
32.719424
161
0.671064
c0066b175ab9fd4a8a0a654e66b44c31194d33f7
3,001
dart
Dart
lib/widgets/bottom_tabs.dart
melhamin/iNova
5b3a197976b9b1f946d753d0f7ccf7a1656524e4
[ "Unlicense" ]
10
2020-09-07T12:39:56.000Z
2022-03-09T05:02:29.000Z
lib/widgets/bottom_tabs.dart
melhamin/iNova
5b3a197976b9b1f946d753d0f7ccf7a1656524e4
[ "Unlicense" ]
1
2020-04-07T19:20:53.000Z
2020-04-07T19:20:53.000Z
lib/widgets/bottom_tabs.dart
melhamin/iNova
5b3a197976b9b1f946d753d0f7ccf7a1656524e4
[ "Unlicense" ]
2
2021-06-09T10:52:46.000Z
2021-07-01T11:31:56.000Z
import 'package:e_movies/consts/consts.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import './bottom_bar.dart'; class BottomTabs extends StatelessWidget { final int currentIndex; final ValueChanged<int> onTap; BottomTabs({ this.currentIndex, this.onTap, }); @override Widget build(BuildContext context) { return Align( alignment: FractionalOffset.bottomCenter, child: BottomBar( currentIndex: currentIndex, onTap: onTap, items: [ BottomNavigationBarItem( // title: Text( // 'Discover', // style: kBottomBarTextStyle, // ), // activeIcon:Icon(Icons.home), // icon: Icon(CupertinoIcons.home), icon: SvgPicture.asset('assets/svg/home.svg', width: 25, height: 25, color: Colors.white.withOpacity(0.7)), activeIcon: SvgPicture.asset('assets/svg/Home_solid.svg', width: 25, height: 25, color: Theme.of(context).accentColor), backgroundColor: Theme.of(context).primaryColor, ), BottomNavigationBarItem( // title: Text( // 'Search', // style: kBottomBarTextStyle, // ), // icon: Icon(CupertinoIcons.search), icon: SvgPicture.asset('assets/svg/Search.svg', width: 25, height: 25, color: Colors.white.withOpacity(0.7)), activeIcon: SvgPicture.asset('assets/svg/Search.svg', width: 25, height: 25, color: Theme.of(context).accentColor), backgroundColor: Theme.of(context).primaryColor, ), BottomNavigationBarItem( // title: Text( // 'Lists', // style: kBottomBarTextStyle, // ), icon: SvgPicture.asset('assets/svg/list.svg', width: 25, height: 25, color: Colors.white.withOpacity(0.7)), activeIcon: SvgPicture.asset('assets/svg/list_solid.svg', width: 25, height: 25, color: Theme.of(context).accentColor), backgroundColor: Theme.of(context).primaryColor, ), BottomNavigationBarItem( // title: Text( // 'Cinemas', // style: kBottomBarTextStyle, // ), icon: Icon(CupertinoIcons.location), activeIcon: Icon(CupertinoIcons.location_solid), backgroundColor: Theme.of(context).primaryColor, ), BottomNavigationBarItem( // title: Text( // 'Account', // style: kBottomBarTextStyle, // ), // icon: Icon(CupertinoIcons.profile_circled), icon: SvgPicture.asset('assets/svg/Profile.svg', width: 25, height: 25, color: Colors.white.withOpacity(0.7)), activeIcon: SvgPicture.asset('assets/svg/Profile.svg', width: 25, height: 25, color: Theme.of(context).accentColor), backgroundColor: Theme.of(context).primaryColor, ), ], ), ); } }
37.049383
129
0.6008
2a360bd2f02a817b834a086a2069f586aab8c15d
4,676
java
Java
aura-components/src/test/java/org/auraframework/components/test/java/model/TestIterationModel.java
kiranmai-sfdev/aura
d77bb57ea56ddf769d2be961c3c97afecffc42ce
[ "Apache-2.0" ]
587
2015-01-01T00:42:17.000Z
2022-01-23T00:14:13.000Z
aura-components/src/test/java/org/auraframework/components/test/java/model/TestIterationModel.java
kiranmai-sfdev/aura
d77bb57ea56ddf769d2be961c3c97afecffc42ce
[ "Apache-2.0" ]
156
2015-02-06T17:56:21.000Z
2019-02-27T05:19:11.000Z
aura-components/src/test/java/org/auraframework/components/test/java/model/TestIterationModel.java
kiranmai-sfdev/aura
d77bb57ea56ddf769d2be961c3c97afecffc42ce
[ "Apache-2.0" ]
340
2015-01-13T14:13:38.000Z
2022-03-21T04:05:29.000Z
/* * Copyright (C) 2013 salesforce.com, inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** */ package org.auraframework.components.test.java.model; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import org.auraframework.system.Annotations.AuraEnabled; import org.auraframework.system.Annotations.Model; import com.google.common.collect.ImmutableList; /** * for iterationTest components * * @since */ @Model public class TestIterationModel { private final List<Object> data; private final Map<String, Object> mapdata; private final List<Object> capitaldata; private final List<String> innerdata; private final List<Integer> dataIntList; public TestIterationModel() { data = new LinkedList<>(); capitaldata = new LinkedList<>(); dataIntList = new LinkedList<>(); mapdata = new HashMap<>(); LinkedList<Object> items_in_mapdata = new LinkedList<>(); for (int i = 0; i < 26; i++) { Map<String, Object> dora = new HashMap<>(); char c = (char) ('a' + i); dora.put("stringy", "" + c + c + c); dora.put("whatever", "hooray for everybody"); data.add(dora); dora = new HashMap<>(); c = (char) ('A' + i); dora.put("stringy", "" + c + c + c + c + c); dora.put("whatever", "boo for nobody"); capitaldata.add(dora); // fill dataInt dataIntList.add(i); //fill in mapdata Map<String, Object> item = new HashMap<>(); item.put("label", i); items_in_mapdata.add(item); } mapdata.put("items",items_in_mapdata); innerdata = ImmutableList.of("gah", "bah", "stah", "brah", "yah", "nah", "hah"); } @AuraEnabled public List<Object> getData() { return data; } @AuraEnabled public Map<String, Object> getMapdata() { return mapdata; } @AuraEnabled public List<Integer> getDataIntList() { return this.dataIntList; } @AuraEnabled public List<Object> getCapitalData() { return capitaldata; } @AuraEnabled public List<String> getInnerData() { return innerdata; } @AuraEnabled public String getDerp() { return "DERP"; } @AuraEnabled public List<List<String>> getPlayerData() { List<List<String>> team = new ArrayList<>(); String[][] s = { { "Héctor Sánchez", "23", "Catcher", "2012" }, { "Buster Posey", "25", "Catcher/First Baseman", "2012,2010" }, { "Brandon Belt", " 24", "First baseman", "2012" }, { "Aubrey Huff", "35", "First Basemen", "2012,2010" }, { "Pablo Sandavol", "26", "Third baseman", "2012,2010" }, { "Marco Scutaro", "37", "Second baseman", "2012" }, { "Ángel Pagán", "31", "Outfielder", "2012" }, { "Hunter Pence", "29", "Outfielder", "2012" }, { "Barry Zito", "34", "Starting Pitcher", "2012" }, { "Brian Wilson", "30", "Closing Pitcher", "2010" }, { "Ryan Vogelsong", "35", "Starting Pitcher", "2012" }, { "Sergio Romo", "29", "Closing Pitcher", "2012,2010" }, { "Guillermo Mota", "39", "Relief Pitcher", "2012,2010" }, { "Tim Lincecum", "28", "Starting Pitcher", "2012,2010" }, { "Santiago Casilla", "32", "Relief Pitcher", "2012,2010" }, { "Matt Cain", "28", "Starting Pitcher", "2012,2010" }, { "Madison Bumgarner", "23", "Starting Pitcher", "2012,2010" }, { "Brandon Crawford", "25", "Short Stop", "2012" }, { "Melky Cabrera", "28", "OutFielder", "2009" }, { "Ryan Theriot", "32", "Short Stop", "2011, 2012" }, }; for (String[] list : s) { ArrayList<String> player = new ArrayList<>(); for (String field : list) { player.add(field); } team.add(player); } return team; } }
34.895522
116
0.562019
4f47adf1b0b072591ef00d58a6a87d83226157f9
1,797
lua
Lua
commands/help.lua
Revivalr/Mr.Grape
3c1a263995247ef81a74d70b67bebe74e21a3710
[ "Apache-2.0" ]
43
2020-12-08T18:53:45.000Z
2022-03-16T02:37:54.000Z
commands/help.lua
Revivalr/Mr.Grape
3c1a263995247ef81a74d70b67bebe74e21a3710
[ "Apache-2.0" ]
13
2020-12-08T18:16:30.000Z
2021-12-11T03:16:37.000Z
commands/help.lua
Revivalr/Mr.Grape
3c1a263995247ef81a74d70b67bebe74e21a3710
[ "Apache-2.0" ]
51
2020-08-24T12:48:34.000Z
2022-03-01T16:10:49.000Z
command.Register("help", "Display's info about all the commands.","utility",function(msg, args) local embed = { title = "Mr Grape's Commands", fields = {}, color = EMBEDCOLOR, timestamp = DISCORDIA.Date():toISO('T', 'Z') } if #args == 0 then assert(msg:reply{ embed = { title = "Mr Grape's Commands", fields = { {name = "Categories", value = "Economy\nUtility\nFun\nModeration\nMusic", inline = true}, {name = "Use +help <category> to see each category's commands", value = "ㅤ", inline = false}, {name = "ㅤ", value = "Powered by [NodeClusters](https://nodeclusters.com/billing/link.php?id=8) VPS and Web Hosting", inline = false}, }, color = EMBEDCOLOR, timestamp = DISCORDIA.Date():toISO('T', 'Z') } }) return nil elseif #args == 1 then for index, value in pairs(command.commands) do if value["category"] == args[1]:lower() then table.insert(embed["fields"], { name = index, value = value["desc"] }) end end end --[[ local embed = { title = "Mr Grape's Commands", fields = {}, color = DISCORDIA.Color.fromRGB(170,26,232).value, timestamp = DISCORDIA.Date():toISO('T', 'Z') } for index,value in pairs(command.commands) do table.insert(embed["fields"], { name = index, value = value["desc"] }) end ]]-- if #embed["fields"] == 0 and #args == 1 then msg:reply("Not a valid category!") else -- set description to the category name if #args >= 2 then local s = args[1]:lower() -- first character uppercase embed["description"] = s:sub(1,1):upper()..s:sub(2) end msg:reply{ embed = embed } end end)
28.078125
155
0.559265
fb6dedd7fc50d4f8fec23325ea5552d88d9b6164
2,641
h
C
include/CQChartsWidgetUtil.h
SammyEnigma/CQCharts
56433e32c943272b6faaf6771d0652c0507f943e
[ "MIT" ]
14
2018-05-22T15:06:08.000Z
2022-01-20T12:18:28.000Z
include/CQChartsWidgetUtil.h
SammyEnigma/CQCharts
56433e32c943272b6faaf6771d0652c0507f943e
[ "MIT" ]
6
2020-09-04T15:49:24.000Z
2022-01-12T19:06:45.000Z
include/CQChartsWidgetUtil.h
SammyEnigma/CQCharts
56433e32c943272b6faaf6771d0652c0507f943e
[ "MIT" ]
9
2019-04-01T13:10:11.000Z
2022-01-22T01:46:27.000Z
#ifndef CQChartsWidgetUtil_H #define CQChartsWidgetUtil_H #include <QFrame> #include <QWidgetAction> class QGridLayout; namespace CQChartsWidgetUtil { void addGridLabelWidget(QGridLayout *playout, const QString &label, QWidget *widget, int &row); QFrame *createHSpacer(int width=1, const char *name="spacer"); QFrame *createHStretch(const char *name="spacer"); void setTextColor(QWidget *w, const QColor &c); } //--- namespace CQChartsWidgetUtil { inline void connectDisconnect(bool b, QObject *from, const char *fromName, QObject *to, const char *toName) { if (b) QObject::connect(from, fromName, to, toName); else QObject::disconnect(from, fromName, to, toName); } /*! * \brief RAII Class to Auto Connect/Disconnect to signal/slot * \ingroup Charts */ class AutoDisconnect { public: AutoDisconnect(QObject *from, const char *fromName, QObject *to, const char *toName) : from_(from), fromName_(fromName), to_(to), toName_(toName) { connectDisconnect(false, from_, fromName_, to_, toName_); } ~AutoDisconnect() { connectDisconnect(true, from_, fromName_, to_, toName_); } private: QObject *from_ { nullptr }; const char *fromName_ { nullptr }; QObject *to_ { nullptr }; const char *toName_ { nullptr }; }; } //------ class QPushButton; /*! * \brief dialog OK, Apply, Cancel buttons * \ingroup Charts */ class CQChartsDialogButtons : public QFrame { Q_OBJECT public: CQChartsDialogButtons(QWidget *parent=nullptr); QPushButton* okButton () const { return okButton_ ; } QPushButton* applyButton () const { return applyButton_ ; } QPushButton* cancelButton() const { return cancelButton_; } QPushButton* helpButton () const { return helpButton_ ; } void connect(QWidget *w, const char *okSlot, const char *applySlot, const char *cancelSlot, const char *helpSlot=nullptr); void setToolTips(const QString &okTip, const QString &applyTip, const QString &cancelTip); private: QPushButton* okButton_ { nullptr }; QPushButton* applyButton_ { nullptr }; QPushButton* cancelButton_ { nullptr }; QPushButton* helpButton_ { nullptr }; }; //--- /*! * \brief Widget Action wrapped for Menus * \ingroup Charts */ class CQChartsWidgetAction : public QWidgetAction { public: CQChartsWidgetAction(QWidget *w) : QWidgetAction(nullptr), w_(w) { } ~CQChartsWidgetAction() { delete w_; } QWidget *widget() const { return w_; } QWidget *createWidget(QWidget *parent) { w_->setParent(parent); return w_; } private: QWidget *w_ { nullptr }; }; #endif
22.57265
95
0.686104
164083293610c02f69a4ce1d30af90eef585bc33
2,093
ts
TypeScript
lib/contract.spec.ts
hhatto/dev-kit-js
ff07e0c254167fe9d76a67846df516ac4ab44736
[ "Apache-2.0" ]
null
null
null
lib/contract.spec.ts
hhatto/dev-kit-js
ff07e0c254167fe9d76a67846df516ac4ab44736
[ "Apache-2.0" ]
null
null
null
lib/contract.spec.ts
hhatto/dev-kit-js
ff07e0c254167fe9d76a67846df516ac4ab44736
[ "Apache-2.0" ]
null
null
null
import Web3 from 'web3' import { createDevkitContract, contractFactory, DevkitContract, } from './contract' import { createAllocatorContract } from './allocator/index' import { createMarketContract } from './market' import { createPropertyContract } from './property/index' import { createPropertyFactoryContract } from './property-factory/index' import { createLockupContract } from './lockup/index' import { createDevContract } from './dev' import { createWithdrawContract } from './withdraw' import { createRegistryContract } from './registry' import { createPolicyContract } from './policy' import { createPolicyGroupContract } from './policy-group' import { createMetricsContract } from './metrics' import { createPolicyFactoryContract } from './policy-factory' describe('contract.ts', () => { describe('createDevkitContract', () => { it('check return object', () => { const host = 'localhost' const client = new Web3() client.setProvider(new Web3.providers.HttpProvider(host)) const expected: DevkitContract = { allocator: createAllocatorContract(client), market: createMarketContract(client), property: createPropertyContract(client), propertyFactory: createPropertyFactoryContract(client), lockup: createLockupContract(client), withdraw: createWithdrawContract(client), dev: createDevContract(client), registry: createRegistryContract(client), policy: createPolicyContract(client), policyGroup: createPolicyGroupContract(client), metrics: createMetricsContract(client), policyFactory: createPolicyFactoryContract(client), } const result = createDevkitContract(client) expect(JSON.stringify(result)).toEqual(JSON.stringify(expected)) }) }) describe('contractFactory', () => { it('check return object', () => { const client = new Web3() client.setProvider(new Web3.providers.HttpProvider('localhost')) const expected = createDevkitContract(client) const result = contractFactory(client.currentProvider) expect(JSON.stringify(result)).toEqual(JSON.stringify(expected)) }) }) })
32.703125
72
0.741997
185cb87a140290a26a71e2df0390c97b17288e38
767
dart
Dart
test/presentation/screen/demo_bloc/demo_bloc_bloc_test.dart
rwema3/FindSeat-App
33f357f792597ea5fd0b14d633c438c5f8e2ade3
[ "BSD-3-Clause" ]
2
2022-03-31T09:24:10.000Z
2022-03-31T18:53:49.000Z
test/presentation/screen/demo_bloc/demo_bloc_bloc_test.dart
rwema3/FindSeat-App
33f357f792597ea5fd0b14d633c438c5f8e2ade3
[ "BSD-3-Clause" ]
null
null
null
test/presentation/screen/demo_bloc/demo_bloc_bloc_test.dart
rwema3/FindSeat-App
33f357f792597ea5fd0b14d633c438c5f8e2ade3
[ "BSD-3-Clause" ]
1
2022-03-31T09:43:53.000Z
2022-03-31T09:43:53.000Z
import 'package:find_seat/presentation/screen/demo_bloc/bloc.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:bloc_test/bloc_test.dart'; void main() { group('DemoBlocBloc', () { test('emits OpenScreen then SearchQueryChange', () async { final bloc = DemoBlocBloc(); bloc.add(OpenScreen()); bloc.add(SearchQueryChanged(keyword: "fake")); await emitsExactly(bloc, [ DemoBlocState( isLoading: false, list: DemoBlocBloc.SAMPLE_DATA, ), DemoBlocState( isLoading: true, list: DemoBlocBloc.SAMPLE_DATA, ), DemoBlocState( isLoading: false, list: DemoBlocBloc.SAMPLE_FILTERED, ), ]); }); // }); }
25.566667
67
0.603651
c6315b5364a320a0c3e929309a059ace1cab2305
2,045
lua
Lua
src/gamestates/play.lua
kikito/ld-30
73f739b591cb692c9bd34fb01eb3acfd08c1fbce
[ "MIT" ]
1
2017-05-27T20:45:30.000Z
2017-05-27T20:45:30.000Z
src/gamestates/play.lua
kikito/ld-30
73f739b591cb692c9bd34fb01eb3acfd08c1fbce
[ "MIT" ]
null
null
null
src/gamestates/play.lua
kikito/ld-30
73f739b591cb692c9bd34fb01eb3acfd08c1fbce
[ "MIT" ]
null
null
null
local Game = require 'game' local Level = require 'level' local Map = require 'map' local maps = require 'maps' local media = require 'media' local Play = Game:addState('Play') function Play:hasNextLevel() return self.level_index < #maps end function Play:loadLevel() local map_data = maps[self.level_index] local map = Map:new(map_data) self.level = Level:new(map) end function Play:enteredState() self.level_index = 1 self.steps = 0 self:loadLevel() end function Play:draw() self.level:draw() local w,h = love.graphics.getDimensions() local font = media.fonts.ui love.graphics.setFont(font) local text_height = font:getHeight() local text_width = font:getWidth(self.steps) love.graphics.setColor(0,0,0) love.graphics.rectangle('fill', w-text_width, h-text_height, text_width, text_height) love.graphics.setColor(255,255,255) love.graphics.print(self.steps, w - text_width, h - text_height) local restart_msg = "R = restart level" local text_width = font:getWidth(restart_msg) love.graphics.print(restart_msg, w - text_width, h/2 - text_height) love.graphics.print(restart_msg, w - text_width, h/2) love.graphics.setColor(0,0,0) love.graphics.print('Space = hell', 0, h/2 - text_height) love.graphics.print('Space = earth', 0, h/2) end function Play:keypressed(key) if key == 'escape' then self:gotoState('Intro') media.sfx.cant:play() elseif key == 'r' then media.sfx.cant:play() self.level:restart() elseif key == 'up' or key == 'down' or key == 'right' or key == 'left' then if self.level:attemptMove(key) then self.steps = self.steps + 1 if self.level:isWon() then if self:hasNextLevel() then media.sfx.win:play() self.level_index = self.level_index + 1 self:loadLevel() else self:gotoState('Win') end end else media.sfx.cant:play() end else self.level:switchActiveWorld() end end function Play:exitedState() self.level = nil end return Play
24.638554
87
0.676773
431be4d63074dc5d260b4c3efd543bf17ca4d21e
300
asm
Assembly
oeis/021/A021709.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/021/A021709.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/021/A021709.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A021709: Decimal expansion of 1/705. ; 0,0,1,4,1,8,4,3,9,7,1,6,3,1,2,0,5,6,7,3,7,5,8,8,6,5,2,4,8,2,2,6,9,5,0,3,5,4,6,0,9,9,2,9,0,7,8,0,1,4,1,8,4,3,9,7,1,6,3,1,2,0,5,6,7,3,7,5,8,8,6,5,2,4,8,2,2,6,9,5,0,3,5,4,6,0,9,9,2,9,0,7,8,0,1,4,1,8,4 add $0,1 mov $2,10 pow $2,$0 mov $0,$2 div $0,705 mod $0,10
30
199
0.54
30768fa413a2a32bb1cad1790802754a228ea084
404
asm
Assembly
programs/oeis/273/A273751.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/273/A273751.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/273/A273751.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A273751: Triangle of the natural numbers written by decreasing antidiagonals. ; 1,2,3,4,5,7,6,8,10,13,9,11,14,17,21,12,15,18,22,26,31,16,19,23,27,32,37,43,20,24,28,33,38,44,50,57,25,29,34,39,45,51,58,65,73,30,35,40,46,52,59,66,74,82,91,36,41 mov $2,$0 lpb $0 sub $0,2 lpb $2 mov $0,$2 add $1,1 sub $2,$1 add $3,1 sub $0,$3 mov $3,0 lpe add $1,$0 lpe add $1,1 mov $0,$1
21.263158
163
0.594059
aff22d73c1c3f17d7c63963ec28d7a5fc6e56261
1,023
html
HTML
index.html
echojc/scrambler
e6ce12990fd569925545617e295bf5f7e3e7cc5b
[ "MIT" ]
null
null
null
index.html
echojc/scrambler
e6ce12990fd569925545617e295bf5f7e3e7cc5b
[ "MIT" ]
null
null
null
index.html
echojc/scrambler
e6ce12990fd569925545617e295bf5f7e3e7cc5b
[ "MIT" ]
null
null
null
<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script type="text/javascript" src="./lib/cube.js"></script> <script type="text/javascript" src="./lib/solve.js"></script> <script type="text/javascript" src="./lib/async.js"></script> </head> <body> <div id="main">Initialising generator...</div> <button disabled id="gen">Generate</button> <div>--</div> <div>Corner cycles: <button id="plus">+</button></div> <div id="cycles"></div> <div id="template" style="display:none"> <div> <input disabled type="text"/> x <input disabled type="text"/> <input disabled type="checkbox"/> must include <button disabled>-</button> </div> </div> <br><br> <div><em>Built with <a target="_blank" href="https://github.com/ldez/cubejs">https://github.com/ldez/cubejs</a></em></div> <script type="text/javascript" src="./main.js"></script> </body> </html>
35.275862
126
0.604106
0a0e76f1f6d499f28aad8867b39d82fe41fea0dc
563
ts
TypeScript
src/components/InputPrice/styles.ts
jvrapi/bist
001c3f0b433a99aed8dfb3fda46666a9ddd41dc4
[ "MIT" ]
null
null
null
src/components/InputPrice/styles.ts
jvrapi/bist
001c3f0b433a99aed8dfb3fda46666a9ddd41dc4
[ "MIT" ]
null
null
null
src/components/InputPrice/styles.ts
jvrapi/bist
001c3f0b433a99aed8dfb3fda46666a9ddd41dc4
[ "MIT" ]
null
null
null
import { StyleSheet } from 'react-native' import { theme } from '../../global/styles/theme' export const styles = StyleSheet.create({ container: { width: '50%', borderRadius: 15, borderColor: '#000', borderWidth: 1, backgroundColor: theme.colors.inputBackground, height: 70, alignItems: 'center', justifyContent: 'center', alignSelf: 'center', marginTop: 50, paddingHorizontal: 10 }, input: { flex: 1, width: '100%', fontSize: 20, fontFamily: theme.fonts.title700, textAlign: 'center' } })
21.653846
50
0.626998
874ed48ee3e4910c679e9bb742ba909e55ec0e9c
1,844
xhtml
HTML
web/tickets/create.xhtml
stcarrez/jason
eee21b84fb6bab2e05b1f4df408d8f9ed34cbccc
[ "Apache-2.0" ]
2
2019-01-26T22:14:55.000Z
2019-01-28T10:49:46.000Z
web/tickets/create.xhtml
stcarrez/jason
eee21b84fb6bab2e05b1f4df408d8f9ed34cbccc
[ "Apache-2.0" ]
null
null
null
web/tickets/create.xhtml
stcarrez/jason
eee21b84fb6bab2e05b1f4df408d8f9ed34cbccc
[ "Apache-2.0" ]
null
null
null
<ui:composition xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jstl/core" template="/WEB-INF/layouts/layout.xhtml"> <ui:param name="title" value="#{ticketMsg.tickets_title}" /> <ui:param name="pageStyle" value="page-tickets"/> <ui:param name="top_nav" value="projects"/> <!-- Main page body --> <ui:define name="pageBody"> <f:metadata> <f:viewAction action='#{ticket.load}'/> </f:metadata> <div id='awa-content'> <ui:include src="/projects/views/project-header.xhtml"/> <ui:include src="forms/create-form.xhtml"/> </div> </ui:define> <ui:define name="pageScript"> <script type="text/javascript" src="#{jquery.chosenPath}"></script> <script type="text/javascript" src="#{contextPath}/js/markedit/showdown.js"></script> <script type="text/javascript" src="#{contextPath}/js/markedit/jquery.markedit.js"></script> <script type="text/javascript" src="#{contextPath}/js/dropzone.js"></script> <script type="text/javascript" src="#{contextPath}/js/jquery.datetimepicker.js"></script> <script type="text/javascript" src="#{contextPath}/js/trumbowyg/trumbowyg.js"></script> <script type="text/javascript" src="#{contextPath}/js/trumbowyg/plugins/fontfamily/trumbowyg.fontfamily.js"></script> <script type="text/javascript" src="#{contextPath}/js/trumbowyg/plugins/preformatted/trumbowyg.preformatted.js"></script> <script type="text/javascript" src="#{contextPath}/js/awa-images.js"></script> <script type="text/javascript" src="#{contextPath}/js/projects.js"></script> </ui:define> </ui:composition>
52.685714
129
0.632321
946dd38af5d33cfbaeba26d5b22a9f24a86b62e9
658
cpp
C++
67.cpp
zfang399/LeetCode-Problems
4cb25718a3d1361569f5ee6fde7b4a9a4fde2186
[ "MIT" ]
8
2018-10-31T11:00:19.000Z
2020-07-31T05:25:06.000Z
67.cpp
zfang399/LeetCode-Problems
4cb25718a3d1361569f5ee6fde7b4a9a4fde2186
[ "MIT" ]
null
null
null
67.cpp
zfang399/LeetCode-Problems
4cb25718a3d1361569f5ee6fde7b4a9a4fde2186
[ "MIT" ]
2
2018-05-31T11:29:22.000Z
2019-09-11T06:34:40.000Z
class Solution { public: string addBinary(string a, string b) { string ans; int ex=0,sum,i=a.length()-1,j=b.length()-1; while(i>=0 && j>=0){ sum=a[i]-'0'+b[j]-'0'+ex; i--,j--; ans=to_string(sum%2)+ans; ex=sum/2; cout<<ans<<endl; } while(i>=0){ sum=a[i]-'0'+ex; i--; ans=to_string(sum%2)+ans; ex=sum/2; } while(j>=0){ sum=b[j]-'0'+ex; j--; ans=to_string(sum%2)+ans; ex=sum/2; } if(ex) ans='1'+ans; return ans; } };
22.689655
51
0.370821
90b6bf2e18bb725c4ebf9074f59867186ed55d54
8,375
sql
SQL
db_blog.sql
sajanPoddar/simple_laravel_blog
eb24d53963cde3840cfa3721c4020a885f4c3937
[ "MIT" ]
null
null
null
db_blog.sql
sajanPoddar/simple_laravel_blog
eb24d53963cde3840cfa3721c4020a885f4c3937
[ "MIT" ]
null
null
null
db_blog.sql
sajanPoddar/simple_laravel_blog
eb24d53963cde3840cfa3721c4020a885f4c3937
[ "MIT" ]
null
null
null
-- phpMyAdmin SQL Dump -- version 4.5.4.1deb2ubuntu1 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Jun 16, 2016 at 12:56 AM -- Server version: 5.7.12-0ubuntu1 -- PHP Version: 7.0.4-7ubuntu2.1 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!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 utf8mb4 */; -- -- Database: `db_blog` -- -- -------------------------------------------------------- -- -- Table structure for table `articles` -- CREATE TABLE `articles` ( `id` int(10) UNSIGNED NOT NULL, `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `description` text COLLATE utf8_unicode_ci NOT NULL, `image` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `created_by` varchar(11) COLLATE utf8_unicode_ci DEFAULT NULL, `updated_by` int(11) DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `articles` -- INSERT INTO `articles` (`id`, `title`, `description`, `image`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES (6, 'Doloremque asperiores dolore rerum sint pariatur.', 'Sed sapiente corrupti ea nostrum alias aut sed. Fugit quia quia quisquam quidem nostrum. Mollitia illum et natus vero. Aut explicabo assumenda sit sed.', NULL, NULL, NULL, NULL, NULL), (7, 'Et eligendi nulla saepe enim.sfd', 'Nemo laudantium corporis numquam. Eos maxime non ea. Error velit et porro fugiat.sfdfsf', 'img06.jpg', 'fsdssfd', NULL, NULL, '2016-06-04 07:48:53'), (8, 'Perspiciatis laborum velit magni cum.', 'Non explicabo blanditiis non fugiat magni et rem. Officiis voluptatem facere voluptas. Amet adipisci magni deleniti illum.', NULL, NULL, NULL, NULL, NULL), (9, 'Eius cum molestiae fugiat esse itaque tempora praesentium.', 'Accusamus sed ipsa qui quae aut ducimus. Ut aut nesciunt provident aut earum.', NULL, NULL, NULL, NULL, NULL), (10, 'Rem sint minus eaque ea illo.', 'Ea et ut enim eos eos eligendi. Sint fugiat cupiditate unde rerum. Praesentium sit provident dicta culpa eveniet libero. Perferendis reprehenderit voluptas est.', NULL, NULL, NULL, NULL, NULL), (11, 'asdfasdf', 'adsfadfsf fds', 'img06.jpg', 'sfadsf', NULL, '2016-06-04 06:47:42', '2016-06-04 07:48:32'), (12, 'adsf', 'adf', 'img06.jpg', '0', NULL, '2016-06-04 06:49:04', '2016-06-04 06:49:04'), (13, 'adsf', 'adsf', 'img09.gif', '0', NULL, '2016-06-04 06:58:31', '2016-06-04 06:58:31'), (15, 'asdf', 'adsf', 'img10.gif', '0', NULL, '2016-06-04 07:06:14', '2016-06-04 07:06:14'), (17, 'fgdgf', 'fggdh', 'img06.jpg', 'tanim', NULL, '2016-06-04 07:27:59', '2016-06-04 07:28:51'), (18, 'adsfadsf', 'adsfadfs', 'img07.gif', 'sdfsadsfdas', NULL, '2016-06-11 02:45:17', '2016-06-11 02:45:17'), (19, 'tanimads', 'adsf', 'img12.gif', 'sdfsadsf', NULL, '2016-06-11 02:46:19', '2016-06-11 02:46:19'); -- -------------------------------------------------------- -- -- Table structure for table `blogs` -- CREATE TABLE `blogs` ( `id` int(10) UNSIGNED NOT NULL, `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `image` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `blogs` -- INSERT INTO `blogs` (`id`, `title`, `description`, `image`, `username`, `created_at`, `updated_at`) VALUES (3, 'Prof.', 'Exercitationem tempora neque incidunt voluptatum facere. Pariatur libero necessitatibus sed ab optio voluptas qui. Tenetur beatae quis deserunt a quo. Est error quia placeat debitis maxime quos aspernatur.', NULL, 'Luciano', NULL, NULL), (4, 'Mr.', 'Aut omnis rerum perferendis quas dolore nulla rerum. Doloremque velit tempora ullam expedita dignissimos dicta. Reiciendis nihil et qui est rerum ipsa.', NULL, 'Watson', NULL, NULL), (5, 'Ms.', 'Provident sint nihil magnam quisquam molestiae odio. Unde molestiae cum repellat animi nihil recusandae necessitatibus. Aliquam eligendi deleniti fugit ipsum autem.', NULL, 'Tomasa', NULL, NULL), (6, 'Dr.', 'Delectus possimus qui velit ut molestiae dolores. Vitae vel non quas dignissimos rem iste. Illum fuga non rerum possimus odit pariatur. Recusandae animi commodi consequatur accusamus consequatur ea qui dicta.', NULL, 'Sim', NULL, NULL), (7, 'Prof.', 'Magnam voluptatem quia molestiae. Officia incidunt et ducimus sit ipsam et. Voluptas quo ullam minima. Optio est quam non eius assumenda esse animi.', NULL, 'Carlie', NULL, NULL), (8, 'Dr.', 'Recusandae rem quod voluptas eos voluptas. Sunt vel dolores velit consectetur voluptas maiores. Non numquam vel atque incidunt velit qui nisi. Impedit nostrum consequatur voluptatem cupiditate.', NULL, 'Filomena', NULL, NULL), (9, 'Dr.', 'Reprehenderit non voluptates esse consequatur facilis quis laborum. Aut porro velit dolor est tempore sapiente. Ratione autem deserunt laudantium voluptatem velit.', NULL, 'Cedrick', NULL, NULL), (10, 'Dr.', 'Qui quis necessitatibus ut sint nihil. Laudantium expedita et vero nam. Ut ipsum enim laudantium et dolorem ut dolores.', NULL, 'Zachery', NULL, NULL), (11, 'dsf', 'sfd', 'img09.gif', 'dsf', '2016-06-04 05:18:11', '2016-06-04 05:18:11'); -- -------------------------------------------------------- -- -- Table structure for table `migrations` -- CREATE TABLE `migrations` ( `migration` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `batch` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `migrations` -- INSERT INTO `migrations` (`migration`, `batch`) VALUES ('2014_10_12_000000_create_users_table', 1), ('2014_10_12_100000_create_password_resets_table', 1), ('2016_05_27_061508_create_articles_table', 2), ('2016_05_28_102743_create_blogs_table', 3); -- -------------------------------------------------------- -- -- Table structure for table `password_resets` -- CREATE TABLE `password_resets` ( `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `token` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` int(10) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `confirmed` tinyint(1) NOT NULL DEFAULT '0', `confirmation_code` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Indexes for dumped tables -- -- -- Indexes for table `articles` -- ALTER TABLE `articles` ADD PRIMARY KEY (`id`); -- -- Indexes for table `blogs` -- ALTER TABLE `blogs` ADD PRIMARY KEY (`id`); -- -- Indexes for table `password_resets` -- ALTER TABLE `password_resets` ADD KEY `password_resets_email_index` (`email`), ADD KEY `password_resets_token_index` (`token`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `users_email_unique` (`email`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `articles` -- ALTER TABLE `articles` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20; -- -- AUTO_INCREMENT for table `blogs` -- ALTER TABLE `blogs` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; /*!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 */;
43.619792
251
0.70591
b2c29280d20af5905c42d2cbfa46da120e10442f
62,008
ps1
PowerShell
J81.ADCToolkit/Public/adc-functions-conf-analytics.ps1
j81blog/J81.ADCToolk
acd4d875f0e8c61da765a1128d41d716e4eead1d
[ "MIT" ]
null
null
null
J81.ADCToolkit/Public/adc-functions-conf-analytics.ps1
j81blog/J81.ADCToolk
acd4d875f0e8c61da765a1128d41d716e4eead1d
[ "MIT" ]
null
null
null
J81.ADCToolkit/Public/adc-functions-conf-analytics.ps1
j81blog/J81.ADCToolk
acd4d875f0e8c61da765a1128d41d716e4eead1d
[ "MIT" ]
1
2022-01-02T13:19:03.000Z
2022-01-02T13:19:03.000Z
function Invoke-ADCAddAnalyticsglobalanalyticsprofilebinding { <# .SYNOPSIS Add Analytics configuration Object. .DESCRIPTION Binding object showing the analyticsprofile that can be bound to analyticsglobal. .PARAMETER Analyticsprofile Name of the analytics profile bound. .PARAMETER PassThru Return details about the created analyticsglobal_analyticsprofile_binding item. .EXAMPLE PS C:\>Invoke-ADCAddAnalyticsglobalanalyticsprofilebinding -analyticsprofile <string> An example how to add analyticsglobal_analyticsprofile_binding configuration Object(s). .NOTES File Name : Invoke-ADCAddAnalyticsglobalanalyticsprofilebinding Version : v2111.2521 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/analytics/analyticsglobal_analyticsprofile_binding/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [string]$Analyticsprofile, [Switch]$PassThru ) begin { Write-Verbose "Invoke-ADCAddAnalyticsglobalanalyticsprofilebinding: Starting" } process { try { $payload = @{ analyticsprofile = $analyticsprofile } if ( $PSCmdlet.ShouldProcess("analyticsglobal_analyticsprofile_binding", "Add Analytics configuration Object") ) { $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type analyticsglobal_analyticsprofile_binding -Payload $payload -GetWarning #HTTP Status Code on Success: 201 Created #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error if ( $PSBoundParameters.ContainsKey('PassThru') ) { Write-Output (Invoke-ADCGetAnalyticsglobalanalyticsprofilebinding -Filter $payload) } else { Write-Output $result } } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCAddAnalyticsglobalanalyticsprofilebinding: Finished" } } function Invoke-ADCDeleteAnalyticsglobalanalyticsprofilebinding { <# .SYNOPSIS Delete Analytics configuration Object. .DESCRIPTION Binding object showing the analyticsprofile that can be bound to analyticsglobal. .PARAMETER Analyticsprofile Name of the analytics profile bound. .EXAMPLE PS C:\>Invoke-ADCDeleteAnalyticsglobalanalyticsprofilebinding An example how to delete analyticsglobal_analyticsprofile_binding configuration Object(s). .NOTES File Name : Invoke-ADCDeleteAnalyticsglobalanalyticsprofilebinding Version : v2111.2521 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/analytics/analyticsglobal_analyticsprofile_binding/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [string]$Analyticsprofile ) begin { Write-Verbose "Invoke-ADCDeleteAnalyticsglobalanalyticsprofilebinding: Starting" } process { try { $arguments = @{ } if ( $PSBoundParameters.ContainsKey('Analyticsprofile') ) { $arguments.Add('analyticsprofile', $Analyticsprofile) } if ( $PSCmdlet.ShouldProcess("analyticsglobal_analyticsprofile_binding", "Delete Analytics configuration Object") ) { $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type analyticsglobal_analyticsprofile_binding -NitroPath nitro/v1/config -Resource $ -Arguments $arguments #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $response } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCDeleteAnalyticsglobalanalyticsprofilebinding: Finished" } } function Invoke-ADCGetAnalyticsglobalanalyticsprofilebinding { <# .SYNOPSIS Get Analytics configuration object(s). .DESCRIPTION Binding object showing the analyticsprofile that can be bound to analyticsglobal. .PARAMETER GetAll Retrieve all analyticsglobal_analyticsprofile_binding object(s). .PARAMETER Count If specified, the count of the analyticsglobal_analyticsprofile_binding object(s) will be returned. .PARAMETER Filter Specify a filter. -Filter @{ 'name'='<value>' } .PARAMETER ViewSummary When specified, only a summary of information is returned. .EXAMPLE PS C:\>Invoke-ADCGetAnalyticsglobalanalyticsprofilebinding Get data. .EXAMPLE PS C:\>Invoke-ADCGetAnalyticsglobalanalyticsprofilebinding -GetAll Get all analyticsglobal_analyticsprofile_binding data. .EXAMPLE PS C:\>Invoke-ADCGetAnalyticsglobalanalyticsprofilebinding -Count Get the number of analyticsglobal_analyticsprofile_binding objects. .EXAMPLE PS C:\>Invoke-ADCGetAnalyticsglobalanalyticsprofilebinding -name <string> Get analyticsglobal_analyticsprofile_binding object by specifying for example the name. .EXAMPLE PS C:\>Invoke-ADCGetAnalyticsglobalanalyticsprofilebinding -Filter @{ 'name'='<value>' } Get analyticsglobal_analyticsprofile_binding data with a filter. .NOTES File Name : Invoke-ADCGetAnalyticsglobalanalyticsprofilebinding Version : v2111.2521 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/analytics/analyticsglobal_analyticsprofile_binding/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(DefaultParameterSetName = "GetAll")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(ParameterSetName = 'Count', Mandatory)] [Switch]$Count, [hashtable]$Filter = @{ }, [Parameter(ParameterSetName = 'GetAll')] [Switch]$GetAll ) begin { Write-Verbose "Invoke-ADCGetAnalyticsglobalanalyticsprofilebinding: Beginning" } process { try { if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) { $query = @{ bulkbindings = 'yes' } Write-Verbose "Retrieving all analyticsglobal_analyticsprofile_binding objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type analyticsglobal_analyticsprofile_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) { if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } } Write-Verbose "Retrieving total count for analyticsglobal_analyticsprofile_binding objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type analyticsglobal_analyticsprofile_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) { Write-Verbose "Retrieving analyticsglobal_analyticsprofile_binding objects by arguments" $arguments = @{ } $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type analyticsglobal_analyticsprofile_binding -NitroPath nitro/v1/config -Arguments $arguments -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) { Write-Verbose "Retrieving analyticsglobal_analyticsprofile_binding configuration for property ''" } else { Write-Verbose "Retrieving analyticsglobal_analyticsprofile_binding configuration objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type analyticsglobal_analyticsprofile_binding -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" $response = $null } Write-Output $response } end { Write-Verbose "Invoke-ADCGetAnalyticsglobalanalyticsprofilebinding: Ended" } } function Invoke-ADCGetAnalyticsglobalbinding { <# .SYNOPSIS Get Analytics configuration object(s). .DESCRIPTION Binding object which returns the resources bound to analyticsglobal. .PARAMETER GetAll Retrieve all analyticsglobal_binding object(s). .PARAMETER Count If specified, the count of the analyticsglobal_binding object(s) will be returned. .PARAMETER Filter Specify a filter. -Filter @{ 'name'='<value>' } .PARAMETER ViewSummary When specified, only a summary of information is returned. .EXAMPLE PS C:\>Invoke-ADCGetAnalyticsglobalbinding Get data. .EXAMPLE PS C:\>Invoke-ADCGetAnalyticsglobalbinding -GetAll Get all analyticsglobal_binding data. .EXAMPLE PS C:\>Invoke-ADCGetAnalyticsglobalbinding -name <string> Get analyticsglobal_binding object by specifying for example the name. .EXAMPLE PS C:\>Invoke-ADCGetAnalyticsglobalbinding -Filter @{ 'name'='<value>' } Get analyticsglobal_binding data with a filter. .NOTES File Name : Invoke-ADCGetAnalyticsglobalbinding Version : v2111.2521 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/analytics/analyticsglobal_binding/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(DefaultParameterSetName = "GetAll")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [hashtable]$Filter = @{ }, [Parameter(ParameterSetName = 'GetAll')] [Switch]$GetAll ) begin { Write-Verbose "Invoke-ADCGetAnalyticsglobalbinding: Beginning" } process { try { if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) { $query = @{ bulkbindings = 'yes' } Write-Verbose "Retrieving all analyticsglobal_binding objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type analyticsglobal_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) { if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } } Write-Verbose "Retrieving total count for analyticsglobal_binding objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type analyticsglobal_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) { Write-Verbose "Retrieving analyticsglobal_binding objects by arguments" $arguments = @{ } $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type analyticsglobal_binding -NitroPath nitro/v1/config -Arguments $arguments -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) { Write-Verbose "Retrieving analyticsglobal_binding configuration for property ''" } else { Write-Verbose "Retrieving analyticsglobal_binding configuration objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type analyticsglobal_binding -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" $response = $null } Write-Output $response } end { Write-Verbose "Invoke-ADCGetAnalyticsglobalbinding: Ended" } } function Invoke-ADCDeleteAnalyticsprofile { <# .SYNOPSIS Delete Analytics configuration Object. .DESCRIPTION Configuration for Analytics profile resource. .PARAMETER Name Name for the analytics profile. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters. .EXAMPLE PS C:\>Invoke-ADCDeleteAnalyticsprofile -Name <string> An example how to delete analyticsprofile configuration Object(s). .NOTES File Name : Invoke-ADCDeleteAnalyticsprofile Version : v2111.2521 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/analytics/analyticsprofile/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [string]$Name ) begin { Write-Verbose "Invoke-ADCDeleteAnalyticsprofile: Starting" } process { try { $arguments = @{ } if ( $PSCmdlet.ShouldProcess("$name", "Delete Analytics configuration Object") ) { $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type analyticsprofile -NitroPath nitro/v1/config -Resource $name -Arguments $arguments #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $response } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCDeleteAnalyticsprofile: Finished" } } function Invoke-ADCUnsetAnalyticsprofile { <# .SYNOPSIS Unset Analytics configuration Object. .DESCRIPTION Configuration for Analytics profile resource. .PARAMETER Name Name for the analytics profile. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters. .PARAMETER Collectors The collector can be an IP, an appflow collector name, a service or a vserver. If IP is specified, the transport is considered as logstream and default port of 5557 is taken. If collector name is specified, the collector properties are taken from the configured collector. If service is specified, the configured service is assumed as the collector. If vserver is specified, the services bound to it are considered as collectors and the records are load balanced. .PARAMETER Type This option indicates what information needs to be collected and exported. Possible values = global, webinsight, tcpinsight, securityinsight, videoinsight, hdxinsight, gatewayinsight, timeseries, lsninsight, botinsight, CIinsight .PARAMETER Httpclientsidemeasurements On enabling this option, the Citrix ADC will insert a javascript into the HTTP response to collect the client side page-timings and will send the same to the configured collectors. Possible values = ENABLED, DISABLED .PARAMETER Httppagetracking On enabling this option, the Citrix ADC will link the embedded objects of a page together. Possible values = ENABLED, DISABLED .PARAMETER Httpurl On enabling this option, the Citrix ADC will log the URL in appflow records. Possible values = ENABLED, DISABLED .PARAMETER Httphost On enabling this option, the Citrix ADC will log the Host header in appflow records. Possible values = ENABLED, DISABLED .PARAMETER Httpmethod On enabling this option, the Citrix ADC will log the method header in appflow records. Possible values = ENABLED, DISABLED .PARAMETER Httpreferer On enabling this option, the Citrix ADC will log the referer header in appflow records. Possible values = ENABLED, DISABLED .PARAMETER Httpuseragent On enabling this option, the Citrix ADC will log User-Agent header. Possible values = ENABLED, DISABLED .PARAMETER Httpcookie On enabling this option, the Citrix ADC will log cookie header. Possible values = ENABLED, DISABLED .PARAMETER Httplocation On enabling this option, the Citrix ADC will log location header. Possible values = ENABLED, DISABLED .PARAMETER Urlcategory On enabling this option, the Citrix ADC will send the URL category record. Possible values = ENABLED, DISABLED .PARAMETER Allhttpheaders On enabling this option, the Citrix ADC will log all the request and response headers. Possible values = ENABLED, DISABLED .PARAMETER Httpcontenttype On enabling this option, the Citrix ADC will log content-length header. Possible values = ENABLED, DISABLED .PARAMETER Httpauthentication On enabling this option, the Citrix ADC will log Authentication header. Possible values = ENABLED, DISABLED .PARAMETER Httpvia On enabling this option, the Citrix ADC will Via header. Possible values = ENABLED, DISABLED .PARAMETER Httpxforwardedforheader On enabling this option, the Citrix ADC will log X-Forwarded-For header. Possible values = ENABLED, DISABLED .PARAMETER Httpsetcookie On enabling this option, the Citrix ADC will log set-cookie header. Possible values = ENABLED, DISABLED .PARAMETER Httpsetcookie2 On enabling this option, the Citrix ADC will log set-cookie2 header. Possible values = ENABLED, DISABLED .PARAMETER Httpdomainname On enabling this option, the Citrix ADC will log domain name. Possible values = ENABLED, DISABLED .PARAMETER Httpurlquery On enabling this option, the Citrix ADC will log URL Query. Possible values = ENABLED, DISABLED .PARAMETER Tcpburstreporting On enabling this option, the Citrix ADC will log TCP burst parameters. Possible values = ENABLED, DISABLED .PARAMETER Cqareporting On enabling this option, the Citrix ADC will log TCP CQA parameters. Possible values = ENABLED, DISABLED .PARAMETER Integratedcache On enabling this option, the Citrix ADC will log the Integrated Caching appflow records. Possible values = ENABLED, DISABLED .PARAMETER Grpcstatus On enabling this option, the Citrix ADC will log the gRPC status headers. Possible values = ENABLED, DISABLED .PARAMETER Outputmode This option indicates the format of REST API POST body. It depends on the consumer of the analytics data. Possible values = avro, prometheus, influx .PARAMETER Metrics This option indicates the whether metrics should be sent to the REST collector. Possible values = ENABLED, DISABLED .PARAMETER Events This option indicates the whether events should be sent to the REST collector. Possible values = ENABLED, DISABLED .PARAMETER Auditlogs This option indicates the whether auditlog should be sent to the REST collector. Possible values = ENABLED, DISABLED .EXAMPLE PS C:\>Invoke-ADCUnsetAnalyticsprofile -name <string> An example how to unset analyticsprofile configuration Object(s). .NOTES File Name : Invoke-ADCUnsetAnalyticsprofile Version : v2111.2521 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/analytics/analyticsprofile Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [ValidateLength(1, 127)] [string]$Name, [Boolean]$collectors, [Boolean]$type, [Boolean]$httpclientsidemeasurements, [Boolean]$httppagetracking, [Boolean]$httpurl, [Boolean]$httphost, [Boolean]$httpmethod, [Boolean]$httpreferer, [Boolean]$httpuseragent, [Boolean]$httpcookie, [Boolean]$httplocation, [Boolean]$urlcategory, [Boolean]$allhttpheaders, [Boolean]$httpcontenttype, [Boolean]$httpauthentication, [Boolean]$httpvia, [Boolean]$httpxforwardedforheader, [Boolean]$httpsetcookie, [Boolean]$httpsetcookie2, [Boolean]$httpdomainname, [Boolean]$httpurlquery, [Boolean]$tcpburstreporting, [Boolean]$cqareporting, [Boolean]$integratedcache, [Boolean]$grpcstatus, [Boolean]$outputmode, [Boolean]$metrics, [Boolean]$events, [Boolean]$auditlogs ) begin { Write-Verbose "Invoke-ADCUnsetAnalyticsprofile: Starting" } process { try { $payload = @{ name = $name } if ( $PSBoundParameters.ContainsKey('collectors') ) { $payload.Add('collectors', $collectors) } if ( $PSBoundParameters.ContainsKey('type') ) { $payload.Add('type', $type) } if ( $PSBoundParameters.ContainsKey('httpclientsidemeasurements') ) { $payload.Add('httpclientsidemeasurements', $httpclientsidemeasurements) } if ( $PSBoundParameters.ContainsKey('httppagetracking') ) { $payload.Add('httppagetracking', $httppagetracking) } if ( $PSBoundParameters.ContainsKey('httpurl') ) { $payload.Add('httpurl', $httpurl) } if ( $PSBoundParameters.ContainsKey('httphost') ) { $payload.Add('httphost', $httphost) } if ( $PSBoundParameters.ContainsKey('httpmethod') ) { $payload.Add('httpmethod', $httpmethod) } if ( $PSBoundParameters.ContainsKey('httpreferer') ) { $payload.Add('httpreferer', $httpreferer) } if ( $PSBoundParameters.ContainsKey('httpuseragent') ) { $payload.Add('httpuseragent', $httpuseragent) } if ( $PSBoundParameters.ContainsKey('httpcookie') ) { $payload.Add('httpcookie', $httpcookie) } if ( $PSBoundParameters.ContainsKey('httplocation') ) { $payload.Add('httplocation', $httplocation) } if ( $PSBoundParameters.ContainsKey('urlcategory') ) { $payload.Add('urlcategory', $urlcategory) } if ( $PSBoundParameters.ContainsKey('allhttpheaders') ) { $payload.Add('allhttpheaders', $allhttpheaders) } if ( $PSBoundParameters.ContainsKey('httpcontenttype') ) { $payload.Add('httpcontenttype', $httpcontenttype) } if ( $PSBoundParameters.ContainsKey('httpauthentication') ) { $payload.Add('httpauthentication', $httpauthentication) } if ( $PSBoundParameters.ContainsKey('httpvia') ) { $payload.Add('httpvia', $httpvia) } if ( $PSBoundParameters.ContainsKey('httpxforwardedforheader') ) { $payload.Add('httpxforwardedforheader', $httpxforwardedforheader) } if ( $PSBoundParameters.ContainsKey('httpsetcookie') ) { $payload.Add('httpsetcookie', $httpsetcookie) } if ( $PSBoundParameters.ContainsKey('httpsetcookie2') ) { $payload.Add('httpsetcookie2', $httpsetcookie2) } if ( $PSBoundParameters.ContainsKey('httpdomainname') ) { $payload.Add('httpdomainname', $httpdomainname) } if ( $PSBoundParameters.ContainsKey('httpurlquery') ) { $payload.Add('httpurlquery', $httpurlquery) } if ( $PSBoundParameters.ContainsKey('tcpburstreporting') ) { $payload.Add('tcpburstreporting', $tcpburstreporting) } if ( $PSBoundParameters.ContainsKey('cqareporting') ) { $payload.Add('cqareporting', $cqareporting) } if ( $PSBoundParameters.ContainsKey('integratedcache') ) { $payload.Add('integratedcache', $integratedcache) } if ( $PSBoundParameters.ContainsKey('grpcstatus') ) { $payload.Add('grpcstatus', $grpcstatus) } if ( $PSBoundParameters.ContainsKey('outputmode') ) { $payload.Add('outputmode', $outputmode) } if ( $PSBoundParameters.ContainsKey('metrics') ) { $payload.Add('metrics', $metrics) } if ( $PSBoundParameters.ContainsKey('events') ) { $payload.Add('events', $events) } if ( $PSBoundParameters.ContainsKey('auditlogs') ) { $payload.Add('auditlogs', $auditlogs) } if ( $PSCmdlet.ShouldProcess("$name", "Unset Analytics configuration Object") ) { $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type analyticsprofile -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $response } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCUnsetAnalyticsprofile: Finished" } } function Invoke-ADCUpdateAnalyticsprofile { <# .SYNOPSIS Update Analytics configuration Object. .DESCRIPTION Configuration for Analytics profile resource. .PARAMETER Name Name for the analytics profile. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters. .PARAMETER Collectors The collector can be an IP, an appflow collector name, a service or a vserver. If IP is specified, the transport is considered as logstream and default port of 5557 is taken. If collector name is specified, the collector properties are taken from the configured collector. If service is specified, the configured service is assumed as the collector. If vserver is specified, the services bound to it are considered as collectors and the records are load balanced. .PARAMETER Type This option indicates what information needs to be collected and exported. Possible values = global, webinsight, tcpinsight, securityinsight, videoinsight, hdxinsight, gatewayinsight, timeseries, lsninsight, botinsight, CIinsight .PARAMETER Httpclientsidemeasurements On enabling this option, the Citrix ADC will insert a javascript into the HTTP response to collect the client side page-timings and will send the same to the configured collectors. Possible values = ENABLED, DISABLED .PARAMETER Httppagetracking On enabling this option, the Citrix ADC will link the embedded objects of a page together. Possible values = ENABLED, DISABLED .PARAMETER Httpurl On enabling this option, the Citrix ADC will log the URL in appflow records. Possible values = ENABLED, DISABLED .PARAMETER Httphost On enabling this option, the Citrix ADC will log the Host header in appflow records. Possible values = ENABLED, DISABLED .PARAMETER Httpmethod On enabling this option, the Citrix ADC will log the method header in appflow records. Possible values = ENABLED, DISABLED .PARAMETER Httpreferer On enabling this option, the Citrix ADC will log the referer header in appflow records. Possible values = ENABLED, DISABLED .PARAMETER Httpuseragent On enabling this option, the Citrix ADC will log User-Agent header. Possible values = ENABLED, DISABLED .PARAMETER Httpcookie On enabling this option, the Citrix ADC will log cookie header. Possible values = ENABLED, DISABLED .PARAMETER Httplocation On enabling this option, the Citrix ADC will log location header. Possible values = ENABLED, DISABLED .PARAMETER Urlcategory On enabling this option, the Citrix ADC will send the URL category record. Possible values = ENABLED, DISABLED .PARAMETER Allhttpheaders On enabling this option, the Citrix ADC will log all the request and response headers. Possible values = ENABLED, DISABLED .PARAMETER Httpcontenttype On enabling this option, the Citrix ADC will log content-length header. Possible values = ENABLED, DISABLED .PARAMETER Httpauthentication On enabling this option, the Citrix ADC will log Authentication header. Possible values = ENABLED, DISABLED .PARAMETER Httpvia On enabling this option, the Citrix ADC will Via header. Possible values = ENABLED, DISABLED .PARAMETER Httpxforwardedforheader On enabling this option, the Citrix ADC will log X-Forwarded-For header. Possible values = ENABLED, DISABLED .PARAMETER Httpsetcookie On enabling this option, the Citrix ADC will log set-cookie header. Possible values = ENABLED, DISABLED .PARAMETER Httpsetcookie2 On enabling this option, the Citrix ADC will log set-cookie2 header. Possible values = ENABLED, DISABLED .PARAMETER Httpdomainname On enabling this option, the Citrix ADC will log domain name. Possible values = ENABLED, DISABLED .PARAMETER Httpurlquery On enabling this option, the Citrix ADC will log URL Query. Possible values = ENABLED, DISABLED .PARAMETER Tcpburstreporting On enabling this option, the Citrix ADC will log TCP burst parameters. Possible values = ENABLED, DISABLED .PARAMETER Cqareporting On enabling this option, the Citrix ADC will log TCP CQA parameters. Possible values = ENABLED, DISABLED .PARAMETER Integratedcache On enabling this option, the Citrix ADC will log the Integrated Caching appflow records. Possible values = ENABLED, DISABLED .PARAMETER Grpcstatus On enabling this option, the Citrix ADC will log the gRPC status headers. Possible values = ENABLED, DISABLED .PARAMETER Outputmode This option indicates the format of REST API POST body. It depends on the consumer of the analytics data. Possible values = avro, prometheus, influx .PARAMETER Metrics This option indicates the whether metrics should be sent to the REST collector. Possible values = ENABLED, DISABLED .PARAMETER Events This option indicates the whether events should be sent to the REST collector. Possible values = ENABLED, DISABLED .PARAMETER Auditlogs This option indicates the whether auditlog should be sent to the REST collector. Possible values = ENABLED, DISABLED .PARAMETER PassThru Return details about the created analyticsprofile item. .EXAMPLE PS C:\>Invoke-ADCUpdateAnalyticsprofile -name <string> An example how to update analyticsprofile configuration Object(s). .NOTES File Name : Invoke-ADCUpdateAnalyticsprofile Version : v2111.2521 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/analytics/analyticsprofile/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [ValidateLength(1, 127)] [string]$Name, [ValidateScript({ $_.Length -gt 1 })] [string]$Collectors, [ValidateSet('global', 'webinsight', 'tcpinsight', 'securityinsight', 'videoinsight', 'hdxinsight', 'gatewayinsight', 'timeseries', 'lsninsight', 'botinsight', 'CIinsight')] [string]$Type, [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpclientsidemeasurements, [ValidateSet('ENABLED', 'DISABLED')] [string]$Httppagetracking, [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpurl, [ValidateSet('ENABLED', 'DISABLED')] [string]$Httphost, [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpmethod, [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpreferer, [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpuseragent, [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpcookie, [ValidateSet('ENABLED', 'DISABLED')] [string]$Httplocation, [ValidateSet('ENABLED', 'DISABLED')] [string]$Urlcategory, [ValidateSet('ENABLED', 'DISABLED')] [string]$Allhttpheaders, [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpcontenttype, [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpauthentication, [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpvia, [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpxforwardedforheader, [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpsetcookie, [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpsetcookie2, [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpdomainname, [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpurlquery, [ValidateSet('ENABLED', 'DISABLED')] [string]$Tcpburstreporting, [ValidateSet('ENABLED', 'DISABLED')] [string]$Cqareporting, [ValidateSet('ENABLED', 'DISABLED')] [string]$Integratedcache, [ValidateSet('ENABLED', 'DISABLED')] [string]$Grpcstatus, [ValidateSet('avro', 'prometheus', 'influx')] [string]$Outputmode, [ValidateSet('ENABLED', 'DISABLED')] [string]$Metrics, [ValidateSet('ENABLED', 'DISABLED')] [string]$Events, [ValidateSet('ENABLED', 'DISABLED')] [string]$Auditlogs, [Switch]$PassThru ) begin { Write-Verbose "Invoke-ADCUpdateAnalyticsprofile: Starting" } process { try { $payload = @{ name = $name } if ( $PSBoundParameters.ContainsKey('collectors') ) { $payload.Add('collectors', $collectors) } if ( $PSBoundParameters.ContainsKey('type') ) { $payload.Add('type', $type) } if ( $PSBoundParameters.ContainsKey('httpclientsidemeasurements') ) { $payload.Add('httpclientsidemeasurements', $httpclientsidemeasurements) } if ( $PSBoundParameters.ContainsKey('httppagetracking') ) { $payload.Add('httppagetracking', $httppagetracking) } if ( $PSBoundParameters.ContainsKey('httpurl') ) { $payload.Add('httpurl', $httpurl) } if ( $PSBoundParameters.ContainsKey('httphost') ) { $payload.Add('httphost', $httphost) } if ( $PSBoundParameters.ContainsKey('httpmethod') ) { $payload.Add('httpmethod', $httpmethod) } if ( $PSBoundParameters.ContainsKey('httpreferer') ) { $payload.Add('httpreferer', $httpreferer) } if ( $PSBoundParameters.ContainsKey('httpuseragent') ) { $payload.Add('httpuseragent', $httpuseragent) } if ( $PSBoundParameters.ContainsKey('httpcookie') ) { $payload.Add('httpcookie', $httpcookie) } if ( $PSBoundParameters.ContainsKey('httplocation') ) { $payload.Add('httplocation', $httplocation) } if ( $PSBoundParameters.ContainsKey('urlcategory') ) { $payload.Add('urlcategory', $urlcategory) } if ( $PSBoundParameters.ContainsKey('allhttpheaders') ) { $payload.Add('allhttpheaders', $allhttpheaders) } if ( $PSBoundParameters.ContainsKey('httpcontenttype') ) { $payload.Add('httpcontenttype', $httpcontenttype) } if ( $PSBoundParameters.ContainsKey('httpauthentication') ) { $payload.Add('httpauthentication', $httpauthentication) } if ( $PSBoundParameters.ContainsKey('httpvia') ) { $payload.Add('httpvia', $httpvia) } if ( $PSBoundParameters.ContainsKey('httpxforwardedforheader') ) { $payload.Add('httpxforwardedforheader', $httpxforwardedforheader) } if ( $PSBoundParameters.ContainsKey('httpsetcookie') ) { $payload.Add('httpsetcookie', $httpsetcookie) } if ( $PSBoundParameters.ContainsKey('httpsetcookie2') ) { $payload.Add('httpsetcookie2', $httpsetcookie2) } if ( $PSBoundParameters.ContainsKey('httpdomainname') ) { $payload.Add('httpdomainname', $httpdomainname) } if ( $PSBoundParameters.ContainsKey('httpurlquery') ) { $payload.Add('httpurlquery', $httpurlquery) } if ( $PSBoundParameters.ContainsKey('tcpburstreporting') ) { $payload.Add('tcpburstreporting', $tcpburstreporting) } if ( $PSBoundParameters.ContainsKey('cqareporting') ) { $payload.Add('cqareporting', $cqareporting) } if ( $PSBoundParameters.ContainsKey('integratedcache') ) { $payload.Add('integratedcache', $integratedcache) } if ( $PSBoundParameters.ContainsKey('grpcstatus') ) { $payload.Add('grpcstatus', $grpcstatus) } if ( $PSBoundParameters.ContainsKey('outputmode') ) { $payload.Add('outputmode', $outputmode) } if ( $PSBoundParameters.ContainsKey('metrics') ) { $payload.Add('metrics', $metrics) } if ( $PSBoundParameters.ContainsKey('events') ) { $payload.Add('events', $events) } if ( $PSBoundParameters.ContainsKey('auditlogs') ) { $payload.Add('auditlogs', $auditlogs) } if ( $PSCmdlet.ShouldProcess("analyticsprofile", "Update Analytics configuration Object") ) { $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type analyticsprofile -Payload $payload -GetWarning #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error if ( $PSBoundParameters.ContainsKey('PassThru') ) { Write-Output (Invoke-ADCGetAnalyticsprofile -Filter $payload) } else { Write-Output $result } } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCUpdateAnalyticsprofile: Finished" } } function Invoke-ADCAddAnalyticsprofile { <# .SYNOPSIS Add Analytics configuration Object. .DESCRIPTION Configuration for Analytics profile resource. .PARAMETER Name Name for the analytics profile. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters. .PARAMETER Collectors The collector can be an IP, an appflow collector name, a service or a vserver. If IP is specified, the transport is considered as logstream and default port of 5557 is taken. If collector name is specified, the collector properties are taken from the configured collector. If service is specified, the configured service is assumed as the collector. If vserver is specified, the services bound to it are considered as collectors and the records are load balanced. .PARAMETER Type This option indicates what information needs to be collected and exported. Possible values = global, webinsight, tcpinsight, securityinsight, videoinsight, hdxinsight, gatewayinsight, timeseries, lsninsight, botinsight, CIinsight .PARAMETER Httpclientsidemeasurements On enabling this option, the Citrix ADC will insert a javascript into the HTTP response to collect the client side page-timings and will send the same to the configured collectors. Possible values = ENABLED, DISABLED .PARAMETER Httppagetracking On enabling this option, the Citrix ADC will link the embedded objects of a page together. Possible values = ENABLED, DISABLED .PARAMETER Httpurl On enabling this option, the Citrix ADC will log the URL in appflow records. Possible values = ENABLED, DISABLED .PARAMETER Httphost On enabling this option, the Citrix ADC will log the Host header in appflow records. Possible values = ENABLED, DISABLED .PARAMETER Httpmethod On enabling this option, the Citrix ADC will log the method header in appflow records. Possible values = ENABLED, DISABLED .PARAMETER Httpreferer On enabling this option, the Citrix ADC will log the referer header in appflow records. Possible values = ENABLED, DISABLED .PARAMETER Httpuseragent On enabling this option, the Citrix ADC will log User-Agent header. Possible values = ENABLED, DISABLED .PARAMETER Httpcookie On enabling this option, the Citrix ADC will log cookie header. Possible values = ENABLED, DISABLED .PARAMETER Httplocation On enabling this option, the Citrix ADC will log location header. Possible values = ENABLED, DISABLED .PARAMETER Urlcategory On enabling this option, the Citrix ADC will send the URL category record. Possible values = ENABLED, DISABLED .PARAMETER Allhttpheaders On enabling this option, the Citrix ADC will log all the request and response headers. Possible values = ENABLED, DISABLED .PARAMETER Httpcontenttype On enabling this option, the Citrix ADC will log content-length header. Possible values = ENABLED, DISABLED .PARAMETER Httpauthentication On enabling this option, the Citrix ADC will log Authentication header. Possible values = ENABLED, DISABLED .PARAMETER Httpvia On enabling this option, the Citrix ADC will Via header. Possible values = ENABLED, DISABLED .PARAMETER Httpxforwardedforheader On enabling this option, the Citrix ADC will log X-Forwarded-For header. Possible values = ENABLED, DISABLED .PARAMETER Httpsetcookie On enabling this option, the Citrix ADC will log set-cookie header. Possible values = ENABLED, DISABLED .PARAMETER Httpsetcookie2 On enabling this option, the Citrix ADC will log set-cookie2 header. Possible values = ENABLED, DISABLED .PARAMETER Httpdomainname On enabling this option, the Citrix ADC will log domain name. Possible values = ENABLED, DISABLED .PARAMETER Httpurlquery On enabling this option, the Citrix ADC will log URL Query. Possible values = ENABLED, DISABLED .PARAMETER Tcpburstreporting On enabling this option, the Citrix ADC will log TCP burst parameters. Possible values = ENABLED, DISABLED .PARAMETER Cqareporting On enabling this option, the Citrix ADC will log TCP CQA parameters. Possible values = ENABLED, DISABLED .PARAMETER Integratedcache On enabling this option, the Citrix ADC will log the Integrated Caching appflow records. Possible values = ENABLED, DISABLED .PARAMETER Grpcstatus On enabling this option, the Citrix ADC will log the gRPC status headers. Possible values = ENABLED, DISABLED .PARAMETER Outputmode This option indicates the format of REST API POST body. It depends on the consumer of the analytics data. Possible values = avro, prometheus, influx .PARAMETER Metrics This option indicates the whether metrics should be sent to the REST collector. Possible values = ENABLED, DISABLED .PARAMETER Events This option indicates the whether events should be sent to the REST collector. Possible values = ENABLED, DISABLED .PARAMETER Auditlogs This option indicates the whether auditlog should be sent to the REST collector. Possible values = ENABLED, DISABLED .PARAMETER PassThru Return details about the created analyticsprofile item. .EXAMPLE PS C:\>Invoke-ADCAddAnalyticsprofile -name <string> -type <string> An example how to add analyticsprofile configuration Object(s). .NOTES File Name : Invoke-ADCAddAnalyticsprofile Version : v2111.2521 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/analytics/analyticsprofile/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [ValidateLength(1, 127)] [string]$Name, [ValidateScript({ $_.Length -gt 1 })] [string]$Collectors, [Parameter(Mandatory)] [ValidateSet('global', 'webinsight', 'tcpinsight', 'securityinsight', 'videoinsight', 'hdxinsight', 'gatewayinsight', 'timeseries', 'lsninsight', 'botinsight', 'CIinsight')] [string]$Type, [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpclientsidemeasurements = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Httppagetracking = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpurl = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Httphost = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpmethod = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpreferer = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpuseragent = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpcookie = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Httplocation = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Urlcategory = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Allhttpheaders = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpcontenttype = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpauthentication = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpvia = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpxforwardedforheader = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpsetcookie = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpsetcookie2 = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpdomainname = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Httpurlquery = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Tcpburstreporting = 'ENABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Cqareporting = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Integratedcache = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Grpcstatus = 'DISABLED', [ValidateSet('avro', 'prometheus', 'influx')] [string]$Outputmode = 'avro', [ValidateSet('ENABLED', 'DISABLED')] [string]$Metrics = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Events = 'DISABLED', [ValidateSet('ENABLED', 'DISABLED')] [string]$Auditlogs = 'DISABLED', [Switch]$PassThru ) begin { Write-Verbose "Invoke-ADCAddAnalyticsprofile: Starting" } process { try { $payload = @{ name = $name type = $type } if ( $PSBoundParameters.ContainsKey('collectors') ) { $payload.Add('collectors', $collectors) } if ( $PSBoundParameters.ContainsKey('httpclientsidemeasurements') ) { $payload.Add('httpclientsidemeasurements', $httpclientsidemeasurements) } if ( $PSBoundParameters.ContainsKey('httppagetracking') ) { $payload.Add('httppagetracking', $httppagetracking) } if ( $PSBoundParameters.ContainsKey('httpurl') ) { $payload.Add('httpurl', $httpurl) } if ( $PSBoundParameters.ContainsKey('httphost') ) { $payload.Add('httphost', $httphost) } if ( $PSBoundParameters.ContainsKey('httpmethod') ) { $payload.Add('httpmethod', $httpmethod) } if ( $PSBoundParameters.ContainsKey('httpreferer') ) { $payload.Add('httpreferer', $httpreferer) } if ( $PSBoundParameters.ContainsKey('httpuseragent') ) { $payload.Add('httpuseragent', $httpuseragent) } if ( $PSBoundParameters.ContainsKey('httpcookie') ) { $payload.Add('httpcookie', $httpcookie) } if ( $PSBoundParameters.ContainsKey('httplocation') ) { $payload.Add('httplocation', $httplocation) } if ( $PSBoundParameters.ContainsKey('urlcategory') ) { $payload.Add('urlcategory', $urlcategory) } if ( $PSBoundParameters.ContainsKey('allhttpheaders') ) { $payload.Add('allhttpheaders', $allhttpheaders) } if ( $PSBoundParameters.ContainsKey('httpcontenttype') ) { $payload.Add('httpcontenttype', $httpcontenttype) } if ( $PSBoundParameters.ContainsKey('httpauthentication') ) { $payload.Add('httpauthentication', $httpauthentication) } if ( $PSBoundParameters.ContainsKey('httpvia') ) { $payload.Add('httpvia', $httpvia) } if ( $PSBoundParameters.ContainsKey('httpxforwardedforheader') ) { $payload.Add('httpxforwardedforheader', $httpxforwardedforheader) } if ( $PSBoundParameters.ContainsKey('httpsetcookie') ) { $payload.Add('httpsetcookie', $httpsetcookie) } if ( $PSBoundParameters.ContainsKey('httpsetcookie2') ) { $payload.Add('httpsetcookie2', $httpsetcookie2) } if ( $PSBoundParameters.ContainsKey('httpdomainname') ) { $payload.Add('httpdomainname', $httpdomainname) } if ( $PSBoundParameters.ContainsKey('httpurlquery') ) { $payload.Add('httpurlquery', $httpurlquery) } if ( $PSBoundParameters.ContainsKey('tcpburstreporting') ) { $payload.Add('tcpburstreporting', $tcpburstreporting) } if ( $PSBoundParameters.ContainsKey('cqareporting') ) { $payload.Add('cqareporting', $cqareporting) } if ( $PSBoundParameters.ContainsKey('integratedcache') ) { $payload.Add('integratedcache', $integratedcache) } if ( $PSBoundParameters.ContainsKey('grpcstatus') ) { $payload.Add('grpcstatus', $grpcstatus) } if ( $PSBoundParameters.ContainsKey('outputmode') ) { $payload.Add('outputmode', $outputmode) } if ( $PSBoundParameters.ContainsKey('metrics') ) { $payload.Add('metrics', $metrics) } if ( $PSBoundParameters.ContainsKey('events') ) { $payload.Add('events', $events) } if ( $PSBoundParameters.ContainsKey('auditlogs') ) { $payload.Add('auditlogs', $auditlogs) } if ( $PSCmdlet.ShouldProcess("analyticsprofile", "Add Analytics configuration Object") ) { $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type analyticsprofile -Payload $payload -GetWarning #HTTP Status Code on Success: 201 Created #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error if ( $PSBoundParameters.ContainsKey('PassThru') ) { Write-Output (Invoke-ADCGetAnalyticsprofile -Filter $payload) } else { Write-Output $result } } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCAddAnalyticsprofile: Finished" } } function Invoke-ADCGetAnalyticsprofile { <# .SYNOPSIS Get Analytics configuration object(s). .DESCRIPTION Configuration for Analytics profile resource. .PARAMETER Name Name for the analytics profile. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters. .PARAMETER GetAll Retrieve all analyticsprofile object(s). .PARAMETER Count If specified, the count of the analyticsprofile object(s) will be returned. .PARAMETER Filter Specify a filter. -Filter @{ 'name'='<value>' } .PARAMETER ViewSummary When specified, only a summary of information is returned. .EXAMPLE PS C:\>Invoke-ADCGetAnalyticsprofile Get data. .EXAMPLE PS C:\>Invoke-ADCGetAnalyticsprofile -GetAll Get all analyticsprofile data. .EXAMPLE PS C:\>Invoke-ADCGetAnalyticsprofile -Count Get the number of analyticsprofile objects. .EXAMPLE PS C:\>Invoke-ADCGetAnalyticsprofile -name <string> Get analyticsprofile object by specifying for example the name. .EXAMPLE PS C:\>Invoke-ADCGetAnalyticsprofile -Filter @{ 'name'='<value>' } Get analyticsprofile data with a filter. .NOTES File Name : Invoke-ADCGetAnalyticsprofile Version : v2111.2521 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/analytics/analyticsprofile/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(DefaultParameterSetName = "GetAll")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(ParameterSetName = 'GetByResource')] [ValidateLength(1, 127)] [string]$Name, [Parameter(ParameterSetName = 'Count', Mandatory)] [Switch]$Count, [hashtable]$Filter = @{ }, [Parameter(ParameterSetName = 'GetAll')] [Switch]$GetAll, [Parameter(ParameterSetName = 'GetAll')] [Parameter(ParameterSetName = 'Get')] [Switch]$ViewSummary ) begin { Write-Verbose "Invoke-ADCGetAnalyticsprofile: Beginning" } process { try { if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) { $query = @{ } Write-Verbose "Retrieving all analyticsprofile objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type analyticsprofile -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) { if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } } Write-Verbose "Retrieving total count for analyticsprofile objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type analyticsprofile -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) { Write-Verbose "Retrieving analyticsprofile objects by arguments" $arguments = @{ } $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type analyticsprofile -NitroPath nitro/v1/config -Arguments $arguments -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) { Write-Verbose "Retrieving analyticsprofile configuration for property 'name'" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type analyticsprofile -NitroPath nitro/v1/config -Resource $name -Summary:$ViewSummary -Filter $Filter -GetWarning } else { Write-Verbose "Retrieving analyticsprofile configuration objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type analyticsprofile -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" $response = $null } Write-Output $response } end { Write-Verbose "Invoke-ADCGetAnalyticsprofile: Ended" } }
50.618776
472
0.668107
0b7345be2719bd8b7fdccdbf2d4ec3d3cec346b7
314
py
Python
Lower_Upper_Counter/Lower_Upper_Counter.py
GracjanBuczek/Python
655801ae58ed7ef21f7da2f69f649c556b20aaee
[ "MIT" ]
null
null
null
Lower_Upper_Counter/Lower_Upper_Counter.py
GracjanBuczek/Python
655801ae58ed7ef21f7da2f69f649c556b20aaee
[ "MIT" ]
null
null
null
Lower_Upper_Counter/Lower_Upper_Counter.py
GracjanBuczek/Python
655801ae58ed7ef21f7da2f69f649c556b20aaee
[ "MIT" ]
null
null
null
x = input("Enter sentence: ") count={"Uppercase":0, "Lowercase":0} for i in x: if i.isupper(): count["Uppercase"]+=1 elif i.islower(): count["Lowercase"]+=1 else: pass print ("There is:", count["Uppercase"], "uppercases.") print ("There is:", count["Lowercase"], "lowercases.")
26.166667
54
0.582803
663b6bf56f9581a7c7f9f30dccf82b71b22da176
1,530
cpp
C++
GetProcessCommandLine/ProcCmdLine/ProcessHelper.cpp
catcat0921/lindexi_gd
b64ab9d50821bf00b1587ebc30e6c17490f630c7
[ "MIT" ]
92
2016-01-03T02:48:36.000Z
2022-03-10T15:22:15.000Z
GetProcessCommandLine/ProcCmdLine/ProcessHelper.cpp
catcat0921/lindexi_gd
b64ab9d50821bf00b1587ebc30e6c17490f630c7
[ "MIT" ]
4
2019-07-13T00:04:12.000Z
2021-10-10T02:02:24.000Z
GetProcessCommandLine/ProcCmdLine/ProcessHelper.cpp
catcat0921/lindexi_gd
b64ab9d50821bf00b1587ebc30e6c17490f630c7
[ "MIT" ]
40
2016-02-24T12:01:49.000Z
2022-02-26T02:38:23.000Z
#include "ProcessHelper.h" PVOID CProcessHelper::GetPebAddress(HANDLE ProcessHandle){ _NtQueryInformationProcess NtQueryInformationProcess = (_NtQueryInformationProcess)GetProcAddress(GetModuleHandleA("ntdll.dll"), "NtQueryInformationProcess"); PROCESS_BASIC_INFORMATION pbi = { 0 }; NtQueryInformationProcess(ProcessHandle, 0, &pbi, sizeof(pbi), NULL); return pbi.PebBaseAddress; } bool CProcessHelper::GetProcessCommandLine(DWORD dwProcId, LPWSTR& szCmdLine){ szCmdLine = NULL; HANDLE processHandle = OpenProcess(PROCESS_QUERY_INFORMATION | /* required for NtQueryInformationProcess */ PROCESS_VM_READ, /* required for ReadProcessMemory */ FALSE, dwProcId); if (!processHandle){ return false; } PVOID pebAddress = GetPebAddress(processHandle); PVOID rtlUserProcParamsAddress; if (!ReadProcessMemory(processHandle, &(((_PEB*)pebAddress)->ProcessParameters), &rtlUserProcParamsAddress, sizeof(PVOID), NULL)){ CloseHandle(processHandle); return false; } UNICODE_STRING commandLine; if (!ReadProcessMemory(processHandle, &(((_RTL_USER_PROCESS_PARAMETERS*)rtlUserProcParamsAddress)->CommandLine), &commandLine, sizeof(commandLine), NULL)){ CloseHandle(processHandle); return false; } szCmdLine = new WCHAR[commandLine.MaximumLength]; memset(szCmdLine, 0, commandLine.MaximumLength); if (!ReadProcessMemory(processHandle, commandLine.Buffer, szCmdLine, commandLine.Length, NULL)){ delete szCmdLine; CloseHandle(processHandle); return false; } CloseHandle(processHandle); return true; }
34
159
0.79085
e8a2c7dbe52b53cbc73bb65b8a7f09b634207fd5
872
cpp
C++
Assignments/C++/operator_overloadingin_C++.cpp
ProProgrammer18/WCE2k24_Data_Structures
47fa8a9ead2a91b9e0fe11a0edae12ebddf5ddb0
[ "MIT" ]
null
null
null
Assignments/C++/operator_overloadingin_C++.cpp
ProProgrammer18/WCE2k24_Data_Structures
47fa8a9ead2a91b9e0fe11a0edae12ebddf5ddb0
[ "MIT" ]
null
null
null
Assignments/C++/operator_overloadingin_C++.cpp
ProProgrammer18/WCE2k24_Data_Structures
47fa8a9ead2a91b9e0fe11a0edae12ebddf5ddb0
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; class Time{ private: int hr, min; public: Time(){ hr = 0; min = 0; } void setTime(){ cout << "\nEnter the hour: "; cin >> hr; cout << "Enter the minute: "; cin >> min; } Time operator+(Time t1){ Time t; t.min = (min + t1.min)%60; t.hr = (min + t1.min)/60 + hr + t1.hr; t.hr %= 12; return t; } void display(){ cout<< hr<< ":"<< min; } }; int main(){ Time t1,t2,t3; cout << "Enter the current time: "; t1.setTime(); cout << "\nEnter the time to add: "; t2.setTime(); t3 = t1 + t2; cout << "\nInitial time: "; t1.display(); cout << "\nTime to add: "; t2.display(); cout << "\nSum of times: "; t3.display(); return 0; }
15.571429
46
0.440367
95cb9c4fc2c96a5e864e8509abe522297ede1ec2
260
sql
SQL
sql/jira/jira_clean_old_hipchat_data.sql
AndriiMaliuta/cleanup-scripts
037036c950e45591d11ecab26797ba1c01ba8516
[ "Apache-2.0" ]
26
2019-06-27T14:08:19.000Z
2022-02-06T10:27:55.000Z
sql/jira/jira_clean_old_hipchat_data.sql
AndriiMaliuta/cleanup-scripts
037036c950e45591d11ecab26797ba1c01ba8516
[ "Apache-2.0" ]
2
2020-03-07T18:25:05.000Z
2022-01-09T10:24:18.000Z
sql/jira/jira_clean_old_hipchat_data.sql
AndriiMaliuta/cleanup-scripts
037036c950e45591d11ecab26797ba1c01ba8516
[ "Apache-2.0" ]
16
2019-02-06T13:35:49.000Z
2022-03-04T13:43:48.000Z
-- detect old HipChat history SELECT count(id) FROM entity_property WHERE ENTITY_NAME = 'hipchat.integration.caches.issue-mentions'; /* -- cleaning that old data DELETE FROM entity_property WHERE ENTITY_NAME = 'hipchat.integration.caches.issue-mentions'; */
20
64
0.788462
df42501b763b982ce3896d9c2caf5d400e1c9a68
167
tab
SQL
ToolsOutputs/ENST00000383036vsENST00000215479_rMATS/SampleFiles/BAM_ENST00000383036andENST00000215479/BAM_ENST00000383036/SJ.out.tab
MattiaPrevitali/comparisonASSW
47025101006aa20704071ea0ba98bf528fc7cf03
[ "MIT" ]
null
null
null
ToolsOutputs/ENST00000383036vsENST00000215479_rMATS/SampleFiles/BAM_ENST00000383036andENST00000215479/BAM_ENST00000383036/SJ.out.tab
MattiaPrevitali/comparisonASSW
47025101006aa20704071ea0ba98bf528fc7cf03
[ "MIT" ]
null
null
null
ToolsOutputs/ENST00000383036vsENST00000215479_rMATS/SampleFiles/BAM_ENST00000383036andENST00000215479/BAM_ENST00000383036/SJ.out.tab
MattiaPrevitali/comparisonASSW
47025101006aa20704071ea0ba98bf528fc7cf03
[ "MIT" ]
null
null
null
Y 6866079 6868036 2 2 1 132 0 6 Y 6868463 6868731 2 2 1 1030 0 45 Y 6868777 6868867 2 2 1 1129 0 44 Y 6868910 6870005 2 2 1 1057 0 44 Y 6870054 6872554 2 2 1 482 0 48
27.833333
33
0.730539
ea254762d3254563e896bd8696e1d05611beffd1
708
asm
Assembly
oeis/287/A287063.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/287/A287063.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/287/A287063.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A287063: Number of dominating sets in the n-crown graph (for n > 1). ; Submitted by Christian Krause ; 3,9,39,183,833,3629,15291,63051,256605,1036401,4167815,16720031,66986169,268173525,1073185011,4293787923,17177379125,68714234201,274866897279,1099488559527,4397998277073,17592085381629,70368534463019,281474540503643,1125899000873613,4503597748323009,18014394617168631,72057585984865071,288230359508714345,1152921470247109541,4611685947560428515,18446743927680664611,73786975994190496869,295147904560877536425,1180591619446100985071,4722366480258305099063,18889465926118461670785 add $0,1 mov $1,$0 mov $2,2 pow $2,$0 sub $0,$2 add $0,1 pow $0,2 sub $2,1 mul $2,$1 sub $2,$0 mul $0,2 add $0,$2 add $0,2
39.333333
480
0.823446
dbe5c9e9056e9d6a7964792aff985e0095acb0a4
832
dart
Dart
flutter_app/lib/driver/list_test_driver.dart
math1024/Demos_flutter
d6a2bf94118c531279086f89ae4cb241e845bdb4
[ "MIT" ]
null
null
null
flutter_app/lib/driver/list_test_driver.dart
math1024/Demos_flutter
d6a2bf94118c531279086f89ae4cb241e845bdb4
[ "MIT" ]
null
null
null
flutter_app/lib/driver/list_test_driver.dart
math1024/Demos_flutter
d6a2bf94118c531279086f89ae4cb241e845bdb4
[ "MIT" ]
null
null
null
import 'package:flutter/material.dart'; class ListForDriver extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('list test driver'), ), body: _buildList(List<String>.generate(1000, (i) => "Item $i")), ); } _buildList(List<String> list) { return ListView.builder( key: Key('long_list'), itemCount: list.length, itemBuilder: (context, index) { return ListTile( title: Text( '${list[index]}', // Add a key to the Text widget for each item. This makes // it possible to look for a particular item in the list // and verify that the text is correct key: Key('item_${index}_text'), ), ); }, ); } }
26
70
0.564904
d28772f0ba080c3567b4370abb9552f12c2cd246
1,023
php
PHP
tests/Test/ConstrainedTestItem.php
valkan07/BoxPacker
8fec7abb3da97bbb3267e7b9b9192b32db7965b9
[ "MIT" ]
null
null
null
tests/Test/ConstrainedTestItem.php
valkan07/BoxPacker
8fec7abb3da97bbb3267e7b9b9192b32db7965b9
[ "MIT" ]
null
null
null
tests/Test/ConstrainedTestItem.php
valkan07/BoxPacker
8fec7abb3da97bbb3267e7b9b9192b32db7965b9
[ "MIT" ]
null
null
null
<?php /** * Box packing (3D bin packing, knapsack problem). * * @author Doug Wright */ declare(strict_types=1); namespace DVDoug\BoxPacker\Test; use DVDoug\BoxPacker\Box; use DVDoug\BoxPacker\ConstrainedItem; use DVDoug\BoxPacker\PackedItem; use DVDoug\BoxPacker\PackedItemList; use function count; use function iterator_to_array; class ConstrainedTestItem extends TestItem implements ConstrainedItem { /** * @var int */ public static $limit = 3; /** * @param PackedItemList $alreadyPackedItems * @param Box $box * * @return bool */ public function canBePackedInBox(PackedItemList $alreadyPackedItems, Box $box): bool { $alreadyPackedType = array_filter( iterator_to_array($alreadyPackedItems, false), function (PackedItem $item) { return $item->getItem()->getDescription() === $this->getDescription(); } ); return count($alreadyPackedType) + 1 <= static::$limit; } }
23.790698
88
0.645161
cc51a797a54c87e2a3ed7a5fc4db78f604b77bd7
135
sql
SQL
Weather Observation Station 10.sql
prateek-code-22/HackerRank_SQL_Solution
9fdef597cd9d7f5db08a3c20f99b138add7f77d7
[ "MIT" ]
1
2021-02-23T12:43:38.000Z
2021-02-23T12:43:38.000Z
Weather Observation Station 10.sql
prateek-code-22/HackerRank_SQL_Solution
9fdef597cd9d7f5db08a3c20f99b138add7f77d7
[ "MIT" ]
null
null
null
Weather Observation Station 10.sql
prateek-code-22/HackerRank_SQL_Solution
9fdef597cd9d7f5db08a3c20f99b138add7f77d7
[ "MIT" ]
null
null
null
select distinct city from station where not (city like '%a' or city like '%e' or city like '%i' or city like '%o' or city like '%u')
45
98
0.666667
ece16f84be52b065c6084759142c4deee8d58edc
354
kt
Kotlin
src/main/java/com/dzen/campfire/server/executors/accounts/EAccountsGetCaptchaSiteKey.kt
ZeonXX/CampfireServer
e6d8777b86077afccf10a646390de811791202fc
[ "Apache-2.0" ]
null
null
null
src/main/java/com/dzen/campfire/server/executors/accounts/EAccountsGetCaptchaSiteKey.kt
ZeonXX/CampfireServer
e6d8777b86077afccf10a646390de811791202fc
[ "Apache-2.0" ]
null
null
null
src/main/java/com/dzen/campfire/server/executors/accounts/EAccountsGetCaptchaSiteKey.kt
ZeonXX/CampfireServer
e6d8777b86077afccf10a646390de811791202fc
[ "Apache-2.0" ]
2
2021-12-31T10:05:20.000Z
2022-01-01T16:01:21.000Z
package com.dzen.campfire.server.executors.accounts import com.dzen.campfire.api.requests.accounts.RAccountsGetCaptchaSiteKey import com.dzen.campfire.server.app.App class EAccountsGetCaptchaSiteKey : RAccountsGetCaptchaSiteKey() { override fun check() {} override fun execute(): Response { return Response(App.hcaptchaSiteKey) } }
29.5
73
0.776836
74d1a82a46284750afbeb1efa1108f150f0dd075
564
js
JavaScript
freeCodeCamp_JS/dropIt.js
rjjanney/after-effects_nodeJS
c9b45f98d08c15ce147b88908a1929fd6c5a72dd
[ "MIT" ]
null
null
null
freeCodeCamp_JS/dropIt.js
rjjanney/after-effects_nodeJS
c9b45f98d08c15ce147b88908a1929fd6c5a72dd
[ "MIT" ]
null
null
null
freeCodeCamp_JS/dropIt.js
rjjanney/after-effects_nodeJS
c9b45f98d08c15ce147b88908a1929fd6c5a72dd
[ "MIT" ]
null
null
null
function dropElements(arr, func) { // Drop them elements. "use strict" let arrCopy = arr.concat([]); for (let i = 0; i < arr.length; i++) { let test = arrCopy.shift(); console.log(test); if (func(test)){ arrCopy.unshift(test); console.log(arrCopy); return arrCopy; } } return []; } dropElements([1, 2, 3], function(n) {return n < 3; }); dropElements([1, 2, 3, 4], function(n) {return n >= 3;}); dropElements([0, 1, 0, 1], function(n) {return n === 1;}); dropElements([1, 2, 3, 4], function(n) {return n > 5;})
22.56
58
0.56383
6eadd23a03ed2368098100938481e93f6280a493
15,745
swift
Swift
Sources/Skyflow/core/Client.swift
skyflowapi/skyflow-iOS
464279c8e4bea11d0a28f3e04fefcb39442b4344
[ "MIT" ]
null
null
null
Sources/Skyflow/core/Client.swift
skyflowapi/skyflow-iOS
464279c8e4bea11d0a28f3e04fefcb39442b4344
[ "MIT" ]
1
2022-03-23T10:49:26.000Z
2022-03-23T10:49:26.000Z
Sources/Skyflow/core/Client.swift
skyflowapi/skyflow-iOS
464279c8e4bea11d0a28f3e04fefcb39442b4344
[ "MIT" ]
null
null
null
// // File.swift // // // Created by Akhil Anil Mangala on 19/07/21. // import Foundation import AEXML public class Client { var vaultID: String var apiClient: APIClient var vaultURL: String var contextOptions: ContextOptions var elementLookup: [String: Any] = [:] public init(_ skyflowConfig: Configuration) { self.vaultID = skyflowConfig.vaultID self.vaultURL = skyflowConfig.vaultURL.hasSuffix("/") ? skyflowConfig.vaultURL + "v1/vaults/" : skyflowConfig.vaultURL + "/v1/vaults/" self.apiClient = APIClient(vaultID: skyflowConfig.vaultID, vaultURL: self.vaultURL, tokenProvider: skyflowConfig.tokenProvider) self.contextOptions = ContextOptions(logLevel: skyflowConfig.options!.logLevel, env: skyflowConfig.options!.env, interface: .CLIENT) Log.info(message: .CLIENT_INITIALIZED, contextOptions: self.contextOptions) } public func insert(records: [String: Any], options: InsertOptions = InsertOptions(), callback: Callback) { var tempContextOptions = self.contextOptions tempContextOptions.interface = .INSERT Log.info(message: .INSERT_TRIGGERED, contextOptions: tempContextOptions) if self.vaultID.isEmpty { let errorCode = ErrorCodes.EMPTY_VAULT_ID() return callback.onFailure(errorCode.getErrorObject(contextOptions: tempContextOptions)) } if self.vaultURL == "/v1/vaults/" { let errorCode = ErrorCodes.EMPTY_VAULT_URL() return callback.onFailure(errorCode.getErrorObject(contextOptions: tempContextOptions)) } let icOptions = ICOptions(tokens: options.tokens) var errorCode: ErrorCodes? if records["records"] == nil { errorCode = .RECORDS_KEY_ERROR() callback.onFailure(errorCode!.getErrorObject(contextOptions: tempContextOptions)) return } Log.info(message: .VALIDATE_RECORDS, contextOptions: tempContextOptions) if let recordEntries = records["records"] as? [[String: Any]] { for record in recordEntries { if record["table"] != nil { if !(record["table"] is String) { errorCode = .INVALID_TABLE_NAME_TYPE() } else { if (record["table"] as! String).isEmpty { errorCode = .EMPTY_TABLE_NAME() } else { if record["fields"] != nil { if !(record["fields"] is [String: Any]) { errorCode = .INVALID_FIELDS_TYPE() break } let fields = record["fields"] as! [String: Any] if fields.isEmpty { errorCode = .EMPTY_FIELDS_KEY() } } else { errorCode = .FIELDS_KEY_ERROR() } } } } else { errorCode = .TABLE_KEY_ERROR() } } if errorCode != nil { callback.onFailure(errorCode!.getErrorObject(contextOptions: tempContextOptions)) return } else { let logCallback = LogCallback(clientCallback: callback, contextOptions: tempContextOptions, onSuccessHandler: { Log.info(message: .INSERT_DATA_SUCCESS, contextOptions: tempContextOptions) }, onFailureHandler: { } ) self.apiClient.post(records: records, callback: logCallback, options: icOptions, contextOptions: tempContextOptions) } } else { errorCode = .INVALID_RECORDS_TYPE() callback.onFailure(errorCode!.getErrorObject(contextOptions: tempContextOptions)) } } public func container<T>(type: T.Type, options: ContainerOptions? = ContainerOptions()) -> Container<T>? { if options != nil { // Set options } if T.self == CollectContainer.self { Log.info(message: .COLLECT_CONTAINER_CREATED, contextOptions: self.contextOptions) return Container<T>(skyflow: self) } if T.self == RevealContainer.self { Log.info(message: .REVEAL_CONTAINER_CREATED, contextOptions: self.contextOptions) return Container<T>(skyflow: self) } return nil } public func detokenize(records: [String: Any], options: RevealOptions? = RevealOptions(), callback: Callback) { var tempContextOptions = self.contextOptions tempContextOptions.interface = .DETOKENIZE func checkRecord(_ token: [String: Any]) -> ErrorCodes? { if token["token"] == nil { return .ID_KEY_ERROR() } else { guard let _ = token["token"] as? String else { return .INVALID_TOKEN_TYPE() } } return nil } Log.info(message: .DETOKENIZE_TRIGGERED, contextOptions: tempContextOptions) if self.vaultID.isEmpty { let errorCode = ErrorCodes.EMPTY_VAULT_ID() return callRevealOnFailure(callback: callback, errorObject: errorCode.getErrorObject(contextOptions: tempContextOptions)) } if self.vaultURL == "/v1/vaults/" { let errorCode = ErrorCodes.EMPTY_VAULT_URL() return callRevealOnFailure(callback: callback, errorObject: errorCode.getErrorObject(contextOptions: tempContextOptions)) } Log.info(message: .VALIDATE_DETOKENIZE_INPUT, contextOptions: tempContextOptions) if records["records"] == nil { return callRevealOnFailure(callback: callback, errorObject: ErrorCodes.RECORDS_KEY_ERROR().getErrorObject(contextOptions: tempContextOptions)) } if let tokens = records["records"] as? [[String: Any]] { var list: [RevealRequestRecord] = [] if tokens.isEmpty { return callRevealOnFailure(callback: callback, errorObject: ErrorCodes.EMPTY_RECORDS_OBJECT().getErrorObject(contextOptions: tempContextOptions)) } for token in tokens { let errorCode = checkRecord(token) if errorCode == nil, let id = token["token"] as? String { list.append(RevealRequestRecord(token: id)) } else { return callRevealOnFailure(callback: callback, errorObject: errorCode!.getErrorObject(contextOptions: tempContextOptions)) } } let logCallback = LogCallback(clientCallback: callback, contextOptions: tempContextOptions, onSuccessHandler: { Log.info(message: .DETOKENIZE_SUCCESS, contextOptions: tempContextOptions) }, onFailureHandler: { } ) self.apiClient.get(records: list, callback: logCallback, contextOptions: tempContextOptions) } else { callRevealOnFailure(callback: callback, errorObject: ErrorCodes.INVALID_RECORDS_TYPE().getErrorObject(contextOptions: tempContextOptions)) } } public func getById(records: [String: Any], callback: Callback) { var tempContextOptions = self.contextOptions tempContextOptions.interface = .GETBYID Log.info(message: .GET_BY_ID_TRIGGERED, contextOptions: tempContextOptions) if self.vaultID.isEmpty { let errorCode = ErrorCodes.EMPTY_VAULT_ID() return callRevealOnFailure(callback: callback, errorObject: errorCode.getErrorObject(contextOptions: tempContextOptions)) } if self.vaultURL == "/v1/vaults/" { let errorCode = ErrorCodes.EMPTY_VAULT_URL() return callRevealOnFailure(callback: callback, errorObject: errorCode.getErrorObject(contextOptions: tempContextOptions)) } Log.info(message: .VALIDATE_GET_BY_ID_INPUT, contextOptions: tempContextOptions) func checkEntry(entry: [String: Any]) -> ErrorCodes? { if entry.isEmpty { return .EMPTY_RECORDS_OBJECT() } if entry["ids"] == nil { return .MISSING_KEY_IDS() } if !(entry["ids"] is [String]) { return .INVALID_IDS_TYPE() } if ((entry["ids"] as? [String])?.count == 0) { return .EMPTY_IDS() } let ids = entry["ids"] as! [String] for id in ids { if (id == "") { return .EMPTY_ID_VALUE() } } if entry["table"] == nil { return .TABLE_KEY_ERROR() } if !(entry["table"] is String) { return .INVALID_TABLE_NAME_TYPE() } if ((entry["table"] as? String) == "") { return .EMPTY_TABLE_NAME() } if entry["redaction"] == nil { return .REDACTION_KEY_ERROR() } if (entry["redaction"] as? RedactionType) != nil { return nil } else { return .INVALID_REDACTION_TYPE(value: entry["redaction"] as! String) } } if records["records"] == nil { return callRevealOnFailure(callback: callback, errorObject: ErrorCodes.EMPTY_RECORDS_OBJECT().getErrorObject(contextOptions: tempContextOptions)) //Check } if let entries = records["records"] as? [[String: Any]] { var list: [GetByIdRecord] = [] if entries.isEmpty { return callRevealOnFailure(callback: callback, errorObject: ErrorCodes.EMPTY_RECORDS_OBJECT().getErrorObject(contextOptions: tempContextOptions)) } for entry in entries { let errorCode = checkEntry(entry: entry) if errorCode != nil { return callRevealOnFailure(callback: callback, errorObject: errorCode!.getErrorObject(contextOptions: tempContextOptions)) } else { if let ids = entry["ids"] as? [String], let table = entry["table"] as? String, let redaction = entry["redaction"] as? RedactionType { list.append(GetByIdRecord(ids: ids, table: table, redaction: redaction.rawValue)) } } } let logCallback = LogCallback(clientCallback: callback, contextOptions: tempContextOptions, onSuccessHandler: { Log.info(message: .GET_BY_ID_SUCCESS, contextOptions: tempContextOptions) }, onFailureHandler: { } ) self.apiClient.getById(records: list, callback: logCallback, contextOptions: tempContextOptions) } else { callRevealOnFailure(callback: callback, errorObject: ErrorCodes.INVALID_RECORDS_TYPE().getErrorObject(contextOptions: tempContextOptions)) } } private func callRevealOnFailure(callback: Callback, errorObject: Error) { let result = ["errors": [errorObject]] callback.onFailure(result) } public func invokeConnection(config: ConnectionConfig, callback: Callback) { var tempContextOptions = self.contextOptions tempContextOptions.interface = .INVOKE_CONNECTION Log.info(message: .INVOKE_CONNECTION_TRIGGERED, contextOptions: tempContextOptions) let connectionAPIClient = ConnectionAPIClient(callback: callback, contextOptions: tempContextOptions) do { let connectionTokenCallback = ConnectionTokenCallback( client: connectionAPIClient, connectionType: .REST, config: try config.convert(contextOptions: tempContextOptions), clientCallback: callback) self.apiClient.getAccessToken(callback: connectionTokenCallback, contextOptions: tempContextOptions) } catch { callRevealOnFailure(callback: callback, errorObject: error) } } public func invokeSoapConnection(config: SoapConnectionConfig, callback: Callback) { var tempContextOptions = self.contextOptions tempContextOptions.interface = .INVOKE_CONNECTION Log.info(message: .INVOKE_CONNECTION_TRIGGERED, contextOptions: tempContextOptions) if config.connectionURL.isEmpty { let errorCode = ErrorCodes.EMPTY_CONNECTION_URL() return callback.onFailure(errorCode.getErrorObject(contextOptions: tempContextOptions)) } if config.requestXML.isEmpty { let errorCode = ErrorCodes.EMPTY_REQUEST_XML() return callback.onFailure(errorCode.getErrorObject(contextOptions: tempContextOptions)) } do { let requestXMLDocument = try AEXMLDocument(xml: config.requestXML) } catch { let errorCode = ErrorCodes.INVALID_REQUEST_XML() return callback.onFailure(errorCode.getErrorObject(contextOptions: tempContextOptions)) } let soapConnectionAPIClient = SoapConnectionAPIClient(callback: callback, skyflow: self, contextOptions: tempContextOptions) let soapConnectionTokenCallback = ConnectionTokenCallback(client: soapConnectionAPIClient, connectionType: .SOAP, config: config, clientCallback: callback) self.apiClient.getAccessToken(callback: soapConnectionTokenCallback, contextOptions: tempContextOptions) } } private class ConnectionTokenCallback: Callback { var client: Any var config: Any var clientCallback: Callback var connectionType: ConnectionType init(client: Any, connectionType: ConnectionType, config: Any, clientCallback: Callback) { self.client = client self.config = config self.clientCallback = clientCallback self.connectionType = connectionType } func onSuccess(_ responseBody: Any) { do { if connectionType == .REST { try (client as! ConnectionAPIClient).invokeConnection( token: responseBody as! String, config: config as! ConnectionConfig) } else { try (client as! SoapConnectionAPIClient).invokeSoapConnection(token: responseBody as! String, config: config as! SoapConnectionConfig) } } catch { clientCallback.onFailure(error) } } func onFailure(_ error: Any) { clientCallback.onFailure(error) } } internal class LogCallback: Callback { var clientCallback: Callback var contextOptions: ContextOptions var onSuccessHandler: () -> Void var onFailureHandler: () -> Void public init(clientCallback: Callback, contextOptions: ContextOptions, onSuccessHandler: @escaping () -> Void, onFailureHandler: @escaping () -> Void) { self.clientCallback = clientCallback self.contextOptions = contextOptions self.onSuccessHandler = onSuccessHandler self.onFailureHandler = onFailureHandler } func onSuccess(_ responseBody: Any) { self.onSuccessHandler() clientCallback.onSuccess(responseBody) } func onFailure(_ error: Any) { self.onFailureHandler() clientCallback.onFailure(error) } } internal enum ConnectionType { case REST case SOAP }
43.857939
165
0.603557
0ce7201689d9142cf85fb513dc2bf55a86b13523
475
py
Python
car/migrations/0004_sale_cc.py
jobkarani/carnect
8675d025e56fc07439b88e873e72a21cbbe747a9
[ "MIT" ]
null
null
null
car/migrations/0004_sale_cc.py
jobkarani/carnect
8675d025e56fc07439b88e873e72a21cbbe747a9
[ "MIT" ]
null
null
null
car/migrations/0004_sale_cc.py
jobkarani/carnect
8675d025e56fc07439b88e873e72a21cbbe747a9
[ "MIT" ]
null
null
null
# Generated by Django 3.2.9 on 2022-01-10 12:39 from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('car', '0003_auto_20220110_1507'), ] operations = [ migrations.AddField( model_name='sale', name='cc', field=models.CharField(default=django.utils.timezone.now, max_length=100), preserve_default=False, ), ]
22.619048
86
0.621053
fbca039610feb481e1609c8fcecd5e98db7813af
95
h
C
c++Project/lib/Qt/5.8/gcc_64/include/QtBluetooth/5.8.0/QtBluetooth/private/qtbluetooth-config_p.h
mattlas/Computer-Vision
87a9e6e68e97af17638eb355c6351f85129a4391
[ "BSD-2-Clause-FreeBSD" ]
1
2017-07-03T08:33:45.000Z
2017-07-03T08:33:45.000Z
c++Project/lib/Qt/5.8/gcc_64/include/QtBluetooth/5.8.0/QtBluetooth/private/qtbluetooth-config_p.h
mattlas/Computer-Vision
87a9e6e68e97af17638eb355c6351f85129a4391
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
c++Project/lib/Qt/5.8/gcc_64/include/QtBluetooth/5.8.0/QtBluetooth/private/qtbluetooth-config_p.h
mattlas/Computer-Vision
87a9e6e68e97af17638eb355c6351f85129a4391
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
#define QT_FEATURE_bluez 1 #define QT_FEATURE_bluez_le 1 #define QT_FEATURE_linux_crypto_api 1
23.75
37
0.873684
85b38eace7198e089aa5e4fcdf67ef5d1f4603db
5,070
h
C
PrmPkg/Include/PrmExportDescriptor.h
mefff/edk2
0a4019ec9de64c6565ea545dc8d847afe2b30d6c
[ "Python-2.0", "Zlib", "BSD-2-Clause", "MIT", "BSD-2-Clause-Patent", "BSD-3-Clause" ]
null
null
null
PrmPkg/Include/PrmExportDescriptor.h
mefff/edk2
0a4019ec9de64c6565ea545dc8d847afe2b30d6c
[ "Python-2.0", "Zlib", "BSD-2-Clause", "MIT", "BSD-2-Clause-Patent", "BSD-3-Clause" ]
null
null
null
PrmPkg/Include/PrmExportDescriptor.h
mefff/edk2
0a4019ec9de64c6565ea545dc8d847afe2b30d6c
[ "Python-2.0", "Zlib", "BSD-2-Clause", "MIT", "BSD-2-Clause-Patent", "BSD-3-Clause" ]
1
2021-12-23T07:59:29.000Z
2021-12-23T07:59:29.000Z
/** @file Definitions for the Platform Runtime Mechanism (PRM) export descriptor structures. Copyright (c) Microsoft Corporation SPDX-License-Identifier: BSD-2-Clause-Patent **/ #ifndef PRM_EXPORT_DESCRIPTOR_H_ #define PRM_EXPORT_DESCRIPTOR_H_ #include <Prm.h> #define PRM_MODULE_EXPORT_DESCRIPTOR_NAME PrmModuleExportDescriptor #define PRM_MODULE_EXPORT_DESCRIPTOR_SIGNATURE SIGNATURE_64 ('P', 'R', 'M', '_', 'M', 'E', 'D', 'T') #define PRM_MODULE_EXPORT_REVISION 0x0 // // Platform Runtime Mechanism (PRM) Export Descriptor Structures // #pragma pack(push, 1) typedef struct { GUID PrmHandlerGuid; CHAR8 PrmHandlerName[PRM_HANDLER_NAME_MAXIMUM_LENGTH]; } PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT; typedef struct { UINT64 Signature; UINT16 Revision; UINT16 NumberPrmHandlers; GUID PlatformGuid; GUID ModuleGuid; } PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER; typedef struct { PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER Header; PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT PrmHandlerExportDescriptors[1]; } PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT; #pragma pack(pop) #if defined (_MSC_VER) #define PRM_PACKED_STRUCT(definition) \ __pragma(pack(push, 1)) typedef struct definition __pragma(pack(pop)) #elif defined (__GNUC__) || defined (__clang__) #define PRM_PACKED_STRUCT(definition) \ typedef struct __attribute__((packed)) definition #endif /** A macro that declares a PRM Handler Export Descriptor for a PRM Handler. This macro is intended to be used once per PRM Handler to describe the handler when the module description is defined. It should be provided as an argument to PRM_MODULE_EXPORT. @param Guid The GUID of the PRM Handler being exported. @param Name The name of the PRM Handler being exported. This string should exactly match the function name. **/ #define PRM_HANDLER_EXPORT_ENTRY(Guid, Name) \ { \ Guid, \ PRM_STRING_(Name) \ } \ /** A macro that returns the count of the number of variable-length arguments given. @param VariableArgumentList A variable argument list of elements that will be included in the return value of the list count. **/ #define VA_ARG_COUNT(...) (sizeof((PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT[]){__VA_ARGS__})/sizeof(PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT)) /** A macro that declares the PRM Module Export Descriptor for a PRM Module. This macro is intended to be used once in a PRM Module after all of the PRM Handler definitions to describe the PRM Handlers being exported in the module. @param PrmHandlerExportEntries A variable argument list of PRM_HANDLER_EXPORT_ENTRY values. This list should include all PRM Handlers being exported by this module. **/ #define PRM_MODULE_EXPORT(...) \ PRM_PACKED_STRUCT( \ { \ PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER Header; \ PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT PrmHandlerExportDescriptors[VA_ARG_COUNT(__VA_ARGS__)]; \ } PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_ \ ); \ \ PRM_EXPORT_API PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_ PRM_MODULE_EXPORT_DESCRIPTOR_NAME = { \ { \ PRM_MODULE_EXPORT_DESCRIPTOR_SIGNATURE, \ PRM_MODULE_EXPORT_REVISION, \ VA_ARG_COUNT(__VA_ARGS__), \ EDKII_DSC_PLATFORM_GUID, \ EFI_CALLER_ID_GUID \ }, \ { __VA_ARGS__ } \ } \ #endif
46.090909
136
0.498619
c3ecdb0d270ec0696818e3424c850192dbc61059
129
sql
SQL
db/src/main/resources/db/migration/V1_015__add_next_payment_date_to_claim.sql
DepartmentOfHealth-htbhf/htbhf-claimant-service
3b96e2ffb8ea422d2190b08ecc18887c1e96565a
[ "MIT" ]
2
2019-10-03T10:37:56.000Z
2021-03-06T14:26:48.000Z
db/src/main/resources/db/migration/V1_015__add_next_payment_date_to_claim.sql
DepartmentOfHealth-htbhf/htbhf-claimant-service
3b96e2ffb8ea422d2190b08ecc18887c1e96565a
[ "MIT" ]
41
2018-12-20T12:43:23.000Z
2020-01-31T13:18:00.000Z
db/src/main/resources/db/migration/V1_015__add_next_payment_date_to_claim.sql
DepartmentOfHealth-htbhf/htbhf-claimant-service
3b96e2ffb8ea422d2190b08ecc18887c1e96565a
[ "MIT" ]
3
2020-01-24T14:24:02.000Z
2020-01-24T14:53:25.000Z
alter table claim add column next_payment_date TIMESTAMP; create index claim_next_payment_date_idx on claim(next_payment_date);
32.25
69
0.868217
aeacaed02fae5ada3427cf8c401bfae41091c56c
1,108
asm
Assembly
platform/mcu/imx6/imx6_platform_sdk/lwip/contrib/ports/blackfin/TestVDK/ExceptionHandler-BF537.asm
jinlongliu/AliOS-Things
ce051172a775f987183e7aca88bb6f3b809ea7b0
[ "Apache-2.0" ]
9
2018-07-16T08:36:21.000Z
2021-04-04T13:27:49.000Z
platform/mcu/imx6/imx6_platform_sdk/lwip/contrib/ports/blackfin/TestVDK/ExceptionHandler-BF537.asm
IamBaoMouMou/AliOS-Things
195a9160b871b3d78de6f8cf6c2ab09a71977527
[ "Apache-2.0" ]
3
2018-12-17T13:06:46.000Z
2018-12-28T01:40:59.000Z
platform/mcu/imx6/imx6_platform_sdk/lwip/contrib/ports/blackfin/TestVDK/ExceptionHandler-BF537.asm
IamBaoMouMou/AliOS-Things
195a9160b871b3d78de6f8cf6c2ab09a71977527
[ "Apache-2.0" ]
7
2018-08-31T05:57:55.000Z
2021-05-26T16:23:52.000Z
/* ============================================================================= * * Description: This is the exception handler. * * ----------------------------------------------------------------------------- * Comments: * * ===========================================================================*/ #include "VDK.h" .file_attr prefersMemNum="30"; .file_attr prefersMem="internal"; .file_attr ISR; .section/doubleany data1; /* declare external globals */ /* declare locals */ .section/doubleany L1_code; /****************************************************************************** * UserExceptionHandler */ /* User Exception Handler entry point */ .GLOBAL UserExceptionHandler; UserExceptionHandler: /** * Handle the exception... * * Remember that the VDK reserves the user exception 0, which * is accessed with the following instruction: * * EXCPT 0; * * Any other exception (user or system), is your responsibility to * handle here. */ RTX; .UserExceptionHandler.end: /* ========================================================================== */
23.574468
80
0.441336
ad2161a242ea67c660f04ee949c63765bcca5842
1,098
swift
Swift
SurRound/Modules/HomeMap/ViewModels/MapPostViewModel.swift
charleshs/SurRound-iOS
46fdccacc8d0e869d79eb84c4a12e4d8517bbedf
[ "MIT" ]
null
null
null
SurRound/Modules/HomeMap/ViewModels/MapPostViewModel.swift
charleshs/SurRound-iOS
46fdccacc8d0e869d79eb84c4a12e4d8517bbedf
[ "MIT" ]
2
2020-01-31T08:18:30.000Z
2020-02-02T07:59:52.000Z
SurRound/Modules/HomeMap/ViewModels/MapPostViewModel.swift
charleshs/SurRound-iOS
46fdccacc8d0e869d79eb84c4a12e4d8517bbedf
[ "MIT" ]
null
null
null
// // MapPostViewModel.swift // SurRound // // Created by Charles Hsieh on 2020/3/3. // Copyright © 2020 Kai-Ta Hsieh. All rights reserved. // import UIKit import GoogleMaps struct MapPostViewModel { var post: Post var mapMarker: GMSMarker init(post: Post) { self.post = post let position = CLLocationCoordinate2D(latitude: post.place.coordinate.latitude, longitude: post.place.coordinate.longitude) mapMarker = GMSMarker(position: position) styleMapMarker() } func displayMarker(onMap map: GMSMapView) { mapMarker.map = map } private func styleMapMarker() { let imgView = SRMapMarker(avatar: post.author.avatar, text: post.text, category: nil, placeholder: UIImage.asset(.Icons_Avatar)) mapMarker.iconView = imgView mapMarker.iconView?.frame = CGRect(x: 0, y: 0, width: 120, height: 48) } }
26.142857
89
0.550091
98deec930fde2558f5da91416c5a622d8ec0fa64
3,052
swift
Swift
Source/SwiftIrbis/ClassicFile.swift
amironov73/SwiftIrbis
272323d94a7d30500acc2583f78aeb262db0ab89
[ "MIT" ]
null
null
null
Source/SwiftIrbis/ClassicFile.swift
amironov73/SwiftIrbis
272323d94a7d30500acc2583f78aeb262db0ab89
[ "MIT" ]
null
null
null
Source/SwiftIrbis/ClassicFile.swift
amironov73/SwiftIrbis
272323d94a7d30500acc2583f78aeb262db0ab89
[ "MIT" ]
null
null
null
import Foundation /// Wrapper for POSIX FILE public class ClassicFile { private var fp: UnsafeMutablePointer<FILE> private(set) public var fileName: String private var closed: Bool /// Initializer. /// /// - Parameters: /// - fileName: name of the file. /// - mode: desired access mode. /// - Throws: I/O error. public init(fileName: String, mode: String) throws { self.fileName = fileName self.fp = fopen(fileName, mode) self.closed = false } // init deinit { self.close() } // deinit /// Close the file. public func close() { if !self.closed { fclose(self.fp) self.closed = true } } // func close /// Current read/write position. public var position: Int { get { return ftell(self.fp) } set(newValue) { fseek(self.fp, newValue, SEEK_SET) } } // var position /// Read array of bytes. /// /// - Parameter count: byte count to read. /// - Returns: read public func read(count: Int) -> Data { precondition(count > 0) var buffer = [UInt8](repeating: 0, count: count) let read = Darwin.fread(&buffer, 1, count, self.fp) let result = Data(buffer[0..<read]) return result } // func read /// Read text line using ANSI encoding. /// /// - Returns: text read. public func readAnsiLine() -> String? { return fromAnsi(self.readLine()) } // func readAnsiLine /// Read line from the file. /// /// - Returns: raw string data (no encoding implied). public func readLine() -> Data { var result = Data() var char: UInt8 = 0 while true { let read = fread(&char, 1, 1, self.fp) if read != 1 { break; } if char == 10 { break } if char == 13 { continue // skip cr } result.append(char) } // while return result } // func readLine /// Read text line using UTF-8 encoding. /// /// - Returns: text read. public func readUtfLine() -> String? { return fromUtf(self.readLine()) } // func readUtfLine /// File size, bytes. public var size: Int { let currentOffset = self.position fseek(self.fp, 0, SEEK_END) let result = ftell(self.fp) fseek(self.fp, currentOffset, SEEK_SET) return result } // var size /// Write data to the file. /// /// - Parameter data: array of bytes to write. /// - Throws: I/O error. public func write(data: [UInt8]) throws { let count = data.count let written = fwrite(data, 1, count, self.fp) if written != count { // TODO throw } } // func write public func writeLine() { // TODO implement } // func write } // class ClassicFile
25.647059
59
0.517366
4a6a3985a40474f462a3d559d3c353331d328567
3,216
html
HTML
public/page/SlideTouchNav.html
wuhuanhost/node-utils
51b8ca724a8399aa7ad51465a2a6c33e078d9d87
[ "MIT" ]
3
2017-05-18T13:41:05.000Z
2019-04-29T10:29:52.000Z
public/page/SlideTouchNav.html
wuhuanhost/node-utils
51b8ca724a8399aa7ad51465a2a6c33e078d9d87
[ "MIT" ]
null
null
null
public/page/SlideTouchNav.html
wuhuanhost/node-utils
51b8ca724a8399aa7ad51465a2a6c33e078d9d87
[ "MIT" ]
1
2017-07-18T14:02:53.000Z
2017-07-18T14:02:53.000Z
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>今日头条APP顶部点击可居中导航</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/> <link rel="stylesheet" href="http://www.17sucai.com/preview/702590/2017-06-08/toutiaoNav/css/swiper.min.css"> <script src="http://www.17sucai.com/preview/702590/2017-06-08/toutiaoNav/js/jquery-1.10.1.min.js"></script> <script src="http://www.17sucai.com/preview/702590/2017-06-08/toutiaoNav/js/swiper.min.js"></script> <style> * { margin: 0; padding: 0; } #topNav { width: 100%; overflow: hidden; font: 16px/32px hiragino sans gb, microsoft yahei, simsun; border-bottom:1px solid #f8f8f8; } #topNav .swiper-slide { padding: 0 5px; letter-spacing:2px; width:3rem; text-align:center; } #topNav .swiper-slide span{ transition:all .3s ease; display:block; } #topNav .active span{ transform:scale(1.1); color:#FF2D2D; } img{ width:100%; line-height:0; } </style> </head> <body> <div id="topNav" class="swiper-container"> <div class="swiper-wrapper"> <div class="swiper-slide active"><span>推荐</span></div> <div class="swiper-slide"><span>热点</span></div> <div class="swiper-slide"><span>深圳</span></div> <div class="swiper-slide"><span>视频</span></div> <div class="swiper-slide"><span>社会</span></div> <div class="swiper-slide"><span>娱乐</span></div> <div class="swiper-slide"><span>科技</span></div> <div class="swiper-slide"><span>问答</span></div> <div class="swiper-slide"><span>汽车</span></div> <div class="swiper-slide"><span>财经</span></div> <div class="swiper-slide"><span>军事</span></div> <div class="swiper-slide"><span>体育</span></div> <div class="swiper-slide"><span>段子</span></div> <div class="swiper-slide"><span>美女</span></div> <div class="swiper-slide"><span>国际</span></div> <div class="swiper-slide"><span>趣图</span></div> <div class="swiper-slide"><span>健康</span></div> <div class="swiper-slide"><span>特产</span></div> <div class="swiper-slide"><span>房产</span></div> </div> </div> <script type="text/javascript"> //如果使用最新版(4.0.0)的swiper部分方法可能徐璈要查看最新版的api做调整 var mySwiper = new Swiper('#topNav', { freeMode: true, freeModeMomentumRatio: 0.5, slidesPerView: 'auto', }); swiperWidth = mySwiper.container[0].clientWidth maxTranslate = mySwiper.maxTranslate(); maxWidth = -maxTranslate + swiperWidth / 2 console.log(swiperWidth) $(".swiper-container").on('touchstart', function(e) { e.preventDefault() }) mySwiper.on('tap', function(swiper, e) { // e.preventDefault() slide = swiper.slides[swiper.clickedIndex] slideLeft = slide.offsetLeft slideWidth = slide.clientWidth slideCenter = slideLeft + slideWidth / 2 // 被点击slide的中心点 mySwiper.setWrapperTransition(300) if (slideCenter < swiperWidth / 2) { mySwiper.setWrapperTranslate(0) } else if (slideCenter > maxWidth) { mySwiper.setWrapperTranslate(maxTranslate) } else { nowTlanslate = slideCenter - swiperWidth / 2 mySwiper.setWrapperTranslate(-nowTlanslate) } $("#topNav .active").removeClass('active') $("#topNav .swiper-slide").eq(swiper.clickedIndex).addClass('active') }) </script> </body> </html>
26.360656
109
0.683769
65d2fbf6d8e21fce7cc80d6ddc999fbfbced9de7
12,360
ps1
PowerShell
Posh-ACME/DnsPlugins/GCloud.ps1
Jackbennett/Posh-ACME
efb583dd6dd742ac8c9ebe90dda10372032432ea
[ "MIT" ]
1
2019-12-12T18:51:22.000Z
2019-12-12T18:51:22.000Z
Posh-ACME/DnsPlugins/GCloud.ps1
Jackbennett/Posh-ACME
efb583dd6dd742ac8c9ebe90dda10372032432ea
[ "MIT" ]
1
2019-09-09T14:06:00.000Z
2019-09-09T14:06:00.000Z
Posh-ACME/DnsPlugins/GCloud.ps1
Jackbennett/Posh-ACME
efb583dd6dd742ac8c9ebe90dda10372032432ea
[ "MIT" ]
null
null
null
function Add-DnsTxtGCloud { [CmdletBinding()] param( [Parameter(Mandatory,Position=0)] [string]$RecordName, [Parameter(Mandatory,Position=1)] [string]$TxtValue, [Parameter(Mandatory,Position=2)] [string]$GCKeyFile, [Parameter(ValueFromRemainingArguments)] $ExtraParams ) # Cloud DNS API Reference # https://cloud.google.com/dns/api/v1beta2/ Connect-GCloudDns $GCKeyFile $token = $script:GCToken Write-Verbose "Attempting to find hosted zone for $RecordName" if (!($zoneID = Find-GCZone $RecordName)) { throw "Unable to find Google hosted zone for $RecordName" } $recRoot = "https://www.googleapis.com/dns/v1beta2/projects/$($token.ProjectID)/managedZones/$zoneID" # query the current txt record set try { $response = Invoke-RestMethod "$recRoot/rrsets?type=TXT&name=$RecordName." ` -Headers $script:GCToken.AuthHeader @script:UseBasic Write-Debug ($response | ConvertTo-Json -Depth 5) } catch { throw } $rrsets = $response.rrsets if ($rrsets.Count -eq 0) { # create a new record from scratch Write-Debug "Creating new record for $RecordName" $changeBody = @{additions=@(@{ name="$RecordName."; type='TXT'; ttl=10; rrdatas=@("`"$TxtValue`"") })} } else { if ("`"$TxtValue`"" -in $rrsets[0].rrdatas) { Write-Debug "Record $RecordName already contains $TxtValue. Nothing to do." return } # append to the existing value list which basically involves # both deleting and re-creating the record in the same "change" # operation Write-Debug "Appending to $RecordName with $($rrsets[0].Count) existing value(s)" $toDelete = $rrsets[0] | ConvertTo-Json | ConvertFrom-Json $rrsets[0].rrdatas += "`"$TxtValue`"" $changeBody = @{ deletions=@($toDelete); additions=@($rrsets[0]); } } Write-Verbose "Sending update for $RecordName" Write-Debug ($changeBody | ConvertTo-Json -Depth 5) try { $response = Invoke-RestMethod "$recRoot/changes" -Method Post ` -Body ($changeBody | ConvertTo-Json -Depth 5) ` -Headers $script:GCToken.AuthHeader ` -ContentType 'application/json' @script:UseBasic Write-Debug ($response | ConvertTo-Json -Depth 5) } catch { throw } <# .SYNOPSIS Add a DNS TXT record to Google Cloud DNS. .DESCRIPTION Add a DNS TXT record to Google Cloud DNS. .PARAMETER RecordName The fully qualified name of the TXT record. .PARAMETER TxtValue The value of the TXT record. .PARAMETER GCKeyFile Path to a service account JSON file that contains the account's private key and other metadata. This should have been downloaded when originally creating the service account. .PARAMETER ExtraParams This parameter can be ignored and is only used to prevent errors when splatting with more parameters than this function supports. .EXAMPLE Add-DnsTxtGCloud '_acme-challenge.site1.example.com' 'asdfqwer12345678' -GCKeyFile .\account.json Adds a TXT record for the specified site with the specified value using the specified Google Cloud service account. #> } function Remove-DnsTxtGCloud { [CmdletBinding()] param( [Parameter(Mandatory,Position=0)] [string]$RecordName, [Parameter(Mandatory,Position=1)] [string]$TxtValue, [Parameter(Mandatory,Position=2)] [string]$GCKeyFile, [Parameter(ValueFromRemainingArguments)] $ExtraParams ) # Cloud DNS API Reference # https://cloud.google.com/dns/api/v1beta2/ Connect-GCloudDns $GCKeyFile $token = $script:GCToken Write-Verbose "Attempting to find hosted zone for $RecordName" if (!($zoneID = Find-GCZone $RecordName)) { throw "Unable to find Google hosted zone for $RecordName" } $recRoot = "https://www.googleapis.com/dns/v1beta2/projects/$($token.ProjectID)/managedZones/$zoneID" # query the current txt record set try { $response = Invoke-RestMethod "$recRoot/rrsets?type=TXT&name=$RecordName." ` -Headers $script:GCToken.AuthHeader @script:UseBasic Write-Debug ($response | ConvertTo-Json -Depth 5) } catch { throw } $rrsets = $response.rrsets if ($rrsets.Count -eq 0) { Write-Debug "Record $RecordName already deleted." return } else { if ("`"$TxtValue`"" -notin $rrsets[0].rrdatas) { Write-Debug "Record $RecordName doesn't contain $TxtValue. Nothing to do." return } # removing the value involves deleting the existing record and # re-creating it without the value in the same change set. But if it's # the last one, we just want to delete it. Write-Debug "Removing from $RecordName with $($rrsets[0].Count) existing value(s)" $changeBody = @{ deletions=@(($rrsets[0] | ConvertTo-Json | ConvertFrom-Json)) } if ($rrsets[0].rrdatas.Count -gt 1) { $rrsets[0].rrdatas = @($rrsets[0].rrdatas | Where-Object { $_ -ne "`"$TxtValue`"" }) $changeBody.additions = @($rrsets[0]) } } Write-Verbose "Sending update for $RecordName" Write-Debug ($changeBody | ConvertTo-Json -Depth 5) try { $response = Invoke-RestMethod "$recRoot/changes" -Method Post ` -Body ($changeBody | ConvertTo-Json -Depth 5) ` -Headers $script:GCToken.AuthHeader ` -ContentType 'application/json' @script:UseBasic Write-Debug ($response | ConvertTo-Json -Depth 5) } catch { throw } <# .SYNOPSIS Remove a DNS TXT record from Google Cloud DNS. .DESCRIPTION Remove a DNS TXT record from Google Cloud DNS. .PARAMETER RecordName The fully qualified name of the TXT record. .PARAMETER TxtValue The value of the TXT record. .PARAMETER GCKeyFile Path to a service account JSON file that contains the account's private key and other metadata. This should have been downloaded when originally creating the service account. .PARAMETER ExtraParams This parameter can be ignored and is only used to prevent errors when splatting with more parameters than this function supports. .EXAMPLE Remove-DnsTxtGCloud '_acme-challenge.site1.example.com' 'asdfqwer12345678' -GCKeyFile .\account.json Removes a TXT record the specified site with the specified value using the specified Google Cloud service account. #> } function Save-DnsTxtGCloud { [CmdletBinding()] param( [Parameter(ValueFromRemainingArguments)] $ExtraParams ) <# .SYNOPSIS Not required. .DESCRIPTION This provider does not require calling this function to commit changes to DNS records. .PARAMETER ExtraParams This parameter can be ignored and is only used to prevent errors when splatting with more parameters than this function supports. #> } ############################ # Helper Functions ############################ function Connect-GCloudDns { [CmdletBinding()] param( [Parameter(Mandatory,Position=0)] [string]$GCKeyFile ) # Using OAuth 2.0 for Server to Server Applications # https://developers.google.com/identity/protocols/OAuth2ServiceAccount # just return if we've already got a valid non-expired token if ($script:GCToken -and (Get-DateTimeOffsetNow) -lt $script:GCToken.Expires) { return } Write-Verbose "Signing into GCloud DNS" # We want to save the contents of GCKeyFile so the user isn't necessarily stuck # keeping it wherever it originally was when they ran the command. But we still want # to use the file by default in case they've updated it as long as it still exists. $GCKeyFile = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($GCKeyFile) if (Test-Path $GCKeyFile -PathType Leaf) { Write-Debug "Using key file" $GCKeyObj = Get-Content $GCKeyFile | ConvertFrom-Json # export the contents as a plugin var $b64Contents = $GCKeyObj | ConvertTo-Json -Compress | ConvertTo-Base64Url Export-PluginVar GCKeyObj $b64Contents } else { $b64Contents = Import-PluginVar GCKeyObj if (-not $b64Contents) { throw "Key file $GCKeyFile not found at `"$GCKeyFile`" and no cached data exists." } else { Write-Warning "Key file not found at `"$GCKeyFile`". Attempting to use cached key data." try { $GCKeyObj = $b64Contents | ConvertFrom-Base64Url | ConvertFrom-Json } catch { throw } } } Write-Debug "Loading private key for $($GCKeyObj.client_email)" $key = Import-Pem -InputString $GCKeyObj.private_key | ConvertFrom-BCKey $unixNow = (Get-DateTimeOffsetNow).ToUnixTimeSeconds() # build the claim set for DNS read/write $jwtClaim = @{ iss = $GCKeyObj.client_email; aud = $GCKeyObj.token_uri; scope = 'https://www.googleapis.com/auth/ndev.clouddns.readwrite'; exp = ($unixNow + 3600).ToString(); iat = $unixNow.ToString(); } Write-Debug "Claim set: $($jwtClaim | ConvertTo-Json)" # build a signed jwt $header = @{alg='RS256';typ='JWT'} $jwt = New-Jws $key $header ($jwtClaim | ConvertTo-Json -Compress) -Compact -NoHeaderValidation # build the POST body $authBody = "assertion=$jwt&grant_type=$([uri]::EscapeDataString('urn:ietf:params:oauth:grant-type:jwt-bearer'))" # attempt to sign in try { Write-Debug "Sending OAuth2 login" $response = Invoke-RestMethod $GCKeyObj.token_uri -Method Post -Body $authBody @script:UseBasic Write-Debug ($response | ConvertTo-Json) } catch { throw } # save a custom token to memory $script:GCToken = @{ AuthHeader = @{Authorization="$($response.token_type) $($response.access_token)"}; Expires = (Get-DateTimeOffsetNow).AddSeconds($response.expires_in - 300); ProjectID = $GCKeyObj.project_id; } } function Find-GCZone { [CmdletBinding()] param( [Parameter(Mandatory,Position=0)] [string]$RecordName ) # setup a module variable to cache the record to zone mapping # so it's quicker to find later if (!$script:GCRecordZones) { $script:GCRecordZones = @{} } # check for the record in the cache if ($script:GCRecordZones.ContainsKey($RecordName)) { return $script:GCRecordZones.$RecordName } $token = $script:GCToken $projRoot = "https://www.googleapis.com/dns/v1beta2/projects/$($token.ProjectID)" # get the list of available zones try { $zones = (Invoke-RestMethod "$projRoot/managedZones" ` -Headers $script:GCToken.AuthHeader @script:UseBasic).managedZones } catch { throw } # Since Google could be hosting both apex and sub-zones, we need to find the closest/deepest # sub-zone that would hold the record rather than just adding it to the apex. So for something # like _acme-challenge.site1.sub1.sub2.example.com, we'd look for zone matches in the following # order: # - site1.sub1.sub2.example.com # - sub1.sub2.example.com # - sub2.example.com # - example.com $pieces = $RecordName.Split('.') for ($i=1; $i -lt ($pieces.Count-1); $i++) { $zoneTest = "$( $pieces[$i..($pieces.Count-1)] -join '.' )." Write-Debug "Checking $zoneTest" if ($zoneTest -in $zones.dnsName) { $zoneID = ($zones | Where-Object { $_.dnsName -eq $zoneTest }).id $script:GCRecordZones.$RecordName = $zoneID return $zoneID } } return $null }
36.246334
183
0.620955
2f651b98e3d74f79464932f46c29307fe5a98c39
1,433
lua
Lua
neovim/lua/config/format.lua
jonataseduardo/linux-config-files
73427b3cf5367a47da18c4fc2dfdf3465798a92c
[ "Apache-2.0" ]
null
null
null
neovim/lua/config/format.lua
jonataseduardo/linux-config-files
73427b3cf5367a47da18c4fc2dfdf3465798a92c
[ "Apache-2.0" ]
null
null
null
neovim/lua/config/format.lua
jonataseduardo/linux-config-files
73427b3cf5367a47da18c4fc2dfdf3465798a92c
[ "Apache-2.0" ]
null
null
null
local map = vim.api.nvim_set_keymap vim.api.nvim_exec([[ augroup Format autocmd! autocmd BufWritePost * FormatWrite augroup END ]], true) map('n', '<silent> <leader>f', ':Format<CR>', { noremap = true }) require "format".setup { ["*"] = { {cmd = {"sed -i 's/[ \t]*$//'"}} -- remove trailing whitespace }, python = { {cmd = {"black", "autoflake --in-place --remove-unused-variables", "isort"}} }, vim = { { cmd = {"luafmt -w replace"}, start_pattern = "^lua << EOF$", end_pattern = "^EOF$" } }, vimwiki = { { cmd = {"prettier -w --parser babel"}, start_pattern = "^{{{javascript$", end_pattern = "^}}}$" } }, lua = { { cmd = { function(file) return string.format("luafmt -l %s -w replace %s", vim.bo.textwidth, file) end } } }, go = { { cmd = {"gofmt -w", "goimports -w"}, tempfile_postfix = ".tmp" } }, javascript = { {cmd = {"prettier -w", "./node_modules/.bin/eslint --fix"}} }, markdown = { {cmd = {"prettier -w"}}, { cmd = {"black"}, start_pattern = "^```python$", end_pattern = "^```$", target = "current" } } }
23.112903
94
0.418004
f009b3d518e1b8520f28ad27fc966139292e346f
15,818
py
Python
robotpy_build/hooks_datacfg.py
ConnectionMaster/robotpy-build
9571a84fdd6268be5e945b31ea8929d84355071a
[ "BSD-3-Clause" ]
null
null
null
robotpy_build/hooks_datacfg.py
ConnectionMaster/robotpy-build
9571a84fdd6268be5e945b31ea8929d84355071a
[ "BSD-3-Clause" ]
null
null
null
robotpy_build/hooks_datacfg.py
ConnectionMaster/robotpy-build
9571a84fdd6268be5e945b31ea8929d84355071a
[ "BSD-3-Clause" ]
null
null
null
# # Defines data that is consumed by the header2whatever hooks/templates # to modify the generated files # import enum from typing import Dict, List, Tuple, Optional from pydantic import validator from .util import Model, _generating_documentation class ParamData(Model): """Various ways to modify parameters""" #: Set parameter name to this name: Optional[str] = None #: Change C++ type emitted x_type: Optional[str] = None #: Default value for parameter default: Optional[str] = None #: Disables a default cast caused by ``default_arg_cast`` disable_type_caster_default_cast: bool = False #: Force this to be an 'out' parameter #: #: .. seealso:: :ref:`autowrap_out_params` #: force_out: bool = False #: Force an array size array_size: Optional[int] = None #: Ignore this parameter ignore: bool = False class BufferType(str, enum.Enum): #: The buffer must indicate that it is readable (such as bytes, or bytearray) IN = "in" #: The buffer must indicate that it is writeable (such as a bytearray) OUT = "out" #: The buffer must indicate that it readable or writeable (such as a bytearray) INOUT = "inout" class BufferData(Model): #: Indicates what type of python buffer is required type: BufferType #: Name of C++ parameter that the buffer will use src: str #: Name of the C++ length parameter. An out-only parameter, it will be set #: to the size of the python buffer, and will be returned so the caller can #: determine how many bytes were written len: str #: If specified, the minimum size of the python buffer minsz: Optional[int] = None class ReturnValuePolicy(enum.Enum): """ See `pybind11 documentation <https://pybind11.readthedocs.io/en/stable/advanced/functions.html#return-value-policies>`_ for what each of these values mean. """ TAKE_OWNERSHIP = "take_ownership" COPY = "copy" MOVE = "move" REFERENCE = "reference" REFERENCE_INTERNAL = "reference_internal" AUTOMATIC = "automatic" AUTOMATIC_REFERENCE = "automatic_reference" class FunctionData(Model): """ Customize the way the autogenerator binds a function. .. code-block:: yaml functions: # for non-overloaded functions, just specify the name + customizations name_of_non_overloaded_fn: # add customizations for function here # For overloaded functions, specify the name, but each overload # separately my_overloaded_fn: overloads: int, int: # customizations for `my_overloaded_fn(int, int)` int, int, int: # customizations for `my_overloaded_fn(int, int, int)` """ #: If True, don't wrap this ignore: bool = False #: If True, don't wrap this, but provide a pure virtual implementation ignore_pure: bool = False #: Generate this in an `#ifdef` ifdef: Optional[str] = None #: Generate this in an `#ifndef` ifndef: Optional[str] = None #: Use this code instead of the generated code cpp_code: Optional[str] = None #: Docstring for the function, will attempt to convert Doxygen docs if omitted doc: Optional[str] = None #: Text to append to the (autoconverted) docstring for the function doc_append: Optional[str] = None #: If True, prepends an underscore to the python name internal: bool = False #: Use this to set the name of the function as exposed to python rename: Optional[str] = None #: Mechanism to override individual parameters param_override: Dict[str, ParamData] = {} #: If specified, put the function in a sub.pack.age subpackage: Optional[str] = None #: By default, robotpy-build will release the GIL whenever a wrapped #: function is called. no_release_gil: Optional[bool] = None buffers: List[BufferData] = [] overloads: Dict[str, "FunctionData"] = {} #: Adds py::keep_alive<x,y> to the function. Overrides automatic #: keepalive support, which retains references passed to constructors. #: https://pybind11.readthedocs.io/en/stable/advanced/functions.html#keep-alive keepalive: Optional[List[Tuple[int, int]]] = None #: https://pybind11.readthedocs.io/en/stable/advanced/functions.html#return-value-policies return_value_policy: ReturnValuePolicy = ReturnValuePolicy.AUTOMATIC #: If this is a function template, this is a list of instantiations #: that you wish to provide. This is a list of lists, where the inner #: list is the template parameters for that function template_impls: Optional[List[List[str]]] = None #: Specify a transformation lambda to be used when this virtual function #: is called from C++. This inline code should be a lambda that has the same #: arguments as the original C++ virtual function, except the first argument #: will be a py::function with the python overload #: #: cpp_code should also be specified for this to be useful #: #: For example, to transform a function that takes an iostream into a function #: that returns a string: #: #: .. code-block:: yaml #: #: cpp_code: | #: [](MyClass* self) { #: return "string"; #: } #: virtual_xform: | #: [](py::function fn, MyClass* self, std::iostream &is) { #: std::string d = py::cast(fn()); #: is << d; #: } #: virtual_xform: Optional[str] = None @validator("overloads", pre=True) def validate_overloads(cls, value): for k, v in value.items(): if v is None: value[k] = FunctionData() return value if not _generating_documentation: FunctionData.update_forward_refs() class PropAccess(enum.Enum): #: Determine read/read-write automatically: #: #: * If a struct/union, default to readwrite #: * If a class, default to readwrite if a basic type that isn't a #: reference, otherwise default to readonly AUTOMATIC = "auto" #: Allow python users access to the value, but ensure it can't #: change. This is useful for properties that are defined directly #: in the class READONLY = "readonly" #: Allows python users to read/write the value READWRITE = "readwrite" class PropData(Model): #: If set to True, this property is not made available to python ignore: bool = False #: Set the python name of this property to the specified string rename: Optional[str] #: Python code access to this property access: PropAccess = PropAccess.AUTOMATIC #: Docstring for the property (only available on class properties) doc: Optional[str] = None #: Text to append to the (autoconverted) docstring doc_append: Optional[str] = None class EnumValue(Model): #: If set to True, this property is not made available to python ignore: bool = False #: Set the python name of this enum value to the specified string rename: Optional[str] = None #: Docstring for the enum value doc: Optional[str] = None #: Text to append to the (autoconverted) docstring doc_append: Optional[str] = None class EnumData(Model): #: Set your own docstring for the enum doc: Optional[str] = None #: Text to append to the (autoconverted) docstring doc_append: Optional[str] = None #: If set to True, this property is not made available to python ignore: bool = False #: Set the python name of this enum to the specified string rename: Optional[str] = None value_prefix: Optional[str] = None #: If specified, put the enum in a sub.pack.age (ignored for #: enums that are part of classes) subpackage: Optional[str] = None values: Dict[str, EnumValue] = {} class ClassData(Model): #: Docstring for the class doc: Optional[str] = None #: Text to append to the (autoconverted) docstring doc_append: Optional[str] = None ignore: bool = False ignored_bases: List[str] = [] #: Specify fully qualified names for the bases base_qualnames: Dict[str, str] = {} attributes: Dict[str, PropData] = {} enums: Dict[str, EnumData] = {} methods: Dict[str, FunctionData] = {} is_polymorphic: bool = False force_no_trampoline: bool = False force_no_default_constructor: bool = False #: pybind11 will detect multiple inheritance automatically if a #: class directly derives from multiple classes. However, #: If the class derives from classes that participate in multiple #: inheritance, pybind11 won't detect it automatically, so this #: flag is needed. force_multiple_inheritance: bool = False #: If there are circular dependencies, this will help you resolve them #: manually. TODO: make it so we don't need this force_depends: List[str] = [] #: Use this to bring in type casters for a particular type that may have #: been hidden (for example, with a typedef or definition in another file), #: instead of explicitly including the header. This should be the full #: namespace of the type. force_type_casters: List[str] = [] #: If the object shouldn't be deleted by pybind11, use this. Disables #: implicit constructors. nodelete: bool = False #: Set the python name of the class to this rename: Optional[str] = None #: This is deprecated and has no effect shared_ptr: bool = True #: If specified, put the class in a sub.pack.age. Ignored #: for functions attached to a class. When template parameters #: are used, must define subpackage on template instances #: instead subpackage: Optional[str] = None #: Extra 'using' directives to insert into the trampoline and the #: wrapping scope typealias: List[str] = [] #: Extra constexpr to insert into the trampoline and wrapping scopes constants: List[str] = [] #: If this is a template class, a list of the parameters if it can't #: be autodetected (currently can't autodetect). If there is no space #: in the parameter, then it is assumed to be a 'typename', otherwise #: the parameter is split by space and the first item is the type and #: the second parameter is the name (useful for integral templates) template_params: Optional[List[str]] = None #: If this is a template class, the specified C++ code is inserted #: into the template definition template_inline_code: str = "" #: If this class has an associated trampoline, add this code inline at #: the bottom of the trampoline class. This is rarely useful. trampoline_inline_code: Optional[str] = None @validator("attributes", pre=True) def validate_attributes(cls, value): for k, v in value.items(): if v is None: value[k] = PropData() return value @validator("enums", pre=True) def validate_enums(cls, value): for k, v in value.items(): if v is None: value[k] = EnumData() return value @validator("methods", pre=True) def validate_methods(cls, value): for k, v in value.items(): if v is None: value[k] = FunctionData() return value class TemplateData(Model): """ Instantiates a template as a python type. To customize the class, add it to the ``classes`` key and specify the template type. Code to be wrapped: .. code-block:: c++ template <typename T> class MyClass {}; To bind ``MyClass<int>`` as the python class ``MyIntClass``, add this to your YAML: .. code-block:: yaml classes: MyClass: template_params: - T templates: MyIntClass: qualname: MyClass params: - int """ #: Fully qualified name of instantiated class qualname: str #: Template parameters to use params: List[str] #: If specified, put the template instantiation in a sub.pack.age subpackage: Optional[str] = None #: Set the docstring for the template instance doc: Optional[str] = None #: Text to append to the (autoconverted) docstring for the template instance doc_append: Optional[str] = None class HooksDataYaml(Model): """ Format of the file in [tool.robotpy-build.wrappers."PACKAGENAME"] generation_data """ strip_prefixes: List[str] = [] #: Adds ``#include <FILENAME>`` directives to the top of the autogenerated #: C++ file, after autodetected include dependencies are inserted. extra_includes: List[str] = [] #: Adds ``#include <FILENAME>`` directives after robotpy_build.h is #: included, but before any autodetected include dependencies. Only use #: this when dealing with broken headers. extra_includes_first: List[str] = [] #: Specify raw C++ code that will be inserted at the end of the #: autogenerated file, inside a function. This is useful for extending #: your classes or providing other customizations. The following C++ #: variables are available: #: #: * ``m`` is the ``py::module`` instance #: * ``cls_CLASSNAME`` are ``py::class`` instances #: * ... lots of other things too #: #: The trampoline class (useful for accessing protected items) is available #: at ``{CLASSNAME}_Trampoline`` #: #: To see the full list, run a build and look at the generated code at #: ``build/*/gensrc/**/*.cpp`` #: #: Recommend that you use the YAML multiline syntax to specify it: #: #: .. code-block:: yaml #: #: inline_code: | #: cls_CLASSNAME.def("get42", []() { return 42; }); inline_code: Optional[str] = None #: Key is the attribute (variable) name #: #: .. code-block:: yaml #: #: attributes: #: my_variable: #: # customizations here, see PropData #: attributes: Dict[str, PropData] = {} #: Key is the class name #: #: .. code-block:: yaml #: #: classes: #: CLASSNAME: #: # customizations here, see ClassData #: classes: Dict[str, ClassData] = {} #: Key is the function name #: #: .. code-block:: yaml #: #: functions: #: fn_name: #: # customizations here, see FunctionData #: functions: Dict[str, FunctionData] = {} #: Key is the enum name, for enums at global scope #: #: .. code-block:: yaml #: #: enums: #: MyEnum: #: # customizations here, see EnumData #: enums: Dict[str, EnumData] = {} #: Instantiates a template. Key is the name to give to the Python type. #: #: .. code-block:: yaml #: #: templates: #: ClassName: #: # customizations here, see TemplateData #: templates: Dict[str, TemplateData] = {} @validator("attributes", pre=True) def validate_attributes(cls, value): for k, v in value.items(): if v is None: value[k] = PropData() return value @validator("classes", pre=True) def validate_classes(cls, value): for k, v in value.items(): if v is None: value[k] = ClassData() return value @validator("enums", pre=True) def validate_enums(cls, value): for k, v in value.items(): if v is None: value[k] = EnumData() return value @validator("functions", pre=True) def validate_functions(cls, value): for k, v in value.items(): if v is None: value[k] = FunctionData() return value
29.845283
123
0.637249
4ec293c9942e681664199c437ed90ebbe0e54e4a
13,457
sql
SQL
mysql_config/WebMonitoring/procedures/samples_size_websites/get_daily_samples_size_websites.sql
raresraf/rafMetrics
21eb5e8210364bf70eee746d71c45f3e353dcb10
[ "MIT" ]
15
2019-11-03T18:01:27.000Z
2021-05-05T20:54:57.000Z
mysql_config/WebMonitoring/procedures/samples_size_websites/get_daily_samples_size_websites.sql
raresraf/rafMetrics
21eb5e8210364bf70eee746d71c45f3e353dcb10
[ "MIT" ]
392
2019-11-09T21:28:01.000Z
2022-03-31T13:04:45.000Z
mysql_config/WebMonitoring/procedures/samples_size_websites/get_daily_samples_size_websites.sql
raresraf/rafMetrics
21eb5e8210364bf70eee746d71c45f3e353dcb10
[ "MIT" ]
1
2021-03-11T18:35:16.000Z
2021-03-11T18:35:16.000Z
delimiter // DROP PROCEDURE IF EXISTS get_daily_samples_size_websites; CREATE PROCEDURE get_daily_samples_size_websites ( IN id INT, OUT entry0 FLOAT, OUT entry1 FLOAT, OUT entry2 FLOAT, OUT entry3 FLOAT, OUT entry4 FLOAT, OUT entry5 FLOAT, OUT entry6 FLOAT, OUT entry7 FLOAT, OUT entry8 FLOAT, OUT entry9 FLOAT, OUT entry10 FLOAT, OUT entry11 FLOAT, OUT entry12 FLOAT, OUT entry13 FLOAT, OUT entry14 FLOAT, OUT entry15 FLOAT, OUT entry16 FLOAT, OUT entry17 FLOAT, OUT entry18 FLOAT, OUT entry19 FLOAT, OUT entry20 FLOAT, OUT entry21 FLOAT, OUT entry22 FLOAT, OUT entry23 FLOAT, OUT start_hour FLOAT ) BEGIN select HOUR(now()) INTO start_hour; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 24 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 23 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry0 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 24 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 23 HOUR) AND Websiteid = id limit 1); else SET entry0 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 23 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 22 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry1 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 23 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 22 HOUR) AND Websiteid = id limit 1); else SET entry1 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 22 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 21 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry2 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 22 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 21 HOUR) AND Websiteid = id limit 1); else SET entry2 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 21 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 20 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry3 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 21 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 20 HOUR) AND Websiteid = id limit 1); else SET entry3 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 20 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 19 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry4 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 20 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 19 HOUR) AND Websiteid = id limit 1); else SET entry4 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 19 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 18 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry5 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 19 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 18 HOUR) AND Websiteid = id limit 1); else SET entry5 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 18 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 17 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry6 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 18 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 17 HOUR) AND Websiteid = id limit 1); else SET entry6 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 17 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 16 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry7 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 17 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 16 HOUR) AND Websiteid = id limit 1); else SET entry7 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 16 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 15 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry8 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 16 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 15 HOUR) AND Websiteid = id limit 1); else SET entry8 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 15 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 14 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry9 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 15 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 14 HOUR) AND Websiteid = id limit 1); else SET entry9 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 14 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 13 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry10 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 14 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 13 HOUR) AND Websiteid = id limit 1); else SET entry10 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 13 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 12 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry11 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 13 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 12 HOUR) AND Websiteid = id limit 1); else SET entry11 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 12 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 11 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry12 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 12 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 11 HOUR) AND Websiteid = id limit 1); else SET entry12 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 11 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 10 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry13 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 11 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 10 HOUR) AND Websiteid = id limit 1); else SET entry13 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 10 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 9 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry14 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 10 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 9 HOUR) AND Websiteid = id limit 1); else SET entry14 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 9 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 8 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry15 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 9 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 8 HOUR) AND Websiteid = id limit 1); else SET entry15 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 8 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 7 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry16 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 8 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 7 HOUR) AND Websiteid = id limit 1); else SET entry16 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 7 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 6 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry17 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 7 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 6 HOUR) AND Websiteid = id limit 1); else SET entry17 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 6 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 5 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry18 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 6 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 5 HOUR) AND Websiteid = id limit 1); else SET entry18 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 5 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 4 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry19 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 5 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 4 HOUR) AND Websiteid = id limit 1); else SET entry19 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 4 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 3 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry20 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 4 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 3 HOUR) AND Websiteid = id limit 1); else SET entry20 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 3 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 2 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry21 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 3 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 2 HOUR) AND Websiteid = id limit 1); else SET entry21 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 2 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 1 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry22 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 2 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 1 HOUR) AND Websiteid = id limit 1); else SET entry22 := 0; end if; if EXISTS(SELECT SUM(bodySize) from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 1 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 0 HOUR) AND Websiteid = id limit 1)) then SELECT SUM(bodySize) INTO entry23 from REQUESTS where Metricid = (SELECT Metricid FROM WEBSITES_METRICS WHERE TIMESTAMP >= DATE_SUB(NOW(), INTERVAL 1 HOUR) AND TIMESTAMP <= DATE_SUB(NOW(), INTERVAL 0 HOUR) AND Websiteid = id limit 1); else SET entry23 := 0; end if; END// delimiter ;
102.725191
249
0.724976
aba2b2faedb32193cdb9ad91adaac400ef07f05a
2,951
rb
Ruby
test/logstash/filters/test_xml.rb
alphagov/logstash
ddecf89a28272609387f26f426d642f3eae93cbf
[ "Apache-2.0" ]
4
2017-10-08T15:14:57.000Z
2019-05-22T08:26:48.000Z
test/logstash/filters/test_xml.rb
derekgr/logstash
fee7d50a45c7d8bcc98b93acf58297292100c7a1
[ "Apache-2.0" ]
null
null
null
test/logstash/filters/test_xml.rb
derekgr/logstash
fee7d50a45c7d8bcc98b93acf58297292100c7a1
[ "Apache-2.0" ]
4
2015-08-21T13:46:03.000Z
2020-01-18T00:04:26.000Z
require "rubygems" require File.join(File.dirname(__FILE__), "..", "minitest") require "logstash/loadlibs" require "logstash" require "logstash/filters" require "logstash/filters/xml" require "logstash/event" describe LogStash::Filters::Xml do before do @filter = LogStash::Filters.from_name("xml", {}) @typename = "xml" end def config(cfg) cfg["type"] = @typename cfg.each_key do |key| if cfg[key].is_a?(String) cfg[key] = [cfg[key]] end end @filter = LogStash::Filters::Xml.new(cfg) @filter.register end # def config test "parse standard xml" do config "raw" => "data" event = LogStash::Event.new event.type = @typename event["raw"] = '<foo key="value"/>' @filter.filter(event) assert_equal(event["data"], {"key" => "value"}) end # parse standard xml test "parse xml but do not store" do config "raw" => "data", "store_xml" => "false" event = LogStash::Event.new event.type = @typename event["raw"] = '<foo key="value"/>' @filter.filter(event) assert_equal(event["data"], nil) end # parse xml but do not store test "parse xml with array as a value" do config "raw" => "data" event = LogStash::Event.new event.type = @typename event["raw"] = '<foo><key>value1</key><key>value2</key></foo>' @filter.filter(event) assert_equal(event["data"], {"key" => ["value1", "value2"]}) end # parse xml with array as a value test "parse xml with hash as a value" do config "raw" => "data" event = LogStash::Event.new event.type = @typename event["raw"] = '<foo><key1><key2>value</key2></key1></foo>' @filter.filter(event) assert_equal(event["data"], {"key1" => [{"key2" => ["value"]}]}) end # parse xml with array as a value test "bad xml" do config "raw" => "data" event = LogStash::Event.new event.type = @typename event["raw"] = '<foo /' @filter.filter(event) assert_equal(event.tags, ["_xmlparsefailure"]) end # bad xml test "parse xml and store single value with xpath" do config "raw" => "data", "xpath" => [ "/foo/key/text()", "xpath_field" ] event = LogStash::Event.new event.type = @typename event["raw"] = '<foo><key>value</key></foo>' @filter.filter(event) assert_equal(event["xpath_field"].length, 1) assert_equal(event["xpath_field"], ["value"]) end # parse xml and store single value with xpath test "parse xml and store mulitple values with xpath" do config "raw" => "data", "xpath" => [ "/foo/key/text()", "xpath_field" ] event = LogStash::Event.new event.type = @typename event["raw"] = '<foo><key>value1</key><key>value2</key></foo>' @filter.filter(event) assert_equal(event["xpath_field"].length, 2) assert_equal(event["xpath_field"], ["value1","value2"]) end # parse xml and store mulitple values with xpath end # Test 'xml' filter
28.375
68
0.618096
7e9d0ce1771e313b497cc937f758940d436118c3
1,321
lua
Lua
Modules/linda-cfg/aircrafts/RealAir Duke Turbine V2/config-user.lua
joeherwig/RealAir-Turbine-Duke-V2-LUA
1e0167ae11e3e23eb08cca6b6f3f445089b8ef29
[ "MIT" ]
1
2015-08-21T16:42:25.000Z
2015-08-21T16:42:25.000Z
Modules/linda-cfg/aircrafts/RealAir Duke Turbine V2/config-user.lua
joeherwig/RealAir-Turbine-Duke-V2-LUA
1e0167ae11e3e23eb08cca6b6f3f445089b8ef29
[ "MIT" ]
2
2015-08-19T16:11:35.000Z
2015-08-20T20:00:37.000Z
Modules/linda-cfg/aircrafts/RealAir Duke Turbine V2/config-user.lua
joeherwig/RealAir-Turbine-Duke-V2-LUA
1e0167ae11e3e23eb08cca6b6f3f445089b8ef29
[ "MIT" ]
null
null
null
-- USER CONFIGURATION FOR AUTOSAVE -- Updated for LINDA 2.5 -- Nov 2014 -- All the settings here could be overridden on per-plane basis -- by creating file config-user.lua in correspnding plane's configs folder -- (i.e. SIM/Modules/linda-cfg/aircrafts/Cessna 172/config-user.lua) -- Use the same variables there with new desired values. -- Autosave feature settings -- ========================= -- Global autosave feature enable/disable AUTOSAVE_ENABLE = 1 -- Make LINDA also save the default flight named "_linda_default", -- so you could set it as default flight in your sim and make next -- flight start from the same place AUTOSAVE_DEFAULT_FLIGHT = 1 -- Make LINDA also save the _plane_specific_ default flight named "_linda_lastpos_AircraftID", -- so you could load it manualy if you have several planes in use -- and want to fast resume their flights AUTOSAVE_PLANE_FLIGHT = 1 -- Make separate save file for each airport (logfile mode) AUTOSAVE_EACH_AIRFIELD = 0 -- What systems should be turned OFF to trigger the autosave action: -- Engine should be off AUTOSAVE_ENGINE_CHECK = 1 -- Magneto should be off AUTOSAVE_MAGNETO_CHECK = 1 -- Main battery should be off AUTOSAVE_BATTERY_CHECK = 1 -- All lights should be off AUTOSAVE_LIGHTS_CHECK = 1 -- Parking brake should be set AUTOSAVE_PARKING_CHECK = 1
29.355556
94
0.757002
f69377beb8585267d3fe8b6d1c3cca532aa494bb
4,182
kt
Kotlin
pop-miners/veriblock-pop-miner/src/main/kotlin/org/veriblock/miners/pop/shell/commands/VeriBlockWalletCommands.kt
xagau/nodecore
582214003e4767c908bacd9bf7b16725caa52761
[ "MIT" ]
null
null
null
pop-miners/veriblock-pop-miner/src/main/kotlin/org/veriblock/miners/pop/shell/commands/VeriBlockWalletCommands.kt
xagau/nodecore
582214003e4767c908bacd9bf7b16725caa52761
[ "MIT" ]
null
null
null
pop-miners/veriblock-pop-miner/src/main/kotlin/org/veriblock/miners/pop/shell/commands/VeriBlockWalletCommands.kt
xagau/nodecore
582214003e4767c908bacd9bf7b16725caa52761
[ "MIT" ]
null
null
null
// VeriBlock Blockchain Project // Copyright 2017-2018 VeriBlock, Inc // Copyright 2018-2020 Xenios SEZC // All rights reserved. // https://www.veriblock.org // Distributed under the MIT software license, see the accompanying // file LICENSE or http://www.opensource.org/licenses/mit-license.php. package org.veriblock.miners.pop.shell.commands import com.google.gson.GsonBuilder import io.grpc.StatusRuntimeException import org.veriblock.core.utilities.extensions.formatAtomicLongWithDecimal import org.veriblock.miners.pop.model.PopEndorsementInfo import org.veriblock.miners.pop.service.NodeCoreGateway import org.veriblock.miners.pop.shell.toShellResult import org.veriblock.shell.CommandFactory import org.veriblock.shell.CommandParameter import org.veriblock.shell.CommandParameterMappers import org.veriblock.shell.command import org.veriblock.shell.core.failure import org.veriblock.shell.core.success fun CommandFactory.veriBlockWalletCommands( nodeCoreGateway: NodeCoreGateway ) { val prettyPrintGson = GsonBuilder().setPrettyPrinting().create() command( name = "Lock VeriBlock Wallet", form = "lockwallet", description = "Locks an encrypted VeriBlock wallet to disable creation of PoP transactions" ) { try { nodeCoreGateway.lockWallet().toShellResult() } catch (e: StatusRuntimeException) { failure { addMessage("V500", "NodeCore Communication Error", e.status.code.toString(), true) } } catch (e: Exception) { failure { addMessage("V500", "Command Error", e.message!!, true) } } } command( name = "Unlock VeriBlock Wallet", form = "unlockwallet", description = "Unlocks an encrypted VeriBlock wallet to allow creation of PoP transactions", parameters = listOf( CommandParameter("passphrase", CommandParameterMappers.STRING) ) ) { try { val passphrase: String = getParameter("passphrase") nodeCoreGateway.unlockWallet(passphrase).toShellResult() } catch (e: StatusRuntimeException) { failure { addMessage("V500", "NodeCore Communication Error", e.status.code.toString(), true) } } catch (e: Exception) { failure { addMessage("V500", "Command Error", e.message!!, true) } } } command( name = "Get PoP Endoresement Info", form = "getpopendorsementinfo", description = "Returns information regarding PoP endorsements for a given address" ) { try { val endorsements = nodeCoreGateway.getPopEndorsementInfo() printInfo("${prettyPrintGson.toJson(endorsements)}\n\n") success() } catch (e: StatusRuntimeException) { failure { addMessage("V500", "NodeCore Communication Error", e.status.code.toString()) } } catch (e: Exception) { failure { addMessage("V500", "Command Error", e.message!!, true) } } } command( name = "View Recent Rewards", form = "viewrecentrewards", description = "Lists recent and upcoming rewards" ) { try { val endorsements: List<PopEndorsementInfo> = nodeCoreGateway.getPopEndorsementInfo().sortedBy { it.endorsedBlockNumber } for (e in endorsements) { printInfo( "{endorsed_block: ${e.endorsedBlockNumber}, ${if (e.finalized) "reward" else "projected_reward"}:" + " ${e.reward.formatAtomicLongWithDecimal()}, paid_in_block: ${e.endorsedBlockNumber + 500}}" ) } success() } catch (e: StatusRuntimeException) { failure { addMessage("V500", "NodeCore Communication Error", e.status.code.toString()) } } catch (e: Exception) { failure { addMessage("V500", "Command Error", e.message!!, true) } } } }
36.365217
120
0.612865
45803bdde63e26766535e08f85f04304191c009b
10,781
ps1
PowerShell
bin/inspect.ps1
cawoodm/powowshell
f43a0e00e6b10b014147ee194b896f81b3799920
[ "MIT" ]
6
2019-04-06T16:41:58.000Z
2021-11-09T12:01:22.000Z
bin/inspect.ps1
cawoodm/powowshell
f43a0e00e6b10b014147ee194b896f81b3799920
[ "MIT" ]
2
2020-12-29T17:19:07.000Z
2020-12-30T15:36:21.000Z
bin/inspect.ps1
cawoodm/powowshell
f43a0e00e6b10b014147ee194b896f81b3799920
[ "MIT" ]
1
2022-02-27T04:53:38.000Z
2022-02-27T04:53:38.000Z
<# .Synopsis Inspect a component (powershell script) to view it's input and outputs .Description PowowShell expects components (scripts) to clearly define their interface. This script returns basic information about a script It always returns something for each .ps1 file .Parameter Path The path to the .ps1 script #> [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingInvokeExpression", "")] param( [Parameter(Mandatory)][string]$Path ) function main() { try { # A necessary evil here so we can query properties without try/catch or other shenanigans Set-StrictMode -Off if ($Path.indexOf([IO.Path]::DirectorySeparatorChar) -ge 0) { $Executable = Resolve-Path -Path $Path $CompType = "component" $Executable = $Executable.Path $Name = (Split-Path -Path $Executable -Leaf) $NiceName = ($Name -replace ".ps1", "") Write-Verbose "Inspecting component $Name ..." $cmd = Get-Help -Full -Name $Executable -ErrorAction SilentlyContinue $cmd2 = Get-Command -Name $Executable -ErrorAction SilentlyContinue if ($null -eq $cmd) {throw "Invalid POW Component '$Executable'!"} $output = Get-OPType($cmd2) if (-not $output) {Write-Warning "No output type on '$NiceName'! Consider adding a [OutputType()] annotation."} $outputFormat = Get-OutputsAnnotation($cmd) if (-not $outputFormat) {Write-Warning "No output format on '$NiceName'! Consider adding a .Outputs annotation."} } else { $CompType = "cmdlet" $Executable = $Path Write-Verbose "Inspecting installed CmdLet $Path ..." $Name = $Path $CachePath = "$($_POW.CACHER)/help" if (-not (Test-Path $CachePath)) {$null = New-Item -Path $CachePath -ItemType Directory} if (Test-Path "$CachePath/$Name.json") { $cmd = Get-Content "$CachePath/$Name.json" | ConvertFrom-Json } else { $cmd = Get-Help -Full -Name $Name -ErrorAction SilentlyContinue # Help returns prefix match so "Get-Item" => ["Get-Item", "Get-Item2"] if ($cmd -is [array]) {$cmd = $cmd | Where-Object {$_.Name -like $Name}} # Cache help because Get-Help can be slow $cmd | ConvertTo-Json -Depth 7 | Set-Content -Encoding UTF8 -Path "$CachePath/$($cmd.details.name).json" } if ($null -eq $cmd) {throw "Invalid CmdLet '$Executable'!"} $NiceName = $cmd.details.name $output = Get-OPReturn($cmd) # CmdLets don't know our output formats like "text/json" # All cmdlets ultimately emit objects even if they are primitives like strings $outputFormat = "psobj" } # Must be lower case for IDE to find it getComponent $reference = $Name.ToLower() $whatif = $false; #$confirm=$false; $passthru=$false; $paramsOut = @(); $inputType = $null; $inputFormat = $null; $inputDesc = $null; $outputDesc = $null; $PipedParamCount = 0; if ($cmd.PSObject.Properties.item("details")) { $boolMap = @{"true" = $true; "false" = $false} $parameters = try {$cmd.parameters.parameter}catch {$null} # Only Syntax.syntaxItem has parameterValueGroup.parameterValue on each parameter $parameters2 = try {$cmd.Syntax.syntaxItem[0].parameter}catch {$null} $pipelineInputParam = $false; $paramsOut = @() foreach ($parameter in $parameters) { $parameter2 = $parameters2 | Where-Object Name -eq $parameter.name $paramPipeMode = $null; $paramPipe = $null; if ($parameter.name -eq "WhatIf") {$whatif = $true; continue; } if ($parameter.name -eq "Confirm") {$confirm = $true; continue; } #if ($parameter.name -eq "PassThru") {$passthru = $true; continue;} $paramType = Get-ParamType $parameter if ($parameter.pipelineInput -like "true*") { $paramPipe = $true; if ($parameter.pipelineInput -like "*ByValue*") { $paramPipeMode += "value"; $PipedParamCount++; $pipelineInputParam = $true; $inputType = $paramType; } if ($parameter.pipelineInput -like "*ByPropertyName*") { $paramPipeMode += "name" } } if ($CompType -eq "component") { $paramValues = GetParamValues $cmd2.parameters[$parameter.name] } else { $paramValues = GetParamValues $parameter2 | Where-Object {$_ -ne $null} } # WEIRD: We have to convert a null object to a real null (or we get "{}" in JSON) if ($null -eq $paramValues) {$paramValues = $null} $paramDefault = $null if ($parameter.defaultValue -and $parameter.defaultValue -notlike "none" -and $parameter.defaultValue -notlike "false") { $paramDefault = $parameter.defaultValue } $paramsOut += [PSCustomObject]@{ "name" = $parameter.name; "type" = $paramType "piped" = $paramPipe "pipedMode" = $paramPipeMode "required" = $boolMap[$parameter.required]; "default" = $paramDefault "description" = (& {try {$parameter.description[0].text}catch {$null}}) "values" = $paramValues; }; } if ($CompType -eq "component") { if ($null -eq $parameters) {$POWMessages += [PSCustomObject]@{type = "INFO"; message = "No parameters found in component '$Name'!"}} if ($pipelineInputParam) { $inputFormat = Get-IPType($cmd); if ($inputFormat -like "none") {$inputFormat = $null} $inputDesc = Get-IPDesc($cmd) } if ($pipelineInputParam -and -not $inputFormat) {Write-Warning "Pipeline input not described properly in annotated comments (.Inputs) of $NiceName!"} if (-not $pipelineInputParam -and $inputFormat) {Write-Warning "Pipeline input not declared properly in parameters (ValueFromPipeline=`$true) of $NiceName!"} } #if ($PipedParamCount -gt 1) {$POWMessages+=[PSCustomObject]@{type="WARNING";message="We don't support multiple piped parameters in '$NiceName'!"}} } else { Write-Error "Invalid CmdLet in component '$Name'!" return } $synopsis = Get-Synopsis($cmd) $description = Get-Description($cmd) # Weird "none or" outputs $output = $output -replace 'None or ', '' $output = $output -replace 'None, ', '' # Use 'string' instead of 'system.string' $output = $output -replace '^system\.', '' $inputType = $inputType -replace '^system\.', '' $inputType = $inputType.toLower(); # Map PSObjects to the object adaptor $MapTypes = @{ "psobject" = "object" "psobject[]" = "object[]" "management.automation.psobject" = "object" "management.automation.psobject[]" = "object[]" } if ($MapTypes.Contains($inputType)) {$inputType = $MapTypes[$inputType]} if ($MapTypes.Contains($output)) {$output = $MapTypes[$output]} # # Validate output types if ($outputFormat -eq 'psobject') { if (-not (IsValidType $output)) {Write-Warning "Unknown output type '$output' for output format '$outputFormat'!"} else {Write-Warning 'foo'} } elseif ($outputFormat -eq 'string') { } if ($CompType -eq "component") {$outputDesc = Get-OPDesc($cmd)} $result = [PSCustomObject]@{ "reference" = $reference; "name" = $NiceName; "type" = $CompType; "executable" = $Executable; "synopsis" = $synopsis; "description" = $description; "module" = $cmd.ModuleName; "examples" = if ($cmd.examples) {$true}else {$false}; "whatif" = $whatif; "parameters" = $paramsOut; "input" = $inputType; "inputFormat" = $inputFormat; "inputDescription" = $inputDesc; "output" = $output; "outputFormat" = $outputFormat; "outputDescription" = $outputDesc; } return $result } catch { #$Host.UI.WriteErrorLine("ERROR in $($_.InvocationInfo.ScriptName):$($_.InvocationInfo.ScriptLineNumber) : $($_.Exception.Message)") throw $_ } } function Get-Synopsis($cmd) {try {$cmd.details.description[0].Text}catch {$null}} function Get-Description($cmd) {try {return $cmd.description[0].Text}catch {$null}} function Get-IPType($cmd) {try {([string](Get-IP($cmd))[0]).ToLower() -replace "[\r\n]", ""}catch {$null}} function Get-IPDesc($cmd) {try {[string](@(Get-IP($cmd)))[1]}catch {$null}} function Get-IP($cmd) {try {@($cmd.inputTypes[0].inputType[0].type.name + "`n" -split "[\r\n]")}catch {$null}} function GetParamValues($param) { if ($param.parameterValueGroup.parameterValue) {return $param.parameterValueGroup.parameterValue} elseif ($param.Attributes.ValidValues) {return $param.Attributes.ValidValues} # With strictmode on we don't get the ValidValues! } function Get-ParamType($param) { $result = $null if ($param.parameterValue.value) {$result = [string]$param.parameterValue.value.toLower()} elseif ($param.type.name) {$result = [string]$param.type.name.toLower()} if ($result -like "switchparameter") {$result = "switch"} return $result; } function Get-OPReturn($cmd) { $result = Get-OP($cmd) if ($null -eq $result) {return ""} $result = $result.trim() -split "\r?\n" # TODO: Normalize multiple types, exclude None and pick one? if ($result.Count -gt 1) { Write-Warning "$($cmd.name) has multiple possible output types ($($result -join ', '))!" # If we have multiple object types, just 'any' $result = "object" } elseif ($result -like '* *') { Write-Warning "$($cmd.name) has multiple possible output types ($result)!" $result = "object" } return [string]$result; } function Get-OutputsAnnotation($cmd) { $result = Get-OPA($cmd) if ($result -is [array]) { $result = $result[0].ToLower() -replace "[\r\n]", "" # If we have multiple object types, just output object if ($result -like "* *") { Write-Warning "$($cmd.name) has multiple possible output types ($result)!" $result = "object" } return [string]$result; } } function Get-OPType($cmd) {try {([string]($cmd.OutputType[0].Name)).ToLower()}catch {$null}} function Get-OPDesc($cmd) {try {[string](@(Get-OP($cmd)))[1]}catch {$null}} function Get-OP($cmd) {try {@($cmd.returnValues.returnValue | ForEach-Object {$_.type.name})}catch {$null}} function Get-OPA($cmd) {try {@($cmd.returnValues[0].returnValue[0].type.name + "`n" -split "`n")}catch {$null}} function IsValidType($type) {try {(Invoke-Expression "[foo]").Name; $true}catch {$false}} . "$PSScriptRoot/common.ps1" $PSDefaultParameterValues['Out-File:Encoding'] = $_POW.ENCODING $ErrorActionPreference = "Stop" main
46.670996
177
0.620072
c5ff0122dde598beb5f819ac68cb2e38b00e3737
53
cpp
C++
Weapon.cpp
Excelsus4/TextRPG
dcb4c2fe01175f2c78c9894f3a2b92d83e2d8d20
[ "MIT" ]
null
null
null
Weapon.cpp
Excelsus4/TextRPG
dcb4c2fe01175f2c78c9894f3a2b92d83e2d8d20
[ "MIT" ]
7
2020-08-25T17:28:36.000Z
2020-08-27T10:36:16.000Z
Weapon.cpp
Excelsus4/TextRPG
dcb4c2fe01175f2c78c9894f3a2b92d83e2d8d20
[ "MIT" ]
null
null
null
#pragma once #include "stdafx.h" #include "Weapon.h"
13.25
19
0.716981
45a1c66221eb2c99eea2e25c102b31d22a2d1074
3,977
sql
SQL
dvsdlc.sql
clarasoft-it/CFS-Clarsoft-FOundation-Server-
e736325fb6d166ccc593e016032cc2faafb667bb
[ "MIT" ]
4
2022-03-01T16:28:51.000Z
2022-03-04T01:08:08.000Z
dvsdlc.sql
clarasoft-it/CFS-Clarsoft-FOundation-Server-
e736325fb6d166ccc593e016032cc2faafb667bb
[ "MIT" ]
null
null
null
dvsdlc.sql
clarasoft-it/CFS-Clarsoft-FOundation-Server-
e736325fb6d166ccc593e016032cc2faafb667bb
[ "MIT" ]
null
null
null
-- Table: public.DVPRJM -- DROP TABLE public."DVPRJM"; CREATE TABLE public."DVPRJM" ( prjtype character varying(10) COLLATE pg_catalog."default" NOT NULL, prjid character varying(32) COLLATE pg_catalog."default" NOT NULL, descr character varying(128) COLLATE pg_catalog."default" NOT NULL, date_open timestamp with time zone, date_close timestamp with time zone, status character varying(1) COLLATE pg_catalog."default" NOT NULL, crtu character varying(10) COLLATE pg_catalog."default" NOT NULL, crtd timestamp with time zone NOT NULL, modu character varying(10) COLLATE pg_catalog."default" NOT NULL, modd timestamp with time zone NOT NULL, ref character varying(64) COLLATE pg_catalog."default", CONSTRAINT "DVPRJM_pkey" PRIMARY KEY (prjtype, prjid) ) WITH ( OIDS = FALSE ) TABLESPACE pg_default; ALTER TABLE public."DVPRJM" OWNER to clarabase; -- Table: public.DVSYSM -- DROP TABLE public."DVSYSM"; CREATE TABLE public."DVSYSM" ( sysname character varying(32) COLLATE pg_catalog."C.UTF-8" NOT NULL, cptid character(36) COLLATE pg_catalog."C.UTF-8" NOT NULL, crtu character(64) COLLATE pg_catalog."default" NOT NULL, crtd timestamp with time zone NOT NULL, updu character(64) COLLATE pg_catalog."default" NOT NULL, updd timestamp with time zone NOT NULL, CONSTRAINT "DVSYSM_pkey" PRIMARY KEY (sysname) ) WITH ( OIDS = FALSE ) TABLESPACE pg_default; ALTER TABLE public."DVSYSM" OWNER to clarabase; GRANT ALL ON TABLE public."DVSYSM" TO clara; GRANT ALL ON TABLE public."DVSYSM" TO clarabase; GRANT ALL ON TABLE public."DVSYSM" TO "clarasoft-it"; COMMENT ON TABLE public."DVSYSM" IS 'SDLC: target systems'; -- Table: public.DVTASKM -- DROP TABLE public."DVTASKM"; CREATE TABLE public."DVTASKM" ( prjtype character varying(10) COLLATE pg_catalog."default" NOT NULL, prjid character varying(32) COLLATE pg_catalog."default" NOT NULL, taskid character varying(32) COLLATE pg_catalog."default" NOT NULL, descr character varying(128) COLLATE pg_catalog."default" NOT NULL, crtu character varying(10) COLLATE pg_catalog."default" NOT NULL, crtd timestamp with time zone NOT NULL, modu character varying(10) COLLATE pg_catalog."default" NOT NULL, modd timestamp without time zone NOT NULL, CONSTRAINT "DVTASKM_pkey" PRIMARY KEY (prjtype, prjid, taskid) ) WITH ( OIDS = FALSE ) TABLESPACE pg_default; ALTER TABLE public."DVTASKM" OWNER to clarabase; -- Table: public.DVTRGM -- DROP TABLE public."DVTRGM"; CREATE TABLE public."DVTRGM" ( trgid character varying(10) COLLATE pg_catalog."default" NOT NULL, cptid character varying(36) COLLATE pg_catalog."default" NOT NULL, crtu character varying(10) COLLATE pg_catalog."default" NOT NULL, crtd timestamp with time zone NOT NULL, modu character varying(10) COLLATE pg_catalog."default" NOT NULL, modd timestamp without time zone NOT NULL, CONSTRAINT "DVTRGM_pkey" PRIMARY KEY (trgid) ) WITH ( OIDS = FALSE ) TABLESPACE pg_default; ALTER TABLE public."DVTRGM" OWNER to clarabase; COMMENT ON TABLE public."DVTRGM" IS 'SDLC: task targets'; -- Table: public.DVTSKTGM -- DROP TABLE public."DVTSKTGM"; CREATE TABLE public."DVTSKTGM" ( prjtype character varying(10) COLLATE pg_catalog."default" NOT NULL, prjid character varying(32) COLLATE pg_catalog."default" NOT NULL, taskid character varying(32) COLLATE pg_catalog."default" NOT NULL, trgid character varying(10) COLLATE pg_catalog."default" NOT NULL, crtu character varying(10) COLLATE pg_catalog."default" NOT NULL, crtd timestamp with time zone NOT NULL, modu character varying(10) COLLATE pg_catalog."default" NOT NULL, modd timestamp without time zone NOT NULL, CONSTRAINT "DVTSKTGM_pkey" PRIMARY KEY (prjtype, prjid, taskid, trgid) ) WITH ( OIDS = FALSE ) TABLESPACE pg_default; ALTER TABLE public."DVTSKTGM" OWNER to clarabase;
28.611511
74
0.731959
d2632f9b59bbbf032fdde45671cd71bfbae167d1
560
php
PHP
resources/views/components/input-date.blade.php
happyicesys/mfg
ff02c5a3db46ad2aa0601cefebb01448085614f1
[ "MIT" ]
null
null
null
resources/views/components/input-date.blade.php
happyicesys/mfg
ff02c5a3db46ad2aa0601cefebb01448085614f1
[ "MIT" ]
null
null
null
resources/views/components/input-date.blade.php
happyicesys/mfg
ff02c5a3db46ad2aa0601cefebb01448085614f1
[ "MIT" ]
null
null
null
@props(['model']) <div x-data x-init="new moment()" ></div> <div class="input-group"> <input type="date" class="form-control" wire:model.defer="{{$model}}" {{$attributes}}> <div class="input-group-append"> <button class="btn btn-outline-secondary" wire:click="onPrevDateClicked({{$model}})"> <i class="fas fa-caret-left"></i> </button> <button class="btn btn-outline-secondary" wire:click="onNextDateClicked({{$model}})"> <i class="fas fa-caret-right"></i> </button> </div> </div>
28
93
0.578571
bafdc076ab5e8f0f8c21a2d3c63d71d2a9823e0c
2,430
dart
Dart
lib/models/organization.dart
mehulagg/Tasky-Mobile-App
b3860553c3ab1adf5993430ad13c0c8b51b64506
[ "MIT" ]
1
2022-02-13T04:19:06.000Z
2022-02-13T04:19:06.000Z
lib/models/organization.dart
sayyidisal/Tasky-Mobile-App
c4e537efc2ff1849c416da3f426d86b4f739dd4c
[ "MIT" ]
null
null
null
lib/models/organization.dart
sayyidisal/Tasky-Mobile-App
c4e537efc2ff1849c416da3f426d86b4f739dd4c
[ "MIT" ]
null
null
null
// To parse this JSON data, do // // final organization = organizationFromMap(jsonString); import 'dart:convert'; import 'package:tasky_app/models/user.dart'; Organization organizationFromMap(String str) => Organization.fromMap(json.decode(str)); String organizationToMap(Organization data) => json.encode(data.toMap()); class Organization { Organization({ this.status, this.message, this.data, }); bool status; String message; Data data; factory Organization.fromMap(Map<String, dynamic> json) => Organization( status: json["status"] == null ? null : json["status"], message: json["message"] == null ? null : json["message"], data: json["data"] == null ? null : Data.fromMap(json["data"]), ); Map<String, dynamic> toMap() => { "status": status == null ? null : status, "message": message == null ? null : message, "data": data == null ? null : data.toMap(), }; } class Data { Data({ this.id, this.name, this.logo, this.teams, this.createdAt, this.updatedAt, this.members, }); int id; String name; String logo; List<String> teams; DateTime createdAt; DateTime updatedAt; List<User> members; factory Data.fromMap(Map<String, dynamic> json) => Data( id: json["id"] == null ? null : json["id"], name: json["name"] == null ? null : json["name"], logo: json["logo"] == null ? null : json["logo"], teams: json["teams"] == null ? null : List<String>.from(json["teams"].map((x) => x)), createdAt: json["createdAt"] == null ? null : DateTime.parse(json["createdAt"]), updatedAt: json["updatedAt"] == null ? null : DateTime.parse(json["updatedAt"]), members: json["members"] == null ? null : List<User>.from(json["members"].map((x) => User.fromMap(x))), ); Map<String, dynamic> toMap() => { "id": id == null ? null : id, "name": name == null ? null : name, "logo": logo == null ? null : logo, "teams": teams == null ? null : List<dynamic>.from(teams.map((x) => x)), "createdAt": createdAt == null ? null : createdAt.toIso8601String(), "updatedAt": updatedAt == null ? null : updatedAt.toIso8601String(), "members": members == null ? null : List<dynamic>.from(members.map((x) => x.toMap())), }; }
31.973684
111
0.574897
ec35a7baae69b6d44e48417c74a0181e38c4331f
952
sql
SQL
db/migrations/20180412140917_create_request_items.sql
IzikAJ/iziproxy-server
9feb89e32c3bacf4e201305461ff910e0ecffaf0
[ "MIT" ]
null
null
null
db/migrations/20180412140917_create_request_items.sql
IzikAJ/iziproxy-server
9feb89e32c3bacf4e201305461ff910e0ecffaf0
[ "MIT" ]
null
null
null
db/migrations/20180412140917_create_request_items.sql
IzikAJ/iziproxy-server
9feb89e32c3bacf4e201305461ff910e0ecffaf0
[ "MIT" ]
null
null
null
-- +micrate Up -- SQL in section 'Up' is executed when this migration is applied CREATE SEQUENCE request_items_id_seq; CREATE TABLE request_items ( id BIGINT PRIMARY KEY NOT NULL DEFAULT nextval('request_items_id_seq'), uuid UUID NOT NULL, client_uuid UUID NOT NULL, connection_id BIGINT, remote_ip VARCHAR(200), method VARCHAR(30), path VARCHAR(512), query VARCHAR(1024), status_code INTEGER, created_at TIMESTAMP, updated_at TIMESTAMP ); ALTER SEQUENCE request_items_id_seq OWNED BY request_items.id; CREATE INDEX request_items_connection_id ON request_items (connection_id); CREATE INDEX request_items_client_uuid ON request_items (client_uuid); CREATE INDEX request_items_uuid ON request_items (uuid); -- +micrate Down -- SQL section 'Down' is executed when this migration is rolled back DROP INDEX request_items_connection_id; DROP INDEX request_items_client_uuid; DROP INDEX request_items_uuid; DROP TABLE request_items;
31.733333
74
0.804622
49e01730626a5b58ef9baffc0671d17d9c2bbc16
263
lua
Lua
thirds/vscode_extensions/of-effect/3rdparty/orangefilter_4.10/RenderState.lua
ysbing/voo
329d6a72ede6dd5903ca4d824bb3c49a5502f5c3
[ "Apache-2.0" ]
56
2022-01-29T04:52:27.000Z
2022-03-31T06:52:15.000Z
thirds/vscode_extensions/of-effect/3rdparty/orangefilter_4.10/RenderState.lua
jumpingfrog0/VOO
af191ece986f997cf98f85016aa7288c323210c3
[ "Apache-2.0" ]
null
null
null
thirds/vscode_extensions/of-effect/3rdparty/orangefilter_4.10/RenderState.lua
jumpingfrog0/VOO
af191ece986f997cf98f85016aa7288c323210c3
[ "Apache-2.0" ]
16
2022-01-29T04:52:39.000Z
2022-03-31T07:48:53.000Z
--* This Document is AutoGenerate by OrangeFilter, Don't Change it! * ---@meta --- ---[4.6]render state[parent:] --- ---@class RenderState RenderState = {} --- ---[4.6]constructor, no param --- --- @nodiscard function RenderState:new() end return RenderState
14.611111
69
0.657795
1307f05f5a6f41ec30b091bfabc19f80cc567505
2,768
c
C
micro_speech/micro_speech_graph_executor/src/model/default_lib0.c
guberti/tvm-arduino-profiling
9232483f210d2c4110a5e5b1e7cbb6123d00cedc
[ "Apache-2.0" ]
null
null
null
micro_speech/micro_speech_graph_executor/src/model/default_lib0.c
guberti/tvm-arduino-profiling
9232483f210d2c4110a5e5b1e7cbb6123d00cedc
[ "Apache-2.0" ]
null
null
null
micro_speech/micro_speech_graph_executor/src/model/default_lib0.c
guberti/tvm-arduino-profiling
9232483f210d2c4110a5e5b1e7cbb6123d00cedc
[ "Apache-2.0" ]
null
null
null
#include "../../src/standalone_crt/include/tvm/runtime/crt/module.h" #ifdef __cplusplus extern "C" #endif TVM_DLL int32_t tvmgen_default_fused_nn_contrib_dense_pack_add_fixed_point_multiply_add_clip_cast_cast_subtract_14669711146056581479_(TVMValue* args, int* type_code, int num_args, TVMValue* out_value, int* out_type_code); #ifdef __cplusplus extern "C" #endif TVM_DLL int32_t tvmgen_default_fused_nn_conv2d_add_cast_multiply_add_right_shift_cast_add_clip_cast_clip(TVMValue* args, int* type_code, int num_args, TVMValue* out_value, int* out_type_code); #ifdef __cplusplus extern "C" #endif TVM_DLL int32_t tvmgen_default_fused_nn_softmax(TVMValue* args, int* type_code, int num_args, TVMValue* out_value, int* out_type_code); #ifdef __cplusplus extern "C" #endif TVM_DLL int32_t tvmgen_default_fused_reshape_cast_subtract(TVMValue* args, int* type_code, int num_args, TVMValue* out_value, int* out_type_code); #ifdef __cplusplus extern "C" #endif TVM_DLL int32_t tvmgen_default_fused_reshape_cast_subtract_1(TVMValue* args, int* type_code, int num_args, TVMValue* out_value, int* out_type_code); #ifdef __cplusplus extern "C" #endif TVM_DLL int32_t tvmgen_default_fused_divide_add_round_cast_clip_cast(TVMValue* args, int* type_code, int num_args, TVMValue* out_value, int* out_type_code); #ifdef __cplusplus extern "C" #endif TVM_DLL int32_t _lookup_linked_param(TVMValue* args, int* type_code, int num_args, TVMValue* out_value, int* out_type_code); static TVMBackendPackedCFunc _tvm_func_array[] = { (TVMBackendPackedCFunc)tvmgen_default_fused_nn_contrib_dense_pack_add_fixed_point_multiply_add_clip_cast_cast_subtract_14669711146056581479_, (TVMBackendPackedCFunc)tvmgen_default_fused_nn_conv2d_add_cast_multiply_add_right_shift_cast_add_clip_cast_clip, (TVMBackendPackedCFunc)tvmgen_default_fused_nn_softmax, (TVMBackendPackedCFunc)tvmgen_default_fused_reshape_cast_subtract, (TVMBackendPackedCFunc)tvmgen_default_fused_reshape_cast_subtract_1, (TVMBackendPackedCFunc)tvmgen_default_fused_divide_add_round_cast_clip_cast, (TVMBackendPackedCFunc)_lookup_linked_param, }; static const TVMFuncRegistry _tvm_func_registry = { "\007tvmgen_default_fused_nn_contrib_dense_pack_add_fixed_point_multiply_add_clip_cast_cast_subtract_14669711146056581479_\000tvmgen_default_fused_nn_conv2d_add_cast_multiply_add_right_shift_cast_add_clip_cast_clip\000tvmgen_default_fused_nn_softmax\000tvmgen_default_fused_reshape_cast_subtract\000tvmgen_default_fused_reshape_cast_subtract_1\000tvmgen_default_fused_divide_add_round_cast_clip_cast\000_lookup_linked_param\000", _tvm_func_array, }; static const TVMModule _tvm_system_lib = { &_tvm_func_registry, }; const TVMModule* TVMSystemLibEntryPoint(void) { return &_tvm_system_lib; } ;
57.666667
453
0.863078
187deee15ceb51b12514ce46ff3db53d109d2a57
2,494
dart
Dart
lib/screens/directions/directions_list.dart
chrisnorman7/worldsmith_studio
e48f732bd062bae19c32f900711bfcd0a48ebe4f
[ "Unlicense" ]
null
null
null
lib/screens/directions/directions_list.dart
chrisnorman7/worldsmith_studio
e48f732bd062bae19c32f900711bfcd0a48ebe4f
[ "Unlicense" ]
null
null
null
lib/screens/directions/directions_list.dart
chrisnorman7/worldsmith_studio
e48f732bd062bae19c32f900711bfcd0a48ebe4f
[ "Unlicense" ]
null
null
null
import 'package:flutter/material.dart'; import '../../constants.dart'; import '../../project_context.dart'; import '../../util.dart'; import '../../widgets/cancel.dart'; import 'edit_direction.dart'; /// A widget for viewing and editing custom directions. class DirectionsList extends StatefulWidget { /// Create an instance. const DirectionsList({ required this.projectContext, super.key, }); /// The project context to use. final ProjectContext projectContext; /// Create state for this widget. @override DirectionsListState createState() => DirectionsListState(); } /// State for [DirectionsList]. class DirectionsListState extends State<DirectionsList> { /// Build a widget. @override Widget build(final BuildContext context) { final world = widget.projectContext.world; final children = <Widget>[]; final entries = world.directions.entries.toList() ..sort((final a, final b) => a.value.compareTo(b.value)); for (var i = 0; i < entries.length; i++) { final entry = entries[i]; children.add( ListTile( autofocus: i == 0, title: Text(entry.key), subtitle: Text('${entry.value}'), onTap: () async { await pushWidget( context: context, builder: (final context) => EditDirection( projectContext: widget.projectContext, name: entry.key, degrees: entry.value, ), ); setState(() {}); }, ), ); } return Cancel( child: Scaffold( appBar: AppBar( title: const Text('Directions'), ), body: ListView( children: children, ), floatingActionButton: FloatingActionButton( onPressed: () { for (var i = 0; i <= 360; i++) { if (world.directions.values .where( (final element) => element.floor() == i, ) .isEmpty) { world.directions['Untitled Direction'] = i.toDouble(); setState(() {}); return; } } showError( context: context, message: 'You already have 360 directions.', ); }, autofocus: world.directions.isEmpty, tooltip: 'Add Direction', child: createIcon, ), ), ); } }
28.022472
70
0.530473
98acaaa09e57fbeaa0db27b10cf5ee0f28bfce22
97
htm
HTML
application/third_party/dompdf/lib/fonts/log.htm
veradara/siph
2f9d49593f12c550a50d6d3273d694f4e366b2a6
[ "MIT" ]
null
null
null
application/third_party/dompdf/lib/fonts/log.htm
veradara/siph
2f9d49593f12c550a50d6d3273d694f4e366b2a6
[ "MIT" ]
null
null
null
application/third_party/dompdf/lib/fonts/log.htm
veradara/siph
2f9d49593f12c550a50d6d3273d694f4e366b2a6
[ "MIT" ]
null
null
null
<span style='color: #900'>6,400 KB</span> <span style='color: #090'>2,417.5298 ms</span><br />
97
97
0.618557
7dfbc0359073a0db01c9b6c75605a7d31860581e
463
lua
Lua
scripts/level/gnome.lua
sidav/shadow-of-the-wyrm
747afdeebed885b1a4f7ab42f04f9f756afd3e52
[ "MIT" ]
60
2019-08-21T04:08:41.000Z
2022-03-10T13:48:04.000Z
scripts/level/gnome.lua
cleancoindev/shadow-of-the-wyrm
51b23e98285ecb8336324bfd41ebf00f67b30389
[ "MIT" ]
3
2021-03-18T15:11:14.000Z
2021-10-20T12:13:07.000Z
scripts/level/gnome.lua
cleancoindev/shadow-of-the-wyrm
51b23e98285ecb8336324bfd41ebf00f67b30389
[ "MIT" ]
8
2019-11-16T06:29:05.000Z
2022-01-23T17:33:43.000Z
require('level') local function gnome_stat_gain_fn(creature_id, level) local is_pl = is_player(creature_id) local stat = RNG_range(1, 3) if level % 7 == 0 then if stat == 1 then incr_int(creature_id, is_pl) elseif stat == 2 then incr_wil(creature_id, is_pl) else incr_agi(creature_id, is_pl) end end end local gnome_race_stat_fn = gnome_stat_gain_fn level.set_race_stat_gain_level_fn("10_gnome", gnome_race_stat_fn)
21.045455
65
0.717063
5622c2786fb24aa090c0cd5583394daaa0c29525
222
go
Go
internal/app/routes.go
jayden1228/rank
a3eafbf2000c1822b8953b1a218231176fe26831
[ "RSA-MD" ]
null
null
null
internal/app/routes.go
jayden1228/rank
a3eafbf2000c1822b8953b1a218231176fe26831
[ "RSA-MD" ]
null
null
null
internal/app/routes.go
jayden1228/rank
a3eafbf2000c1822b8953b1a218231176fe26831
[ "RSA-MD" ]
null
null
null
package app import ( "rank/internal/app/hanlder" "github.com/gin-gonic/gin" ) func registerRouters(router *gin.Engine) { router.GET("/healthz", hanlder.HandleHealthz) router.POST("/match/score", hanlder.AddScore) }
17.076923
46
0.734234
5b4fddc8ba71cb1ea10f0da486bee8ff5bb0dea5
265
cpp
C++
HostMonitor/UIcode/source/ui_layout/View/nibp_list/nibp_list_xml.cpp
SammyEnigma/GuiLiteSamples
99d317c76ca345961e052c7a098773cb253694f4
[ "Apache-2.0" ]
510
2017-09-20T09:35:09.000Z
2022-03-31T03:35:24.000Z
HostMonitor/UIcode/source/ui_layout/View/nibp_list/nibp_list_xml.cpp
vbirds/GuiLiteSamples
99d317c76ca345961e052c7a098773cb253694f4
[ "Apache-2.0" ]
20
2018-01-11T13:35:24.000Z
2022-02-13T22:34:52.000Z
HostMonitor/UIcode/source/ui_layout/View/nibp_list/nibp_list_xml.cpp
vbirds/GuiLiteSamples
99d317c76ca345961e052c7a098773cb253694f4
[ "Apache-2.0" ]
198
2017-09-21T08:51:13.000Z
2022-03-30T12:49:20.000Z
#include "../include/GuiLite.h" #include "../include/ctrl_id.h" #include "nibp_list_xml.h" static c_table s_nibp_list_view_table; WND_TREE g_nibp_list_view_children[] = { {&s_nibp_list_view_table, ID_NIBP_LIST_VIEW_TABLE, 0, 0, 0, 335, 169}, {0,0,0,0,0,0,0} };
24.090909
71
0.732075
59b44e09ad649f498125a9fffaa4b1e59d662754
15,799
cpp
C++
src/pronet/pro_rtp/rtp_bucket.cpp
libpronet/libpronet
78f52fbe002767915553bdf58fb10453e63bf502
[ "Apache-2.0" ]
35
2018-10-29T06:31:09.000Z
2022-03-21T08:13:39.000Z
src/pronet/pro_rtp/rtp_bucket.cpp
libpronet/libpronet
78f52fbe002767915553bdf58fb10453e63bf502
[ "Apache-2.0" ]
null
null
null
src/pronet/pro_rtp/rtp_bucket.cpp
libpronet/libpronet
78f52fbe002767915553bdf58fb10453e63bf502
[ "Apache-2.0" ]
11
2018-11-03T04:45:29.000Z
2021-11-23T06:09:20.000Z
/* * Copyright (C) 2018-2019 Eric Tung <libpronet@gmail.com> * * Licensed under the Apache License, Version 2.0 (the "License"), * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * This file is part of LibProNet (https://github.com/libpronet/libpronet) */ #include "rtp_bucket.h" #include "rtp_base.h" #include "rtp_flow_stat.h" #include "rtp_packet.h" #include "../pro_util/pro_memory_pool.h" #include "../pro_util/pro_stl.h" #include "../pro_util/pro_time_util.h" #include "../pro_util/pro_z.h" #include <cassert> ///////////////////////////////////////////////////////////////////////////// //// #define BASE_REDLINE_BYTES (1024 * 1024) #define AUDIO_REDLINE_BYTES (1024 * 16) #define VIDEO_REDLINE_BYTES (1024 * 512) #define VIDEO_REDLINE_FRAMES 30 #define MAX_FRAME_SIZE (1024 * 1024) #define MAX_AUDIO_DELAY_MS 1000 #define MAX_VIDEO_DELAY_MS 1200 struct RTP_VIDEO_FRAME { RTP_VIDEO_FRAME() { tick = ProGetTickCount64(); keyFrame = false; bucket.SetRedline(MAX_FRAME_SIZE, 0, 0); } PRO_INT64 tick; bool keyFrame; CRtpBucket bucket; DECLARE_SGI_POOL(0) }; ///////////////////////////////////////////////////////////////////////////// //// CRtpBucket::CRtpBucket() { m_redlineBytes = BASE_REDLINE_BYTES; m_redlineFrames = 0; m_redlineDelayMs = 0; m_totalBytes = 0; m_flowStat.SetTimeSpan(GetRtpFlowctrlTimeSpan()); } CRtpBucket::~CRtpBucket() { Reset(); } void PRO_CALLTYPE CRtpBucket::Destroy() { delete this; } IRtpPacket* PRO_CALLTYPE CRtpBucket::GetFront() { if (m_packets.size() == 0) { return (NULL); } IRtpPacket* const packet = m_packets.front(); return (packet); } bool PRO_CALLTYPE CRtpBucket::PushBackAddRef(IRtpPacket* packet) { assert(packet != NULL); if (packet == NULL) { return (false); } const unsigned long size = packet->GetPayloadSize(); m_flowStat.PushData(1, size); /* * arrival time */ const PRO_INT64 tick = ProGetTickCount64(); ((CRtpPacket*)packet)->SetMagic2(tick); /* * remove old packets */ while (m_packets.size() > 0) { CRtpPacket* const packet2 = (CRtpPacket*)m_packets.front(); if (tick - packet2->GetMagic2() > m_redlineDelayMs && m_redlineDelayMs > 0) { m_packets.pop_front(); m_totalBytes -= packet2->GetPayloadSize(); packet2->Release(); continue; } break; } if (m_totalBytes > 0) { if ( m_totalBytes + size > m_redlineBytes || (m_packets.size() >= m_redlineFrames && m_redlineFrames > 0) ) { return (false); } } packet->AddRef(); m_packets.push_back(packet); m_totalBytes += size; return (true); } void PRO_CALLTYPE CRtpBucket::PopFrontRelease(IRtpPacket* packet) { if (packet == NULL || m_packets.size() == 0 || packet != m_packets.front()) { return; } m_packets.pop_front(); const unsigned long size = packet->GetPayloadSize(); m_flowStat.PopData(1, size); m_totalBytes -= size; packet->Release(); } void PRO_CALLTYPE CRtpBucket::Reset() { int i = 0; const int c = (int)m_packets.size(); for (; i < c; ++i) { m_packets[i]->Release(); } m_totalBytes = 0; m_packets.clear(); m_flowStat.Reset(); } void PRO_CALLTYPE CRtpBucket::SetRedline(unsigned long redlineBytes, /* = 0 */ unsigned long redlineFrames, /* = 0 */ unsigned long redlineDelayMs) /* = 0 */ { if (redlineBytes > 0) { m_redlineBytes = redlineBytes; } if (redlineFrames > 0) { m_redlineFrames = redlineFrames; } if (redlineDelayMs > 0) { m_redlineDelayMs = redlineDelayMs; } } void PRO_CALLTYPE CRtpBucket::GetRedline(unsigned long* redlineBytes, /* = NULL */ unsigned long* redlineFrames, /* = NULL */ unsigned long* redlineDelayMs) const /* = NULL */ { if (redlineBytes != NULL) { *redlineBytes = m_redlineBytes; } if (redlineFrames != NULL) { *redlineFrames = m_redlineFrames; } if (redlineDelayMs != NULL) { *redlineDelayMs = (unsigned long)m_redlineDelayMs; } } void PRO_CALLTYPE CRtpBucket::GetFlowctrlInfo(float* srcFrameRate, /* = NULL */ float* srcBitRate, /* = NULL */ float* outFrameRate, /* = NULL */ float* outBitRate, /* = NULL */ unsigned long* cachedBytes, /* = NULL */ unsigned long* cachedFrames) const /* = NULL */ { m_flowStat.CalcInfo(srcFrameRate, srcBitRate, outFrameRate, outBitRate); if (cachedBytes != NULL) { *cachedBytes = m_totalBytes; } if (cachedFrames != NULL) { *cachedFrames = (unsigned long)m_packets.size(); } } void PRO_CALLTYPE CRtpBucket::ResetFlowctrlInfo() { m_flowStat.Reset(); } ///////////////////////////////////////////////////////////////////////////// //// CRtpAudioBucket::CRtpAudioBucket() { m_redlineBytes = AUDIO_REDLINE_BYTES; m_redlineDelayMs = MAX_AUDIO_DELAY_MS; } bool PRO_CALLTYPE CRtpAudioBucket::PushBackAddRef(IRtpPacket* packet) { assert(packet != NULL); if (packet == NULL) { return (false); } const unsigned long size = packet->GetPayloadSize(); m_flowStat.PushData(1, size); /* * arrival time */ const PRO_INT64 tick = ProGetTickCount64(); ((CRtpPacket*)packet)->SetMagic2(tick); /* * remove old packets */ while (m_packets.size() > 0) { CRtpPacket* const packet2 = (CRtpPacket*)m_packets.front(); if (tick - packet2->GetMagic2() > m_redlineDelayMs || m_totalBytes + size > m_redlineBytes) { m_packets.pop_front(); m_totalBytes -= packet2->GetPayloadSize(); packet2->Release(); continue; } break; } packet->AddRef(); m_packets.push_back(packet); m_totalBytes += size; return (true); } ///////////////////////////////////////////////////////////////////////////// //// CRtpVideoBucket::CRtpVideoBucket() { m_redlineBytes = VIDEO_REDLINE_BYTES; m_redlineFrames = VIDEO_REDLINE_FRAMES; m_redlineDelayMs = MAX_VIDEO_DELAY_MS; m_totalBytes = 0; m_totalFrames = 0; m_waitingFrame = NULL; m_sendingFrame = NULL; m_needKeyFrame = true; m_flowStat.SetTimeSpan(GetRtpFlowctrlTimeSpan()); } CRtpVideoBucket::~CRtpVideoBucket() { Reset(); } void PRO_CALLTYPE CRtpVideoBucket::Destroy() { delete this; } IRtpPacket* PRO_CALLTYPE CRtpVideoBucket::GetFront() { if (m_sendingFrame != NULL) { IRtpPacket* const packet = m_sendingFrame->bucket.GetFront(); if (packet != NULL) { return (packet); } delete m_sendingFrame; m_sendingFrame = NULL; --m_totalFrames; } if (m_frames.size() == 0) { return (NULL); } m_sendingFrame = m_frames.front(); m_frames.pop_front(); IRtpPacket* const packet = m_sendingFrame->bucket.GetFront(); return (packet); } bool PRO_CALLTYPE CRtpVideoBucket::PushBackAddRef(IRtpPacket* packet) { assert(packet != NULL); if (packet == NULL) { return (false); } const bool marker = packet->GetMarker(); const bool keyFrame = packet->GetKeyFrame(); const bool firstPacketOfFrame = packet->GetFirstPacketOfFrame(); const unsigned long size = packet->GetPayloadSize(); m_flowStat.PushData(marker ? 1 : 0, size); /* * 1. synchronization point */ if (m_needKeyFrame) { if (!keyFrame || !firstPacketOfFrame) { return (false); } m_needKeyFrame = false; } /* * 2. waiting-frame */ { if (firstPacketOfFrame) { if (m_waitingFrame != NULL) { m_totalBytes -= m_waitingFrame->bucket.GetTotalBytes(); delete m_waitingFrame; m_waitingFrame = NULL; --m_totalFrames; } m_waitingFrame = new RTP_VIDEO_FRAME; m_waitingFrame->keyFrame = keyFrame; ++m_totalFrames; } else { if (m_waitingFrame == NULL) { m_needKeyFrame = true; /* ===resynchronize=== */ return (false); } } /* * move to waiting-frame */ m_waitingFrame->bucket.PushBackAddRef(packet); m_totalBytes += size; /* * check waiting-frame */ if (m_waitingFrame->bucket.GetTotalBytes() > MAX_FRAME_SIZE) { m_totalBytes -= m_waitingFrame->bucket.GetTotalBytes(); delete m_waitingFrame; m_waitingFrame = NULL; --m_totalFrames; m_needKeyFrame = true; /* ===resynchronize=== */ return (false); } if (!marker) { return (true); } } /* * 3. P-frame */ if (!m_waitingFrame->keyFrame) { /* * check redline */ if (m_totalBytes > m_redlineBytes || m_totalFrames > m_redlineFrames) { m_totalBytes -= m_waitingFrame->bucket.GetTotalBytes(); delete m_waitingFrame; m_waitingFrame = NULL; --m_totalFrames; m_needKeyFrame = true; /* ===resynchronize=== */ return (false); } /* * move to frame list */ m_frames.push_back(m_waitingFrame); m_waitingFrame = NULL; /* * check timeout */ RemoveOldFrames(); return (m_frames.size() > 0); } /* * 4. I-frame */ { /* * clean old frames */ while (m_frames.size() > 0) { RTP_VIDEO_FRAME* const frame = m_frames.front(); m_frames.pop_front(); m_totalBytes -= frame->bucket.GetTotalBytes(); delete frame; --m_totalFrames; } /* * move to frame list */ m_frames.push_back(m_waitingFrame); m_waitingFrame = NULL; } return (true); } void CRtpVideoBucket::RemoveOldFrames() { if (m_frames.size() == 0) { return; } const PRO_INT64 tick = ProGetTickCount64(); /* * first frame */ RTP_VIDEO_FRAME* frame = m_frames.front(); if (tick - frame->tick <= m_redlineDelayMs) { return; } while (m_frames.size() > 0) { frame = m_frames.front(); /* * find a good GOP */ if (frame->keyFrame && tick - frame->tick <= m_redlineDelayMs) { m_needKeyFrame = false; break; } /* * remove old frames */ m_frames.pop_front(); m_totalBytes -= frame->bucket.GetTotalBytes(); delete frame; --m_totalFrames; m_needKeyFrame = true; /* ===resynchronize=== */ } } void PRO_CALLTYPE CRtpVideoBucket::PopFrontRelease(IRtpPacket* packet) { if (packet == NULL || m_sendingFrame == NULL || packet != m_sendingFrame->bucket.GetFront()) { return; } const unsigned long size = packet->GetPayloadSize(); m_flowStat.PopData(packet->GetMarker() ? 1 : 0, size); m_totalBytes -= size; m_sendingFrame->bucket.PopFrontRelease(packet); if (m_sendingFrame->bucket.GetFront() == NULL) { delete m_sendingFrame; m_sendingFrame = NULL; --m_totalFrames; } } void PRO_CALLTYPE CRtpVideoBucket::Reset() { delete m_waitingFrame; int i = 0; const int c = (int)m_frames.size(); for (; i < c; ++i) { delete m_frames[i]; } delete m_sendingFrame; m_totalBytes = 0; m_totalFrames = 0; m_waitingFrame = NULL; m_frames.clear(); m_sendingFrame = NULL; m_needKeyFrame = true; m_flowStat.Reset(); } void PRO_CALLTYPE CRtpVideoBucket::SetRedline(unsigned long redlineBytes, /* = 0 */ unsigned long redlineFrames, /* = 0 */ unsigned long redlineDelayMs) /* = 0 */ { if (redlineBytes > 0) { m_redlineBytes = redlineBytes; } if (redlineFrames > 0) { m_redlineFrames = redlineFrames; } if (redlineDelayMs > 0) { m_redlineDelayMs = redlineDelayMs; } } void PRO_CALLTYPE CRtpVideoBucket::GetRedline(unsigned long* redlineBytes, /* = NULL */ unsigned long* redlineFrames, /* = NULL */ unsigned long* redlineDelayMs) const /* = NULL */ { if (redlineBytes != NULL) { *redlineBytes = m_redlineBytes; } if (redlineFrames != NULL) { *redlineFrames = m_redlineFrames; } if (redlineDelayMs != NULL) { *redlineDelayMs = (unsigned long)m_redlineDelayMs; } } void PRO_CALLTYPE CRtpVideoBucket::GetFlowctrlInfo(float* srcFrameRate, /* = NULL */ float* srcBitRate, /* = NULL */ float* outFrameRate, /* = NULL */ float* outBitRate, /* = NULL */ unsigned long* cachedBytes, /* = NULL */ unsigned long* cachedFrames) const /* = NULL */ { m_flowStat.CalcInfo(srcFrameRate, srcBitRate, outFrameRate, outBitRate); if (cachedBytes != NULL) { *cachedBytes = m_totalBytes; } if (cachedFrames != NULL) { *cachedFrames = m_totalFrames; } } void PRO_CALLTYPE CRtpVideoBucket::ResetFlowctrlInfo() { m_flowStat.Reset(); } ///////////////////////////////////////////////////////////////////////////// //// IRtpBucket* PRO_CALLTYPE CreateRtpBucket(RTP_MM_TYPE mmType, RTP_SESSION_TYPE sessionType) { assert(mmType != 0); if (mmType == 0) { return (NULL); } IRtpBucket* bucket = NULL; if (mmType >= RTP_MMT_AUDIO_MIN && mmType <= RTP_MMT_AUDIO_MAX) { bucket = new CRtpAudioBucket; } else if (mmType >= RTP_MMT_VIDEO_MIN && mmType <= RTP_MMT_VIDEO_MAX) { switch (sessionType) { case RTP_ST_TCPCLIENT_EX: case RTP_ST_TCPSERVER_EX: case RTP_ST_SSLCLIENT_EX: case RTP_ST_SSLSERVER_EX: { bucket = new CRtpVideoBucket; break; } default: { bucket = new CRtpBucket; break; } } } else { bucket = new CRtpBucket; } return (bucket); }
21.943056
80
0.537566
c6657dc9b1a33f56e8d1a8d859729dd0d52edb37
416
asm
Assembly
programs/oeis/332/A332126.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/332/A332126.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/332/A332126.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A332126: a(n) = 2*(10^(2n+1)-1)/9 + 4*10^n. ; 6,262,22622,2226222,222262222,22222622222,2222226222222,222222262222222,22222222622222222,2222222226222222222,222222222262222222222,22222222222622222222222,2222222222226222222222222,222222222222262222222222222,22222222222222622222222222222,2222222222222226222222222222222 mov $1,10 pow $1,$0 mul $1,5 add $1,5 bin $1,2 sub $1,45 div $1,45 mul $1,8 add $1,6 mov $0,$1
29.714286
273
0.793269
e08daf930d9c3e42895e7bf61337b858babe7627
544
sql
SQL
liferay/lucene-search-sample/docroot/WEB-INF/sql/tables.sql
ranraj/Workout
b0fe5d87ae72e5894e87f29e0a23e5f87cecd885
[ "Apache-2.0" ]
null
null
null
liferay/lucene-search-sample/docroot/WEB-INF/sql/tables.sql
ranraj/Workout
b0fe5d87ae72e5894e87f29e0a23e5f87cecd885
[ "Apache-2.0" ]
null
null
null
liferay/lucene-search-sample/docroot/WEB-INF/sql/tables.sql
ranraj/Workout
b0fe5d87ae72e5894e87f29e0a23e5f87cecd885
[ "Apache-2.0" ]
2
2018-03-16T05:33:07.000Z
2021-10-07T13:44:49.000Z
create table Sample_EntryComment ( uuid_ VARCHAR(75) null, commentId LONG not null primary key, companyId LONG, groupId LONG, userId LONG, comment_ VARCHAR(75) null, classNameId LONG, classPK LONG, createDate DATE null, modifiedDate DATE null ); create table Sample_SampleEntry ( uuid_ VARCHAR(75) null, entryId LONG not null primary key, companyId LONG, groupId LONG, userId LONG, userName VARCHAR(75) null, title VARCHAR(75) null, content VARCHAR(75) null, createDate DATE null, modifiedDate DATE null, status BOOLEAN );
20.923077
37
0.764706
bf11b474cea23e183b7598a1632e0684ea24a131
4,700
ps1
PowerShell
Update-OrionServerNodeIds.ps1
kmsigma/SwqlQueries
51441c0651e6afed585d29bf406aeb74331b6f05
[ "MIT" ]
8
2020-10-16T18:56:11.000Z
2021-09-14T13:52:04.000Z
Update-OrionServerNodeIds.ps1
kmsigma/SwqlQueries
51441c0651e6afed585d29bf406aeb74331b6f05
[ "MIT" ]
null
null
null
Update-OrionServerNodeIds.ps1
kmsigma/SwqlQueries
51441c0651e6afed585d29bf406aeb74331b6f05
[ "MIT" ]
1
2021-03-11T23:58:01.000Z
2021-03-11T23:58:01.000Z
<################################################## Update-OrionServerNodeIds.ps1 This script will update the Orion.OrionServers elements with the matching NodeIDs It prompts for confirmation on each update since there's a chance there will be a mismatch. ---Tested with Core 2020.2.6 HF2--- ##################################################> if ( -not ( $SwisConnection ) ) { $SwisHost = Read-Host -Prompt "Provide the IP or FQDN of your Orion server" if ( -not ( $SwisCreds ) ) { $SwisCreds = Get-Credential -Message "Enter your Orion credentials for $SwisHost" } if ( $SwisHost -and $SwisCreds ) { $SwisConnection = Connect-Swis -Hostname $SwisHost -Credential $SwisCreds } } $MissingNodeIds = Get-SwisData -SwisConnection $SwisConnection -Query "SELECT Uri, HostName FROM Orion.OrionServers WHERE IsNull(NodeID, 0) = 0" if ( $MissingNodeIds ) { ForEach ( $MissingNodeId in $MissingNodeIds ) { Write-Host "Checking matches for '$( $MissingNodeId.HostName )'" $PossibleMatches = Get-SwisData -SwisConnection $SwisConnection -Query "SELECT NodeID, Caption, DNS, SysName, IPAddress FROM Orion.Nodes WHERE Caption LIKE '%$( $MissingNodeId.HostName )%' OR DNS LIKE '%$( $MissingNodeId.HostName )%' OR SysName LIKE '%$( $MissingNodeId.HostName )%'" if ( $PossibleMatches.Count -eq 1 ) { # Single match Write-Host "`tFound a potential match:" $PossibleMatches | Format-Table # Build menu for choice $Yes = New-Object -TypeName System.Management.Automation.Host.ChoiceDescription -ArgumentList ( '&Yes', "Set NodeID for $( $MissingNodeId.HostName ) to $( $PossibleMatches.NodeID )" ) $No = New-Object -TypeName System.Management.Automation.Host.ChoiceDescription -ArgumentList ( '&No', "Make no changes") $Choices = [System.Management.Automation.Host.ChoiceDescription[]]($Yes, $No) $Title = "Update Orion.Servers Entry" $Message = "Do you want to update entry for '$( $MissingNodeId.HostName )' in Orion.OrionServers with NodeID: $( $PossibleMatches.NodeID )?" $Response = $Host.Ui.PromptForChoice($Title, $Message, $Choices, 1) # Check to see if we said "Yes" (Response 0) if ( $Response -eq 0 ) { Write-Host "We'd run the update now" -ForegroundColor Green Write-Host 'Command Code: Set-SwisObject -SwisConnection $SwisConnection -Uri $( $MissingNodeId.Uri ) -Properties @{ NodeId = $PossibleMatches.NodeID }' -ForegroundColor Green Write-Host "Command that's sent: Set-SwisObject -SwisConnection `$SwisConnection -Uri $( $MissingNodeId.Uri ) -Properties `@{ NodeId = $( $PossibleMatches.NodeID ) }" -ForegroundColor Green } else { Write-Host "I guess not you aren't interested in doing the update" -ForegroundColor Red } } elseif ( $PossibleMatches.Count -gt 1 ) { # Multiple matches Write-Host "`tFound multiple potential matches:" $PossibleMatches | Format-Table $Response = $null do { if ( -not $ResponseOk ) { if ( $Response ) { Write-Error -Message "'$Response' is an invalid NodeID. Please enter a Node ID from the below table." } $PossibleMatches | Format-Table -AutoSize } Write-Host "Enter the NodeID you'd like to assign to '$( $MissingNodeID.HostName )' in Orion.OrionServers " -NoNewLine $Response = Read-Host -Prompt "or enter 'S' to skip" $ResponseOk = $Response -in ( $PossibleMatches.NodeID ) -or $Response -eq 's' } until ( $ResponseOk ) if ( $Response.ToLower() -ne 's' ) { Write-Host "We'd run the update now" -ForegroundColor Green Write-Host 'Command Code: Set-SwisObject -SwisConnection $SwisConnection -Uri $( $MissingNodeId.Uri ) -Properties @{ NodeId = $Response }' -ForegroundColor Green Write-Host "Command that's sent: Set-SwisObject -SwisConnection `$SwisConnection -Uri $( $MissingNodeId.Uri ) -Properties `@{ NodeId = $Response }" -ForegroundColor Green } else { Write-Host "I guess not." -ForegroundColor Red } } else { # No matches Write-Error -Message "Found no appropriate matches. Are you monitoring your Orion servers?" } } } else { Write-Warning -Message "All Orion Server objects have a matching NodeID" }
54.022989
291
0.605319
ccb97945dfbf3711056d95346716a6fe91ae8cca
7,754
asm
Assembly
c2000/C2000Ware_1_00_06_00/libraries/math/CLAmath/c28/source/CLAexpN.asm
ramok/Themis_ForHPSDR
d0f323a843ac0a488ef816ccb7c828032855a40a
[ "Unlicense" ]
null
null
null
c2000/C2000Ware_1_00_06_00/libraries/math/CLAmath/c28/source/CLAexpN.asm
ramok/Themis_ForHPSDR
d0f323a843ac0a488ef816ccb7c828032855a40a
[ "Unlicense" ]
null
null
null
c2000/C2000Ware_1_00_06_00/libraries/math/CLAmath/c28/source/CLAexpN.asm
ramok/Themis_ForHPSDR
d0f323a843ac0a488ef816ccb7c828032855a40a
[ "Unlicense" ]
1
2021-07-21T08:10:37.000Z
2021-07-21T08:10:37.000Z
;;############################################################################# ;; FILE: CLAexpN.asm ;; ;; DESCRIPTION: CLA Base N Exponent function ;; ;; Group: C2000 ;; Target Family: C28x+CLA ;; ;;############################################################################# ;; $TI Release: CLA Math Library 4.02.02.00 $ ;; $Release Date: Oct 18, 2018 $ ;; $Copyright: Copyright (C) 2018 Texas Instruments Incorporated - ;; http://www.ti.com/ ALL RIGHTS RESERVED $ ;;############################################################################# .cdecls C,LIST,"CLAmath.h" .include "CLAeabi.asm" ;;---------------------------------------------------------------------------- ;; Description: ;; Step(1): Calculate ln(Num) ;; ;; Step(2): x*ln(Num) ;; ;; Step(3): N^x = e^(x*ln(Num)) ;; ;; Input : fVal (or x), the power of N - MR0 ;; N, the base - MR1 ;; ;; Benchmark: Cycles = 68 ;; Instructions = 68 ;; ;; Scratchpad Usage: (Local Function Scratchpad Pointer (SP)) ;; ;; |_______|<- exponent temporary variable (SP+4) ;; |_______|<- exponentN temporary variable (SP+2) ;; |_______|<- MR3 (SP+0) ;; ;;---------------------------------------------------------------------------- .def _CLAexpN .sect "Cla1Prog:_CLAexpN" .align 2 .def __cla_CLAexpN_sp __cla_CLAexpN_sp .usect ".scratchpad:Cla1Prog:_CLAexpN",6,0,1 _CLAexpN: .asmfunc .asg __cla_CLAexpN_sp + 0, _save_MR3 .asg __cla_CLAexpN_sp + 2, _expN_tmp .asg __cla_CLAexpN_sp + 2, _exp_tmp ; Context Save MMOV32 @_save_MR3, MR3 ;;---------------------------------------------------------------------------- ;; Step 1: Calculate ln(Num) ;;---------------------------------------------------------------------------- MMOV32 @_expN_tmp, MR0 ; Save fVal (or Num) ; Step 1 MMOV32 MR3, MR1 ; MR3 = N MMOV32 MR2, MR3 ; LOAD N TO MR2 ; Step 2 MLSR32 MR2, #23 ; MR2 = EXPONENT(X) MI32TOF32 MR2,MR2 ; Step 3 MMOV32 MR1,@_CLALN_TABLE_MASK1 ; MR1 = 0x3FFFFFFF MAND32 MR3, MR1, MR3 ; MMOV32 MR1,@_CLALN_TABLE_MASK2 ; MR1 = 0x3F800000 MOR32 MR3, MR1, MR3 ; MR3 = X/2^(EXPONENT) MFRACF32 MR3,MR3 ; MR3 = MANTISSA ; Step 4 ; || MMOV32 MR1,@_CLABIAS ; MSUBF32 MR2,MR2,MR1 ; MR2 = EXPONENT - BIAS ; ; ||MMOV32 MR1,@_CLALNV2 ; MMPYF32 MR2,MR2,MR1 ; MR2 = (Exponent-127)*(Ln(2)) MMPYF32 MR0,MR3,#32.0 ; 32 = Elements In Table MF32TOUI16 MR0,MR0 ; MR0 = int(32*Xm) MADD32 MR0,MR0,MR0 ; MR0 = 2*MR0 MADD32 MR1,MR0,MR0 ; MR1 = 4*MR0 MADD32 MR0,MR0,MR1 ; MR0 = 6*MR0 this is the index value for ; the stored data array MMOV16 MAR1,MR0,#_CLALnTable+4 MMOV32 MR1,@_CLABIAS MSUBF32 MR2,MR2,MR1 ; MR2 = EXPONENT - BIAS || MMOV32 MR1,@_CLALNV2 MMPYF32 MR2,MR2,MR1 ; MR2 = (Exponent-127)*(Ln(2)) ; Step 5 ; Ln(X) = A0 + Xm(A1 + A2*Xm) MMOV32 MR1,*MAR1[#-2]++ ; MR1 = A2 MMPYF32 MR1,MR3,MR1 ; MR1 = A2*Xm || MMOV32 MR0,*MAR1[#-2]++ ; MR0 = A1 MADDF32 MR1,MR0,MR1 ; MR1 = A1 + A2*Xm MMPYF32 MR0,MR3,MR1 ; MR0 = Xm*(A1 + A2*Xm) || MMOV32 MR1,*MAR1[#-2]++ ; MR1 = A0 MADDF32 MR3,MR1,MR0 ; MR3 = A0 + Xm*(A1 + A2*Xm) = Ln(1+mantissa) MADDF32 MR3,MR3,MR2 ; Y = Ln(1+mantissa) + (Exponent-127)*(Ln(2)) ;;---------------------------------------------------------------------------- ;; Step 2: x*ln(Num) ;;---------------------------------------------------------------------------- MMOV32 MR1, @_expN_tmp MMPYF32 MR0, MR1, MR3 ; MR0 = x*Ln(Num) ;;---------------------------------------------------------------------------- ;; Step 3: N^x = e^(x*ln(Num)) ;;---------------------------------------------------------------------------- ; The input argument fVal is refered to as X ; save input argument on scratchpad MMOV32 @_exp_tmp,MR0 ; Step 1 MMOV32 MR3,MR0 ; Load argument into MR3 MABSF32 MR3,MR3 ; LOAD |X| TO MR3 ; Step 2 MF32TOI32 MR0,MR3 ; MR0 = INTEGER(X) MFRACF32 MR1,MR3 ; MR1 = MANTISSA(X) ; Step 3 MADD32 MR2,MR0,MR0 MMOV16 MAR1,MR2,#_CLAExpTable ; Step 3 MMOV32 MR2,@_CLAINV7 ; MR2 = 1/7 MMPYF32 MR3,MR2,MR1 ; MR3 = Xm/7 || MMOV32 MR2,@_CLAINV1 ; MR2 = 1 MADDF32 MR3,MR3,MR2 ; MR3 =(1+Xm/7) MMOV32 MR2,@_CLAINV6 ; MR2 = 1/6 || MMPYF32 MR3,MR1,MR3 ; MR3 = Xm(1+Xm/7) MMPYF32 MR3,MR3,MR2 ; MR3 = Xm(1+Xm/7)/6 || MMOV32 MR2,@_CLAINV1 ; MR2 = 1 MADDF32 MR3,MR3,MR2 ; MR3 = 1+(Xm/6)*(1+Xm/7) || MMOV32 MR0,*MAR1 ; MR0 = e^(INTEGER(X)) MMOV32 MR2,@_CLAINV5 ; MR2 = .2 || MMPYF32 MR3,MR1,MR3 ; MR3 = Xm(1+Xm/6*(1+Xm/7)) MMPYF32 MR3,MR3,MR2 ; MR3 = Xm(1+Xm/6*(1+Xm/7))/5 || MMOV32 MR2,@_CLAINV1 ; MR2 = 1 MADDF32 MR3,MR3,MR2 ; MR3 = 1+(Xm/5)*(1+Xm/6*(1+Xm/7)) MMOV32 MR2,@_CLAINV4 ; MR2 = .25 || MMPYF32 MR3,MR1,MR3 ; MR3 = Xm(1+Xm/5*(1+Xm/6*(1+Xm/7))) MMPYF32 MR3,MR3,MR2 ; MR3 = Xm(1+Xm/5*(1+Xm/6*(1+Xm/7)))/4 || MMOV32 MR2,@_CLAINV1 ; MR2 = 1 MADDF32 MR3,MR3,MR2 ; MR3 = 1+(Xm/4)*(1+Xm/5*(1+Xm/6*(1+Xm/7))) MMOV32 MR2,@_CLAINV3 ; MR2 = .3333333 || MMPYF32 MR3,MR1,MR3 ; MR3 = Xm(1+(Xm/4)*(1+Xm/5)*(1+Xm/6*(1+Xm/7))) MMPYF32 MR3,MR3,MR2 ; MR3 = Xm(1+(Xm/4)*(1+Xm/5)*(1+Xm/6*(1+Xm/7)))*0.333333 || MMOV32 MR2,@_CLAINV1 ; MR2 = 1 MADDF32 MR3,MR3,MR2 ; MR3 = 1+(Xm/3)*(1+(Xm/4)*(1+Xm/5*(1+Xm/6*(1+Xm/7)))) MMOV32 MR2,@_CLAINV2 ; MR2 = .5 || MMPYF32 MR3,MR1,MR3 ; MR3 = Xm(1+(Xm/3)*(1+(Xm/4)*(1+Xm/5*(1+Xm/6*(1+Xm/7))))) MMPYF32 MR3,MR3,MR2 ; MR3 = Xm(1+(Xm/3)*(1+(Xm/4)*(1+Xm/5*(1+Xm/6*(1+Xm/7)))))*0.5 || MMOV32 MR2,@_CLAINV1 ; MR2 = 1 MADDF32 MR3,MR3,MR2 ; MR3 = 1+(1+(Xm/3)*(1+(Xm/4)*(1+Xm/5*(1+Xm/6*(1+Xm/7)))))Xm/2 MMPYF32 MR3,MR3,MR1 ; MR3 = Xm(1+(1+(Xm/3)*(1+(Xm/4)*(1+Xm/5*(1+Xm/6*(1+Xm/7)))))Xm/2) || MMOV32 MR2,@_CLAINV1 ; MR2 = 1 MADDF32 MR3,MR3,MR2 ; MR3 = e^(MANTISSA)= 1+Xm(1+(1+(Xm/3)*(1+(Xm/4)*(1+Xm/5*(1+Xm/6)*(1+Xm/7))))Xm/2) ; Step 4 MMPYF32 MR3,MR3,MR0 ; MR3 = e^(MANTISSA) x e^(INTEGER(X)) MMOV32 MR1,MR3,UNC ; Calculation of e^-x MEINVF32 MR2,MR1 ; MR2 = Ye = Estimate(1/Den) MMPYF32 MR3,MR2,MR1 ; MR3 = Ye*Den MSUBF32 MR3,#2.0,MR3 ; MR3 = 2.0 - Ye*Den MMPYF32 MR2,MR2,MR3 ; MR2 = Ye = Ye*(2.0 - Ye*Den) MMPYF32 MR3,MR2,MR1 ; MR3 = Ye*Den MSUBF32 MR3,#2.0,MR3 ; MR3 = 2.0 - Ye*Den MMPYF32 MR2,MR2,MR3 ; MR2 = Ye = Ye*(2.0 - Ye*Den) || MMOV32 MR0,@_exp_tmp ; MR2 = X (set/clear NF,ZF) ; Context Restore and Final Operations MRCNDD UNC MMOV32 MR1,MR2,LT ; update e^X with inverse value MMOV32 MR0,MR1 ; Store result in MR0 MMOV32 MR3,@_save_MR3 .unasg _save_MR3 .unasg _expN_tmp .unasg _exp_tmp .endasmfunc ;; End of File
41.913514
116
0.439515
e78493e4dcbcfb56478f001bf777a2811784c684
329
js
JavaScript
assets/components/organisms/organisms.config.js
jamesmacwhite/open-standards-guidebook
fb6ad6990b2cdf9c47b341099ee2dfbb972637ce
[ "MIT" ]
24
2018-01-11T15:53:18.000Z
2021-12-02T17:38:37.000Z
assets/components/organisms/organisms.config.js
jamesmacwhite/open-standards-guidebook
fb6ad6990b2cdf9c47b341099ee2dfbb972637ce
[ "MIT" ]
117
2018-01-18T12:30:27.000Z
2021-05-05T12:53:58.000Z
assets/components/organisms/organisms.config.js
jamesmacwhite/open-standards-guidebook
fb6ad6990b2cdf9c47b341099ee2dfbb972637ce
[ "MIT" ]
5
2018-02-15T21:51:02.000Z
2019-07-03T18:44:53.000Z
module.exports = { collator: function(markup, item) { return `<!-- Start: @${item.handle} -->\n <h3><code>${item.label}</code></h4>\n <div style="padding-bottom:20px">\n ${markup}\n </div>\n <!-- End: @${item.handle} -->\n` } }
29.909091
53
0.407295
ee3d128cfcc6958fde344206319317a69ebbd189
2,658
dart
Dart
fireshift/lib/shift/screens/dashboard/components/thread_paged_list.dart
AlexeyPerov/FireShift
a15586d6d7bf244b6b0c7b225683b6aa1c243289
[ "MIT" ]
1
2022-01-19T15:39:55.000Z
2022-01-19T15:39:55.000Z
fireshift/lib/shift/screens/dashboard/components/thread_paged_list.dart
AlexeyPerov/FireShift
a15586d6d7bf244b6b0c7b225683b6aa1c243289
[ "MIT" ]
null
null
null
fireshift/lib/shift/screens/dashboard/components/thread_paged_list.dart
AlexeyPerov/FireShift
a15586d6d7bf244b6b0c7b225683b6aa1c243289
[ "MIT" ]
null
null
null
import 'dart:async'; import 'package:fireshift/platform/utilities/navigator.dart'; import 'package:fireshift/shift/bloc/dashboard/thread_list.dart'; import 'package:fireshift/shift/entities/support_thread.dart'; import 'package:fireshift/shift/screens/chat/chat_screen.dart'; import 'package:fireshift/shift/screens/dashboard/components/thread_card.dart'; import 'package:flutter/material.dart'; import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart'; class ThreadPagedList extends StatefulWidget { final Filter filter; const ThreadPagedList(this.filter, {Key key}) : super(key: key); @override _ThreadPagedListState createState() => _ThreadPagedListState(); } class _ThreadPagedListState extends State<ThreadPagedList> { final ThreadListBloc _bloc = ThreadListBloc(); final PagingController<int, SupportThreadInfo> _pagingController = PagingController(firstPageKey: 0); StreamSubscription _blocSubscription; @override void initState() { _bloc.onFilterChangedSink.add(widget.filter); _pagingController.addPageRequestListener((pageKey) { _bloc.onPageRequestSink.add(pageKey); }); // We could've used StreamBuilder, but that would unnecessarily recreate // the entire widget every time the state changes. // Instead, handling the subscription ourselves and updating only the // _pagingController is more efficient. _blocSubscription = _bloc.onNewListingState.listen((listingState) { _pagingController.value = PagingState( nextPageKey: listingState.nextPageKey, error: listingState.error, itemList: listingState.itemList, ); }); super.initState(); } @override Widget build(BuildContext context) { _bloc.onFilterChangedSink.add(widget.filter); return RefreshIndicator( onRefresh: () => Future.sync( () => _pagingController.refresh(), ), child: PagedListView<int, SupportThreadInfo>.separated( pagingController: _pagingController, builderDelegate: PagedChildBuilderDelegate<SupportThreadInfo>( itemBuilder: (context, item, index) => SupportThreadInfoCard( threadInfo: item, onNavigateToChatScreen: _navigateToChatScreen), ), separatorBuilder: (c, i) => Container()), ); } @override void dispose() { _pagingController.dispose(); _blocSubscription.cancel(); _bloc.dispose(); super.dispose(); } void _navigateToChatScreen(BuildContext context, String threadId) { NavigatorUtilities.pushAndRemoveUntil( context, (c) => ChatConnector(threadId: threadId)); } }
32.814815
79
0.722724
1d0985164a3987e1787e24dbb170dc5739a5501d
2,796
dart
Dart
dart/lib/src/model/healthcare_provider_id.dart
martin-ladecky/loono-api
2da4105fef32ec48ab6613df13c412a2c10b4357
[ "MIT" ]
1
2021-11-21T21:21:34.000Z
2021-11-21T21:21:34.000Z
dart/lib/src/model/healthcare_provider_id.dart
martin-ladecky/loono-api
2da4105fef32ec48ab6613df13c412a2c10b4357
[ "MIT" ]
4
2021-12-02T20:37:28.000Z
2022-03-10T12:14:45.000Z
dart/lib/src/model/healthcare_provider_id.dart
martin-ladecky/loono-api
2da4105fef32ec48ab6613df13c412a2c10b4357
[ "MIT" ]
6
2021-10-31T09:43:18.000Z
2022-03-05T22:22:46.000Z
// // AUTO-GENERATED FILE, DO NOT MODIFY! // import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; part 'healthcare_provider_id.g.dart'; /// Composite key of the healthcare provider /// /// Properties: /// * [locationId] /// * [institutionId] abstract class HealthcareProviderId implements Built<HealthcareProviderId, HealthcareProviderIdBuilder> { @BuiltValueField(wireName: r'locationId') int get locationId; @BuiltValueField(wireName: r'institutionId') int get institutionId; HealthcareProviderId._(); @BuiltValueHook(initializeBuilder: true) static void _defaults(HealthcareProviderIdBuilder b) => b; factory HealthcareProviderId([void updates(HealthcareProviderIdBuilder b)]) = _$HealthcareProviderId; @BuiltValueSerializer(custom: true) static Serializer<HealthcareProviderId> get serializer => _$HealthcareProviderIdSerializer(); } class _$HealthcareProviderIdSerializer implements StructuredSerializer<HealthcareProviderId> { @override final Iterable<Type> types = const [HealthcareProviderId, _$HealthcareProviderId]; @override final String wireName = r'HealthcareProviderId'; @override Iterable<Object?> serialize(Serializers serializers, HealthcareProviderId object, {FullType specifiedType = FullType.unspecified}) { final result = <Object?>[]; result ..add(r'locationId') ..add(serializers.serialize(object.locationId, specifiedType: const FullType(int))); result ..add(r'institutionId') ..add(serializers.serialize(object.institutionId, specifiedType: const FullType(int))); return result; } @override HealthcareProviderId deserialize(Serializers serializers, Iterable<Object?> serialized, {FullType specifiedType = FullType.unspecified}) { final result = HealthcareProviderIdBuilder(); final iterator = serialized.iterator; while (iterator.moveNext()) { final key = iterator.current as String; iterator.moveNext(); final Object? value = iterator.current; switch (key) { case r'locationId': final valueDes = serializers.deserialize(value, specifiedType: const FullType(int)) as int; result.locationId = valueDes; break; case r'institutionId': final valueDes = serializers.deserialize(value, specifiedType: const FullType(int)) as int; result.institutionId = valueDes; break; } } return result.build(); } }
33.686747
105
0.64628
e8000e474647cb34c8ab25bbfe0d3c1c1f768df6
1,906
cpp
C++
packages/arb-avm-cpp/avm_values/src/code.cpp
EazyReal/arbitrum
858284c776b6b385b81ecf010c3caa33deddfee0
[ "Apache-2.0" ]
null
null
null
packages/arb-avm-cpp/avm_values/src/code.cpp
EazyReal/arbitrum
858284c776b6b385b81ecf010c3caa33deddfee0
[ "Apache-2.0" ]
4
2022-02-18T21:35:24.000Z
2022-03-31T07:15:09.000Z
packages/arb-avm-cpp/avm_values/src/code.cpp
EazyReal/arbitrum
858284c776b6b385b81ecf010c3caa33deddfee0
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2022, Offchain Labs, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <avm_values/code.hpp> void RunningCode::commitCodeToCore( const std::map<uint64_t, uint64_t>& segment_counts, const std::shared_ptr<CoreCode>& core_code) const { const std::unique_lock<std::shared_mutex> lock(mutex); // If our parent is an EphemeralBarrier, prune all the way down to the // CoreCode if (dynamic_cast<EphemeralBarrier*>(parent.get())) { parent = core_code; } parent->commitCodeToCore(segment_counts, core_code); auto root_segments = core_code->getRootSegments(); auto it = segment_counts.lower_bound(impl->first_segment); auto end = segment_counts.lower_bound(impl->nextSegmentNum()); for (; it != end; ++it) { auto segment = impl->getSegment(it->first); if (segment == nullptr) { continue; } auto inserted = root_segments.segments->insert(std::make_pair(it->first, segment)); // Verify that the element didn't exist previously assert(inserted.second); if (!inserted.second) { throw std::runtime_error( "code segment id collision when filling in code"); } } if (impl->nextSegmentNum() > *root_segments.next_segment_num) { *root_segments.next_segment_num = impl->nextSegmentNum(); } }
38.12
79
0.674711
8a3521557dd5c832af33f304e1412a56951a919c
1,036
rs
Rust
server/src/subscribe/main.rs
Admiy02/HoloStats
affa577f095fcec21a36c30fc8a5c694d8f32c78
[ "MIT" ]
null
null
null
server/src/subscribe/main.rs
Admiy02/HoloStats
affa577f095fcec21a36c30fc8a5c694d8f32c78
[ "MIT" ]
null
null
null
server/src/subscribe/main.rs
Admiy02/HoloStats
affa577f095fcec21a36c30fc8a5c694d8f32c78
[ "MIT" ]
null
null
null
#[path = "../error.rs"] mod error; #[path = "../requests/mod.rs"] mod requests; #[path = "../vtubers.rs"] mod vtubers; use futures::{stream, FutureExt, StreamExt}; use reqwest::Client; use crate::error::Result; use crate::vtubers::VTUBERS; const CALLBACK_URL: &str = concat!("https://holo.poi.cat/api/v3/", env!("PUBSUBHUBBUB_URL")); const TOPIC_BASE_URL: &str = "https://www.youtube.com/xml/feeds/videos.xml?channel_id="; #[tokio::main] async fn main() -> Result<()> { let client = Client::new(); stream::iter(VTUBERS.iter().filter_map(|v| v.youtube).map(|channel_id| { client .post("https://pubsubhubbub.appspot.com/subscribe") .header("Content-Type", "application/x-www-form-urlencoded") .body(format!( "hub.callback={}&hub.topic={}{}&hub.mode=subscribe", CALLBACK_URL, TOPIC_BASE_URL, channel_id )) .send() .map(|_| ()) })) .buffer_unordered(10) .collect::<Vec<()>>() .await; Ok(()) }
26.564103
93
0.584942
a53b38ce712940fae0f544cc29fd9fd8913653e8
1,292
kt
Kotlin
app/src/main/java/com/example/ar_liveimages/Utils.kt
TheBukharian/AR-LiveImage
874e49eb04d73002d5e41c811af8eb31aa96cc4e
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/example/ar_liveimages/Utils.kt
TheBukharian/AR-LiveImage
874e49eb04d73002d5e41c811af8eb31aa96cc4e
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/example/ar_liveimages/Utils.kt
TheBukharian/AR-LiveImage
874e49eb04d73002d5e41c811af8eb31aa96cc4e
[ "Apache-2.0" ]
null
null
null
package com.example.ar_liveimages import android.app.Activity import android.content.ContentValues.TAG import android.util.Log import com.google.ar.core.ArCoreApk import com.google.ar.core.exceptions.UnavailableException fun isARCoreSupportedAndUpToDate(activity: Activity): Boolean { return when (ArCoreApk.getInstance().checkAvailability(activity.applicationContext)) { ArCoreApk.Availability.SUPPORTED_INSTALLED -> true ArCoreApk.Availability.SUPPORTED_APK_TOO_OLD, ArCoreApk.Availability.SUPPORTED_NOT_INSTALLED -> { try { // Request ARCore installation or update if needed. when (ArCoreApk.getInstance().requestInstall(activity, true)) { ArCoreApk.InstallStatus.INSTALL_REQUESTED -> { Log.i(TAG, "ARCore installation requested.") false } ArCoreApk.InstallStatus.INSTALLED -> true } } catch (e: UnavailableException) { Log.e(TAG, "ARCore not installed", e) false } } ArCoreApk.Availability.UNSUPPORTED_DEVICE_NOT_CAPABLE -> // This device is not supported for AR. false else -> false } }
36.914286
105
0.623839
e92dd6c2b3bdcd459601972f295f183b2cade38a
1,281
lua
Lua
entities/weapons/weapon_twitch_mac10/shared.lua
SherlockMe/basewars.1.1
0daf733700f5c16c9984eb3c0bd72821b11b4667
[ "Apache-2.0" ]
1
2021-09-05T14:55:46.000Z
2021-09-05T14:55:46.000Z
entities/weapons/weapon_twitch_mac10/shared.lua
SherlockMe/basewars.1.1
0daf733700f5c16c9984eb3c0bd72821b11b4667
[ "Apache-2.0" ]
null
null
null
entities/weapons/weapon_twitch_mac10/shared.lua
SherlockMe/basewars.1.1
0daf733700f5c16c9984eb3c0bd72821b11b4667
[ "Apache-2.0" ]
2
2016-12-18T13:32:54.000Z
2019-06-17T16:47:39.000Z
SWEP.Base = "weapon_twitch_base" if SERVER then AddCSLuaFile ("shared.lua") SWEP.HoldType = "smg" end SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.PrintName = "Twitch MAC-10" SWEP.Slot = 2 SWEP.IconLetter = "l" SWEP.ViewModel = "models/weapons/v_smg_mac10.mdl" SWEP.WorldModel = "models/weapons/w_smg_mac10.mdl" --SWEP.ViewModelAimPos = Vector (2.5364, -1.8409, 1.745) SWEP.ViewModelAimPos = Vector (4.6152, 0, 0.9695) SWEP.ViewModelAimAng = Vector (3.5009, 0.31, 6.6686) SWEP.ViewModelFlip = true SWEP.DrawAmmo = false SWEP.DrawCrosshair = false SWEP.Primary.Sound = Sound ("Weapon_MAC10.Single") SWEP.Primary.BullettimeSound = Sound ("weapons/mac10/mac10-1.wav") SWEP.Primary.BullettimeSoundPitch = 70 SWEP.Primary.Damage = 18 SWEP.Primary.NumShots = 1 SWEP.Primary.Cone = 0.04 SWEP.Primary.ConeZoomed = 0.011 SWEP.Primary.Delay = 0.06 SWEP.Primary.ClipSize = 33 SWEP.Primary.DefaultClip = 288 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "smg1" SWEP.Recoil = 1.4 SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" if CLIENT then killicon.AddFont ("weapon_twitch_mac10", "CSKillIcons", "l", Color (150, 150, 255, 255)) end
26.142857
107
0.715847
007f249019727244520d4839f8761fdaf35bf95e
15,257
ps1
PowerShell
DescriptionFile.ps1
MarcusWalther/EnvironmentModuleCore
af3dfcf0e28c8e1e5203504abfbb37f797b33392
[ "MIT" ]
null
null
null
DescriptionFile.ps1
MarcusWalther/EnvironmentModuleCore
af3dfcf0e28c8e1e5203504abfbb37f797b33392
[ "MIT" ]
20
2019-04-04T20:21:59.000Z
2022-03-20T17:29:34.000Z
DescriptionFile.ps1
MarcusWalther/EnvironmentModuleCore
af3dfcf0e28c8e1e5203504abfbb37f797b33392
[ "MIT" ]
null
null
null
$nameRegex = "^[0-9A-Za-z_]+$" $versionRegex = "^v?(?:(?:(?<epoch>[0-9]+)!)?(?<release>[0-9]*(?:[_\.][0-9]+)*)(?<pre>[_\.]?(?<pre_l>(a|b|c|rc|alpha|beta|pre|preview|sp))[_\.]?(?<pre_n>[0-9]+)?)?(?<post>(?:-(?<post_n1>[0-9]+))|(?:[_\.]?(?<post_l>post|rev|r)[_\.]?(?<post_n2>[0-9]+)?))?(?<dev>[_\.]?(?<dev_l>dev)[_\.]?(?<dev_n>[0-9]+)?)?)(?:\+(?<local>[a-z0-9]+(?:[_\.][a-z0-9]+)*))?$" $architectureRegex = "^x64|x86$" $additionalOptionsRegex = "^[0-9A-Za-z.]+$" function Split-EnvironmentModuleName([String] $ModuleFullName, [switch] $Silent) { <# .SYNOPSIS Splits the given name into an array with 4 parts (name, version, architecture, additionalOptions). .DESCRIPTION Split a name string that either has the format 'Name-Version-Architecture' or just 'Name'. The output is an anonymous object with the 4 properties (name, version, architecture, additionalOptions). If a value was not specified, $null is returned at the according array index. .PARAMETER ModuleFullName The full name of the module that should be splitted. .OUTPUTS A string array with 4 parts (name, version, architecture, additionalOptions) #> $parts = $ModuleFullName.Split("-") $nameMatchResult = [System.Text.RegularExpressions.Regex]::Match($parts[0], $nameRegex, [System.Text.RegularExpressions.RegexOptions]::IgnoreCase) $result = @{} $result.Name = $nameMatchResult.Value $regexOrder = @(@($versionRegex, "Version"), @($architectureRegex, "Architecture"), @($additionalOptionsRegex, "AdditionalOptions")) $currentRegexIndex = 0 $matchFailed = (-not ($nameMatchResult.Success)) for($i = 1; $i -lt $parts.Count; $i++) { if($currentRegexIndex -ge $regexOrder.Count) { # More parts than matching regexes found $matchFailed = $true break } $currentRegex = $regexOrder[$currentRegexIndex][0] $matchResult = [System.Text.RegularExpressions.Regex]::Match($parts[$i], $currentRegex, [System.Text.RegularExpressions.RegexOptions]::IgnoreCase) if($matchResult.Success) { $result.($regexOrder[$currentRegexIndex][1]) = $matchResult.Value } else { $i-- # We have to check the same part again with the next regex in the list } $currentRegexIndex++ } if($matchFailed) { if(-not ($Silent)) { Write-Warning "The environment module name '$ModuleFullName' is not correctly formated. It must be 'Name-Version-Architecture-AdditionalOptions'" } return $null } return $result } function Read-EnvironmentModuleDescriptionFile([string] $ModuleBase, [string] $ModuleFullName) { <# .SYNOPSIS Read the Environment Module file (*.pse) of the of the given module. .DESCRIPTION This function will read the environment module info of the given module. If the module does not depend on the environment module, $null is returned. If no description file was found, an empty map is returned. .OUTPUTS The map containing the values or $null. #> Write-Verbose "Reading environment module description file for $($Module.Name)" # Search for a pse1 file in the base directory return Read-EnvironmentModuleDescriptionFileByPath (Join-Path $ModuleBase "$($ModuleFullName).pse1") } function Read-EnvironmentModuleDescriptionFileByPath([string] $Path) { <# .SYNOPSIS Read the given Environment Module file (*.pse). .DESCRIPTION This function will read the environment module info. If the description file was not found, an empty map is returned. .OUTPUTS The map containing the values or $null. #> if(Test-Path $Path) { # Parse the pse1 file Write-Verbose "Found desciption file $descriptionFile" return Import-PowershellDataFile $Path } return @{} } function New-EnvironmentModuleInfoBase { <# .SYNOPSIS Create a new EnvironmentModuleInfoBase object from the given parameters. .PARAMETER Module The module info that contains the base information. .OUTPUTS The created object of type EnvironmentModuleInfoBase or $null. .NOTES The given module name must match exactly one module, otherwise $null is returned. #> [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] param ( [PSModuleInfo] $Module ) $nameParts = Split-EnvironmentModuleName $Module.Name if($null -eq $nameParts) { return $null } $descriptionContent = Read-EnvironmentModuleDescriptionFile $Module.ModuleBase $Module.Name if(-not $descriptionContent) { return $null } $result = New-Object EnvironmentModuleCore.EnvironmentModuleInfoBase -ArgumentList @($Module.Name, $Module.ModuleBase, $nameParts.Name, $nameParts.Version, $nameParts.Architecture, $nameParts.AdditionalOptions, [EnvironmentModuleCore.EnvironmentModuleType]::Default) Set-EnvironmentModuleInfoBaseParameter $result $descriptionContent return $result } function Set-EnvironmentModuleInfoBaseParameter { <# .SYNOPSIS Assign the given parameters to the passed module object. .PARAMETER Module The module to modify. .PARAMETER Parameters The parameters to set. #> [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] param( [EnvironmentModuleCore.EnvironmentModuleInfoBase][ref] $Module, [hashtable] $Parameters ) if($Parameters.Contains("ModuleType")) { $Module.ModuleType = [Enum]::Parse([EnvironmentModuleCore.EnvironmentModuleType], $descriptionContent.Item("ModuleType")) Write-Verbose "Read module type $($Module.ModuleType)" } } function New-EnvironmentModuleInfo { <# .SYNOPSIS Create a new EnvironmentModuleInfo object from the given parameters. .PARAMETER Module The module info that contains the base information. .PARAMETER ModuleFullName The full name of the module. Only used if the module parameter is not set. .PARAMETER ModuleFile The module file (psd1) to load. If this is set, the ModuleFullName is not evaluated. .OUTPUTS The created object of type EnvironmentModuleInfo or $null. .NOTES The given module name must match exactly one module, otherwise $null is returned. #> [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] param ( [EnvironmentModuleCore.EnvironmentModuleInfoBase] $Module = $null, [String] $ModuleFullName = $null, [String] $ModuleFile = $null ) if($null -eq $Module) { if(-not ([string]::IsNullOrEmpty($ModuleFile))) { $matchingModules = (Get-Module "$ModuleFile" -ListAvailable) if($matchingModules.Length -lt 1) { Write-Verbose "Unable to find the module $ModuleFile" return $null } $Module = New-EnvironmentModuleInfoBase $matchingModules[0] } else { $matchingModules = Get-EnvironmentModule -ListAvailable $ModuleFullName if($matchingModules.Length -lt 1) { Write-Verbose "Unable to find the module $ModuleFullName in the list of all environment modules" return $null } if($matchingModules.Length -gt 1) { Write-Warning "More than one environment module matches the given full name '$ModuleFullName'" } $Module = $matchingModules[0] } } $descriptionContent = Read-EnvironmentModuleDescriptionFile $Module.ModuleBase $Module.FullName if(-not $descriptionContent) { return $null } $arguments = @($Module, $null, (Join-Path $script:tmpEnvironmentRootSessionPath $Module.Name)) $result = New-Object EnvironmentModuleCore.EnvironmentModuleInfo -ArgumentList $arguments Set-EnvironmentModuleInfoBaseParameter $result $descriptionContent $result.DirectUnload = $false $customSearchPaths = $script:customSearchPaths[$Module.FullName] if ($customSearchPaths) { $result.SearchPaths = $result.SearchPaths + $customSearchPaths } $dependencies = @() if($descriptionContent.Contains("RequiredEnvironmentModules")) { Write-Warning "The field 'RequiredEnvironmentModules' defined for '$($Module.FullName)' is deprecated, please use the dependencies field." $dependencies = $descriptionContent.Item("RequiredEnvironmentModules") | Foreach-Object { New-Object "EnvironmentModuleCore.DependencyInfo" -ArgumentList $_} Write-Verbose "Read module dependencies $($dependencies)" } if($descriptionContent.Contains("Dependencies")) { $dependencies = $dependencies + ($descriptionContent.Item("Dependencies") | Foreach-Object { if($_.GetType() -eq [string]) { New-Object "EnvironmentModuleCore.DependencyInfo" -ArgumentList $_ } else { New-Object "EnvironmentModuleCore.DependencyInfo" -ArgumentList $_.Name, $_.Optional } }) Write-Verbose "Read module dependencies $($dependencies)" } $result.Dependencies = $dependencies if($descriptionContent.Contains("DirectUnload")) { $result.DirectUnload = $descriptionContent.Item("DirectUnload") Write-Verbose "Read module direct unload $($result.DirectUnload)" } $requiredItems = @() if($descriptionContent.Contains("RequiredFiles")) { Write-Warning "The field 'RequiredFiles' defined for '$($Module.FullName)' is deprecated, please use the RequiredItems field." $requiredItems = $result.RequiredItems + ($descriptionContent.Item("RequiredFiles") | ForEach-Object { New-Object "EnvironmentModuleCore.RequiredItem" -ArgumentList ([EnvironmentModuleCore.RequiredItem]::TYPE_FILE), $_ }) Write-Verbose "Read required files $($descriptionContent.Item('RequiredFiles'))" } if($descriptionContent.Contains("RequiredItems") -and $descriptionContent.Item("RequiredItems").count -gt 0) { $requiredItems = $requiredItems + ($descriptionContent.Item("RequiredItems") | Foreach-Object { if($_.GetType() -eq [string]) { New-Object "EnvironmentModuleCore.RequiredItem" -ArgumentList ([EnvironmentModuleCore.RequiredItem]::TYPE_FILE), $_ } else { New-Object "EnvironmentModuleCore.RequiredItem" -ArgumentList $_.Type, $_.Value } }) Write-Verbose "Read module dependencies $($dependencies)" } $result.RequiredItems = $requiredItems if($descriptionContent.Contains("DefaultRegistryPaths") -and $descriptionContent.Item("DefaultRegistryPaths").count -gt 0) { Write-Warning "The field 'DefaultRegistryPaths' defined for '$($Module.FullName)' is deprecated, please use the DefaultSearchPaths field." $pathValues = $descriptionContent.Item("DefaultRegistryPaths") $searchPathType = "REGISTRY" $searchPathPriority = $script:searchPathTypes[$searchPathType].Item2 Write-Verbose "Read default registry paths $($result.DefaultRegistryPaths)" $result.SearchPaths = $result.SearchPaths + ($pathValues | ForEach-Object { $parts = $_.Split([IO.Path]::PathSeparator) + @("") New-Object "EnvironmentModuleCore.SearchPath" -ArgumentList @($parts[0], $searchPathType, $searchPathPriority, $parts[1], $true) }) } if($descriptionContent.Contains("DefaultFolderPaths") -and $descriptionContent.Item("DefaultFolderPaths").count -gt 0) { Write-Warning "The field 'DefaultFolderPaths' defined for '$($Module.FullName)' is deprecated, please use the DefaultSearchPaths field." $pathValues = $descriptionContent.Item("DefaultFolderPaths") $searchPathType = [EnvironmentModuleCore.SearchPath]::TYPE_DIRECTORY $searchPathPriority = $script:searchPathTypes[$searchPathType].Item2 Write-Verbose "Read default folder paths $($result.DefaultFolderPaths)" $result.SearchPaths = $result.SearchPaths + ($pathValues | ForEach-Object { $parts = $_.Split([IO.Path]::PathSeparator) + @("") New-Object "EnvironmentModuleCore.SearchPath" -ArgumentList @($parts[0], $searchPathType, $searchPathPriority, $parts[1], $true) }) } if($descriptionContent.Contains("DefaultEnvironmentPaths") -and $descriptionContent.Item("DefaultEnvironmentPaths").count -gt 0) { Write-Warning "The field 'DefaultEnvironmentPaths' defined for '$($Module.FullName)' is deprecated, please use the DefaultSearchPaths field." $pathValues = $descriptionContent.Item("DefaultEnvironmentPaths") $searchPathType = [EnvironmentModuleCore.SearchPath]::TYPE_ENVIRONMENT_VARIABLE $searchPathPriority = $script:searchPathTypes[$searchPathType].Item2 Write-Verbose "Read default environment paths $($result.DefaultEnvironmentPaths)" $result.SearchPaths = $result.SearchPaths + ($pathValues | ForEach-Object { $parts = $_.Split([IO.Path]::PathSeparator) + @("") New-Object "EnvironmentModuleCore.SearchPath" -ArgumentList @($parts[0], $searchPathType, $searchPathPriority, $parts[1], $true) }) } if($descriptionContent.Contains("DefaultSearchPaths") -and $descriptionContent.Item("DefaultSearchPaths").count -gt 0) { $result.SearchPaths = $result.SearchPaths + ($descriptionContent.Item("DefaultSearchPaths") | ForEach-Object { if($_.GetType() -eq [string]) { $searchPathType = [EnvironmentModuleCore.SearchPath]::TYPE_DIRECTORY $searchPathPriority = $script:searchPathTypes[$searchPathType].Item2 New-Object "EnvironmentModuleCore.SearchPath" -ArgumentList $_, $searchPathType, $searchPathPriority, $null, $true } else { $searchPathType = $_.Type $searchPathPriority = $_.Priority if($null -eq $searchPathPriority) { $searchPathPriority = $script:searchPathTypes[$searchPathType].Item2 } New-Object "EnvironmentModuleCore.SearchPath" -ArgumentList $_.Key, $searchPathType, $searchPathPriority, $_.SubFolder, $true } }) Write-Verbose "Read module default search paths $($result.SearchPaths)" } if($descriptionContent.Contains("StyleVersion")) { $result.StyleVersion = $descriptionContent.Item("StyleVersion") Write-Verbose "Read module style version $($result.StyleVersion)" } if($descriptionContent.Contains("Category")) { $result.Category = $descriptionContent.Item("Category") Write-Verbose "Read module category $($result.Category)" } if($descriptionContent.Contains("Parameters")) { $descriptionContent.Item("Parameters").Keys | Foreach-Object { $result.Parameters[$_] = $descriptionContent.Item("Parameters")[$_] } Write-Verbose "Read module parameters $($result.Parameters.GetEnumerator() -join ',')" } return $result }
44.351744
352
0.676018
db17c898f21ba9271691604fa4c83ebd4f03ebdc
242
kt
Kotlin
Kotlin/Code/Kotlin-Github/app/src/main/java/com/bennyhuo/github/utils/Network.kt
hiloWang/notes
64a637a86f734e4e80975f4aa93ab47e8d7e8b64
[ "Apache-2.0" ]
2
2020-10-08T13:22:08.000Z
2021-07-28T14:45:41.000Z
Kotlin/Kotlin-github/app/src/main/java/com/bennyhuo/github/utils/Network.kt
flyfire/Programming-Notes-Code
4b1bdd74c1ba0c007c504834e4508ec39f01cd94
[ "Apache-2.0" ]
null
null
null
Kotlin/Kotlin-github/app/src/main/java/com/bennyhuo/github/utils/Network.kt
flyfire/Programming-Notes-Code
4b1bdd74c1ba0c007c504834e4508ec39f01cd94
[ "Apache-2.0" ]
6
2020-08-20T07:19:17.000Z
2022-03-02T08:16:21.000Z
package com.bennyhuo.github.utils import com.bennyhuo.github.AppContext import org.jetbrains.anko.connectivityManager object Network { fun isAvailable(): Boolean = AppContext.connectivityManager.activeNetworkInfo?.isAvailable ?: false }
30.25
103
0.822314
78dda245454c742710d6e677a7c0111546354c1b
748
tab
SQL
CZ-9x9-CMR/4-16-ES-08STATES-40CMR23.tab
bidlom/Mendel2019-ES
24632a8582e2b18bd8367ecb599c9d4b58e7d7da
[ "BSD-3-Clause" ]
null
null
null
CZ-9x9-CMR/4-16-ES-08STATES-40CMR23.tab
bidlom/Mendel2019-ES
24632a8582e2b18bd8367ecb599c9d4b58e7d7da
[ "BSD-3-Clause" ]
null
null
null
CZ-9x9-CMR/4-16-ES-08STATES-40CMR23.tab
bidlom/Mendel2019-ES
24632a8582e2b18bd8367ecb599c9d4b58e7d7da
[ "BSD-3-Clause" ]
null
null
null
2 8 0 0 0 0 6 1 0 0 0 0 7 1 0 0 0 1 1 1 0 0 0 4 0 1 0 0 0 7 1 7 0 0 1 0 0 7 0 0 1 0 1 7 0 0 1 0 2 2 0 0 1 0 7 0 0 0 1 1 1 7 0 0 7 2 1 1 0 1 0 0 1 1 0 1 0 0 2 1 0 1 1 0 2 2 0 1 1 0 3 2 0 1 1 2 1 2 0 1 1 2 2 2 0 1 7 2 1 2 0 2 0 0 1 6 0 2 1 0 1 2 0 2 1 0 2 2 0 2 1 0 5 2 0 2 1 1 2 2 0 2 6 0 5 2 0 3 1 0 0 5 0 5 0 0 0 1 0 6 0 0 0 1 0 7 0 0 0 1 0 7 1 0 0 5 0 7 1 0 2 2 0 7 1 2 1 2 1 0 7 1 1 1 1 0 7 1 4 1 1 0 7 2 1 1 1 0 7 3 4 1 1 1 0 3 0 3 1 1 0 6 0 3 1 1 4 3 0 3 1 1 5 0 3 3 1 3 0 0 0 3 1 3 1 0 0 3 1 3 5 0 0 3 1 4 0 0 0 3 3 0 0 4 0 2 3 0 3 0 0 5 3 0 4 0 0 5 3 2 4 3 0 3 3 3 0 0 0 3 3 3 5 3 0 3 3 3 6 3 4 3 3 4 0 0 0 3 3 4 0 4 0 6 3 4 2 4 0 3 3 4 4 0 0 3 3 6 5 3 0 3 5 0 0 0 0 4 5 0 3 0 0 0 5 3 0 0 0 3 6 0 0 0 0 4 6 3 5 0 3 3 7 0 0 0 0 4 7 0 4 0 0 0
11.6875
11
0.5
a9bba2b5228123c26915c56ecdf61e6f5d5afec0
1,742
html
HTML
docs/naaccr-documentation/naaccr15/subsqRx3rdCourseCodes.html
imsweb/layout
2d9eb699fb3b05e430fbab5021f154367eef5914
[ "BSD-3-Clause" ]
1
2021-09-03T16:01:16.000Z
2021-09-03T16:01:16.000Z
docs/naaccr-documentation/naaccr15/subsqRx3rdCourseCodes.html
imsweb/layout
2d9eb699fb3b05e430fbab5021f154367eef5914
[ "BSD-3-Clause" ]
81
2015-11-04T19:11:11.000Z
2021-09-03T09:41:23.000Z
docs/naaccr-documentation/naaccr14/subsqRx3rdCourseCodes.html
imsweb/layout
2d9eb699fb3b05e430fbab5021f154367eef5914
[ "BSD-3-Clause" ]
1
2017-03-28T06:13:15.000Z
2017-03-28T06:13:15.000Z
<table class="naaccr-summary-table naaccr-borders"> <tr> <th class="naaccr-summary-header naaccr-borders">Alternate Name</th> <th class="naaccr-summary-header naaccr-borders">Item #</th> <th class="naaccr-summary-header naaccr-borders">Length</th> <th class="naaccr-summary-header naaccr-borders">Source of Standard</th> <th class="naaccr-summary-header naaccr-borders">Column #</th> </tr> <tr> <td class="naaccr-summary-cell naaccr-borders"></td> <td class="naaccr-summary-cell naaccr-borders naaccr-summary-centered">1690</td> <td class="naaccr-summary-cell naaccr-borders naaccr-summary-centered">11</td> <td class="naaccr-summary-cell naaccr-borders naaccr-summary-centered"></td> <td class="naaccr-summary-cell naaccr-borders naaccr-summary-centered">1755 - 1765</td> </tr> </table> <div class='content chap10-para-head'><strong><strong>Description</strong></strong></div> <div class='content chap10-para'>The name for a group of subfields that describe the third course or set of subsequent therapy. As of January 1, 2003, CoC no longer supports Subsequent Therapy data items.<br/><br/>Group names appear only in the data dictionary and Appendix E.<strong><br/><br/>Subfields</strong><br/>&#160;&#160; &#160;&#160; &#160;&#160; Subsq RX 3rd Course Surg [1691]<br/>&#160;&#160; &#160;&#160; &#160;&#160; Subsq RX 3rd Course Rad [1692]<br/>&#160;&#160; &#160;&#160; &#160;&#160; Subsq RX 3rd Course Chemo [1693]<br/>&#160;&#160; &#160;&#160; &#160;&#160; Subsq RX 3rd Course Horm [1694]<br/>&#160;&#160; &#160;&#160; &#160;&#160; Subsq RX 3rd Course BRM [1695]<br/>&#160;&#160; &#160;&#160; &#160;&#160; Subsq RX 3rd Course Oth [1696] </div>
87.1
760
0.67279
c5fde5dbb55b825cad99ebb64ed278c8d5a2fcbb
1,473
hpp
C++
src/include/base-util/conv.hpp
dpacbach/base-util
32f9f2201f784d60437eec351c9a5950170e9650
[ "MIT" ]
2
2019-11-13T15:30:06.000Z
2021-09-15T02:25:51.000Z
src/include/base-util/conv.hpp
dpacbach/base-util
32f9f2201f784d60437eec351c9a5950170e9650
[ "MIT" ]
null
null
null
src/include/base-util/conv.hpp
dpacbach/base-util
32f9f2201f784d60437eec351c9a5950170e9650
[ "MIT" ]
null
null
null
/**************************************************************** * Text Encoding Conversion Utilities ****************************************************************/ #pragma once #include "fs.hpp" #include <vector> namespace conv { // This function takes a vector of chars that are assumed to con- // tain ascii-encoded text and it will convert them to UTF16LE by // simply widening each byte with a zero byte. The input is veri- // fied to be valid ASCII (i.e., numerical values of characters // <= 127) and the function will throw if a violation is found // (which might indicate the presence of a non-ascii encoding // which then cannot be converted using this simple method of // this function). Optionally it will insert a byte order mark // (BOM) of 0xFF 0xFE at the start of the resultant vector. Note: // if concatentaning multiple UTF16 strings, only the initial one // should contain a byte order mark. // // If the input is empty the the function will yield an empty re- // sult even if bom is true. std::vector<char> ascii_2_utf16le( std::vector<char> const& v, bool bom = false ); // Will call ascii_2_utf16le on a vector containing the contents // of the file; note that byte order mark (BOM) is inserted at // the start of the file by default. Will throw if input file // contains any non-ascii characters. void ascii_2_utf16le( fs::path const& p, bool bom = true ); } // namespace conv
40.916667
66
0.643585
c389fd351b2682e9469ab33f47a8277a4cf151cc
1,006
go
Go
examples/custom-routes/main.go
beanox/webservice
3ea9aa9bcb8efd39b4fe2e0a5022e7a4387e6248
[ "Apache-2.0" ]
null
null
null
examples/custom-routes/main.go
beanox/webservice
3ea9aa9bcb8efd39b4fe2e0a5022e7a4387e6248
[ "Apache-2.0" ]
null
null
null
examples/custom-routes/main.go
beanox/webservice
3ea9aa9bcb8efd39b4fe2e0a5022e7a4387e6248
[ "Apache-2.0" ]
null
null
null
package main import ( "encoding/json" "net/http" "github.com/beanox/webservice" "github.com/beanox/webservice/logging" "github.com/gorilla/mux" "github.com/sirupsen/logrus" ) type customRoutesService struct { } func main() { svc := New() svc.Start() } // New creates App instance func New() webservice.SimpleService { return webservice.NewSimpleService(&customRoutesService{}) } func (s *customRoutesService) GetHTTPHandler() (handler http.Handler, err error) { router := mux.NewRouter() // Added new route GET /status router.Handle("/status", webservice.AppHandler(s.getServerStatus)).Methods("GET") handler = router // Add logger (will be visible only in trace level) handler = logging.New(logrus.WithField("facility", "microservice")).Middleware(handler) return } func (s *customRoutesService) getServerStatus(w http.ResponseWriter, r *http.Request) error { json.NewEncoder(w).Encode(webservice.NewServerStatus()) return nil }
21.869565
94
0.707753
ddee3ce3fffe2840c513e6e1491a341f114d2b36
5,423
dart
Dart
lib/Home/Model/allListUI.dart
sandicax/Learnly
8b12d1ee65e2cda763762a71633eeab12ca78b0f
[ "MIT" ]
null
null
null
lib/Home/Model/allListUI.dart
sandicax/Learnly
8b12d1ee65e2cda763762a71633eeab12ca78b0f
[ "MIT" ]
null
null
null
lib/Home/Model/allListUI.dart
sandicax/Learnly
8b12d1ee65e2cda763762a71633eeab12ca78b0f
[ "MIT" ]
null
null
null
import 'package:esprit/Home/AppTheme/appthemeColors.dart'; import 'package:esprit/screens/courses/coursesModel.dart'; import 'package:flutter/material.dart'; import 'package:esprit/SizeConfig.dart'; import 'package:esprit/src/utils/my_urls.dart'; class AllCoursesUI extends StatelessWidget { final CourseList courses; final Function onTab; const AllCoursesUI({Key key, this.courses, this.onTab}) : super(key: key); @override Widget build(BuildContext context) { return SizedBox( height: 66.1290322581 * SizeConfig1.heightMultiplier, child: Stack( children: <Widget>[ Padding( padding: const EdgeInsets.only(right: 0, left: 0), child: Row( children: <Widget>[ Expanded( child: GestureDetector( onTap: onTab, child: Container( decoration: BoxDecoration( color: AppThemeColors.darkBlue.withOpacity(0.20), borderRadius: BorderRadius.all(Radius.circular( 3.87096774194 * SizeConfig1.heightMultiplier))), child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[ Padding( padding: EdgeInsets.only( left: 15, top: 1.3 * SizeConfig1.heightMultiplier, right: 15), child: Text( "${courses.title}", textAlign: TextAlign.left, style: TextStyle( fontWeight: FontWeight.w600, fontFamily: "muli", fontSize: 2.06 * SizeConfig1.heightMultiplier, letterSpacing: 0.27, color: Colors.black), ), ), Padding( padding: EdgeInsets.only( left: 5, top: 1.58064516129 * SizeConfig1.heightMultiplier, right: 15, ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Text( "Author:\n${courses.fullname}", textAlign: TextAlign.left, style: TextStyle( fontFamily: "muli", fontWeight: FontWeight.bold, fontSize: 1.40 * SizeConfig1.textMultiplier, letterSpacing: 0.17, color: Colors.black.withOpacity(0.7)), ), Container( child: Row(children: <Widget>[ Text( "${courses.rating}", textAlign: TextAlign.left, style: TextStyle( fontFamily: "muli", fontWeight: FontWeight.bold, fontSize: 1.34 * SizeConfig1.textMultiplier, letterSpacing: 0.11, color: Colors.black), ), Icon( Icons.star, color: Colors.red[300], size: 1.5 * SizeConfig1.heightMultiplier, ), ]), ), ]), ), SizedBox( height: 10, ), Expanded( child: Padding( padding: const EdgeInsets.all(10.0), child: Center( child: Image.network( "${MyUrls.serverUrl}/uploads/${courses.imagepath}", fit: BoxFit.contain), ), )) ], ), ), ), ), ], ), ) ], ), ); } }
45.191667
85
0.338005
81ded24a92324d1963052278e3275fda808231aa
946
go
Go
src/manager/event/mesos_event.go
cmingxu/naws
f942d901e4a25d992289e21bbb952d891892e525
[ "Apache-2.0" ]
null
null
null
src/manager/event/mesos_event.go
cmingxu/naws
f942d901e4a25d992289e21bbb952d891892e525
[ "Apache-2.0" ]
null
null
null
src/manager/event/mesos_event.go
cmingxu/naws
f942d901e4a25d992289e21bbb952d891892e525
[ "Apache-2.0" ]
null
null
null
package event import ( "encoding/json" "github.com/Dataman-Cloud/swan/src/mesosproto/sched" ) type MesosEvent struct { EventType sched.Event_Type Event *sched.Event } func (me *MesosEvent) GetEventType() string { switch me.EventType { case sched.Event_SUBSCRIBED: return EVENT_TYPE_MESOS_SUBSCRIBED case sched.Event_HEARTBEAT: return EVENT_TYPE_MESOS_HEARTBEAT case sched.Event_OFFERS: return EVENT_TYPE_MESOS_OFFERS case sched.Event_RESCIND: return EVENT_TYPE_MESOS_RESCIND case sched.Event_UPDATE: return EVENT_TYPE_MESOS_UPDATE case sched.Event_FAILURE: return EVENT_TYPE_MESOS_FAILURE case sched.Event_MESSAGE: return EVENT_TYPE_MESOS_MESSAGE case sched.Event_ERROR: return EVENT_TYPE_MESOS_ERROR default: panic("not known event type") } } func (me *MesosEvent) GetEvent() interface{} { return me.Event } func (me *MesosEvent) String() string { bs, _ := json.Marshal(me.Event) return string(bs) }
21.5
53
0.781184
d27550aa8c0fcfe0f278adf2df633636578b9ea8
2,409
php
PHP
app/Http/Controllers/mokitcontroller.php
potato-p/BackEnd
11c182c562b03e364de4b2841090d680c33bbaee
[ "MIT" ]
null
null
null
app/Http/Controllers/mokitcontroller.php
potato-p/BackEnd
11c182c562b03e364de4b2841090d680c33bbaee
[ "MIT" ]
null
null
null
app/Http/Controllers/mokitcontroller.php
potato-p/BackEnd
11c182c562b03e364de4b2841090d680c33bbaee
[ "MIT" ]
null
null
null
<?php namespace App\Http\Controllers; use App\model\mokit; use App\model\supplier; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; class mokitcontroller extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $mokit = mokit::all(); return view("mokit.index", ['mokit'=> $mokit]); } /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $mokit = mokit::all(); $supplier = supplier::all(); return view("mokit.create",['supplier'=>$supplier],['mokit'=>$mokit]); } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { DB::table('mokit')->insert(['nama' => $request ->nama, 'grade'=>$request->grade,'supplier_id'=>$request->supplier_id]); return redirect()->route('mokit.index'); } /** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { // } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $supplier = supplier::all(); $mokit = mokit::where('id',$id)->first(); return view("mokit.edit", ['mokit'=> $mokit],['supplier'=>$supplier]); } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { mokit::where('id',$id)-> update(['nama' => $request ->nama, 'grade'=>$request->grade,'supplier_id'=>$request->supplier_id]); return redirect()->route('mokit.index'); } /** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { mokit::where('id', $id)->delete(); return redirect()->route('mokit.index'); } }
23.38835
78
0.557078
fa4bcd2fbd78c432b558dc73a3a882786a21b191
390
ps1
PowerShell
source/GCPackages/LinuxGroupsMustExclude/LinuxGroupsMustExclude.config.ps1
SynEdgy/nxtools
84ba5248f17df8e1ce955380c9e1452fa953cb22
[ "MIT" ]
3
2021-04-07T15:31:17.000Z
2022-02-14T18:42:51.000Z
source/GCPackages/LinuxGroupsMustExclude/LinuxGroupsMustExclude.config.ps1
SynEdgy/nxtools
84ba5248f17df8e1ce955380c9e1452fa953cb22
[ "MIT" ]
2
2021-05-04T11:59:29.000Z
2021-05-20T15:12:01.000Z
source/GCPackages/LinuxGroupsMustExclude/LinuxGroupsMustExclude.config.ps1
SynEdgy/nxtools
84ba5248f17df8e1ce955380c9e1452fa953cb22
[ "MIT" ]
null
null
null
configuration LinuxGroupsMustExclude { Import-DscResource -ModuleName nxtools #-ModuleVersion 0.3.0 node LinuxGroupsMustExclude { GC_LinuxGroup LinuxGroupsMustExclude { # the group must be present but not contain root or test Ensure = 'Present' GroupName = 'foobar' MembersToExcludeAsString = 'root;test' } } }
30
68
0.641026