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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4e9913a3d1625f82f5de9aac0caabd9ec58c8148 | 591 | sql | SQL | HostelSQLSchema.sql | VeoScript/slsu-hostel | 0f2a7934123360a059e54f12a7f6859d5dd9711f | [
"MIT"
] | 1 | 2021-04-26T01:56:00.000Z | 2021-04-26T01:56:00.000Z | HostelSQLSchema.sql | VeoScript/slsu-hostel | 0f2a7934123360a059e54f12a7f6859d5dd9711f | [
"MIT"
] | null | null | null | HostelSQLSchema.sql | VeoScript/slsu-hostel | 0f2a7934123360a059e54f12a7f6859d5dd9711f | [
"MIT"
] | null | null | null | create database HOSTEL
use hostel
create table account(
id int IDENTITY PRIMARY KEY NOT NULL,
accounttype varchar(10) NOT NULL,
fullname varchar(255) UNIQUE NOT NULL,
position varchar(255) NOT NULL,
username varchar(255) NOT NULL,
password varchar(255) NOT NULL
)
drop table account
insert into account(accounttype, fullname, position, username, password) values('ADMIN', 'Jerome Villaruel', 'OJT', 'jerome123', '123')
insert into account(accounttype, fullname, position, username, password) values('USER', 'Ruby Gene S. Resus', 'Employee', 'bygene20', '123')
select * from account | 32.833333 | 140 | 0.756345 |
7f64e9b725b20e9e48248416034655dd35d0b782 | 3,096 | swift | Swift | MyAirbnb/View/LuxeHouse/LuxeDetailMoreInfoTableCell.swift | backend-and-children/MyAirbnb_iOS | 70fead1ebd26cf50f099bd8e323686e72ab648ca | [
"MIT"
] | 14 | 2019-08-10T14:46:02.000Z | 2022-03-09T06:07:32.000Z | MyAirbnb/View/LuxeHouse/LuxeDetailMoreInfoTableCell.swift | backend-and-children/MyAirbnb_iOS | 70fead1ebd26cf50f099bd8e323686e72ab648ca | [
"MIT"
] | 18 | 2019-07-21T07:14:08.000Z | 2019-07-30T03:11:38.000Z | MyAirbnb/View/LuxeHouse/LuxeDetailMoreInfoTableCell.swift | backend-and-children/MyAirbnb_iOS | 70fead1ebd26cf50f099bd8e323686e72ab648ca | [
"MIT"
] | 7 | 2019-07-05T09:40:58.000Z | 2020-03-30T05:16:39.000Z | //
// LuxeDetailMoreInfoTableCell.swift
// MyAirbnb
//
// Created by ํ๋ณตํ ๊ฐ๋ฐ์ on 2019/08/07.
// Copyright ยฉ 2019 Alex Lee. All rights reserved.
//
import Foundation
import SnapKit
class LuxeDetailMoreInfoTableCell: UITableViewCell {
static let identifier = "LuxeDetailMoreInfoTableCell"
let logoImageView = UIImageView()
let titleLabel = UILabel()
let subtitleLabel = UILabel()
let seeMoreLabel = UILabel()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setAutoLayout()
configureViewsOptions()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setAutoLayout() {
let sideMargin = StandardUIValue.shared.mainViewSideMargin * 2
self.addSubview(logoImageView)
logoImageView.snp.makeConstraints { (make) in
make.top.equalTo(60)
make.leading.equalTo(sideMargin)
make.width.equalTo(70)
make.height.equalTo(50)
}
self.addSubview(titleLabel)
titleLabel.snp.makeConstraints { (make) in
make.top.equalTo(logoImageView.snp.bottom).offset(30)
make.leading.equalTo(sideMargin)
make.trailing.equalTo(-sideMargin)
}
self.addSubview(subtitleLabel)
subtitleLabel.snp.makeConstraints { (make) in
make.top.equalTo(titleLabel.snp.bottom).offset(12)
make.leading.equalTo(sideMargin)
make.trailing.equalTo(-sideMargin)
}
self.addSubview(seeMoreLabel)
seeMoreLabel.snp.makeConstraints { (make) in
make.leading.equalTo(sideMargin)
make.top.equalTo(subtitleLabel.snp.bottom).offset(25)
make.bottom.equalTo(-50)
}
}
private func configureViewsOptions() {
self.backgroundColor = #colorLiteral(red: 0.921431005, green: 0.9214526415, blue: 0.9214410186, alpha: 0.6109803082)
self.selectionStyle = .none
logoImageView.contentMode = .scaleAspectFit
logoImageView.image = UIImage(named: "LuxeDetailLogo")
titleLabel.text = "๋ชจ๋ ๊ฒ์ด 5์ฑ๊ธ์ธ ํน๋ณํ ์์"
titleLabel.textColor = .black
titleLabel.numberOfLines = 0
titleLabel.font = UIFont(name: StandardUIValue.shared.airbnbBookFontString, size: 22)
subtitleLabel.text = "Airbnb Luxe๋ ๊ณ ๊ธ ํธ์์์ค, ์๋น์ค, ์ ๋ด ์ฌํ ๋์์ด๋๋ฅผ ๊ฐ์ถ๊ณ ์ต์์ ๊ด๋ฆฌ ์ํ์ ์ ๋ฌธ์ ์ธ ๋์์ธ์ ์๋ํ๋ ์์๋ฅผ ์ ๊ณตํฉ๋๋ค."
subtitleLabel.textColor = StandardUIValue.shared.colorRegularText
subtitleLabel.font = UIFont(name: StandardUIValue.shared.airbnbBookFontString, size: 15)
subtitleLabel.setLineSpacing(lineSpacing: 5, lineHeightMultiple: 1)
subtitleLabel.numberOfLines = 0
seeMoreLabel.text = "์์ธํ ์์๋ณด๊ธฐ >"
seeMoreLabel.font = .systemFont(ofSize: 13, weight: .semibold)
seeMoreLabel.textColor = StandardUIValue.shared.colorPurple
}
}
| 36 | 124 | 0.652778 |
2a5afa60c78bc76ce8a4d951a768913b7a8bb84a | 8,892 | java | Java | dashboard-web-app/src/main/java/org/inventory/hub/controller/ProductsInventoryController.java | Aiden007700/inventory-hub-java-on-azure | fdddf9b73911f0d05573260e01874d7d9557d982 | [
"MIT"
] | 1 | 2022-03-23T11:54:18.000Z | 2022-03-23T11:54:18.000Z | dashboard-web-app/src/main/java/org/inventory/hub/controller/ProductsInventoryController.java | saragluna/inventory-hub-java-on-azure | 2355b1d674735690d85bf7111f84336bf61e500b | [
"MIT"
] | null | null | null | dashboard-web-app/src/main/java/org/inventory/hub/controller/ProductsInventoryController.java | saragluna/inventory-hub-java-on-azure | 2355b1d674735690d85bf7111f84336bf61e500b | [
"MIT"
] | 1 | 2020-11-19T23:21:51.000Z | 2020-11-19T23:21:51.000Z | /**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for
* license information.
*/
package org.inventory.hub.controller;
import org.inventory.hub.dao.ProductsInventoryRepository;
import org.inventory.hub.model.Product;
import org.inventory.hub.model.ProductsInventory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Collection;
import java.util.ArrayList;
import java.util.Map;
import java.util.TreeMap;
import java.util.UUID;
@RestController
public class ProductsInventoryController {
@Autowired
private ProductsInventoryRepository ProductsInventoryRepository;
public ProductsInventoryController() {
}
@RequestMapping("/home")
public Map<String, Object> home() {
final Map<String, Object> model = new HashMap<String, Object>();
model.put("id", UUID.randomUUID().toString());
model.put("content", "home");
return model;
}
/**
* HTTP GET
*/
@RequestMapping(value = "/api/products/{productName}",
method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<?> getProduct(@PathVariable("productName") String productName) {
try {
final ResponseEntity<Iterable<ProductsInventory>> productInventories =
new ResponseEntity<Iterable<ProductsInventory>>(ProductsInventoryRepository
.findAll(), HttpStatus.OK);
System.out.println("======= /api/products/{productName} ===== ");
System.out.println(productInventories.toString());
final Iterable <ProductsInventory> iterable = (Iterable<ProductsInventory>) productInventories.getBody();
final Iterator <ProductsInventory> it = makeCollection(iterable).iterator();
final Product product = new Product();
ProductsInventory productInventory = null;
while (it.hasNext()) {
productInventory = it.next();
product.setName(productInventory.getProductName());
product.getCountByLocation()
.put(productInventory.getLocation(),
Integer.valueOf(productInventory.getTotalCount()));
}
return new ResponseEntity<Product> (product, HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<String>(productName + " not found",
HttpStatus.NOT_FOUND);
}
}
private static <E> Collection<E> makeCollection(Iterable<E> iter) {
Collection<E> list = new ArrayList<E>();
for (E item : iter) {
list.add(item);
}
return list;
}
/**
* HTTP GET ALL
*/
@RequestMapping(value = "/api/products", method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<?> getProducts() {
try {
// return new ResponseEntity<List<ProductsInventory>>(ProductsInventoryRepository.findAll(), HttpStatus.OK);
final ResponseEntity<Iterable<ProductsInventory>> productInventories =
new ResponseEntity<Iterable<ProductsInventory>>(ProductsInventoryRepository
.findAll(), HttpStatus.OK);
System.out.println("======= /api/products ===== ");
System.out.println(productInventories.toString());
final Iterable <ProductsInventory> iterable = (Iterable<ProductsInventory>) productInventories.getBody();
final Iterator <ProductsInventory> it = makeCollection(iterable).iterator();
Product product;
final Map<String, Product> products = new TreeMap<String, Product>();
final Map<String, Integer> locations = new HashMap<>();
ProductsInventory productInventory = null;
while (it.hasNext()) {
productInventory = it.next();
product = products.get(productInventory.getProductName());
if (product == null) {
product = new Product();
product.setName(productInventory.getProductName());
product.setDescription(productInventory.getDescription());
products.put(productInventory.getProductName(), product);
}
final String currentLocation = productInventory.getLocation();
Integer totalItems = locations.get(currentLocation);
if (totalItems == null) {
totalItems = Integer.valueOf(productInventory.getTotalCount());
locations.put(currentLocation, totalItems);
} else {
locations.put(currentLocation, totalItems + Integer.valueOf(productInventory.getTotalCount()));
}
System.out.println("== inventory === " + productInventory);
product.getCountByLocation()
.put(productInventory.getLocation(),
Integer.valueOf(productInventory.getTotalCount()));
}
for (final Map.Entry<String, Integer> locationEntry : locations.entrySet()) {
System.out.format("== inventory total per location === %s: %d\n",
locationEntry.getKey(), locationEntry.getValue());
for (final Map.Entry<String, Product> productEntry : products.entrySet()) {
final Map<String, Integer> productByLocationMap = productEntry.getValue().getCountByLocation();
final Integer currentCount = productByLocationMap.get(locationEntry.getKey());
if (currentCount == null) {
productByLocationMap.put(locationEntry.getKey(), 0);
}
}
}
System.out.println("====== success");
return new ResponseEntity<Map<String, Product>> (products, HttpStatus.OK);
} catch (Exception e) {
System.out.println("======== EXCEPTION =======");
e.printStackTrace();
return new ResponseEntity<String>("Nothing found", HttpStatus.NOT_FOUND);
}
}
/**
* HTTP GET ALL
*/
@RequestMapping(value = "/api/locations", method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<?> getLocations() {
try {
final ResponseEntity<Iterable<ProductsInventory>> productInventories =
new ResponseEntity<Iterable<ProductsInventory>>(ProductsInventoryRepository
.findAll(), HttpStatus.OK);
System.out.println("======= /api/locations ===== ");
System.out.println(productInventories.toString());
final Iterable <ProductsInventory> iterable = (Iterable<ProductsInventory>) productInventories.getBody();
final Iterator <ProductsInventory> it = makeCollection(iterable).iterator();
final Map<String, Integer> locations = new HashMap<>();
ProductsInventory productInventory = null;
while (it.hasNext()) {
productInventory = it.next();
final String currentLocation = productInventory.getLocation();
Integer totalItems = locations.get(currentLocation);
if (totalItems == null) {
totalItems = Integer.valueOf(productInventory.getTotalCount());
locations.put(currentLocation, totalItems);
} else {
locations.put(currentLocation, totalItems + Integer.valueOf(productInventory.getTotalCount()));
}
}
for (final Map.Entry<String, Integer> locationEntry : locations.entrySet()) {
System.out.format("== locations === %s: %d\n",
locationEntry.getKey(), locationEntry.getValue());
}
System.out.println("====== success");
return new ResponseEntity<Map<String, Integer>> (locations, HttpStatus.OK);
} catch (Exception e) {
System.out.println("======== EXCEPTION =======");
e.printStackTrace();
return new ResponseEntity<String>("Nothing found", HttpStatus.NOT_FOUND);
}
}
}
| 41.943396 | 121 | 0.590418 |
fe4bc3f80a7e18dd420feac3aec5e49669e60c53 | 6,313 | swift | Swift | Source/CocoaMQTTProperty.swift | leeway1208/CocoaMQTT5 | ed3e4ac0ec301fc3571709726084218e76ce9331 | [
"MIT"
] | 1 | 2021-10-03T03:52:41.000Z | 2021-10-03T03:52:41.000Z | Source/CocoaMQTTProperty.swift | leeway1208/CocoaMQTT5 | ed3e4ac0ec301fc3571709726084218e76ce9331 | [
"MIT"
] | 1 | 2021-10-03T06:38:02.000Z | 2021-10-03T08:39:02.000Z | Source/CocoaMQTTProperty.swift | leeway1208/CocoaMQTT5 | ed3e4ac0ec301fc3571709726084218e76ce9331 | [
"MIT"
] | null | null | null | //
// CocoaMQTTPropertyType.swift
// CocoaMQTT
//
// Created by liwei wang on 2021/7/6.
//
import Foundation
public enum CocoaMQTTPropertyName: UInt8 {
case payloadFormatIndicator = 0x01
case willExpiryInterval = 0x02
case contentType = 0x03
case responseTopic = 0x08
case correlationData = 0x09
case subscriptionIdentifier = 0x0B
case sessionExpiryInterval = 0x11
case assignedClientIdentifier = 0x12
case serverKeepAlive = 0x13
case authenticationMethod = 0x15
case authenticationData = 0x16
case requestProblemInfomation = 0x17
case willDelayInterval = 0x18
case requestResponseInformation = 0x19
case responseInformation = 0x1A
case serverReference = 0x1C
case reasonString = 0x1F
case receiveMaximum = 0x21
case topicAliasMaximum = 0x22
case topicAlias = 0x23
case maximumQoS = 0x24
case retainAvailable = 0x25
case userProperty = 0x26
case maximumPacketSize = 0x27
case wildcardSubscriptionAvailable = 0x28
case subscriptionIdentifiersAvailable = 0x29
case sharedSubscriptionAvailable = 0x2A
}
public enum formatInt: Int {
case formatUint8 = 0x11;
case formatUint16 = 0x12;
case formatUint32 = 0x14;
case formatSint8 = 0x21;
case formatSint16 = 0x22;
case formatSint32 = 0x24;
}
func getMQTTPropertyData(type:UInt8, value:[UInt8]) -> [UInt8] {
var properties = [UInt8]()
properties.append(UInt8(type))
properties += value
return properties
}
func getMQTTPropertyLength(type:UInt8, value:[UInt8]) -> [UInt8] {
var properties = [UInt8]()
properties.append(UInt8(type))
properties += value
return properties
}
func integerCompute(data:[UInt8], formatType:Int, offset:Int) -> (res: Int, newOffset: Int)?{
switch formatType {
case formatInt.formatUint8.rawValue:
return (unsignedByteToInt(data: data[offset]), offset + 1)
case formatInt.formatUint16.rawValue:
return (unsignedBytesToInt(data0: data[offset], data1: data[offset + 1]), offset + 2)
case formatInt.formatUint32.rawValue:
return (unsignedBytesToInt(data0: data[offset], data1: data[offset + 1], data2: data[offset + 2], data3: data[offset + 3]), offset + 4)
case formatInt.formatSint8.rawValue:
return (unsignedToSigned(unsign: unsignedByteToInt(data: data[offset]), size: 8), offset + 1)
case formatInt.formatSint16.rawValue:
return (unsignedToSigned(unsign: unsignedBytesToInt(data0: data[offset], data1: data[offset + 1]), size: 16), offset + 2)
case formatInt.formatSint32.rawValue:
return (unsignedToSigned(unsign: unsignedBytesToInt(data0: data[offset], data1: data[offset + 1], data2: data[offset + 2], data3: data[offset + 3]), size: 32), offset + 4)
default:
printDebug("integerCompute nothing")
}
return nil
}
func unsignedByteToInt(data: UInt8) -> (Int){
return (Int)(data & 0xFF);
}
func unsignedBytesToInt(data0: UInt8, data1: UInt8) -> (Int){
return (unsignedByteToInt(data: data0) << 8) + unsignedByteToInt(data: data1)
}
func unsignedBytesToInt(data0: UInt8, data1: UInt8, data2: UInt8, data3: UInt8) -> (Int){
return unsignedByteToInt(data: data3) + (unsignedByteToInt(data: data2) << 8) + (unsignedByteToInt(data: data1) << 16) + (unsignedByteToInt(data: data0) << 24)
}
func unsignedToSigned(unsign: NSInteger, size: NSInteger) -> (Int){
var res = unsign
if ((res & (1 << size-1)) != 0) {
res = -1 * ((1 << size-1) - (res & ((1 << size-1) - 1)));
}
return res;
}
func unsignedByteToString(data:[UInt8], offset:Int) -> (resStr: String, newOffset: Int)?{
var newOffset = offset
if offset + 1 > data.count {
return nil
}
var length = 0
let comRes = integerCompute(data: data, formatType: formatInt.formatUint16.rawValue, offset: newOffset)
length = comRes!.res
newOffset = comRes!.newOffset
var stringData = Data()
for _ in 0 ..< length {
stringData.append(data[newOffset])
newOffset += 1
}
guard let res = String(data: stringData, encoding: .utf8) else {
return nil
}
return (res, newOffset)
}
func unsignedByteToBinary(data:[UInt8], offset:Int) -> (resStr: [UInt8], newOffset: Int)?{
var newOffset = offset
if offset + 1 > data.count {
return nil
}
var length = 0
let comRes = integerCompute(data: data, formatType: formatInt.formatUint16.rawValue, offset: newOffset)
length = comRes!.res
newOffset = comRes!.newOffset
var res = [UInt8]()
for _ in 0 ..< length {
res.append(data[newOffset])
newOffset += 1
}
return (res, newOffset)
}
//1.5.5 Variable Byte Integer
//The Variable Byte Integer is encoded using an encoding scheme which uses a single byte for values up to 127. Larger values are handled as follows. The least significant seven bits of each byte encode the data, and the most significant bit is used to indicate whether there are bytes following in the representation. Thus, each byte encodes 128 values and a "continuation bit". The maximum number of bytes in the Variable Byte Integer field is four. The encoded value MUST use the minimum number of bytes necessary to represent the value [MQTT-1.5.5-1]. This is shown in Table 1โ1 Size of Variable Byte Integer.
func decodeVariableByteInteger(data: [UInt8], offset: Int) -> (res: Int, newOffset: Int) {
var newOffset = offset
var count = 0
var res: Int = 0
while newOffset < data.count {
let newValue = Int(data[newOffset] & 0x7f) << count
res += newValue
if (data[newOffset] & 0x80) == 0 || count >= 21 {
newOffset += 1
break
}
newOffset += 1
count += 7
}
return (res, newOffset)
}
func beVariableByteInteger(length: Int) -> [UInt8]{
var res = [UInt8]()
if length > 0 && length <= 127 {
res.append(UInt8(length))
}else if length > 127 && length <= 16383 {
res += UInt16(length).hlBytes
}else if length > 16383 && length <= 2097151 {
res += UInt32(length).byteArrayLittleEndian
}else if length > 2097151 && length <= 268435455 {
res += UInt32(length).byteArrayLittleEndian
}else{
return [0]
}
return res
}
| 31.252475 | 612 | 0.667195 |
651a2016a85cc4b87ea259dc527ee25d7fddcb67 | 300 | rs | Rust | tests/comment.rs | podo-os/n3-parser | 5a5103c683a289bf0660dcd2ef85ece3694ca2c3 | [
"BSD-3-Clause"
] | 1 | 2020-05-25T10:06:26.000Z | 2020-05-25T10:06:26.000Z | tests/comment.rs | podo-os/n3-parser | 5a5103c683a289bf0660dcd2ef85ece3694ca2c3 | [
"BSD-3-Clause"
] | null | null | null | tests/comment.rs | podo-os/n3-parser | 5a5103c683a289bf0660dcd2ef85ece3694ca2c3 | [
"BSD-3-Clause"
] | null | null | null | #[test]
fn test_comments() {
const MODEL: &str = "
// Comment Model
[CommentModel]
// Yes, comment model
[Conv2d] // override convolution layer
* K: kernel size = 3 // default kernel size
#0 Input = 3, H, W // define input layer
";
n3_parser::parser::parse_file(MODEL).unwrap();
}
| 17.647059 | 48 | 0.636667 |
41d598cf7d5aa8febd67ee2676f10e7c62088d6a | 57 | swift | Swift | native/ios/PrestoPay/Utils/APIModule.swift | calmato/presto-pay | 4350bb99485e5a8c9edc2e833e78546a24240bb9 | [
"MIT"
] | 7 | 2020-06-16T13:29:46.000Z | 2021-04-21T06:33:44.000Z | native/ios/PrestoPay/Utils/APIModule.swift | calmato/presto-pay | 4350bb99485e5a8c9edc2e833e78546a24240bb9 | [
"MIT"
] | 63 | 2020-05-11T04:59:31.000Z | 2022-02-27T10:01:13.000Z | native/ios/PrestoPay/Utils/APIModule.swift | calmato/presto-pay | 4350bb99485e5a8c9edc2e833e78546a24240bb9 | [
"MIT"
] | 1 | 2020-07-08T16:03:02.000Z | 2020-07-08T16:03:02.000Z | import Foundation
let baseURL = "http://localhost:8080"
| 14.25 | 37 | 0.754386 |
01716c86033fd914c0063aea97868ec45dc765f2 | 1,656 | swift | Swift | Sources/SwiftSimpleCLIFramework/Commands/PrintNameCommand.swift | turekj/SwiftSimpleCLI | 5b805c5845445b29007a4497a40618f833fb3c20 | [
"MIT"
] | 1 | 2019-03-06T11:28:08.000Z | 2019-03-06T11:28:08.000Z | Sources/SwiftSimpleCLIFramework/Commands/PrintNameCommand.swift | turekj/SwiftSimpleCLI | 5b805c5845445b29007a4497a40618f833fb3c20 | [
"MIT"
] | null | null | null | Sources/SwiftSimpleCLIFramework/Commands/PrintNameCommand.swift | turekj/SwiftSimpleCLI | 5b805c5845445b29007a4497a40618f833fb3c20 | [
"MIT"
] | null | null | null | import Commandant
import Foundation
import Result
import SwiftSyntax
public struct PrintNameCommand: CommandProtocol {
public typealias Options = PrintNameOptions
public let verb: String = "print_name"
public let function: String = "Prints names of types declared in the file"
public func run(_ options: Options) -> Result<(), MainError> {
guard let url = URL(string: options.path), let parser = try? SyntaxTreeParser.parse(url) else {
return Result(error: .fatalError(description: "Could not parse Swift file at \(options.path) path"))
}
let visitor = TokenVisitor()
visitor.visit(parser)
return Result(value: ())
}
public init() {}
}
public struct PrintNameOptions: OptionsProtocol {
public let path: String
public static func create(_ path: String) -> PrintNameOptions {
return PrintNameOptions(path: path)
}
public static func evaluate(_ m: CommandMode) -> Result<PrintNameOptions, CommandantError<MainError>> {
return create
<*> m <| Argument(usage: "the swift file to read")
}
}
class TokenVisitor: SyntaxVisitor {
private var nextIdentifierType: String?
override func visit(_ token: TokenSyntax) {
switch token.tokenKind {
case .classKeyword, .extensionKeyword, .protocolKeyword:
nextIdentifierType = token.text
case let .identifier(identifier):
if let identifierType = nextIdentifierType {
nextIdentifierType = nil
print("\(identifierType) \(identifier)")
}
default:
break
}
}
}
| 28.551724 | 112 | 0.647947 |
16827c3a7bd4389542ff89ce58846a54a062335b | 1,186 | ts | TypeScript | src/inversify/modules/InversifyContainerBuilder.ts | flaranda/fn-screener-backend | 82c6585886e940f9fe7c4c58f4c71a31aab2750a | [
"MIT"
] | null | null | null | src/inversify/modules/InversifyContainerBuilder.ts | flaranda/fn-screener-backend | 82c6585886e940f9fe7c4c58f4c71a31aab2750a | [
"MIT"
] | null | null | null | src/inversify/modules/InversifyContainerBuilder.ts | flaranda/fn-screener-backend | 82c6585886e940f9fe7c4c58f4c71a31aab2750a | [
"MIT"
] | null | null | null | import * as inversify from 'inversify';
import { IBuilder } from '../../common/interfaces/IBuilder';
import { containerModuleConstructors } from './containerModuleConstructors';
type InversifyContainerModuleConstructor = new () => inversify.ContainerModule;
export class InversifyContainerBuilder
implements IBuilder<inversify.Container>
{
constructor(
private readonly containerModules: InversifyContainerModuleConstructor[] = containerModuleConstructors,
) {}
public build(): inversify.Container {
const container: inversify.Container = new inversify.Container();
this.initialize(container);
return container;
}
private initialize(container: inversify.Container): void {
this.containerModules.map(
(containerModuleConstructor: InversifyContainerModuleConstructor) =>
this.loadContainerModule(container, containerModuleConstructor),
);
}
private loadContainerModule(
container: inversify.Container,
containerModuleConstructor: InversifyContainerModuleConstructor,
): void {
const containerModule: inversify.ContainerModule =
new containerModuleConstructor();
container.load(containerModule);
}
}
| 29.65 | 107 | 0.764755 |
6523e525ee263cd4beac2a6f6ac2b433492aed2d | 1,692 | sql | SQL | Exams/Database_Basics_MySQL_Exam_20_June_2021/01_table_design.sql | MNikov/MySQL-SoftUni | a479c1db8b137ffadeba492dfc81e558eaf994a8 | [
"MIT"
] | null | null | null | Exams/Database_Basics_MySQL_Exam_20_June_2021/01_table_design.sql | MNikov/MySQL-SoftUni | a479c1db8b137ffadeba492dfc81e558eaf994a8 | [
"MIT"
] | null | null | null | Exams/Database_Basics_MySQL_Exam_20_June_2021/01_table_design.sql | MNikov/MySQL-SoftUni | a479c1db8b137ffadeba492dfc81e558eaf994a8 | [
"MIT"
] | null | null | null | CREATE TABLE addresses (
id INT PRIMARY KEY AUTO_INCREMENT,
`name` VARCHAR(100) NOT NULL
);
CREATE TABLE categories (
id INT PRIMARY KEY AUTO_INCREMENT,
`name` VARCHAR(10) NOT NULL
);
CREATE TABLE clients (
id INT PRIMARY KEY AUTO_INCREMENT,
full_name VARCHAR(50) NOT NULL,
phone_number VARCHAR(20) NOT NULL
);
CREATE TABLE drivers (
id INT PRIMARY KEY AUTO_INCREMENT,
first_name VARCHAR(30) NOT NULL,
last_name VARCHAR(30) NOT NULL,
age INT NOT NULL,
rating FLOAT DEFAULT 5.5
);
CREATE TABLE cars (
id INT PRIMARY KEY AUTO_INCREMENT,
make VARCHAR(20) NOT NULL,
model VARCHAR(20),
`year` INT DEFAULT 0 NOT NULL,
mileage INT DEFAULT 0,
`condition` CHAR NOT NULL,
category_id INT NOT NULL,
CONSTRAINT fk_cars_categories FOREIGN KEY (category_id)
REFERENCES categories (id)
);
CREATE TABLE courses (
id INT PRIMARY KEY AUTO_INCREMENT,
from_address_id INT NOT NULL,
CONSTRAINT fk_courses_addresses FOREIGN KEY (from_address_id)
REFERENCES addresses (id),
`start` DATETIME NOT NULL,
bill DECIMAL(10 , 2 ) DEFAULT 10,
car_id INT NOT NULL,
CONSTRAINT fk_courses_cars FOREIGN KEY (car_id)
REFERENCES cars (id),
client_id INT NOT NULL,
CONSTRAINT fk_courses_clients FOREIGN KEY (client_id)
REFERENCES clients (id)
);
CREATE TABLE cars_drivers (
car_id INT NOT NULL,
CONSTRAINT fk_cars_drivers_cars FOREIGN KEY (car_id)
REFERENCES cars (id),
driver_id INT NOT NULL,
CONSTRAINT fk_cars_drivers_drivers FOREIGN KEY (driver_id)
REFERENCES drivers (id),
CONSTRAINT pk_cars_drivers PRIMARY KEY (car_id , driver_id)
); | 28.2 | 65 | 0.703901 |
d1975032f3eeb691f4c2754309577bcc2a2650d7 | 515 | kt | Kotlin | domain/src/main/java/de/fklappan/app/workoutlog/domain/usecases/GetResultDetailsUseCase.kt | fklappan/WorkoutLog | 8ea72f48a950df952d1712ff119df7eb86a941e6 | [
"Apache-2.0"
] | null | null | null | domain/src/main/java/de/fklappan/app/workoutlog/domain/usecases/GetResultDetailsUseCase.kt | fklappan/WorkoutLog | 8ea72f48a950df952d1712ff119df7eb86a941e6 | [
"Apache-2.0"
] | 15 | 2020-01-02T21:46:18.000Z | 2021-09-26T18:40:38.000Z | domain/src/main/java/de/fklappan/app/workoutlog/domain/usecases/GetResultDetailsUseCase.kt | fklappan/WorkoutLog | 8ea72f48a950df952d1712ff119df7eb86a941e6 | [
"Apache-2.0"
] | null | null | null | package de.fklappan.app.workoutlog.domain.usecases
import de.fklappan.app.workoutlog.domain.WorkoutLogRepository
import de.fklappan.app.workoutlog.domain.WorkoutResultDomainModel
import io.reactivex.Single
class GetResultDetailsUseCase(val repository: WorkoutLogRepository) : UseCase<Int,WorkoutResultDomainModel> {
override fun execute(resultId: Int): Single<WorkoutResultDomainModel> {
val resultDomainModel = repository.getResultById(resultId)
return Single.just(resultDomainModel)
}
} | 39.615385 | 109 | 0.813592 |
26b6c6469b8107579a425feb99978c0c5f9b134b | 2,626 | java | Java | app/src/androidTest/java/com/javapapers/android/androidsmsapp/ApplicationTest.java | ricardobaumann/sms_automator | e41ccfd33e688eb35219472e7d974295b6600d81 | [
"MIT"
] | null | null | null | app/src/androidTest/java/com/javapapers/android/androidsmsapp/ApplicationTest.java | ricardobaumann/sms_automator | e41ccfd33e688eb35219472e7d974295b6600d81 | [
"MIT"
] | null | null | null | app/src/androidTest/java/com/javapapers/android/androidsmsapp/ApplicationTest.java | ricardobaumann/sms_automator | e41ccfd33e688eb35219472e7d974295b6600d81 | [
"MIT"
] | null | null | null | package com.javapapers.android.androidsmsapp;
import android.app.Application;
import android.support.test.espresso.ViewAction;
import android.support.test.espresso.action.ViewActions;
import android.support.test.espresso.assertion.ViewAssertions;
import android.support.test.espresso.matcher.ViewMatchers;
import android.test.ActivityInstrumentationTestCase2;
import android.test.ApplicationTestCase;
import android.test.suitebuilder.annotation.LargeTest;
import org.hamcrest.CoreMatchers;
import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.typeText;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.collection.IsMapContaining.hasEntry;
import static org.hamcrest.core.Is.is;
@LargeTest
public class ApplicationTest extends ActivityInstrumentationTestCase2<MainActivity> {
public ApplicationTest() {super(MainActivity.class);}
@Override
protected void setUp() throws Exception {
super.setUp();
getActivity();
}
public void testButtonPresentAndActivityChange() {
onView(withId(R.id.btnInbox)).check(matches(isDisplayed()));
onView(withId(R.id.btnInbox)).perform(click());
}
public void testSendAndReceiveSms() throws InterruptedException {
onView(withId(R.id.btnCompose)).check(matches(isDisplayed()));
onView(withId(R.id.btnCompose)).perform(click());
onView(withId(R.id.editTextPhoneNo)).perform(typeText("5184117032"));
onView(withId(R.id.editTextSMS)).perform(typeText("mensagem ui loco"));
onView(withId(R.id.btnSendSMS)).perform(click());
Thread.sleep(50000);
onView(withId(R.id.btnInbox)).check(matches(isDisplayed()));
onView(withId(R.id.btnInbox)).perform(click());
onData(allOf(is(instanceOf(String.class)), containsString("Dieine")))
.perform(click());
}
} | 38.617647 | 86 | 0.751714 |
b91b95ab306e6bdab3e40106673a973af5d38c35 | 225 | h | C | include/conector.h | budacalorin/Binary-Circuits | 5997bd42d3900824530a7404a69a3825f120567e | [
"Apache-2.0"
] | null | null | null | include/conector.h | budacalorin/Binary-Circuits | 5997bd42d3900824530a7404a69a3825f120567e | [
"Apache-2.0"
] | null | null | null | include/conector.h | budacalorin/Binary-Circuits | 5997bd42d3900824530a7404a69a3825f120567e | [
"Apache-2.0"
] | null | null | null | #ifndef CONECTOR_H
#define CONECTOR_H
class conector
{
public:
bool currentState;
bool alive=0;
void set_state(bool state);
bool get_state();
conector();
};
#endif // CONECTOR_H
| 14.0625 | 35 | 0.6 |
64da034391761f02b11c5e3e7f6b15173234d0f7 | 2,425 | rs | Rust | frontend/apps/crates/entry/user/src/password/state.rs | corinnewo/ji-cloud | 58fc898703ca0fc5b962e644dfcfbcce8547c525 | [
"Apache-2.0",
"MIT"
] | null | null | null | frontend/apps/crates/entry/user/src/password/state.rs | corinnewo/ji-cloud | 58fc898703ca0fc5b962e644dfcfbcce8547c525 | [
"Apache-2.0",
"MIT"
] | null | null | null | frontend/apps/crates/entry/user/src/password/state.rs | corinnewo/ji-cloud | 58fc898703ca0fc5b962e644dfcfbcce8547c525 | [
"Apache-2.0",
"MIT"
] | null | null | null | use dominator_helpers::futures::AsyncLoader;
use futures_signals::signal::{Signal, Mutable, SignalExt};
use std::cell::RefCell;
use crate::register::state::Step;
use zxcvbn::Entropy;
pub struct PasswordState {
pub strength: Mutable<PasswordStrength>,
pub value: RefCell<String>,
pub status: Mutable<Option<PasswordStatus>>,
}
impl PasswordState {
pub fn new() -> Self {
Self {
strength: Mutable::new(PasswordStrength::None),
value: RefCell::new("".to_string()),
status: Mutable::new(None),
}
}
pub fn get_strength(&self) -> impl Signal<Item = &'static str> {
self.strength
.signal()
.map(|x| x.as_str())
}
pub fn clear_status(&self) {
self.status.set(None);
}
pub fn error(&self) -> impl Signal<Item = &'static str> {
self.status
.signal_cloned()
.map(|err| {
err
.map(|err| err.as_str())
.unwrap_or("")
})
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum PasswordStrength {
None,
Weak,
Average,
Strong
}
impl PasswordStrength {
pub fn as_str(&self) -> &'static str {
match self {
Self::None => "none",
Self::Weak => "weak",
Self::Average => "average",
Self::Strong => "strong",
}
}
}
impl From<Entropy> for PasswordStrength {
fn from(entropy:Entropy) -> Self {
if crate::debug::settings().skip_password_strength {
Self::Strong
} else {
let score = entropy.score();
if score < 2 {
Self::Weak
} else if score < 4 {
Self::Average
} else {
Self::Strong
}
}
}
}
#[derive(Debug, Clone)]
pub enum PasswordStatus {
EmptyPw,
PwMismatch,
PwWeak,
ResetError,
UnknownFirebase,
Technical
}
impl PasswordStatus {
pub fn as_str(&self) -> &'static str {
match self {
Self::EmptyPw => "supply a password!",
Self::PwMismatch => "passwords don't match!",
Self::PwWeak => "weak password!",
Self::UnknownFirebase => "firebase error!",
Self::ResetError => "unable to reset password!",
Self::Technical => "technical error!",
}
}
}
| 24.009901 | 68 | 0.522062 |
4186c4cfb5469f0eff26b277f4e9994d4bbac22e | 4,182 | swift | Swift | UpgradeBelt/UpgradeBelt/SecondViewController.swift | Juju4ka/UpgradeBelt-iOS | 25a98bcdd266600bfd52af8c099bceae4a1cd46b | [
"MIT"
] | null | null | null | UpgradeBelt/UpgradeBelt/SecondViewController.swift | Juju4ka/UpgradeBelt-iOS | 25a98bcdd266600bfd52af8c099bceae4a1cd46b | [
"MIT"
] | 8 | 2020-04-03T23:23:03.000Z | 2020-04-14T04:22:30.000Z | UpgradeBelt/UpgradeBelt/SecondViewController.swift | Juju4ka/UpgradeBelt-iOS | 25a98bcdd266600bfd52af8c099bceae4a1cd46b | [
"MIT"
] | 1 | 2020-04-04T08:23:27.000Z | 2020-04-04T08:23:27.000Z | //
// SecondViewController.swift
// UpgradeBelt
//
// Created by Julia Boichentsova on 11/04/2020.
// Copyright ยฉ 2020 Julia Boichentsova. All rights reserved.
//
import UIKit
import MessageUI
class SecondViewController: UIViewController, MFMailComposeViewControllerDelegate {
@IBOutlet var containerView: UIView!
@IBOutlet var textView: UITextView!
@IBOutlet var contactUsButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let buildVersion = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "X"
textView.contentInset = .init(top: 0, left: 20, bottom: 0, right: 20)
textView.text = "Upgrade Taekwondo Belt app is created for Taekwon-Do students as a support tool to browse and learn grading material in preparation for their next belt.\n\nThe app may not cover all grading requirements and may contain mistakes. \n\nIf you'd like to contribute or support the project please contact us.\n\nBuild v." + buildVersion
contactUsButton.layer.cornerRadius = 10
contactUsButton.layer.borderColor = UIColor.black.cgColor
contactUsButton.layer.borderWidth = 1.0
contactUsButton.backgroundColor = .white
}
func openURL(url: URL) {
// for versions iOS 10 and above
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:])
}
}
@IBAction func contactUs(_ sender:UIButton) {
let recipientEmail = "upgradebelt@gmail.com"
let subject = "Upgrade Taekwondo Belt"
let body = ""
// Show default mail composer
if MFMailComposeViewController.canSendMail() {
let mail = MFMailComposeViewController()
mail.mailComposeDelegate = self
mail.setToRecipients([recipientEmail])
mail.setSubject(subject)
mail.setMessageBody(body, isHTML: false)
present(mail, animated: true)
// Show third party email composer if default Mail app is not present
} else if let emailUrl = createEmailUrl(to: recipientEmail, subject: subject, body: body) {
if(UIApplication.shared.canOpenURL(emailUrl)) {
UIApplication.shared.open(emailUrl)
} else {
let url = URL(string:"https://upgradebelt.wordpress.com/")
self.openURL(url: url!)
}
}
}
private func createEmailUrl(to: String, subject: String, body: String) -> URL? {
let subjectEncoded = subject.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)!
let bodyEncoded = body.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)!
let gmailUrl = URL(string: "googlegmail://co?to=\(to)&subject=\(subjectEncoded)&body=\(bodyEncoded)")
let outlookUrl = URL(string: "ms-outlook://compose?to=\(to)&subject=\(subjectEncoded)")
let yahooMail = URL(string: "ymail://mail/compose?to=\(to)&subject=\(subjectEncoded)&body=\(bodyEncoded)")
let sparkUrl = URL(string: "readdle-spark://compose?recipient=\(to)&subject=\(subjectEncoded)&body=\(bodyEncoded)")
let defaultUrl = URL(string: "mailto:\(to)?subject=\(subjectEncoded)&body=\(bodyEncoded)")
if let gmailUrl = gmailUrl, UIApplication.shared.canOpenURL(gmailUrl) {
return gmailUrl
} else if let outlookUrl = outlookUrl, UIApplication.shared.canOpenURL(outlookUrl) {
return outlookUrl
} else if let yahooMail = yahooMail, UIApplication.shared.canOpenURL(yahooMail) {
return yahooMail
} else if let sparkUrl = sparkUrl, UIApplication.shared.canOpenURL(sparkUrl) {
return sparkUrl
}
return defaultUrl
}
//MARK: - MFMail compose method
func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {
controller.dismiss(animated: true, completion: nil)
}
}
| 43.5625 | 355 | 0.651363 |
83d50e18ba827d2a0d57f7d58d3eae23e5c2f6e4 | 48 | sql | SQL | store/postgres/migrations/2021-01-15-013524_drop_deployment_detail/up.sql | Tumble17/graph-node | a4315a33652391f453031a5412b6c51ba4ce084c | [
"Apache-2.0",
"MIT"
] | 1,811 | 2018-08-01T00:52:11.000Z | 2022-03-31T17:56:57.000Z | store/postgres/migrations/2021-01-15-013524_drop_deployment_detail/up.sql | Tumble17/graph-node | a4315a33652391f453031a5412b6c51ba4ce084c | [
"Apache-2.0",
"MIT"
] | 1,978 | 2018-08-01T17:00:43.000Z | 2022-03-31T23:59:29.000Z | store/postgres/migrations/2021-01-15-013524_drop_deployment_detail/up.sql | Tumble17/graph-node | a4315a33652391f453031a5412b6c51ba4ce084c | [
"Apache-2.0",
"MIT"
] | 516 | 2018-08-01T05:26:27.000Z | 2022-03-31T14:04:19.000Z | drop view subgraphs.subgraph_deployment_detail;
| 24 | 47 | 0.895833 |
bfe5e3e685d91d31d6519b18bd64caea3c36f28d | 836 | dart | Dart | lib/src/base/icon_options.dart | zyzbroker/leaflet-map-dart-library | de7d83858f669b6a4a0e6c59ba9884d4a4ca3728 | [
"BSD-2-Clause"
] | null | null | null | lib/src/base/icon_options.dart | zyzbroker/leaflet-map-dart-library | de7d83858f669b6a4a0e6c59ba9884d4a4ca3728 | [
"BSD-2-Clause"
] | null | null | null | lib/src/base/icon_options.dart | zyzbroker/leaflet-map-dart-library | de7d83858f669b6a4a0e6c59ba9884d4a4ca3728 | [
"BSD-2-Clause"
] | null | null | null | import 'point.dart';
class IconOptions {
String iconUrl;
String iconRetinaUrl;
String shadowUrl;
Point backgroundPosition;
Point iconSize;
Point iconAnchor;
Point popupAnchor;
Point shadowAnchor;
Point tooltipAnchor;
Point shadowSize;
String className = '';
String imagePath = '';
String html = '';
IconOptions():
popupAnchor = new Point(0, 0),
tooltipAnchor = new Point(0, 0);
IconOptions.defaultOption() {
this.iconUrl = '/assets/images/marker-icon.png';
this.iconRetinaUrl = '/assets/images/marker-icon-2x.png';
this.shadowUrl = '/assets/images/marker-shadow.png';
this.iconSize = new Point(25,41);
this.iconAnchor = new Point(12,41);
this.popupAnchor = new Point(1, -34);
this.tooltipAnchor = new Point(16, -28);
this.shadowSize = new Point(41,41);
}
} | 25.333333 | 61 | 0.675837 |
267de58dd1d350592a301b2a1b455360590b8e83 | 2,794 | asm | Assembly | MIPS32/Upper_Lower.asm | alexPlessias/AssemblyProgrammes | 5f6da80b8dfac8eb6f51c92fb32a6d23d873aa24 | [
"MIT"
] | null | null | null | MIPS32/Upper_Lower.asm | alexPlessias/AssemblyProgrammes | 5f6da80b8dfac8eb6f51c92fb32a6d23d873aa24 | [
"MIT"
] | null | null | null | MIPS32/Upper_Lower.asm | alexPlessias/AssemblyProgrammes | 5f6da80b8dfac8eb6f51c92fb32a6d23d873aa24 | [
"MIT"
] | null | null | null | .data
banner: .asciiz "#############################################################\n"
header: .asciiz "###### Convert Upper case to Lower case (for strings) #######\n"
ask_for_string: .asciiz "\nPlease give the String you want to convert:\n"
lower_msg: .asciiz "\nThe Lower case is:\n"
goodbye: .asciiz "\nGoodbye !!!\n\n"
string: .space 150 #150 Bytes it's OK, (1 byte == 1 char
.text
main: li $v0, 4 # Show message.
la $a0, banner
syscall
li $v0, 4 # Show message.
la $a0, header
syscall
li $v0, 4 # Show message.
la $a0, banner
syscall
li $v0, 4 # Show message.
la $a0, ask_for_string
syscall
la $a0,string # Start.
li $a1,150 # Size of string.
li $v0,8
syscall
jal manage_lower_upper # Jump and link to LABEL 'manage_lower_upper'.
li $v0, 4 # Show message.
la $a0, lower_msg
syscall
li $v0, 4 # Show message.
la $a0, string
syscall
li $v0, 4 # Show message.
la $a0, goodbye
syscall
li $v0, 10 # Exit.
syscall
######################## FUNCTION #############################
# Input the adress of string. Output the changed string.
# Check all chars of string and search for Uppercase(65-90) and convert them to Lowercase(+32),
# except the first character, if is Lowercase(97-122) and convert them to Uppercase(-32).
manage_lower_upper : li $v0, 0 # Initialize $V0.
la $t0, string # Load the address of strING into $t0.
li $t1, 0 # Adress position (initialize 0).
li $t2, 65 # Ascii code 65 is A.
li $t3, 90 # Ascii code 90 is Z.
li $t4, 97 # Ascii code 97 is a.
li $t5, 122 # Ascii code 122 is z.
li $t6, 32 # The absolute difference between uppercase and lowercase is 32
lb $t1, 0($t0) # Load the first byte from address in $t0
bge $t1, $t4, max_than_97 # if ($t1 >= 97) [element >= a] goto LABEL max_than_97
j pre_loop
max_than_97: ble $t1, $t5, upper # AND if ($t1 <= 122)[element <= z] the first num is lower.
j pre_loop
upper: sub $t1, $t1,$t6 # Lowercase - 32 = upper.
sb $t1, 0($t0) # Store the changed byte($t1) at ($t0).
j pre_loop
pre_loop: add $t0,$t0, 1 # Increase the address by 1.
loop: lb $t1, 0($t0) # Load the byte from address[string($t0)] to $t1.
beq $t1, $zero, end # if ($t1 == 0) then goto LABEL 'end'.
bge $t1, $t2, max_than_65 # if ($t1 >= 65)[element >= A].
continue: add $t0, $t0, 1 # Increase the address by 1.
j loop
max_than_65: ble $t1, $t3, lower # AND if ($t1 <= 65)[element <= Z].
j continue
lower: add $t1, $t1,$t6 # Uppercase + 32 = lower.
sb $t1, 0($t0) # Store the changed byte($t1) at ($t0).
j continue
end: jr $ra | 29.723404 | 96 | 0.564424 |
b29e8d926e431f2bc7f20951b8a55e4609333993 | 533 | kt | Kotlin | app/src/main/java/com/aaks/news/dal/IArticleRepository.kt | palburtus/news | 6089c6ad2023b4f4a521a33696ad958a2144a411 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/aaks/news/dal/IArticleRepository.kt | palburtus/news | 6089c6ad2023b4f4a521a33696ad958a2144a411 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/aaks/news/dal/IArticleRepository.kt | palburtus/news | 6089c6ad2023b4f4a521a33696ad958a2144a411 | [
"Apache-2.0"
] | null | null | null | package com.aaks.news.dal
import androidx.room.*
import com.aaks.news.model.Article
@Dao
interface IArticleRepository {
@Insert
fun create(article: Article) : Long
@Query("SELECT * FROM ${ArticleDbConstants.ARTICLE_TABLE_NAME} WHERE ${ArticleDbConstants.URL} = :url LIMIT 1")
fun get(url: String) : Article?
@Query("SELECT * FROM ${ArticleDbConstants.ARTICLE_TABLE_NAME}")
fun get() : List<Article>
@Update
fun update(article: Article) : Int
@Delete
fun delete(article: Article) : Int
} | 23.173913 | 115 | 0.69606 |
58c966c665635d8e8428ade009423f1e35757f6e | 5,379 | rs | Rust | src/subcommands/quicklookup/mod.rs | thuetz/pwned-rs | 543a9c5cdcb1f50d35f4326a7e88fdb24e8020fc | [
"MIT"
] | null | null | null | src/subcommands/quicklookup/mod.rs | thuetz/pwned-rs | 543a9c5cdcb1f50d35f4326a7e88fdb24e8020fc | [
"MIT"
] | 2 | 2020-02-04T00:13:02.000Z | 2020-02-04T00:13:03.000Z | src/subcommands/quicklookup/mod.rs | thuetz/pwned-rs | 543a9c5cdcb1f50d35f4326a7e88fdb24e8020fc | [
"MIT"
] | null | null | null | use crate::PasswordHashEntry;
use clap::ArgMatches;
use log::{error, info};
use rpassword::read_password_from_tty;
use std::fs::{metadata, File, OpenOptions};
use std::io::{BufRead, BufReader, Seek, SeekFrom};
use std::path::Path;
use std::process::exit;
use std::str::FromStr;
struct DivideAndConquerLookup {
file_handle: BufReader<File>,
file_size: u64,
head_position: u64,
tail_position: u64,
}
impl DivideAndConquerLookup {
pub fn from_file(password_file: &Path) -> Option<DivideAndConquerLookup> {
let file_size = match metadata(password_file) {
Ok(metadata) => metadata.len(),
Err(error) => {
error!(
"Could not determine the size of the file. The error was: {}",
error.to_string()
);
return None;
}
};
let file_handle = match OpenOptions::new()
.append(false)
.write(false)
.read(true)
.open(password_file)
{
Ok(handle) => BufReader::new(handle),
Err(_) => {
error!(
"Could not open {} for reading passwords from it.",
password_file.to_str().unwrap()
);
return None;
}
};
Some(DivideAndConquerLookup {
file_handle,
file_size,
head_position: 0,
tail_position: 0,
})
}
pub fn get_password_count(&mut self, seeked_password_hash: &PasswordHashEntry) -> Option<u64> {
if self.tail_position == 0 {
self.head_position = 0;
self.tail_position = self.file_size;
}
let mid = (self.tail_position - self.head_position) / 2 + self.head_position;
if self.file_handle.seek(SeekFrom::Start(mid)).is_err() {
error!("Could not seek to byte: {}", mid);
return None;
}
let mut line_read_buffer = String::new();
// first read seeks to next new line
if self.file_handle.read_line(&mut line_read_buffer).is_err() {
error!("Could not seek to the next line of the file");
return None;
}
line_read_buffer.clear();
// second read does the actual read of the current data set
if self.file_handle.read_line(&mut line_read_buffer).is_err() {
error!("Could not read a full line for parsing a password entry");
return None;
}
// try to parse the current line and extract the password hash
let password_hash_at_current_line =
match PasswordHashEntry::from_str(line_read_buffer.replace("\r\n", "").as_str()) {
Ok(entry) => entry,
Err(error) => {
error!(
"Could not extract the password hash from the read line. The error was: {}",
error.to_string()
);
return None;
}
};
// if the last read hash is the searched one, we are done here
if password_hash_at_current_line == *seeked_password_hash {
return Some(password_hash_at_current_line.occurrences);
}
// determine in which block we should continue our search
if password_hash_at_current_line < *seeked_password_hash {
self.head_position = mid;
} else {
self.tail_position = mid;
}
// 40 Bytes sha1 + 1 Byte seperator + 1 Byte single digit occurrence
if self.tail_position - self.head_position < 42 {
return None;
}
// continue with the divide and conquer method
self.get_password_count(seeked_password_hash)
}
}
pub fn run_subcommand(matches: &ArgMatches) {
// get the path to the password database
let password_hash_file_path = match matches.value_of("password-database") {
Some(path) => Path::new(path),
None => {
error!("It seems that the path to the file for the password hashes was not provided, please see the help for usage instructions.");
exit(-1);
}
};
// try to read the password from the user
let read_password =
match read_password_from_tty(Some("Enter the password you are looking for: ")) {
Ok(password) => PasswordHashEntry::from_password(password.as_str()),
Err(_) => {
error!("Could not read the password from the user.");
return;
}
};
// get the lookup instance
let mut divide_and_conquer_lookup =
match DivideAndConquerLookup::from_file(password_hash_file_path) {
Some(lookup) => lookup,
None => {
error!("Could not get instace of the divide and conquer lookup algorithm.");
exit(-2);
}
};
// try to lookup the password
match divide_and_conquer_lookup.get_password_count(&read_password) {
Some(count) => info!(
"Choose a different password - the one you entered appears {} times in a list of hacked password!",
count
),
None => {
info!("Perfect! Could not find the password in any of the available breaches. Go on!")
}
}
}
| 34.261146 | 143 | 0.562744 |
ceeb3706b6f4b760d3967c3836f231c24b12651b | 10,424 | swift | Swift | NotificationServiceExtension/NotificationService.swift | guorenxi/Bark | 01dbb1e55f676ceba72637b7ec0a57a581c17d8f | [
"MIT"
] | 1 | 2022-02-18T04:50:42.000Z | 2022-02-18T04:50:42.000Z | NotificationServiceExtension/NotificationService.swift | devYongs/Bark | 25e27e59fcdb4a10dede06df04daae486dd501e0 | [
"MIT"
] | null | null | null | NotificationServiceExtension/NotificationService.swift | devYongs/Bark | 25e27e59fcdb4a10dede06df04daae486dd501e0 | [
"MIT"
] | null | null | null | //
// NotificationService.swift
// NotificationServiceExtension
//
// Created by huangfeng on 2018/12/17.
// Copyright ยฉ 2018 Fin. All rights reserved.
//
import Intents
import Kingfisher
import MobileCoreServices
import RealmSwift
import UIKit
import UserNotifications
class NotificationService: UNNotificationServiceExtension {
lazy var realm: Realm? = {
let groupUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.bark")
let fileUrl = groupUrl?.appendingPathComponent("bark.realm")
let config = Realm.Configuration(
fileURL: fileUrl,
schemaVersion: 13,
migrationBlock: { _, oldSchemaVersion in
// We havenโt migrated anything yet, so oldSchemaVersion == 0
if oldSchemaVersion < 1 {
// Nothing to do!
// Realm will automatically detect new properties and removed properties
// And will update the schema on disk automatically
}
}
)
// Tell Realm to use this new configuration object for the default Realm
Realm.Configuration.defaultConfiguration = config
return try? Realm()
}()
/// ่ชๅจไฟๅญๆจ้
/// - Parameters:
/// - userInfo: ๆจ้ๅๆฐ
/// - bestAttemptContentBody: ๆจ้body๏ผๅฆๆ็จๆท`ๆฒกๆๆๅฎ่ฆๅคๅถ็ๅผ` ๏ผ้ป่ฎคๅคๅถ `ๆจ้ๆญฃๆ`
fileprivate func autoCopy(_ userInfo: [AnyHashable: Any], defaultCopy: String) {
if userInfo["autocopy"] as? String == "1"
|| userInfo["automaticallycopy"] as? String == "1"
{
if let copy = userInfo["copy"] as? String {
UIPasteboard.general.string = copy
}
else {
UIPasteboard.general.string = defaultCopy
}
}
}
/// ไฟๅญๆจ้
/// - Parameter userInfo: ๆจ้ๅๆฐ
/// ๅฆๆ็จๆทๆบๅธฆไบ `isarchive` ๅๆฐ๏ผๅไปฅ `isarchive` ๅๆฐๅผไธบๅ
/// ๅฆๅ๏ผไปฅ็จๆท`ๅบ็จๅ
่ฎพ็ฝฎ`ไธบๅ
fileprivate func archive(_ userInfo: [AnyHashable: Any]) {
var isArchive: Bool?
if let archive = userInfo["isarchive"] as? String {
isArchive = archive == "1" ? true : false
}
if isArchive == nil {
isArchive = ArchiveSettingManager.shared.isArchive
}
let alert = (userInfo["aps"] as? [String: Any])?["alert"] as? [String: Any]
let title = alert?["title"] as? String
let body = alert?["body"] as? String
let url = userInfo["url"] as? String
let group = userInfo["group"] as? String
if isArchive == true {
try? realm?.write {
let message = Message()
message.title = title
message.body = body
message.url = url
message.group = group
message.createDate = Date()
realm?.add(message)
}
}
}
/// ไฟๅญๅพ็ๅฐ็ผๅญไธญ
/// - Parameters:
/// - cache: ไฝฟ็จ็็ผๅญ
/// - data: ๅพ็ Data ๆฐๆฎ
/// - key: ็ผๅญ Key
func storeImage(cache: ImageCache, data: Data, key: String) async {
return await withCheckedContinuation { continuation in
cache.storeToDisk(data, forKey: key, expiration: StorageExpiration.never) { _ in
continuation.resume()
}
}
}
/// ไฝฟ็จ Kingfisher.ImageDownloader ไธ่ฝฝๅพ็
/// - Parameter url: ไธ่ฝฝ็ๅพ็URL
/// - Returns: ่ฟๅ Result
func downloadImage(url: URL) async -> Result<ImageLoadingResult, KingfisherError> {
return await withCheckedContinuation { continuation in
Kingfisher.ImageDownloader.default.downloadImage(with: url, options: nil) { result in
continuation.resume(returning: result)
}
}
}
/// ไธ่ฝฝๆจ้ๅพ็
/// - Parameter imageUrl: ๅพ็URLๅญ็ฌฆไธฒ
/// - Returns: ไฟๅญๅจๆฌๅฐไธญ็`ๅพ็ File URL`
fileprivate func downloadImage(_ imageUrl: String) async -> String? {
guard let groupUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.bark"),
let cache = try? ImageCache(name: "shared", cacheDirectoryURL: groupUrl),
let imageResource = URL(string: imageUrl)
else {
return nil
}
// ๅ
ๆฅ็ๅพ็็ผๅญ
if cache.diskStorage.isCached(forKey: imageResource.cacheKey) {
return cache.cachePath(forKey: imageResource.cacheKey)
}
// ไธ่ฝฝๅพ็
guard let result = try? await downloadImage(url: imageResource).get() else {
return nil
}
// ็ผๅญๅพ็
await storeImage(cache: cache, data: result.originalData, key: imageResource.cacheKey)
return cache.cachePath(forKey: imageResource.cacheKey)
}
/// ไธบ Notification Content ่ฎพ็ฝฎๅพ็
/// - Parameter bestAttemptContent: ่ฆ่ฎพ็ฝฎ็ Notification Content
/// - Returns: ่ฟๅ่ฎพ็ฝฎๅพ็ๅ็ Notification Content
fileprivate func setImage(content bestAttemptContent: UNMutableNotificationContent) async -> UNMutableNotificationContent {
let userInfo = bestAttemptContent.userInfo
guard let imageUrl = userInfo["image"] as? String,
let imageFileUrl = await downloadImage(imageUrl)
else {
return bestAttemptContent
}
let copyDestUrl = URL(fileURLWithPath: imageFileUrl).appendingPathExtension(".tmp")
// ๅฐๅพ็็ผๅญๅคๅถไธไปฝ๏ผๆจ้ไฝฟ็จๅฎๅไผ่ชๅจๅ ้ค๏ผไฝๅพ็็ผๅญ้่ฆ็็ไปฅๅๅจๅๅฒ่ฎฐๅฝ้ๆฅ็
try? FileManager.default.copyItem(
at: URL(fileURLWithPath: imageFileUrl),
to: copyDestUrl
)
if let attachment = try? UNNotificationAttachment(
identifier: "image",
url: copyDestUrl,
options: [UNNotificationAttachmentOptionsTypeHintKey: kUTTypePNG]
) {
bestAttemptContent.attachments = [attachment]
}
return bestAttemptContent
}
/// ไธบ Notification Content ่ฎพ็ฝฎICON
/// - Parameter bestAttemptContent: ่ฆ่ฎพ็ฝฎ็ Notification Content
/// - Returns: ่ฟๅ่ฎพ็ฝฎICONๅ็ Notification Content
fileprivate func setIcon(content bestAttemptContent: UNMutableNotificationContent) async -> UNMutableNotificationContent {
if #available(iOSApplicationExtension 15.0, *) {
let userInfo = bestAttemptContent.userInfo
guard let imageUrl = userInfo["icon"] as? String,
let imageFileUrl = await downloadImage(imageUrl)
else {
return bestAttemptContent
}
var personNameComponents = PersonNameComponents()
personNameComponents.nickname = bestAttemptContent.title
let avatar = INImage(imageData: NSData(contentsOfFile: imageFileUrl)! as Data)
let senderPerson = INPerson(
personHandle: INPersonHandle(value: "", type: .unknown),
nameComponents: personNameComponents,
displayName: personNameComponents.nickname,
image: avatar,
contactIdentifier: nil,
customIdentifier: nil,
isMe: false,
suggestionType: .none
)
let mePerson = INPerson(
personHandle: INPersonHandle(value: "", type: .unknown),
nameComponents: nil,
displayName: nil,
image: nil,
contactIdentifier: nil,
customIdentifier: nil,
isMe: true,
suggestionType: .none
)
let intent = INSendMessageIntent(
recipients: [mePerson],
outgoingMessageType: .outgoingMessageText,
content: bestAttemptContent.body,
speakableGroupName: INSpeakableString(spokenPhrase: personNameComponents.nickname ?? ""),
conversationIdentifier: bestAttemptContent.threadIdentifier,
serviceName: nil,
sender: senderPerson,
attachments: nil
)
intent.setImage(avatar, forParameterNamed: \.sender)
let interaction = INInteraction(intent: intent, response: nil)
interaction.direction = .incoming
try? await interaction.donate()
do {
let content = try bestAttemptContent.updating(from: intent) as! UNMutableNotificationContent
return content
}
catch {}
return bestAttemptContent
}
else {
return bestAttemptContent
}
}
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> ()) {
guard let bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent) else {
contentHandler(request.content)
return
}
let userInfo = bestAttemptContent.userInfo
// ้็ฅไธญๆญ็บงๅซ
if #available(iOSApplicationExtension 15.0, *) {
if let level = userInfo["level"] as? String {
let interruptionLevels: [String: UNNotificationInterruptionLevel] = [
"passive": UNNotificationInterruptionLevel.passive,
"active": UNNotificationInterruptionLevel.active,
"timeSensitive": UNNotificationInterruptionLevel.timeSensitive,
"timesensitive": UNNotificationInterruptionLevel.timeSensitive,
"critical": UNNotificationInterruptionLevel.critical,
]
bestAttemptContent.interruptionLevel = interruptionLevels[level] ?? .active
}
}
// ้็ฅ่งๆ
if let badgeStr = userInfo["badge"] as? String, let badge = Int(badgeStr) {
bestAttemptContent.badge = NSNumber(value: badge)
}
// ่ชๅจๅคๅถ
autoCopy(userInfo, defaultCopy: bestAttemptContent.body)
// ไฟๅญๆจ้
archive(userInfo)
Task.init {
// ่ฎพ็ฝฎๆจ้ๅพๆ
let iconResult = await setIcon(content: bestAttemptContent)
// ่ฎพ็ฝฎๆจ้ๅพ็
let imageResult = await self.setImage(content: iconResult)
contentHandler(imageResult)
}
}
}
| 37.631769 | 140 | 0.580487 |
6fd28ac31142f526d3111c590137adf17778f223 | 35,067 | asm | Assembly | s3d/music-original/Credits.asm | Cancer52/flamedriver | 9ee6cf02c137dcd63e85a559907284283421e7ba | [
"0BSD"
] | 9 | 2017-10-09T20:28:45.000Z | 2021-06-29T21:19:20.000Z | s3d/music-original/Credits.asm | Cancer52/flamedriver | 9ee6cf02c137dcd63e85a559907284283421e7ba | [
"0BSD"
] | 12 | 2018-08-01T13:52:20.000Z | 2022-02-21T02:19:37.000Z | s3d/music-original/Credits.asm | Cancer52/flamedriver | 9ee6cf02c137dcd63e85a559907284283421e7ba | [
"0BSD"
] | 2 | 2018-02-17T19:50:36.000Z | 2019-10-30T19:28:06.000Z | Snd_Credits_Header:
smpsHeaderStartSong 3
smpsHeaderVoice Snd_Credits_Voices
smpsHeaderChan $06, $03
smpsHeaderTempo $01, $40
smpsHeaderDAC Snd_Credits_DAC
smpsHeaderFM Snd_Credits_FM1, $00, $12
smpsHeaderFM Snd_Credits_FM2, $F4, $19
smpsHeaderFM Snd_Credits_FM3, $F4, $18
smpsHeaderFM Snd_Credits_FM4, $00, $13
smpsHeaderFM Snd_Credits_FM5, $00, $12
smpsHeaderPSG Snd_Credits_PSG1, $DC, $02, $00, $00
smpsHeaderPSG Snd_Credits_PSG2, $DC, $02, $00, $00
smpsHeaderPSG Snd_Credits_PSG3, $23, $02, $00, $00
; FM1 Data
Snd_Credits_FM1:
smpsSetvoice $00
smpsPan panCenter, $00
smpsModSet $07, $01, $03, $05
dc.b nA3, $0C, nRst, $08, nA4, $04, nRst, $08, nA4, $04, nG4, $08
dc.b nA4, $06, nRst, $0A, nG3, $0C, nA3, nC4, nRst, $08, nC4, $04
dc.b nRst, $08, nBb4, $04, nC4, $08, nRst, $04, nC4, $08, nC5, $04
dc.b nRst, $0C, nC4, nC5, nC4, nF3, $08, nF4, $04, nRst, $08, nE4
dc.b $04, nF3, $0C, nE4, $08, nF4, $04, nRst, $0C, nF3, nF4, nE3
dc.b nRst, nE3, $04, nRst, nE5, nF3, nRst, nD5, nE5, $08, nRst, $04
dc.b nE3, $08, nE5, $04, nE3, $0C, nE3, nE3, $08, nB4, $04, nA3
dc.b $0C, nRst, $08, nA4, $04, nRst, $0C, nA3, $08, nG4, $04, nRst
dc.b $08, nG4, $04, nA4, nRst, $08, nG4, nC3, $04, nC4, $0C, smpsNoAttack
dc.b $04, nRst, $08, nC4, nC3, $04, nD4, $08, nRst, $04, nD4, $08
dc.b nD3, $04, nE4, $0C, nE4, nC4, nC4, nF4, $18, nE4, $03, nF4
dc.b $09, nE4, $18, $03, nF4, $09, nE4, $0C, nD4, smpsNoAttack, nD4, $14
dc.b nD3, $04, nG4, $03, nA4, $09, nG4, $18
smpsSetvoice $01
dc.b nG2, $02, nA2, nB2, nC3, nD3, nE3, nFs4, nF4, nE4, nD4, nC4
dc.b nB3, nA3, nG3, nFs3, nE3, nD3, nC3
Snd_Credits_Jump05:
dc.b nA2, $08, nRst, $0C, nA3, $04, nRst, $08, nA3, $04, nG3, $08
dc.b nA3, $04, nRst, $0C, nG2, nA2, nA2, $08, nG3, $04, nC3, $08
dc.b nC4, $04, nRst, $08, nBb3, $04, nC3, $08, nRst, $04, nC3, $08
dc.b nC4, $04, nRst, $0C, nC3, nC4, nC3, $08, nC4, $04, nF2, $08
dc.b nF3, $04, nRst, $08, nE3, $04, nF2, $0C, nE3, $08, nF3, $04
dc.b nRst, $0C, nF2, nF3, nE2, smpsNoAttack, nE2, $04, nRst, nE2, $08, nRst
dc.b $04, nE4, nF2, $08, nD4, $04, nE4, $08, nRst, $04, nE2, $08
dc.b nE4, $04, nE2, $0C, nE2, nE2, $08, nB3, $04, nA2, $08, nRst
dc.b $0C, nA3, $04, nRst, $0C, nA2, $08, nG3, $04, nRst, $08, nG3
dc.b $04, nA3, $06, nRst, nG3, $08, nC2, $04, nC3, $0C, smpsNoAttack, $04
dc.b nRst, $08, nC3, nC2, $04, nD3, $08, nRst, $04, nD3, $08, nD2
dc.b $04, nE3, $0C, nE3, nC3, nC3, nF2, nF2, $04, nRst, nF3, nRst
dc.b $0C, nF2, $08, nF3, $04, nRst, $08, nF3, $04, nF2, $08, nRst
dc.b $04, nF2, $08, nRst, $04, nE2, $0C, smpsNoAttack, $04, nRst, $08, nE2
dc.b $04, nRst, nE3, nRst, $0C, nE2, $08, nE3, $04, nRst, $08, nE3
dc.b $04, nE2, $0C, nE2, nE2, $08, nE3, $04, nD2, $08, nRst, $0C
dc.b nA3, $04, nRst, $08, nA3, $04, nG3, $08, nA3, $04, nRst, $0C
dc.b nG2, nD2, nC2, nRst, $08, nC3, $04, nRst, $08, nBb3, $04, nC3
dc.b $08, nRst, $04, nC3, $08, nC4, $04, nRst, $0C, nC3, nC4, nC3
dc.b $08, nC4, $04, nD2, $08, nRst, $0C, nA3, $04, nRst, $08, nA3
dc.b $04, nG3, $08, nA3, $04, nRst, $0C, nG2, nD2, nC2, nRst, $08
dc.b nC3, $04, nRst, $08, nBb3, $04, nC3, $08, nRst, $04, nC3, $08
dc.b nC4, $04, nRst, $0C, nC3, nC4, nC3, $08, nC4, $04, nD2, $08
dc.b nRst, $0C, nA3, $04, nRst, $0C, nA2, $08, nG3, $04, nRst, $08
dc.b nG3, $04, nA3, nRst, $08, nD3, $0C, nC3, smpsNoAttack, nC3, $04, nRst
dc.b $08, nC3, nC2, $04, nD3, $08, nRst, $04, nD3, $08, nD2, $04
dc.b nE3, $0C, nE3, nC3, nB2, smpsNoAttack, nB2, $04, nRst, $08, nB1, $04
dc.b nRst, nB2, nRst, $0C, nB1, $08, nB2, $04, nRst, $08, nB2, $04
dc.b nB1, $08, nRst, $04, nB1, $08, nRst, $04, nE2, $0C, smpsNoAttack, $04
dc.b nRst, $08, nE2, $04, nRst, nE3, nRst, $08, nE2, $04, nRst, $08
dc.b nE3, $04, nRst, $08, nE3, $04, nE2, $08, nRst, $04, nE2, $08
dc.b nRst, $04, nE2, $08, nE3, $04, nA2, $08, nRst, $0C, nA3, $04
dc.b nRst, $08, nA3, $04, nG3, $08, nA3, $04, nRst, $0C, nG2, nA2
dc.b nC3, nRst, $08, nC3, $04, nRst, $08, nBb3, $04, nC3, $08, nRst
dc.b $04, nC3, $08, nC4, $04, nRst, $0C, nC3, nC4, nC3, $08, nC4
dc.b $04, nF2, $08, nF3, $04, nRst, $08, nE3, $04, nF2, $0C, nE3
dc.b $08, nF3, $04, nRst, $0C, nF2, nF3, nE2, nRst, nE2, $04, nRst
dc.b nE4, nF2, nRst, nD4, nE4, $08, nRst, $04, nE2, $08, nE4, $04
dc.b nE2, $08, nRst, $04, nE2, $08, nRst, $04, nE2, $08, nB3, $04
dc.b nA2, $08, nRst, $0C, nA3, $04, nRst, $0C, nA2, $08, nG3, $04
dc.b nRst, $08, nG3, $04, nA3, nRst, $08, nG3, nC2, $04, nC3, $0C
dc.b smpsNoAttack, $04, nRst, $08, nC3, nC2, $04, nD3, $08, nRst, $04, nD3
dc.b $08, nD2, $04, nE3, $0C, nE3, nC3, nC3, nF2, nF2, $04, nRst
dc.b nF3, nRst, $0C, nE2, $04, nRst, nE3, nRst, $08, nE3, $04, nE2
dc.b $0C, nE2, nD2, smpsNoAttack, nD2, $04, nRst, $08, nD2, $04, nRst, nD3
dc.b nRst, $0C, nG2, $08, nG3, $04, nRst, $08, nG3, $04, nG2, $0C
dc.b nG2, nG2, $06, nG3
smpsJump Snd_Credits_Jump05
; FM2 Data
Snd_Credits_FM2:
smpsSetvoice $02
smpsPan panLeft, $00
smpsModSet $07, $01, $03, $05
dc.b nRst, $0C, nG4, $04, nRst, $10, nG4, $04, nRst, $0C, nG4, $06
dc.b nRst, $0E, nG4, $04, nRst, $0C, nF4, smpsNoAttack, nF4, nBb4, $04, nRst
dc.b $10, nF4, $04, nRst, $0C, nF4, $06, nRst, $0E, nF4, $06, nRst
dc.b $16, nRst, $0C, nG4, $06, nRst, $0E, nG4, $04, nRst, $0C, nG4
dc.b $06, nRst, $0E, nG4, $04, nRst, $0C, nA4, nRst, nA4, $06, nRst
dc.b $0E, nA4, $04, nRst, $0C, nAb4, $06, nRst, $0E, nAb4, $0C, nRst
dc.b $04, nAb4, nRst, $08, nRst, $0C, nG4, $04, nRst, $10, nG4, $04
dc.b nRst, $0C, nG4, $06, nRst, $0E, nG4, $04, nRst, $0C, nF4, smpsNoAttack
dc.b nF4, nF4, $04, nRst, $10, nF4, $04, nRst, $0C, nBb4, $06, nRst
dc.b nBb4, nRst, nEb5, $04, nRst, $14, nRst, $0C, nG4, $06, nRst, $0E
dc.b nG4, $04, nRst, $0C, nG4, $06, nRst, $0E, nG4, $04, nRst, $18
dc.b nRst, $08, nG4, $04, nRst, $0C, nG4, $0C, nRst, $08, nF4, $04
dc.b nRst, $0C, nF4, $0C, nRst, $08
smpsSetvoice $06
dc.b nG3, $02, nA3, nB3, nC4, nD4, nE4, nF4, nG4
Snd_Credits_Jump04:
smpsSetvoice $06
smpsFMAlterVol $F9
smpsPan panRight, $00
dc.b nB5, $10, nC5, $04, nRst, nC3, nRst, nC5, nRst, $08, nC5, $04
smpsSetvoice $02
smpsFMAlterVol $07
smpsPan panLeft, $00
dc.b nG4, $06, nRst, $0E, nG4, $04, nRst, $0C, nF4, $0C, smpsNoAttack, nF4
dc.b $0C, nBb4, $04, nRst, $08
smpsSetvoice $06
smpsFMAlterVol $F9
smpsPan panRight, $00
dc.b nC5, $08, nRst, $04, nC5, $08, nRst, $04, nC3, nRst, nC5, nRst
dc.b $08, nC5, $04, nRst, $18, nRst, $0C, nF3, $03, nG3, nA3, nB3
dc.b nG5, $0C, nC5, $08, nRst, $04
smpsSetvoice $02
smpsFMAlterVol $07
smpsPan panLeft, $00
dc.b nG4, $06, nRst, $0E, nG4, $04, nRst, $0C, nA4, $0C, nRst, $14
dc.b nB2, $04, nD5, $08, nRst, $04, nD5, $08, nRst, $04
smpsSetvoice $06
smpsFMAlterVol $F9
smpsPan panRight, $00
dc.b nAb4, $06, nRst, $0E, nAb4, $0C, nRst, $04, nAb4, $04, nRst, $08
smpsSetvoice $02
smpsFMAlterVol $07
smpsPan panLeft, $00
dc.b nRst, $0C, nAb4, $06, nRst, $02
smpsSetvoice $06
smpsFMAlterVol $F9
smpsPan panRight, $00
dc.b nA4, $04, nC3, $04, nRst, $04, nA4, $04, nRst, $08, nA4, $04
smpsSetvoice $02
smpsFMAlterVol $07
smpsPan panLeft, $00
dc.b nAb4, $06, nRst, $0E, nAb4, $04, nRst, $0C, nF4, $0C, smpsNoAttack, nF4
dc.b $0C, nF4, $04, nRst, $14
smpsSetvoice $06
smpsFMAlterVol $F9
smpsPan panRight, $00
dc.b nC3, $04, nRst, nC5, nC3, nRst, nC5, nRst, $08, nC5, $04
smpsSetvoice $02
smpsFMAlterVol $07
smpsPan panLeft, $00
dc.b nEb5, $04, nRst, $14, nRst, $0C, nG4, $06, nRst, $0E, nG4, $04
dc.b nRst, $0C, nG4, $06, nRst, $0E, nG4, $04, nRst, $18, nRst, $08
dc.b nA4, $04, nRst, $08
smpsSetvoice $06
smpsFMAlterVol $F9
smpsPan panRight, $00
dc.b nB2, $04, nD5, $04, nRst, $04, nD5, $08
smpsSetvoice $02
smpsFMAlterVol $07
smpsPan panLeft, $00
dc.b nRst, $0C, nAb4, $0C
smpsSetvoice $06
smpsFMAlterVol $FC
smpsPan panRight, $00
dc.b nA5, $02, nG5, nF5, nE5, nD5, nC5, nB4, nA4, nG4, nF4, nE4
dc.b nD4, nC4, nB3, nA3, nG3, nA5, $0C
smpsSetvoice $02
smpsFMAlterVol $04
smpsPan panLeft, $00
dc.b nG4, $04, nRst, $10, nG4, $04, nRst, $0C, nG4, $06, nRst, $0E
dc.b nG4, $04, nRst, $18, nRst, $0C, nD4, $04, nRst, $10, nC4, $04
dc.b nRst, $0C, nD4, $06, nRst, $2A
smpsSetvoice $06
smpsFMAlterVol $F9
smpsPan panRight, $00
dc.b nRst, $0C, nA2, $04, nB2, nC3, nA5, $0C
smpsSetvoice $02
smpsFMAlterVol $07
smpsPan panLeft, $00
dc.b nRst, $0C, nG4, $06, nRst, $0E, nG4, $04, nRst, $18, nRst, $0C
dc.b nG4, $04, nRst, $10, nC4, $04, nRst, $0C, nD4, $06, nRst, $02
dc.b nD6, $06, nRst, $06, nG4, $06, nRst, $0A
smpsSetvoice $06
smpsFMAlterVol $F9
smpsPan panRight, $00
dc.b nA2, $04, nB2, $04, nC3, $04, nA5, $0C
smpsSetvoice $02
smpsFMAlterVol $07
smpsPan panLeft, $00
dc.b nG4, $04, nRst, $10, nG4, $04, nRst, $0C, nG4, $06, nRst, $0E
dc.b nG4, $04, nRst, $18, nRst, $0C, nG4, $04, nRst, $10, nG4, $04
dc.b nRst, $0C, nG4, $06, nRst, $2A, nRst, $60
smpsSetvoice $06
smpsFMAlterVol $F9
smpsPan panRight, $00
dc.b nRst, $12, nE3, $06, nRst, $12, nE3, $06, nRst, $0C, nE3, nRst
dc.b $06, nE3, nRst, $0C
smpsSetvoice $02
smpsFMAlterVol $07
smpsPan panLeft, $00
dc.b nRst, $0C, nG4, $04, nRst, $10, nG4, $04, nRst, $08, nA3, $04
dc.b nG4, $06, nRst, $02, nA5, $06, nRst, nG4, $04, nRst, $0C, nF4
dc.b $0C, smpsNoAttack, nF4, $0C, nBb4, $04, nRst, $10, nF4, $04, nRst, $0C
dc.b nF4, $06, nRst, $0E, nF4, $06, nRst, $16, nRst, $0C, nG4, $06
dc.b nRst, $0E, nG4, $04, nRst, $0C, nG4, $06, nRst, $0E, nG4, $04
dc.b nRst, $0C, nA4, $0C, nRst, $0C, nA4, $04
smpsSetvoice $06
smpsFMAlterVol $F9
smpsPan panRight, $00
dc.b nB2, $04, nRst, $04, nD5, $08, nRst, $04, nD5, $08, nRst, $04
smpsSetvoice $02
smpsFMAlterVol $07
smpsPan panLeft, $00
dc.b nAb4, $06, nRst, $0E, nAb4, $0C, nRst, $04, nAb4, nRst, $08, nRst
dc.b $0C, nG4, $04, nRst, $10, nG4, $04, nRst, $08, nA3, $04, nG4
dc.b $06, nRst, $02, nA5, $06, nRst, nG4, $04, nRst, $0C, nF4, $0C
dc.b smpsNoAttack, nF4, $0C, nF4, $04, nRst, $10, nF4, $04, nRst, $0C, nBb4
dc.b $06, nRst, nBb4, nRst, nEb5, $04, nRst, $14, nRst, $0C, nG4, $06
dc.b nRst, $0E, nG4, $04, nRst, $0C, nG4, $06, nRst, $0E, nG4, $04
dc.b nRst, $18, nRst, $08, nF4, $04, nRst, $0C, nF4, nRst, $08, nF4
dc.b $04, nRst, $0C, nF4, nRst, $08, nF4, $04, nRst, $0C
smpsJump Snd_Credits_Jump04
; FM3 Data
Snd_Credits_FM3:
smpsSetvoice $02
smpsPan panLeft, $00
smpsModSet $07, $01, $03, $05
dc.b nRst, $0C, nC5, $04, nRst, $08, nA3, $04, nRst, nC5, nRst, $08
dc.b nA3, $04, nC5, $06, nRst, $0E, nC5, $04, nG3, $0C, nD5, smpsNoAttack
dc.b nD5, nC5, $04, nRst, $08, nC4, $06, nRst, $02, nC5, $04, nRst
dc.b $08, nBb3, $04, nC5, $06, nRst, $0E, nC5, $06, nRst, $16, nRst
dc.b $0C, nE5, $06, nRst, nF2, $04, nRst, nC5, nRst, $0C, nC5, $06
dc.b nRst, $0E, nC5, $04, nRst, $0C, nD5, nRst, nD5, $06, nRst, nB3
dc.b $04, nRst, nD5, nB3, nRst, $08, nG5, $06, nRst, $0E, nG5, $0C
dc.b nRst, $04, nF5, nRst, nA3, nRst, $0C, nC5, $04, nRst, $08, nA3
dc.b $04, nRst, nC5, nRst, $08, nA3, $04, nC5, $06, nRst, $0E, nC5
dc.b $04, nG3, $0C, nD5, smpsNoAttack, nD5, nC5, $04, nRst, $10, nC5, $04
dc.b nRst, $08, nBb3, $04, nA5, $06, nRst, nG5, nRst, $02, nC4, $04
dc.b nE5, $06, nRst, nD5, nRst, $02, nC5, $04, nRst, $0C, nE5, $06
dc.b nRst, nF2, nRst, $02, nC5, $04, nRst, $0C, nD5, $06, nRst, $0E
dc.b nD5, $04, nRst, $18, nRst, $08, nC5, $04, nRst, $0C, nC5, nRst
dc.b $08, nC5, $04, nRst, $0C, nC5, nRst, $08, nC5, $04, nRst, $0C
Snd_Credits_Jump03:
dc.b nRst, nC5, $04, nRst, $08, nA3, $04, nRst, nC5, nRst, $08, nA3
dc.b $04, nC5, $06, nRst, $0E, nC5, $04, nG3, $0C, nD5, smpsNoAttack, nD5
dc.b nC5, $04, nRst, $08, nC4, $06, nRst, $02, nC5, $04, nRst, $08
dc.b nBb3, $04, nC5, $06, nRst, $0E, nC5, $06, nRst, $16, nRst, $0C
dc.b nE5, $06, nRst, nF2, $04, nRst, nC5, nRst, $0C, nC5, $06, nRst
dc.b $0E, nC5, $04, nRst, $0C, nD5, nRst, nD5, $06, nRst, nB3, $04
dc.b nRst, nD5, nB3, nRst, $08, nG5, $06, nRst, $0E, nG5, $0C, nRst
dc.b $04, nF5, nRst, nA3, nA2, $0C, nE5, $06, nRst, nA3, $04, nRst
dc.b nE5, nRst, $08, nA3, $04, nE5, $06, nRst, $0E, nE5, $04, nRst
dc.b $08, nA3, $04, nD5, $0C, nC3, $04, nRst, $08, nC5, $04, nRst
dc.b $10, nC5, $04, nRst, $08, nBb3, $04, nA5, $06, nRst, nG5, nRst
dc.b $02, nC4, $04, nE5, $06, nRst, nD5, nRst, $02, nC5, $04, nRst
dc.b $0C, nE5, $06, nRst, nF2, nRst, $02, nC5, $04, nRst, $0C, nC5
dc.b $06, nRst, $0E, nC5, $04, nRst, $18, nRst, $08, nD5, $04, nRst
dc.b $0C, nD5, nRst, $08, nD5, $04, nRst, $0C, nD5, nRst, $08, nD5
dc.b $04, nRst, $0C, nRst, nC5, $04, nRst, $08, nA3, $04, nRst, nC5
dc.b nRst, $08, nA3, $04, nC5, $06, nRst, $0E, nC5, $04, nG3, $0C
dc.b nRst, nRst, nG4, $04, nRst, $08, nC3, $06, nRst, $02, nG4, $04
dc.b nRst, $08, nG3, $04, nG4, $06, nRst, $02, nG5, $04, nA5, $06
dc.b nRst, $02, nC6, $04, nRst, $18, nRst, $0C, nC5, $04, nRst, $08
dc.b nA3, $04, nRst, nC5, nRst, $08, nA3, $04, nC5, $06, nRst, $0E
dc.b nC5, $04, nG3, $0C, nRst, nRst, nD5, $04, nRst, $08, nC3, $06
dc.b nRst, $02, nD5, $04, nRst, $08, nG3, $04, nG4, $06, nRst, $02
dc.b nG6, $06, nRst, nE6, nRst, $0A, nD6, $06, nRst, $02, nC6, $04
dc.b nRst, $0C, nC5, $04, nRst, $08, nA3, $04, nRst, nC5, nRst, $08
dc.b nA3, $04, nC5, $06, nRst, $0E, nC5, $04, nG3, $0C, nRst, nRst
dc.b nD5, $04, nRst, $08, nC3, $06, nRst, $02, nD5, $04, nRst, $08
dc.b nG3, $04, nD5, $06, nRst, $02, nG5, $04, nA5, $06, nRst, $02
dc.b nC6, $04, nRst, $18, nRst, $60, nRst, nRst, $0C, nC5, $04, nRst
dc.b $08, nA3, $04, nRst, nG6, nRst, $08, nE6, $04, nC5, $06, nRst
dc.b $02, nD6, $06, nRst, nC6, $04, nG3, $0C, nD5, smpsNoAttack, nD5, nC5
dc.b $04, nRst, $08, nC4, $06, nRst, $02, nC5, $04, nRst, $08, nBb3
dc.b $04, nC5, $06, nRst, $0E, nC5, $06, nRst, $16, nRst, $0C, nE5
dc.b $06, nRst, nF2, $04, nRst, nC5, nRst, $0C, nC5, $06, nRst, $0E
dc.b nC5, $04, nRst, $0C, nD5, nRst, nD5, $06, nRst, nB3, $04, nRst
dc.b nD5, nB3, nRst, $08, nG5, $06, nRst, $0E, nG5, $0C, nRst, $04
dc.b nF5, nRst, nA3, nRst, $0C, nC5, $04, nRst, $08, nA3, $04, nRst
dc.b nG6, nRst, $08, nE6, $04, nC5, $06, nRst, $02, nD6, $06, nRst
dc.b nC6, $04, nG3, $0C, nD5, smpsNoAttack, nD5, nC5, $04, nRst, $10, nC5
dc.b $04, nRst, $08, nBb3, $04, nA5, $06, nRst, nG5, nRst, $02, nC4
dc.b $04, nE5, $06, nRst, nD5, nRst, $02, nC5, $04, nRst, $0C, nE5
dc.b $06, nRst, nF2, nRst, $02, nC5, $04, nRst, $0C, nC5, $06, nRst
dc.b $0E, nC5, $04, nRst, $18, nRst, $08, nC5, $04, nRst, $0C, nC5
dc.b nRst, $08, nC5, $04, nRst, $0C, nC5, nRst, $08, nC5, $04, nRst
dc.b $0C
smpsJump Snd_Credits_Jump03
; FM4 Data
Snd_Credits_FM4:
smpsModSet $07, $01, $03, $05
smpsSetvoice $03
smpsPan panRight, $00
dc.b nG4, $24, $06, nRst, $12, nG4, $06, nRst, $12, nBb4, $0C, smpsNoAttack
dc.b $30, $18, nBb4, nA4, $2A, nRst, $12, nA4, $06, nRst, $12, nA4
dc.b $0C, smpsNoAttack, $24, nAb4, $3C
smpsSetvoice $04
smpsAlterPitch $F4
smpsFMAlterVol $04
smpsPan panCenter, $00
dc.b nB6, $3C, nG6, $0C, nE6, $0C, nA6, $0C, smpsNoAttack, nA6, $3C, nG6
dc.b $0C, nE6, $18
smpsSetvoice $03
smpsAlterPitch $0C
smpsFMAlterVol $FC
smpsPan panRight, $00
dc.b nRst, $0C, nG4, $02, nA4, $0A, nG4, $0C, nC4, $18, nD4, $02
dc.b nE4, $0A, nD4, $0C, nG3, smpsNoAttack, nG3, $30, nRst
Snd_Credits_Jump02:
smpsSetvoice $07
smpsFMAlterVol $06
smpsPan panLeft, $00
dc.b nD5, $10, nG4, $04, nRst, $0C, nG4, $04, nRst, $08, nG4, $04
smpsSetvoice $03
smpsFMAlterVol $FA
smpsPan panRight, $00
dc.b nRst, $08, nG4, $04, nA4, $08, nC5, $08, nRst, $14
smpsSetvoice $07
smpsFMAlterVol $06
smpsPan panLeft, $00
dc.b nRst, $18, nF4, $08, nRst, $04, nF4, $08, nRst, $0C, nG4, $04
dc.b nRst, $08, nG4, $04, nRst, $18, nRst, $18, nA4, $0C, nE4, $08
dc.b nRst, $0C
smpsSetvoice $03
smpsFMAlterVol $FA
smpsPan panRight, $00
dc.b nG4, $04, nA4, $08, nC5, $08, nRst, $14
smpsSetvoice $07
smpsFMAlterVol $06
smpsPan panLeft, $00
dc.b nRst, $18, nE4, $08, nRst, $04, nE4, $08, nRst, $34
smpsSetvoice $03
smpsFMAlterVol $FA
smpsPan panRight, $00
dc.b nRst, $08, nAb4, $04, nRst, $08
smpsSetvoice $07
smpsFMAlterVol $06
smpsPan panLeft, $00
dc.b nE4, $04, nRst, $08, nE4, $04, nRst, $08, nE4, $04, nRst, $08
smpsSetvoice $03
smpsFMAlterVol $FA
smpsPan panRight, $00
dc.b nAb4, $04, nRst, $24
smpsSetvoice $07
smpsFMAlterVol $06
smpsPan panLeft, $00
dc.b nRst, $2C, nG4, $04, nRst, $08, nG4, $04, nRst, $08, nG4, $04
dc.b nRst, $18
smpsSetvoice $03
smpsFMAlterVol $FA
smpsPan panRight, $00
dc.b nRst, $08, nG4, $04, nRst, $20, nG4, $04, nRst, $08, nG4, $04
dc.b nRst, $20, nG4, $04, nA4, $08, nRst, $04, nA4, $08, nRst, $04
smpsSetvoice $07
smpsFMAlterVol $06
smpsPan panLeft, $00
dc.b nE4, $08, nRst, $04, nE4, $08, nRst, $04
smpsSetvoice $03
smpsFMAlterVol $FA
smpsPan panRight, $00
dc.b nAb4, $0C, nRst, $08, nAb4, $04, nRst, $18
smpsSetvoice $07
smpsFMAlterVol $06
smpsPan panLeft, $00
dc.b nD3, $0C
smpsSetvoice $03
smpsFMAlterVol $FA
smpsPan panRight, $00
dc.b nRst, $2C, nG4, $08, nRst, $20, nRst, $60
smpsSetvoice $07
smpsFMAlterVol $06
smpsPan panLeft, $00
dc.b nRst, $18, nD3, $0C
smpsSetvoice $03
smpsFMAlterVol $FA
smpsPan panRight, $00
dc.b nRst, $14, nG4, $08, nRst, $20, nRst, $60
smpsSetvoice $07
smpsFMAlterVol $06
smpsPan panLeft, $00
dc.b nD3, $0C
smpsSetvoice $03
smpsFMAlterVol $FA
smpsPan panRight, $00
dc.b nRst, $2C, nG4, $08, nRst, $20, nRst, $60
smpsSetvoice $04
smpsFMAlterVol $04
smpsPan panCenter, $00
dc.b nFs5, $18, nA5, $18, nRst, $0C, nCs6, $0C, nD6, $0C, nE6, $0C
dc.b nRst, $0C, nE5, $06, nRst, $06, nE5, $12, nE5, $06, nRst, $30
smpsSetvoice $05
smpsAlterPitch $F4
smpsFMAlterVol $04
smpsModSet $07, $01, $05, $07
dc.b nB6, $30, nG6, $24, nE6, $0C, smpsNoAttack, $2A, nRst, $06, nE6, $0C
dc.b nF6, $0C, nG6, $18, nE6, $18, nD6, $0C, nC6, $0C, nRst, $0C
dc.b nD6, $0C, nRst, $0C, nE6, $0C, smpsNoAttack, nE6, $18, nF6, $0C, nD6
dc.b $24, nC6, $0C, nB5, $0C, nB6, $30, nG6, $24, nE6, $0C, smpsNoAttack
dc.b $60
smpsSetvoice $03
smpsAlterPitch $0C
smpsFMAlterVol $F8
smpsModSet $07, $01, $03, $05
smpsPan panRight, $00
dc.b nRst, $06, nG4, nRst, $0C, nG4, $12, $06, nRst, $30
smpsSetvoice $07
smpsFMAlterVol $02
smpsPan panLeft, $00
dc.b nRst, $40, nA5, $02, nG5, nF5, nE5, nD5, nC5, nB4, nA4, nG4
dc.b nF4, nE4, nD4, nC4, nB3, nA3, nG3
smpsFMAlterVol $FE
smpsPan panRight, $00
smpsJump Snd_Credits_Jump02
; FM5 Data
Snd_Credits_FM5:
smpsSetvoice $03
smpsPan panRight, $00
smpsModSet $07, $01, $03, $05
dc.b nRst, $02, nC5, nD5, nE5, $12, nD5, $0C, nC5, $06, nRst, $12
dc.b nD5, $06, nRst, $12, nE5, $0C, smpsNoAttack, $30, $0C, nF5, nG5, $18
dc.b nE5, nD5, $0C, nC5, $06, nRst, $12, nD5, $06, nRst, $12, nE5
dc.b $0C, smpsNoAttack, $18, nF5, $0C, nD5, $3C, nRst, $02, nC5, nD5, nE5
dc.b $12, nD5, $0C, nC5, $06, nRst, $12, nD5, $06, nRst, $12, nE5
dc.b $0C, smpsNoAttack, $30, $0C, nF5, nG5, $18, nRst, $0C, nG5, $02, nA5
dc.b $0A, nG5, $0C, nC5, $18, nD5, $02, nE5, $0A, nD5, $0C, nG4
dc.b smpsNoAttack, nG4, $30, nRst
Snd_Credits_Jump01:
dc.b nRst, $38, nC5, $04, nA4, $08, nC5, nRst, $14, nRst, $38, nC5
dc.b $08, nRst, $20, nRst, $38, nC5, $04, nA4, $08, nC5, nRst, $14
dc.b nRst, $60, nRst, $08, nCs5, $04, nRst, $2C, nCs5, $04, nRst, $24
dc.b nRst, $60, nRst, $08, nC5, $04, nRst, $20, nC5, $04, nRst, $08
dc.b nC5, $04, nRst, $20, nC5, $04, nD5, $08, nRst, $04, nD5, $08
dc.b nRst, $0C, nD5, $04, nRst, $0C, nD5, nRst, $08, nD5, $04, nRst
dc.b $18, nRst, $38, nC5, $08, nRst, $20, nRst, $60, nRst, $38, nC5
dc.b $08, nRst, $20, nRst, $60, nRst, $38, nC5, $08, nRst, $20, nRst
dc.b $60, nRst
smpsSetvoice $07
smpsFMAlterVol $07
smpsPan panLeft, $00
dc.b nRst, $12, nE3, $06, nRst, $12, nE3, $06, nRst, $0C, nE3, nRst
dc.b $06, nE3, nRst, $0C
smpsSetvoice $03
smpsFMAlterVol $F9
smpsPan panRight, $00
dc.b nRst, $02, nC5, nD5, nE5, $12, nD5, $0C, nC5, $06, nRst, $12
dc.b nD5, $06, nRst, $12, nE5, $0C, smpsNoAttack, $30, $0C, nF5, nG5, $18
dc.b nE5, nD5, $0C, nC5, $06, nRst, $12, nD5, $06, nRst, $12, nE5
dc.b $0C, smpsNoAttack, nE5, $10
smpsSetvoice $07
smpsFMAlterVol $07
smpsPan panLeft, $00
dc.b nB2, $04, nRst, $04, nD5, $08, nRst, $04, nD5, $08
smpsSetvoice $03
smpsFMAlterVol $F9
smpsPan panRight, $00
dc.b nD5, $34, nRst, $02, nC5, nD5, nE5, $12, nD5, $0C, nC5, $06
dc.b nRst, $12, nD5, $06, nRst, $12, nE5, $0C, smpsNoAttack, $60, nRst, $06
dc.b nC5, nRst, $0C, nC5, $12, $06, nRst, $30, nRst, $60
smpsJump Snd_Credits_Jump01
; PSG1 Data
Snd_Credits_PSG1:
smpsPSGvoice sTone_06
smpsAlterPitch $0C
smpsPSGAlterVol $01
dc.b nG4, $24, $06, nRst, $12, nG4, $06, nRst, $12, nBb4, $0C, smpsNoAttack
dc.b $30, $18, nBb4, nA4, $2A, nRst, $12, nA4, $06, nRst, $12, nA4
dc.b $0C, smpsNoAttack, $24, nAb4, $36
smpsAlterPitch $F4
dc.b nB6, $02, nG6, $02, nE6, $02, nD6, $54, nBb5, $0C, smpsNoAttack, $30
dc.b $0C, nG5, nE5, nE5, smpsNoAttack, nE5, $24, nD5, nC5, $0C, nC5, smpsNoAttack
dc.b nC5, $30, nRst, $30
smpsPSGAlterVol $FF
Snd_Credits_Jump07:
dc.b nRst, $60, nRst, nRst, nRst
smpsPSGvoice sTone_22
dc.b nRst, $0C, nB6, $08, nE6, $04, nAb5, $48, nRst, $60, nRst
smpsPSGAlterVol $FE
dc.b nRst, $30, nAb5, $18, nBb5, $18, nRst, $48, nC5, $0C, nB4, $0C
dc.b smpsNoAttack, nB4, $60, nRst, $48, nC5, $0C, nB4, $0C, smpsNoAttack, nB4, $60
dc.b nRst, $48, nC5, $0C, nB4, $0C, smpsNoAttack, nB4, $48, nB4, $0C, nA4
dc.b $0C, smpsNoAttack, nA4, $60, nRst
smpsPSGAlterVol $02
smpsAlterPitch $0C
smpsPSGAlterVol $01
dc.b nG4, $24, $06, nRst, $12, nG4, $06, nRst, $12, nBb4, $0C, smpsNoAttack
dc.b $30, $18, nBb4, nA4, $2A, nRst, $12, nA4, $06, nRst, $12, nA4
dc.b $0C, smpsNoAttack, $24, nAb4, $3C, nG4, $24, $06, nRst, $12, nG4, $06
dc.b nRst, $12, nBb4, $0C, smpsNoAttack, $60
smpsAlterPitch $F4
smpsPSGAlterVol $FF
dc.b nRst, nRst
smpsJump Snd_Credits_Jump07
; PSG2 Data
Snd_Credits_PSG2:
smpsPSGvoice sTone_06
smpsAlterPitch $0C
smpsPSGAlterVol $01
dc.b nRst, $02, nC5, nD5, nE5, $12, nD5, $0C, nC5, $06, nRst, $12
dc.b nD5, $06, nRst, $12, nE5, $0C, smpsNoAttack, $30, $0C, nF5, nG5, $18
dc.b nE5, nD5, $0C, nC5, $06, nRst, $12, nD5, $06, nRst, $12, nE5
dc.b $0C, smpsNoAttack, $18, nF5, $0C, nD5, $36
smpsAlterPitch $F4
dc.b nB6, $02, nG6, $02, nE6, $02, nB6, $54, nE6, $0C, smpsNoAttack, nE6
dc.b $30, nG6, $0C, nA6, $06, nRst, $12, nC6, $0C, smpsNoAttack, $24, nB5
dc.b $24, nA5, $0C, nA5, $0C, smpsNoAttack, nA5, $30, nRst, $30
smpsPSGAlterVol $FF
Snd_Credits_Jump06:
dc.b nRst, $60, nRst, nRst, nRst
smpsPSGvoice sTone_22
dc.b nRst, $0C, nB6, $04, nAb6, $08, nCs6, $48, nRst, $60, nRst
smpsPSGAlterVol $FE
dc.b nRst, $30, nG6, $18, nF6, $18, nRst, $48, nA5, $0C, nG5, $0C
dc.b smpsNoAttack, nG5, $60, nRst, $48, nA5, $0C, nG5, $0C, smpsNoAttack, nG5, $60
dc.b nRst, $48, nA5, $0C, nG5, smpsNoAttack, nG5, $48, nG5, $0C, nFs5, $0C
dc.b smpsNoAttack, nFs5, $60, nRst
smpsPSGAlterVol $02
smpsAlterPitch $0C
smpsPSGAlterVol $01
dc.b nRst, $02, nC5, nD5, nE5, $12, nD5, $0C, nC5, $06, nRst, $12
dc.b nD5, $06, nRst, $12, nE5, $0C, smpsNoAttack, $30, $0C, nF5, nG5, $18
dc.b nE5, nD5, $0C, nC5, $06, nRst, $12, nD5, $06, nRst, $12, nE5
dc.b $0C, smpsNoAttack, $18, nF5, $0C, nD5, $3C, nRst, $02, nC5, nD5, nE5
dc.b $12, nD5, $0C, nC5, $06, nRst, $12, nD5, $06, nRst, $12, nE5
dc.b $0C
smpsAlterPitch $F4
smpsPSGAlterVol $FF
dc.b smpsNoAttack, $60, nRst, nRst
smpsJump Snd_Credits_Jump06
; PSG3 Data
Snd_Credits_PSG3:
smpsPSGform $E7
Snd_Credits_Loop00:
smpsCall Snd_Credits_Call05
smpsLoop $00, $03, Snd_Credits_Loop00
smpsCall Snd_Credits_Call06
smpsCall Snd_Credits_Call07
Snd_Credits_Loop01:
smpsCall Snd_Credits_Call05
smpsLoop $00, $03, Snd_Credits_Loop01
smpsCall Snd_Credits_Call08
smpsCall Snd_Credits_Call09
Snd_Credits_Loop02:
smpsCall Snd_Credits_Call05
smpsLoop $00, $03, Snd_Credits_Loop02
smpsCall Snd_Credits_Call08
smpsCall Snd_Credits_Call0A
Snd_Credits_Loop03:
smpsCall Snd_Credits_Call05
smpsLoop $00, $03, Snd_Credits_Loop03
smpsCall Snd_Credits_Call08
smpsCall Snd_Credits_Call0B
smpsJump Snd_Credits_Loop01
Snd_Credits_Call08:
smpsPSGvoice sTone_0F
dc.b (nMaxPSG2-$23)&$FF, $0C, $0C
smpsPSGvoice sTone_12
dc.b $0C
smpsPSGvoice sTone_0F
dc.b $08
smpsPSGvoice sTone_12
dc.b $0C
smpsPSGvoice sTone_0F
dc.b $04
smpsPSGvoice sTone_12
dc.b $0C
smpsPSGvoice sTone_0F
dc.b $0C
smpsPSGvoice sTone_12
dc.b $0C
smpsReturn
Snd_Credits_Call05:
smpsPSGvoice sTone_0F
dc.b $0C, $0C
smpsPSGvoice sTone_12
dc.b $0C
smpsPSGvoice sTone_0F
dc.b $08
smpsPSGvoice sTone_12
dc.b $0C
smpsPSGvoice sTone_0F
dc.b $04
smpsPSGvoice sTone_12
dc.b $0C
smpsPSGvoice sTone_0F
dc.b $0C
smpsPSGvoice sTone_12
dc.b $0C
smpsPSGvoice sTone_0F
dc.b $0C, $0C
smpsPSGvoice sTone_12
dc.b $0C
smpsPSGvoice sTone_0F
dc.b $08
smpsPSGvoice sTone_12
dc.b $0C
smpsPSGvoice sTone_0F
dc.b $04
smpsPSGvoice sTone_12
dc.b $0C
smpsPSGvoice sTone_0F
dc.b $08, $04
smpsPSGvoice sTone_12
dc.b $0C
smpsReturn
Snd_Credits_Call06:
smpsPSGvoice sTone_0F
dc.b $08, $04
smpsPSGvoice sTone_12
dc.b $0C
smpsPSGvoice sTone_0F
dc.b $0C, $08, $04
smpsPSGvoice sTone_12
dc.b $0C
smpsPSGvoice sTone_0F
dc.b $0C, $08, $04
smpsPSGvoice sTone_12
dc.b $0C
smpsReturn
Snd_Credits_Call07:
smpsPSGvoice sTone_12
dc.b $18, $18, $14
smpsPSGvoice sTone_0F
dc.b $04, $08, $04
smpsPSGvoice sTone_12
dc.b $0C
smpsReturn
Snd_Credits_Call09:
smpsPSGvoice sTone_0F
dc.b $08, $04
smpsPSGvoice sTone_12
dc.b $0C
smpsPSGvoice sTone_0F
dc.b $08
smpsPSGvoice sTone_12
dc.b $0C
smpsPSGvoice sTone_0F
dc.b $04, $0C, $0C
smpsPSGvoice sTone_12
dc.b $08
smpsPSGvoice sTone_0F
dc.b $04
smpsPSGvoice sTone_12
dc.b $08
smpsPSGvoice sTone_0F
dc.b $04
smpsReturn
Snd_Credits_Call0A:
smpsPSGvoice sTone_0F
dc.b $08, $04
smpsPSGvoice sTone_12
dc.b $0C
smpsPSGvoice sTone_0F
dc.b $08, $04
smpsPSGvoice sTone_12
dc.b $0C, $14
smpsPSGvoice sTone_0F
dc.b $04, $08, $04
smpsPSGvoice sTone_12
dc.b $0C
smpsReturn
Snd_Credits_Call0B:
smpsPSGvoice sTone_0F
dc.b $08, $04
smpsPSGvoice sTone_12
dc.b $0C
smpsPSGvoice sTone_0F
dc.b $08
smpsPSGvoice sTone_12
dc.b $0C
smpsPSGvoice sTone_0F
dc.b $04, $14, $04
smpsPSGvoice sTone_12
dc.b $08
smpsPSGvoice sTone_0F
dc.b $04
smpsPSGvoice sTone_12
dc.b $08
smpsPSGvoice sTone_0F
dc.b $04
smpsReturn
; DAC Data
Snd_Credits_DAC:
dc.b nRst, $60
smpsLoop $00, $07, Snd_Credits_DAC
dc.b nRst, $30, dMuffledSnare, $12, $18, $06
Snd_Credits_Jump00:
smpsCall Snd_Credits_Call00
smpsCall Snd_Credits_Call01
smpsCall Snd_Credits_Call00
smpsCall Snd_Credits_Call02
smpsCall Snd_Credits_Call00
smpsCall Snd_Credits_Call01
smpsCall Snd_Credits_Call00
smpsCall Snd_Credits_Call03
smpsCall Snd_Credits_Call00
smpsCall Snd_Credits_Call01
smpsCall Snd_Credits_Call00
smpsCall Snd_Credits_Call04
smpsJump Snd_Credits_Jump00
Snd_Credits_Call00:
dc.b dKickS3, $0C, dFloorTomS3, $0C, dSnareS3, $12, dKickS3, $06, $0C, $0C, dSnareS3, $06
dc.b dFloorTomS3, $12, dKickS3, $18, dSnareS3, $12, dKickS3, $06, $0C, $0C, dSnareS3, $06
dc.b dFloorTomS3, $12, dKickS3, $0C, dFloorTomS3, $0C, dSnareS3, $12, dKickS3, $06, $0C, $0C
dc.b dSnareS3, $06, dFloorTomS3, $12
smpsReturn
Snd_Credits_Call01:
dc.b dKickS3, $18, dSnareS3, $12, dKickS3, $06, $0C, $0C, dSnareS3, $06, dFloorTomS3, $0C
dc.b dMuffledSnare, $06
smpsReturn
Snd_Credits_Call02:
dc.b dKickS3, $18, dSnareS3, $12, dKickS3, $06, $0C, $06, dMuffledSnare, $06, dSnareS3, $06
dc.b dFloorTomS3, $0C, dMuffledSnare, $06
smpsReturn
Snd_Credits_Call03:
dc.b dKickS3, $0C, dMuffledSnare, $0C, dSnareS3, $12, dKickS3, $06, $0C, $06, dMuffledSnare, $06
dc.b dSnareS3, $06, dMuffledSnare, $12
smpsReturn
Snd_Credits_Call04:
dc.b dKickS3, $0C, dMuffledSnare, $0C, dSnareS3, $12, dKickS3, $06, $06, dMuffledSnare, $06, dKickS3
dc.b $0C, dSnareS3, $06, dFloorTomS3, $0C, dMuffledSnare, $06
smpsReturn
Snd_Credits_Voices:
; Voice $00
; $08
; $0A, $70, $30, $00, $1F, $1F, $5F, $5F, $12, $0E, $0A, $0A
; $00, $04, $04, $03, $2F, $2F, $2F, $2F, $24, $2D, $13, $80
smpsVcAlgorithm $00
smpsVcFeedback $01
smpsVcUnusedBits $00
smpsVcDetune $00, $03, $07, $00
smpsVcCoarseFreq $00, $00, $00, $0A
smpsVcRateScale $01, $01, $00, $00
smpsVcAttackRate $1F, $1F, $1F, $1F
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $0A, $0A, $0E, $12
smpsVcDecayRate2 $03, $04, $04, $00
smpsVcDecayLevel $02, $02, $02, $02
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $00, $13, $2D, $24
; Voice $01
; $18
; $37, $30, $30, $31, $9E, $DC, $1C, $9C, $0D, $06, $04, $01
; $08, $0A, $03, $05, $BF, $BF, $3F, $2F, $2C, $22, $14, $80
smpsVcAlgorithm $00
smpsVcFeedback $03
smpsVcUnusedBits $00
smpsVcDetune $03, $03, $03, $03
smpsVcCoarseFreq $01, $00, $00, $07
smpsVcRateScale $02, $00, $03, $02
smpsVcAttackRate $1C, $1C, $1C, $1E
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $01, $04, $06, $0D
smpsVcDecayRate2 $05, $03, $0A, $08
smpsVcDecayLevel $02, $03, $0B, $0B
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $00, $14, $22, $2C
; Voice $02
; $3A
; $31, $7F, $61, $0A, $9C, $DB, $9C, $9A, $04, $08, $03, $09
; $03, $01, $00, $00, $1F, $0F, $FF, $FF, $23, $25, $1B, $80
smpsVcAlgorithm $02
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $00, $06, $07, $03
smpsVcCoarseFreq $0A, $01, $0F, $01
smpsVcRateScale $02, $02, $03, $02
smpsVcAttackRate $1A, $1C, $1B, $1C
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $09, $03, $08, $04
smpsVcDecayRate2 $00, $00, $01, $03
smpsVcDecayLevel $0F, $0F, $00, $01
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $00, $1B, $25, $23
; Voice $03
; $3B
; $0F, $06, $00, $01, $DF, $1F, $1F, $DF, $0C, $00, $0A, $03
; $0F, $00, $00, $01, $FF, $0F, $5F, $5F, $22, $22, $22, $80
smpsVcAlgorithm $03
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $00, $00, $00, $00
smpsVcCoarseFreq $01, $00, $06, $0F
smpsVcRateScale $03, $00, $00, $03
smpsVcAttackRate $1F, $1F, $1F, $1F
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $03, $0A, $00, $0C
smpsVcDecayRate2 $01, $00, $00, $0F
smpsVcDecayLevel $05, $05, $00, $0F
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $00, $22, $22, $22
; Voice $04
; $3C
; $31, $52, $50, $30, $1F, $11, $1F, $11, $1F, $1F, $1F, $1F
; $00, $00, $00, $00, $0F, $0F, $0F, $0F, $1A, $86, $16, $86
smpsVcAlgorithm $04
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $03, $05, $05, $03
smpsVcCoarseFreq $00, $00, $02, $01
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $11, $1F, $11, $1F
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $1F, $1F, $1F, $1F
smpsVcDecayRate2 $00, $00, $00, $00
smpsVcDecayLevel $00, $00, $00, $00
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $06, $16, $06, $1A
; Voice $05
; $38
; $31, $51, $31, $71, $17, $18, $1A, $11, $17, $16, $0B, $00
; $00, $00, $00, $00, $1F, $1F, $0F, $0F, $20, $11, $21, $80
smpsVcAlgorithm $00
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $07, $03, $05, $03
smpsVcCoarseFreq $01, $01, $01, $01
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $11, $1A, $18, $17
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $00, $0B, $16, $17
smpsVcDecayRate2 $00, $00, $00, $00
smpsVcDecayLevel $00, $00, $01, $01
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $00, $21, $11, $20
; Voice $06
; $3B
; $52, $31, $31, $51, $12, $14, $12, $14, $0E, $00, $0E, $02
; $00, $00, $00, $01, $4F, $0F, $5F, $3F, $1C, $18, $1D, $80
smpsVcAlgorithm $03
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $05, $03, $03, $05
smpsVcCoarseFreq $01, $01, $01, $02
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $14, $12, $14, $12
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $02, $0E, $00, $0E
smpsVcDecayRate2 $01, $00, $00, $00
smpsVcDecayLevel $03, $05, $00, $04
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $00, $1D, $18, $1C
; Voice $07
; $3C
; $31, $52, $50, $30, $52, $53, $52, $53, $08, $00, $08, $00
; $04, $00, $04, $00, $1F, $0F, $1F, $0F, $1A, $80, $16, $80
smpsVcAlgorithm $04
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $03, $05, $05, $03
smpsVcCoarseFreq $00, $00, $02, $01
smpsVcRateScale $01, $01, $01, $01
smpsVcAttackRate $13, $12, $13, $12
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $00, $08, $00, $08
smpsVcDecayRate2 $00, $04, $00, $04
smpsVcDecayLevel $00, $01, $00, $01
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $00, $16, $00, $1A
| 38.87694 | 101 | 0.572932 |
d09c4cd8e956e8bc7692c608122aed432217fbd6 | 139 | sql | SQL | fixtures/doctests/ddl/101_create_trigger/input.sql | SKalt/pg_sql_parser_tests | 1e22b4bf2ccecfe0544692e93a6e63113c9db054 | [
"BSD-3-Clause"
] | null | null | null | fixtures/doctests/ddl/101_create_trigger/input.sql | SKalt/pg_sql_parser_tests | 1e22b4bf2ccecfe0544692e93a6e63113c9db054 | [
"BSD-3-Clause"
] | null | null | null | fixtures/doctests/ddl/101_create_trigger/input.sql | SKalt/pg_sql_parser_tests | 1e22b4bf2ccecfe0544692e93a6e63113c9db054 | [
"BSD-3-Clause"
] | null | null | null | CREATE TRIGGER insert_measurement_trigger
BEFORE INSERT ON measurement
FOR EACH ROW EXECUTE FUNCTION measurement_insert_trigger();
| 34.75 | 63 | 0.827338 |
574247dde9b4bed6e49b0be496672cb28e494118 | 48,819 | c | C | sys/src/cmd/tex/web2c/web2c/web2cy.c | Plan9-Archive/plan9-2e | ce6d0434246216e848babe4f56919dc28981ad04 | [
"MIT"
] | 1 | 2021-03-23T22:40:43.000Z | 2021-03-23T22:40:43.000Z | sys/src/cmd/tex/web2c/web2c/web2cy.c | Plan9-Archive/plan9-2e | ce6d0434246216e848babe4f56919dc28981ad04 | [
"MIT"
] | null | null | null | sys/src/cmd/tex/web2c/web2c/web2cy.c | Plan9-Archive/plan9-2e | ce6d0434246216e848babe4f56919dc28981ad04 | [
"MIT"
] | 1 | 2021-12-21T06:19:58.000Z | 2021-12-21T06:19:58.000Z | #define array_tok 57346
#define begin_tok 57347
#define case_tok 57348
#define const_tok 57349
#define do_tok 57350
#define downto_tok 57351
#define else_tok 57352
#define end_tok 57353
#define file_tok 57354
#define for_tok 57355
#define function_tok 57356
#define goto_tok 57357
#define if_tok 57358
#define label_tok 57359
#define of_tok 57360
#define procedure_tok 57361
#define program_tok 57362
#define record_tok 57363
#define repeat_tok 57364
#define then_tok 57365
#define to_tok 57366
#define type_tok 57367
#define until_tok 57368
#define var_tok 57369
#define while_tok 57370
#define others_tok 57371
#define r_num_tok 57372
#define i_num_tok 57373
#define string_literal_tok 57374
#define single_char_tok 57375
#define assign_tok 57376
#define two_dots_tok 57377
#define undef_id_tok 57378
#define var_id_tok 57379
#define proc_id_tok 57380
#define proc_param_tok 57381
#define fun_id_tok 57382
#define fun_param_tok 57383
#define const_id_tok 57384
#define type_id_tok 57385
#define hhb0_tok 57386
#define hhb1_tok 57387
#define field_id_tok 57388
#define define_tok 57389
#define field_tok 57390
#define break_tok 57391
#define not_eq_tok 57392
#define less_eq_tok 57393
#define great_eq_tok 57394
#define or_tok 57395
#define unary_plus_tok 57396
#define unary_minus_tok 57397
#define div_tok 57398
#define mod_tok 57399
#define and_tok 57400
#define not_tok 57401
#line 20 "web2c.yacc"
#include "web2c.h"
#define YYDEBUG 1
#define symbol(x) sym_table[x].id
#define MAX_ARGS 50
static char fn_return_type[50], for_stack[300], control_var[50],
relation[3];
static char arg_type[MAX_ARGS][30];
static int last_type = -1, ids_typed;
char my_routine[100]; /* Name of routine being parsed, if any */
static char array_bounds[80], array_offset[80];
static int uses_mem, uses_eqtb, lower_sym, upper_sym;
static FILE *orig_std;
boolean doing_statements = false;
static boolean var_formals = false;
static int param_id_list[MAX_ARGS], ids_paramed=0;
extern char conditional[], temp[], *std_header;
extern int tex, mf, strict_for;
extern FILE *coerce;
extern char coerce_name[];
extern boolean debug;
static long my_labs();
static void compute_array_bounds(), fixup_var_list();
static void do_proc_args(), gen_function_head();
static boolean doreturn();
extern int yyerrflag;
#ifndef YYMAXDEPTH
#define YYMAXDEPTH 150
#endif
#ifndef YYSTYPE
#define YYSTYPE int
#endif
YYSTYPE yylval;
YYSTYPE yyval;
#define YYEOFCODE 1
#define YYERRCODE 2
#line 1106 "web2c.yacc"
static void compute_array_bounds()
{
long lb;
char tmp[200];
if (lower_sym == -1) { /* lower is a constant */
lb = lower_bound - 1;
if (lb==0) lb = -1; /* Treat lower_bound==1 as if lower_bound==0 */
if (upper_sym == -1) /* both constants */
(void) sprintf(tmp, "[%ld]", upper_bound - lb);
else { /* upper a symbol, lower constant */
if (lb < 0)
(void) sprintf(tmp, "[%s + %ld]",
symbol(upper_sym), (-lb));
else
(void) sprintf(tmp, "[%s - %ld]",
symbol(upper_sym), lb);
}
if (lower_bound < 0 || lower_bound > 1) {
if (*array_bounds) {
fprintf(stderr, "Cannot handle offset in second dimension\n");
exit(1);
}
if (lower_bound < 0) {
(void) sprintf(array_offset, "+%ld", -lower_bound);
} else {
(void) sprintf(array_offset, "-%ld", lower_bound);
}
}
(void) strcat(array_bounds, tmp);
}
else { /* lower is a symbol */
if (upper_sym != -1) /* both are symbols */
(void) sprintf(tmp, "[%s - %s + 1]", symbol(upper_sym),
symbol(lower_sym));
else { /* upper constant, lower symbol */
(void) sprintf(tmp, "[%ld - %s]", upper_bound + 1,
symbol(lower_sym));
}
if (*array_bounds) {
fprintf(stderr, "Cannot handle symbolic offset in second dimension\n");
exit(1);
}
(void) sprintf(array_offset, "- (int)(%s)", symbol(lower_sym));
(void) strcat(array_bounds, tmp);
}
}
/* Kludge around negative lower array bounds. */
static void
fixup_var_list ()
{
int i, j;
char output_string[100], real_symbol[100];
for (i = 0; var_list[i++] == '!'; )
{
for (j = 0; real_symbol[j++] = var_list[i++]; )
;
if (*array_offset)
{
(void) fprintf (std, "\n#define %s (%s %s)\n ",
real_symbol, next_temp, array_offset);
(void) strcpy (real_symbol, next_temp);
/* Add the temp to the symbol table, so that change files can
use it later on if necessary. */
j = add_to_table (next_temp);
sym_table[j].typ = var_id_tok;
find_next_temp ();
}
(void) sprintf (output_string, "%s%s%c", real_symbol, array_bounds,
var_list[i] == '!' ? ',' : ' ');
my_output (output_string);
}
semicolon ();
}
/* If we're not processing TeX, we return false. Otherwise,
return true if the label is "10" and we're not in one of four TeX
routines where the line labeled "10" isn't the end of the routine.
Otherwise, return 0. */
static boolean
doreturn (label)
char *label;
{
return
tex
&& STREQ (label, "10")
&& !STREQ (my_routine, "macrocall")
&& !STREQ (my_routine, "hpack")
&& !STREQ (my_routine, "vpackage")
&& !STREQ (my_routine, "trybreak");
}
/* Return the absolute value of a long. */
static long
my_labs (x)
long x;
{
if (x < 0L) return(-x);
return(x);
}
static void
do_proc_args ()
{
fprintf (coerce, "%s %s();\n", fn_return_type, z_id);
}
static void
gen_function_head()
{
int i;
if (strcmp(my_routine, z_id)) {
fprintf(coerce, "#define %s(", my_routine);
for (i=0; i<ids_paramed; i++) {
if (i > 0)
fprintf(coerce, ", %s", symbol(param_id_list[i]));
else
fprintf(coerce, "%s", symbol(param_id_list[i]));
}
fprintf(coerce, ") %s(", z_id);
for (i=0; i<ids_paramed; i++) {
if (i > 0)
fputs(", ", coerce);
fprintf(coerce, "(%s) ", arg_type[i]);
fprintf(coerce, "%s(%s)",
sym_table[param_id_list[i]].var_formal?"&":"",
symbol(param_id_list[i]));
}
fprintf(coerce, ")\n");
}
std = orig_std;
my_output(z_id);
my_output("(");
for (i=0; i<ids_paramed; i++) {
if (i > 0) my_output(",");
my_output(symbol(param_id_list[i]));
}
my_output(")");
indent_line();
for (i=0; i<ids_paramed; i++) {
my_output(arg_type[i]);
my_output(symbol(param_id_list[i]));
semicolon();
}
}
short yyexca[] =
{-1, 1,
1, -1,
-2, 0,
-1, 38,
36, 30,
-2, 27,
-1, 53,
36, 44,
-2, 41,
-1, 66,
36, 86,
37, 86,
46, 86,
-2, 83,
-1, 154,
72, 151,
75, 151,
-2, 153,
-1, 208,
36, 72,
46, 72,
-2, 75,
-1, 299,
36, 72,
46, 72,
-2, 75,
-1, 352,
50, 0,
51, 0,
52, 0,
53, 0,
54, 0,
55, 0,
-2, 176,
-1, 353,
50, 0,
51, 0,
52, 0,
53, 0,
54, 0,
55, 0,
-2, 178,
-1, 355,
50, 0,
51, 0,
52, 0,
53, 0,
54, 0,
55, 0,
-2, 182,
-1, 356,
50, 0,
51, 0,
52, 0,
53, 0,
54, 0,
55, 0,
-2, 184,
-1, 357,
50, 0,
51, 0,
52, 0,
53, 0,
54, 0,
55, 0,
-2, 186,
-1, 358,
50, 0,
51, 0,
52, 0,
53, 0,
54, 0,
55, 0,
-2, 188,
-1, 372,
24, 258,
-2, 261,
};
#define YYNPROD 264
#define YYPRIVATE 57344
#define YYLAST 542
short yyact[] =
{
307, 294, 379, 232, 365, 128, 129, 306, 301, 363,
127, 172, 290, 243, 83, 217, 293, 51, 221, 36,
164, 24, 84, 15, 252, 233, 95, 248, 269, 270,
272, 273, 274, 275, 265, 266, 277, 212, 75, 267,
278, 268, 271, 276, 222, 391, 46, 223, 347, 390,
205, 346, 269, 270, 272, 273, 274, 275, 265, 266,
277, 204, 186, 267, 278, 268, 271, 276, 107, 340,
107, 378, 376, 339, 106, 207, 344, 269, 270, 272,
273, 274, 275, 265, 266, 277, 381, 45, 267, 278,
268, 271, 276, 297, 341, 342, 296, 44, 58, 179,
410, 59, 218, 265, 266, 277, 97, 181, 267, 278,
268, 271, 276, 91, 165, 109, 180, 289, 408, 288,
118, 142, 31, 32, 284, 169, 389, 183, 28, 29,
124, 267, 278, 268, 271, 276, 298, 49, 178, 377,
163, 166, 167, 168, 269, 270, 272, 273, 274, 275,
265, 266, 277, 258, 50, 267, 278, 268, 271, 276,
34, 47, 184, 368, 211, 185, 182, 206, 203, 111,
110, 114, 115, 201, 185, 126, 154, 33, 94, 234,
235, 116, 388, 200, 93, 62, 61, 60, 35, 142,
142, 213, 299, 214, 30, 142, 225, 236, 228, 229,
240, 142, 219, 27, 17, 230, 49, 231, 237, 185,
108, 89, 49, 250, 67, 42, 255, 256, 185, 249,
54, 85, 86, 50, 302, 73, 396, 280, 142, 50,
264, 87, 210, 279, 303, 262, 263, 261, 239, 259,
269, 270, 272, 273, 274, 275, 265, 266, 277, 70,
57, 267, 278, 268, 271, 276, 304, 5, 102, 287,
39, 308, 104, 105, 295, 269, 270, 272, 273, 274,
275, 265, 266, 277, 69, 72, 267, 278, 268, 271,
276, 82, 324, 23, 6, 111, 110, 114, 115, 98,
22, 100, 101, 21, 20, 19, 18, 116, 325, 56,
8, 63, 285, 331, 188, 333, 332, 187, 385, 249,
348, 349, 350, 351, 352, 353, 354, 355, 356, 357,
358, 359, 360, 361, 338, 337, 190, 43, 370, 372,
142, 64, 369, 142, 402, 373, 148, 158, 380, 367,
245, 366, 52, 37, 161, 406, 147, 162, 329, 383,
81, 92, 367, 160, 366, 80, 397, 336, 209, 159,
81, 16, 133, 194, 407, 80, 392, 145, 154, 144,
146, 155, 156, 326, 25, 375, 413, 394, 412, 142,
138, 393, 405, 371, 398, 328, 395, 400, 238, 198,
327, 197, 399, 283, 142, 196, 404, 403, 401, 380,
409, 153, 152, 151, 364, 387, 362, 148, 158, 142,
323, 411, 195, 414, 415, 161, 11, 147, 162, 224,
286, 199, 193, 10, 160, 157, 150, 149, 12, 141,
159, 140, 189, 343, 13, 384, 14, 305, 145, 154,
144, 146, 155, 156, 257, 282, 281, 227, 322, 321,
320, 138, 319, 318, 317, 316, 315, 9, 314, 313,
312, 311, 310, 309, 226, 386, 345, 260, 220, 192,
216, 143, 215, 137, 136, 135, 134, 132, 131, 130,
191, 139, 335, 247, 122, 103, 334, 246, 121, 79,
292, 244, 291, 242, 202, 120, 99, 119, 78, 77,
76, 117, 123, 68, 66, 254, 382, 300, 253, 251,
208, 177, 176, 175, 174, 48, 173, 171, 170, 125,
88, 55, 53, 113, 112, 71, 40, 38, 41, 26,
374, 330, 241, 96, 4, 90, 74, 65, 7, 3,
2, 1
};
short yypact[] =
{
-1000,-1000, 237,-1000,-1000, 264, 409, 344, 137, 260,
259, 258, 257, 254, 247, 367,-1000,-1000, 136, 61,
127, 55, 110, 121, 318,-1000, 296,-1000,-1000, 28,
-1000,-1000, 18,-1000, 164,-1000, 315,-1000,-1000,-1000,
214, 31,-1000,-1000, 120, 119, 118, 266, 300,-1000,
-1000,-1000,-1000,-1000,-1000, 213,-1000,-1000,-1000, 296,
-1000,-1000,-1000, 164,-1000, 336,-1000,-1000, 185,-1000,
-1000, 161,-1000,-1000, 346,-1000, 117, 111,-1000,-1000,
253, 222,-1000, 0,-1000,-1000,-1000,-1000, 160, 255,
-1000,-1000,-1000,-1000,-1000,-1000, 344,-1000,-1000,-1000,
-1000,-1000,-1000,-1000,-1000,-1000,-1000, 185,-1000, 108,
-1000,-1000,-1000,-1000,-1000,-1000,-1000, 331, 367, 46,
46, 46, 46, 95,-1000, 95,-1000, 151,-1000,-1000,
-12,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,
-1000,-1000, 273, 270,-1000,-1000,-1000, 295,-1000,-1000,
-1000,-1000,-1000,-1000,-1000,-1000,-1000, 353,-1000,-1000,
-1000,-1000,-1000, 318, 106,-1000, 101, -13, -24, 100,
-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000, 3,
-1000, 340, 189, 97, -38, 331, 402,-1000,-1000, 34,
-1000, 331, -28,-1000,-1000, 139, 139, 331, 201, 139,
-1000,-1000, 313,-1000,-1000,-1000,-1000, 170,-1000,-1000,
-1000,-1000,-1000,-1000,-1000, 139, 139,-1000,-1000, 142,
-28,-1000,-1000, 191, 331, 215, 139,-1000,-1000,-1000,
-1000,-1000,-1000,-1000,-1000,-1000, 190, 98, 268,-1000,
190, 315, 50,-1000,-1000,-1000, 95, 95, 23,-1000,
-1000, 125,-1000, 188, 95, 190, 190, 139,-1000,-1000,
139,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,
-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,
-1000, 139, 34, 365,-1000,-1000, 325,-1000,-1000, 313,
-1000, 185,-1000,-1000,-1000,-1000, 339, 170,-1000,-1000,
-1,-1000,-1000,-1000,-1000, 25,-1000, 2, -22, 139,
139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 310, 94,-1000, 331, 139, 139, 331,
370,-1000, -2,-1000, 72, 4, 95, 13,-1000,-1000,
188,-1000,-1000,-1000, 277,-1000,-1000,-1000, 70, 70,
-1000,-1000, 47, 47,-1000, 47, 47, 47, 47,-1000,
70,-1000, 115,-1000, -25,-1000,-1000,-1000,-1000,-1000,
190, 358, 190,-1000,-1000, 331, 183,-1000,-1000,-1000,
-1000, 338, 95,-1000, 139,-1000, 139,-1000, 323,-1000,
402, 310,-1000, 321, 355, 107,-1000, 95,-1000,-1000,
27,-1000,-1000,-1000,-1000, 331,-1000,-1000,-1000,-1000,
-1000,-1000, 139, 139, 190, 190
};
short yypgo[] =
{
0, 541, 540, 539, 538, 23, 21, 19, 17, 537,
536, 535, 534, 11, 26, 533, 532, 531, 530, 529,
528, 215, 527, 260, 526, 525, 25, 524, 523, 522,
220, 521, 520, 519, 1, 518, 517, 516, 161, 515,
514, 513, 512, 511, 27, 2, 510, 509, 24, 508,
507, 506, 8, 505, 504, 214, 503, 14, 502, 22,
501, 10, 38, 500, 499, 498, 497, 20, 496, 495,
494, 493, 13, 12, 492, 491, 490, 489, 488, 487,
16, 486, 485, 484, 483, 482, 481, 480, 5, 6,
479, 478, 477, 476, 475, 474, 473, 3, 472, 0,
471, 470, 469, 468, 18, 467, 466, 465, 464, 463,
462, 461, 460, 459, 458, 456, 455, 454, 453, 452,
450, 449, 448, 447, 446, 445, 15, 444, 437, 7,
435, 433, 432, 431, 429, 427, 426, 425, 422, 421,
420, 419, 412, 410, 406, 405, 9, 404, 4, 403,
402, 401, 395, 393, 391, 390, 389, 388, 385, 383,
382, 381, 378, 377, 376
};
short yyr1[] =
{
0, 4, 9, 1, 2, 2, 12, 12, 12, 12,
12, 12, 12, 12, 12, 3, 15, 16, 17, 14,
5, 19, 5, 20, 20, 21, 6, 6, 22, 22,
24, 25, 23, 26, 26, 26, 26, 27, 27, 28,
7, 7, 29, 29, 31, 32, 33, 30, 34, 34,
35, 35, 13, 39, 39, 38, 38, 37, 36, 36,
36, 36, 43, 40, 40, 44, 44, 45, 46, 41,
47, 47, 49, 51, 48, 48, 50, 50, 52, 52,
53, 42, 8, 8, 54, 54, 56, 58, 55, 57,
57, 59, 59, 59, 11, 60, 11, 10, 10, 10,
62, 62, 63, 66, 65, 69, 65, 67, 70, 67,
71, 71, 74, 73, 75, 72, 76, 72, 68, 68,
64, 78, 79, 81, 77, 83, 84, 85, 77, 82,
82, 80, 18, 87, 86, 61, 61, 88, 88, 90,
89, 89, 91, 91, 91, 91, 91, 98, 93, 101,
93, 102, 97, 97, 100, 100, 103, 103, 105, 104,
104, 104, 104, 106, 107, 106, 99, 109, 99, 110,
99, 111, 99, 112, 99, 113, 99, 114, 99, 115,
99, 116, 99, 117, 99, 118, 99, 119, 99, 120,
99, 121, 99, 122, 99, 99, 108, 108, 108, 124,
123, 123, 123, 123, 125, 123, 127, 126, 128, 130,
128, 129, 131, 131, 94, 94, 132, 94, 95, 96,
92, 92, 92, 133, 133, 135, 135, 139, 140, 137,
141, 138, 142, 143, 136, 144, 144, 146, 147, 147,
148, 148, 145, 145, 134, 134, 134, 152, 153, 149,
154, 155, 150, 156, 158, 160, 151, 157, 161, 162,
159, 163, 164, 159
};
short yyr2[] =
{
0, 0, 0, 10, 0, 2, 4, 4, 4, 6,
4, 6, 4, 6, 4, 3, 0, 0, 0, 8,
0, 0, 4, 1, 3, 1, 0, 2, 1, 2,
0, 0, 6, 1, 1, 1, 1, 1, 1, 1,
0, 2, 1, 2, 0, 0, 0, 7, 1, 1,
1, 1, 3, 0, 1, 2, 1, 1, 1, 1,
1, 1, 2, 6, 8, 1, 1, 1, 0, 4,
1, 3, 0, 0, 5, 0, 1, 3, 1, 1,
0, 4, 0, 2, 1, 2, 0, 0, 6, 1,
3, 1, 1, 1, 0, 0, 5, 0, 1, 2,
2, 2, 2, 0, 5, 0, 5, 0, 0, 4,
1, 3, 0, 4, 0, 2, 0, 3, 1, 1,
2, 0, 0, 0, 9, 0, 0, 0, 9, 1,
1, 1, 3, 0, 4, 1, 3, 1, 3, 1,
1, 1, 1, 1, 1, 1, 1, 0, 4, 0,
4, 0, 3, 1, 1, 1, 1, 2, 0, 4,
2, 2, 2, 1, 0, 4, 2, 0, 4, 0,
4, 0, 4, 0, 4, 0, 4, 0, 4, 0,
4, 0, 4, 0, 4, 0, 4, 0, 4, 0,
4, 0, 4, 0, 4, 1, 1, 1, 1, 0,
4, 1, 1, 1, 0, 3, 0, 4, 1, 0,
4, 2, 2, 0, 1, 1, 0, 3, 2, 0,
1, 1, 1, 1, 1, 1, 2, 0, 0, 6,
0, 3, 0, 0, 7, 1, 3, 3, 1, 3,
1, 1, 1, 2, 1, 1, 1, 0, 0, 6,
0, 0, 6, 0, 0, 0, 9, 1, 0, 0,
5, 0, 0, 5
};
short yychk[] =
{
-1000, -1, -2, -3, -12, 20, 47, -4, 36, 48,
14, 7, 19, 25, 27, -5, 17, 67, 36, 36,
36, 36, 36, 36, -6, 7, -19, 67, 67, 68,
67, 67, 68, 67, 50, 67, -7, 25, -22, -23,
-24, -20, -21, 31, 69, 69, -13, -38, -39, 42,
59, -8, 27, -29, -30, -31, -23, 36, 67, 70,
67, 67, 67, 35, 31, -9, -54, -55, -56, -30,
36, -25, -21, -38, -10, -62, -63, -64, -65, -77,
19, 14, -55, -57, -59, 36, 37, 46, -32, 50,
-11, -62, 5, 67, 67, -14, -15, -14, 36, -68,
38, 39, 36, -82, 40, 41, 74, 70, 50, -26,
31, 30, -27, -28, 32, 33, 42, -60, -5, -66,
-69, -78, -83, -58, -59, -33, 67, -61, -88, -89,
-90, -91, -92, 31, -93, -94, -95, -96, 49, -86,
-133,-134, -97,-100, 38, 36, 39, 15, 5,-135,
-136,-149,-150,-151, 37, 40, 41,-137, 6, 28,
22, 13, 16, -6, -67, 68, -67, -67, -67, -34,
-35, -36, -13, -37, -40, -41, -42, -43, 43, 4,
21, 12, 71, -34, 11, 67, 74, 34, 34,-132,
31, -87,-102,-138, 10,-142,-152,-154,-156,-139,
-7, 67, -70, 67, 74, 74, 67, 72, -46, 18,
43, 67, 75, -88, -89, -98,-101,-126, 68, -61,
-103,-104, 72, 75,-141, -99,-108,-123, 59, 60,
66, 68, -97, -26, 40, 41, -99, -61,-157, 37,
-99, -16, -71, -72, -75, 27, -79, -84, -44, -13,
43, -47, -48, -49, -53, -99, -99,-127, 11,-104,
-105, 46, 44, 45, -88, 56, 57, 61, 63, 50,
51, 64, 52, 53, 54, 55, 65, 58, 62, 18,
-99,-124,-125,-153, 26, 34,-140, -8, 69, 67,
-73, -74, -76, -80, -34, -80, 73, 70, 11, 67,
-50, -52, 36, 46, -34,-128,-129, -99, -99,-109,
-110,-111,-112,-113,-114,-115,-116,-117,-118,-119,
-120,-121,-122,-143, -99,-126, 8,-155,-158, 23,
-17, -72, -57, -73, -81, -85, 18, -44, -48, 74,
70, 69, 70,-131, 74,-106, 73, 70, -99, -99,
-99, -99, -99, -99, -99, -99, -99, -99, -99, -99,
-99, -99,-144,-146,-147,-148, 31, 29, 69, -88,
-99,-159, -99, -88, -18, 5, 74, 67, 67, -45,
-34, 73, -51, -52,-130, 31,-107,-145, 67, 11,
74, 70, 8,-161,-163, -61, 43, 18, -34,-129,
-99,-146, 11, -89,-148,-160, 24, 9, 11, -45,
73, -88,-162,-164, -99, -99
};
short yydef[] =
{
4, -2, 0, 1, 5, 0, 0, 20, 0, 0,
0, 0, 0, 0, 0, 26, 21, 15, 0, 0,
0, 0, 0, 0, 40, 30, 0, 6, 7, 0,
8, 10, 0, 12, 53, 14, 82, 44, -2, 28,
0, 0, 23, 25, 0, 0, 0, 0, 0, 56,
54, 2, 86, -2, 42, 0, 29, 31, 22, 0,
9, 11, 13, 53, 55, 97, -2, 84, 0, 43,
45, 0, 24, 52, 94, 98, 0, 0, 16, 16,
0, 0, 85, 0, 89, 91, 92, 93, 0, 0,
3, 99, 95, 100, 101, 102, 20, 120, 103, 105,
118, 119, 121, 125, 129, 130, 87, 0, 46, 0,
33, 34, 35, 36, 37, 38, 39, 219, 26, 107,
107, 107, 107, 53, 90, 53, 32, 0, 135, 137,
0, 140, 141, 139, 142, 143, 144, 145, 146, 220,
221, 222, 0, 0, 214, 215, 216, 0, 133, 223,
224, 244, 245, 246, -2, 154, 155, 225, 232, 247,
250, 253, 227, 40, 0, 108, 0, 0, 0, 0,
48, 49, 50, 51, 58, 59, 60, 61, 57, 0,
68, 0, 0, 0, 0, 219, 219, 147, 149, 0,
218, 219, 0, 226, 230, 0, 0, 219, 0, 0,
17, 104, 114, 106, 122, 126, 88, 53, -2, 80,
62, 47, 96, 136, 138, 0, 0, 217, 206, 0,
152, 156, 158, 0, 219, 0, 0, 195, 196, 197,
198, 199, 201, 202, 203, 204, 248, 0, 0, 257,
228, 82, 0, 110, 112, 116, 53, 53, 0, 65,
66, 0, 70, 0, 53, 148, 150, 0, 134, 157,
0, 160, 161, 162, 231, 167, 169, 171, 173, 175,
177, 179, 181, 183, 185, 187, 189, 191, 193, 233,
166, 0, 0, 0, 251, 254, 0, 18, 109, 114,
115, 0, 112, 123, 131, 127, 0, 53, 69, -2,
0, 76, 78, 79, 81, 0, 208, 213, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 205, 219, 0, 0, 219,
0, 111, 0, 117, 0, 0, 53, 0, 71, 73,
0, 207, 209, 211, 0, 159, 163, 164, 168, 170,
172, 174, -2, -2, 180, -2, -2, -2, -2, 190,
192, 194, 0, 235, 0, 238, 240, 241, 200, 249,
252, 0, -2, 229, 19, 219, 0, 124, 128, 63,
67, 0, 53, 77, 0, 212, 0, 234, 0, 242,
219, 0, 255, 0, 0, 0, 113, 53, 74, 210,
0, 236, 243, 237, 239, 219, 259, 262, 132, 64,
165, 256, 0, 0, 260, 263
};
short yytok1[] =
{
1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
68, 69, 61, 56, 70, 57, 75, 62, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 74, 67,
52, 50, 53, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 72, 0, 73, 71
};
short yytok2[] =
{
2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 44, 45, 46, 47, 48, 49, 51, 54,
55, 58, 59, 60, 63, 64, 65, 66
};
long yytok3[] =
{
0
};
#define YYFLAG -1000
#define YYERROR goto yyerrlab
#define YYACCEPT return(0)
#define YYABORT return(1)
#define yyclearin yychar = -1
#define yyerrok yyerrflag = 0
#ifdef yydebug
#include "y.debug"
#else
#define yydebug 0
#endif
/* parser for yacc output */
int yynerrs = 0; /* number of errors */
int yyerrflag = 0; /* error recovery flag */
char* yytoknames[1]; /* for debugging */
char* yystates[1]; /* for debugging */
long yychar; /* for debugging */
extern int fprint(int, char*, ...);
extern int sprint(char*, char*, ...);
char*
yytokname(int yyc)
{
static char x[10];
if(yyc > 0 && yyc <= sizeof(yytoknames)/sizeof(yytoknames[0]))
if(yytoknames[yyc-1])
return yytoknames[yyc-1];
sprintf(x, "<%d>", yyc);
return x;
}
char*
yystatname(int yys)
{
static char x[10];
if(yys >= 0 && yys < sizeof(yystates)/sizeof(yystates[0]))
if(yystates[yys])
return yystates[yys];
sprintf(x, "<%d>\n", yys);
return x;
}
long
yylex1(void)
{
long yychar;
long *t3p;
int c;
yychar = yylex();
if(yychar <= 0) {
c = yytok1[0];
goto out;
}
if(yychar < sizeof(yytok1)/sizeof(yytok1[0])) {
c = yytok1[yychar];
goto out;
}
if(yychar >= YYPRIVATE)
if(yychar < YYPRIVATE+sizeof(yytok2)/sizeof(yytok2[0])) {
c = yytok2[yychar-YYPRIVATE];
goto out;
}
for(t3p=yytok3;; t3p+=2) {
c = t3p[0];
if(c == yychar) {
c = t3p[1];
goto out;
}
if(c == 0)
break;
}
c = 0;
out:
if(c == 0)
c = yytok2[1]; /* unknown char */
if(yydebug >= 3)
printf("lex %.4X %s\n", yychar, yytokname(c));
return c;
}
int
yyparse(void)
{
struct
{
YYSTYPE yyv;
int yys;
} yys[YYMAXDEPTH], *yyp, *yypt;
short *yyxi;
int yyj, yym, yystate, yyn, yyg;
YYSTYPE save1, save2;
int save3, save4;
save1 = yylval;
save2 = yyval;
save3 = yynerrs;
save4 = yyerrflag;
yystate = 0;
yychar = -1;
yynerrs = 0;
yyerrflag = 0;
yyp = &yys[-1];
goto yystack;
ret0:
yyn = 0;
goto ret;
ret1:
yyn = 1;
goto ret;
ret:
yylval = save1;
yyval = save2;
yynerrs = save3;
yyerrflag = save4;
return yyn;
yystack:
/* put a state and value onto the stack */
if(yydebug >= 4)
printf("char %s in %s", yytokname(yychar), yystatname(yystate));
yyp++;
if(yyp >= &yys[YYMAXDEPTH]) {
yyerror("yacc stack overflow");
goto ret1;
}
yyp->yys = yystate;
yyp->yyv = yyval;
yynewstate:
yyn = yypact[yystate];
if(yyn <= YYFLAG)
goto yydefault; /* simple state */
if(yychar < 0)
yychar = yylex1();
yyn += yychar;
if(yyn < 0 || yyn >= YYLAST)
goto yydefault;
yyn = yyact[yyn];
if(yychk[yyn] == yychar) { /* valid shift */
yychar = -1;
yyval = yylval;
yystate = yyn;
if(yyerrflag > 0)
yyerrflag--;
goto yystack;
}
yydefault:
/* default state action */
yyn = yydef[yystate];
if(yyn == -2) {
if(yychar < 0)
yychar = yylex1();
/* look through exception table */
for(yyxi=yyexca;; yyxi+=2)
if(yyxi[0] == -1 && yyxi[1] == yystate)
break;
for(yyxi += 2;; yyxi += 2) {
yyn = yyxi[0];
if(yyn < 0 || yyn == yychar)
break;
}
yyn = yyxi[1];
if(yyn < 0)
goto ret0;
}
if(yyn == 0) {
/* error ... attempt to resume parsing */
switch(yyerrflag) {
case 0: /* brand new error */
yyerror("syntax error");
if(yydebug >= 1) {
printf("%s", yystatname(yystate));
printf("saw %s\n", yytokname(yychar));
}
yyerrlab:
yynerrs++;
case 1:
case 2: /* incompletely recovered error ... try again */
yyerrflag = 3;
/* find a state where "error" is a legal shift action */
while(yyp >= yys) {
yyn = yypact[yyp->yys] + YYERRCODE;
if(yyn >= 0 && yyn < YYLAST) {
yystate = yyact[yyn]; /* simulate a shift of "error" */
if(yychk[yystate] == YYERRCODE)
goto yystack;
}
/* the current yyp has no shift onn "error", pop stack */
if(yydebug >= 2)
printf("error recovery pops state %d, uncovers %d\n",
yyp->yys, (yyp-1)->yys );
yyp--;
}
/* there is no state on the stack with an error shift ... abort */
goto ret1;
case 3: /* no shift yet; clobber input char */
if(yydebug >= YYEOFCODE)
printf("error recovery discards %s\n", yytokname(yychar));
if(yychar == 0)
goto ret1;
yychar = -1;
goto yynewstate; /* try again in the same state */
}
}
/* reduction by production yyn */
if(yydebug >= 2)
printf("reduce %d in:\n\t%s", yyn, yystatname(yystate));
yypt = yyp;
yyp -= yyr2[yyn];
yyval = (yyp+1)->yyv;
yym = yyn;
/* consult goto table to find next state */
yyn = yyr1[yyn];
yyg = yypgo[yyn];
yyj = yyg + yyp->yys + 1;
if(yyj >= YYLAST || yychk[yystate=yyact[yyj]] != -yyn)
yystate = yyact[yyg];
switch(yym) {
case 1:
#line 58 "web2c.yacc"
{ block_level++;
printf ("#include \"%s\"\n", std_header);
} break;
case 2:
#line 63 "web2c.yacc"
{ printf ("\n#include \"%s\"\n", coerce_name); } break;
case 3:
#line 66 "web2c.yacc"
{ YYACCEPT; } break;
case 6:
#line 76 "web2c.yacc"
{
ii = add_to_table (last_id);
sym_table[ii].typ = field_id_tok;
} break;
case 7:
#line 81 "web2c.yacc"
{
ii = add_to_table (last_id);
sym_table[ii].typ = fun_id_tok;
} break;
case 8:
#line 86 "web2c.yacc"
{
ii = add_to_table (last_id);
sym_table[ii].typ = const_id_tok;
} break;
case 9:
#line 91 "web2c.yacc"
{
ii = add_to_table (last_id);
sym_table[ii].typ = fun_param_tok;
} break;
case 10:
#line 96 "web2c.yacc"
{
ii = add_to_table (last_id);
sym_table[ii].typ = proc_id_tok;
} break;
case 11:
#line 101 "web2c.yacc"
{
ii = add_to_table (last_id);
sym_table[ii].typ = proc_param_tok;
} break;
case 12:
#line 106 "web2c.yacc"
{
ii = add_to_table (last_id);
sym_table[ii].typ = type_id_tok;
} break;
case 13:
#line 111 "web2c.yacc"
{
ii = add_to_table (last_id);
sym_table[ii].typ = type_id_tok;
sym_table[ii].val = lower_bound;
sym_table[ii].val_sym = lower_sym;
sym_table[ii].upper = upper_bound;
sym_table[ii].upper_sym = upper_sym;
} break;
case 14:
#line 120 "web2c.yacc"
{
ii = add_to_table (last_id);
sym_table[ii].typ = var_id_tok;
} break;
case 16:
#line 131 "web2c.yacc"
{ if (block_level > 0) my_output("{");
indent++; block_level++;
} break;
case 17:
#line 136 "web2c.yacc"
{if (block_level == 2) {
if (strcmp(fn_return_type, "void")) {
my_output("register");
my_output(fn_return_type);
my_output("Result;");
}
if (tex) {
(void) sprintf(safe_string, "%s_regmem",
my_routine);
my_output(safe_string);
indent_line();
}
}
} break;
case 18:
#line 151 "web2c.yacc"
{if (block_level == 1)
puts("\n#include \"coerce.h\"");
doing_statements = true;
} break;
case 19:
#line 156 "web2c.yacc"
{if (block_level == 2) {
if (strcmp(fn_return_type,"void")) {
my_output("return(Result)");
semicolon();
}
if (tex) {
if (uses_mem && uses_eqtb)
(void) fprintf(coerce,
"#define %s_regmem register memoryword *mem=zmem, *eqtb=zeqtb;\n",
my_routine);
else if (uses_mem)
(void) fprintf(coerce,
"#define %s_regmem register memoryword *mem=zmem;\n",
my_routine);
else if (uses_eqtb)
(void) fprintf(coerce,
"#define %s_regmem register memoryword *eqtb=zeqtb;\n",
my_routine);
else
(void) fprintf(coerce,
"#define %s_regmem\n",
my_routine);
}
my_routine[0] = '\0';
}
indent--; block_level--;
my_output("}"); new_line();
doing_statements = false;
} break;
case 21:
#line 189 "web2c.yacc"
{ my_output("/*"); } break;
case 22:
#line 191 "web2c.yacc"
{ my_output("*/"); } break;
case 25:
#line 199 "web2c.yacc"
{ my_output(temp); } break;
case 27:
#line 204 "web2c.yacc"
{ indent_line(); } break;
case 30:
#line 212 "web2c.yacc"
{ new_line(); my_output("#define"); } break;
case 31:
#line 214 "web2c.yacc"
{ ii=add_to_table(last_id);
sym_table[ii].typ = const_id_tok;
my_output(last_id);
} break;
case 32:
#line 219 "web2c.yacc"
{ sym_table[ii].val=last_i_num;
new_line(); } break;
case 33:
#line 224 "web2c.yacc"
{
(void) sscanf(temp, "%ld", &last_i_num);
if (my_labs((long) last_i_num) > 32767)
(void) strcat(temp, "L");
my_output(temp);
yyval = ex_32;
} break;
case 34:
#line 232 "web2c.yacc"
{ my_output(temp);
yyval = ex_real;
} break;
case 35:
#line 236 "web2c.yacc"
{ yyval = 0; } break;
case 36:
#line 238 "web2c.yacc"
{ yyval = ex_32; } break;
case 37:
#line 242 "web2c.yacc"
{ int i, j; char s[132];
j = 1;
s[0] = '"';
for (i=1; yytext[i-1]!=0; i++) {
if (yytext[i] == '\\' || yytext[i] == '"')
s[j++]='\\';
else if (yytext[i] == '\'') i++;
s[j++] = yytext[i];
}
s[j-1] = '"';
s[j] = 0;
my_output(s);
} break;
case 38:
#line 256 "web2c.yacc"
{ char s[5];
s[0]='\'';
if (yytext[1] == '\\' || yytext[1] == '\'') {
s[2] = yytext[1];
s[1] = '\\';
s[3] = '\'';
s[4] = '\0';
}
else {
s[1] = yytext[1];
s[2]='\'';
s[3]='\0';
}
my_output(s);
} break;
case 39:
#line 274 "web2c.yacc"
{ my_output(last_id); } break;
case 44:
#line 286 "web2c.yacc"
{ my_output("typedef"); } break;
case 45:
#line 288 "web2c.yacc"
{ ii = add_to_table(last_id);
sym_table[ii].typ = type_id_tok;
(void) strcpy(safe_string, last_id);
last_type = ii;
} break;
case 46:
#line 294 "web2c.yacc"
{
array_bounds[0] = 0;
array_offset[0] = 0;
} break;
case 47:
#line 299 "web2c.yacc"
{ if (*array_offset) {
fprintf(stderr, "Cannot typedef arrays with offsets\n");
exit(1);
}
my_output(safe_string);
my_output(array_bounds);
semicolon();
last_type = -1;
} break;
case 50:
#line 315 "web2c.yacc"
{ if (last_type >= 0) {
sym_table[ii].val = lower_bound;
sym_table[ii].val_sym = lower_sym;
sym_table[ii].upper = upper_bound;
sym_table[ii].upper_sym = upper_sym;
ii= -1;
}
/* The following code says: if the bounds are known at translation time
* on an integral type, then we select the smallest type of data which
* can represent it in ANSI C. We only use unsigned types when necessary.
*/
if (lower_sym == -1 && upper_sym == -1) {
if (lower_bound>= -127 && upper_bound<=127)
my_output("schar");
else if (lower_bound >= 0
&& upper_bound <= 255)
my_output("unsigned char");
else if (lower_bound >= -32767
&& upper_bound <= 32767)
my_output("short");
else if (lower_bound >= 0
&& upper_bound <= 65535)
my_output(UNSIGNED_SHORT_STRING);
else my_output("integer");
}
else my_output("integer");
} break;
case 55:
#line 353 "web2c.yacc"
{lower_bound = upper_bound;
lower_sym = upper_sym;
(void) sscanf(temp, "%ld", &upper_bound);
upper_sym = -1; /* no sym table entry */
} break;
case 56:
#line 359 "web2c.yacc"
{ lower_bound = upper_bound;
lower_sym = upper_sym;
upper_bound = sym_table[l_s].val;
upper_sym = l_s;
} break;
case 57:
#line 367 "web2c.yacc"
{if (last_type >= 0) {
sym_table[last_type].var_not_needed = sym_table[l_s].var_not_needed;
sym_table[last_type].upper = sym_table[l_s].upper;
sym_table[last_type].upper_sym = sym_table[l_s].upper_sym;
sym_table[last_type].val = sym_table[l_s].val;
sym_table[last_type].val_sym = sym_table[l_s].val_sym;
}
my_output(last_id); } break;
case 58:
#line 379 "web2c.yacc"
{ if (last_type >= 0)
sym_table[last_type].var_not_needed = true;
} break;
case 60:
#line 384 "web2c.yacc"
{ if (last_type >= 0)
sym_table[last_type].var_not_needed = true;
} break;
case 61:
#line 388 "web2c.yacc"
{ if (last_type >= 0)
sym_table[last_type].var_not_needed = true;
} break;
case 62:
#line 394 "web2c.yacc"
{if (last_type >= 0) {
sym_table[last_type].var_not_needed = sym_table[l_s].var_not_needed;
sym_table[last_type].upper = sym_table[l_s].upper;
sym_table[last_type].upper_sym = sym_table[l_s].upper_sym;
sym_table[last_type].val = sym_table[l_s].val;
sym_table[last_type].val_sym = sym_table[l_s].val_sym;
}
my_output(last_id); my_output("*"); } break;
case 65:
#line 410 "web2c.yacc"
{ compute_array_bounds(); } break;
case 66:
#line 412 "web2c.yacc"
{ lower_bound = sym_table[l_s].val;
lower_sym = sym_table[l_s].val_sym;
upper_bound = sym_table[l_s].upper;
upper_sym = sym_table[l_s].upper_sym;
compute_array_bounds();
} break;
case 68:
#line 425 "web2c.yacc"
{ my_output("struct"); my_output("{"); indent++;} break;
case 69:
#line 427 "web2c.yacc"
{ indent--; my_output("}"); semicolon(); } break;
case 72:
#line 435 "web2c.yacc"
{ field_list[0] = 0; } break;
case 73:
#line 437 "web2c.yacc"
{
/*array_bounds[0] = 0;
array_offset[0] = 0;*/
} break;
case 74:
#line 442 "web2c.yacc"
{ int i=0, j; char ltemp[80];
while(field_list[i++] == '!') {
j = 0;
while (field_list[i])
ltemp[j++] = field_list[i++];
i++;
if (field_list[i] == '!')
ltemp[j++] = ',';
ltemp[j] = 0;
my_output(ltemp);
}
semicolon();
} break;
case 78:
#line 463 "web2c.yacc"
{ int i=0, j=0;
while (field_list[i] == '!')
while(field_list[i++]);
ii = add_to_table(last_id);
sym_table[ii].typ = field_id_tok;
field_list[i++] = '!';
while (last_id[j])
field_list[i++] = last_id[j++];
field_list[i++] = 0;
field_list[i++] = 0;
} break;
case 79:
#line 475 "web2c.yacc"
{ int i=0, j=0;
while (field_list[i] == '!')
while(field_list[i++]);
field_list[i++] = '!';
while (last_id[j])
field_list[i++] = last_id[j++];
field_list[i++] = 0;
field_list[i++] = 0;
} break;
case 80:
#line 487 "web2c.yacc"
{ my_output("file_ptr /* of "); } break;
case 81:
#line 489 "web2c.yacc"
{ my_output("*/"); } break;
case 86:
#line 501 "web2c.yacc"
{ var_list[0] = 0;
array_bounds[0] = 0;
array_offset[0] = 0;
var_formals = false;
ids_paramed = 0;
} break;
case 87:
#line 508 "web2c.yacc"
{
array_bounds[0] = 0;
array_offset[0] = 0;
} break;
case 88:
#line 513 "web2c.yacc"
{ fixup_var_list(); } break;
case 91:
#line 521 "web2c.yacc"
{ int i=0, j=0;
ii = add_to_table(last_id);
sym_table[ii].typ = var_id_tok;
sym_table[ii].var_formal = var_formals;
param_id_list[ids_paramed++] = ii;
while (var_list[i] == '!')
while(var_list[i++]);
var_list[i++] = '!';
while (last_id[j])
var_list[i++] = last_id[j++];
var_list[i++] = 0;
var_list[i++] = 0;
} break;
case 92:
#line 535 "web2c.yacc"
{ int i=0, j=0;
ii = add_to_table(last_id);
sym_table[ii].typ = var_id_tok;
sym_table[ii].var_formal = var_formals;
param_id_list[ids_paramed++] = ii;
while (var_list[i] == '!')
while (var_list[i++]);
var_list[i++] = '!';
while (last_id[j])
var_list[i++] = last_id[j++];
var_list[i++] = 0;
var_list[i++] = 0;
} break;
case 93:
#line 549 "web2c.yacc"
{ int i=0, j=0;
ii = add_to_table(last_id);
sym_table[ii].typ = var_id_tok;
sym_table[ii].var_formal = var_formals;
param_id_list[ids_paramed++] = ii;
while (var_list[i] == '!')
while(var_list[i++]);
var_list[i++] = '!';
while (last_id[j])
var_list[i++] = last_id[j++];
var_list[i++] = 0;
var_list[i++] = 0;
} break;
case 95:
#line 567 "web2c.yacc"
{ my_output ("void main_body() {");
indent++;
new_line ();
} break;
case 96:
#line 572 "web2c.yacc"
{ indent--;
my_output ("}");
new_line ();
} break;
case 100:
#line 584 "web2c.yacc"
{ indent_line(); remove_locals(); } break;
case 101:
#line 586 "web2c.yacc"
{ indent_line(); remove_locals(); } break;
case 103:
#line 594 "web2c.yacc"
{ ii = add_to_table(last_id);
if (debug)
(void) fprintf(stderr, "%3d Procedure %s\n",
pf_count++, last_id);
sym_table[ii].typ = proc_id_tok;
(void) strcpy(my_routine, last_id);
uses_eqtb = uses_mem = false;
my_output("void");
orig_std = std;
std = 0;
} break;
case 104:
#line 606 "web2c.yacc"
{ (void) strcpy(fn_return_type, "void");
do_proc_args();
gen_function_head();} break;
case 105:
#line 610 "web2c.yacc"
{ ii = l_s;
if (debug)
(void) fprintf(stderr, "%3d Procedure %s\n",
pf_count++, last_id);
(void) strcpy(my_routine, last_id);
my_output("void");
} break;
case 106:
#line 618 "web2c.yacc"
{ (void) strcpy(fn_return_type, "void");
do_proc_args();
gen_function_head();
} break;
case 107:
#line 626 "web2c.yacc"
{
(void) strcpy (z_id, last_id);
mark ();
ids_paramed = 0;
} break;
case 108:
#line 632 "web2c.yacc"
{ sprintf (z_id, "z%s", last_id);
ids_paramed = 0;
if (sym_table[ii].typ == proc_id_tok)
sym_table[ii].typ = proc_param_tok;
else if (sym_table[ii].typ == fun_id_tok)
sym_table[ii].typ = fun_param_tok;
mark();
} break;
case 112:
#line 648 "web2c.yacc"
{ ids_typed = ids_paramed;} break;
case 113:
#line 650 "web2c.yacc"
{ int i, need_var;
i = search_table(last_id);
need_var = !sym_table[i].var_not_needed;
for (i=ids_typed; i<ids_paramed; i++)
{
(void) strcpy(arg_type[i], last_id);
if (need_var && sym_table[param_id_list[i]].var_formal)
(void) strcat(arg_type[i], " *");
else
sym_table[param_id_list[i]].var_formal = false;
}
} break;
case 114:
#line 664 "web2c.yacc"
{var_formals = 0;} break;
case 116:
#line 665 "web2c.yacc"
{var_formals = 1;} break;
case 121:
#line 676 "web2c.yacc"
{ orig_std = std;
std = 0;
ii = add_to_table(last_id);
if (debug)
(void) fprintf(stderr, "%3d Function %s\n",
pf_count++, last_id);
sym_table[ii].typ = fun_id_tok;
(void) strcpy(my_routine, last_id);
uses_eqtb = uses_mem = false;
} break;
case 122:
#line 687 "web2c.yacc"
{ normal();
array_bounds[0] = 0;
array_offset[0] = 0;
} break;
case 123:
#line 692 "web2c.yacc"
{(void) strcpy(fn_return_type, yytext);
do_proc_args();
gen_function_head();
} break;
case 125:
#line 699 "web2c.yacc"
{ orig_std = std;
std = 0;
ii = l_s;
if (debug)
(void) fprintf(stderr, "%3d Function %s\n",
pf_count++, last_id);
(void) strcpy(my_routine, last_id);
uses_eqtb = uses_mem = false;
} break;
case 126:
#line 709 "web2c.yacc"
{ normal();
array_bounds[0] = 0;
array_offset[0] = 0;
} break;
case 127:
#line 714 "web2c.yacc"
{(void) strcpy(fn_return_type, yytext);
do_proc_args();
gen_function_head();
} break;
case 133:
#line 732 "web2c.yacc"
{my_output("{"); indent++; new_line();} break;
case 134:
#line 734 "web2c.yacc"
{ indent--; my_output("}"); new_line(); } break;
case 139:
#line 747 "web2c.yacc"
{if (!doreturn(temp)) {
(void) sprintf(safe_string, "lab%s:",
temp);
my_output(safe_string);
}
} break;
case 140:
#line 756 "web2c.yacc"
{ semicolon(); } break;
case 141:
#line 758 "web2c.yacc"
{ semicolon(); } break;
case 146:
#line 766 "web2c.yacc"
{my_output("break");} break;
case 147:
#line 770 "web2c.yacc"
{ my_output("="); } break;
case 149:
#line 773 "web2c.yacc"
{ my_output("Result ="); } break;
case 151:
#line 778 "web2c.yacc"
{ if (strcmp(last_id, "mem") == 0)
uses_mem = 1;
else if (strcmp(last_id, "eqtb") == 0)
uses_eqtb = 1;
if (sym_table[l_s].var_formal)
(void) putchar('*');
my_output(last_id);
yyval = ex_32;
} break;
case 153:
#line 789 "web2c.yacc"
{ if (sym_table[l_s].var_formal)
(void) putchar('*');
my_output(last_id); yyval = ex_32; } break;
case 154:
#line 795 "web2c.yacc"
{ yyval = ex_32; } break;
case 155:
#line 797 "web2c.yacc"
{ yyval = ex_32; } break;
case 158:
#line 805 "web2c.yacc"
{ my_output("["); } break;
case 159:
#line 807 "web2c.yacc"
{ my_output("]"); } break;
case 160:
#line 809 "web2c.yacc"
{if (tex || mf) {
if (strcmp(last_id, "int")==0)
my_output(".cint");
else if (strcmp(last_id, "lh")==0)
my_output(".v.LH");
else if (strcmp(last_id, "rh")==0)
my_output(".v.RH");
else {
(void)sprintf(safe_string, ".%s", last_id);
my_output(safe_string);
}
}
else {
(void) sprintf(safe_string, ".%s", last_id);
my_output(safe_string);
}
} break;
case 161:
#line 827 "web2c.yacc"
{ my_output(".hh.b0");} break;
case 162:
#line 829 "web2c.yacc"
{ my_output(".hh.b1");} break;
case 164:
#line 834 "web2c.yacc"
{ my_output("][");} break;
case 166:
#line 839 "web2c.yacc"
{ yyval = yypt[-0].yyv; } break;
case 167:
#line 840 "web2c.yacc"
{my_output("+");} break;
case 168:
#line 841 "web2c.yacc"
{yyval = max(yypt[-3].yyv, yypt[-0].yyv);} break;
case 169:
#line 842 "web2c.yacc"
{my_output("-");} break;
case 170:
#line 843 "web2c.yacc"
{yyval = max(yypt[-3].yyv, yypt[-0].yyv);} break;
case 171:
#line 844 "web2c.yacc"
{my_output("*");} break;
case 172:
#line 845 "web2c.yacc"
{yyval = max(yypt[-3].yyv, yypt[-0].yyv);} break;
case 173:
#line 846 "web2c.yacc"
{my_output("/");} break;
case 174:
#line 847 "web2c.yacc"
{yyval = max(yypt[-3].yyv, yypt[-0].yyv);} break;
case 175:
#line 848 "web2c.yacc"
{my_output("==");} break;
case 176:
#line 849 "web2c.yacc"
{yyval = max(yypt[-3].yyv, yypt[-0].yyv);} break;
case 177:
#line 850 "web2c.yacc"
{my_output("!=");} break;
case 178:
#line 851 "web2c.yacc"
{yyval = max(yypt[-3].yyv, yypt[-0].yyv);} break;
case 179:
#line 852 "web2c.yacc"
{my_output("%");} break;
case 180:
#line 853 "web2c.yacc"
{yyval = max(yypt[-3].yyv, yypt[-0].yyv);} break;
case 181:
#line 854 "web2c.yacc"
{my_output("<");} break;
case 182:
#line 855 "web2c.yacc"
{yyval = max(yypt[-3].yyv, yypt[-0].yyv);} break;
case 183:
#line 856 "web2c.yacc"
{my_output(">");} break;
case 184:
#line 857 "web2c.yacc"
{yyval = max(yypt[-3].yyv, yypt[-0].yyv);} break;
case 185:
#line 858 "web2c.yacc"
{my_output("<=");} break;
case 186:
#line 859 "web2c.yacc"
{yyval = max(yypt[-3].yyv, yypt[-0].yyv);} break;
case 187:
#line 860 "web2c.yacc"
{my_output(">=");} break;
case 188:
#line 861 "web2c.yacc"
{yyval = max(yypt[-3].yyv, yypt[-0].yyv);} break;
case 189:
#line 862 "web2c.yacc"
{my_output("&&");} break;
case 190:
#line 863 "web2c.yacc"
{yyval = max(yypt[-3].yyv, yypt[-0].yyv);} break;
case 191:
#line 864 "web2c.yacc"
{my_output("||");} break;
case 192:
#line 865 "web2c.yacc"
{yyval = max(yypt[-3].yyv, yypt[-0].yyv);} break;
case 193:
#line 867 "web2c.yacc"
{ my_output("/ ((double)"); } break;
case 194:
#line 869 "web2c.yacc"
{yyval = max(yypt[-3].yyv, yypt[-0].yyv); my_output(")"); } break;
case 195:
#line 871 "web2c.yacc"
{ yyval = yypt[-0].yyv; } break;
case 197:
#line 876 "web2c.yacc"
{ my_output("- (integer)"); } break;
case 198:
#line 878 "web2c.yacc"
{ my_output("!"); } break;
case 199:
#line 882 "web2c.yacc"
{ my_output("("); } break;
case 200:
#line 884 "web2c.yacc"
{ my_output(")"); yyval = yypt[-3].yyv; } break;
case 203:
#line 888 "web2c.yacc"
{ my_output(last_id); my_output("()"); } break;
case 204:
#line 890 "web2c.yacc"
{ my_output(last_id); } break;
case 206:
#line 895 "web2c.yacc"
{ my_output("("); } break;
case 207:
#line 897 "web2c.yacc"
{ my_output(")"); } break;
case 209:
#line 902 "web2c.yacc"
{ my_output(","); } break;
case 214:
#line 915 "web2c.yacc"
{ my_output(last_id); my_output("()"); } break;
case 215:
#line 917 "web2c.yacc"
{ my_output(last_id);
ii = add_to_table(last_id);
sym_table[ii].typ = proc_id_tok;
my_output("()");
} break;
case 216:
#line 923 "web2c.yacc"
{ my_output(last_id); } break;
case 218:
#line 928 "web2c.yacc"
{if (doreturn(temp)) {
if (strcmp(fn_return_type,"void"))
my_output("return(Result)");
else
my_output("return");
} else {
(void) sprintf(safe_string, "goto lab%s",
temp);
my_output(safe_string);
}
} break;
case 227:
#line 958 "web2c.yacc"
{ my_output("if"); my_output("("); } break;
case 228:
#line 960 "web2c.yacc"
{ my_output(")"); new_line();} break;
case 230:
#line 965 "web2c.yacc"
{ my_output("else"); } break;
case 232:
#line 970 "web2c.yacc"
{ my_output("switch"); my_output("("); } break;
case 233:
#line 972 "web2c.yacc"
{ my_output(")"); indent_line();
my_output("{"); indent++;
} break;
case 234:
#line 976 "web2c.yacc"
{ indent--; my_output("}"); new_line(); } break;
case 237:
#line 984 "web2c.yacc"
{ my_output("break"); semicolon(); } break;
case 240:
#line 992 "web2c.yacc"
{ my_output("case");
my_output(temp);
my_output(":"); indent_line();
} break;
case 241:
#line 997 "web2c.yacc"
{ my_output("default:"); indent_line(); } break;
case 247:
#line 1010 "web2c.yacc"
{ my_output("while");
my_output("(");
} break;
case 248:
#line 1014 "web2c.yacc"
{ my_output(")"); } break;
case 250:
#line 1019 "web2c.yacc"
{ my_output("do"); my_output("{"); indent++; } break;
case 251:
#line 1021 "web2c.yacc"
{ indent--; my_output("}");
my_output("while"); my_output("( ! (");
} break;
case 252:
#line 1025 "web2c.yacc"
{ my_output(") )"); } break;
case 253:
#line 1029 "web2c.yacc"
{
my_output("{");
my_output("register");
my_output("integer");
if (strict_for)
my_output("for_begin,");
my_output("for_end;");
} break;
case 254:
#line 1038 "web2c.yacc"
{ if (strict_for)
my_output("for_begin");
else
my_output(control_var);
my_output("="); } break;
case 255:
#line 1044 "web2c.yacc"
{ my_output("; if (");
if (strict_for) my_output("for_begin");
else my_output(control_var);
my_output(relation);
my_output("for_end)");
if (strict_for) {
my_output("{");
my_output(control_var);
my_output("=");
my_output("for_begin");
semicolon();
}
my_output("do");
indent++;
new_line();} break;
case 256:
#line 1060 "web2c.yacc"
{
char *top = strrchr (for_stack, '#');
indent--;
new_line();
my_output("while");
my_output("(");
my_output(top+1);
my_output(")");
my_output(";");
my_output("}");
if (strict_for)
my_output("}");
*top=0;
new_line();
} break;
case 257:
#line 1078 "web2c.yacc"
{(void) strcpy(control_var, last_id); } break;
case 258:
#line 1082 "web2c.yacc"
{ my_output(";"); } break;
case 259:
#line 1084 "web2c.yacc"
{
(void) strcpy(relation, "<=");
my_output("for_end");
my_output("="); } break;
case 260:
#line 1089 "web2c.yacc"
{
(void) sprintf(for_stack + strlen(for_stack),
"#%s++ < for_end", control_var);
} break;
case 261:
#line 1094 "web2c.yacc"
{ my_output(";"); } break;
case 262:
#line 1096 "web2c.yacc"
{
(void) strcpy(relation, ">=");
my_output("for_end");
my_output("="); } break;
case 263:
#line 1101 "web2c.yacc"
{
(void) sprintf(for_stack + strlen(for_stack),
"#%s-- > for_end", control_var);
} break;
}
goto yystack; /* stack new state and value */
}
| 26.677049 | 76 | 0.552101 |
d302248603f1d6dd81d76207d4a7a8039bff0201 | 878 | lua | Lua | applications/luci-app-beardropper/luasrc/controller/beardropper.lua | QiuSimons/luci-1 | b6608a0cda0dcf883f2845df0677cc69c2c6ceab | [
"Apache-2.0"
] | 42 | 2021-04-11T13:37:44.000Z | 2022-03-14T16:00:13.000Z | applications/luci-app-beardropper/luasrc/controller/beardropper.lua | QiuSimons/luci-1 | b6608a0cda0dcf883f2845df0677cc69c2c6ceab | [
"Apache-2.0"
] | 52 | 2021-04-13T04:17:02.000Z | 2022-03-12T15:05:14.000Z | applications/luci-app-beardropper/luasrc/controller/beardropper.lua | QiuSimons/luci-1 | b6608a0cda0dcf883f2845df0677cc69c2c6ceab | [
"Apache-2.0"
] | 109 | 2021-04-01T09:13:05.000Z | 2022-03-31T17:33:13.000Z | module("luci.controller.beardropper", package.seeall)
function index()
if not nixio.fs.access("/etc/config/beardropper") then
return
end
local page = entry({"admin", "services", "beardropper"}, alias("admin", "services", "beardropper", "setting"),_("BearDropper"))
page.order = 20
page.dependent = true
page.acl_depends = { "luci-app-beardropper" }
entry({"admin", "services", "beardropper", "status"}, call("act_status"))
entry({"admin", "services", "beardropper", "setting"}, cbi("beardropper/setting"), _("Setting"), 30).leaf= true
entry({"admin", "services", "beardropper", "log"}, form("beardropper/log"),_("Log"), 40).leaf= true
--entry:
end
function act_status()
local e={}
e.running = luci.sys.call("pgrep -f /usr/sbin/beardropper >/dev/null")==0
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end | 39.909091 | 131 | 0.667426 |
307c1df37c99c995ce25955a63be46ff565db883 | 1,131 | htm | HTML | konten/Daftar Lagu Coldplay Terbaik, Enak Didengar, dan Populer - Zonanesia_files/daftar-lagu-coldplay-terbaik-enak_002.htm | hadypriyono1/TKPPLBespoke-bug1 | 8685ecfae462c91bf351a86d336f99c0ba345aa7 | [
"CC-BY-3.0"
] | null | null | null | konten/Daftar Lagu Coldplay Terbaik, Enak Didengar, dan Populer - Zonanesia_files/daftar-lagu-coldplay-terbaik-enak_002.htm | hadypriyono1/TKPPLBespoke-bug1 | 8685ecfae462c91bf351a86d336f99c0ba345aa7 | [
"CC-BY-3.0"
] | null | null | null | konten/Daftar Lagu Coldplay Terbaik, Enak Didengar, dan Populer - Zonanesia_files/daftar-lagu-coldplay-terbaik-enak_002.htm | hadypriyono1/TKPPLBespoke-bug1 | 8685ecfae462c91bf351a86d336f99c0ba345aa7 | [
"CC-BY-3.0"
] | null | null | null | <!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"></head><body><script src="daftar-lagu-coldplay-terbaik-enak_data_002/expansion_embed.js"></script><script>google_ad_slot="5150221435";google_ad_client="ca-pub-4559298072630269";google_adsbygoogle_status="done";google_ad_width=336;google_ad_height=280;google_ad_modifications={"plle":true,"eids":["10573696"],"loeids":[]};google_loader_used="aa";google_reactive_tag_first=false;google_active_plles=[];google_ad_format="336x280";google_ad_unit_key="2084231349";google_show_ads_impl=true;google_unique_id=2;google_async_iframe_id="aswift_1";google_start_time=1464177942081;google_bpp=9;google_async_rrc=0;google_iframe_start_time=new Date().getTime();</script><script src="daftar-lagu-coldplay-terbaik-enak_data_002/show_ads_impl.js"></script><iframe id="google_ads_frame2" name="google_ads_frame2" src="daftar-lagu-coldplay-terbaik-enak_data_002/ads.htm" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no" allowfullscreen="true" frameborder="0" height="280" width="336"></iframe></body></html> | 377 | 1,102 | 0.809903 |
5f391f9e4fca9818eb2d3d3716e1b645e96c8da2 | 2,964 | kt | Kotlin | app/src/main/java/com/chepsi/callbackdemo/NetworkMonitor.kt | bebop-001/CheckNetworkConnectivity | f9a7adb0e06cc340c38979e5dbe5b045b1499cc8 | [
"Apache-2.0"
] | 1 | 2021-03-19T07:16:08.000Z | 2021-03-19T07:16:08.000Z | app/src/main/java/com/chepsi/callbackdemo/NetworkMonitor.kt | bebop-001/CheckNetworkConnectivity | f9a7adb0e06cc340c38979e5dbe5b045b1499cc8 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/chepsi/callbackdemo/NetworkMonitor.kt | bebop-001/CheckNetworkConnectivity | f9a7adb0e06cc340c38979e5dbe5b045b1499cc8 | [
"Apache-2.0"
] | null | null | null | package com.chepsi.callbackdemo
import android.app.Application
import android.content.Context
import android.net.ConnectivityManager
import android.net.Network
import android.net.NetworkInfo
import android.net.NetworkRequest
import android.os.Build
import androidx.annotation.RequiresPermission
class NetworkMonitor
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
constructor(private val application: Application) {
fun startNetworkCallback() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
val cm: ConnectivityManager =
application.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
val builder: NetworkRequest.Builder = NetworkRequest.Builder()
/**Check if version code is greater than API 24*/
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
cm.registerDefaultNetworkCallback(
networkCallback
as ConnectivityManager.NetworkCallback
)
} else {
cm.registerNetworkCallback(
builder.build(),
networkCallback as ConnectivityManager.NetworkCallback
)
}
}
}
fun stopNetworkCallback() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
val cm: ConnectivityManager =
application.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
cm.unregisterNetworkCallback(ConnectivityManager.NetworkCallback())
}
}
companion object {
// for polling by older versions of android.
fun checkNetworkConnection(application: Application): Boolean {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
val connectivityManager = application.getSystemService(Context.CONNECTIVITY_SERVICE)
GlobalVariables.isNetworkConnected =
if (connectivityManager is ConnectivityManager) {
val networkInfo: NetworkInfo? = connectivityManager.activeNetworkInfo
networkInfo?.isConnected ?: false
} else false
}
return GlobalVariables.isNetworkConnected
}
}
private var networkCallback:Any? = null
init {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// install callback for newer versions of android.
networkCallback = object : ConnectivityManager.NetworkCallback() {
override fun onAvailable(network: Network) {
GlobalVariables.isNetworkConnected = true
}
override fun onLost(network: Network) {
GlobalVariables.isNetworkConnected = false
}
}
}
else checkNetworkConnection(application)
}
} | 38 | 100 | 0.633941 |
f1c251b47aae40265df069488983dadaa24fb483 | 1,471 | swift | Swift | Swift/Struct/data-Base-exercises/data-Base-exercisesTests/ExpresstionTests.swift | sky15179/Language | 85e84b3e99c47a01c51e44f1f191c306b4328c82 | [
"MIT"
] | null | null | null | Swift/Struct/data-Base-exercises/data-Base-exercisesTests/ExpresstionTests.swift | sky15179/Language | 85e84b3e99c47a01c51e44f1f191c306b4328c82 | [
"MIT"
] | null | null | null | Swift/Struct/data-Base-exercises/data-Base-exercisesTests/ExpresstionTests.swift | sky15179/Language | 85e84b3e99c47a01c51e44f1f191c306b4328c82 | [
"MIT"
] | null | null | null | //
// ExpresstionTests.swift
// data-Base-exercises
//
// Created by ็ๆบๅ on 2017/6/30.
// Copyright ยฉ 2017ๅนด ็ๆบๅ. All rights reserved.
//
import XCTest
class ExpresstionTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
let result = expression.run("2*3+4*6/2-10")
XCTAssert(result?.0 == 8)
let result1 = myExpression.intParser.run("1")
let expressions: [myExpression] = [
// (1+2)*3
.infix(.infix(.int(1), "+", .int(2)), "*", .int(3)),
// A0*3
.infix(.reference("A", 0), "*", .int(3)),
// SUM(A0:A1)
.function("SUM", .infix(.reference("A", 0), ":", .reference("A", 1)))
]
evaluate(expressions: expressions)
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
| 28.843137 | 111 | 0.558804 |
36ccf6e863325e9b2bc459db91c7fa935e7492b6 | 228 | dart | Dart | lib/src/providers/apple_provider.dart | mvitolo/firebase_auth_ui | 3bc0bee8371c8c54b8a70ea894fc7b55ac0e4e87 | [
"BSD-3-Clause"
] | null | null | null | lib/src/providers/apple_provider.dart | mvitolo/firebase_auth_ui | 3bc0bee8371c8c54b8a70ea894fc7b55ac0e4e87 | [
"BSD-3-Clause"
] | null | null | null | lib/src/providers/apple_provider.dart | mvitolo/firebase_auth_ui | 3bc0bee8371c8c54b8a70ea894fc7b55ac0e4e87 | [
"BSD-3-Clause"
] | null | null | null | import '../../providers.dart';
class AppleProvider extends AuthProvider {
AppleProvider() : super(providerId: "apple");
@override
Map<String, dynamic> getMap() {
return {
'providerId': providerId,
};
}
}
| 17.538462 | 47 | 0.635965 |
ae465ee66ba6ae99233bc57b9446468a28ddf3a9 | 294 | sql | SQL | db/seeds.sql | b-e-christensen/employee-tracker | 07b76419c635d79b6b685f0ec33c555af4cf1efe | [
"MIT"
] | null | null | null | db/seeds.sql | b-e-christensen/employee-tracker | 07b76419c635d79b6b685f0ec33c555af4cf1efe | [
"MIT"
] | null | null | null | db/seeds.sql | b-e-christensen/employee-tracker | 07b76419c635d79b6b685f0ec33c555af4cf1efe | [
"MIT"
] | null | null | null | INSERT INTO departments (name)
VALUES ("Development");
INSERT INTO roles (title, salary, department_id)
VALUES ("Junior Dev", 58000, 1),
("Senior Dev", 88000, 1);
INSERT INTO employees (first_name, last_name, role_id, manager_id)
VALUES ("Billy", "Bob", 1, 2),
("Average", "Joe", 2, NULL);
| 22.615385 | 66 | 0.690476 |
1649785cd5f01e268b935bcaaaa08470f9ffc3a9 | 2,685 | c | C | d/tharis/Tharis/market.c | Dbevan/SunderingShadows | 6c15ec56cef43c36361899bae6dc08d0ee907304 | [
"MIT"
] | 13 | 2019-07-19T05:24:44.000Z | 2021-11-18T04:08:19.000Z | d/tharis/Tharis/market.c | Dbevan/SunderingShadows | 6c15ec56cef43c36361899bae6dc08d0ee907304 | [
"MIT"
] | 4 | 2021-03-15T18:56:39.000Z | 2021-08-17T17:08:22.000Z | d/tharis/Tharis/market.c | Dbevan/SunderingShadows | 6c15ec56cef43c36361899bae6dc08d0ee907304 | [
"MIT"
] | 13 | 2019-09-12T06:22:38.000Z | 2022-01-31T01:15:12.000Z |
// /market.c//
#include <std.h>
#include "../tharis.h"
#include <daemons.h>
inherit VAULT;
int count;
void create() {
::create();
set_terrain(CITY);
set_travel(PAVED_ROAD);
}
void reset(){
int num;
int number;
object ob;
int x;
string time;
::reset();
if(!present("citizen")){
num = random(5);
for(x = 1; x <= num;x++){
number = random(10);
switch (number){
case 0: break;
case 1:
case 2:
case 3:
case 4:
case 5:
new("d/tharis/monsters/citizen")->move(TO);
break;
case 6:
case 7:
case 8:
new("d/tharis/monsters/patrol")->move(TO);
break;
case 9:
new("d/tharis/monsters/thief")->move(TO);
break;
}
}
}
if(!present("vendor")){
time = EVENTS_D->query_time_of_day();
if(time!="night"){
number = random(10);
switch (number){
case 0:
case 1:
new("/d/tharis/monsters/tb_vendor")->move(TO);
break;
case 2:
case 3:
new("/d/tharis/monsters/cl_vendor")->move(TO);
break;
case 4:
case 5:
case 6:
new("/d/tharis/monsters/f_vendor")->move(TO);
break;
case 7:
new("/d/tharis/monsters/perfume")->move(TO);
break;
case 8:
new("/d/tharis/monsters/ring")->move(TO);
break;
case 9:
new("/d/tharis/monsters/scribe")->move(TO);
break;
}
}
}
if(!present("street_light",TO))
new("/d/tharis/obj/street_light")->move(TO);
}
/*
//This query weather is for a plot. Remove when no longer needed.
//~Circe~ 7/15/08
query_weather() { return "%^BOLD%^%^BLACK%^Stormclouds %^CYAN%^roll in the %^BLUE%^sky%^CYAN%^, shedding a steady downpour of %^BLUE%^rain%^CYAN%^.%^RESET%^"; }
*/ | 28.870968 | 160 | 0.356797 |
d2551b721de75c91b9a14e407f9bf499ad72101d | 1,664 | php | PHP | application/views/masters/product_tab/product_tab_add.php | sutouch08/wms | 42d4b3fc459837ecd9d0ca0c32a0043061b3511f | [
"MIT"
] | null | null | null | application/views/masters/product_tab/product_tab_add.php | sutouch08/wms | 42d4b3fc459837ecd9d0ca0c32a0043061b3511f | [
"MIT"
] | null | null | null | application/views/masters/product_tab/product_tab_add.php | sutouch08/wms | 42d4b3fc459837ecd9d0ca0c32a0043061b3511f | [
"MIT"
] | null | null | null | <?php $this->load->view('include/header'); ?>
<div class="row">
<div class="col-sm-6">
<h3 class="title"><?php echo $this->title; ?></h3>
</div>
<div class="col-sm-6">
<p class="pull-right top-p">
<button type="button" class="btn btn-sm btn-warning" onclick="goBack()"><i class="fa fa-arrow-left"></i> เธเธฅเธฑเธ</button>
</p>
</div>
</div><!-- End Row -->
<hr class=""/>
<style>
.lbl::before {
margin-right:10px !important;
}
</style>
<form id="addForm" method="post" action="<?php echo $this->home; ?>/add">
<div class="row">
<div class="col-sm-12">
<div class="form-group">
<label class="col-sm-2 control-label no-padding-right text-right">เธเธทเนเธญเนเธเธ</label>
<div class="col-sm-4">
<input type="text" class="form-control input-sm" name="tab_name" id="tab_name" required>
</div>
</div>
</div>
<div class="col-sm-12">
<div class="form-group">
<label class="col-sm-2 control-label no-padding-right text-right">เนเธเธเธซเธฅเธฑเธ</label>
<div class="col-xs-12 col-sm-reset">
<?php echo getTabsTree(); ?>
</div>
</div>
</div>
<div class="col-sm-12 text-center">
<div class="form-group">
<label class="col-sm-2 control-label no-padding-right"> </label>
<div class="col-sm-4 text-right">
<?php if($this->pm->can_add) : ?>
<button type="submit" class="btn btn-sm btn-success"><i class="fa fa-save"></i> เธเธฑเธเธเธถเธ</button>
<?php endif; ?>
</div>
</div>
</div>
</div>
</form>
<script src="<?php echo base_url(); ?>scripts/masters/product_tab.js"></script>
<?php $this->load->view('include/footer'); ?>
| 29.714286 | 126 | 0.574519 |
a4a096baf5f7f88e0fa1683d58121472b6286f31 | 492 | kt | Kotlin | mastodonk-core/src/commonMain/kotlin/fr/outadoc/mastodonk/api/endpoint/statuses/PollsApi.kt | outadoc/mastodonk | 0dff922e6077184f4d9fcefb9f5204fac6b3bdfd | [
"Apache-2.0"
] | 4 | 2021-04-26T20:12:35.000Z | 2021-12-13T11:17:10.000Z | mastodonk-core/src/commonMain/kotlin/fr/outadoc/mastodonk/api/endpoint/statuses/PollsApi.kt | outadoc/mastodonk | 0dff922e6077184f4d9fcefb9f5204fac6b3bdfd | [
"Apache-2.0"
] | 11 | 2021-04-26T07:21:45.000Z | 2021-05-16T19:54:53.000Z | mastodonk-core/src/commonMain/kotlin/fr/outadoc/mastodonk/api/endpoint/statuses/PollsApi.kt | outadoc/mastodonk | 0dff922e6077184f4d9fcefb9f5204fac6b3bdfd | [
"Apache-2.0"
] | null | null | null | package fr.outadoc.mastodonk.api.endpoint.statuses
import fr.outadoc.mastodonk.api.entity.Poll
/**
* View and vote on polls.
*
* @see [Official Docs](https://docs.joinmastodon.org/methods/statuses/polls/)
*/
public interface PollsApi {
/**
* Gets a single [Poll]'s details.
*/
public suspend fun getPoll(pollId: String): Poll?
/**
* Votes on a poll for the given [choices].
*/
public suspend fun addVote(pollId: String, choices: List<Int>): Poll
}
| 22.363636 | 78 | 0.662602 |
cb26864ec35e42e4686f20122f11076dbfac23c0 | 1,647 | h | C | src/mmt_mobile/nas/ies/esp_mobile_identity.h | Montimage/mmt-dpi | 92ce3808ffc7f3d392e598e9e3db6433bae9b645 | [
"Apache-2.0"
] | 3 | 2022-01-31T09:38:29.000Z | 2022-02-13T19:58:16.000Z | src/mmt_mobile/nas/ies/esp_mobile_identity.h | Montimage/mmt-dpi | 92ce3808ffc7f3d392e598e9e3db6433bae9b645 | [
"Apache-2.0"
] | 1 | 2022-02-24T10:04:10.000Z | 2022-03-07T10:59:42.000Z | src/mmt_mobile/nas/ies/esp_mobile_identity.h | Montimage/mmt-dpi | 92ce3808ffc7f3d392e598e9e3db6433bae9b645 | [
"Apache-2.0"
] | null | null | null | /*
* esp_mobile_identity.h
*
* Created on: Nov 7, 2018
* by: Huu-Nghia
*/
#ifndef SRC_MMT_5G_NAS_ESP_MOBILE_IDENTITY_H_
#define SRC_MMT_5G_NAS_ESP_MOBILE_IDENTITY_H_
#include <stdlib.h>
#include <stdint.h>
#define EPS_MOBILE_IDENTITY_MINIMUM_LENGTH 3
#define EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH 13
typedef struct {
uint8_t spare:4;
#define EPS_MOBILE_IDENTITY_EVEN 0
#define EPS_MOBILE_IDENTITY_ODD 1
uint8_t oddeven:1;
uint8_t typeofidentity:3;
uint8_t mccdigit2:4;
uint8_t mccdigit1:4;
uint8_t mncdigit3:4;
uint8_t mccdigit3:4;
uint8_t mncdigit2:4;
uint8_t mncdigit1:4;
uint16_t mmegroupid;
uint8_t mmecode;
uint32_t mtmsi;
} nas_guti_eps_mobile_identity_t;
typedef struct {
uint8_t digit1:4;
uint8_t oddeven:1;
uint8_t typeofidentity:3;
uint8_t digit2:4;
uint8_t digit3:4;
uint8_t digit4:4;
uint8_t digit5:4;
uint8_t digit6:4;
uint8_t digit7:4;
uint8_t digit8:4;
uint8_t digit9:4;
uint8_t digit10:4;
uint8_t digit11:4;
uint8_t digit12:4;
uint8_t digit13:4;
uint8_t digit14:4;
uint8_t digit15:4;
} nas_imsi_eps_mobile_identity_t;
typedef nas_imsi_eps_mobile_identity_t nas_imei_eps_mobile_identity_t;
#define EPS_MOBILE_IDENTITY_IMSI 0b001
#define EPS_MOBILE_IDENTITY_GUTI 0b110
#define EPS_MOBILE_IDENTITY_IMEI 0b011
typedef union {
nas_imsi_eps_mobile_identity_t imsi;
nas_guti_eps_mobile_identity_t guti;
nas_imei_eps_mobile_identity_t imei;
} nas_eps_mobile_identity_t;
int nas_decode_eps_mobile_identity(nas_eps_mobile_identity_t *epsmobileidentity, uint8_t iei, const uint8_t *buffer, uint32_t len);
#endif /* SRC_MMT_5G_NAS_ESP_MOBILE_IDENTITY_H_ */
| 24.58209 | 131 | 0.794171 |
2770911a6a1217708021bf1554d2cfc105135ee9 | 4,221 | dart | Dart | petitparser/lib/src/parser/repeater/greedy.dart | KomodoPlatform/dart-petitparser | 4dfa7fc15de2a8b4ebd70e50faa9757ef6b783b1 | [
"MIT"
] | null | null | null | petitparser/lib/src/parser/repeater/greedy.dart | KomodoPlatform/dart-petitparser | 4dfa7fc15de2a8b4ebd70e50faa9757ef6b783b1 | [
"MIT"
] | null | null | null | petitparser/lib/src/parser/repeater/greedy.dart | KomodoPlatform/dart-petitparser | 4dfa7fc15de2a8b4ebd70e50faa9757ef6b783b1 | [
"MIT"
] | null | null | null | library petitparser.parser.repeater.greedy;
import '../../context/context.dart';
import '../../context/result.dart';
import '../../core/parser.dart';
import 'lazy.dart';
import 'limited.dart';
import 'possesive.dart';
import 'unbounded.dart';
extension GreedyRepeatingParserExtension<T> on Parser<T> {
/// Returns a parser that parses the receiver zero or more times until it
/// reaches a [limit]. This is a greedy non-blind implementation of the
/// [star] operator. The [limit] is not consumed.
///
/// For example, the parser `char('{') & any().starGreedy(char('}')) &
/// char('}')` consumes the complete input `'{abc}def}'` of `'{abc}def}'`.
///
/// See [starLazy] for the lazy, more efficient, and generally preferred
/// variation of this combinator.
Parser<List<T>> starGreedy(Parser limit) => repeatGreedy(limit, 0, unbounded);
/// Returns a parser that parses the receiver one or more times until it
/// reaches [limit]. This is a greedy non-blind implementation of the [plus]
/// operator. The [limit] is not consumed.
///
/// For example, the parser `char('{') & any().plusGreedy(char('}')) &
/// char('}')` consumes the complete input `'{abc}def}'` of `'{abc}def}'`.
///
/// See [plusLazy] for the lazy, more efficient, and generally preferred
/// variation of this combinator.
Parser<List<T>> plusGreedy(Parser limit) => repeatGreedy(limit, 1, unbounded);
/// Returns a parser that parses the receiver at least [min] and at most [max]
/// times until it reaches a [limit]. This is a greedy non-blind
/// implementation of the [repeat] operator. The [limit] is not consumed.
///
/// This is the more generic variation of the [starGreedy] and [plusGreedy]
/// combinators.
Parser<List<T>> repeatGreedy(Parser limit, int min, int max) =>
GreedyRepeatingParser<T>(this, limit, min, max);
}
/// A greedy repeating parser, commonly seen in regular expression
/// implementations. It aggressively consumes as much input as possible and then
/// backtracks to meet the 'limit' condition.
class GreedyRepeatingParser<T> extends LimitedRepeatingParser<T> {
GreedyRepeatingParser(Parser<T> parser, Parser limit, int min, int max)
: super(parser, limit, min, max);
@override
Result<List<T>> parseOn(Context context) {
var current = context;
final elements = <T>[];
while (elements.length < min) {
final result = delegate.parseOn(current);
if (result.isFailure) {
return result.failure(result.message);
}
elements.add(result.value);
current = result;
}
final contexts = <Context>[current];
while (max == unbounded || elements.length < max) {
final result = delegate.parseOn(current);
if (result.isFailure) {
break;
}
elements.add(result.value);
contexts.add(current = result);
}
for (;;) {
final limiter = limit.parseOn(contexts.last);
if (limiter.isSuccess) {
return contexts.last.success(elements);
}
if (elements.isEmpty) {
return limiter.failure(limiter.message);
}
contexts.removeLast();
elements.removeLast();
if (contexts.isEmpty) {
return limiter.failure(limiter.message);
}
}
}
@override
int fastParseOn(String buffer, int position) {
var count = 0;
var current = position;
while (count < min) {
final result = delegate.fastParseOn(buffer, current);
if (result < 0) {
return -1;
}
current = result;
count++;
}
final positions = <int>[current];
while (max == unbounded || count < max) {
final result = delegate.fastParseOn(buffer, current);
if (result < 0) {
break;
}
positions.add(current = result);
count++;
}
for (;;) {
final limiter = limit.fastParseOn(buffer, positions.last);
if (limiter >= 0) {
return positions.last;
}
if (count == 0) {
return -1;
}
positions.removeLast();
count--;
if (positions.isEmpty) {
return -1;
}
}
}
@override
GreedyRepeatingParser<T> copy() =>
GreedyRepeatingParser<T>(delegate, limit, min, max);
}
| 32.72093 | 80 | 0.630182 |
1763dff36c5d05e2aa0d32275b15e63c1e565c03 | 677 | html | HTML | Public/Tpl/hot.html | chengroxas/weitoutiao | 7bc0984d8f54e2256409d2f1e9b09ab1f63b10c6 | [
"BSD-2-Clause"
] | null | null | null | Public/Tpl/hot.html | chengroxas/weitoutiao | 7bc0984d8f54e2256409d2f1e9b09ab1f63b10c6 | [
"BSD-2-Clause"
] | null | null | null | Public/Tpl/hot.html | chengroxas/weitoutiao | 7bc0984d8f54e2256409d2f1e9b09ab1f63b10c6 | [
"BSD-2-Clause"
] | null | null | null | <section class="am-panel am-panel-default">
<div class="am-panel-hd">็ญ้จ</div>
<ul id="showtitle" data-am-widget="gallery" class="am-gallery am-avg-sm-1 am-avg-md-1 am-avg-lg-1 am-gallery-overlay" data-am-gallery="{ pureview: true }" >
<foreach name="hot" item="list">
<li >
<div class="am-gallery-item" >
<div >
<p></p>
<a href="{:U('Article/index',array('type'=>$list['type'],'id'=>$list['id']))}" >
<img src="{:str_replace('size','middle',$list['imgsrc'])}" alt="{$list['title']}"/>
<input type="hidden" value="{$list['title']}"/>
</a>
</div>
</div>
</li>
</foreach>
</ul>
</section>
| 35.631579 | 166 | 0.534712 |
8ec39b8a260cf14c282dc8b9ea4d108a5ed20f49 | 46 | rb | Ruby | test/fixtures/ruby/corpus/delimiter.A.rb | matsubara0507/semantic | 67899f701abc0f1f0cb4374d8d3c249afc33a272 | [
"MIT"
] | 8,844 | 2019-05-31T15:47:12.000Z | 2022-03-31T18:33:51.000Z | test/fixtures/ruby/corpus/delimiter.A.rb | matsubara0507/semantic | 67899f701abc0f1f0cb4374d8d3c249afc33a272 | [
"MIT"
] | 401 | 2019-05-31T18:30:26.000Z | 2022-03-31T16:32:29.000Z | test/fixtures/ruby/corpus/delimiter.A.rb | matsubara0507/semantic | 67899f701abc0f1f0cb4374d8d3c249afc33a272 | [
"MIT"
] | 504 | 2019-05-31T17:55:03.000Z | 2022-03-30T04:15:04.000Z | %q#a#
%q<a<b>c>
%#a#
%Q#a#
%<a<b>c>
%Q<a<b>c>
| 6.571429 | 9 | 0.347826 |
2a69fbcccaf851d3d8dd57d1b6d706d85d5852b5 | 26,969 | java | Java | htb/fatty-10.10.10.174/fatty-client/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.java | benhunter/ctf | 3de1a222ea0034ef15eb6b75585b03a6ee37ec37 | [
"MIT"
] | null | null | null | htb/fatty-10.10.10.174/fatty-client/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.java | benhunter/ctf | 3de1a222ea0034ef15eb6b75585b03a6ee37ec37 | [
"MIT"
] | 1 | 2022-03-31T22:44:36.000Z | 2022-03-31T22:44:36.000Z | htb/fatty-10.10.10.174/fatty-client/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.java | benhunter/ctf | 3de1a222ea0034ef15eb6b75585b03a6ee37ec37 | [
"MIT"
] | null | null | null | /* */ package org.springframework.aop.aspectj;
/* */
/* */ import java.lang.annotation.Annotation;
/* */ import java.lang.reflect.Constructor;
/* */ import java.lang.reflect.Method;
/* */ import java.util.ArrayList;
/* */ import java.util.HashSet;
/* */ import java.util.List;
/* */ import java.util.Set;
/* */ import org.aspectj.lang.JoinPoint;
/* */ import org.aspectj.lang.ProceedingJoinPoint;
/* */ import org.aspectj.weaver.tools.PointcutParser;
/* */ import org.aspectj.weaver.tools.PointcutPrimitive;
/* */ import org.springframework.core.ParameterNameDiscoverer;
/* */ import org.springframework.lang.Nullable;
/* */ import org.springframework.util.StringUtils;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class AspectJAdviceParameterNameDiscoverer
/* */ implements ParameterNameDiscoverer
/* */ {
/* */ private static final String THIS_JOIN_POINT = "thisJoinPoint";
/* */ private static final String THIS_JOIN_POINT_STATIC_PART = "thisJoinPointStaticPart";
/* */ private static final int STEP_JOIN_POINT_BINDING = 1;
/* */ private static final int STEP_THROWING_BINDING = 2;
/* */ private static final int STEP_ANNOTATION_BINDING = 3;
/* */ private static final int STEP_RETURNING_BINDING = 4;
/* */ private static final int STEP_PRIMITIVE_ARGS_BINDING = 5;
/* */ private static final int STEP_THIS_TARGET_ARGS_BINDING = 6;
/* */ private static final int STEP_REFERENCE_PCUT_BINDING = 7;
/* */ private static final int STEP_FINISHED = 8;
/* 135 */ private static final Set<String> singleValuedAnnotationPcds = new HashSet<>();
/* 136 */ private static final Set<String> nonReferencePointcutTokens = new HashSet<>();
/* */
/* */
/* */ static {
/* 140 */ singleValuedAnnotationPcds.add("@this");
/* 141 */ singleValuedAnnotationPcds.add("@target");
/* 142 */ singleValuedAnnotationPcds.add("@within");
/* 143 */ singleValuedAnnotationPcds.add("@withincode");
/* 144 */ singleValuedAnnotationPcds.add("@annotation");
/* */
/* 146 */ Set<PointcutPrimitive> pointcutPrimitives = PointcutParser.getAllSupportedPointcutPrimitives();
/* 147 */ for (PointcutPrimitive primitive : pointcutPrimitives) {
/* 148 */ nonReferencePointcutTokens.add(primitive.getName());
/* */ }
/* 150 */ nonReferencePointcutTokens.add("&&");
/* 151 */ nonReferencePointcutTokens.add("!");
/* 152 */ nonReferencePointcutTokens.add("||");
/* 153 */ nonReferencePointcutTokens.add("and");
/* 154 */ nonReferencePointcutTokens.add("or");
/* 155 */ nonReferencePointcutTokens.add("not");
/* */ }
/* */
/* */
/* */
/* */ @Nullable
/* */ private String pointcutExpression;
/* */
/* */
/* */ private boolean raiseExceptions;
/* */
/* */
/* */ @Nullable
/* */ private String returningName;
/* */
/* */ @Nullable
/* */ private String throwingName;
/* */
/* 173 */ private Class<?>[] argumentTypes = new Class[0];
/* */
/* 175 */ private String[] parameterNameBindings = new String[0];
/* */
/* */
/* */
/* */ private int numberOfRemainingUnboundArguments;
/* */
/* */
/* */
/* */
/* */ public AspectJAdviceParameterNameDiscoverer(@Nullable String pointcutExpression) {
/* 185 */ this.pointcutExpression = pointcutExpression;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public void setRaiseExceptions(boolean raiseExceptions) {
/* 195 */ this.raiseExceptions = raiseExceptions;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public void setReturningName(@Nullable String returningName) {
/* 204 */ this.returningName = returningName;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public void setThrowingName(@Nullable String throwingName) {
/* 213 */ this.throwingName = throwingName;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Nullable
/* */ public String[] getParameterNames(Method method) {
/* 227 */ this.argumentTypes = method.getParameterTypes();
/* 228 */ this.numberOfRemainingUnboundArguments = this.argumentTypes.length;
/* 229 */ this.parameterNameBindings = new String[this.numberOfRemainingUnboundArguments];
/* */
/* 231 */ int minimumNumberUnboundArgs = 0;
/* 232 */ if (this.returningName != null) {
/* 233 */ minimumNumberUnboundArgs++;
/* */ }
/* 235 */ if (this.throwingName != null) {
/* 236 */ minimumNumberUnboundArgs++;
/* */ }
/* 238 */ if (this.numberOfRemainingUnboundArguments < minimumNumberUnboundArgs) {
/* 239 */ throw new IllegalStateException("Not enough arguments in method to satisfy binding of returning and throwing variables");
/* */ }
/* */
/* */
/* */ try {
/* 244 */ int algorithmicStep = 1;
/* 245 */ while (this.numberOfRemainingUnboundArguments > 0 && algorithmicStep < 8) {
/* 246 */ switch (algorithmicStep++) {
/* */ case 1:
/* 248 */ if (!maybeBindThisJoinPoint()) {
/* 249 */ maybeBindThisJoinPointStaticPart();
/* */ }
/* */ continue;
/* */ case 2:
/* 253 */ maybeBindThrowingVariable();
/* */ continue;
/* */ case 3:
/* 256 */ maybeBindAnnotationsFromPointcutExpression();
/* */ continue;
/* */ case 4:
/* 259 */ maybeBindReturningVariable();
/* */ continue;
/* */ case 5:
/* 262 */ maybeBindPrimitiveArgsFromPointcutExpression();
/* */ continue;
/* */ case 6:
/* 265 */ maybeBindThisOrTargetOrArgsFromPointcutExpression();
/* */ continue;
/* */ case 7:
/* 268 */ maybeBindReferencePointcutParameter();
/* */ continue;
/* */ }
/* 271 */ throw new IllegalStateException("Unknown algorithmic step: " + (algorithmicStep - 1));
/* */ }
/* */
/* */ }
/* 275 */ catch (AmbiguousBindingException|IllegalArgumentException ex) {
/* 276 */ if (this.raiseExceptions) {
/* 277 */ throw ex;
/* */ }
/* */
/* 280 */ return null;
/* */ }
/* */
/* */
/* 284 */ if (this.numberOfRemainingUnboundArguments == 0) {
/* 285 */ return this.parameterNameBindings;
/* */ }
/* */
/* 288 */ if (this.raiseExceptions) {
/* 289 */ throw new IllegalStateException("Failed to bind all argument names: " + this.numberOfRemainingUnboundArguments + " argument(s) could not be bound");
/* */ }
/* */
/* */
/* */
/* 294 */ return null;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Nullable
/* */ public String[] getParameterNames(Constructor<?> ctor) {
/* 308 */ if (this.raiseExceptions) {
/* 309 */ throw new UnsupportedOperationException("An advice method can never be a constructor");
/* */ }
/* */
/* */
/* */
/* 314 */ return null;
/* */ }
/* */
/* */
/* */
/* */ private void bindParameterName(int index, String name) {
/* 320 */ this.parameterNameBindings[index] = name;
/* 321 */ this.numberOfRemainingUnboundArguments--;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ private boolean maybeBindThisJoinPoint() {
/* 329 */ if (this.argumentTypes[0] == JoinPoint.class || this.argumentTypes[0] == ProceedingJoinPoint.class) {
/* 330 */ bindParameterName(0, "thisJoinPoint");
/* 331 */ return true;
/* */ }
/* */
/* 334 */ return false;
/* */ }
/* */
/* */
/* */ private void maybeBindThisJoinPointStaticPart() {
/* 339 */ if (this.argumentTypes[0] == JoinPoint.StaticPart.class) {
/* 340 */ bindParameterName(0, "thisJoinPointStaticPart");
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ private void maybeBindThrowingVariable() {
/* 349 */ if (this.throwingName == null) {
/* */ return;
/* */ }
/* */
/* */
/* 354 */ int throwableIndex = -1;
/* 355 */ for (int i = 0; i < this.argumentTypes.length; i++) {
/* 356 */ if (isUnbound(i) && isSubtypeOf(Throwable.class, i)) {
/* 357 */ if (throwableIndex == -1) {
/* 358 */ throwableIndex = i;
/* */ }
/* */ else {
/* */
/* 362 */ throw new AmbiguousBindingException("Binding of throwing parameter '" + this.throwingName + "' is ambiguous: could be bound to argument " + throwableIndex + " or argument " + i);
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */
/* 369 */ if (throwableIndex == -1) {
/* 370 */ throw new IllegalStateException("Binding of throwing parameter '" + this.throwingName + "' could not be completed as no available arguments are a subtype of Throwable");
/* */ }
/* */
/* */
/* 374 */ bindParameterName(throwableIndex, this.throwingName);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ private void maybeBindReturningVariable() {
/* 382 */ if (this.numberOfRemainingUnboundArguments == 0) {
/* 383 */ throw new IllegalStateException("Algorithm assumes that there must be at least one unbound parameter on entry to this method");
/* */ }
/* */
/* */
/* 387 */ if (this.returningName != null) {
/* 388 */ if (this.numberOfRemainingUnboundArguments > 1) {
/* 389 */ throw new AmbiguousBindingException("Binding of returning parameter '" + this.returningName + "' is ambiguous, there are " + this.numberOfRemainingUnboundArguments + " candidates.");
/* */ }
/* */
/* */
/* */
/* 394 */ for (int i = 0; i < this.parameterNameBindings.length; i++) {
/* 395 */ if (this.parameterNameBindings[i] == null) {
/* 396 */ bindParameterName(i, this.returningName);
/* */ break;
/* */ }
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ private void maybeBindAnnotationsFromPointcutExpression() {
/* 412 */ List<String> varNames = new ArrayList<>();
/* 413 */ String[] tokens = StringUtils.tokenizeToStringArray(this.pointcutExpression, " ");
/* 414 */ for (int i = 0; i < tokens.length; i++) {
/* 415 */ String toMatch = tokens[i];
/* 416 */ int firstParenIndex = toMatch.indexOf('(');
/* 417 */ if (firstParenIndex != -1) {
/* 418 */ toMatch = toMatch.substring(0, firstParenIndex);
/* */ }
/* 420 */ if (singleValuedAnnotationPcds.contains(toMatch)) {
/* 421 */ PointcutBody body = getPointcutBody(tokens, i);
/* 422 */ i += body.numTokensConsumed;
/* 423 */ String varName = maybeExtractVariableName(body.text);
/* 424 */ if (varName != null) {
/* 425 */ varNames.add(varName);
/* */ }
/* */ }
/* 428 */ else if (tokens[i].startsWith("@args(") || tokens[i].equals("@args")) {
/* 429 */ PointcutBody body = getPointcutBody(tokens, i);
/* 430 */ i += body.numTokensConsumed;
/* 431 */ maybeExtractVariableNamesFromArgs(body.text, varNames);
/* */ }
/* */ }
/* */
/* 435 */ bindAnnotationsFromVarNames(varNames);
/* */ }
/* */
/* */
/* */
/* */
/* */ private void bindAnnotationsFromVarNames(List<String> varNames) {
/* 442 */ if (!varNames.isEmpty()) {
/* */
/* 444 */ int numAnnotationSlots = countNumberOfUnboundAnnotationArguments();
/* 445 */ if (numAnnotationSlots > 1) {
/* 446 */ throw new AmbiguousBindingException("Found " + varNames.size() + " potential annotation variable(s), and " + numAnnotationSlots + " potential argument slots");
/* */ }
/* */
/* */
/* 450 */ if (numAnnotationSlots == 1) {
/* 451 */ if (varNames.size() == 1) {
/* */
/* 453 */ findAndBind(Annotation.class, varNames.get(0));
/* */ }
/* */ else {
/* */
/* 457 */ throw new IllegalArgumentException("Found " + varNames.size() + " candidate annotation binding variables but only one potential argument binding slot");
/* */ }
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Nullable
/* */ private String maybeExtractVariableName(@Nullable String candidateToken) {
/* 473 */ if (!StringUtils.hasLength(candidateToken)) {
/* 474 */ return null;
/* */ }
/* 476 */ if (Character.isJavaIdentifierStart(candidateToken.charAt(0)) &&
/* 477 */ Character.isLowerCase(candidateToken.charAt(0))) {
/* 478 */ char[] tokenChars = candidateToken.toCharArray();
/* 479 */ for (char tokenChar : tokenChars) {
/* 480 */ if (!Character.isJavaIdentifierPart(tokenChar)) {
/* 481 */ return null;
/* */ }
/* */ }
/* 484 */ return candidateToken;
/* */ }
/* */
/* 487 */ return null;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ private void maybeExtractVariableNamesFromArgs(@Nullable String argsSpec, List<String> varNames) {
/* 496 */ if (argsSpec == null) {
/* */ return;
/* */ }
/* 499 */ String[] tokens = StringUtils.tokenizeToStringArray(argsSpec, ",");
/* 500 */ for (int i = 0; i < tokens.length; i++) {
/* 501 */ tokens[i] = StringUtils.trimWhitespace(tokens[i]);
/* 502 */ String varName = maybeExtractVariableName(tokens[i]);
/* 503 */ if (varName != null) {
/* 504 */ varNames.add(varName);
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ private void maybeBindThisOrTargetOrArgsFromPointcutExpression() {
/* 514 */ if (this.numberOfRemainingUnboundArguments > 1) {
/* 515 */ throw new AmbiguousBindingException("Still " + this.numberOfRemainingUnboundArguments + " unbound args at this(),target(),args() binding stage, with no way to determine between them");
/* */ }
/* */
/* */
/* 519 */ List<String> varNames = new ArrayList<>();
/* 520 */ String[] tokens = StringUtils.tokenizeToStringArray(this.pointcutExpression, " ");
/* 521 */ for (int i = 0; i < tokens.length; i++) {
/* 522 */ if (tokens[i].equals("this") || tokens[i]
/* 523 */ .startsWith("this(") || tokens[i]
/* 524 */ .equals("target") || tokens[i]
/* 525 */ .startsWith("target(")) {
/* 526 */ PointcutBody body = getPointcutBody(tokens, i);
/* 527 */ i += body.numTokensConsumed;
/* 528 */ String varName = maybeExtractVariableName(body.text);
/* 529 */ if (varName != null) {
/* 530 */ varNames.add(varName);
/* */ }
/* */ }
/* 533 */ else if (tokens[i].equals("args") || tokens[i].startsWith("args(")) {
/* 534 */ PointcutBody body = getPointcutBody(tokens, i);
/* 535 */ i += body.numTokensConsumed;
/* 536 */ List<String> candidateVarNames = new ArrayList<>();
/* 537 */ maybeExtractVariableNamesFromArgs(body.text, candidateVarNames);
/* */
/* */
/* 540 */ for (String varName : candidateVarNames) {
/* 541 */ if (!alreadyBound(varName)) {
/* 542 */ varNames.add(varName);
/* */ }
/* */ }
/* */ }
/* */ }
/* */
/* */
/* 549 */ if (varNames.size() > 1) {
/* 550 */ throw new AmbiguousBindingException("Found " + varNames.size() + " candidate this(), target() or args() variables but only one unbound argument slot");
/* */ }
/* */
/* 553 */ if (varNames.size() == 1) {
/* 554 */ for (int j = 0; j < this.parameterNameBindings.length; j++) {
/* 555 */ if (isUnbound(j)) {
/* 556 */ bindParameterName(j, varNames.get(0));
/* */ break;
/* */ }
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */ private void maybeBindReferencePointcutParameter() {
/* 565 */ if (this.numberOfRemainingUnboundArguments > 1) {
/* 566 */ throw new AmbiguousBindingException("Still " + this.numberOfRemainingUnboundArguments + " unbound args at reference pointcut binding stage, with no way to determine between them");
/* */ }
/* */
/* */
/* 570 */ List<String> varNames = new ArrayList<>();
/* 571 */ String[] tokens = StringUtils.tokenizeToStringArray(this.pointcutExpression, " ");
/* 572 */ for (int i = 0; i < tokens.length; i++) {
/* 573 */ String toMatch = tokens[i];
/* 574 */ if (toMatch.startsWith("!")) {
/* 575 */ toMatch = toMatch.substring(1);
/* */ }
/* 577 */ int firstParenIndex = toMatch.indexOf('(');
/* 578 */ if (firstParenIndex != -1) {
/* 579 */ toMatch = toMatch.substring(0, firstParenIndex);
/* */ } else {
/* */
/* 582 */ if (tokens.length < i + 2) {
/* */ continue;
/* */ }
/* */
/* */
/* 587 */ String nextToken = tokens[i + 1];
/* 588 */ if (nextToken.charAt(0) != '(') {
/* */ continue;
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* 597 */ PointcutBody body = getPointcutBody(tokens, i);
/* 598 */ i += body.numTokensConsumed;
/* */
/* 600 */ if (!nonReferencePointcutTokens.contains(toMatch)) {
/* */
/* 602 */ String varName = maybeExtractVariableName(body.text);
/* 603 */ if (varName != null) {
/* 604 */ varNames.add(varName);
/* */ }
/* */ }
/* */ continue;
/* */ }
/* 609 */ if (varNames.size() > 1) {
/* 610 */ throw new AmbiguousBindingException("Found " + varNames.size() + " candidate reference pointcut variables but only one unbound argument slot");
/* */ }
/* */
/* 613 */ if (varNames.size() == 1) {
/* 614 */ for (int j = 0; j < this.parameterNameBindings.length; j++) {
/* 615 */ if (isUnbound(j)) {
/* 616 */ bindParameterName(j, varNames.get(0));
/* */ break;
/* */ }
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ private PointcutBody getPointcutBody(String[] tokens, int startIndex) {
/* 629 */ int numTokensConsumed = 0;
/* 630 */ String currentToken = tokens[startIndex];
/* 631 */ int bodyStart = currentToken.indexOf('(');
/* 632 */ if (currentToken.charAt(currentToken.length() - 1) == ')')
/* */ {
/* 634 */ return new PointcutBody(0, currentToken.substring(bodyStart + 1, currentToken.length() - 1));
/* */ }
/* */
/* 637 */ StringBuilder sb = new StringBuilder();
/* 638 */ if (bodyStart >= 0 && bodyStart != currentToken.length() - 1) {
/* 639 */ sb.append(currentToken.substring(bodyStart + 1));
/* 640 */ sb.append(" ");
/* */ }
/* 642 */ numTokensConsumed++;
/* 643 */ int currentIndex = startIndex + numTokensConsumed;
/* 644 */ while (currentIndex < tokens.length) {
/* 645 */ if (tokens[currentIndex].equals("(")) {
/* 646 */ currentIndex++;
/* */
/* */ continue;
/* */ }
/* 650 */ if (tokens[currentIndex].endsWith(")")) {
/* 651 */ sb.append(tokens[currentIndex].substring(0, tokens[currentIndex].length() - 1));
/* 652 */ return new PointcutBody(numTokensConsumed, sb.toString().trim());
/* */ }
/* */
/* 655 */ String toAppend = tokens[currentIndex];
/* 656 */ if (toAppend.startsWith("(")) {
/* 657 */ toAppend = toAppend.substring(1);
/* */ }
/* 659 */ sb.append(toAppend);
/* 660 */ sb.append(" ");
/* 661 */ currentIndex++;
/* 662 */ numTokensConsumed++;
/* */ }
/* */
/* */
/* */
/* */
/* 668 */ return new PointcutBody(numTokensConsumed, null);
/* */ }
/* */
/* */
/* */
/* */
/* */ private void maybeBindPrimitiveArgsFromPointcutExpression() {
/* 675 */ int numUnboundPrimitives = countNumberOfUnboundPrimitiveArguments();
/* 676 */ if (numUnboundPrimitives > 1) {
/* 677 */ throw new AmbiguousBindingException("Found '" + numUnboundPrimitives + "' unbound primitive arguments with no way to distinguish between them.");
/* */ }
/* */
/* 680 */ if (numUnboundPrimitives == 1) {
/* */
/* 682 */ List<String> varNames = new ArrayList<>();
/* 683 */ String[] tokens = StringUtils.tokenizeToStringArray(this.pointcutExpression, " "); int i;
/* 684 */ for (i = 0; i < tokens.length; i++) {
/* 685 */ if (tokens[i].equals("args") || tokens[i].startsWith("args(")) {
/* 686 */ PointcutBody body = getPointcutBody(tokens, i);
/* 687 */ i += body.numTokensConsumed;
/* 688 */ maybeExtractVariableNamesFromArgs(body.text, varNames);
/* */ }
/* */ }
/* 691 */ if (varNames.size() > 1) {
/* 692 */ throw new AmbiguousBindingException("Found " + varNames.size() + " candidate variable names but only one candidate binding slot when matching primitive args");
/* */ }
/* */
/* 695 */ if (varNames.size() == 1)
/* */ {
/* 697 */ for (i = 0; i < this.argumentTypes.length; i++) {
/* 698 */ if (isUnbound(i) && this.argumentTypes[i].isPrimitive()) {
/* 699 */ bindParameterName(i, varNames.get(0));
/* */ break;
/* */ }
/* */ }
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ private boolean isUnbound(int i) {
/* 712 */ return (this.parameterNameBindings[i] == null);
/* */ }
/* */
/* */ private boolean alreadyBound(String varName) {
/* 716 */ for (int i = 0; i < this.parameterNameBindings.length; i++) {
/* 717 */ if (!isUnbound(i) && varName.equals(this.parameterNameBindings[i])) {
/* 718 */ return true;
/* */ }
/* */ }
/* 721 */ return false;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ private boolean isSubtypeOf(Class<?> supertype, int argumentNumber) {
/* 729 */ return supertype.isAssignableFrom(this.argumentTypes[argumentNumber]);
/* */ }
/* */
/* */ private int countNumberOfUnboundAnnotationArguments() {
/* 733 */ int count = 0;
/* 734 */ for (int i = 0; i < this.argumentTypes.length; i++) {
/* 735 */ if (isUnbound(i) && isSubtypeOf(Annotation.class, i)) {
/* 736 */ count++;
/* */ }
/* */ }
/* 739 */ return count;
/* */ }
/* */
/* */ private int countNumberOfUnboundPrimitiveArguments() {
/* 743 */ int count = 0;
/* 744 */ for (int i = 0; i < this.argumentTypes.length; i++) {
/* 745 */ if (isUnbound(i) && this.argumentTypes[i].isPrimitive()) {
/* 746 */ count++;
/* */ }
/* */ }
/* 749 */ return count;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ private void findAndBind(Class<?> argumentType, String varName) {
/* 757 */ for (int i = 0; i < this.argumentTypes.length; i++) {
/* 758 */ if (isUnbound(i) && isSubtypeOf(argumentType, i)) {
/* 759 */ bindParameterName(i, varName);
/* */ return;
/* */ }
/* */ }
/* 763 */ throw new IllegalStateException("Expected to find an unbound argument of type '" + argumentType
/* 764 */ .getName() + "'");
/* */ }
/* */
/* */
/* */
/* */ private static class PointcutBody
/* */ {
/* */ private int numTokensConsumed;
/* */
/* */
/* */ @Nullable
/* */ private String text;
/* */
/* */
/* */
/* */ public PointcutBody(int tokens, @Nullable String text) {
/* 780 */ this.numTokensConsumed = tokens;
/* 781 */ this.text = text;
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static class AmbiguousBindingException
/* */ extends RuntimeException
/* */ {
/* */ public AmbiguousBindingException(String msg) {
/* 798 */ super(msg);
/* */ }
/* */ }
/* */ }
/* Location: /home/kali/ctf/htb/fatty-10.10.10.174/ftp/fatty-client.jar!/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/ | 33.418835 | 200 | 0.47499 |
b8b5054c540334bbca20e5fb28dbb32413efc991 | 3,844 | lua | Lua | server/apps/yp.lua | githork/8bit_phone | e9851c61635602661fe94df1f576ec6839951b54 | [
"Apache-2.0"
] | 2 | 2021-08-31T23:46:10.000Z | 2021-11-08T12:47:07.000Z | server/apps/yp.lua | githork/8bit_phone | e9851c61635602661fe94df1f576ec6839951b54 | [
"Apache-2.0"
] | null | null | null | server/apps/yp.lua | githork/8bit_phone | e9851c61635602661fe94df1f576ec6839951b54 | [
"Apache-2.0"
] | 3 | 2021-05-01T15:26:45.000Z | 2021-09-21T14:42:30.000Z | local Advertisements = {}
function CreateAd(adData)
Advertisements[adData.id] = adData
TriggerClientEvent('8bit_phone:client:ReceiveAd', -1, Advertisements[adData.id])
return Advertisements[adData.id] ~= nil
end
function DeleteAd(source)
local src = source
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer ~= nil then
local char = xPlayer.identifier
if char ~= nil then
local id = char
Advertisements[id] = nil
TriggerClientEvent('8bit_phone:client:DeleteAd', -1, id)
else
return false
end
return true
else
return false
end
end
RegisterServerEvent('mythic_base:server:Logout')
AddEventHandler('mythic_base:server:Logout', function()
DeleteAd(source)
end)
RegisterServerEvent('8bit_phone:server:GetAds')
AddEventHandler('8bit_phone:server:GetAds', function()
local src = source
Citizen.CreateThread(function()
TriggerClientEvent('8bit_phone:client:SetupData', src, { { name = 'adverts', data = Advertisements } })
end)
end)
AddEventHandler('playerDropped', function()
DeleteAd(source)
end)
ESX.RegisterServerCallback('8bit_phone:server:NewAd', function(source, cb, data)
local src = source
local xPlayer = ESX.GetPlayerFromId(source)
local cData = getIdentity(src)
cb(CreateAd({
id = xPlayer.identifier,
author = cData.firstname .. ' ' .. cData.lastname,
number = cData.phone_number,
date = data.date,
title = data.title,
message = data.message .. " - " .. cData.phone_number
}))
TriggerEvent("8bit_phone:newad", cData.firstname .. ' ' .. cData.lastname, data.title, " - " .. cData.phone_number, xPlayer.name, xPlayer.identifier)
end)
RegisterServerEvent('8bit_phone:server:NewAdOnDuty')
AddEventHandler('8bit_phone:server:NewAdOnDuty', function(title, message)
local src = source
local xPlayer = ESX.GetPlayerFromId(source)
local cData = getIdentity(src)
CreateAd({
id = xPlayer.identifier,
author = cData.firstname .. ' ' .. cData.lastname,
number = cData.phone_number,
date = os.time(),
title = title,
message = message .. " - " .. cData.phone_number
})
end)
AddEventHandler('8bit_phone:newad', function (author, title, msg, sname, shex)
-- print(json.encode(tweet))
local discord_webhook = GetConvar('discord_webhook', 'https://discordapp.com/api/webhooks/661385091708223539/Kx29wT_IVkow28ywHJerwtcO0YF-dV1IoIl40nQARjunqn_GxmSt5-KhXBthMJ68Sq18')
if discord_webhook == '' then
return
end
local headers = {
['Content-Type'] = 'application/json'
}
local data = {
["username"] = '@' .. author .. '',
["embeds"] = {{
["thumbnail"] = {
["url"] = SystemAvatar
},
["fields"] = {
{
["name"] = 'Ad Message',
["value"] = msg,
},
{
["name"] = 'Steam Name',
["value"] = sname,
},
{
["name"] = 'Steam HEX',
["value"] = shex,
},
},
["color"] = 1942002,
--["timestamp"] = 'time'
}},
}
local isHttp = string.sub(title, 0, 7) == 'http://' or string.sub(title, 0, 8) == 'https://'
local ext = string.sub(title, -4)
local isImg = ext == '.png' or ext == '.pjg' or ext == '.gif' or string.sub(title, -5) == '.jpeg'
if (isHttp and isImg) and true then
data['embeds'][1]['image'] = { ['url'] = title }
else
data['embeds'][1]['title'] = author
data['embeds'][1]['description'] = title
end
PerformHttpRequest(discord_webhook, function(err, text, headers) end, 'POST', json.encode(data), headers)
end)
ESX.RegisterServerCallback('8bit_phone:server:DeleteAd', function(source, cb, data)
cb(DeleteAd(source))
end) | 30.507937 | 181 | 0.616025 |
907a7e8216a42b1ff660664b5693ec6f75daa871 | 4,920 | py | Python | Profile/views.py | RAPTOR-XR/Meety-Version_2.0 | c93e108995c8ffd687b2475c8fd9f9d93dbafcfb | [
"MIT"
] | null | null | null | Profile/views.py | RAPTOR-XR/Meety-Version_2.0 | c93e108995c8ffd687b2475c8fd9f9d93dbafcfb | [
"MIT"
] | null | null | null | Profile/views.py | RAPTOR-XR/Meety-Version_2.0 | c93e108995c8ffd687b2475c8fd9f9d93dbafcfb | [
"MIT"
] | null | null | null | from django.shortcuts import render, redirect, get_object_or_404
from Profile.forms import SignupForm, ChangePasswordForm, EditProfileForm
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from django.contrib.auth import update_session_auth_hash
from Profile.models import Profile
from Post.models import Post, Follow, Stream
from django.db import transaction
from django.template import loader
from django.http import HttpResponse, HttpResponseRedirect
from django.urls import reverse
from django.core.paginator import Paginator
from django.urls import resolve
def UserProfile(request, username):
user = get_object_or_404(User, username=username)
profile = Profile.objects.get(user=user)
url_name = resolve(request.path).url_name
if url_name == 'profile':
posts = Post.objects.filter(user=user).order_by('-posted')
else:
posts = profile.favorites.all()
posts_count = Post.objects.filter(user=user).count()
following_count = Follow.objects.filter(follower=user).count()
followers_count = Follow.objects.filter(following=user).count()
follow_status = Follow.objects.filter(following=user, follower=request.user).exists()
paginator = Paginator(posts, 8)
page_number = request.GET.get('page')
posts_paginator = paginator.get_page(page_number)
template = loader.get_template('profile.html')
context = {
'posts': posts_paginator,
'profile':profile,
'following_count':following_count,
'followers_count':followers_count,
'posts_count':posts_count,
'follow_status':follow_status,
'url_name':url_name,
}
return HttpResponse(template.render(context, request))
def UserProfileFavorites(request, username):
user = get_object_or_404(User, username=username)
profile = Profile.objects.get(user=user)
posts = profile.favorites.all()
posts_count = Post.objects.filter(user=user).count()
following_count = Follow.objects.filter(follower=user).count()
followers_count = Follow.objects.filter(following=user).count()
paginator = Paginator(posts, 8)
page_number = request.GET.get('page')
posts_paginator = paginator.get_page(page_number)
template = loader.get_template('profile_favorite.html')
context = {
'posts': posts_paginator,
'profile':profile,
'following_count':following_count,
'followers_count':followers_count,
'posts_count':posts_count,
}
return HttpResponse(template.render(context, request))
def Signup(request):
if request.method == 'POST':
form = SignupForm(request.POST)
if form.is_valid():
username = form.cleaned_data.get('username')
email = form.cleaned_data.get('email')
password = form.cleaned_data.get('password')
User.objects.create_user(username=username, email=email, password=password)
return redirect('index')
else:
form = SignupForm()
context = {
'form':form,
}
return render(request, 'signup.html', context)
@login_required
def PasswordChange(request):
user = request.user
if request.method == 'POST':
form = ChangePasswordForm(request.POST)
if form.is_valid():
new_password = form.cleaned_data.get('new_password')
user.set_password(new_password)
user.save()
update_session_auth_hash(request, user)
return redirect('change_password_done')
else:
form = ChangePasswordForm(instance=user)
context = {
'form':form,
}
return render(request, 'change_password.html', context)
def PasswordChangeDone(request):
return render(request, 'change_password_done.html')
@login_required
def EditProfile(request):
user = request.user.id
profile = Profile.objects.get(user__id=user)
BASE_WIDTH = 400
if request.method == 'POST':
form = EditProfileForm(request.POST, request.FILES)
if form.is_valid():
profile.picture = form.cleaned_data.get('picture')
profile.first_name = form.cleaned_data.get('first_name')
profile.last_name = form.cleaned_data.get('last_name')
profile.location = form.cleaned_data.get('location')
profile.url = form.cleaned_data.get('url')
profile.profile_info = form.cleaned_data.get('profile_info')
profile.save()
return redirect('index')
else:
form = EditProfileForm()
context = {
'form':form,
}
return render(request, 'edit_profile.html', context)
@login_required
def follow(request, username, option):
following = get_object_or_404(User, username=username)
try:
f, created = Follow.objects.get_or_create(follower=request.user, following=following)
if int(option) == 0:
f.delete()
Stream.objects.filter(following=following, user=request.user).all().delete()
else:
posts = Post.objects.all().filter(user=following)[:25]
with transaction.atomic():
for post in posts:
stream = Stream(post=post, user=request.user, date=post.posted, following=following)
stream.save()
return HttpResponseRedirect(reverse('profile', args=[username]))
except User.DoesNotExist:
return HttpResponseRedirect(reverse('profile', args=[username])) | 30 | 90 | 0.75752 |
736227e69661836bd40d873748bfa8eb289e9b9e | 588 | sql | SQL | db/functions/specials/00_git_parse_object_type.sql | SpinlockLabs/GitSQL | 864cbad68abbe633aecf398ee368f53f145eb1ad | [
"MIT"
] | 6 | 2018-01-15T08:05:21.000Z | 2020-12-17T05:16:30.000Z | db/functions/specials/00_git_parse_object_type.sql | SpinlockLabs/GitSQL | 864cbad68abbe633aecf398ee368f53f145eb1ad | [
"MIT"
] | null | null | null | db/functions/specials/00_git_parse_object_type.sql | SpinlockLabs/GitSQL | 864cbad68abbe633aecf398ee368f53f145eb1ad | [
"MIT"
] | null | null | null | CREATE OR REPLACE FUNCTION git_parse_object_type(blob BYTEA)
RETURNS objtype
IMMUTABLE
AS $BODY$
DECLARE
type TEXT;
_header TEXT;
BEGIN
_header := trim(both ' ' FROM encode((substring(blob FROM 0 FOR position('\000'::BYTEA IN blob))), 'escape'));
type := trim(both ' ' FROM substring(_header FROM 0 FOR position(' ' IN _header)));
IF type = 'commit' THEN
RETURN 'commit'::objtype;
ELSEIF type = 'tree' THEN
RETURN 'tree'::objtype;
ELSEIF type = 'tag' THEN
RETURN 'tag'::objtype;
ELSE
RETURN 'blob'::objtype;
END IF;
END;
$BODY$
LANGUAGE 'plpgsql';
| 24.5 | 112 | 0.671769 |
c389b7913d30ff5b6dcc6c910f2c3dc119fcb4ca | 8,890 | go | Go | vendor/github.com/gardener/controller-manager-library/pkg/controllermanager/controller/extension.go | ezeeyahoo/cert-management | 6a0604fb76c3573448dc1274cf3e21fc7e53c756 | [
"MIT",
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | vendor/github.com/gardener/controller-manager-library/pkg/controllermanager/controller/extension.go | ezeeyahoo/cert-management | 6a0604fb76c3573448dc1274cf3e21fc7e53c756 | [
"MIT",
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | vendor/github.com/gardener/controller-manager-library/pkg/controllermanager/controller/extension.go | ezeeyahoo/cert-management | 6a0604fb76c3573448dc1274cf3e21fc7e53c756 | [
"MIT",
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | /*
* Copyright 2019 SAP SE or an SAP affiliate company. All rights reserved.
* This file is licensed under the Apache Software License, v. 2 except as noted
* otherwise in the LICENSE file
*
* 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
*
*/
package controller
import (
"context"
"fmt"
"strings"
"time"
"github.com/gardener/controller-manager-library/pkg/config"
"github.com/gardener/controller-manager-library/pkg/resources"
"github.com/gardener/controller-manager-library/pkg/sync"
parentcfg "github.com/gardener/controller-manager-library/pkg/controllermanager/config"
areacfg "github.com/gardener/controller-manager-library/pkg/controllermanager/controller/config"
"github.com/gardener/controller-manager-library/pkg/controllermanager/extension"
"github.com/gardener/controller-manager-library/pkg/ctxutil"
"github.com/gardener/controller-manager-library/pkg/utils"
)
const TYPE = areacfg.OPTION_SOURCE
func init() {
extension.RegisterExtension(&ExtensionType{DefaultRegistry()})
}
type ExtensionType struct {
Registry
}
var _ extension.ExtensionType = &ExtensionType{}
func NewExtensionType() *ExtensionType {
return &ExtensionType{NewRegistry()}
}
func (this *ExtensionType) Name() string {
return TYPE
}
func (this *ExtensionType) Definition() extension.Definition {
return NewExtensionDefinition(this.GetDefinitions())
}
////////////////////////////////////////////////////////////////////////////////
type ExtensionDefinition struct {
extension.ExtensionDefinitionBase
definitions Definitions
}
func NewExtensionDefinition(defs Definitions) *ExtensionDefinition {
return &ExtensionDefinition{
ExtensionDefinitionBase: extension.NewExtensionDefinitionBase(TYPE, []string{"webhooks"}),
definitions: defs,
}
}
func (this *ExtensionDefinition) Description() string {
return "kubernetes controllers and operators"
}
func (this *ExtensionDefinition) Size() int {
return this.definitions.Size()
}
func (this *ExtensionDefinition) Names() utils.StringSet {
return this.definitions.Names()
}
func (this *ExtensionDefinition) Validate() error {
for n := range this.definitions.Names() {
for _, r := range this.definitions.Get(n).RequiredControllers() {
if this.definitions.Get(r) == nil {
return fmt.Errorf("controller %q requires controller %q, which is not declared", n, r)
}
}
}
return nil
}
func (this *ExtensionDefinition) ExtendConfig(cfg *parentcfg.Config) {
my := areacfg.NewConfig()
this.definitions.ExtendConfig(my)
cfg.AddSource(areacfg.OPTION_SOURCE, my)
}
func (this *ExtensionDefinition) CreateExtension(cm extension.ControllerManager) (extension.Extension, error) {
return NewExtension(this.definitions, cm)
}
////////////////////////////////////////////////////////////////////////////////
type Extension struct {
extension.Environment
sharedAttributes
config *areacfg.Config
definitions Definitions
registrations Registrations
controllers controllers
after map[string][]string
plain_groups map[string]StartupGroup
lease_groups map[string]StartupGroup
prepared map[string]*sync.SyncPoint
}
var _ Environment = &Extension{}
type prepare interface {
Prepare() error
}
func NewExtension(defs Definitions, cm extension.ControllerManager) (*Extension, error) {
ctx := ctxutil.WaitGroupContext(cm.GetContext(), "controller extension")
ext := extension.NewDefaultEnvironment(ctx, TYPE, cm)
cfg := areacfg.GetConfig(cm.GetConfig())
if cfg.LeaseName == "" {
cfg.LeaseName = cm.GetName() + "-controllers"
}
groups := defs.Groups()
ext.Infof("configured groups: %s", groups.AllGroups())
active, err := groups.Members(ext, strings.Split(cfg.Controllers, ","))
if err != nil {
return nil, err
}
added := utils.StringSet{}
for c := range active {
req, err := defs.GetRequiredControllers(c)
if err != nil {
return nil, err
}
added.AddSet(req)
}
added, _ = active.DiffFrom(added)
if len(added) > 0 {
ext.Infof("controllers implied by activated controllers: %s", added)
active.AddSet(added)
ext.Infof("finally active controllers: %s", active)
} else {
ext.Infof("no controllers implied")
}
registrations, err := defs.Registrations(active.AsArray()...)
if err != nil {
return nil, err
}
for n := range registrations {
var cerr error
options := cfg.GetSource(n).(*ControllerConfig)
options.PrefixedShared().VisitSources(func(n string, s config.OptionSource) bool {
if p, ok := s.(prepare); ok {
err := p.Prepare()
if err != nil {
cerr = err
return false
}
}
return true
})
if cerr != nil {
return nil, fmt.Errorf("invalid config for controller %q: %s", n, cerr)
}
}
_, after, err := extension.Order(registrations)
if err != nil {
return nil, err
}
return &Extension{
Environment: ext,
sharedAttributes: sharedAttributes{
LogContext: ext,
},
config: cfg,
definitions: defs,
registrations: registrations,
prepared: map[string]*sync.SyncPoint{},
after: after,
plain_groups: map[string]StartupGroup{},
lease_groups: map[string]StartupGroup{},
}, nil
}
func (this *Extension) RequiredClusters() (utils.StringSet, error) {
return this.definitions.DetermineRequestedClusters(this.ClusterDefinitions(), this.registrations.Names())
}
func (this *Extension) GetConfig() *areacfg.Config {
return this.config
}
func (this *Extension) Setup(ctx context.Context) error {
return nil
}
func (this *Extension) Start(ctx context.Context) error {
var err error
for _, def := range this.registrations {
lines := strings.Split(def.String(), "\n")
this.Infof("creating %s", lines[0])
for _, l := range lines[1:] {
this.Info(l)
}
cmp, err := this.definitions.GetMappingsFor(def.Name())
if err != nil {
return err
}
cntr, err := NewController(this, def, cmp)
if err != nil {
return err
}
this.controllers = append(this.controllers, cntr)
this.prepared[cntr.GetName()] = &sync.SyncPoint{}
}
this.controllers, err = this.controllers.getOrder(this)
if err != nil {
return err
}
for _, cntr := range this.controllers {
def := this.registrations[cntr.GetName()]
if def.RequireLease() {
cluster := cntr.GetCluster(def.LeaseClusterName())
this.getLeaseStartupGroup(cluster).Add(cntr)
} else {
this.getPlainStartupGroup(cntr.GetMainCluster()).Add(cntr)
}
err := this.checkController(cntr)
if err != nil {
return err
}
}
err = this.startGroups(this.plain_groups, this.lease_groups)
if err != nil {
return err
}
ctxutil.WaitGroupRun(ctx, func() {
<-this.GetContext().Done()
this.Info("waiting for controllers to shutdown")
ctxutil.WaitGroupWait(this.GetContext(), 120*time.Second)
this.Info("all controllers down now")
})
return nil
}
// checkController does all the checks that might cause startController to fail
// after the check startController can execute without error
func (this *Extension) checkController(cntr *controller) error {
return cntr.check()
}
// startController finally starts the controller
// all error conditions MUST also be checked
// in checkController, so after a successful checkController
// startController MUST not return an error.
func (this *Extension) startController(cntr *controller) error {
for i, a := range this.after[cntr.GetName()] {
if i == 0 {
cntr.Infof("observing initialization requirements: %s", utils.Strings(this.after[cntr.GetName()]...))
}
after := this.prepared[a]
if after != nil {
if !after.IsReached() {
cntr.Infof(" startup of %q waiting for %q", cntr.GetName(), a)
if !after.Sync(this.GetContext()) {
return fmt.Errorf("setup aborted")
}
cntr.Infof(" controller %q is initialized now", a)
} else {
cntr.Infof(" controller %q is already initialized", a)
}
} else {
cntr.Infof(" omittimg unused controller %q", a)
}
}
cntr.Infof("starting controller")
err := cntr.prepare()
if err != nil {
return err
}
this.prepared[cntr.GetName()].Reach()
ctxutil.WaitGroupRunAndCancelOnExit(this.GetContext(), cntr.Run)
return nil
}
////////////////////////////////////////////////////////////////////////////////
func (this *Extension) Enqueue(obj resources.Object) {
for _, c := range this.controllers {
c.Enqueue(obj)
}
}
func (this *Extension) EnqueueKey(key resources.ClusterObjectKey) {
for _, c := range this.controllers {
c.EnqueueKey(key)
}
}
| 26.696697 | 111 | 0.695726 |
0f70d073afec42ade33c9314f461dc5c60647d40 | 614 | cql | SQL | pet-race-ui/src/main/resources/config/cql/changelog/20160617222917_added_entity_Metric.cql | k8s-for-greeks/gpmr | c44ee3d5d6c7c9e145edbc909ce5705adc7e9738 | [
"Apache-2.0"
] | 44 | 2016-05-19T23:36:52.000Z | 2021-08-04T07:02:40.000Z | pet-race-ui/src/main/resources/config/cql/changelog/20160617222917_added_entity_Metric.cql | slachiewicz/gpmr | c44ee3d5d6c7c9e145edbc909ce5705adc7e9738 | [
"Apache-2.0"
] | 13 | 2016-05-15T16:35:44.000Z | 2016-06-30T01:37:24.000Z | pet-race-ui/src/main/resources/config/cql/changelog/20160617222917_added_entity_Metric.cql | slachiewicz/gpmr | c44ee3d5d6c7c9e145edbc909ce5705adc7e9738 | [
"Apache-2.0"
] | 11 | 2016-05-15T16:27:21.000Z | 2020-07-03T22:30:05.000Z |
CREATE TABLE IF NOT EXISTS metric (
id uuid,
metricId uuid,
connectionErrors int,
writeTimeouts int,
readTimeouts int,
unavailables int,
otherErrors int,
retries int,
ignores int,
knownHosts int,
connectedTo int,
openConnections int,
reqCount int,
reqMinLatency double,
reqMaxLatency double,
reqMeanLatency double,
reqStdev double,
reqMedian double,
req75percentile double,
req97percentile double,
req98percentile double,
req99percentile double,
req999percentile double,
dateCreated timestamp,
PRIMARY KEY(id)
);
| 21.172414 | 35 | 0.693811 |
6390ec82ae155e44be8b034fcff078e1b8bef70e | 713 | swift | Swift | NYT Movies/Extensions/UIImageView+Ext.swift | roz0n/nyt-movies | 2d2643d93e76874273400687ecc22a9d7fd0f641 | [
"MIT"
] | null | null | null | NYT Movies/Extensions/UIImageView+Ext.swift | roz0n/nyt-movies | 2d2643d93e76874273400687ecc22a9d7fd0f641 | [
"MIT"
] | null | null | null | NYT Movies/Extensions/UIImageView+Ext.swift | roz0n/nyt-movies | 2d2643d93e76874273400687ecc22a9d7fd0f641 | [
"MIT"
] | null | null | null | //
// UIImageView+Ext.swift
// NYT Movies
//
// Created by Arnaldo Rozon on 11/30/20.
//
import UIKit
extension UIImageView {
func loadRemote(url: URL) {
DispatchQueue.global().async { [weak self] in
if let data = try? Data.init(contentsOf: url) {
if let image = UIImage(data: data) {
DispatchQueue.main.async {
self?.image = image
self?.heightAnchor.constraint(equalToConstant: image.size.height).isActive = true
self?.widthAnchor.constraint(equalToConstant: image.size.width).isActive = true
}
}
}
}
}
}
| 26.407407 | 105 | 0.518934 |
6e2e5c8a84280d3308913c3161d9b5b69fac3d19 | 2,697 | html | HTML | web/angular/partials/main.html | cargografias/cargografias | 97ac77d273c4a5eb49990281ff81ef47983cadd2 | [
"Apache-2.0"
] | 27 | 2015-02-18T16:15:50.000Z | 2019-07-27T23:13:31.000Z | web/angular/partials/main.html | cargografias/cargografias | 97ac77d273c4a5eb49990281ff81ef47983cadd2 | [
"Apache-2.0"
] | null | null | null | web/angular/partials/main.html | cargografias/cargografias | 97ac77d273c4a5eb49990281ff81ef47983cadd2 | [
"Apache-2.0"
] | 14 | 2015-01-28T01:20:46.000Z | 2020-10-10T17:12:32.000Z | <div class="module">
<div class="col-xs-12
col-sm-12
col-md-12
col-lg-12
search-bar">
<div class="search-bar-1">
<a id="logotype" href="/"><img src="/img/v2/logo.png" alt=""></a>
<!-- <img id="place" src="/img/v2/argentina.png" alt=""> -->
<h3>
{{customization.siteTitle ? customization.siteTitle : 'Cargografias'}}
</h3>
</div>
<div class="search-bar-2">
<a href="/"><img src="/img/v2/flag.png" alt="">CAMBIAR PAIS</a>
<a href="/"><img src="/img/v2/about2.png" alt="">ACERCA DE</a>
</div>
</div>
</div>
<div ng-controller="loaderController" ng-include="'/angular/partials/loader.html'">
</div>
<div ng-show="ready" style="flex:1">
<div ng-show="showPresetsView" id="presets" ng-include="'/angular/partials/presets.html'"></div>
<div ng-show="showPresetsView" ng-include="'/angular/partials/footer.html'"></div>
<div ng-show="showFilterView" id="filter-container" ng-include="'/angular/partials/filter.html'"></div>
<div ng-show="showVisualizationView" ng-include="'/angular/partials/onVisualization.html'"></div>
</div>
<!-- <div class="search-bar-3">
<div id="burger" data-activates="slide-out" class="button-collapse">
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</div>
<div id="slide-out" class="side-nav">
<div id="choise-places">
<img src="/img/v2/argentina.png" alt="">
<p>Argentina</p>
</li>
</div>
<ul id="side-nav-options">
<li>
<p>Visita guiada</p>
</li>
<li>
<p>Colaboradores</p>
</li>
<li>
<p>Fuentes de informaciรณn</p>
</li>
<li>
<p>Nuestras histรณrias</p>
</li>
<li>
<p>Acerca de Cargografรญas</p>
</li>
<li>
<p>Changelog</p>
</li>
</ul>
<br>
<br>
<ul id="social-icons-nav">
<li>
<a href="#"><img src="/img/v2/facebook.png" alt=""></a>
</li>
<li>
<a href="#"><img src="/img/v2/twitter.png" alt=""></a>
</li>
<li>
<a href="#"><img src="/img/v2/github.png" alt=""></a>
</li>
<li>
<a href="#"><img src="/img/v2/mail.png" alt=""></a>
</li>
</ul>
<br>
<div class="column-3">
<a href="https://docs.google.com/forms/d/1NoOYENvhHXqpLO3WpB8l6R8ofJkJiShLlx2A_DfrNd0/viewform?embedded=true&hl=es" target="_blank"><img src="/img/v2/icon4.png" alt="">
<p>AYUDANOS A MEJORAR</p>
</a>
</div>
<br>
<ul id="other-icons">
<li>
<a href="#"><img src="/img/v2/icon1.png" alt=""></a>
</li>
<li>
<a href="#"><img src="/img/v2/icon2.png" alt=""></a>
</li>
<li>
<a href="#"><img src="/img/v2/icon3.png" alt=""></a>
</li>
</ul>
</div>
</div> -->
| 26.441176 | 180 | 0.548758 |
1e09088209bd34790ef673ac102398577547b38a | 181 | lua | Lua | scripts/doors/locations/Route124.lua | SaltContainer/PokemonEmeraldMapRandoTracker | ab3d4474508ba4a08b211b0da9fec7f29683c541 | [
"MIT"
] | 3 | 2021-11-26T22:21:31.000Z | 2022-02-23T07:56:21.000Z | scripts/doors/locations/Route124.lua | SaltContainer/PokemonEmeraldMapRandoTracker | ab3d4474508ba4a08b211b0da9fec7f29683c541 | [
"MIT"
] | 1 | 2021-11-27T00:14:45.000Z | 2021-12-31T03:39:20.000Z | scripts/doors/locations/Route124.lua | SaltContainer/PokemonEmeraldMapRandoTracker | ab3d4474508ba4a08b211b0da9fec7f29683c541 | [
"MIT"
] | 1 | 2021-12-12T15:30:22.000Z | 2021-12-12T15:30:22.000Z | local route_124_shard = DoorSlot("route_124", "shard")
local route_124_shard_hub = DoorSlotHub("route_124", "shard", route_124_shard)
route_124_shard:setHubIcon(route_124_shard_hub) | 60.333333 | 78 | 0.828729 |
8564167a6317693f29f6466dc5398d78b597fac9 | 3,639 | js | JavaScript | __tests__/LinkedList.test.js | mrinalini-m/data_structures | 60564fb664c7dc424f8a73246c216ea81782d939 | [
"MIT"
] | null | null | null | __tests__/LinkedList.test.js | mrinalini-m/data_structures | 60564fb664c7dc424f8a73246c216ea81782d939 | [
"MIT"
] | null | null | null | __tests__/LinkedList.test.js | mrinalini-m/data_structures | 60564fb664c7dc424f8a73246c216ea81782d939 | [
"MIT"
] | null | null | null | const { LinkedList } = require('../src')
describe('head, tail, size, print, search', () => {
const ll = new LinkedList(),
testList = [5, 3]
ll.fromArray(testList)
test('gets head of linked list', () => {
expect(ll.head).toEqual({ val: 5, next: { val: 3, next: null } })
})
test('gets tail of linked list', () => {
expect(ll.tail).toEqual({ val: 3, next: null })
})
test('does not mutate head of linked list', () => {
expect(() => {
ll.head = null
}).toThrow(
`Cannot set property head of #<LinkedList> which has only a getter`
)
})
test('gets size of linked list', () => {
expect(ll.size).toBe(2)
})
test('prints all node vals as an array', () => {
expect(ll.printList()).toEqual(testList)
})
test('searches linked list and returns true if given val exists', () => {
expect(ll.search(5)).toBe(true)
})
test('searches linked list and returns false if given val does not exist', () => {
expect(ll.search(1)).toBe(false)
})
})
describe('add', () => {
test('appends nodes to end of linked list from vals of array', () => {
const ll = new LinkedList(),
testList = [5, 3]
ll.fromArray(testList)
expect(ll.head).toEqual({ val: 5, next: { val: 3, next: null } })
})
test('prepends node of given val to head of linked list ', () => {
const ll = new LinkedList()
ll.fromArray([2])
ll.prependToHead(1)
expect(ll.printList()).toEqual([1, 2])
})
test('appends node of given val to tail of linked list ', () => {
const ll = new LinkedList()
ll.fromArray([1])
ll.appendToTail(2)
expect(ll.printList()).toEqual([1, 2])
})
})
describe('delete from head', () => {
test('deletes head node of linked list if node does not equal null and returns deleted node val', () => {
const ll = new LinkedList(),
testList = [5, 3]
ll.fromArray(testList)
expect(ll.deleteFromHead()).toBe(5)
})
test('returns null if head is null', () => {
const ll = new LinkedList()
expect(ll.deleteFromHead()).toBe(null)
})
})
describe('delete from tail', () => {
test('deletes tail node of linked list if node does not equal null and returns deleted node val', () => {
const ll = new LinkedList(),
testList = [5, 3]
ll.fromArray(testList)
expect(ll.deleteFromTail()).toBe(3)
expect(ll.size).toBe(1)
expect(ll.deleteFromTail()).toBe(5)
expect(ll.size).toBe(0)
})
test('returns null if head is null', () => {
const ll = new LinkedList()
expect(ll.deleteFromTail()).toBe(null)
})
})
describe('delete node of given val', () => {
test('deletes first node that matches the given val', () => {
const ll = new LinkedList(),
testList = [1, 2, 1, 3]
ll.fromArray(testList)
expect(ll.deleteNode(1, false)).toBe(true)
})
test('deletes only the first node that matches the given val', () => {
const ll = new LinkedList(),
testList = [1, 2, 1, 3]
ll.fromArray(testList)
ll.deleteNode(1, false)
expect(ll.printList()).toEqual([2, 1, 3])
})
test('deletes all nodes that matches the given val', () => {
const ll = new LinkedList(),
testList = [1, 2, 1, 3]
ll.fromArray(testList)
ll.deleteNode(1, true)
expect(ll.printList()).toEqual([2, 3])
})
test('returns false if node of given val is not found', () => {
const ll = new LinkedList(),
testList = [1, 2, 1, 3]
ll.fromArray(testList)
expect(ll.deleteNode(9, false)).toBe(false)
})
test('returns null if head is null', () => {
const ll = new LinkedList()
expect(ll.deleteFromTail()).toBe(null)
})
})
| 27.778626 | 107 | 0.597417 |
91dbc52400f1d804c1434d8c259a55ce49f0e3c9 | 1,208 | dart | Dart | lib/presentation/pages/upload_audio_page.dart | SSebigo/ahhhhhh | 3241aadce891b804d12d28c998b16dfe78a5f925 | [
"MIT"
] | 20 | 2019-09-18T06:43:03.000Z | 2022-01-21T06:40:46.000Z | lib/presentation/pages/upload_audio_page.dart | SSebigo/ahhhhhh | 3241aadce891b804d12d28c998b16dfe78a5f925 | [
"MIT"
] | null | null | null | lib/presentation/pages/upload_audio_page.dart | SSebigo/ahhhhhh | 3241aadce891b804d12d28c998b16dfe78a5f925 | [
"MIT"
] | 2 | 2019-12-23T22:08:13.000Z | 2021-08-17T05:35:17.000Z | import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:ahhhhhh/application/upload_audio_form/upload_audio_form_bloc.dart';
import 'package:ahhhhhh/injection.dart';
import 'package:ahhhhhh/presentation/widgets/upload_audio/upload_audio_form.dart';
import 'package:ahhhhhh/utils/themes.dart';
/// @nodoc
class UploadAudioPage extends StatelessWidget {
/// @nodoc
const UploadAudioPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
return AnnotatedRegion<SystemUiOverlayStyle>(
value: Themes.wineLightTheme(),
child: Scaffold(
appBar: AppBar(
title: const Text('UPLOAD A SOUND'),
backgroundColor: Colors.black,
brightness: Brightness.dark,
iconTheme: const IconThemeData(color: Colors.white),
elevation: 0.0,
),
body: BlocProvider(
create: (_) => getIt<UploadAudioFormBloc>(),
child: const UploadAudioForm(),
),
),
);
}
}
| 30.974359 | 83 | 0.687914 |
f97e0ed7652d6d277c6d58743d375d6053347dcf | 467 | sql | SQL | Chapter04/CH05_48_simple_transaction_in_try_catch.sql | PhilippeBinggeli/Hands-On-Data-Science-with-SQL-Server-2017 | f0af444e190ce7fcaf5e65fc2d5bae4f6f66a73b | [
"MIT"
] | 8 | 2018-07-09T16:08:23.000Z | 2021-11-08T13:10:52.000Z | Chapter04/CH05_48_simple_transaction_in_try_catch.sql | PhilippeBinggeli/Hands-On-Data-Science-with-SQL-Server-2017 | f0af444e190ce7fcaf5e65fc2d5bae4f6f66a73b | [
"MIT"
] | null | null | null | Chapter04/CH05_48_simple_transaction_in_try_catch.sql | PhilippeBinggeli/Hands-On-Data-Science-with-SQL-Server-2017 | f0af444e190ce7fcaf5e65fc2d5bae4f6f66a73b | [
"MIT"
] | 9 | 2018-08-07T09:54:39.000Z | 2021-05-21T17:44:23.000Z | BEGIN TRY
BEGIN TRAN
DELETE Analytics.Orders
INSERT Analytics.Orders
(OrderLineId, ProductKey, ProductName, UnitPrice, Quantity, TotalPrice)
SELECT ol.Id as OrderLineId
, ProductKey
, ProductName
, UnitPrice
, Quantity
, TotalPrice
FROM Src.OrderLines as ol
JOIN Src.Products as p on ol.ProductId = p.ProductKey
COMMIT
END TRY
BEGIN CATCH
IF @@TRANCOUNT > 1
ROLLBACK;
THROW;
END CATCH | 23.35 | 77 | 0.657388 |
6d53a592cb54d3677fca58484311b1422dbe365b | 985 | dart | Dart | test/flutter_page_router_test.dart | HugoHeneault/flutter_page_router | 031e8e233469187e2ade9db6c407a8dc3cc378c3 | [
"MIT"
] | 4 | 2019-07-26T05:28:51.000Z | 2019-10-25T18:36:49.000Z | test/flutter_page_router_test.dart | HugoHeneault/flutter_page_router | 031e8e233469187e2ade9db6c407a8dc3cc378c3 | [
"MIT"
] | 2 | 2019-08-01T03:51:27.000Z | 2020-04-08T04:28:28.000Z | test/flutter_page_router_test.dart | HugoHeneault/flutter_page_router | 031e8e233469187e2ade9db6c407a8dc3cc378c3 | [
"MIT"
] | 1 | 2020-03-09T15:55:06.000Z | 2020-03-09T15:55:06.000Z | import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import '../example/lib/main.dart';
void main() {
testWidgets('test push and pop', (WidgetTester tester) async {
await tester.pumpWidget(MyApp());
expect(find.widgetWithText(AppBar, 'Home'), findsOneWidget);
await tester.tap(find.byType(FloatingActionButton));
await tester.pumpAndSettle(const Duration(milliseconds: 1200));
expect(find.widgetWithText(AppBar, 'Other'), findsOneWidget);
await tester.tap(find.byType(FloatingActionButton));
await tester.pumpAndSettle();
expect(find.widgetWithText(AppBar, 'NotFound'), findsOneWidget);
await tester.tap(find.byKey(Key('notFoundPop')));
await tester.pumpAndSettle();
expect(find.widgetWithText(AppBar, 'Other'), findsOneWidget);
await tester.tap(find.byKey(Key('otherPop')));
await tester.pumpAndSettle();
expect(find.widgetWithText(AppBar, 'Home'), findsOneWidget);
});
}
| 25.921053 | 68 | 0.719797 |
c601f15947cf0c1428fbcdc38f7ac8202e1b2124 | 2,082 | rb | Ruby | lib/aef/hosts/comment.rb | aef/hosts | 836ec3e37c69c3a36e0a761abac7ffe014372f8f | [
"0BSD"
] | 16 | 2015-05-11T19:29:08.000Z | 2019-11-08T13:33:42.000Z | lib/aef/hosts/comment.rb | aef/hosts | 836ec3e37c69c3a36e0a761abac7ffe014372f8f | [
"0BSD"
] | 1 | 2016-03-23T16:11:25.000Z | 2016-03-23T19:59:40.000Z | lib/aef/hosts/comment.rb | aef/hosts | 836ec3e37c69c3a36e0a761abac7ffe014372f8f | [
"0BSD"
] | null | null | null | # encoding: UTF-8
=begin
Copyright Alexander E. Fischer <aef@raxys.net>, 2012
This file is part of Hosts.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
=end
require 'aef/hosts'
module Aef
module Hosts
# Represents a comment-only line as element of a hosts file
class Comment < Element
# The comment
#
# @return [String]
attr_reader :comment
# Initializes a comment
#
# @param comment [String] the comment
# @param options [Hash]
# @option options [String] :cache sets a cached String representation
def initialize(comment, options = {})
validate_options(options, :cache)
raise ArgumentError, 'Comment cannot be empty' unless comment
@comment = comment.to_s
@cache = options[:cache].to_s unless options[:cache].nil?
end
# Sets the comment
def comment=(comment)
set_if_changed(:comment, comment.to_s) do
invalidate_cache!
end
end
# A String representation for debugging purposes
#
# @return [String]
def inspect
generate_inspect(self, :comment, :cache)
end
protected
# Defines the algorithm to generate a String representation from scratch.
#
# @return [String] a generated String representation
def generate_string(options = {})
"##{comment}\n"
end
end
end
end
| 28.135135 | 79 | 0.682037 |
c42a1be3a99cd51c894483e23bbb5ccdade1b5c6 | 886 | h | C | ZhiWeibo_v1/Shared/DataSource/SearchViewDataSource.h | xiaopingchen/WeiboSDK | 01bcd6e8a183264a57e0db168b46495a46a9d978 | [
"Apache-2.0"
] | 1 | 2016-07-21T06:08:41.000Z | 2016-07-21T06:08:41.000Z | ZhiWeibo_v1/Shared/DataSource/SearchViewDataSource.h | xiaopingchen/WeiboSDK | 01bcd6e8a183264a57e0db168b46495a46a9d978 | [
"Apache-2.0"
] | null | null | null | ZhiWeibo_v1/Shared/DataSource/SearchViewDataSource.h | xiaopingchen/WeiboSDK | 01bcd6e8a183264a57e0db168b46495a46a9d978 | [
"Apache-2.0"
] | null | null | null | //
// SearchViewDataSource.h
// ZhiWeibo
//
// Created by Zhang Jason on 1/14/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "WeiboClient.h"
#import "LoadMoreCell.h"
@protocol SearchViewDataSourceDelegate
- (void)searchBarSelected;
- (void)suggestionsSelected;
- (void)trendSelected:(NSString*)trend;
@end
@class TrendNowCellView;
@interface SearchViewDataSource : NSObject<UITableViewDelegate,UITableViewDataSource> {
UITableView *tableView;
WeiboClient *weiboClient;
NSMutableArray *trends;
TrendNowCellView *trendNowCell;
NSDate *date;
id<SearchViewDataSourceDelegate> searchViewDelegate;
}
@property(nonatomic,assign)id<SearchViewDataSourceDelegate> searchViewDelegate;
@property(nonatomic,retain)UITableView *tableView;
- (id)initWithTableView:(UITableView *)_tableView;
- (void)loadRecent;
@end
| 20.604651 | 87 | 0.785553 |
3bcafa45e493458fb493305285c862b80d69d5f9 | 5,523 | h | C | cpp/wingchun/include/kungfu/wingchun/event_loop/event_loop.h | shu13720902/kungfu | da8101b6e4b7f08280d047c8f8c85c5e51875f15 | [
"Apache-2.0"
] | null | null | null | cpp/wingchun/include/kungfu/wingchun/event_loop/event_loop.h | shu13720902/kungfu | da8101b6e4b7f08280d047c8f8c85c5e51875f15 | [
"Apache-2.0"
] | null | null | null | cpp/wingchun/include/kungfu/wingchun/event_loop/event_loop.h | shu13720902/kungfu | da8101b6e4b7f08280d047c8f8c85c5e51875f15 | [
"Apache-2.0"
] | 1 | 2021-10-31T05:11:05.000Z | 2021-10-31T05:11:05.000Z | //
// Created by qlu on 2019/1/16.
//
#ifndef WC_2_EVENT_LOOP_H
#define WC_2_EVENT_LOOP_H
#include <memory>
#include <csignal>
#include <spdlog/spdlog.h>
#include <kungfu/yijinjing/nanomsg/socket.h>
#include <kungfu/yijinjing/nanomsg/passive.h>
#include <kungfu/yijinjing/journal/journal.h>
#include <kungfu/wingchun/md_struct.h>
#include <kungfu/wingchun/oms_struct.h>
#include <kungfu/wingchun/msg.h>
#include <kungfu/wingchun/util/task_scheduler.h>
namespace kfj = kungfu::journal;
namespace kungfu
{
typedef std::function<void (const kfj::Quote& quote)> QuoteCallback;
typedef std::function<void (const kfj::Entrust& entrust)> EntrustCallback;
typedef std::function<void (const kfj::Transaction& transaction)> TransactionCallback;
typedef std::function<void (const std::string& recipient, std::vector<kfj::Instrument>&, bool is_level2)> SubscribeCallback;
typedef std::function<void (const std::string& recipient, const std::string& client_id)> ReqLoginCallback;
typedef std::function<void (const kfj::OrderInput& input)> OrderInputCallback;
typedef std::function<void (const kfj::OrderAction& action)> OrderActionCallback;
typedef std::function<void (const kfj::Order& order)> OrderCallback;
typedef std::function<void (const kfj::Trade& trade)> TradeCallback;
typedef std::function<void (uint64_t order_id, const std::string& client_id, const std::string& algo_type, const std::string& algo_order_input)> AlgoOrderInputCallback;
typedef std::function<void (uint64_t order_id, const std::string& algo_type, const std::string& status)> AlgoOrderStatusCallback;
typedef std::function<void (uint64_t order_id, uint64_t order_action_id, const std::string& cmd)> AlgoOrderActionCallback;
typedef std::function<void (kfj::OrderInput& input)> ManualOrderInputCallback;
typedef std::function<void (const std::string& account_id, const std::string& client_id, const std::vector<uint64_t>& order_ids)> ManualOrderActionCallback;
typedef std::function<void ()> ReloadInstrumentsCallback;
typedef std::function<void (int sig)> SignalCallback;
class EventLoop
{
public:
EventLoop(const std::string& name): quit_(false), name_(name), low_latency_(false), reader_(nullptr), scheduler_(new TaskScheduler()) {};
void set_logger(std::shared_ptr<spdlog::logger> logger) const;
void subscribe_nanomsg(const std::string& url);
void bind_nanomsg(const std::string& url);
void add_socket(std::shared_ptr<yijinjing::nanomsg::socket> socket) { socket_vec_.push_back(socket); };
void subscribe_yjj_journal(const std::string& journal_folder, const std::string& journal_name, int64_t offset_nano);
void register_nanotime_callback(int64_t nano, TSCallback callback); // if nano == 0, trigger at next update
void register_nanotime_callback_at_next(const char* time_str, TSCallback callback);
void register_quote_callback(QuoteCallback callback);
void register_entrust_callback(EntrustCallback callback);
void register_transaction_callback(TransactionCallback callback);
void register_order_input_callback(OrderInputCallback callback);
void register_order_action_callback(OrderActionCallback callback);
void register_order_callback(OrderCallback callback);
void register_trade_callback(TradeCallback callback);
void register_subscribe_callback(SubscribeCallback callback);
void register_req_login_callback(ReqLoginCallback callback);
void register_algo_order_input_callback(AlgoOrderInputCallback callback);
void register_algo_order_status_callback(AlgoOrderStatusCallback callback);
void register_algo_order_action_callback(AlgoOrderActionCallback callback);
void register_manual_order_input_callback(ManualOrderInputCallback callback);
void register_manual_order_action_callback(ManualOrderActionCallback callback);
void register_reload_instruments_callback(ReloadInstrumentsCallback callback);
void register_signal_callback(SignalCallback handler);
void run();
void stop();
void iteration();
int64_t get_nano() const;
private:
bool quit_;
std::string name_;
bool low_latency_;
yijinjing::passive::notice notice_;
yijinjing::JournalReaderPtr reader_;
std::vector<std::shared_ptr<yijinjing::nanomsg::socket>> socket_vec_;
std::unique_ptr<TaskScheduler> scheduler_;
static volatile std::sig_atomic_t signal_received_;
vector<SignalCallback> signal_callbacks_;
QuoteCallback quote_callback_;
EntrustCallback entrust_callback_;
TransactionCallback transaction_callback_;
ReqLoginCallback login_callback_;
SubscribeCallback sub_callback_;
OrderInputCallback order_input_callback_;
OrderActionCallback order_action_callback_;
OrderCallback order_callback_;
TradeCallback trade_callback_;
AlgoOrderInputCallback algo_order_input_callback_;
AlgoOrderStatusCallback algo_order_status_callback_;
AlgoOrderActionCallback algo_order_action_callback_;
ManualOrderInputCallback manual_order_input_callback_;
ManualOrderActionCallback manual_order_action_callback_;
ReloadInstrumentsCallback reload_instruments_callback_;
static void signal_handler(int signal);
};
DECLARE_PTR(EventLoop)
}
#endif //WC_2_EVENT_LOOP_H
| 43.148438 | 172 | 0.753214 |
aabd9e977cc9284150dae02eb98d021d63373f7b | 307 | sql | SQL | qal/sql/tests/resources/_test_INSERT_matrix_csv_DB2_in.sql | OptimalBPM/qal | 4d7a31c0d68042b4110e1fa3e733711e0fdd473e | [
"Unlicense"
] | 3 | 2016-05-02T14:35:55.000Z | 2021-08-31T14:19:15.000Z | qal/sql/tests/resources/_test_INSERT_matrix_csv_DB2_in.sql | OptimalBPM/qal | 4d7a31c0d68042b4110e1fa3e733711e0fdd473e | [
"Unlicense"
] | null | null | null | qal/sql/tests/resources/_test_INSERT_matrix_csv_DB2_in.sql | OptimalBPM/qal | 4d7a31c0d68042b4110e1fa3e733711e0fdd473e | [
"Unlicense"
] | 1 | 2018-03-18T13:19:52.000Z | 2018-03-18T13:19:52.000Z | INSERT INTO "Test" ("Column1", "Column2")
(SELECT 'Matrix11' AS "Column1",'Matrix12' AS "Column2" FROM sysibm.sysdummy1
UNION
SELECT 'Matrix21','Matrix22' FROM sysibm.sysdummy1)
UNION
(SELECT 'CSV11' AS "Column1",'CSV12' AS "Column2" FROM sysibm.sysdummy1
UNION
SELECT 'CSV21','CSV22' FROM sysibm.sysdummy1) | 38.375 | 77 | 0.752443 |
f03400bb73c597151150858a75ed84bff4357c12 | 1,404 | js | JavaScript | packages/manager/apps/dedicated/client/app/dedicated/server/dashboard/advanced-features/sgx/status/status.service.js | brugere/manager | ebc661c51c921daabed35d045f1fad60d5d24e89 | [
"BSD-3-Clause"
] | 141 | 2019-10-18T15:00:40.000Z | 2022-02-24T20:17:12.000Z | packages/manager/apps/dedicated/client/app/dedicated/server/dashboard/advanced-features/sgx/status/status.service.js | brugere/manager | ebc661c51c921daabed35d045f1fad60d5d24e89 | [
"BSD-3-Clause"
] | 2,181 | 2019-10-21T08:06:37.000Z | 2022-03-31T18:41:21.000Z | packages/manager/apps/dedicated/client/app/dedicated/server/dashboard/advanced-features/sgx/status/status.service.js | brugere/manager | ebc661c51c921daabed35d045f1fad60d5d24e89 | [
"BSD-3-Clause"
] | 81 | 2019-10-22T07:52:54.000Z | 2022-03-11T09:19:37.000Z | import includes from 'lodash/includes';
import keys from 'lodash/keys';
import values from 'lodash/values';
import { STATUS } from '../sgx.constants';
export default class {
static isSgxStatusValid(value) {
const isValueValid = includes(values(STATUS), value);
const isKeyValid = includes(keys(STATUS), value);
return isValueValid || isKeyValid;
}
static resolveSgxStatus(value) {
if (includes(values(STATUS), value)) {
return value;
}
return STATUS[value];
}
static buildStatusClassName({ isRunning, status }) {
if (isRunning) {
return 'oui-badge_warning';
}
if (status === STATUS.DISABLED) {
return 'oui-badge_error';
}
return 'oui-badge_success';
}
static buildStatusTextId({ isRunning, status }) {
if (isRunning) {
return 'dedicated_server_dashboard_advanced_features_sgx_status_isRunning';
}
switch (status) {
case STATUS.DISABLED:
return 'dedicated_server_dashboard_advanced_features_sgx_status_disabled';
case STATUS.ENABLED:
return 'dedicated_server_dashboard_advanced_features_sgx_status_enabled';
case STATUS.SOFTWARE_CONTROLLED:
return 'dedicated_server_dashboard_advanced_features_sgx_status_softwareControlled';
default:
throw new Error(
`The input value ${status} should be of type SgxStatus`,
);
}
}
}
| 24.631579 | 92 | 0.685185 |
81b39234f45d0efcf46b460c4db412335c22e45f | 212 | lua | Lua | effects/init.lua | ClamityAnarchy/mcl_beacon | 083590fedbeca0603490832d8fcca44cff35c40c | [
"MIT"
] | null | null | null | effects/init.lua | ClamityAnarchy/mcl_beacon | 083590fedbeca0603490832d8fcca44cff35c40c | [
"MIT"
] | null | null | null | effects/init.lua | ClamityAnarchy/mcl_beacon | 083590fedbeca0603490832d8fcca44cff35c40c | [
"MIT"
] | null | null | null | local path = mcl_beacon.modpath.."/effects"
dofile(path.."/fly.lua")
dofile(path.."/healing.lua")
dofile(path.."/jump.lua")
dofile(path.."/speed.lua")
dofile(path.."/breathing.lua")
dofile(path.."/gravity.lua")
| 23.555556 | 43 | 0.688679 |
0ef9634a33179198001165d0bd1ec5538760da7c | 2,407 | h | C | Source/ObjectiveDropboxOfficial/Shared/Generated/Routes/DBUSERSUserAuthRoutes.h | zeteticllc/dropbox-sdk-obj-c | 71014accab8a6ac39cb9daaf88902f916a5dd738 | [
"MIT"
] | null | null | null | Source/ObjectiveDropboxOfficial/Shared/Generated/Routes/DBUSERSUserAuthRoutes.h | zeteticllc/dropbox-sdk-obj-c | 71014accab8a6ac39cb9daaf88902f916a5dd738 | [
"MIT"
] | null | null | null | Source/ObjectiveDropboxOfficial/Shared/Generated/Routes/DBUSERSUserAuthRoutes.h | zeteticllc/dropbox-sdk-obj-c | 71014accab8a6ac39cb9daaf88902f916a5dd738 | [
"MIT"
] | null | null | null | ///
/// Copyright (c) 2016 Dropbox, Inc. All rights reserved.
///
/// Auto-generated by Stone, do not modify.
///
#import <Foundation/Foundation.h>
#import "DBTasks.h"
@class DBNilObject;
@class DBUSERSAccountType;
@class DBUSERSBasicAccount;
@class DBUSERSFullAccount;
@class DBUSERSFullTeam;
@class DBUSERSGetAccountBatchError;
@class DBUSERSGetAccountError;
@class DBUSERSName;
@class DBUSERSSpaceAllocation;
@class DBUSERSSpaceUsage;
@protocol DBTransportClient;
///
/// Routes for the `Users` namespace
///
NS_ASSUME_NONNULL_BEGIN
@interface DBUSERSUserAuthRoutes : NSObject
/// An instance of the networking client that each route will use to submit a
/// request.
@property (nonatomic, readonly) id<DBTransportClient> client;
/// Initializes the `DBUSERSUserAuthRoutes` namespace container object with a
/// networking client.
- (instancetype)init:(id<DBTransportClient>)client;
///
/// Get information about a user's account.
///
/// @param accountId A user's account identifier.
///
/// @return Through the response callback, the caller will receive a `DBUSERSBasicAccount` object on success or a
/// `DBUSERSGetAccountError` object on failure.
///
- (DBRpcTask<DBUSERSBasicAccount *, DBUSERSGetAccountError *> *)getAccount:(NSString *)accountId;
///
/// Get information about multiple user accounts. At most 300 accounts may be queried per request.
///
/// @param accountIds List of user account identifiers. Should not contain any duplicate account IDs.
///
/// @return Through the response callback, the caller will receive a `NSArray<DBUSERSBasicAccount *>` object on success
/// or a `DBUSERSGetAccountBatchError` object on failure.
///
- (DBRpcTask<NSArray<DBUSERSBasicAccount *> *, DBUSERSGetAccountBatchError *> *)getAccountBatch:
(NSArray<NSString *> *)accountIds;
///
/// Get information about the current user's account.
///
///
/// @return Through the response callback, the caller will receive a `DBUSERSFullAccount` object on success or a `void`
/// object on failure.
///
- (DBRpcTask<DBUSERSFullAccount *, DBNilObject *> *)getCurrentAccount;
///
/// Get the space usage information for the current user's account.
///
///
/// @return Through the response callback, the caller will receive a `DBUSERSSpaceUsage` object on success or a `void`
/// object on failure.
///
- (DBRpcTask<DBUSERSSpaceUsage *, DBNilObject *> *)getSpaceUsage;
@end
NS_ASSUME_NONNULL_END
| 29.353659 | 119 | 0.749065 |
a86d59a275045ec742caef7d12b9d92067b65a7d | 6,134 | rs | Rust | bin/node/executor/tests/submit_transaction.rs | yanganto/darwinia | a8ec47bd6e42af9597ccb78d327b31b6320d0a49 | [
"Apache-2.0"
] | null | null | null | bin/node/executor/tests/submit_transaction.rs | yanganto/darwinia | a8ec47bd6e42af9597ccb78d327b31b6320d0a49 | [
"Apache-2.0"
] | 2 | 2020-02-11T07:29:36.000Z | 2020-02-11T11:43:41.000Z | bin/node/executor/tests/submit_transaction.rs | yanganto/darwinia | a8ec47bd6e42af9597ccb78d327b31b6320d0a49 | [
"Apache-2.0"
] | null | null | null | use codec::Decode;
use frame_system::offchain::{SubmitSignedTransaction, SubmitUnsignedTransaction};
use node_runtime::{Call, Executive, Indices, Runtime, SubmitTransaction, UncheckedExtrinsic};
use pallet_im_online::sr25519::AuthorityPair as Key;
use sp_application_crypto::AppKey;
use sp_core::offchain::{testing::TestTransactionPoolExt, TransactionPoolExt};
use sp_core::testing::KeyStore;
use sp_core::traits::KeystoreExt;
pub mod common;
use self::common::*;
#[test]
fn should_submit_unsigned_transaction() {
let mut t = new_test_ext(COMPACT_CODE, false);
let (pool, state) = TestTransactionPoolExt::new();
t.register_extension(TransactionPoolExt::new(pool));
t.execute_with(|| {
let signature = Default::default();
let heartbeat_data = pallet_im_online::Heartbeat {
block_number: 1,
network_state: Default::default(),
session_index: 1,
authority_index: 0,
};
let call = pallet_im_online::Call::heartbeat(heartbeat_data, signature);
<SubmitTransaction as SubmitUnsignedTransaction<Runtime, Call>>::submit_unsigned(call).unwrap();
assert_eq!(state.read().transactions.len(), 1)
});
}
const PHRASE: &str = "news slush supreme milk chapter athlete soap sausage put clutch what kitten";
#[test]
fn should_submit_signed_transaction() {
let mut t = new_test_ext(COMPACT_CODE, false);
let (pool, state) = TestTransactionPoolExt::new();
t.register_extension(TransactionPoolExt::new(pool));
let keystore = KeyStore::new();
keystore
.write()
.sr25519_generate_new(Key::ID, Some(&format!("{}/hunter1", PHRASE)))
.unwrap();
keystore
.write()
.sr25519_generate_new(Key::ID, Some(&format!("{}/hunter2", PHRASE)))
.unwrap();
keystore
.write()
.sr25519_generate_new(Key::ID, Some(&format!("{}/hunter3", PHRASE)))
.unwrap();
t.register_extension(KeystoreExt(keystore));
t.execute_with(|| {
let keys = <SubmitTransaction as SubmitSignedTransaction<Runtime, Call>>::find_all_local_keys();
assert_eq!(keys.len(), 3, "Missing keys: {:?}", keys);
let can_sign = <SubmitTransaction as SubmitSignedTransaction<Runtime, Call>>::can_sign();
assert!(can_sign, "Since there are keys, `can_sign` should return true");
let call = pallet_balances::Call::transfer(Default::default(), Default::default());
let results = <SubmitTransaction as SubmitSignedTransaction<Runtime, Call>>::submit_signed(call);
let len = results.len();
assert_eq!(len, 3);
assert_eq!(results.into_iter().filter_map(|x| x.1.ok()).count(), len);
assert_eq!(state.read().transactions.len(), len);
});
}
#[test]
fn should_submit_signed_twice_from_the_same_account() {
let mut t = new_test_ext(COMPACT_CODE, false);
let (pool, state) = TestTransactionPoolExt::new();
t.register_extension(TransactionPoolExt::new(pool));
let keystore = KeyStore::new();
keystore
.write()
.sr25519_generate_new(Key::ID, Some(&format!("{}/hunter1", PHRASE)))
.unwrap();
t.register_extension(KeystoreExt(keystore));
t.execute_with(|| {
let call = pallet_balances::Call::transfer(Default::default(), Default::default());
let results = <SubmitTransaction as SubmitSignedTransaction<Runtime, Call>>::submit_signed(call);
let len = results.len();
assert_eq!(len, 1);
assert_eq!(results.into_iter().filter_map(|x| x.1.ok()).count(), len);
assert_eq!(state.read().transactions.len(), 1);
// submit another one from the same account. The nonce should be incremented.
let call = pallet_balances::Call::transfer(Default::default(), Default::default());
let results = <SubmitTransaction as SubmitSignedTransaction<Runtime, Call>>::submit_signed(call);
let len = results.len();
assert_eq!(len, 1);
assert_eq!(results.into_iter().filter_map(|x| x.1.ok()).count(), len);
assert_eq!(state.read().transactions.len(), 2);
// now check that the transaction nonces are not equal
let s = state.read();
fn nonce(tx: UncheckedExtrinsic) -> frame_system::CheckNonce<Runtime> {
let extra = tx.signature.unwrap().2;
extra.3
}
let nonce1 = nonce(UncheckedExtrinsic::decode(&mut &*s.transactions[0]).unwrap());
let nonce2 = nonce(UncheckedExtrinsic::decode(&mut &*s.transactions[1]).unwrap());
assert!(
nonce1 != nonce2,
"Transactions should have different nonces. Got: {:?}",
nonce1
);
});
}
#[test]
fn submitted_transaction_should_be_valid() {
use codec::Encode;
use frame_support::storage::StorageMap;
use sp_runtime::traits::StaticLookup;
use sp_runtime::transaction_validity::ValidTransaction;
let mut t = new_test_ext(COMPACT_CODE, false);
let (pool, state) = TestTransactionPoolExt::new();
t.register_extension(TransactionPoolExt::new(pool));
let keystore = KeyStore::new();
keystore
.write()
.sr25519_generate_new(Key::ID, Some(&format!("{}/hunter1", PHRASE)))
.unwrap();
t.register_extension(KeystoreExt(keystore));
t.execute_with(|| {
let call = pallet_balances::Call::transfer(Default::default(), Default::default());
let results = <SubmitTransaction as SubmitSignedTransaction<Runtime, Call>>::submit_signed(call);
let len = results.len();
assert_eq!(len, 1);
assert_eq!(results.into_iter().filter_map(|x| x.1.ok()).count(), len);
});
// check that transaction is valid, but reset environment storage,
// since CreateTransaction increments the nonce
let tx0 = state.read().transactions[0].clone();
let mut t = new_test_ext(COMPACT_CODE, false);
t.execute_with(|| {
let extrinsic = UncheckedExtrinsic::decode(&mut &*tx0).unwrap();
// add balance to the account
let author = extrinsic.signature.clone().unwrap().0;
let address = Indices::lookup(author).unwrap();
let data = pallet_balances::balance::AccountData {
free: 5_000_000_000_000,
..Default::default()
};
let account = frame_system::AccountInfo {
nonce: 0u32,
refcount: 0u8,
data,
};
<frame_system::Account<Runtime>>::insert(&address, account);
// check validity
let res = Executive::validate_transaction(extrinsic);
assert_eq!(
res.unwrap(),
ValidTransaction {
priority: 2_411_002_000_000,
requires: vec![],
provides: vec![(address, 0).encode()],
longevity: 127,
propagate: true,
}
);
});
}
| 33.519126 | 99 | 0.715194 |
ab8eabaf2c9078cf3dfde057c5e95bd368c1e0f2 | 1,808 | swift | Swift | Sources/Domain/Actors and Actions/UserFavorites/RequestFavoriteDeletion.swift | edmw/wishlist | f4664156eb0fb1e681ebed0373d8459637f8c238 | [
"MIT"
] | 3 | 2019-10-29T23:37:02.000Z | 2020-02-09T22:24:08.000Z | Sources/Domain/Actors and Actions/UserFavorites/RequestFavoriteDeletion.swift | edmw/wishlist | f4664156eb0fb1e681ebed0373d8459637f8c238 | [
"MIT"
] | null | null | null | Sources/Domain/Actors and Actions/UserFavorites/RequestFavoriteDeletion.swift | edmw/wishlist | f4664156eb0fb1e681ebed0373d8459637f8c238 | [
"MIT"
] | null | null | null | import Foundation
import NIO
// MARK: RequestFavoriteDeletion
public struct RequestFavoriteDeletion: Action {
// MARK: Boundaries
public struct Boundaries: AutoActionBoundaries {
public let worker: EventLoop
}
// MARK: Specification
public struct Specification: AutoActionSpecification {
public let userID: UserID
public let listID: ListID
}
// MARK: Result
public struct Result: ActionResult {
public let user: UserRepresentation
public let list: ListRepresentation
internal init(_ user: User, _ list: List) {
self.user = user.representation
self.list = list.representation
}
}
}
// MARK: - Actor
extension DomainUserFavoritesActor {
// MARK: requestFavoriteDeletion
public func requestFavoriteDeletion(
_ specification: RequestFavoriteDeletion.Specification,
_ boundaries: RequestFavoriteDeletion.Boundaries
) throws -> EventLoopFuture<RequestFavoriteDeletion.Result> {
let listRepository = self.listRepository
let favoriteRepository = self.favoriteRepository
return userRepository.find(id: specification.userID)
.unwrap(or: UserFavoritesActorError.invalidUser)
.flatMap { user in
return listRepository.find(by: specification.listID)
.unwrap(or: UserFavoritesActorError.invalidList)
.flatMap { list in
return try favoriteRepository.find(favorite: list, for: user)
.unwrap(or: UserFavoritesActorError.favoriteNotExisting)
.map { _ in
return .init(user, list)
}
}
}
}
}
| 29.16129 | 85 | 0.615044 |
9c5a54f441c587e0cced8475658d4aca16ef2602 | 1,314 | js | JavaScript | src/components/Message/index.js | Akerlay/react-messenger | efb3331212fbe0470f232d72fa7614684a6debb1 | [
"MIT"
] | null | null | null | src/components/Message/index.js | Akerlay/react-messenger | efb3331212fbe0470f232d72fa7614684a6debb1 | [
"MIT"
] | 5 | 2021-03-10T22:59:28.000Z | 2022-02-27T07:00:29.000Z | src/components/Message/index.js | Akerlay/react-messenger | efb3331212fbe0470f232d72fa7614684a6debb1 | [
"MIT"
] | 2 | 2020-03-23T17:17:23.000Z | 2020-06-23T10:34:32.000Z | import React from 'react';
import moment from 'moment';
import './Message.css';
export default function Message(props) {
const {
data,
isMine,
startsSequence,
endsSequence,
showTimestamp
} = props;
const friendlyTimestamp = moment(data.timestamp).format('d MMMM y');
const friendlyTimestam = moment(data.timestamp).format('HH:mm');
console.log(props.authorUsername);
return (
<div className={[
'message',
`${isMine ? 'mine' : ''}`,
`${startsSequence ? 'start' : ''}`,
`${endsSequence ? 'end' : ''}`
].join(' ')}>
{
showTimestamp &&
<div className="timestamp">
{ friendlyTimestamp }
</div>
}
{isMine ? '': startsSequence? <div className="bubble-container">
<div className="bubble-author">
<p className={"autograph"}>@{props.authorUsername}</p>
</div>
</div>: ''}
<div className="bubble-container">
<div className="bubble">
<div className={'fefe'}>
{ data.message }
</div>
<div className="messageTime">
{friendlyTimestam}
</div>
</div>
</div>
</div>
);
} | 25.764706 | 74 | 0.495434 |
3a25c285256231c434eaa339a490daafe8db3285 | 276 | kt | Kotlin | core/src/main/java/io/freshdroid/vinyl/core/network/ApiEndpoint.kt | gm4s/Vinyl | 36e6d69aa15b7eff1981fe549bb8606df06a0410 | [
"Apache-2.0"
] | 2 | 2019-03-15T15:53:21.000Z | 2019-06-13T10:45:31.000Z | core/src/main/java/io/freshdroid/vinyl/core/network/ApiEndpoint.kt | gm4s/Vinyl | 36e6d69aa15b7eff1981fe549bb8606df06a0410 | [
"Apache-2.0"
] | 1 | 2019-03-15T16:13:51.000Z | 2019-03-16T18:12:41.000Z | core/src/main/java/io/freshdroid/vinyl/core/network/ApiEndpoint.kt | gm4s/Vinyl | 36e6d69aa15b7eff1981fe549bb8606df06a0410 | [
"Apache-2.0"
] | null | null | null | package io.freshdroid.vinyl.core.network
import io.freshdroid.vinyl.core.lib.Secrets
internal enum class ApiEndpoint(
val tag: String,
val url: String
) {
VINYL("vinyl", Secrets.Vinyl.API_BASE_URL),
VINYL_DEV("vinyl dev", Secrets.Vinyl.API_BASE_URL_DEV)
} | 19.714286 | 58 | 0.735507 |
f4390aaa92bb7d99cfad32286540b1be5b442ae5 | 136 | go | Go | plugin/handler/backup/util/constants.go | mycontroller-org/server | 246d4c820236e6850664ab2566082e7881c5406d | [
"Apache-2.0"
] | 14 | 2021-06-25T02:51:39.000Z | 2022-03-27T11:57:30.000Z | plugin/handler/backup/util/constants.go | mycontroller-org/mycontroller-v2 | 9f2f43e7529596bf90d4e2daf073b58187db2019 | [
"Apache-2.0"
] | 10 | 2021-07-31T15:49:26.000Z | 2022-03-31T10:33:18.000Z | plugin/handler/backup/util/constants.go | mycontroller-org/backend | 49e7a2fdd2ef86b3d119f3fc11696edb1cbcfafa | [
"Apache-2.0"
] | 3 | 2021-09-10T19:40:35.000Z | 2022-03-27T11:57:32.000Z | package backup
// backup types
const (
ProviderDisk = "disk"
)
// backup identifier prefix
const (
BackupIdentifier = "mc_backup"
)
| 11.333333 | 31 | 0.713235 |
30c28be3172d334aa3382341aee1c3795f9921fa | 5,845 | kt | Kotlin | app/src/main/java/com/abdoul/chatapplication/ChatActivity.kt | gatanga/Chatter | 6f8255a111f0f3ba26260ed51f143934cf90cdd2 | [
"MIT"
] | null | null | null | app/src/main/java/com/abdoul/chatapplication/ChatActivity.kt | gatanga/Chatter | 6f8255a111f0f3ba26260ed51f143934cf90cdd2 | [
"MIT"
] | null | null | null | app/src/main/java/com/abdoul/chatapplication/ChatActivity.kt | gatanga/Chatter | 6f8255a111f0f3ba26260ed51f143934cf90cdd2 | [
"MIT"
] | null | null | null | package com.abdoul.chatapplication
import android.app.Activity
import android.content.Intent
import android.graphics.Bitmap
import android.graphics.ImageDecoder
import android.os.Build
import android.os.Bundle
import android.provider.MediaStore
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import com.abdoul.chatapplication.model.ImageMessage
import com.abdoul.chatapplication.model.MessageType
import com.abdoul.chatapplication.model.TextMessage
import com.abdoul.chatapplication.model.User
import com.abdoul.chatapplication.util.AppConstants
import com.abdoul.chatapplication.util.FireStoreUtil
import com.abdoul.chatapplication.util.StorageUtil
import com.abdoul.chatapplication.util.ViewUtils
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.firestore.ListenerRegistration
import com.xwray.groupie.GroupAdapter
import com.xwray.groupie.Section
import com.xwray.groupie.kotlinandroidextensions.GroupieViewHolder
import com.xwray.groupie.kotlinandroidextensions.Item
import kotlinx.android.synthetic.main.activity_chat.*
import java.io.ByteArrayOutputStream
import java.util.*
class ChatActivity : AppCompatActivity() {
private lateinit var messagesListenerRegistration: ListenerRegistration
private var shouldInitRecyclerView = true
private lateinit var messageSection: Section
private lateinit var currentChannelId: String
private lateinit var currentUser: User
private lateinit var otherUserId: String
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_chat)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.title = intent.getStringExtra(AppConstants.USER_NAME)
FireStoreUtil.getCurrentUser {
currentUser = it
}
otherUserId = intent.getStringExtra(AppConstants.USER_ID)
FireStoreUtil.getOrCreateChatChannel(otherUserId) { channelId ->
currentChannelId = channelId
messagesListenerRegistration =
FireStoreUtil.addChatMessagesListener(channelId, this, this::updateRecyclerView)
sendMessageListener(channelId)
sendImageMessageListener()
}
}
private fun sendMessageListener(channelId: String) {
imageView_send.setOnClickListener {
if (editText_message.length() > 0) {
val messageToSend = TextMessage(
editText_message.text.toString(), Calendar.getInstance().time,
FirebaseAuth.getInstance().currentUser!!.uid, otherUserId, currentUser.name
)
editText_message.setText("")
FireStoreUtil.sendMessage(messageToSend, channelId)
} else {
ViewUtils.showToast(this, "Please enter a message")
}
}
}
private fun sendImageMessageListener() {
fab_send_image.setOnClickListener {
val intent = Intent().apply {
type = "image/*"
action = Intent.ACTION_GET_CONTENT
putExtra(Intent.EXTRA_MIME_TYPES, arrayOf("image/jpeg", "image/png"))
}
startActivityForResult(
Intent.createChooser(intent, "Select Image"),
SELECT_IMAGE_MSG_REQUEST
)
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == SELECT_IMAGE_MSG_REQUEST && resultCode == Activity.RESULT_OK &&
data != null && data.data != null
) {
val selectedImagePath = data.data
val selectedImageBmp =
if (Build.VERSION.SDK_INT < 28) MediaStore.Images.Media.getBitmap(
this.contentResolver,
selectedImagePath
) else {
val source = this.contentResolver?.let { contentResolver ->
selectedImagePath?.let { uri ->
ImageDecoder.createSource(
contentResolver,
uri
)
}
}
source?.let { ImageDecoder.decodeBitmap(it) }
}
val outputStream = ByteArrayOutputStream()
selectedImageBmp?.compress(Bitmap.CompressFormat.JPEG, 90, outputStream)
val selectedImageBytes = outputStream.toByteArray()
StorageUtil.uploadMessageImage(selectedImageBytes) { imagePath ->
val messageToSend = ImageMessage(
imagePath,
Calendar.getInstance().time,
FirebaseAuth.getInstance().currentUser!!.uid,otherUserId, currentUser.name
)
FireStoreUtil.sendMessage(messageToSend, currentChannelId)
}
}
}
private fun updateRecyclerView(messages: List<Item>) {
fun init() {
recycler_view_messages.apply {
layoutManager = LinearLayoutManager(this@ChatActivity)
adapter = GroupAdapter<GroupieViewHolder>().apply {
messageSection = Section(messages)
this.add(messageSection)
}
}
shouldInitRecyclerView = true
}
fun updateItems() = messageSection.update(messages)
if (shouldInitRecyclerView)
init()
else
updateItems()
recycler_view_messages.scrollToPosition(recycler_view_messages.adapter!!.itemCount - 1)
}
companion object {
private const val SELECT_IMAGE_MSG_REQUEST = 3
}
} | 38.453947 | 96 | 0.644996 |
863b88ca839b1c41af82431385047072183f4d35 | 3,010 | go | Go | internal/data/utils.go | MainframeEL/srpmproc | 9fb2f48380a8b669e9bee92abfd49c313f5733b8 | [
"MIT"
] | null | null | null | internal/data/utils.go | MainframeEL/srpmproc | 9fb2f48380a8b669e9bee92abfd49c313f5733b8 | [
"MIT"
] | null | null | null | internal/data/utils.go | MainframeEL/srpmproc | 9fb2f48380a8b669e9bee92abfd49c313f5733b8 | [
"MIT"
] | 1 | 2021-05-12T13:28:07.000Z | 2021-05-12T13:28:07.000Z | // Copyright (c) 2021 The Srpmproc Authors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
package data
import (
"crypto/md5"
"crypto/sha1"
"crypto/sha256"
"crypto/sha512"
"encoding/hex"
"github.com/go-git/go-billy/v5"
"hash"
"io"
"log"
"os"
"path/filepath"
)
func CopyFromFs(from billy.Filesystem, to billy.Filesystem, path string) {
read, err := from.ReadDir(path)
if err != nil {
log.Fatalf("could not read dir: %v", err)
}
for _, fi := range read {
fullPath := filepath.Join(path, fi.Name())
if fi.IsDir() {
_ = to.MkdirAll(fullPath, 0755)
CopyFromFs(from, to, fullPath)
} else {
_ = to.Remove(fullPath)
f, err := to.OpenFile(fullPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, fi.Mode())
if err != nil {
log.Fatalf("could not open file: %v", err)
}
oldFile, err := from.Open(fullPath)
if err != nil {
log.Fatalf("could not open from file: %v", err)
}
_, err = io.Copy(f, oldFile)
if err != nil {
log.Fatalf("could not copy from oldFile to new: %v", err)
}
}
}
}
func IgnoredContains(a []*IgnoredSource, b string) bool {
for _, val := range a {
if val.Name == b {
return true
}
}
return false
}
func StrContains(a []string, b string) bool {
for _, val := range a {
if val == b {
return true
}
}
return false
}
// check if content and checksum matches
// returns the hash type if success else nil
func CompareHash(content []byte, checksum string) hash.Hash {
var hashType hash.Hash
switch len(checksum) {
case 128:
hashType = sha512.New()
break
case 64:
hashType = sha256.New()
break
case 40:
hashType = sha1.New()
break
case 32:
hashType = md5.New()
break
default:
return nil
}
hashType.Reset()
_, err := hashType.Write(content)
if err != nil {
return nil
}
calculated := hex.EncodeToString(hashType.Sum(nil))
if calculated != checksum {
log.Printf("wanted checksum %s, but got %s", checksum, calculated)
return nil
}
return hashType
}
| 23.888889 | 81 | 0.685382 |
cb754243cac22e85e91db0608250d296b96a260b | 1,917 | go | Go | search/search.go | starlightromero/makescraper | 34cda57d65388f10180d21b034e1ef64b1b61711 | [
"MIT"
] | null | null | null | search/search.go | starlightromero/makescraper | 34cda57d65388f10180d21b034e1ef64b1b61711 | [
"MIT"
] | null | null | null | search/search.go | starlightromero/makescraper | 34cda57d65388f10180d21b034e1ef64b1b61711 | [
"MIT"
] | null | null | null | package search
import (
"fmt"
"os"
"strings"
"github.com/gocolly/colly"
"github.com/starlightromero/cl/help"
)
type Result struct {
title string
link string
}
// func Execute(area, query string, today bool, wantHelp bool, c *colly.Collector) []Result {
func Execute(area, query string, today bool, wantHelp bool, c *colly.Collector) {
help.Check(wantHelp, printHelp)
var postedToday int
// var results []Result
if area == "" && query == "" {
printErrorHelp()
os.Exit(1)
}
if today {
postedToday = 1
}
c.OnHTML("h3.result-heading", func(e *colly.HTMLElement) {
// var result Result
title := strings.TrimSpace(e.Text)
link := e.ChildAttr("a", "href")
fmt.Println(title)
fmt.Println(link)
fmt.Println("")
// result.title = title
// result.link = link
// results = append(results, result)
})
c.OnError(func(_ *colly.Response, err error) {
fmt.Println("Something went wrong:", err)
})
link := fmt.Sprintf("https://%s.craigslist.org/d/free-stuff/search/zip?query=%s&postedToday=%d&searchNearby=0", area, query, postedToday)
c.Visit(link)
// return results
}
func ParseAreas(flags []string) []string {
var areas = []string{}
for i, f := range flags {
if f == "-a" {
areas = append(areas, flags[i+1])
}
}
return areas
}
func printHelp() {
fmt.Println("")
fmt.Println("Usage: cl search [OPTIONS]")
fmt.Println("")
fmt.Println("Search Craigslist for free items")
fmt.Println("Options:")
fmt.Println(" -a, --area string The area to search for items within")
fmt.Println(" -q, --query string The query to search")
fmt.Println(" -t, --today bool Only show items that were posted today")
}
func printErrorHelp() {
fmt.Println("\"cl search\" requires at least 1 flag.")
fmt.Println("See 'cl search --help'.")
fmt.Println("")
fmt.Println("Usage: cl search [OPTIONS]")
fmt.Println("")
fmt.Println("Search Craigslist for free items")
}
| 22.034483 | 138 | 0.664058 |
61da2f9845d2f0eb1165edd22e0dc090177e3b39 | 32 | css | CSS | www/css/style.css | BryanPatucci/Projeto-Mobile | b616744b4f1a5317cd1229cdac5186e36995214e | [
"MIT"
] | null | null | null | www/css/style.css | BryanPatucci/Projeto-Mobile | b616744b4f1a5317cd1229cdac5186e36995214e | [
"MIT"
] | 1 | 2021-05-10T03:55:32.000Z | 2021-05-10T03:55:32.000Z | www/css/style.css | BryanPatucci/Projeto-Mobile | b616744b4f1a5317cd1229cdac5186e36995214e | [
"MIT"
] | null | null | null | /**/
h1{
margin-left: 75px;
}
| 6.4 | 20 | 0.5 |
866f8ff5b242e8f1cc9e764357f910cd916df702 | 1,509 | go | Go | server.go | gomaster-me/golang-echo-web-framework-sidepro | 2a64f43d156253977e3394ae39e7d57ee5a9e3bb | [
"Apache-2.0"
] | null | null | null | server.go | gomaster-me/golang-echo-web-framework-sidepro | 2a64f43d156253977e3394ae39e7d57ee5a9e3bb | [
"Apache-2.0"
] | null | null | null | server.go | gomaster-me/golang-echo-web-framework-sidepro | 2a64f43d156253977e3394ae39e7d57ee5a9e3bb | [
"Apache-2.0"
] | null | null | null | package main
import (
"github.com/labstack/echo"
"net/http"
"myecho/controller"
"myecho/model"
"github.com/labstack/echo/middleware"
)
var e = echo.New()
func init() {
// Root level middleware
e.Use(middleware.Logger())
e.Use(middleware.Recover())
}
func main() {
e.GET("/", func(c echo.Context) error {
return c.String(http.StatusOK, "hello world")
})
//e.POST("/users",saveUser)
//e.GET("/users/:id",getUser)
//e.PUT("/users/:id",updateUser)
//e.DELETE("/users/:id",deleteUser)
//path param
e.GET("/users/:id", controller.GetUser)
//e.POST("/users", controller.SaveUser)
e.POST("/users/:id", controller.UpdateUser)
e.DELETE("/users/:id", controller.DeleteUser)
//query param
e.GET("/show", controller.Show)
//form param application/x-www-form-urlencoded
e.POST("/save", controller.Save)
//form multipart/form-data
e.POST("/save", controller.SaveAvatar)
//$~ myecho [master] curl -F "name=fqc" -F "email=gomaster_me@sina.com" http://localhost:1323/users
//{"Id":0,"name":"fqc","email":"gomaster_me@sina.com"}%
e.POST("/users", func(c echo.Context) error {
u := new(model.User)
if err := c.Bind(u); err != nil {
return err
}
return c.JSON(http.StatusCreated, u)
//return c.XML(http.StatusCreated, u)
//โ Desktop curl -F "name=Joe Smith" -F "email=xxx@sina.com" http://localhost:1323/users
//<?xml version="1.0" encoding="UTF-8"?>
//<User><Id>0</Id><name>Joe Smith</name><email>xxx@sina.com</email></User>%
})
e.Logger.Fatal(e.Start(":1323"))
}
| 25.15 | 101 | 0.657389 |
1fd75d8974e50fbc80ac121627d0cbf852599c10 | 5,236 | css | CSS | target/classes/Style2.css | CC3002-Metodologias/scrabble-diego-dc | faa78ff996165709183aa520621fb774f7b36ee9 | [
"CC-BY-4.0"
] | null | null | null | target/classes/Style2.css | CC3002-Metodologias/scrabble-diego-dc | faa78ff996165709183aa520621fb774f7b36ee9 | [
"CC-BY-4.0"
] | null | null | null | target/classes/Style2.css | CC3002-Metodologias/scrabble-diego-dc | faa78ff996165709183aa520621fb774f7b36ee9 | [
"CC-BY-4.0"
] | null | null | null |
.button{
-fx-background-color: #d2c08e;
-fx-text-fill: #ffffff;
-fx-font-size: 14px;
-fx-background-radius: 30;
}
.button:hover
{
-fx-background-color: #ded3b5;
}
.button:pressed
{
-fx-background-color: #d2c08e;
}
.label
{
-fx-font-size: 45px;
-fx-font-family: Impact;
}
#result_Label
{
-fx-font-size: 62px;
-fx-text-fill: #ffffff;
-fx-font-family: Impact;
}
#operation_button
{
-fx-background-color: rgba(194, 115, 64, 0.81);
-fx-text-fill: #ffffff;
-fx-font-size: 14px;
-fx-background-radius: 30;
-fx-font-family: Impact;
}
#operation_button:hover
{
-fx-background-color: rgba(206, 187, 160, 0.94);
}
#operation_button:pressed
{
-fx-background-color: rgba(194, 115, 64, 0.81);
}
#transform_button
{
-fx-background-color: rgba(248, 233, 95, 0.81);
-fx-text-fill: #ffffff;
-fx-font-size: 14px;
-fx-background-radius: 30;
-fx-font-family: Impact;
}
#transform_button:hover
{
-fx-background-color: rgba(206, 187, 160, 0.94);
}
#transform_button:pressed
{
-fx-background-color: rgba(248, 233, 95, 0.81);
}
#sttype_button
{
-fx-background-color: rgba(255, 255, 255, 0.91);
-fx-text-fill: #000000;
-fx-font-size: 14px;
-fx-background-radius: 30;
-fx-font-family: Impact;
}
#sttype_button:hover
{
-fx-background-color: rgba(206, 187, 160, 0.94);
}
#sttype_button:pressed
{
-fx-background-color: rgba(255, 255, 255, 0.91);
}
#calculator_button
{
-fx-background-color: rgba(194, 115, 64, 0.81);
-fx-text-fill: #ffffff;
-fx-font-size: 20px;
-fx-background-radius: 30;
-fx-font-family: Impact;
}
#calculator_button:hover
{
-fx-background-color: rgba(206, 187, 160, 0.94);
}
#calculator_button:pressed
{
-fx-background-color: rgba(194, 115, 64, 0.81);
}
#ok_button
{
-fx-background-color: rgba(152, 203, 51, 0.86);
-fx-text-fill: #ffffff;
-fx-font-size: 21px;
-fx-background-radius: 30;
}
#ok_button:hover
{
-fx-background-color: rgb(187, 212, 140);
}
#ok_button:pressed
{
-fx-background-color: rgba(154, 205, 61, 0.86);
}
#calculate_button
{
-fx-background-color: rgba(181, 219, 116, 0.86);
-fx-text-fill: #ffffff;
-fx-font-size: 21px;
-fx-background-radius: 30;
-fx-font-family: Impact;
}
#calculate_button:hover
{
-fx-background-color: rgb(187, 212, 140);
}
#calculate_button:pressed
{
-fx-background-color: rgba(181, 219, 116, 0.86);
}
#false_button
{
-fx-background-color: rgba(201, 52, 52, 0.86);
-fx-text-fill: #ffffff;
-fx-font-size: 30px;
-fx-background-radius: 50;
-fx-font-family: Impact;
}
#false_button:hover
{
-fx-background-color: rgba(241, 133, 133, 0.86);
}
#false_button:pressed
{
-fx-background-color: rgba(201, 52, 52, 0.86);
}
#true_button
{
-fx-background-color: rgba(145, 208, 33, 0.86);
-fx-text-fill: #ffffff;
-fx-font-size: 30px;
-fx-background-radius: 50;
-fx-font-family: Impact;
}
#true_button:hover
{
-fx-background-color: rgba(178, 215, 118, 0.86);
}
#true_button
{
-fx-background-color: rgba(145, 208, 33, 0.86);
}
#num0_button
{
-fx-background-color: rgba(255, 255, 255, 0.91);
-fx-text-fill: #000000;
-fx-font-size: 30px;
-fx-background-radius: 50;
-fx-font-family: Impact;
}
#num0_button:hover
{
-fx-background-color: rgba(206, 187, 160, 0.94);
}
#num0_button:pressed
{
-fx-background-color: rgba(255, 255, 255, 0.91);
}
#num1_button
{
-fx-background-color: rgba(255, 255, 255, 0.91);
-fx-text-fill: #000000;
-fx-font-size: 30px;
-fx-background-radius: 50;
-fx-font-family: Impact;
}
#num1_button:hover
{
-fx-background-color: rgba(206, 187, 160, 0.94);
}
#num1_button:pressed
{
-fx-background-color: rgba(255, 255, 255, 0.91);
}
#clear_button
{
-fx-background-color: rgba(191, 20, 20, 0.86);
-fx-text-fill: #ffffff;
-fx-font-size: 21px;
-fx-background-radius: 60;
-fx-font-family: Impact;
}
#clear_button:hover
{
-fx-background-color: rgba(220, 109, 109, 0.86);
}
#clear_button:pressed
{
-fx-background-color: rgba(191, 20, 20, 0.86);
}
#changeView_button
{
-fx-background-color: rgba(78, 78, 78, 0.91);
-fx-text-fill: #ffffff;
-fx-font-size: 12px;
-fx-background-radius: 10;
-fx-font-family: Impact;
}
#changeView_button:hover
{
-fx-background-color: rgba(144, 143, 143, 0.91);
}
#changeView_button:pressed
{
-fx-background-color: rgba(78, 78, 78, 0.91);
}
#binary_label
{
-fx-font-size: 28px;
-fx-text-fill: rgb(255, 255, 255);
-fx-font-family: Impact;
}
#warning_label
{
-fx-font-size: 12px;
-fx-text-fill: rgba(213, 61, 61, 0.89);
-fx-font-family: Impact;
}
#result_label
{
-fx-font-size: 16px;
-fx-background-color: rgba(147, 111, 38, 0.89);
-fx-text-fill: rgb(255, 255, 255);
-fx-font-family: Impact;
}
#finalResult_label
{
-fx-font-size: 32px;
-fx-text-fill: rgb(255, 255, 255);
-fx-font-family: Impact;
}
#wrongCount_label
{
-fx-font-size: 14px;
-fx-text-fill: rgba(213, 61, 61, 0.92);
-fx-font-family: Impact;
}
#correctCount_label
{
-fx-font-size: 14px;
-fx-text-fill: rgba(35, 193, 24, 0.97);
-fx-font-family: Impact;
} | 18.567376 | 52 | 0.624523 |
7d570230020ae708c267d4b156b04aad2d27e17d | 590 | kt | Kotlin | app/src/main/java/io/github/mcasper3/prep/base/PrepActivity.kt | mcasper3/Prep | 397ba370ae5e71e245a60a0763cfb33c2b52a132 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/io/github/mcasper3/prep/base/PrepActivity.kt | mcasper3/Prep | 397ba370ae5e71e245a60a0763cfb33c2b52a132 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/io/github/mcasper3/prep/base/PrepActivity.kt | mcasper3/Prep | 397ba370ae5e71e245a60a0763cfb33c2b52a132 | [
"Apache-2.0"
] | null | null | null | package io.github.mcasper3.prep.base
import android.annotation.SuppressLint
import android.os.Bundle
import dagger.android.support.DaggerAppCompatActivity
@SuppressLint("Registered")
open class PrepActivity<P, V : View> : DaggerAppCompatActivity() where P : Presenter<V> {
open lateinit var presenter: P
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@Suppress("UNCHECKED_CAST")
presenter.attachView(this as V)
}
override fun onDestroy() {
presenter.detachView()
super.onDestroy()
}
}
| 26.818182 | 89 | 0.718644 |
5589f59d9dc9b451ec92353c42639e88da89b8c7 | 460 | html | HTML | exercicios/ex010-pratica/zaun.html | renanf23/html-css | b631f12375ae508e7ab17e16632b4b9b2f9cc584 | [
"MIT"
] | null | null | null | exercicios/ex010-pratica/zaun.html | renanf23/html-css | b631f12375ae508e7ab17e16632b4b9b2f9cc584 | [
"MIT"
] | null | null | null | exercicios/ex010-pratica/zaun.html | renanf23/html-css | b631f12375ae508e7ab17e16632b4b9b2f9cc584 | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Zaun</title>
</head>
<body>
<h1>Histรณria de Zaun</h1>
<p>Zaun a cidade rejeitada</p>
<img src="imagens/Zaun.jpg" alt="Imagem da cidade de Zaun">
<p><a href="index.html">⇐Voltar para a pรกgina principal.</a></p>
</body>
</html> | 30.666667 | 74 | 0.63913 |
71cd8783f729924043ac49285275de7d25c5c9e6 | 574 | ts | TypeScript | frontend/projects/bookolog-ui-kit/src/lib/ui-chips/directives/chip-add-on-blur.directive.ts | afferenslucem/ui-kit | 126a67f87e008316c91a719a34c5c7bb41ea48fe | [
"MIT"
] | null | null | null | frontend/projects/bookolog-ui-kit/src/lib/ui-chips/directives/chip-add-on-blur.directive.ts | afferenslucem/ui-kit | 126a67f87e008316c91a719a34c5c7bb41ea48fe | [
"MIT"
] | 8 | 2021-06-03T15:06:18.000Z | 2021-10-03T03:16:55.000Z | frontend/projects/bookolog-ui-kit/src/lib/ui-chips/directives/chip-add-on-blur.directive.ts | afferenslucem/ui-kit | 126a67f87e008316c91a719a34c5c7bb41ea48fe | [
"MIT"
] | null | null | null | import { Directive, HostListener, Output } from '@angular/core';
import { NgControl } from '@angular/forms';
import { Subject } from 'rxjs';
@Directive({
selector: '[uiChipAddOnBlur]',
})
export class ChipAddOnBlurDirective extends Subject<string> {
@Output('uiChipAddOnBlur')
public get finished(): Subject<string> {
return this;
}
constructor(private ngControl: NgControl) {
super();
}
@HostListener('blur')
public onBlur(): void {
if (this.ngControl.value) {
this.next(this.ngControl.value);
this.ngControl.reset();
}
}
}
| 22.076923 | 64 | 0.667247 |
c7d27eaebf91efa80ceada2f319e720db52de7e1 | 186 | py | Python | arc059_c.py | Lockdef/kyopro-code | 2d943a87987af05122c556e173e5108a0c1c77c8 | [
"MIT"
] | null | null | null | arc059_c.py | Lockdef/kyopro-code | 2d943a87987af05122c556e173e5108a0c1c77c8 | [
"MIT"
] | null | null | null | arc059_c.py | Lockdef/kyopro-code | 2d943a87987af05122c556e173e5108a0c1c77c8 | [
"MIT"
] | null | null | null | N = int(input())
a = list(map(int, input().split()))
s = float("inf")
for i in range(min(a), max(a) + 1):
t = 0
for j in a:
t += (j - i) ** 2
s = min(s, t)
print(s)
| 16.909091 | 35 | 0.451613 |
dfdb455177d4832a5b24ec9b5719cb7a7ee8608c | 421 | ts | TypeScript | src/api/routes/v1/index.ts | rythm-of-the-red-man/express-typescript | db87b57d0e71e2b1a05df6affa31e2f6db5c4c60 | [
"MIT"
] | null | null | null | src/api/routes/v1/index.ts | rythm-of-the-red-man/express-typescript | db87b57d0e71e2b1a05df6affa31e2f6db5c4c60 | [
"MIT"
] | 36 | 2021-09-23T19:15:20.000Z | 2022-03-28T20:12:54.000Z | src/api/routes/v1/index.ts | rythm-of-the-red-man/express-typescript | db87b57d0e71e2b1a05df6affa31e2f6db5c4c60 | [
"MIT"
] | null | null | null | import express, {Request, Response} from 'express';
import userRoutes from './user.route';
import authRoutes from './auth.route';
const router = express.Router();
/**
* GET v1/status
*/
router.get('/status', (req:Request, res:Response) => res.send('OK'));
/**
* GET v1/docs
*/
router.use('/docs', express.static('docs'));
router.use('/users', userRoutes);
router.use('/auth', authRoutes);
export default router;
| 20.047619 | 69 | 0.669834 |
c33e0a788ec23f779270a22a4ed93243164ccc08 | 1,797 | go | Go | go/util/options/errors.go | jlmucb/cloudproxy | b5aa0b619bc454ba4dd183ab1c6c8298a3b9d8c1 | [
"Apache-2.0"
] | 34 | 2015-03-10T09:58:23.000Z | 2021-08-12T21:42:28.000Z | go/util/options/errors.go | virginwidow/cloudproxy | b5aa0b619bc454ba4dd183ab1c6c8298a3b9d8c1 | [
"Apache-2.0"
] | 53 | 2015-06-09T21:07:41.000Z | 2016-12-15T00:14:53.000Z | go/util/options/errors.go | jethrogb/cloudproxy | fcf90a62bf09c4ecc9812117d065954be8a08da5 | [
"Apache-2.0"
] | 17 | 2015-06-09T21:29:23.000Z | 2021-03-26T15:35:18.000Z | // Copyright (c) 2015, Kevin Walsh. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package options works in concert with flag, adding prettier printing of
// options.
package options
import (
"fmt"
"os"
)
// FailIf does the same thing as Fail, but only if err is not nil.
func FailIf(err error, msg string, args ...interface{}) {
if err != nil {
Fail(err, msg, args...)
}
}
// WarnIf prints an error and accompanying message, but only if err is not nil.
func WarnIf(err error, msg string, args ...interface{}) {
if err != nil {
s := fmt.Sprintf(msg, args...)
fmt.Fprintf(os.Stderr, "warning: %v: %s\n", err, s)
}
}
// Fail prints an error and accompanying message to os.Stderr, then exits the
// program with status 2. The err parameter can be nil.
func Fail(err error, msg string, args ...interface{}) {
s := fmt.Sprintf(msg, args...)
if err != nil {
fmt.Fprintf(os.Stderr, "%v: %s\n", err, s)
} else {
fmt.Fprintf(os.Stderr, "error: %s\n", s)
}
os.Exit(2)
}
// Usage prints a message to os.Stderr, along with a note about the -help
// option, then exits the program with status 1.
func Usage(msg string, args ...interface{}) {
fmt.Fprintf(os.Stderr, msg+"\n", args...)
fmt.Fprintf(os.Stderr, "Try -help instead!\n")
os.Exit(1)
}
| 30.982759 | 79 | 0.6867 |
2298f7f48fa41cc2e530c953ae74b2b477b88003 | 169 | html | HTML | public/modules/core/views/home.client.view.html | schafer14/Chess4 | 7516503d6defab30746a82632ea0a0606d9f8431 | [
"MIT"
] | null | null | null | public/modules/core/views/home.client.view.html | schafer14/Chess4 | 7516503d6defab30746a82632ea0a0606d9f8431 | [
"MIT"
] | null | null | null | public/modules/core/views/home.client.view.html | schafer14/Chess4 | 7516503d6defab30746a82632ea0a0606d9f8431 | [
"MIT"
] | null | null | null | <section data-ng-controller="HomeController">
<div class="col-md-6 col-md-offset-3" style="margin-top: 50px">
<board provider="myBoard"></board>
</div>
</section> | 24.142857 | 64 | 0.686391 |
d4c8ca6d1965239d52928b9c6d3c1fdb8c7f2d37 | 2,481 | rs | Rust | src/device/file.rs | syhpoon/learnfs | c0397df71966e7daa15777e3a36d977bffab30a4 | [
"MIT"
] | 1 | 2020-07-04T13:59:16.000Z | 2020-07-04T13:59:16.000Z | src/device/file.rs | syhpoon/learnfs | c0397df71966e7daa15777e3a36d977bffab30a4 | [
"MIT"
] | null | null | null | src/device/file.rs | syhpoon/learnfs | c0397df71966e7daa15777e3a36d977bffab30a4 | [
"MIT"
] | null | null | null | /*
MIT License
Copyright (c) 2019 Max Kuznetsov <syhpoon@syhpoon.ca>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
use std::fs;
use std::io;
use anyhow::Error;
use crate::device::Device;
use std::fs::{File, OpenOptions};
/// Implements Device abstraction on top of a file
pub struct FileDevice {
file: fs::File,
capacity: u64,
}
impl FileDevice {
/// Instantiate new FileDevice from a file path
pub fn new(path: &str, capacity: u64) -> Result<Self, Error> {
let file = OpenOptions::new()
.write(true)
.truncate(true)
.create(true)
.open(path)?;
Ok(FileDevice { file, capacity })
}
/// Open existing file
pub fn open(path: &str) -> Result<Self, Error> {
let file = File::open(path)?;
Ok(FileDevice { file, capacity: 0 })
}
}
impl Device for FileDevice {
fn capacity(&self) -> Result<u64, Error> {
Ok(self.capacity)
}
}
impl io::Write for FileDevice {
fn write(&mut self, buf: &[u8]) -> Result<usize, io::Error> {
return self.file.write(buf);
}
fn flush(&mut self) -> Result<(), io::Error> {
return self.file.flush();
}
}
impl io::Seek for FileDevice {
fn seek(&mut self, pos: io::SeekFrom) -> Result<u64, io::Error> {
return self.file.seek(pos);
}
}
impl io::Read for FileDevice {
fn read(&mut self, buf: &mut [u8]) -> Result<usize, io::Error> {
return self.file.read(buf);
}
}
| 28.848837 | 79 | 0.669085 |
5dbcf3de5f455c3a1300803726af13a9c83aff04 | 926 | go | Go | app/service/luntan.go | cy-17/taptap | 1328bc52f83fe654fb7b0b40e96b738eb3871cc0 | [
"MulanPSL-1.0"
] | null | null | null | app/service/luntan.go | cy-17/taptap | 1328bc52f83fe654fb7b0b40e96b738eb3871cc0 | [
"MulanPSL-1.0"
] | null | null | null | app/service/luntan.go | cy-17/taptap | 1328bc52f83fe654fb7b0b40e96b738eb3871cc0 | [
"MulanPSL-1.0"
] | null | null | null | package service
import (
"errors"
"san616qi/app/dao"
"san616qi/app/model"
"strings"
)
// ไธญ้ดไปถ็ฎก็ๆๅก
var LunTan = luntanService{}
type luntanService struct{}
// ่ทๅ่ฎบๅๅ่กจ
func (lt *luntanService) GetForumList(offset int) (error, *model.LuntanEntity) {
//ๅๅค่ฟๅ็entityๆฐๆฎ
entity := &model.LuntanEntity{
LuntanRepList: make([]*model.LuntanRep, 0),
}
//ๅๅค็ธๅบๆฐๆฎ็ปๆไฝ
var result []*model.Luntan
//่ทๅoffset๏ผๅนถๅค็๏ผlimitไธบ15
if offset == 0 {
offset = 1
}
limit := 15
//่ทๅๆฐๆฎ
if err := dao.Luntan.Offset((offset-1)*limit).Limit(limit).Scan(&result); err != nil {
return errors.New("ๆฐๆฎๅบๆฅ่ฏข้่ฏฏ"), nil
}
//ๅค็ๆฐๆฎ๏ผๅๅค่ฟๅ
for _, v := range result {
var rep = &model.LuntanRep{
LuntanId: v.LuntanId,
LuntanName: v.LuntanName,
Shortdesc: v.Shortdesc,
Icon: v.Icon,
GameId: v.GameId,
}
rep.Tags = strings.Split(v.Tags,",")
entity.LuntanRepList = append(entity.LuntanRepList, rep)
}
return nil, entity
}
| 16.535714 | 87 | 0.667387 |
760e483a6d44affd1801ecab95f9f14cb6d2f7fb | 481 | go | Go | models/course_nickname.go | atomicjolt/canvasapi | 661496752cea4d89e8bce246d9c1a2e8039fb8af | [
"Apache-2.0"
] | null | null | null | models/course_nickname.go | atomicjolt/canvasapi | 661496752cea4d89e8bce246d9c1a2e8039fb8af | [
"Apache-2.0"
] | null | null | null | models/course_nickname.go | atomicjolt/canvasapi | 661496752cea4d89e8bce246d9c1a2e8039fb8af | [
"Apache-2.0"
] | null | null | null | package models
type CourseNickname struct {
CourseID int64 `json:"course_id" url:"course_id,omitempty"` // the ID of the course.Example: 88
Name string `json:"name" url:"name,omitempty"` // the actual name of the course.Example: S1048576 DPMS1200 Intro to Newtonian Mechanics
Nickname string `json:"nickname" url:"nickname,omitempty"` // the calling user's nickname for the course.Example: Physics
}
func (t *CourseNickname) HasErrors() error {
return nil
}
| 40.083333 | 150 | 0.731809 |
9160bced4c4f894fb88d1a97aabec9d4e12c869b | 188 | html | HTML | _posts/2004-11-30-john_gabriels_i.html | twhume/twhume.github.io | 25fba2d149592b67d97d5211060b11a0eb7cd399 | [
"MIT"
] | null | null | null | _posts/2004-11-30-john_gabriels_i.html | twhume/twhume.github.io | 25fba2d149592b67d97d5211060b11a0eb7cd399 | [
"MIT"
] | null | null | null | _posts/2004-11-30-john_gabriels_i.html | twhume/twhume.github.io | 25fba2d149592b67d97d5211060b11a0eb7cd399 | [
"MIT"
] | null | null | null | ---
layout: post
title: '<a href=\"http://www.penny-arcade.com/view.php3?date=2004-03-19&res=l\">John Gabriels Internet Fuckwad Theory</a>'
date: 2004-11-30 00:00:00
category: links
---
| 20.888889 | 122 | 0.691489 |
8ecd2868b2452c02b63503165257237565285556 | 769 | rb | Ruby | lib/junos-ez/stdlib.rb | dkaias/ruby-junos-ez-stdlib | 65a829d2e3cbaa1c5af58a26c1d349f9b1e16aa6 | [
"BSD-2-Clause"
] | 25 | 2015-01-13T19:11:20.000Z | 2021-01-28T04:28:40.000Z | lib/junos-ez/stdlib.rb | dkaias/ruby-junos-ez-stdlib | 65a829d2e3cbaa1c5af58a26c1d349f9b1e16aa6 | [
"BSD-2-Clause"
] | 31 | 2015-01-05T04:13:26.000Z | 2020-02-27T08:38:29.000Z | lib/junos-ez/stdlib.rb | dkaias/ruby-junos-ez-stdlib | 65a829d2e3cbaa1c5af58a26c1d349f9b1e16aa6 | [
"BSD-2-Clause"
] | 22 | 2015-01-14T20:47:37.000Z | 2021-01-26T22:07:18.000Z |
require 'junos-ez/provider' # framework code
require 'junos-ez/facts' # fact keeper
require 'junos-ez/system' # various system resources
require 'junos-ez/l1_ports' # physical ports
require 'junos-ez/vlans' # vlans
require 'junos-ez/l2_ports' # switch ports
require 'junos-ez/ip_ports' # ip ports (v4)
require 'junos-ez/lag_ports' # Link Aggregation Groups
require 'junos-ez/group'
# -------------------------------------------------------------------
# utility libraries, not providers
# -------------------------------------------------------------------
require 'junos-ez/utils/re'
require 'junos-ez/utils/fs'
require 'junos-ez/utils/config'
| 40.473684 | 70 | 0.503251 |
2b2c0714685feddc3a7efc259393610bff0530ea | 296 | swift | Swift | ListPlaceholderSample/ListPlaceholderView.swift | Toni77777/ListPlaceholderSample | 7ae946e10b03abf6310e3344ccf3b10c5c70ab9f | [
"MIT"
] | 2 | 2021-07-09T05:43:03.000Z | 2021-07-09T15:17:35.000Z | ListPlaceholderSample/ListPlaceholderView.swift | Toni77777/ListPlaceholderSample | 7ae946e10b03abf6310e3344ccf3b10c5c70ab9f | [
"MIT"
] | null | null | null | ListPlaceholderSample/ListPlaceholderView.swift | Toni77777/ListPlaceholderSample | 7ae946e10b03abf6310e3344ccf3b10c5c70ab9f | [
"MIT"
] | null | null | null | //
// ListPlaceholderView.swift
// ListPlaceholderSample
//
// Created by Anton Paliakou on 6/16/21.
//
import SwiftUI
struct ListPlaceholderView: View {
let title: String = "No Counties"
var body: some View {
Text(title)
.font(.largeTitle)
}
}
| 14.8 | 41 | 0.601351 |
04b521a3485178d9003345895c2672e0bedb27d1 | 11,012 | html | HTML | sound/drums_0_Chaos_sf2_fileDrum_Stan1_SC88P.html | surikov/webaudiofontdata | 23ca907d4370a04fd89ca483a92915e4d6159ab9 | [
"MIT"
] | 26 | 2017-11-27T19:38:47.000Z | 2022-02-14T07:21:05.000Z | sound/drums_0_Chaos_sf2_fileDrum_Stan1_SC88P.html | surikov/webaudiofontdata | 23ca907d4370a04fd89ca483a92915e4d6159ab9 | [
"MIT"
] | 3 | 2017-08-19T16:04:12.000Z | 2020-03-11T07:25:00.000Z | sound/drums_0_Chaos_sf2_fileDrum_Stan1_SC88P.html | surikov/webaudiofontdata | 23ca907d4370a04fd89ca483a92915e4d6159ab9 | [
"MIT"
] | 14 | 2017-06-30T03:04:25.000Z | 2021-11-14T06:47:46.000Z | <html>
<head>
<script src='https://surikov.github.io/webaudiofont/npm/dist/WebAudioFontPlayer.js'></script>
<script src='12835_0_Chaos_sf2_file.js'></script>
<script src='12836_0_Chaos_sf2_file.js'></script>
<script src='12837_0_Chaos_sf2_file.js'></script>
<script src='12838_0_Chaos_sf2_file.js'></script>
<script src='12839_0_Chaos_sf2_file.js'></script>
<script src='12840_0_Chaos_sf2_file.js'></script>
<script src='12841_0_Chaos_sf2_file.js'></script>
<script src='12842_0_Chaos_sf2_file.js'></script>
<script src='12843_0_Chaos_sf2_file.js'></script>
<script src='12844_0_Chaos_sf2_file.js'></script>
<script src='12845_0_Chaos_sf2_file.js'></script>
<script src='12846_0_Chaos_sf2_file.js'></script>
<script src='12847_0_Chaos_sf2_file.js'></script>
<script src='12848_0_Chaos_sf2_file.js'></script>
<script src='12849_0_Chaos_sf2_file.js'></script>
<script src='12850_0_Chaos_sf2_file.js'></script>
<script src='12851_0_Chaos_sf2_file.js'></script>
<script src='12852_0_Chaos_sf2_file.js'></script>
<script src='12853_0_Chaos_sf2_file.js'></script>
<script src='12854_0_Chaos_sf2_file.js'></script>
<script src='12855_0_Chaos_sf2_file.js'></script>
<script src='12856_0_Chaos_sf2_file.js'></script>
<script src='12857_0_Chaos_sf2_file.js'></script>
<script src='12858_0_Chaos_sf2_file.js'></script>
<script src='12859_0_Chaos_sf2_file.js'></script>
<script src='12860_0_Chaos_sf2_file.js'></script>
<script src='12861_0_Chaos_sf2_file.js'></script>
<script src='12862_0_Chaos_sf2_file.js'></script>
<script src='12863_0_Chaos_sf2_file.js'></script>
<script src='12864_0_Chaos_sf2_file.js'></script>
<script src='12865_0_Chaos_sf2_file.js'></script>
<script src='12866_0_Chaos_sf2_file.js'></script>
<script src='12867_0_Chaos_sf2_file.js'></script>
<script src='12868_0_Chaos_sf2_file.js'></script>
<script src='12869_0_Chaos_sf2_file.js'></script>
<script src='12870_0_Chaos_sf2_file.js'></script>
<script src='12871_0_Chaos_sf2_file.js'></script>
<script src='12872_0_Chaos_sf2_file.js'></script>
<script src='12873_0_Chaos_sf2_file.js'></script>
<script src='12874_0_Chaos_sf2_file.js'></script>
<script src='12875_0_Chaos_sf2_file.js'></script>
<script src='12876_0_Chaos_sf2_file.js'></script>
<script src='12877_0_Chaos_sf2_file.js'></script>
<script src='12878_0_Chaos_sf2_file.js'></script>
<script src='12879_0_Chaos_sf2_file.js'></script>
<script src='12880_0_Chaos_sf2_file.js'></script>
<script src='12881_0_Chaos_sf2_file.js'></script>
<script>
var AudioContextFunc = window.AudioContext || window.webkitAudioContext;
var audioContext = new AudioContextFunc();
var player=new WebAudioFontPlayer();
function startWaveTableNow(drum,pitch) {
var audioBufferSourceNode = player.queueWaveTable(audioContext, audioContext.destination, drum, audioContext.currentTime + 0, pitch, 3.5);
var audioBufferSourceNode = player.queueWaveTable(audioContext, audioContext.destination, drum, audioContext.currentTime + 0.4, pitch, 3.5);
var audioBufferSourceNode = player.queueWaveTable(audioContext, audioContext.destination, drum, audioContext.currentTime + 0.6, pitch, 3.5);
var audioBufferSourceNode = player.queueWaveTable(audioContext, audioContext.destination, drum, audioContext.currentTime + 0.8, pitch, 3.5);
}
</script>
</head>
<body>
<p><a href='javascript:player.cancelQueue(audioContext);'>stop</a></p>
<p>
<a href='javascript:startWaveTableNow(_drum_35_0_Chaos_sf2_file,35);'>35. Bass Drum 2</a>, file 12835_0_Chaos_sf2_file.js, var _drum_35_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_36_0_Chaos_sf2_file,36);'>36. Bass Drum 1</a>, file 12836_0_Chaos_sf2_file.js, var _drum_36_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_37_0_Chaos_sf2_file,37);'>37. Side Stick/Rimshot</a>, file 12837_0_Chaos_sf2_file.js, var _drum_37_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_38_0_Chaos_sf2_file,38);'>38. Snare Drum 1</a>, file 12838_0_Chaos_sf2_file.js, var _drum_38_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_39_0_Chaos_sf2_file,39);'>39. Hand Clap</a>, file 12839_0_Chaos_sf2_file.js, var _drum_39_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_40_0_Chaos_sf2_file,40);'>40. Snare Drum 2</a>, file 12840_0_Chaos_sf2_file.js, var _drum_40_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_41_0_Chaos_sf2_file,41);'>41. Low Tom 2</a>, file 12841_0_Chaos_sf2_file.js, var _drum_41_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_42_0_Chaos_sf2_file,42);'>42. Closed Hi-hat</a>, file 12842_0_Chaos_sf2_file.js, var _drum_42_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_43_0_Chaos_sf2_file,43);'>43. Low Tom 1</a>, file 12843_0_Chaos_sf2_file.js, var _drum_43_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_44_0_Chaos_sf2_file,44);'>44. Pedal Hi-hat</a>, file 12844_0_Chaos_sf2_file.js, var _drum_44_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_45_0_Chaos_sf2_file,45);'>45. Mid Tom 2</a>, file 12845_0_Chaos_sf2_file.js, var _drum_45_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_46_0_Chaos_sf2_file,46);'>46. Open Hi-hat</a>, file 12846_0_Chaos_sf2_file.js, var _drum_46_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_47_0_Chaos_sf2_file,47);'>47. Mid Tom 1</a>, file 12847_0_Chaos_sf2_file.js, var _drum_47_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_48_0_Chaos_sf2_file,48);'>48. High Tom 2</a>, file 12848_0_Chaos_sf2_file.js, var _drum_48_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_49_0_Chaos_sf2_file,49);'>49. Crash Cymbal 1</a>, file 12849_0_Chaos_sf2_file.js, var _drum_49_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_50_0_Chaos_sf2_file,50);'>50. High Tom 1</a>, file 12850_0_Chaos_sf2_file.js, var _drum_50_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_51_0_Chaos_sf2_file,51);'>51. Ride Cymbal 1</a>, file 12851_0_Chaos_sf2_file.js, var _drum_51_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_52_0_Chaos_sf2_file,52);'>52. Chinese Cymbal</a>, file 12852_0_Chaos_sf2_file.js, var _drum_52_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_53_0_Chaos_sf2_file,53);'>53. Ride Bell</a>, file 12853_0_Chaos_sf2_file.js, var _drum_53_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_54_0_Chaos_sf2_file,54);'>54. Tambourine</a>, file 12854_0_Chaos_sf2_file.js, var _drum_54_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_55_0_Chaos_sf2_file,55);'>55. Splash Cymbal</a>, file 12855_0_Chaos_sf2_file.js, var _drum_55_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_56_0_Chaos_sf2_file,56);'>56. Cowbell</a>, file 12856_0_Chaos_sf2_file.js, var _drum_56_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_57_0_Chaos_sf2_file,57);'>57. Crash Cymbal 2</a>, file 12857_0_Chaos_sf2_file.js, var _drum_57_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_58_0_Chaos_sf2_file,58);'>58. Vibra Slap</a>, file 12858_0_Chaos_sf2_file.js, var _drum_58_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_59_0_Chaos_sf2_file,59);'>59. Ride Cymbal 2</a>, file 12859_0_Chaos_sf2_file.js, var _drum_59_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_60_0_Chaos_sf2_file,60);'>60. High Bongo</a>, file 12860_0_Chaos_sf2_file.js, var _drum_60_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_61_0_Chaos_sf2_file,61);'>61. Low Bongo</a>, file 12861_0_Chaos_sf2_file.js, var _drum_61_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_62_0_Chaos_sf2_file,62);'>62. Mute High Conga</a>, file 12862_0_Chaos_sf2_file.js, var _drum_62_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_63_0_Chaos_sf2_file,63);'>63. Open High Conga</a>, file 12863_0_Chaos_sf2_file.js, var _drum_63_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_64_0_Chaos_sf2_file,64);'>64. Low Conga</a>, file 12864_0_Chaos_sf2_file.js, var _drum_64_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_65_0_Chaos_sf2_file,65);'>65. High Timbale</a>, file 12865_0_Chaos_sf2_file.js, var _drum_65_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_66_0_Chaos_sf2_file,66);'>66. Low Timbale</a>, file 12866_0_Chaos_sf2_file.js, var _drum_66_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_67_0_Chaos_sf2_file,67);'>67. High Agogo</a>, file 12867_0_Chaos_sf2_file.js, var _drum_67_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_68_0_Chaos_sf2_file,68);'>68. Low Agogo</a>, file 12868_0_Chaos_sf2_file.js, var _drum_68_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_69_0_Chaos_sf2_file,69);'>69. Cabasa</a>, file 12869_0_Chaos_sf2_file.js, var _drum_69_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_70_0_Chaos_sf2_file,70);'>70. Maracas</a>, file 12870_0_Chaos_sf2_file.js, var _drum_70_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_71_0_Chaos_sf2_file,71);'>71. Short Whistle</a>, file 12871_0_Chaos_sf2_file.js, var _drum_71_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_72_0_Chaos_sf2_file,72);'>72. Long Whistle</a>, file 12872_0_Chaos_sf2_file.js, var _drum_72_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_73_0_Chaos_sf2_file,73);'>73. Short Guiro</a>, file 12873_0_Chaos_sf2_file.js, var _drum_73_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_74_0_Chaos_sf2_file,74);'>74. Long Guiro</a>, file 12874_0_Chaos_sf2_file.js, var _drum_74_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_75_0_Chaos_sf2_file,75);'>75. Claves</a>, file 12875_0_Chaos_sf2_file.js, var _drum_75_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_76_0_Chaos_sf2_file,76);'>76. High Wood Block</a>, file 12876_0_Chaos_sf2_file.js, var _drum_76_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_77_0_Chaos_sf2_file,77);'>77. Low Wood Block</a>, file 12877_0_Chaos_sf2_file.js, var _drum_77_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_78_0_Chaos_sf2_file,78);'>78. Mute Cuica</a>, file 12878_0_Chaos_sf2_file.js, var _drum_78_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_79_0_Chaos_sf2_file,79);'>79. Open Cuica</a>, file 12879_0_Chaos_sf2_file.js, var _drum_79_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_80_0_Chaos_sf2_file,80);'>80. Mute Triangle</a>, file 12880_0_Chaos_sf2_file.js, var _drum_80_0_Chaos_sf2_file<br/>
<a href='javascript:startWaveTableNow(_drum_81_0_Chaos_sf2_file,81);'>81. Open Triangle</a>, file 12881_0_Chaos_sf2_file.js, var _drum_81_0_Chaos_sf2_file<br/>
</p>
</body>
</html>
| 94.931034 | 166 | 0.791137 |
cb2565ec5612dac46d4a919213d2e657122c8dae | 1,633 | go | Go | pkg/applicationserver/io/web/registry.go | mastermind88/lorawan-stack | c09a63b9d8a613f61734dbe5162e25c6238690a2 | [
"Apache-2.0"
] | 737 | 2019-01-31T16:32:04.000Z | 2022-03-29T00:23:42.000Z | pkg/applicationserver/io/web/registry.go | mastermind88/lorawan-stack | c09a63b9d8a613f61734dbe5162e25c6238690a2 | [
"Apache-2.0"
] | 3,787 | 2019-01-31T19:17:40.000Z | 2022-03-31T21:11:03.000Z | pkg/applicationserver/io/web/registry.go | mastermind88/lorawan-stack | c09a63b9d8a613f61734dbe5162e25c6238690a2 | [
"Apache-2.0"
] | 276 | 2019-01-31T16:32:16.000Z | 2022-03-23T00:48:52.000Z | // Copyright ยฉ 2021 The Things Network Foundation, The Things Industries B.V.
//
// 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 web
import (
"context"
"go.thethings.network/lorawan-stack/v3/pkg/ttnpb"
)
// WebhookRegistry is a store for webhooks.
type WebhookRegistry interface {
// Get returns the webhook by its identifiers.
Get(ctx context.Context, ids *ttnpb.ApplicationWebhookIdentifiers, paths []string) (*ttnpb.ApplicationWebhook, error)
// List returns all webhooks of the application.
List(ctx context.Context, ids *ttnpb.ApplicationIdentifiers, paths []string) ([]*ttnpb.ApplicationWebhook, error)
// Set creates, updates or deletes the webhook by its identifiers.
Set(ctx context.Context, ids *ttnpb.ApplicationWebhookIdentifiers, paths []string, f func(*ttnpb.ApplicationWebhook) (*ttnpb.ApplicationWebhook, []string, error)) (*ttnpb.ApplicationWebhook, error)
// Range ranges over the webhooks and calls the callback function, until false is returned.
Range(ctx context.Context, paths []string, f func(context.Context, ttnpb.ApplicationIdentifiers, *ttnpb.ApplicationWebhook) bool) error
}
| 48.029412 | 198 | 0.768524 |
3f49d1f32b1ccbac8e545b3c167b7095501c2935 | 74,545 | swift | Swift | Sources/Bluetooth/DefinedUUIDExtension.swift | ksinghal/Bluetooth | 6e99685bb22b532536dac6187faa3287671c83ae | [
"MIT"
] | 105 | 2016-04-02T05:53:55.000Z | 2022-03-28T04:46:12.000Z | Sources/BluetoothWeb/Bluetooth/DefinedUUIDExtension.swift | PureSwift/BluetoothWeb | 79e971fe659888e993c17ea153f3fe54ace432ea | [
"MIT"
] | 107 | 2018-03-15T03:24:18.000Z | 2021-11-13T21:37:12.000Z | Sources/BluetoothWeb/Bluetooth/DefinedUUIDExtension.swift | PureSwift/BluetoothWeb | 79e971fe659888e993c17ea153f3fe54ace432ea | [
"MIT"
] | 22 | 2016-06-18T11:01:20.000Z | 2022-02-24T08:50:26.000Z | //
// DefinedUUIDExtension.swift
// Bluetooth
//
// Generated by Alsey Coleman Miller on 5/29/20.
//
public extension BluetoothUUID {
/// SDP (`0x0001`)
static var sdp: BluetoothUUID {
return .bit16(0x0001)
}
/// RFCOMM (`0x0003`)
static var rfcomm: BluetoothUUID {
return .bit16(0x0003)
}
/// TCS-BIN (`0x0005`)
static var tcsBin: BluetoothUUID {
return .bit16(0x0005)
}
/// ATT (`0x0007`)
static var att: BluetoothUUID {
return .bit16(0x0007)
}
/// OBEX (`0x0008`)
static var obex: BluetoothUUID {
return .bit16(0x0008)
}
/// BNEP (`0x000F`)
static var bnep: BluetoothUUID {
return .bit16(0x000F)
}
/// UPNP (`0x0010`)
static var upnp: BluetoothUUID {
return .bit16(0x0010)
}
/// HIDP (`0x0011`)
static var hidp: BluetoothUUID {
return .bit16(0x0011)
}
/// Hardcopy Control Channel (`0x0012`)
static var hardcopyControlChannel: BluetoothUUID {
return .bit16(0x0012)
}
/// Hardcopy Data Channel (`0x0014`)
static var hardcopyDataChannel: BluetoothUUID {
return .bit16(0x0014)
}
/// Hardcopy Notification (`0x0016`)
static var hardcopyNotification: BluetoothUUID {
return .bit16(0x0016)
}
/// AVCTP (`0x0017`)
static var avctp: BluetoothUUID {
return .bit16(0x0017)
}
/// AVDTP (`0x0019`)
static var avdtp: BluetoothUUID {
return .bit16(0x0019)
}
/// CMTP (`0x001B`)
static var cmtp: BluetoothUUID {
return .bit16(0x001B)
}
/// MCAP Control Channel (`0x001E`)
static var mcapControlChannel: BluetoothUUID {
return .bit16(0x001E)
}
/// MCAP Data Channel (`0x001F`)
static var mcapDataChannel: BluetoothUUID {
return .bit16(0x001F)
}
/// L2CAP (`0x0100`)
static var l2Cap: BluetoothUUID {
return .bit16(0x0100)
}
/// Service Discovery Server Service Class (`0x1000`)
static var serviceDiscoveryServerServiceClass: BluetoothUUID {
return .bit16(0x1000)
}
/// Browse Group Descriptor Service Class (`0x1001`)
static var browseGroupDescriptorServiceClass: BluetoothUUID {
return .bit16(0x1001)
}
/// Public Browse Root (`0x1002`)
static var publicBrowseRoot: BluetoothUUID {
return .bit16(0x1002)
}
/// Serial Port (`0x1101`)
static var serialPort: BluetoothUUID {
return .bit16(0x1101)
}
/// LAN Access Using PPP (`0x1102`)
static var lanAccessUsingPpp: BluetoothUUID {
return .bit16(0x1102)
}
/// Dialup Networking (`0x1103`)
static var dialupNetworking: BluetoothUUID {
return .bit16(0x1103)
}
/// IrMC Sync (`0x1104`)
static var irmcSync: BluetoothUUID {
return .bit16(0x1104)
}
/// OBEX Object Push (`0x1105`)
static var obexObjectPush: BluetoothUUID {
return .bit16(0x1105)
}
/// OBEX File Transfer (`0x1106`)
static var obexFileTransfer: BluetoothUUID {
return .bit16(0x1106)
}
/// IrMC Sync Command (`0x1107`)
static var irmcSyncCommand: BluetoothUUID {
return .bit16(0x1107)
}
/// Headset (`0x1108`)
static var headset: BluetoothUUID {
return .bit16(0x1108)
}
/// Cordless Telephony (`0x1109`)
static var cordlessTelephony: BluetoothUUID {
return .bit16(0x1109)
}
/// Audio Source (`0x110A`)
static var audioSource: BluetoothUUID {
return .bit16(0x110A)
}
/// Audio Sink (`0x110B`)
static var audioSink: BluetoothUUID {
return .bit16(0x110B)
}
/// A/V Remote Control Target (`0x110C`)
static var avRemoteControlTarget: BluetoothUUID {
return .bit16(0x110C)
}
/// Advanced Audio Distribution (`0x110D`)
static var advancedAudioDistribution: BluetoothUUID {
return .bit16(0x110D)
}
/// A/V Remote Control (`0x110E`)
static var avRemoteControl: BluetoothUUID {
return .bit16(0x110E)
}
/// A/V Remote Control Controller (`0x110F`)
static var avRemoteControlController: BluetoothUUID {
return .bit16(0x110F)
}
/// Intercom (`0x1110`)
static var intercom: BluetoothUUID {
return .bit16(0x1110)
}
/// Fax (`0x1111`)
static var fax: BluetoothUUID {
return .bit16(0x1111)
}
/// Headset AG (`0x1112`)
static var headset2: BluetoothUUID {
return .bit16(0x1112)
}
/// WAP (`0x1113`)
static var wap: BluetoothUUID {
return .bit16(0x1113)
}
/// WAP Client (`0x1114`)
static var wapClient: BluetoothUUID {
return .bit16(0x1114)
}
/// PANU (`0x1115`)
static var panu: BluetoothUUID {
return .bit16(0x1115)
}
/// NAP (`0x1116`)
static var nap: BluetoothUUID {
return .bit16(0x1116)
}
/// GN (`0x1117`)
static var gn: BluetoothUUID {
return .bit16(0x1117)
}
/// Direct Printing (`0x1118`)
static var directPrinting: BluetoothUUID {
return .bit16(0x1118)
}
/// Reference Printing (`0x1119`)
static var referencePrinting: BluetoothUUID {
return .bit16(0x1119)
}
/// Basic Imaging Profile (`0x111A`)
static var basicImagingProfile: BluetoothUUID {
return .bit16(0x111A)
}
/// Imaging Responder (`0x111B`)
static var imagingResponder: BluetoothUUID {
return .bit16(0x111B)
}
/// Imaging Automatic Archive (`0x111C`)
static var imagingAutomaticArchive: BluetoothUUID {
return .bit16(0x111C)
}
/// Imaging Referenced Objects (`0x111D`)
static var imagingReferencedObjects: BluetoothUUID {
return .bit16(0x111D)
}
/// Handsfree (`0x111E`)
static var handsfree: BluetoothUUID {
return .bit16(0x111E)
}
/// Handsfree Audio Gateway (`0x111F`)
static var handsfreeAudioGateway: BluetoothUUID {
return .bit16(0x111F)
}
/// Direct Printing Refrence Objects Service (`0x1120`)
static var directPrintingRefrenceObjectsService: BluetoothUUID {
return .bit16(0x1120)
}
/// Reflected UI (`0x1121`)
static var reflectedUi: BluetoothUUID {
return .bit16(0x1121)
}
/// Basic Printing (`0x1122`)
static var basicPrinting: BluetoothUUID {
return .bit16(0x1122)
}
/// Printing Status (`0x1123`)
static var printingStatus: BluetoothUUID {
return .bit16(0x1123)
}
/// Human Interface Device Service (`0x1124`)
static var humanInterfaceDeviceService: BluetoothUUID {
return .bit16(0x1124)
}
/// Hardcopy Cable Replacement (`0x1125`)
static var hardcopyCableReplacement: BluetoothUUID {
return .bit16(0x1125)
}
/// HCR Print (`0x1126`)
static var hcrPrint: BluetoothUUID {
return .bit16(0x1126)
}
/// HCR Scan (`0x1127`)
static var hcrScan: BluetoothUUID {
return .bit16(0x1127)
}
/// Common ISDN Access (`0x1128`)
static var commonIsdnAccess: BluetoothUUID {
return .bit16(0x1128)
}
/// SIM Access (`0x112D`)
static var simAccess: BluetoothUUID {
return .bit16(0x112D)
}
/// Phonebook Access Client (`0x112E`)
static var phonebookAccessClient: BluetoothUUID {
return .bit16(0x112E)
}
/// Phonebook Access Server (`0x112F`)
static var phonebookAccessServer: BluetoothUUID {
return .bit16(0x112F)
}
/// Phonebook Access (`0x1130`)
static var phonebookAccess: BluetoothUUID {
return .bit16(0x1130)
}
/// Headset HS (`0x1131`)
static var headsetHs: BluetoothUUID {
return .bit16(0x1131)
}
/// Message Access Server (`0x1132`)
static var messageAccessServer: BluetoothUUID {
return .bit16(0x1132)
}
/// Message Notification Server (`0x1133`)
static var messageNotificationServer: BluetoothUUID {
return .bit16(0x1133)
}
/// Message Access Profile (`0x1134`)
static var messageAccessProfile: BluetoothUUID {
return .bit16(0x1134)
}
/// GNSS (`0x1135`)
static var gnss: BluetoothUUID {
return .bit16(0x1135)
}
/// GNSS Server (`0x1136`)
static var gnssServer: BluetoothUUID {
return .bit16(0x1136)
}
/// 3D Display (`0x1137`)
static var uuid3Ddisplay: BluetoothUUID {
return .bit16(0x1137)
}
/// 3D Glasses (`0x1138`)
static var uuid3Dglasses: BluetoothUUID {
return .bit16(0x1138)
}
/// 3D Synchronization (`0x1139`)
static var uuid3Dsynchronization: BluetoothUUID {
return .bit16(0x1139)
}
/// MPS Profile (`0x113A`)
static var mpsProfile: BluetoothUUID {
return .bit16(0x113A)
}
/// MPS Service (`0x113B`)
static var mpsService: BluetoothUUID {
return .bit16(0x113B)
}
/// PnP Information (`0x1200`)
static var pnpInformation: BluetoothUUID {
return .bit16(0x1200)
}
/// Generic Networking (`0x1201`)
static var genericNetworking: BluetoothUUID {
return .bit16(0x1201)
}
/// Generic File Transfer (`0x1202`)
static var genericFileTransfer: BluetoothUUID {
return .bit16(0x1202)
}
/// Generic Audio (`0x1203`)
static var genericAudio: BluetoothUUID {
return .bit16(0x1203)
}
/// Generic Telephony (`0x1204`)
static var genericTelephony: BluetoothUUID {
return .bit16(0x1204)
}
/// UPNP Service (`0x1205`)
static var upnpService: BluetoothUUID {
return .bit16(0x1205)
}
/// UPNP IP Service (`0x1206`)
static var upnpIpService: BluetoothUUID {
return .bit16(0x1206)
}
/// UPNP IP PAN (`0x1300`)
static var upnpIpPan: BluetoothUUID {
return .bit16(0x1300)
}
/// UPNP IP LAP (`0x1301`)
static var upnpIpLap: BluetoothUUID {
return .bit16(0x1301)
}
/// UPNP IP L2CAP (`0x1302`)
static var upnpIpL2Cap: BluetoothUUID {
return .bit16(0x1302)
}
/// Video Source (`0x1303`)
static var videoSource: BluetoothUUID {
return .bit16(0x1303)
}
/// Video Sink (`0x1304`)
static var videoSink: BluetoothUUID {
return .bit16(0x1304)
}
/// Video Distribution (`0x1305`)
static var videoDistribution: BluetoothUUID {
return .bit16(0x1305)
}
/// HDP (`0x1400`)
static var hdp: BluetoothUUID {
return .bit16(0x1400)
}
/// HDP Source (`0x1401`)
static var hdpSource: BluetoothUUID {
return .bit16(0x1401)
}
/// HDP Sink (`0x1402`)
static var hdpSink: BluetoothUUID {
return .bit16(0x1402)
}
/// Generic Access Profile (`0x1800`)
static var genericAccessProfile: BluetoothUUID {
return .bit16(0x1800)
}
/// Generic Attribute Profile (`0x1801`)
static var genericAttributeProfile: BluetoothUUID {
return .bit16(0x1801)
}
/// Immediate Alert (`0x1802`)
static var immediateAlert: BluetoothUUID {
return .bit16(0x1802)
}
/// Link Loss (`0x1803`)
static var linkLoss: BluetoothUUID {
return .bit16(0x1803)
}
/// Tx Power (`0x1804`)
static var txPower: BluetoothUUID {
return .bit16(0x1804)
}
/// Current Time Service (`0x1805`)
static var currentTimeService: BluetoothUUID {
return .bit16(0x1805)
}
/// Reference Time Update Service (`0x1806`)
static var referenceTimeUpdateService: BluetoothUUID {
return .bit16(0x1806)
}
/// Next DST Change Service (`0x1807`)
static var nextDstChangeService: BluetoothUUID {
return .bit16(0x1807)
}
/// Glucose (`0x1808`)
static var glucose: BluetoothUUID {
return .bit16(0x1808)
}
/// Health Thermometer (`0x1809`)
static var healthThermometer: BluetoothUUID {
return .bit16(0x1809)
}
/// Device Information (`0x180A`)
static var deviceInformation: BluetoothUUID {
return .bit16(0x180A)
}
/// Heart Rate (`0x180D`)
static var heartRate: BluetoothUUID {
return .bit16(0x180D)
}
/// Phone Alert Status Service (`0x180E`)
static var phoneAlertStatusService: BluetoothUUID {
return .bit16(0x180E)
}
/// Battery Service (`0x180F`)
static var batteryService: BluetoothUUID {
return .bit16(0x180F)
}
/// Blood Pressure (`0x1810`)
static var bloodPressure: BluetoothUUID {
return .bit16(0x1810)
}
/// Alert Notification Service (`0x1811`)
static var alertNotificationService: BluetoothUUID {
return .bit16(0x1811)
}
/// Human Interface Device (`0x1812`)
static var humanInterfaceDevice: BluetoothUUID {
return .bit16(0x1812)
}
/// Scan Parameters (`0x1813`)
static var scanParameters: BluetoothUUID {
return .bit16(0x1813)
}
/// Running Speed and Cadence (`0x1814`)
static var runningSpeedAndCadence: BluetoothUUID {
return .bit16(0x1814)
}
/// Automation IO (`0x1815`)
static var automationIo: BluetoothUUID {
return .bit16(0x1815)
}
/// Cycling Speed and Cadence (`0x1816`)
static var cyclingSpeedAndCadence: BluetoothUUID {
return .bit16(0x1816)
}
/// Cycling Power (`0x1818`)
static var cyclingPower: BluetoothUUID {
return .bit16(0x1818)
}
/// Location and Navigation (`0x1819`)
static var locationAndNavigation: BluetoothUUID {
return .bit16(0x1819)
}
/// Environmental Sensing (`0x181A`)
static var environmentalSensing: BluetoothUUID {
return .bit16(0x181A)
}
/// Body Composition (`0x181B`)
static var bodyComposition: BluetoothUUID {
return .bit16(0x181B)
}
/// User Data (`0x181C`)
static var userData: BluetoothUUID {
return .bit16(0x181C)
}
/// Weight Scale (`0x181D`)
static var weightScale: BluetoothUUID {
return .bit16(0x181D)
}
/// Bond Management (`0x181E`)
static var bondManagement: BluetoothUUID {
return .bit16(0x181E)
}
/// Continuous Glucose Monitoring (`0x181F`)
static var continuousGlucoseMonitoring: BluetoothUUID {
return .bit16(0x181F)
}
/// Internet Protocol Support (`0x1820`)
static var internetProtocolSupport: BluetoothUUID {
return .bit16(0x1820)
}
/// Indoor Positioning (`0x1821`)
static var indoorPositioning: BluetoothUUID {
return .bit16(0x1821)
}
/// Pulse Oximeter (`0x1822`)
static var pulseOximeter: BluetoothUUID {
return .bit16(0x1822)
}
/// HTTP Proxy (`0x1823`)
static var httpProxy: BluetoothUUID {
return .bit16(0x1823)
}
/// Transport Discovery (`0x1824`)
static var transportDiscovery: BluetoothUUID {
return .bit16(0x1824)
}
/// Object Transfer (`0x1825`)
static var objectTransfer: BluetoothUUID {
return .bit16(0x1825)
}
/// Primary Service (`0x2800`)
static var primaryService: BluetoothUUID {
return .bit16(0x2800)
}
/// Secondary Service (`0x2801`)
static var secondaryService: BluetoothUUID {
return .bit16(0x2801)
}
/// Include (`0x2802`)
static var include: BluetoothUUID {
return .bit16(0x2802)
}
/// Characteristic (`0x2803`)
static var characteristic: BluetoothUUID {
return .bit16(0x2803)
}
/// Characteristic Extended Properties (`0x2900`)
static var characteristicExtendedProperties: BluetoothUUID {
return .bit16(0x2900)
}
/// Characteristic User Description (`0x2901`)
static var characteristicUserDescription: BluetoothUUID {
return .bit16(0x2901)
}
/// Client Characteristic Configuration (`0x2902`)
static var clientCharacteristicConfiguration: BluetoothUUID {
return .bit16(0x2902)
}
/// Server Characteristic Configuration (`0x2903`)
static var serverCharacteristicConfiguration: BluetoothUUID {
return .bit16(0x2903)
}
/// Characteristic Format (`0x2904`)
static var characteristicFormat: BluetoothUUID {
return .bit16(0x2904)
}
/// Characteristic Aggregate Format (`0x2905`)
static var characteristicAggregateFormat: BluetoothUUID {
return .bit16(0x2905)
}
/// Valid Range (`0x2906`)
static var validRange: BluetoothUUID {
return .bit16(0x2906)
}
/// External Report Reference (`0x2907`)
static var externalReportReference: BluetoothUUID {
return .bit16(0x2907)
}
/// Report Reference (`0x2908`)
static var reportReference: BluetoothUUID {
return .bit16(0x2908)
}
/// Number of Digitals (`0x2909`)
static var numberOfDigitals: BluetoothUUID {
return .bit16(0x2909)
}
/// Value Trigger Setting (`0x290A`)
static var valueTriggerSetting: BluetoothUUID {
return .bit16(0x290A)
}
/// Environmental Sensing Configuration (`0x290B`)
static var environmentalSensingConfiguration: BluetoothUUID {
return .bit16(0x290B)
}
/// Environmental Sensing Measurement (`0x290C`)
static var environmentalSensingMeasurement: BluetoothUUID {
return .bit16(0x290C)
}
/// Environmental Sensing Trigger Setting (`0x290D`)
static var environmentalSensingTriggerSetting: BluetoothUUID {
return .bit16(0x290D)
}
/// Time Trigger Setting (`0x290E`)
static var timeTriggerSetting: BluetoothUUID {
return .bit16(0x290E)
}
/// Device Name (`0x2A00`)
static var deviceName: BluetoothUUID {
return .bit16(0x2A00)
}
/// Appearance (`0x2A01`)
static var appearance: BluetoothUUID {
return .bit16(0x2A01)
}
/// Peripheral Privacy Flag (`0x2A02`)
static var peripheralPrivacyFlag: BluetoothUUID {
return .bit16(0x2A02)
}
/// Reconnection Address (`0x2A03`)
static var reconnectionAddress: BluetoothUUID {
return .bit16(0x2A03)
}
/// Peripheral Preferred Connection Parameters (`0x2A04`)
static var peripheralPreferredConnectionParameters: BluetoothUUID {
return .bit16(0x2A04)
}
/// Service Changed (`0x2A05`)
static var serviceChanged: BluetoothUUID {
return .bit16(0x2A05)
}
/// Alert Level (`0x2A06`)
static var alertLevel: BluetoothUUID {
return .bit16(0x2A06)
}
/// Tx Power Level (`0x2A07`)
static var txPowerLevel: BluetoothUUID {
return .bit16(0x2A07)
}
/// Date Time (`0x2A08`)
static var dateTime: BluetoothUUID {
return .bit16(0x2A08)
}
/// Day of Week (`0x2A09`)
static var dayOfWeek: BluetoothUUID {
return .bit16(0x2A09)
}
/// Day Date Time (`0x2A0A`)
static var dayDateTime: BluetoothUUID {
return .bit16(0x2A0A)
}
/// Exact Time 100 (`0x2A0B`)
static var exactTime100: BluetoothUUID {
return .bit16(0x2A0B)
}
/// Exact Time 256 (`0x2A0C`)
static var exactTime256: BluetoothUUID {
return .bit16(0x2A0C)
}
/// DST Offset (`0x2A0D`)
static var dstOffset: BluetoothUUID {
return .bit16(0x2A0D)
}
/// Time Zone (`0x2A0E`)
static var timeZone: BluetoothUUID {
return .bit16(0x2A0E)
}
/// Local Time Information (`0x2A0F`)
static var localTimeInformation: BluetoothUUID {
return .bit16(0x2A0F)
}
/// Secondary Time Zone (`0x2A10`)
static var secondaryTimeZone: BluetoothUUID {
return .bit16(0x2A10)
}
/// Time with DST (`0x2A11`)
static var timeWithDst: BluetoothUUID {
return .bit16(0x2A11)
}
/// Time Accuracy (`0x2A12`)
static var timeAccuracy: BluetoothUUID {
return .bit16(0x2A12)
}
/// Time Source (`0x2A13`)
static var timeSource: BluetoothUUID {
return .bit16(0x2A13)
}
/// Reference Time Information (`0x2A14`)
static var referenceTimeInformation: BluetoothUUID {
return .bit16(0x2A14)
}
/// Time Broadcast (`0x2A15`)
static var timeBroadcast: BluetoothUUID {
return .bit16(0x2A15)
}
/// Time Update Control Point (`0x2A16`)
static var timeUpdateControlPoint: BluetoothUUID {
return .bit16(0x2A16)
}
/// Time Update State (`0x2A17`)
static var timeUpdateState: BluetoothUUID {
return .bit16(0x2A17)
}
/// Glucose Measurement (`0x2A18`)
static var glucoseMeasurement: BluetoothUUID {
return .bit16(0x2A18)
}
/// Battery Level (`0x2A19`)
static var batteryLevel: BluetoothUUID {
return .bit16(0x2A19)
}
/// Battery Power State (`0x2A1A`)
static var batteryPowerState: BluetoothUUID {
return .bit16(0x2A1A)
}
/// Battery Level State (`0x2A1B`)
static var batteryLevelState: BluetoothUUID {
return .bit16(0x2A1B)
}
/// Temperature Measurement (`0x2A1C`)
static var temperatureMeasurement: BluetoothUUID {
return .bit16(0x2A1C)
}
/// Temperature Type (`0x2A1D`)
static var temperatureType: BluetoothUUID {
return .bit16(0x2A1D)
}
/// Intermediate Temperature (`0x2A1E`)
static var intermediateTemperature: BluetoothUUID {
return .bit16(0x2A1E)
}
/// Measurement Interval (`0x2A21`)
static var measurementInterval: BluetoothUUID {
return .bit16(0x2A21)
}
/// Boot Keyboard Input Report (`0x2A22`)
static var bootKeyboardInputReport: BluetoothUUID {
return .bit16(0x2A22)
}
/// System ID (`0x2A23`)
static var systemId: BluetoothUUID {
return .bit16(0x2A23)
}
/// Model Number String (`0x2A24`)
static var modelNumberString: BluetoothUUID {
return .bit16(0x2A24)
}
/// Serial Number String (`0x2A25`)
static var serialNumberString: BluetoothUUID {
return .bit16(0x2A25)
}
/// Firmware Revision String (`0x2A26`)
static var firmwareRevisionString: BluetoothUUID {
return .bit16(0x2A26)
}
/// Hardware Revision String (`0x2A27`)
static var hardwareRevisionString: BluetoothUUID {
return .bit16(0x2A27)
}
/// Software Revision String (`0x2A28`)
static var softwareRevisionString: BluetoothUUID {
return .bit16(0x2A28)
}
/// Manufacturer Name String (`0x2A29`)
static var manufacturerNameString: BluetoothUUID {
return .bit16(0x2A29)
}
/// IEEE 11073-20601 Regulatory Cert. Data List (`0x2A2A`)
static var ieee1107320601RegulatoryCertDataList: BluetoothUUID {
return .bit16(0x2A2A)
}
/// Current Time (`0x2A2B`)
static var currentTime: BluetoothUUID {
return .bit16(0x2A2B)
}
/// Magnetic Declination (`0x2A2C`)
static var magneticDeclination: BluetoothUUID {
return .bit16(0x2A2C)
}
/// Scan Refresh (`0x2A31`)
static var scanRefresh: BluetoothUUID {
return .bit16(0x2A31)
}
/// Boot Keyboard Output Report (`0x2A32`)
static var bootKeyboardOutputReport: BluetoothUUID {
return .bit16(0x2A32)
}
/// Boot Mouse Input Report (`0x2A33`)
static var bootMouseInputReport: BluetoothUUID {
return .bit16(0x2A33)
}
/// Glucose Measurement Context (`0x2A34`)
static var glucoseMeasurementContext: BluetoothUUID {
return .bit16(0x2A34)
}
/// Blood Pressure Measurement (`0x2A35`)
static var bloodPressureMeasurement: BluetoothUUID {
return .bit16(0x2A35)
}
/// Intermediate Cuff Pressure (`0x2A36`)
static var intermediateCuffPressure: BluetoothUUID {
return .bit16(0x2A36)
}
/// Heart Rate Measurement (`0x2A37`)
static var heartRateMeasurement: BluetoothUUID {
return .bit16(0x2A37)
}
/// Body Sensor Location (`0x2A38`)
static var bodySensorLocation: BluetoothUUID {
return .bit16(0x2A38)
}
/// Heart Rate Control Point (`0x2A39`)
static var heartRateControlPoint: BluetoothUUID {
return .bit16(0x2A39)
}
/// Alert Status (`0x2A3F`)
static var alertStatus: BluetoothUUID {
return .bit16(0x2A3F)
}
/// Ringer Control Point (`0x2A40`)
static var ringerControlPoint: BluetoothUUID {
return .bit16(0x2A40)
}
/// Ringer Setting (`0x2A41`)
static var ringerSetting: BluetoothUUID {
return .bit16(0x2A41)
}
/// Alert Category ID Bit Mask (`0x2A42`)
static var alertCategoryIdBitMask: BluetoothUUID {
return .bit16(0x2A42)
}
/// Alert Category ID (`0x2A43`)
static var alertCategoryId: BluetoothUUID {
return .bit16(0x2A43)
}
/// Alert Notification Control Point (`0x2A44`)
static var alertNotificationControlPoint: BluetoothUUID {
return .bit16(0x2A44)
}
/// Unread Alert Status (`0x2A45`)
static var unreadAlertStatus: BluetoothUUID {
return .bit16(0x2A45)
}
/// New Alert (`0x2A46`)
static var newAlert: BluetoothUUID {
return .bit16(0x2A46)
}
/// Supported New Alert Category (`0x2A47`)
static var supportedNewAlertCategory: BluetoothUUID {
return .bit16(0x2A47)
}
/// Supported Unread Alert Category (`0x2A48`)
static var supportedUnreadAlertCategory: BluetoothUUID {
return .bit16(0x2A48)
}
/// Blood Pressure Feature (`0x2A49`)
static var bloodPressureFeature: BluetoothUUID {
return .bit16(0x2A49)
}
/// HID Information (`0x2A4A`)
static var hidInformation: BluetoothUUID {
return .bit16(0x2A4A)
}
/// Report Map (`0x2A4B`)
static var reportMap: BluetoothUUID {
return .bit16(0x2A4B)
}
/// HID Control Point (`0x2A4C`)
static var hidControlPoint: BluetoothUUID {
return .bit16(0x2A4C)
}
/// Report (`0x2A4D`)
static var report: BluetoothUUID {
return .bit16(0x2A4D)
}
/// Protocol Mode (`0x2A4E`)
static var protocolMode: BluetoothUUID {
return .bit16(0x2A4E)
}
/// Scan Interval Window (`0x2A4F`)
static var scanIntervalWindow: BluetoothUUID {
return .bit16(0x2A4F)
}
/// PnP ID (`0x2A50`)
static var pnpId: BluetoothUUID {
return .bit16(0x2A50)
}
/// Glucose Feature (`0x2A51`)
static var glucoseFeature: BluetoothUUID {
return .bit16(0x2A51)
}
/// Record Access Control Point (`0x2A52`)
static var recordAccessControlPoint: BluetoothUUID {
return .bit16(0x2A52)
}
/// RSC Measurement (`0x2A53`)
static var rscMeasurement: BluetoothUUID {
return .bit16(0x2A53)
}
/// RSC Feature (`0x2A54`)
static var rscFeature: BluetoothUUID {
return .bit16(0x2A54)
}
/// SC Control Point (`0x2A55`)
static var scControlPoint: BluetoothUUID {
return .bit16(0x2A55)
}
/// Digital (`0x2A56`)
static var digital: BluetoothUUID {
return .bit16(0x2A56)
}
/// Analog (`0x2A58`)
static var analog: BluetoothUUID {
return .bit16(0x2A58)
}
/// Analog Output (`0x2A59`)
static var analogOutput: BluetoothUUID {
return .bit16(0x2A59)
}
/// Aggregate (`0x2A5A`)
static var aggregate: BluetoothUUID {
return .bit16(0x2A5A)
}
/// CSC Measurement (`0x2A5B`)
static var cscMeasurement: BluetoothUUID {
return .bit16(0x2A5B)
}
/// CSC Feature (`0x2A5C`)
static var cscFeature: BluetoothUUID {
return .bit16(0x2A5C)
}
/// Sensor Location (`0x2A5D`)
static var sensorLocation: BluetoothUUID {
return .bit16(0x2A5D)
}
/// Cycling Power Measurement (`0x2A63`)
static var cyclingPowerMeasurement: BluetoothUUID {
return .bit16(0x2A63)
}
/// Cycling Power Vector (`0x2A64`)
static var cyclingPowerVector: BluetoothUUID {
return .bit16(0x2A64)
}
/// Cycling Power Feature (`0x2A65`)
static var cyclingPowerFeature: BluetoothUUID {
return .bit16(0x2A65)
}
/// Cycling Power Control Point (`0x2A66`)
static var cyclingPowerControlPoint: BluetoothUUID {
return .bit16(0x2A66)
}
/// Location and Speed (`0x2A67`)
static var locationAndSpeed: BluetoothUUID {
return .bit16(0x2A67)
}
/// Navigation (`0x2A68`)
static var navigation: BluetoothUUID {
return .bit16(0x2A68)
}
/// Position Quality (`0x2A69`)
static var positionQuality: BluetoothUUID {
return .bit16(0x2A69)
}
/// LN Feature (`0x2A6A`)
static var lnFeature: BluetoothUUID {
return .bit16(0x2A6A)
}
/// LN Control Point (`0x2A6B`)
static var lnControlPoint: BluetoothUUID {
return .bit16(0x2A6B)
}
/// Elevation (`0x2A6C`)
static var elevation: BluetoothUUID {
return .bit16(0x2A6C)
}
/// Pressure (`0x2A6D`)
static var pressure: BluetoothUUID {
return .bit16(0x2A6D)
}
/// Temperature (`0x2A6E`)
static var temperature: BluetoothUUID {
return .bit16(0x2A6E)
}
/// Humidity (`0x2A6F`)
static var humidity: BluetoothUUID {
return .bit16(0x2A6F)
}
/// True Wind Speed (`0x2A70`)
static var trueWindSpeed: BluetoothUUID {
return .bit16(0x2A70)
}
/// True Wind Direction (`0x2A71`)
static var trueWindDirection: BluetoothUUID {
return .bit16(0x2A71)
}
/// Apparent Wind Speed (`0x2A72`)
static var apparentWindSpeed: BluetoothUUID {
return .bit16(0x2A72)
}
/// Apparent Wind Direction (`0x2A73`)
static var apparentWindDirection: BluetoothUUID {
return .bit16(0x2A73)
}
/// Gust Factor (`0x2A74`)
static var gustFactor: BluetoothUUID {
return .bit16(0x2A74)
}
/// Pollen Concentration (`0x2A75`)
static var pollenConcentration: BluetoothUUID {
return .bit16(0x2A75)
}
/// UV Index (`0x2A76`)
static var uvIndex: BluetoothUUID {
return .bit16(0x2A76)
}
/// Irradiance (`0x2A77`)
static var irradiance: BluetoothUUID {
return .bit16(0x2A77)
}
/// Rainfall (`0x2A78`)
static var rainfall: BluetoothUUID {
return .bit16(0x2A78)
}
/// Wind Chill (`0x2A79`)
static var windChill: BluetoothUUID {
return .bit16(0x2A79)
}
/// Heat Index (`0x2A7A`)
static var heatIndex: BluetoothUUID {
return .bit16(0x2A7A)
}
/// Dew Point (`0x2A7B`)
static var dewPoint: BluetoothUUID {
return .bit16(0x2A7B)
}
/// Trend (`0x2A7C`)
static var trend: BluetoothUUID {
return .bit16(0x2A7C)
}
/// Descriptor Value Changed (`0x2A7D`)
static var descriptorValueChanged: BluetoothUUID {
return .bit16(0x2A7D)
}
/// Aerobic Heart Rate Lower Limit (`0x2A7E`)
static var aerobicHeartRateLowerLimit: BluetoothUUID {
return .bit16(0x2A7E)
}
/// Aerobic Threshold (`0x2A7F`)
static var aerobicThreshold: BluetoothUUID {
return .bit16(0x2A7F)
}
/// Age (`0x2A80`)
static var age: BluetoothUUID {
return .bit16(0x2A80)
}
/// Anaerobic Heart Rate Lower Limit (`0x2A81`)
static var anaerobicHeartRateLowerLimit: BluetoothUUID {
return .bit16(0x2A81)
}
/// Anaerobic Heart Rate Upper Limit (`0x2A82`)
static var anaerobicHeartRateUpperLimit: BluetoothUUID {
return .bit16(0x2A82)
}
/// Anaerobic Threshold (`0x2A83`)
static var anaerobicThreshold: BluetoothUUID {
return .bit16(0x2A83)
}
/// Aerobic Heart Rate Upper Limit (`0x2A84`)
static var aerobicHeartRateUpperLimit: BluetoothUUID {
return .bit16(0x2A84)
}
/// Date of Birth (`0x2A85`)
static var dateOfBirth: BluetoothUUID {
return .bit16(0x2A85)
}
/// Date of Threshold Assessment (`0x2A86`)
static var dateOfThresholdAssessment: BluetoothUUID {
return .bit16(0x2A86)
}
/// Email Address (`0x2A87`)
static var emailAddress: BluetoothUUID {
return .bit16(0x2A87)
}
/// Fat Burn Heart Rate Lower Limit (`0x2A88`)
static var fatBurnHeartRateLowerLimit: BluetoothUUID {
return .bit16(0x2A88)
}
/// Fat Burn Heart Rate Upper Limit (`0x2A89`)
static var fatBurnHeartRateUpperLimit: BluetoothUUID {
return .bit16(0x2A89)
}
/// First Name (`0x2A8A`)
static var firstName: BluetoothUUID {
return .bit16(0x2A8A)
}
/// Five Zone Heart Rate Limits (`0x2A8B`)
static var fiveZoneHeartRateLimits: BluetoothUUID {
return .bit16(0x2A8B)
}
/// Gender (`0x2A8C`)
static var gender: BluetoothUUID {
return .bit16(0x2A8C)
}
/// Heart Rate Max (`0x2A8D`)
static var heartRateMax: BluetoothUUID {
return .bit16(0x2A8D)
}
/// Height (`0x2A8E`)
static var height: BluetoothUUID {
return .bit16(0x2A8E)
}
/// Hip Circumference (`0x2A8F`)
static var hipCircumference: BluetoothUUID {
return .bit16(0x2A8F)
}
/// Last Name (`0x2A90`)
static var lastName: BluetoothUUID {
return .bit16(0x2A90)
}
/// Maximum Recommended Heart Rate (`0x2A91`)
static var maximumRecommendedHeartRate: BluetoothUUID {
return .bit16(0x2A91)
}
/// Resting Heart Rate (`0x2A92`)
static var restingHeartRate: BluetoothUUID {
return .bit16(0x2A92)
}
/// Sport Type for Aerobic/Anaerobic Thresholds (`0x2A93`)
static var sportTypeForAerobicAnaerobicThresholds: BluetoothUUID {
return .bit16(0x2A93)
}
/// Three Zone Heart Rate Limits (`0x2A94`)
static var threeZoneHeartRateLimits: BluetoothUUID {
return .bit16(0x2A94)
}
/// Two Zone Heart Rate Limit (`0x2A95`)
static var twoZoneHeartRateLimit: BluetoothUUID {
return .bit16(0x2A95)
}
/// VO2 Max (`0x2A96`)
static var vo2Max: BluetoothUUID {
return .bit16(0x2A96)
}
/// Waist Circumference (`0x2A97`)
static var waistCircumference: BluetoothUUID {
return .bit16(0x2A97)
}
/// Weight (`0x2A98`)
static var weight: BluetoothUUID {
return .bit16(0x2A98)
}
/// Database Change Increment (`0x2A99`)
static var databaseChangerement: BluetoothUUID {
return .bit16(0x2A99)
}
/// User Index (`0x2A9A`)
static var userIndex: BluetoothUUID {
return .bit16(0x2A9A)
}
/// Body Composition Feature (`0x2A9B`)
static var bodyCompositionFeature: BluetoothUUID {
return .bit16(0x2A9B)
}
/// Body Composition Measurement (`0x2A9C`)
static var bodyCompositionMeasurement: BluetoothUUID {
return .bit16(0x2A9C)
}
/// Weight Measurement (`0x2A9D`)
static var weightMeasurement: BluetoothUUID {
return .bit16(0x2A9D)
}
/// Weight Scale Feature (`0x2A9E`)
static var weightScaleFeature: BluetoothUUID {
return .bit16(0x2A9E)
}
/// User Control Point (`0x2A9F`)
static var userControlPoint: BluetoothUUID {
return .bit16(0x2A9F)
}
/// Magnetic Flux Density - 2D (`0x2AA0`)
static var magneticFluxDensity2D: BluetoothUUID {
return .bit16(0x2AA0)
}
/// Magnetic Flux Density - 3D (`0x2AA1`)
static var magneticFluxDensity3D: BluetoothUUID {
return .bit16(0x2AA1)
}
/// Language (`0x2AA2`)
static var language: BluetoothUUID {
return .bit16(0x2AA2)
}
/// Barometric Pressure Trend (`0x2AA3`)
static var barometricPressureTrend: BluetoothUUID {
return .bit16(0x2AA3)
}
/// Bond Management Control Point (`0x2AA4`)
static var bondManagementControlPoint: BluetoothUUID {
return .bit16(0x2AA4)
}
/// Bond Management Feature (`0x2AA5`)
static var bondManagementFeature: BluetoothUUID {
return .bit16(0x2AA5)
}
/// Central Address Resolution (`0x2AA6`)
static var centralAddressResolution: BluetoothUUID {
return .bit16(0x2AA6)
}
/// CGM Measurement (`0x2AA7`)
static var cgmMeasurement: BluetoothUUID {
return .bit16(0x2AA7)
}
/// CGM Feature (`0x2AA8`)
static var cgmFeature: BluetoothUUID {
return .bit16(0x2AA8)
}
/// CGM Status (`0x2AA9`)
static var cgmStatus: BluetoothUUID {
return .bit16(0x2AA9)
}
/// CGM Session Start Time (`0x2AAA`)
static var cgmSessionStartTime: BluetoothUUID {
return .bit16(0x2AAA)
}
/// CGM Session Run Time (`0x2AAB`)
static var cgmSessionRunTime: BluetoothUUID {
return .bit16(0x2AAB)
}
/// CGM Specific Ops Control Point (`0x2AAC`)
static var cgmSpecificOpsControlPoint: BluetoothUUID {
return .bit16(0x2AAC)
}
/// Indoor Positioning Configuration (`0x2AAD`)
static var indoorPositioningConfiguration: BluetoothUUID {
return .bit16(0x2AAD)
}
/// Latitude (`0x2AAE`)
static var latitude: BluetoothUUID {
return .bit16(0x2AAE)
}
/// Longitude (`0x2AAF`)
static var longitude: BluetoothUUID {
return .bit16(0x2AAF)
}
/// Local North Coordinate (`0x2AB0`)
static var localNorthCoordinate: BluetoothUUID {
return .bit16(0x2AB0)
}
/// Local East Coordinate (`0x2AB1`)
static var localEastCoordinate: BluetoothUUID {
return .bit16(0x2AB1)
}
/// Floor Number (`0x2AB2`)
static var floorNumber: BluetoothUUID {
return .bit16(0x2AB2)
}
/// Altitude (`0x2AB3`)
static var altitude: BluetoothUUID {
return .bit16(0x2AB3)
}
/// Uncertainty (`0x2AB4`)
static var uncertainty: BluetoothUUID {
return .bit16(0x2AB4)
}
/// Location Name (`0x2AB5`)
static var locationName: BluetoothUUID {
return .bit16(0x2AB5)
}
/// URI (`0x2AB6`)
static var uri: BluetoothUUID {
return .bit16(0x2AB6)
}
/// HTTP Headers (`0x2AB7`)
static var httpHeaders: BluetoothUUID {
return .bit16(0x2AB7)
}
/// HTTP Status Code (`0x2AB8`)
static var httpStatusCode: BluetoothUUID {
return .bit16(0x2AB8)
}
/// HTTP Entity Body (`0x2AB9`)
static var httpEntityBody: BluetoothUUID {
return .bit16(0x2AB9)
}
/// HTTP Control Point (`0x2ABA`)
static var httpControlPoint: BluetoothUUID {
return .bit16(0x2ABA)
}
/// HTTPS Security (`0x2ABB`)
static var httpsSecurity: BluetoothUUID {
return .bit16(0x2ABB)
}
/// TDS Control Point (`0x2ABC`)
static var tdsControlPoint: BluetoothUUID {
return .bit16(0x2ABC)
}
/// OTS Feature (`0x2ABD`)
static var otsFeature: BluetoothUUID {
return .bit16(0x2ABD)
}
/// Object Name (`0x2ABE`)
static var objectName: BluetoothUUID {
return .bit16(0x2ABE)
}
/// Object Type (`0x2ABF`)
static var objectType: BluetoothUUID {
return .bit16(0x2ABF)
}
/// Object Size (`0x2AC0`)
static var objectSize: BluetoothUUID {
return .bit16(0x2AC0)
}
/// Object First-Created (`0x2AC1`)
static var objectFirstCreated: BluetoothUUID {
return .bit16(0x2AC1)
}
/// Object Last-Modified (`0x2AC2`)
static var objectLastModified: BluetoothUUID {
return .bit16(0x2AC2)
}
/// Object ID (`0x2AC3`)
static var objectId: BluetoothUUID {
return .bit16(0x2AC3)
}
/// Object Properties (`0x2AC4`)
static var objectProperties: BluetoothUUID {
return .bit16(0x2AC4)
}
/// Object Action Control Point (`0x2AC5`)
static var objectActionControlPoint: BluetoothUUID {
return .bit16(0x2AC5)
}
/// Object List Control Point (`0x2AC6`)
static var objectListControlPoint: BluetoothUUID {
return .bit16(0x2AC6)
}
/// Object List Filter (`0x2AC7`)
static var objectListFilter: BluetoothUUID {
return .bit16(0x2AC7)
}
/// Object Changed (`0x2AC8`)
static var objectChanged: BluetoothUUID {
return .bit16(0x2AC8)
}
/// Cross Trainer Data (`0x2ACE`)
static var crossTrainerData: BluetoothUUID {
return .bit16(0x2ACE)
}
/// Date UTC (`0x2AED`)
static var dateUtc: BluetoothUUID {
return .bit16(0x2AED)
}
/// Abbott Diabetes Care (`0xFDE3`)
static var abbottDiabetesCare: BluetoothUUID {
return .bit16(0xFDE3)
}
/// JUUL Labs, Inc. (`0xFDE4`)
static var juulLabs: BluetoothUUID {
return .bit16(0xFDE4)
}
/// SMK Corporation (`0xFDE5`)
static var smk: BluetoothUUID {
return .bit16(0xFDE5)
}
/// Intelletto Technologies Inc (`0xFDE6`)
static var intellettoTechnologies: BluetoothUUID {
return .bit16(0xFDE6)
}
/// SECOM Co., LTD (`0xFDE7`)
static var secom: BluetoothUUID {
return .bit16(0xFDE7)
}
/// Robert Bosch GmbH (`0xFDE8`)
static var robertBosch: BluetoothUUID {
return .bit16(0xFDE8)
}
/// Spacesaver Corporation (`0xFDE9`)
static var spacesaver: BluetoothUUID {
return .bit16(0xFDE9)
}
/// SeeScan, Inc (`0xFDEA`)
static var seescan: BluetoothUUID {
return .bit16(0xFDEA)
}
/// Syntronix Corporation (`0xFDEB`)
static var syntronix: BluetoothUUID {
return .bit16(0xFDEB)
}
/// Mannkind Corporation (`0xFDEC`)
static var mannkind: BluetoothUUID {
return .bit16(0xFDEC)
}
/// Pole Star (`0xFDED`)
static var poleStar: BluetoothUUID {
return .bit16(0xFDED)
}
/// Huawei Technologies Co., Ltd. (`0xFDEE`)
static var huaweiTechnologies: BluetoothUUID {
return .bit16(0xFDEE)
}
/// ART AND PROGRAM, INC. (`0xFDEF`)
static var artAndProgram: BluetoothUUID {
return .bit16(0xFDEF)
}
/// Google Inc. (`0xFDF0`)
static var google: BluetoothUUID {
return .bit16(0xFDF0)
}
/// LAMPLIGHT Co.,Ltd (`0xFDF1`)
static var lamplight: BluetoothUUID {
return .bit16(0xFDF1)
}
/// AMICCOM Electronics Corporation (`0xFDF2`)
static var amiccomElectronics: BluetoothUUID {
return .bit16(0xFDF2)
}
/// Amersports (`0xFDF3`)
static var amersports: BluetoothUUID {
return .bit16(0xFDF3)
}
/// O. E. M. Controls, Inc. (`0xFDF4`)
static var oEMControls: BluetoothUUID {
return .bit16(0xFDF4)
}
/// Milwaukee Electric Tools (`0xFDF5`)
static var milwaukeeElectricTools: BluetoothUUID {
return .bit16(0xFDF5)
}
/// AIAIAI ApS (`0xFDF6`)
static var aiaiai: BluetoothUUID {
return .bit16(0xFDF6)
}
/// HP Inc. (`0xFDF7`)
static var hp: BluetoothUUID {
return .bit16(0xFDF7)
}
/// Onvocal (`0xFDF8`)
static var onvocal: BluetoothUUID {
return .bit16(0xFDF8)
}
/// INIA (`0xFDF9`)
static var inia: BluetoothUUID {
return .bit16(0xFDF9)
}
/// Tandem Diabetes Care (`0xFDFA`)
static var tandemDiabetesCare: BluetoothUUID {
return .bit16(0xFDFA)
}
/// Tandem Diabetes Care (`0xFDFB`)
static var tandemDiabetesCare2: BluetoothUUID {
return .bit16(0xFDFB)
}
/// Optrel AG (`0xFDFC`)
static var optrel: BluetoothUUID {
return .bit16(0xFDFC)
}
/// RecursiveSoft Inc. (`0xFDFD`)
static var recursivesoft: BluetoothUUID {
return .bit16(0xFDFD)
}
/// ADHERIUM(NZ) LIMITED (`0xFDFE`)
static var adheriumNzLimited: BluetoothUUID {
return .bit16(0xFDFE)
}
/// OSRAM GmbH (`0xFDFF`)
static var osram: BluetoothUUID {
return .bit16(0xFDFF)
}
/// Amazon.com Services, Inc. (`0xFE00`)
static var amazon: BluetoothUUID {
return .bit16(0xFE00)
}
/// Duracell U.S. Operations Inc. (`0xFE01`)
static var duracellUSOperations: BluetoothUUID {
return .bit16(0xFE01)
}
/// Robert Bosch GmbH (`0xFE02`)
static var robertBosch2: BluetoothUUID {
return .bit16(0xFE02)
}
/// Amazon.com Services, Inc. (`0xFE03`)
static var amazon2: BluetoothUUID {
return .bit16(0xFE03)
}
/// OpenPath Security Inc (`0xFE04`)
static var openpathSecurity: BluetoothUUID {
return .bit16(0xFE04)
}
/// CORE Transport Technologies NZ Limited (`0xFE05`)
static var coreTransportTechnologiesNz: BluetoothUUID {
return .bit16(0xFE05)
}
/// Qualcomm Technologies, Inc. (`0xFE06`)
static var qualcommTechnologies: BluetoothUUID {
return .bit16(0xFE06)
}
/// Microsoft (`0xFE08`)
static var microsoft: BluetoothUUID {
return .bit16(0xFE08)
}
/// Pillsy, Inc. (`0xFE09`)
static var pillsy: BluetoothUUID {
return .bit16(0xFE09)
}
/// ruwido austria gmbh (`0xFE0A`)
static var ruwidoAustria: BluetoothUUID {
return .bit16(0xFE0A)
}
/// ruwido austria gmbh (`0xFE0B`)
static var ruwidoAustria2: BluetoothUUID {
return .bit16(0xFE0B)
}
/// Procter & Gamble (`0xFE0C`)
static var procterGamble: BluetoothUUID {
return .bit16(0xFE0C)
}
/// Procter & Gamble (`0xFE0D`)
static var procterGamble2: BluetoothUUID {
return .bit16(0xFE0D)
}
/// Setec Pty Ltd (`0xFE0E`)
static var setecPty: BluetoothUUID {
return .bit16(0xFE0E)
}
/// Philips Lighting B.V. (`0xFE0F`)
static var philipsLighting: BluetoothUUID {
return .bit16(0xFE0F)
}
/// Lapis Semiconductor Co., Ltd. (`0xFE10`)
static var lapisSemiconductor: BluetoothUUID {
return .bit16(0xFE10)
}
/// GMC-I Messtechnik GmbH (`0xFE11`)
static var gmcIMesstechnik: BluetoothUUID {
return .bit16(0xFE11)
}
/// M-Way Solutions GmbH (`0xFE12`)
static var mWaySolutions: BluetoothUUID {
return .bit16(0xFE12)
}
/// Apple Inc. (`0xFE13`)
static var apple: BluetoothUUID {
return .bit16(0xFE13)
}
/// Flextronics International USA Inc. (`0xFE14`)
static var flextronicsInternationalUsa: BluetoothUUID {
return .bit16(0xFE14)
}
/// Amazon.com Services, Inc. (`0xFE15`)
static var amazon3: BluetoothUUID {
return .bit16(0xFE15)
}
/// Footmarks, Inc. (`0xFE16`)
static var footmarks: BluetoothUUID {
return .bit16(0xFE16)
}
/// Telit Wireless Solutions GmbH (`0xFE17`)
static var telitWirelessSolutions: BluetoothUUID {
return .bit16(0xFE17)
}
/// Runtime, Inc. (`0xFE18`)
static var runtime: BluetoothUUID {
return .bit16(0xFE18)
}
/// Google Inc. (`0xFE19`)
static var google2: BluetoothUUID {
return .bit16(0xFE19)
}
/// Tyto Life LLC (`0xFE1A`)
static var tytoLife: BluetoothUUID {
return .bit16(0xFE1A)
}
/// Tyto Life LLC (`0xFE1B`)
static var tytoLife2: BluetoothUUID {
return .bit16(0xFE1B)
}
/// NetMedia, Inc. (`0xFE1C`)
static var netmedia: BluetoothUUID {
return .bit16(0xFE1C)
}
/// Illuminati Instrument Corporation (`0xFE1D`)
static var illuminatiInstrument: BluetoothUUID {
return .bit16(0xFE1D)
}
/// Smart Innovations Co., Ltd (`0xFE1E`)
static var smartInnovations: BluetoothUUID {
return .bit16(0xFE1E)
}
/// Garmin International, Inc. (`0xFE1F`)
static var garminInternational: BluetoothUUID {
return .bit16(0xFE1F)
}
/// Emerson (`0xFE20`)
static var emerson: BluetoothUUID {
return .bit16(0xFE20)
}
/// Bose Corporation (`0xFE21`)
static var bose: BluetoothUUID {
return .bit16(0xFE21)
}
/// Zoll Medical Corporation (`0xFE22`)
static var zollMedical: BluetoothUUID {
return .bit16(0xFE22)
}
/// Zoll Medical Corporation (`0xFE23`)
static var zollMedical2: BluetoothUUID {
return .bit16(0xFE23)
}
/// August Home Inc (`0xFE24`)
static var augustHome: BluetoothUUID {
return .bit16(0xFE24)
}
/// Apple, Inc. (`0xFE25`)
static var apple2: BluetoothUUID {
return .bit16(0xFE25)
}
/// Google Inc. (`0xFE26`)
static var google3: BluetoothUUID {
return .bit16(0xFE26)
}
/// Google Inc. (`0xFE27`)
static var google4: BluetoothUUID {
return .bit16(0xFE27)
}
/// Ayla Networks (`0xFE28`)
static var aylaNetworks: BluetoothUUID {
return .bit16(0xFE28)
}
/// Gibson Innovations (`0xFE29`)
static var gibsonInnovations: BluetoothUUID {
return .bit16(0xFE29)
}
/// DaisyWorks, Inc. (`0xFE2A`)
static var daisyworks: BluetoothUUID {
return .bit16(0xFE2A)
}
/// ITT Industries (`0xFE2B`)
static var ittIndustries: BluetoothUUID {
return .bit16(0xFE2B)
}
/// Google Inc. (`0xFE2C`)
static var google5: BluetoothUUID {
return .bit16(0xFE2C)
}
/// SMART INNOVATION Co.,Ltd (`0xFE2D`)
static var smartInnovation: BluetoothUUID {
return .bit16(0xFE2D)
}
/// ERi,Inc. (`0xFE2E`)
static var eri: BluetoothUUID {
return .bit16(0xFE2E)
}
/// CRESCO Wireless, Inc (`0xFE2F`)
static var crescoWireless: BluetoothUUID {
return .bit16(0xFE2F)
}
/// Volkswagen AG (`0xFE30`)
static var volkswagen: BluetoothUUID {
return .bit16(0xFE30)
}
/// Volkswagen AG (`0xFE31`)
static var volkswagen2: BluetoothUUID {
return .bit16(0xFE31)
}
/// Pro-Mark, Inc. (`0xFE32`)
static var proMark: BluetoothUUID {
return .bit16(0xFE32)
}
/// CHIPOLO d.o.o. (`0xFE33`)
static var chipolo: BluetoothUUID {
return .bit16(0xFE33)
}
/// SmallLoop LLC (`0xFE34`)
static var smallloop: BluetoothUUID {
return .bit16(0xFE34)
}
/// HUAWEI Technologies Co., Ltd (`0xFE35`)
static var huaweiTechnologies2: BluetoothUUID {
return .bit16(0xFE35)
}
/// HUAWEI Technologies Co., Ltd (`0xFE36`)
static var huaweiTechnologies3: BluetoothUUID {
return .bit16(0xFE36)
}
/// Spaceek LTD (`0xFE37`)
static var spaceek: BluetoothUUID {
return .bit16(0xFE37)
}
/// Spaceek LTD (`0xFE38`)
static var spaceek2: BluetoothUUID {
return .bit16(0xFE38)
}
/// TTS Tooltechnic Systems AG & Co. (`0xFE39`)
static var ttsTooltechnicSystems: BluetoothUUID {
return .bit16(0xFE39)
}
/// TTS Tooltechnic Systems AG & Co. (`0xFE3A`)
static var ttsTooltechnicSystems2: BluetoothUUID {
return .bit16(0xFE3A)
}
/// Dolby Laboratories (`0xFE3B`)
static var dolbyLaboratories: BluetoothUUID {
return .bit16(0xFE3B)
}
/// Alibaba (`0xFE3C`)
static var alibaba: BluetoothUUID {
return .bit16(0xFE3C)
}
/// BD Medical (`0xFE3D`)
static var bdMedical: BluetoothUUID {
return .bit16(0xFE3D)
}
/// BD Medical (`0xFE3E`)
static var bdMedical2: BluetoothUUID {
return .bit16(0xFE3E)
}
/// Friday Labs Limited (`0xFE3F`)
static var fridayLabs: BluetoothUUID {
return .bit16(0xFE3F)
}
/// Inugo Systems Limited (`0xFE40`)
static var inugoSystems: BluetoothUUID {
return .bit16(0xFE40)
}
/// Inugo Systems Limited (`0xFE41`)
static var inugoSystems2: BluetoothUUID {
return .bit16(0xFE41)
}
/// Nets A/S (`0xFE42`)
static var nets: BluetoothUUID {
return .bit16(0xFE42)
}
/// Andreas Stihl AG & Co. KG (`0xFE43`)
static var andreasStihl: BluetoothUUID {
return .bit16(0xFE43)
}
/// SK Telecom (`0xFE44`)
static var skTelecom: BluetoothUUID {
return .bit16(0xFE44)
}
/// Snapchat Inc (`0xFE45`)
static var snapchat: BluetoothUUID {
return .bit16(0xFE45)
}
/// B&O Play A/S (`0xFE46`)
static var bOPlay: BluetoothUUID {
return .bit16(0xFE46)
}
/// General Motors (`0xFE47`)
static var generalMotors: BluetoothUUID {
return .bit16(0xFE47)
}
/// General Motors (`0xFE48`)
static var generalMotors2: BluetoothUUID {
return .bit16(0xFE48)
}
/// SenionLab AB (`0xFE49`)
static var senionlab: BluetoothUUID {
return .bit16(0xFE49)
}
/// OMRON HEALTHCARE Co., Ltd. (`0xFE4A`)
static var omronHealthcare: BluetoothUUID {
return .bit16(0xFE4A)
}
/// Philips Lighting B.V. (`0xFE4B`)
static var philipsLighting2: BluetoothUUID {
return .bit16(0xFE4B)
}
/// Volkswagen AG (`0xFE4C`)
static var volkswagen3: BluetoothUUID {
return .bit16(0xFE4C)
}
/// Casambi Technologies Oy (`0xFE4D`)
static var casambiTechnologies: BluetoothUUID {
return .bit16(0xFE4D)
}
/// NTT docomo (`0xFE4E`)
static var nttDocomo: BluetoothUUID {
return .bit16(0xFE4E)
}
/// Molekule, Inc. (`0xFE4F`)
static var molekule: BluetoothUUID {
return .bit16(0xFE4F)
}
/// Google Inc. (`0xFE50`)
static var google6: BluetoothUUID {
return .bit16(0xFE50)
}
/// SRAM (`0xFE51`)
static var sram: BluetoothUUID {
return .bit16(0xFE51)
}
/// SetPoint Medical (`0xFE52`)
static var setpointMedical: BluetoothUUID {
return .bit16(0xFE52)
}
/// 3M (`0xFE53`)
static var uuid3M: BluetoothUUID {
return .bit16(0xFE53)
}
/// Motiv, Inc. (`0xFE54`)
static var motiv: BluetoothUUID {
return .bit16(0xFE54)
}
/// Google Inc. (`0xFE55`)
static var google7: BluetoothUUID {
return .bit16(0xFE55)
}
/// Google Inc. (`0xFE56`)
static var google8: BluetoothUUID {
return .bit16(0xFE56)
}
/// Dotted Labs (`0xFE57`)
static var dottedLabs: BluetoothUUID {
return .bit16(0xFE57)
}
/// Nordic Semiconductor ASA (`0xFE58`)
static var nordicSemiconductor: BluetoothUUID {
return .bit16(0xFE58)
}
/// Nordic Semiconductor ASA (`0xFE59`)
static var nordicSemiconductor2: BluetoothUUID {
return .bit16(0xFE59)
}
/// Chronologics Corporation (`0xFE5A`)
static var chronologics: BluetoothUUID {
return .bit16(0xFE5A)
}
/// GT-tronics HK Ltd (`0xFE5B`)
static var gtTronicsHk: BluetoothUUID {
return .bit16(0xFE5B)
}
/// million hunters GmbH (`0xFE5C`)
static var millionHunters: BluetoothUUID {
return .bit16(0xFE5C)
}
/// Grundfos A/S (`0xFE5D`)
static var grundfos: BluetoothUUID {
return .bit16(0xFE5D)
}
/// Plastc Corporation (`0xFE5E`)
static var plastc: BluetoothUUID {
return .bit16(0xFE5E)
}
/// Eyefi, Inc. (`0xFE5F`)
static var eyefi: BluetoothUUID {
return .bit16(0xFE5F)
}
/// Lierda Science & Technology Group Co., Ltd. (`0xFE60`)
static var lierdaScienceTechnologyGroup: BluetoothUUID {
return .bit16(0xFE60)
}
/// Logitech International SA (`0xFE61`)
static var logitechInternational: BluetoothUUID {
return .bit16(0xFE61)
}
/// Indagem Tech LLC (`0xFE62`)
static var indagemTech: BluetoothUUID {
return .bit16(0xFE62)
}
/// Connected Yard, Inc. (`0xFE63`)
static var connectedYard: BluetoothUUID {
return .bit16(0xFE63)
}
/// Siemens AG (`0xFE64`)
static var siemens: BluetoothUUID {
return .bit16(0xFE64)
}
/// CHIPOLO d.o.o. (`0xFE65`)
static var chipolo2: BluetoothUUID {
return .bit16(0xFE65)
}
/// Intel Corporation (`0xFE66`)
static var intel: BluetoothUUID {
return .bit16(0xFE66)
}
/// Lab Sensor Solutions (`0xFE67`)
static var labSensorSolutions: BluetoothUUID {
return .bit16(0xFE67)
}
/// Qualcomm Life Inc (`0xFE68`)
static var qualcommLife: BluetoothUUID {
return .bit16(0xFE68)
}
/// Qualcomm Life Inc (`0xFE69`)
static var qualcommLife2: BluetoothUUID {
return .bit16(0xFE69)
}
/// Kontakt Micro-Location Sp. z o.o. (`0xFE6A`)
static var kontaktMicroLocation: BluetoothUUID {
return .bit16(0xFE6A)
}
/// TASER International, Inc. (`0xFE6B`)
static var taserInternational: BluetoothUUID {
return .bit16(0xFE6B)
}
/// TASER International, Inc. (`0xFE6C`)
static var taserInternational2: BluetoothUUID {
return .bit16(0xFE6C)
}
/// The University of Tokyo (`0xFE6D`)
static var universityOfTokyo: BluetoothUUID {
return .bit16(0xFE6D)
}
/// The University of Tokyo (`0xFE6E`)
static var universityOfTokyo2: BluetoothUUID {
return .bit16(0xFE6E)
}
/// LINE Corporation (`0xFE6F`)
static var line: BluetoothUUID {
return .bit16(0xFE6F)
}
/// Beijing Jingdong Century Trading Co., Ltd. (`0xFE70`)
static var beijingJingdongCenturyTrading: BluetoothUUID {
return .bit16(0xFE70)
}
/// Plume Design Inc (`0xFE71`)
static var plumeDesign: BluetoothUUID {
return .bit16(0xFE71)
}
/// St. Jude Medical, Inc. (`0xFE72`)
static var stJudeMedical: BluetoothUUID {
return .bit16(0xFE72)
}
/// St. Jude Medical, Inc. (`0xFE73`)
static var stJudeMedical2: BluetoothUUID {
return .bit16(0xFE73)
}
/// unwire (`0xFE74`)
static var unwire: BluetoothUUID {
return .bit16(0xFE74)
}
/// TangoMe (`0xFE75`)
static var tangome: BluetoothUUID {
return .bit16(0xFE75)
}
/// TangoMe (`0xFE76`)
static var tangome2: BluetoothUUID {
return .bit16(0xFE76)
}
/// Hewlett-Packard Company (`0xFE77`)
static var hewlettPackardCompany: BluetoothUUID {
return .bit16(0xFE77)
}
/// Hewlett-Packard Company (`0xFE78`)
static var hewlettPackardCompany2: BluetoothUUID {
return .bit16(0xFE78)
}
/// Zebra Technologies (`0xFE79`)
static var zebraTechnologies: BluetoothUUID {
return .bit16(0xFE79)
}
/// Bragi GmbH (`0xFE7A`)
static var bragi: BluetoothUUID {
return .bit16(0xFE7A)
}
/// Orion Labs, Inc. (`0xFE7B`)
static var orionLabs: BluetoothUUID {
return .bit16(0xFE7B)
}
/// Stollmann E+V GmbH (`0xFE7C`)
static var stollmannEV: BluetoothUUID {
return .bit16(0xFE7C)
}
/// Aterica Health Inc. (`0xFE7D`)
static var atericaHealth: BluetoothUUID {
return .bit16(0xFE7D)
}
/// Awear Solutions Ltd (`0xFE7E`)
static var awearSolutions: BluetoothUUID {
return .bit16(0xFE7E)
}
/// Doppler Lab (`0xFE7F`)
static var dopplerLab: BluetoothUUID {
return .bit16(0xFE7F)
}
/// Doppler Lab (`0xFE80`)
static var dopplerLab2: BluetoothUUID {
return .bit16(0xFE80)
}
/// Medtronic Inc. (`0xFE81`)
static var medtronic: BluetoothUUID {
return .bit16(0xFE81)
}
/// Medtronic Inc. (`0xFE82`)
static var medtronic2: BluetoothUUID {
return .bit16(0xFE82)
}
/// Blue Bite (`0xFE83`)
static var blueBite: BluetoothUUID {
return .bit16(0xFE83)
}
/// RF Digital Corp (`0xFE84`)
static var rfDigital: BluetoothUUID {
return .bit16(0xFE84)
}
/// RF Digital Corp (`0xFE85`)
static var rfDigital2: BluetoothUUID {
return .bit16(0xFE85)
}
/// HUAWEI Technologies Co., Ltd. ( ๅไธบๆๆฏๆ้ๅ
ฌๅธ ) (`0xFE86`)
static var huaweiTechnologiesๅไธบๆๆฏๆ้ๅ
ฌๅธ: BluetoothUUID {
return .bit16(0xFE86)
}
/// Qingdao Yeelink Information Technology Co., Ltd. ( ้ๅฒไบฟ่ๅฎขไฟกๆฏๆๆฏๆ้ๅ
ฌๅธ ) (`0xFE87`)
static var qingdaoYeelinkInformationTechnology้ๅฒไบฟ่ๅฎขไฟกๆฏๆๆฏๆ้ๅ
ฌๅธ: BluetoothUUID {
return .bit16(0xFE87)
}
/// SALTO SYSTEMS S.L. (`0xFE88`)
static var saltoSystems: BluetoothUUID {
return .bit16(0xFE88)
}
/// B&O Play A/S (`0xFE89`)
static var bOPlay2: BluetoothUUID {
return .bit16(0xFE89)
}
/// Apple, Inc. (`0xFE8A`)
static var apple3: BluetoothUUID {
return .bit16(0xFE8A)
}
/// Apple, Inc. (`0xFE8B`)
static var apple4: BluetoothUUID {
return .bit16(0xFE8B)
}
/// TRON Forum (`0xFE8C`)
static var tronForum: BluetoothUUID {
return .bit16(0xFE8C)
}
/// Interaxon Inc. (`0xFE8D`)
static var interaxon: BluetoothUUID {
return .bit16(0xFE8D)
}
/// ARM Ltd (`0xFE8E`)
static var arm: BluetoothUUID {
return .bit16(0xFE8E)
}
/// CSR (`0xFE8F`)
static var csr: BluetoothUUID {
return .bit16(0xFE8F)
}
/// JUMA (`0xFE90`)
static var juma: BluetoothUUID {
return .bit16(0xFE90)
}
/// Shanghai Imilab Technology Co.,Ltd (`0xFE91`)
static var shanghaiImilabTechnology: BluetoothUUID {
return .bit16(0xFE91)
}
/// Jarden Safety & Security (`0xFE92`)
static var jardenSafetySecurity: BluetoothUUID {
return .bit16(0xFE92)
}
/// OttoQ Inc. (`0xFE93`)
static var ottoq: BluetoothUUID {
return .bit16(0xFE93)
}
/// OttoQ Inc. (`0xFE94`)
static var ottoq2: BluetoothUUID {
return .bit16(0xFE94)
}
/// Xiaomi Inc. (`0xFE95`)
static var xiaomi: BluetoothUUID {
return .bit16(0xFE95)
}
/// Tesla Motor Inc. (`0xFE96`)
static var teslaMotor: BluetoothUUID {
return .bit16(0xFE96)
}
/// Tesla Motor Inc. (`0xFE97`)
static var teslaMotor2: BluetoothUUID {
return .bit16(0xFE97)
}
/// Currant, Inc. (`0xFE98`)
static var currant: BluetoothUUID {
return .bit16(0xFE98)
}
/// Currant, Inc. (`0xFE99`)
static var currant2: BluetoothUUID {
return .bit16(0xFE99)
}
/// Estimote (`0xFE9A`)
static var estimote: BluetoothUUID {
return .bit16(0xFE9A)
}
/// Samsara Networks, Inc (`0xFE9B`)
static var samsaraNetworks: BluetoothUUID {
return .bit16(0xFE9B)
}
/// GSI Laboratories, Inc. (`0xFE9C`)
static var gsiLaboratories: BluetoothUUID {
return .bit16(0xFE9C)
}
/// Mobiquity Networks Inc (`0xFE9D`)
static var mobiquityNetworks: BluetoothUUID {
return .bit16(0xFE9D)
}
/// Dialog Semiconductor B.V. (`0xFE9E`)
static var dialogSemiconductor: BluetoothUUID {
return .bit16(0xFE9E)
}
/// Google Inc. (`0xFE9F`)
static var google9: BluetoothUUID {
return .bit16(0xFE9F)
}
/// Google Inc. (`0xFEA0`)
static var google10: BluetoothUUID {
return .bit16(0xFEA0)
}
/// Intrepid Control Systems, Inc. (`0xFEA1`)
static var intrepidControlSystems: BluetoothUUID {
return .bit16(0xFEA1)
}
/// Intrepid Control Systems, Inc. (`0xFEA2`)
static var intrepidControlSystems2: BluetoothUUID {
return .bit16(0xFEA2)
}
/// ITT Industries (`0xFEA3`)
static var ittIndustries2: BluetoothUUID {
return .bit16(0xFEA3)
}
/// Paxton Access Ltd (`0xFEA4`)
static var paxtonAccess: BluetoothUUID {
return .bit16(0xFEA4)
}
/// GoPro, Inc. (`0xFEA5`)
static var gopro: BluetoothUUID {
return .bit16(0xFEA5)
}
/// GoPro, Inc. (`0xFEA6`)
static var gopro2: BluetoothUUID {
return .bit16(0xFEA6)
}
/// UTC Fire and Security (`0xFEA7`)
static var utcFireAndSecurity: BluetoothUUID {
return .bit16(0xFEA7)
}
/// Savant Systems LLC (`0xFEA8`)
static var savantSystems: BluetoothUUID {
return .bit16(0xFEA8)
}
/// Savant Systems LLC (`0xFEA9`)
static var savantSystems2: BluetoothUUID {
return .bit16(0xFEA9)
}
/// Google Inc. (`0xFEAA`)
static var google11: BluetoothUUID {
return .bit16(0xFEAA)
}
/// Nokia Corporation (`0xFEAB`)
static var nokia: BluetoothUUID {
return .bit16(0xFEAB)
}
/// Nokia Corporation (`0xFEAC`)
static var nokia2: BluetoothUUID {
return .bit16(0xFEAC)
}
/// Nokia Corporation (`0xFEAD`)
static var nokia3: BluetoothUUID {
return .bit16(0xFEAD)
}
/// Nokia Corporation (`0xFEAE`)
static var nokia4: BluetoothUUID {
return .bit16(0xFEAE)
}
/// Nest Labs Inc. (`0xFEAF`)
static var nestLabs: BluetoothUUID {
return .bit16(0xFEAF)
}
/// Nest Labs Inc. (`0xFEB0`)
static var nestLabs2: BluetoothUUID {
return .bit16(0xFEB0)
}
/// Electronics Tomorrow Limited (`0xFEB1`)
static var electronicsTomorrow: BluetoothUUID {
return .bit16(0xFEB1)
}
/// Microsoft Corporation (`0xFEB2`)
static var microsoft2: BluetoothUUID {
return .bit16(0xFEB2)
}
/// Taobao (`0xFEB3`)
static var taobao: BluetoothUUID {
return .bit16(0xFEB3)
}
/// WiSilica Inc. (`0xFEB4`)
static var wisilica: BluetoothUUID {
return .bit16(0xFEB4)
}
/// WiSilica Inc. (`0xFEB5`)
static var wisilica2: BluetoothUUID {
return .bit16(0xFEB5)
}
/// Vencer Co, Ltd (`0xFEB6`)
static var vencerCo: BluetoothUUID {
return .bit16(0xFEB6)
}
/// Facebook, Inc. (`0xFEB7`)
static var facebook: BluetoothUUID {
return .bit16(0xFEB7)
}
/// Facebook, Inc. (`0xFEB8`)
static var facebook2: BluetoothUUID {
return .bit16(0xFEB8)
}
/// LG Electronics (`0xFEB9`)
static var lgElectronics: BluetoothUUID {
return .bit16(0xFEB9)
}
/// Tencent Holdings Limited (`0xFEBA`)
static var tencentHoldings: BluetoothUUID {
return .bit16(0xFEBA)
}
/// adafruit industries (`0xFEBB`)
static var adafruitIndustries: BluetoothUUID {
return .bit16(0xFEBB)
}
/// Dexcom, Inc. (`0xFEBC`)
static var dexcom: BluetoothUUID {
return .bit16(0xFEBC)
}
/// Clover Network, Inc. (`0xFEBD`)
static var cloverNetwork: BluetoothUUID {
return .bit16(0xFEBD)
}
/// Bose Corporation (`0xFEBE`)
static var bose2: BluetoothUUID {
return .bit16(0xFEBE)
}
/// Nod, Inc. (`0xFEBF`)
static var nod: BluetoothUUID {
return .bit16(0xFEBF)
}
/// KDDI Corporation (`0xFEC0`)
static var kddi: BluetoothUUID {
return .bit16(0xFEC0)
}
/// KDDI Corporation (`0xFEC1`)
static var kddi2: BluetoothUUID {
return .bit16(0xFEC1)
}
/// Blue Spark Technologies, Inc. (`0xFEC2`)
static var blueSparkTechnologies: BluetoothUUID {
return .bit16(0xFEC2)
}
/// 360fly, Inc. (`0xFEC3`)
static var uuid360Fly: BluetoothUUID {
return .bit16(0xFEC3)
}
/// PLUS Location Systems (`0xFEC4`)
static var plusLocationSystems: BluetoothUUID {
return .bit16(0xFEC4)
}
/// Realtek Semiconductor Corp. (`0xFEC5`)
static var realtekSemiconductor: BluetoothUUID {
return .bit16(0xFEC5)
}
/// Kocomojo, LLC (`0xFEC6`)
static var kocomojo: BluetoothUUID {
return .bit16(0xFEC6)
}
/// Apple, Inc. (`0xFEC7`)
static var apple5: BluetoothUUID {
return .bit16(0xFEC7)
}
/// Apple, Inc. (`0xFEC8`)
static var apple6: BluetoothUUID {
return .bit16(0xFEC8)
}
/// Apple, Inc. (`0xFEC9`)
static var apple7: BluetoothUUID {
return .bit16(0xFEC9)
}
/// Apple, Inc. (`0xFECA`)
static var apple8: BluetoothUUID {
return .bit16(0xFECA)
}
/// Apple, Inc. (`0xFECB`)
static var apple9: BluetoothUUID {
return .bit16(0xFECB)
}
/// Apple, Inc. (`0xFECC`)
static var apple10: BluetoothUUID {
return .bit16(0xFECC)
}
/// Apple, Inc. (`0xFECD`)
static var apple11: BluetoothUUID {
return .bit16(0xFECD)
}
/// Apple, Inc. (`0xFECE`)
static var apple12: BluetoothUUID {
return .bit16(0xFECE)
}
/// Apple, Inc. (`0xFECF`)
static var apple13: BluetoothUUID {
return .bit16(0xFECF)
}
/// Apple, Inc. (`0xFED0`)
static var apple14: BluetoothUUID {
return .bit16(0xFED0)
}
/// Apple, Inc. (`0xFED1`)
static var apple15: BluetoothUUID {
return .bit16(0xFED1)
}
/// Apple, Inc. (`0xFED2`)
static var apple16: BluetoothUUID {
return .bit16(0xFED2)
}
/// Apple, Inc. (`0xFED3`)
static var apple17: BluetoothUUID {
return .bit16(0xFED3)
}
/// Apple, Inc. (`0xFED4`)
static var apple18: BluetoothUUID {
return .bit16(0xFED4)
}
/// Plantronics Inc. (`0xFED5`)
static var plantronics: BluetoothUUID {
return .bit16(0xFED5)
}
/// Broadcom Corporation (`0xFED6`)
static var broadcom: BluetoothUUID {
return .bit16(0xFED6)
}
/// Broadcom Corporation (`0xFED7`)
static var broadcom2: BluetoothUUID {
return .bit16(0xFED7)
}
/// Google Inc. (`0xFED8`)
static var google12: BluetoothUUID {
return .bit16(0xFED8)
}
/// Pebble Technology Corporation (`0xFED9`)
static var pebbleTechnology: BluetoothUUID {
return .bit16(0xFED9)
}
/// ISSC Technologies Corporation (`0xFEDA`)
static var isscTechnologies: BluetoothUUID {
return .bit16(0xFEDA)
}
/// Perka, Inc. (`0xFEDB`)
static var perka: BluetoothUUID {
return .bit16(0xFEDB)
}
/// Jawbone (`0xFEDC`)
static var jawbone: BluetoothUUID {
return .bit16(0xFEDC)
}
/// Jawbone (`0xFEDD`)
static var jawbone2: BluetoothUUID {
return .bit16(0xFEDD)
}
/// Coin, Inc. (`0xFEDE`)
static var coin: BluetoothUUID {
return .bit16(0xFEDE)
}
/// Design SHIFT (`0xFEDF`)
static var designShift: BluetoothUUID {
return .bit16(0xFEDF)
}
/// Anhui Huami Information Technology Co. (`0xFEE0`)
static var anhuiHuamiInformationTechnology: BluetoothUUID {
return .bit16(0xFEE0)
}
/// Anhui Huami Information Technology Co. (`0xFEE1`)
static var anhuiHuamiInformationTechnology2: BluetoothUUID {
return .bit16(0xFEE1)
}
/// Anki, Inc. (`0xFEE2`)
static var anki: BluetoothUUID {
return .bit16(0xFEE2)
}
/// Anki, Inc. (`0xFEE3`)
static var anki2: BluetoothUUID {
return .bit16(0xFEE3)
}
/// Nordic Semiconductor ASA (`0xFEE4`)
static var nordicSemiconductor3: BluetoothUUID {
return .bit16(0xFEE4)
}
/// Nordic Semiconductor ASA (`0xFEE5`)
static var nordicSemiconductor4: BluetoothUUID {
return .bit16(0xFEE5)
}
/// Silvair, Inc. (`0xFEE6`)
static var silvair: BluetoothUUID {
return .bit16(0xFEE6)
}
/// Tencent Holdings Limited (`0xFEE7`)
static var tencentHoldings2: BluetoothUUID {
return .bit16(0xFEE7)
}
/// Quintic Corp. (`0xFEE8`)
static var quintic: BluetoothUUID {
return .bit16(0xFEE8)
}
/// Quintic Corp. (`0xFEE9`)
static var quintic2: BluetoothUUID {
return .bit16(0xFEE9)
}
/// Swirl Networks, Inc. (`0xFEEA`)
static var swirlNetworks: BluetoothUUID {
return .bit16(0xFEEA)
}
/// Swirl Networks, Inc. (`0xFEEB`)
static var swirlNetworks2: BluetoothUUID {
return .bit16(0xFEEB)
}
/// Tile, Inc. (`0xFEEC`)
static var tile: BluetoothUUID {
return .bit16(0xFEEC)
}
/// Tile, Inc. (`0xFEED`)
static var tile2: BluetoothUUID {
return .bit16(0xFEED)
}
/// Polar Electro Oy (`0xFEEE`)
static var polarElectro: BluetoothUUID {
return .bit16(0xFEEE)
}
/// Polar Electro Oy (`0xFEEF`)
static var polarElectro2: BluetoothUUID {
return .bit16(0xFEEF)
}
/// Intel (`0xFEF0`)
static var intel2: BluetoothUUID {
return .bit16(0xFEF0)
}
/// CSR (`0xFEF1`)
static var csr2: BluetoothUUID {
return .bit16(0xFEF1)
}
/// CSR (`0xFEF2`)
static var csr3: BluetoothUUID {
return .bit16(0xFEF2)
}
/// Google Inc. (`0xFEF3`)
static var google13: BluetoothUUID {
return .bit16(0xFEF3)
}
/// Google Inc. (`0xFEF4`)
static var google14: BluetoothUUID {
return .bit16(0xFEF4)
}
/// Dialog Semiconductor GmbH (`0xFEF5`)
static var dialogSemiconductor2: BluetoothUUID {
return .bit16(0xFEF5)
}
/// Wicentric, Inc. (`0xFEF6`)
static var wicentric: BluetoothUUID {
return .bit16(0xFEF6)
}
/// Aplix Corporation (`0xFEF7`)
static var aplix: BluetoothUUID {
return .bit16(0xFEF7)
}
/// Aplix Corporation (`0xFEF8`)
static var aplix2: BluetoothUUID {
return .bit16(0xFEF8)
}
/// PayPal, Inc. (`0xFEF9`)
static var paypal: BluetoothUUID {
return .bit16(0xFEF9)
}
/// PayPal, Inc. (`0xFEFA`)
static var paypal2: BluetoothUUID {
return .bit16(0xFEFA)
}
/// Telit Wireless Solutions (`0xFEFB`)
static var telitWirelessSolutions2: BluetoothUUID {
return .bit16(0xFEFB)
}
/// Gimbal, Inc. (`0xFEFC`)
static var gimbal: BluetoothUUID {
return .bit16(0xFEFC)
}
/// Gimbal, Inc. (`0xFEFD`)
static var gimbal2: BluetoothUUID {
return .bit16(0xFEFD)
}
/// GN ReSound A/S (`0xFEFE`)
static var gnResound: BluetoothUUID {
return .bit16(0xFEFE)
}
/// GN Netcom (`0xFEFF`)
static var gnNetcom: BluetoothUUID {
return .bit16(0xFEFF)
}
/// Fast IDentity Online Alliance (FIDO) (`0xFFFD`)
static var fastIdentityOnlineAllianceFido: BluetoothUUID {
return .bit16(0xFFFD)
}
/// Alliance for Wireless Power (A4WP) (`0xFFFE`)
static var allianceForWirelessPowerA4Wp: BluetoothUUID {
return .bit16(0xFFFE)
}
}
| 24.077842 | 85 | 0.610356 |
94f03af25c2d1d75cd424dbb6b0ad9f3007afb88 | 382 | kt | Kotlin | app/src/main/java/space/taran/arknavigator/mvp/view/dialog/SortDialogView.kt | MickeyMouse2/ARK-Navigator | 71e77ebd9807706d443519be2285be6856171f74 | [
"MIT"
] | 1 | 2022-03-22T14:19:34.000Z | 2022-03-22T14:19:34.000Z | app/src/main/java/space/taran/arknavigator/mvp/view/dialog/SortDialogView.kt | MickeyMouse2/ARK-Navigator | 71e77ebd9807706d443519be2285be6856171f74 | [
"MIT"
] | null | null | null | app/src/main/java/space/taran/arknavigator/mvp/view/dialog/SortDialogView.kt | MickeyMouse2/ARK-Navigator | 71e77ebd9807706d443519be2285be6856171f74 | [
"MIT"
] | null | null | null | package space.taran.arknavigator.mvp.view.dialog
import moxy.MvpView
import moxy.viewstate.strategy.AddToEndSingleStrategy
import moxy.viewstate.strategy.StateStrategyType
import space.taran.arknavigator.utils.Sorting
@StateStrategyType(AddToEndSingleStrategy::class)
interface SortDialogView : MvpView {
fun init(sorting: Sorting, ascending: Boolean)
fun closeDialog()
}
| 29.384615 | 53 | 0.829843 |
905d5c290850b1ab1382b1735d6e9f19d10539d6 | 4,110 | py | Python | src/plotting/TATA_enrichment_plots.py | Switham1/PromoterArchitecture | 0a9021b869ac66cdd622be18cd029950314d111e | [
"MIT"
] | null | null | null | src/plotting/TATA_enrichment_plots.py | Switham1/PromoterArchitecture | 0a9021b869ac66cdd622be18cd029950314d111e | [
"MIT"
] | null | null | null | src/plotting/TATA_enrichment_plots.py | Switham1/PromoterArchitecture | 0a9021b869ac66cdd622be18cd029950314d111e | [
"MIT"
] | null | null | null | import argparse
import os
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
def parse_args(args):
"""define arguments"""
parser = argparse.ArgumentParser(description="TATA_enrichment_plots")
parser.add_argument(
"file_names",
type=str,
help="Name of folder and filenames for the promoters extracted",
)
parser.add_argument(
"gat_TATA_constitutive_output",
type=str,
help="Location of constitutive promoter gat analysis output",
)
parser.add_argument(
"gat_TATA_variable_output",
type=str,
help="Location of variable promoter gat analysis output",
)
parser.add_argument(
"output_prefix",
type=str,
help="Output prefix to add to plot file name",
)
parser.add_argument(
"output_folder_name",
type=str,
help="Optional output folder name ending in a forward slash",
default="",
nargs="?",
)
parser.add_argument(
"variable1_name",
type=str,
help="Optional replacement name for 2nd variable eg. non-specific",
default="constitutive",
nargs="?",
)
parser.add_argument(
"variable2_name",
type=str,
help="Optional replacement name for 2nd variable eg. tissue_specific",
default="variable",
nargs="?",
)
parser.add_argument(
"palette",
type=str,
help="Optional replacement colour palette for plots",
default=None,
nargs="?",
)
return parser.parse_args(
args
) # let argparse grab args from sys.argv itself to allow for testing in module import
def create_plot(
file_names,
output_folder_name,
output_prefix,
gat_TATA_constitutive_output,
gat_TATA_variable_output,
palette,
variable1_name,
variable2_name,
):
"""import and process the raw outputs after running gat (Genomic association tester). Then create barplot of constitutive and variable gene TATA enrichment"""
# import gat output files as dfs
constitutive = pd.read_table(
gat_TATA_constitutive_output, sep="\t", header=0
)
variable = pd.read_table(gat_TATA_variable_output, sep="\t", header=0)
# merge dfs
merged = pd.concat([constitutive, variable], ignore_index=True)
# set style to ticks
sns.set(style="ticks", color_codes=True)
# set colour palette
colours = sns.color_palette(palette)
# bar chart, 95% confidence intervals
plot = sns.barplot(
x="annotation",
y="l2fold",
data=merged,
order=[variable1_name, variable2_name],
palette=colours,
)
plot.axhline(0, color="black")
plt.xlabel("Gene type")
plt.ylabel("Log2-fold enrichment over background").get_figure().savefig(
f"../../data/output/{file_names}/TATA/{output_folder_name}plots/{output_prefix}_log2fold.pdf",
format="pdf",
)
def main(args):
# parse arguments
args = parse_args(args)
# make directory for the plots to be exported to
dirName = (
f"../../data/output/{args.file_names}/TATA/{args.output_folder_name}"
)
try:
# Create target Directory
os.mkdir(dirName)
print("Directory ", dirName, " created")
except FileExistsError:
print("Directory ", dirName, " already exists")
# make directory for the plots to be exported to
dirName = f"../../data/output/{args.file_names}/TATA/{args.output_folder_name}/plots"
try:
# Create target Directory
os.mkdir(dirName)
print("Directory ", dirName, " created")
except FileExistsError:
print("Directory ", dirName, " already exists")
# Create barplot
create_plot(
args.file_names,
args.output_folder_name,
args.output_prefix,
args.gat_TATA_constitutive_output,
args.gat_TATA_variable_output,
args.palette,
args.variable1_name,
args.variable2_name,
)
if __name__ == "__main__":
import sys
main(sys.argv[1:])
| 27.959184 | 162 | 0.6382 |
16eb4218ceba6952d637e6cb185c774ad492d57d | 1,124 | ts | TypeScript | server/utils/wowza/env.ts | cccties/ChibiCHiLO | fbd1abb5915ba508a02ded702218ef368b9bd849 | [
"MIT"
] | null | null | null | server/utils/wowza/env.ts | cccties/ChibiCHiLO | fbd1abb5915ba508a02ded702218ef368b9bd849 | [
"MIT"
] | 70 | 2020-10-07T06:57:39.000Z | 2020-11-25T10:40:02.000Z | server/utils/wowza/env.ts | cccties/ChibiCHiLO | fbd1abb5915ba508a02ded702218ef368b9bd849 | [
"MIT"
] | null | null | null | import format from "date-fns/format";
import utcToZoneTime from "date-fns-tz/utcToZonedTime";
import {
WOWZA_SCP_HOST,
WOWZA_SCP_PORT,
WOWZA_SCP_USERNAME,
WOWZA_SCP_PRIVATE_KEY,
WOWZA_SCP_PASS_PHRASE,
WOWZA_SCP_SERVER_PATH,
} from "$server/utils/env";
export function validateWowzaSettings(logging = true) {
if (
!WOWZA_SCP_HOST ||
!WOWZA_SCP_PORT ||
!WOWZA_SCP_USERNAME ||
!WOWZA_SCP_PRIVATE_KEY ||
!WOWZA_SCP_SERVER_PATH
) {
if (logging)
logger(
"INFO",
`wowza upload is disabled. WOWZA_SCP_HOST:${WOWZA_SCP_HOST} WOWZA_SCP_PORT:${WOWZA_SCP_PORT} WOWZA_SCP_USERNAME:${WOWZA_SCP_USERNAME} WOWZA_SCP_PRIVATE_KEY:${WOWZA_SCP_PRIVATE_KEY} WOWZA_SCP_PASS_PHRASE:${WOWZA_SCP_PASS_PHRASE} WOWZA_SCP_SERVER_PATH:${WOWZA_SCP_SERVER_PATH}`
);
return false;
}
return true;
}
export function logger(level: string, output: string, error?: Error | unknown) {
console.log(
format(utcToZoneTime(new Date(), "Asia/Tokyo"), "yyyy-MM-dd HH:mm:ss"),
level,
output,
"WowzaUploadLog"
);
if (error instanceof Error) console.log(error.stack);
}
| 28.1 | 283 | 0.719751 |
8e4ec9c24b15f155c10432018591043c89c3e0f2 | 375 | rb | Ruby | config/initializers/elo.rb | kevinreedy/shuffleboard_elo | 664e7c310734a5264e48f3d0f9a1984d7cd29ec0 | [
"Apache-2.0"
] | 3 | 2019-01-29T20:09:58.000Z | 2020-01-25T02:09:08.000Z | config/initializers/elo.rb | kevinreedy/shuffleboard_elo | 664e7c310734a5264e48f3d0f9a1984d7cd29ec0 | [
"Apache-2.0"
] | 69 | 2018-10-05T06:38:24.000Z | 2021-03-06T04:27:42.000Z | config/initializers/elo.rb | kevinreedy/shuffleboard_elo | 664e7c310734a5264e48f3d0f9a1984d7cd29ec0 | [
"Apache-2.0"
] | 4 | 2018-10-23T22:17:51.000Z | 2020-01-25T02:09:15.000Z | Elo.configure do |config|
# Every player starts with a rating of 1000
config.default_rating = 1000
# A player is considered a pro, when he/she has more than 2400 points
# TODO: we should store Team.pro? when this triggers
config.pro_rating_boundry = 2400
# A player is considered a new, when he/she has played less than 9 games
config.starter_boundry = 9
end
| 31.25 | 74 | 0.744 |
5df16b468267a6c4ccc03d2b78964ac06ad5d389 | 1,376 | c | C | LeetCode/Answers/Leetcode-cpp-solution/preorder.c | quantumlaser/code2016 | 25f8e1e55224e3f7522f8ba1fa5587530f0daf54 | [
"MIT"
] | null | null | null | LeetCode/Answers/Leetcode-cpp-solution/preorder.c | quantumlaser/code2016 | 25f8e1e55224e3f7522f8ba1fa5587530f0daf54 | [
"MIT"
] | null | null | null | LeetCode/Answers/Leetcode-cpp-solution/preorder.c | quantumlaser/code2016 | 25f8e1e55224e3f7522f8ba1fa5587530f0daf54 | [
"MIT"
] | null | null | null | /**
* Definition for binary tree
* struct TNode {
* int val;
* TNode *left;
* TNode *right;
* TNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
void preorder(TNode *root)
{
if(!root) {
visit(root);
preorder(root->left);
preorder(root->right);
}
}
void preorder2(TNode *root)
{
Stack S;
while(!root || !S.empty()) {
while(!root) {
visit(root);
S.push(root);
root = root->left;
}
if(!S.empty()) {
root = S.pop();
root = root->right;
}
}
}
void preorder3(TNode *root)
{
if(!root) {
Stack S;
S.push(root);
if(!S.empty()) {
root = S.pop();
S.push(root->right);
S.push(root->left);
}
}
}
void inorder(TNode *root)
{
Stack S;
while(!root || !S.empty) {
while(!root) {
S.push(root);
root = root->left;
}
if(!S.empty()) {
root = S.pop();
visit(root);
root = root->right;
}
}
}
void levelorder(TNode *root) {
Queue Q;
TNode *node;
Q.push(root);
while(!Q.empty()) {
node = Q.front();
visit(node);
if(!node->left) Q.push(node->left);
if(!node->right) Q.push(node->right);
}
}
| 17.641026 | 57 | 0.428052 |
56c904b59917029a3597068ccddce17e6aceffff | 277 | ts | TypeScript | asymmetric/asymmetric.ts | mabels/neckless | be1e769ed886360f80d68777a6993c6ce8ba4f2e | [
"Apache-2.0"
] | 1 | 2021-01-29T12:29:57.000Z | 2021-01-29T12:29:57.000Z | asymmetric/asymmetric.ts | mabels/neckless | be1e769ed886360f80d68777a6993c6ce8ba4f2e | [
"Apache-2.0"
] | 11 | 2020-07-13T09:48:23.000Z | 2021-02-13T17:12:43.000Z | asymmetric/asymmetric.ts | mabels/neckless | be1e769ed886360f80d68777a6993c6ce8ba4f2e | [
"Apache-2.0"
] | null | null | null | import { RawKey } from '../key/key'
export function CreateShared(priv: RawKey, pub: RawKey): RawKey {
// curve25519.ScalarMult(&shared, priv.As32Byte(), pub.As32Byte())
throw Error("CreateShared not implemented")
const shared = new RawKey(Buffer.from([]))
return shared
}
| 30.777778 | 67 | 0.722022 |
72f7071274543b9b896c7ae18c18feba0fc97ff9 | 8,879 | html | HTML | ui/client-v5/public/index.html | gcavancer/practical-spring-boot-microservices | e628dcdbf3992d9cedee08b3bdc76ed98c2fd6d5 | [
"MIT"
] | 1 | 2021-12-14T16:58:35.000Z | 2021-12-14T16:58:35.000Z | ui/client-v5/public/index.html | gcavancer/practical-spring-boot-microservices | e628dcdbf3992d9cedee08b3bdc76ed98c2fd6d5 | [
"MIT"
] | 3 | 2022-02-27T21:15:29.000Z | 2022-02-27T21:16:27.000Z | ui/client-v5/public/index.html | gcavancer/practical-spring-boot-microservices | e628dcdbf3992d9cedee08b3bdc76ed98c2fd6d5 | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<style>
.path9, .path10 {
animation: swim 5s 0s cubic-bezier(0.1, 0.2, 0.4, 1) infinite;
}
.path11, .path6, .path7, .path3 {
animation: swim 5s 0.1s cubic-bezier(0.1, 0.2, 0.4, 1) infinite;
}
.path12, .path4, .path8, .path1 {
animation: swim 5s 0.2s cubic-bezier(0.1, 0.2, 0.4, 1) infinite;
}
.path5, .path2 {
animation: swim 5s 0.3s cubic-bezier(0.1, 0.2, 0.4, 1) infinite;
}
.path17, .path13, .path14 {
animation: swim 5s 0.4s cubic-bezier(0.1, 0.2, 0.4, 1) infinite;
}
.path16, .path15 {
animation: swim 5s 0.5s cubic-bezier(0.1, 0.2, 0.4, 1) infinite;
}
@keyframes swim {
0% {
transform: scale(1);
}
50% {
transform: scale(0.9);
}
100% {
transform: scale(1);
}
}
.footer {
position: relative;
margin-top: -150px;
height: 150px;
clear:both;
padding-top:20px;
}
</style>
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<div class="fixed-bottom">
<div class="text-center mt-3">
<p>
<a href="#" target="_blank">client-v5: Spring Boot Microservices</a>
</p>
<p>
<a href="https://currere.co" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" width="180" height="40" viewBox="0 0 1008.041 218.667">
<defs>
<clipPath id="a">
<path d="M0 560h960V0H0z"></path>
</clipPath>
</defs>
<g clip-path="url(#a)" transform="matrix(1.33333 0 0 -1.33333 -114.333 452)">
<path d="M343.457 302.975c-4.84-1.26-9.412-3.396-13.715-6.276-6.156-4.26-10.907-9.542-14.253-15.78-3.348-6.24-5.02-12.974-5.02-20.173 0-13.376 4.675-24.338 14.029-32.405C333.85 220.27 346.385 216 362.103 216H370v15h-6.821c-10.997 0-19.798 2.853-26.4 8.162-6.604 5.308-9.905 12.44-9.905 21.2 0 8.816 3.285 16.123 9.86 21.432 6.573 5.308 15.388 8.206 26.445 8.206h6.82v15h-7.896c-7.59 0-13.805-.765-18.646-2.025" class="path22" fill="#6a6a6a"></path>
<path d="M444 253.71c0-6.958-1.955-12.627-5.988-17.005-4.035-4.38-9.217-6.568-15.611-6.568-6.336 0-11.359 2.189-15.452 6.568-4.094 4.378-5.949 10.047-5.949 17.006V305h-16v-48.41c0-12.837 3.356-23.005 10.11-30.502 6.753-7.5 15.797-11.247 27.152-11.247 11.414 0 20.647 3.748 27.43 11.247C456.474 233.585 460 243.753 460 256.59V305h-16z" class="path26" fill="#6a6a6a"></path>
<path d="M618.525 282.82c5.408 5.907 12.057 8.862 19.945 8.862 3.885 0 7.47-.75 10.758-2.25 3.228-1.473 6.14-3.647 8.734-6.509l-47.31-26.27a38.118 38.118 0 0 0-.24 4.256c0 8.697 2.703 16.001 8.113 21.91m38.725-45.26c-5.05-4.948-11.31-7.423-18.78-7.423-7.83 0-14.463 2.97-19.9 8.91a31.34 31.34 0 0 0-3.209 4.151l6.615 3.676 57.641 32.032c-4.363 8.997-10.057 15.85-17.078 20.56-7.022 4.708-14.985 7.063-23.889 7.063-5.977 0-11.67-1.14-17.078-3.419-5.408-2.28-10.234-5.609-14.477-9.988-4.244-4.44-7.484-9.418-9.726-14.936-2.24-5.519-3.362-11.338-3.362-17.456 0-8.339 1.942-15.986 5.827-22.944 3.884-6.96 9.353-12.598 16.404-16.916a41.982 41.982 0 0 1 10.713-4.634 43.05 43.05 0 0 1 11.52-1.575c11.413 0 21.095 3.658 29.044 10.977 7.948 7.32 13.028 17.277 15.24 29.873l-16.048 2.43c-1.254-8.639-4.407-15.432-9.457-20.38" class="path30" fill="#6a6a6a"></path>
<path d="M777.55 282.82c5.409 5.907 12.058 8.862 19.946 8.862 3.885 0 7.47-.75 10.758-2.25 3.285-1.5 6.244-3.72 8.875-6.658l-2.965-1.66-.04.011-44.425-24.67a38.249 38.249 0 0 0-.26 4.454c0 8.697 2.704 16.001 8.112 21.91m48.184-24.879c-1.256-8.639-4.41-15.432-9.457-20.38-5.051-4.949-11.311-7.424-18.782-7.424-7.828 0-14.463 2.97-19.9 8.91a31.451 31.451 0 0 0-3.122 4.02l59.12 33.027-.007.002 5.056 2.81c-4.363 8.997-10.055 15.85-17.076 20.56-7.024 4.708-14.987 7.063-23.891 7.063-5.977 0-11.668-1.14-17.076-3.419-5.41-2.28-10.235-5.609-14.48-9.988-4.243-4.44-7.483-9.418-9.723-14.936-2.242-5.519-3.364-11.338-3.364-17.456 0-8.339 1.942-15.986 5.829-22.944 3.882-6.96 9.35-12.598 16.404-16.916a41.922 41.922 0 0 1 10.713-4.634 43.025 43.025 0 0 1 11.517-1.575c11.414 0 21.096 3.658 29.045 10.977 7.948 7.32 13.028 17.277 15.24 29.873z" class="path34" fill="#6a6a6a"></path>
<path d="M583.625 306.376c-2.078.025-4.723.011-7.439-.126-8.81-.445-17.241-3.312-23.737-9.643C545.209 290.693 540 281.564 540 265.8V216h15v41.787c0 11.637 2.314 20.678 7.125 25.838 4.811 5.158 12.934 7.375 23.75 7.375h1.75l.076 5.292c.039-.007.104-.011.104-.011l.164 9.969.031.002v.014l-3.719.125c-.211 0-.447-.013-.656-.015" class="path38" fill="#6a6a6a"></path>
<path d="M520.625 306.376c-2.078.025-4.723.011-7.439-.126-8.81-.445-17.241-3.312-23.737-9.643C482.209 290.693 477 281.564 477 265.8V216h15v41.787c0 11.637 2.314 20.678 7.125 25.838 4.811 5.158 12.934 7.375 23.75 7.375h1.75l.076 5.292c.039-.007.104-.011.104-.011l.164 9.969.031.002v.014l-3.719.125c-.211 0-.447-.013-.656-.015" class="path42" fill="#6a6a6a"></path>
<path d="M743.625 306.376c-2.078.025-4.723.011-7.439-.126-8.81-.445-17.241-3.312-23.737-9.643C705.209 290.693 700 281.564 700 265.8V216h15v41.787c0 11.637 2.314 20.678 7.125 25.838 4.811 5.158 12.934 7.375 23.75 7.375h1.75l.076 5.292c.039-.007.104-.011.104-.011l.164 9.969.031.002v.014l-3.719.125c-.211 0-.447-.013-.656-.015" class="path46" fill="#6a6a6a"></path>
</g>
<path d="M124.333 217.333h64L157 161.833" class="path1" fill="#f8af00"></path>
<path d="M157 161.833l-62.417.042 29.75 55.458" class="path2" fill="#ffdb3f"></path>
<path d="M157 161.833l64.333.167-33 55.333" class="path3" fill="#58daf4"></path>
<path d="M123.333 106l67-.167-33.396-51.229" class="path4" fill="#ff8300"></path>
<path d="M156.937 54.604L92 54.667 123.333 106" class="path5" fill="#4ab7cd"></path>
<path d="M156.937 54.604l65.334-.104-31.938 51.333" class="path6" fill="#ffba45"></path>
<path d="M157 161.833l64.333.167-31-56.167" class="path7" fill="#00b6db"></path>
<path d="M190.333 105.833l-67 .167L157 161.833" class="path8" fill="#0084b9"></path>
<path d="M190.333 105.833l62.334-.388L221.333 162" class="path9" fill="#62f3ff"></path>
<path d="M190.333 105.833l62.334-.388L222.27 54.5" class="path10" fill="#ffda81"></path>
<path d="M156.937 54.604l65.334-.104L189.336 0" class="path11" fill="#ffda81"></path>
<path d="M127 0h62.336l-32.315 54.604" class="path12" fill="#006f9b"></path>
<path d="M112.333 108.401L50 108.556 81.321 160.5" class="path13" fill="#006f9b"></path>
<path d="M49.667 218.667h64l-31.334-55.5" class="path14" fill="#ffd573"></path>
<path d="M0 168.52l56.667.146-27.306-49.473" class="path15" fill="#df8b00"></path>
<path d="M7.604 55.937l65.333-.104L41 107.167" class="path16" fill="#4ab7cd"></path>
<path d="M59.5 1.13l65.39-.463-34.187 49.937" class="path17" fill="#52cce4"></path>
</svg>
</a>
</p>
</div>
</div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
| 66.759398 | 888 | 0.608627 |
ddf2ee880cfb88e32d3701d93120cc98c9f0a990 | 2,916 | kt | Kotlin | app/src/main/kotlin/com/ivanovsky/passnotes/presentation/selectdb/cells/factory/SelectDatabaseCellModelFactory.kt | aivanovski/passnotes | 08df99c790087a252f05de76a75833ec538f6100 | [
"Apache-2.0"
] | null | null | null | app/src/main/kotlin/com/ivanovsky/passnotes/presentation/selectdb/cells/factory/SelectDatabaseCellModelFactory.kt | aivanovski/passnotes | 08df99c790087a252f05de76a75833ec538f6100 | [
"Apache-2.0"
] | null | null | null | app/src/main/kotlin/com/ivanovsky/passnotes/presentation/selectdb/cells/factory/SelectDatabaseCellModelFactory.kt | aivanovski/passnotes | 08df99c790087a252f05de76a75833ec538f6100 | [
"Apache-2.0"
] | null | null | null | package com.ivanovsky.passnotes.presentation.selectdb.cells.factory
import com.ivanovsky.passnotes.R
import com.ivanovsky.passnotes.data.entity.FileDescriptor
import com.ivanovsky.passnotes.data.entity.SyncStatus
import com.ivanovsky.passnotes.domain.ResourceProvider
import com.ivanovsky.passnotes.extensions.formatReadablePath
import com.ivanovsky.passnotes.presentation.core.model.BaseCellModel
import com.ivanovsky.passnotes.presentation.selectdb.cells.model.DatabaseFileCellModel
import com.ivanovsky.passnotes.util.toLinkedMap
import java.util.UUID
class SelectDatabaseCellModelFactory(
private val resourceProvider: ResourceProvider
) {
fun createCellModels(
files: List<Pair<UUID, FileDescriptor>>
): MutableMap<UUID, BaseCellModel> {
return files.map { (uid, file) ->
Pair(
uid,
createDatabaseFileCell(
file = file,
fileUid = uid,
syncStatus = null
)
)
}
.toLinkedMap()
}
fun createCellModel(
file: FileDescriptor,
fileUid: UUID,
syncStatus: SyncStatus?
): BaseCellModel =
createDatabaseFileCell(
file = file,
fileUid = fileUid,
syncStatus = syncStatus
)
private fun createDatabaseFileCell(
file: FileDescriptor,
fileUid: UUID,
syncStatus: SyncStatus?
): BaseCellModel =
DatabaseFileCellModel(
id = fileUid,
name = file.name,
path = file.formatReadablePath(resourceProvider),
status = formatSyncStatus(syncStatus),
isRemoveButtonVisible = true,
isResolveButtonVisible = (syncStatus == SyncStatus.CONFLICT)
)
private fun formatSyncStatus(syncStatus: SyncStatus?): String {
return when (syncStatus) {
SyncStatus.NO_CHANGES -> {
resourceProvider.getString(R.string.file_is_up_to_date)
}
SyncStatus.LOCAL_CHANGES -> {
resourceProvider.getString(R.string.unsent_changes)
}
SyncStatus.REMOTE_CHANGES -> {
resourceProvider.getString(R.string.new_version_of_file_is_available)
}
SyncStatus.LOCAL_CHANGES_NO_NETWORK -> {
resourceProvider.getString(R.string.unsent_changes_and_offline_mode)
}
SyncStatus.NO_NETWORK -> {
resourceProvider.getString(R.string.offline_mode)
}
SyncStatus.CONFLICT -> {
resourceProvider.getString(R.string.conflict)
}
else -> {
resourceProvider.getString(
R.string.text_with_dots,
resourceProvider.getString(R.string.checking)
)
}
}
}
} | 33.906977 | 86 | 0.608025 |
8a2201d7b0cab979cbaaedf3c7bf23f97e560234 | 359 | asm | Assembly | programs/oeis/083/A083088.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/083/A083088.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/083/A083088.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A083088: First column of table A083087.
; 1,2,4,6,7,9,11,12,14,16,18,19,21,23,24,26,28,30,31,33,35,36,38,40,41,43,45,47,48,50,52,53,55,57,59,60,62,64,65,67,69,70,72,74,76,77,79,81,82,84,86,88,89,91,93,94,96,98,100,101,103,105,106,108,110,111,113,115
mov $2,$0
pow $0,2
div $0,2
lpb $0,1
add $1,1
sub $0,$1
sub $0,$1
trn $0,1
lpe
add $1,1
add $1,$2
| 23.933333 | 209 | 0.626741 |
f16b5a164b7cad4f7daa87e4fab99518c2d49c3c | 257 | rb | Ruby | app/validators/withdraw_blacklist_validator.rb | gsmlg/peatio | 6a5e3362754de5de810502dbd35ae4ce6841d752 | [
"MIT"
] | 3,436 | 2015-01-02T02:49:24.000Z | 2022-03-31T23:19:00.000Z | app/validators/withdraw_blacklist_validator.rb | gsmlg/peatio | 6a5e3362754de5de810502dbd35ae4ce6841d752 | [
"MIT"
] | 471 | 2015-01-01T00:20:54.000Z | 2019-03-24T05:07:50.000Z | app/validators/withdraw_blacklist_validator.rb | gsmlg/peatio | 6a5e3362754de5de810502dbd35ae4ce6841d752 | [
"MIT"
] | 2,084 | 2015-01-02T05:32:13.000Z | 2022-03-31T23:19:25.000Z | class WithdrawBlacklistValidator < ActiveModel::Validator
def validate(record)
if record.channel.blacklist && record.channel.blacklist.include?(record.fund_uid)
record.errors[:fund_uid] << I18n.t('withdraws.invalid_address')
end
end
end
| 25.7 | 85 | 0.750973 |
904b25718ea69983c9d2be29db5ea854f989010e | 19,052 | py | Python | tests/test_client.py | StorjOld/dataserv-client | a1a0052184875bd8f033b7928b2d717ae811b2bb | [
"MIT"
] | 2 | 2016-05-19T16:09:04.000Z | 2016-05-19T16:09:06.000Z | tests/test_client.py | StorjOld/dataserv-client | a1a0052184875bd8f033b7928b2d717ae811b2bb | [
"MIT"
] | null | null | null | tests/test_client.py | StorjOld/dataserv-client | a1a0052184875bd8f033b7928b2d717ae811b2bb | [
"MIT"
] | 4 | 2017-01-04T02:43:29.000Z | 2020-05-17T19:09:54.000Z | from dataserv_client import common
import os
import tempfile
import unittest
import datetime
import json
import psutil
from future.moves.urllib.request import urlopen
from dataserv_client import cli
from dataserv_client import api
from btctxstore import BtcTxStore
from dataserv_client import exceptions
url = "http://127.0.0.1:5000"
common.SHARD_SIZE = 1024 * 128 # monkey patch shard size to 128K
class AbstractTestSetup(object):
def setUp(self):
self.btctxstore = BtcTxStore()
# debug output the server online list
# print(urlopen(url + '/api/online/json').read().decode('utf8'))
class TestClientRegister(AbstractTestSetup, unittest.TestCase):
def test_register_payout(self):
client = api.Client(url=url, config_path=tempfile.mktemp())
config = client.config()
self.assertTrue(client.register())
result = json.loads(
urlopen(url + '/api/online/json').read().decode('utf8')
)
result = [farmer for farmer in result['farmers']
if farmer['payout_addr'] == config['payout_address']]
last_seen = result[0]['last_seen']
reg_time = result[0]['reg_time']
result = json.dumps(result, sort_keys=True)
expected = json.dumps([{
'height': 0,
'nodeid': common.address2nodeid(config['payout_address']),
'last_seen': last_seen,
'payout_addr': config['payout_address'],
'reg_time': reg_time,
'bandwidth_upload': 0,
'bandwidth_download': 0,
"ip": "",
'uptime': 100.0
}], sort_keys=True)
self.assertEqual(result, expected)
def test_register(self): # register without createing a config
client = api.Client(url=url)
self.assertTrue(client.register())
def test_already_registered(self):
def callback():
client = api.Client(url=url, config_path=tempfile.mktemp())
client.register()
client.register()
self.assertRaises(exceptions.AddressAlreadyRegistered, callback)
def test_invalid_farmer(self):
def callback():
client = api.Client(url=url + "/xyz",
config_path=tempfile.mktemp())
client.register()
self.assertRaises(exceptions.ServerNotFound, callback)
class TestClientPing(AbstractTestSetup, unittest.TestCase):
def test_ping(self):
client = api.Client(url=url, config_path=tempfile.mktemp())
self.assertTrue(client.register())
self.assertTrue(client.ping())
def test_invalid_farmer(self):
def callback():
client = api.Client(url=url + "/xyz",
config_path=tempfile.mktemp())
client.ping()
self.assertRaises(exceptions.ServerNotFound, callback)
class TestClientPoll(AbstractTestSetup, unittest.TestCase):
def test_poll(self):
client = api.Client(url=url, config_path=tempfile.mktemp())
client.register()
before = datetime.datetime.now()
self.assertTrue(client.poll(delay=2, limit=2))
after = datetime.datetime.now()
# check that poll did 2 pings with 2 sec delay
self.assertTrue(datetime.timedelta(seconds=2) <= (after - before))
class TestInvalidArgument(AbstractTestSetup, unittest.TestCase):
def test_invalid_retry_limit(self):
def callback():
api.Client(connection_retry_limit=-1,
config_path=tempfile.mktemp())
self.assertRaises(exceptions.InvalidInput, callback)
def test_invalid_retry_delay(self):
def callback():
api.Client(connection_retry_delay=-1,
config_path=tempfile.mktemp())
self.assertRaises(exceptions.InvalidInput, callback)
def test_invalid_negativ_max_size(self):
def callback():
api.Client(max_size=-1, config_path=tempfile.mktemp())
self.assertRaises(exceptions.InvalidInput, callback)
def test_invalid_zero_max_size(self):
def callback():
api.Client(max_size=0, config_path=tempfile.mktemp())
self.assertRaises(exceptions.InvalidInput, callback)
def test_invalid_negativ_min_free_size(self):
def callback():
api.Client(min_free_size=-1, config_path=tempfile.mktemp())
self.assertRaises(exceptions.InvalidInput, callback)
def test_invalid_zero_min_free_size(self):
def callback():
api.Client(min_free_size=0, config_path=tempfile.mktemp())
self.assertRaises(exceptions.InvalidInput, callback)
def test_build_invalid_negative_workers(self):
def callback():
client = api.Client(config_path=tempfile.mktemp())
client.build(workers=-1)
self.assertRaises(exceptions.InvalidInput, callback)
def test_farm_invalid_zero_workers(self):
def callback():
client = api.Client(config_path=tempfile.mktemp())
client.farm(workers=0)
self.assertRaises(exceptions.InvalidInput, callback)
def test_build_invalid_negative_set_height_interval(self):
def callback():
client = api.Client(config_path=tempfile.mktemp())
client.build(set_height_interval=-1)
self.assertRaises(exceptions.InvalidInput, callback)
def test_farm_invalid_zero_set_height_interval(self):
def callback():
client = api.Client(config_path=tempfile.mktemp())
client.farm(set_height_interval=0)
self.assertRaises(exceptions.InvalidInput, callback)
def test_farm_invalid_negative_set_height_interval(self):
def callback():
client = api.Client(config_path=tempfile.mktemp())
client.farm(set_height_interval=-1)
self.assertRaises(exceptions.InvalidInput, callback)
def test_build_invalid_zero_set_height_interval(self):
def callback():
client = api.Client(config_path=tempfile.mktemp())
client.build(set_height_interval=0)
self.assertRaises(exceptions.InvalidInput, callback)
def test_poll_invalid_negativ_delay(self):
def callback():
client = api.Client(config_path=tempfile.mktemp())
client.poll(delay=-1, limit=0)
self.assertRaises(exceptions.InvalidInput, callback)
def test_audit_invalid_negativ_delay(self):
def callback():
client = api.Client(config_path=tempfile.mktemp())
client.audit(delay=-1, limit=0)
self.assertRaises(exceptions.InvalidInput, callback)
class TestConnectionRetry(AbstractTestSetup, unittest.TestCase):
def test_no_retry(self):
def callback():
client = api.Client(url="http://invalid.url",
connection_retry_limit=0,
connection_retry_delay=0,
config_path=tempfile.mktemp())
client.register()
before = datetime.datetime.now()
self.assertRaises(exceptions.ConnectionError, callback)
after = datetime.datetime.now()
self.assertTrue(datetime.timedelta(seconds=15) > (after - before))
def test_retry_server_not_found(self):
def callback():
client = api.Client(url="http://ServerNotFound.url",
config_path=tempfile.mktemp(),
connection_retry_limit=2,
connection_retry_delay=2)
client.register()
before = datetime.datetime.now()
self.assertRaises(exceptions.ConnectionError, callback)
after = datetime.datetime.now()
self.assertTrue(datetime.timedelta(seconds=4) < (after - before))
def test_retry_invalid_url(self):
def callback():
client = api.Client(url="http://127.0.0.257",
config_path=tempfile.mktemp(),
connection_retry_limit=2,
connection_retry_delay=2)
client.register()
before = datetime.datetime.now()
self.assertRaises(exceptions.ConnectionError, callback)
after = datetime.datetime.now()
self.assertTrue(datetime.timedelta(seconds=4) < (after - before))
def test_retry_high_retry_limit(self):
def callback():
client = api.Client(url="http://127.0.0.257",
config_path=tempfile.mktemp(),
connection_retry_limit=2000,
connection_retry_delay=0,
quiet=True)
client.register()
self.assertRaises(exceptions.ConnectionError, callback)
class TestClientBuild(AbstractTestSetup, unittest.TestCase):
def test_build(self):
client = api.Client(url=url,
config_path=tempfile.mktemp(),
max_size=1024 * 256) # 256K
client.register()
generated = client.build(cleanup=True)
self.assertTrue(len(generated))
client = api.Client(url=url,
config_path=tempfile.mktemp(),
max_size=1024 * 512) # 512K
config = client.config()
client.register()
generated = client.build(cleanup=True)
self.assertTrue(len(generated) == 4)
result = json.loads(
urlopen(url + '/api/online/json').read().decode('utf8')
)
result = [farmer for farmer in result['farmers']
if farmer['payout_addr'] == config['payout_address']]
last_seen = result[0]['last_seen']
reg_time = result[0]['reg_time']
result = json.dumps(result, sort_keys=True)
expected = json.dumps([{
'height': 4,
'nodeid': common.address2nodeid(config['payout_address']),
'last_seen': last_seen,
'payout_addr': config['payout_address'],
'reg_time': reg_time,
'bandwidth_upload': 0,
'bandwidth_download': 0,
"ip": "",
'uptime': 100.0
}], sort_keys=True)
self.assertEqual(result, expected)
def test_build_min_free_space(self):
store_path = tempfile.mktemp()
os.mkdir(store_path)
my_free_size = psutil.disk_usage(store_path).free - (1024 * 256) # 256
client = api.Client(url=url,
config_path=tempfile.mktemp(),
store_path=store_path,
max_size=1024 * 1024 * 2,
min_free_size=my_free_size) # 256
config = client.config()
client.register()
generated = client.build()
self.assertTrue(len(generated) > 0) # build at least 1 shard
self.assertTrue(len(generated) < 16) # stoped cause of free Space
result = json.loads(
urlopen(url + '/api/online/json').read().decode('utf8')
)
result = [farmer for farmer in result['farmers']
if farmer['payout_addr'] == config['payout_address']]
last_seen = result[0]['last_seen']
reg_time = result[0]['reg_time']
result = json.dumps(result, sort_keys=True)
expected = json.dumps([{
'height': len(generated),
'nodeid': common.address2nodeid(config['payout_address']),
'last_seen': last_seen,
'payout_addr': config['payout_address'],
'reg_time': reg_time,
'bandwidth_upload': 0,
'bandwidth_download': 0,
"ip": "",
'uptime': 100.0
}], sort_keys=True)
self.assertEqual(result, expected)
class TestClientFarm(AbstractTestSetup, unittest.TestCase):
def test_farm(self):
client = api.Client(url=url,
config_path=tempfile.mktemp(),
max_size=1024 * 256) # 256K
befor = datetime.datetime.now()
self.assertTrue(client.farm(delay=2, limit=2)) # check farm return true
after = datetime.datetime.now()
# check that farm did 2 pings with 2 sec delay
self.assertTrue(datetime.timedelta(seconds=2) <= (after - befor))
def test_farm_registered(self):
client = api.Client(url=url,
config_path=tempfile.mktemp(),
max_size=1024 * 256) # 256K
config = client.config()
client.register()
befor = datetime.datetime.now()
self.assertTrue(client.farm(delay=2, limit=2)) # check farm return true
after = datetime.datetime.now()
# check that farm did 2 pings with 2 sec delay
self.assertTrue(datetime.timedelta(seconds=2) <= (after - befor))
result = json.loads(
urlopen(url + '/api/online/json').read().decode('utf8')
)
result = [farmer for farmer in result['farmers']
if farmer['payout_addr'] == config['payout_address']]
last_seen = result[0]['last_seen']
reg_time = result[0]['reg_time']
# check bandwidth and pop as expected result cannot be know
bandwidth_upload = result[0].pop('bandwidth_upload')
bandwidth_download = result[0].pop('bandwidth_download')
self.assertGreater(bandwidth_upload, 0)
self.assertGreater(bandwidth_download, 0)
result = json.dumps(result, sort_keys=True)
expected = json.dumps([{
'height': 2,
'nodeid': common.address2nodeid(config['payout_address']),
'last_seen': last_seen,
'payout_addr': config['payout_address'],
'reg_time': reg_time,
"ip": "",
'uptime': 100.0
}], sort_keys=True)
self.assertEqual(result, expected)
class TestClientAudit(AbstractTestSetup, unittest.TestCase):
@unittest.skip("to many blockchain api requests")
def test_audit(self):
client = api.Client(url=url,
config_path=tempfile.mktemp(),
max_size=1024 * 256) # 256K
client.register()
self.assertTrue(client.audit(delay=1, limit=1))
class TestClientCliArgs(AbstractTestSetup, unittest.TestCase):
def test_version(self):
args = [
"--config_path=" + tempfile.mktemp(),
"version"
]
self.assertTrue(cli.main(args))
def test_freespace(self):
args = [
"--config_path=" + tempfile.mktemp(),
"freespace"
]
self.assertTrue(cli.main(args))
def test_poll(self):
path = tempfile.mktemp()
args = [
"--url=" + url,
"--config_path=" + path,
"register",
]
cli.main(args)
args = [
"--url=" + url,
"--config_path=" + path,
"poll",
"--delay=0",
"--limit=0"
] # no pings needed for check args
self.assertTrue(cli.main(args))
def test_register(self):
args = [
"--url=" + url,
"--config_path=" + tempfile.mktemp(),
"register"
]
self.assertTrue(cli.main(args))
def test_build(self):
path = tempfile.mktemp()
args = [
"--url=" + url,
"--config_path=" + path,
"register",
]
cli.main(args)
args = [
"--url=" + url,
"--config_path=" + path,
"--max_size=" + str(1024 * 256), # 256K
"--min_free_size=" + str(1024 * 256), # 256K
"build",
"--workers=4",
"--cleanup",
"--rebuild",
"--repair",
"--set_height_interval=3"
]
self.assertTrue(cli.main(args))
def test_audit(self):
path = tempfile.mktemp()
args = [
"--url=" + url,
"--config_path=" + path,
"register",
]
cli.main(args)
args = [
"--url=" + url,
"--config_path=" + path,
"audit",
"--delay=0",
"--limit=0"
] # no audit needed for check args
self.assertTrue(cli.main(args))
def test_farm(self):
args = [
"--url=" + url,
"--config_path=" + tempfile.mktemp(),
"--max_size=" + str(1024 * 256), # 256K
"--min_free_size=" + str(1024 * 256), # 256K
"farm",
"--workers=4",
"--cleanup",
"--rebuild",
"--repair",
"--set_height_interval=3",
"--delay=0",
"--limit=0"
] # no pings needed for check args
self.assertTrue(cli.main(args))
def test_ping(self):
config_path = tempfile.mktemp()
args = [
"--url=" + url,
"--config_path=" + config_path,
"register"
]
self.assertTrue(cli.main(args))
args = [
"--url=" + url,
"--config_path=" + config_path,
"ping"
]
self.assertTrue(cli.main(args))
def test_no_command_error(self):
def callback():
cli.main([])
self.assertRaises(SystemExit, callback)
def test_input_error(self):
def callback():
path = tempfile.mktemp()
cli.main([
"--url=" + url,
"--config_path=" + path,
"register",
])
cli.main([
"--url=" + url,
"--config_path=" + path,
"poll",
"--delay=5",
"--limit=xyz"
])
self.assertRaises(ValueError, callback)
class TestConfig(AbstractTestSetup, unittest.TestCase):
def test_show(self):
payout_wif = self.btctxstore.create_key()
hwif = self.btctxstore.create_wallet()
payout_address = self.btctxstore.get_address(payout_wif)
client = api.Client(config_path=tempfile.mktemp())
config = client.config(set_wallet=hwif,
set_payout_address=payout_address)
self.assertEqual(config["wallet"], hwif)
self.assertEqual(config["payout_address"], payout_address)
def test_validation(self):
def callback():
client = api.Client(config_path=tempfile.mktemp())
client.config(set_payout_address="invalid")
self.assertRaises(exceptions.InvalidAddress, callback)
def test_persistance(self):
config_path = tempfile.mktemp()
a = api.Client(config_path=config_path).config()
b = api.Client(config_path=config_path).config()
c = api.Client(config_path=config_path).config()
self.assertEqual(a, b, c)
self.assertTrue(c["wallet"] is not None)
if __name__ == '__main__':
unittest.main()
| 33.660777 | 80 | 0.571961 |
262f646f859f8b9806853db5ebd288fc121a825e | 2,735 | swift | Swift | Assault-of-fortress/SceneMap/SquareMap.swift | teddyzxcv/AOF-Demo | 1a36906ac005603da6a5d4e20217d2365a83405d | [
"MIT"
] | null | null | null | Assault-of-fortress/SceneMap/SquareMap.swift | teddyzxcv/AOF-Demo | 1a36906ac005603da6a5d4e20217d2365a83405d | [
"MIT"
] | null | null | null | Assault-of-fortress/SceneMap/SquareMap.swift | teddyzxcv/AOF-Demo | 1a36906ac005603da6a5d4e20217d2365a83405d | [
"MIT"
] | null | null | null | //
// SquareMap.swift
// ARMultiuser
//
// Created by ZhengWu Pan on 14.03.2022.
// Copyright ยฉ 2022 Apple. All rights reserved.
//
import Foundation
import DequeModule
import ARKit
class Square: Codable{
// ะกะบะพัะพััั "ัะพััะฐ ะฒััะพัั" ะบะปะตัะบะธ
var speed = 0
// ะััะพัะฐ ะบะปะตัะบะธ ะฒ ะบะฐะบะพะผ-ัะพ ะพะฟัะตะดะตะปัะฝะฝะพะผ ัะฐะฝะบะต
var main = 0
// ะะพะปะธัะตััะฒะพ "ะฟะพัะตัะตะฝะธะน" ะบะปะตัะบะธ
var count = 0
// ะขะธะฟ ะฟะพะฒะตัั
ะฝััะธ, ะบะพัะพัะฐั ะฑัะดะตั ัะฐัะฟะพะปะฐะณะฐัััั ะฝะฐ ะบะปะตัะบะต
var id = 0
// ะัะพะณะพะฒะฐั (ััะตะดะฝัั) ะฒััะพัะฐ ะบะปะตัะบะธ ะฟะพ ะฒัะตะผ ัะฐะฝะบะฐะผ, ั ััััะพะผ ะฑะปะธะทะพััะธ ะพั ัะตะฝััะพะฒ ะณะตะฝะตัะฐัะธะน
var height = 0
// ะะพะฟะฝัะปะฐ ะปะธ ะตัั ััะฐ ะบะปะตัะบะฐ ะฟัะธ ะณะตะฝะตัะฐัะธะธ ะบะพะฝะบัะตัะฝะพะณะพ ัะฐะฝะบะฐ?
var turn = 0
// "ะะตั", ะฝะฐ ะบะพัะพััะน ะฝัะถะฝะพ ะดะตะปะธัั self.heigth, ะดะปั ะฟะพะปััะตะฝะธั ััะตะดะฝะตะน ะฒััะพัั
var delta = 0
// ะฏะฒะปัะตััั ะปะธ ะณะตะฝะตัะธััะตะผัะน ัะฐะฝะบ - ัะฐะฝะบะพะผ ัััะธ?
var type = 0
// ะขะธะฟ "ะฑะธะพะผะฐ", ะฟะพ ะบะพัะพัะพะผั ะฑะตะดะตั ะณะตะฝะตัะธัะพะฒะฐัััั ัะฐะฝะบ
var typeres = 0
var x = 0
var y = 0
}
class Map: Codable {
var size : Int
// ะะฐััะฐ ะฒััะพั.
var heights: [[Int]] = [[Int]]()
// ะะฐััะฐ ัะตััััะพะฒ.
var resources: [[Int]] = [[Int]]()
// ะะพะพัะดะธะฝะฐัั ะฟะตัะฒะพะณะพ ะธะณัะพะบะฐ
var first_x: Int = 0
var first_y: Int = 0
// ะะพะพัะดะธะฝะฐัั ะฒัะพัะพะณะพ ะธะณัะพะบะฐ.
var second_x: Int = 0
var second_y: Int = 0
init(size: Int) {
self.size = size
for indexX in 0..<size{
var x = [Int]()
var resource = [Int]()
for indexY in 0..<size {
x.append(Int.random(in: 1...5))
resource.append(Int.random(in: 0...4))
}
heights.append(x)
resources.append(resource)
}
first_y = Int.random(in: 0..<size)
first_x = Int.random(in: 0..<size)
second_y = Int.random(in: 0..<size)
second_x = Int.random(in: 0..<size)
}
func generateRandomPlayersPosition(){
first_y = Int.random(in: 0..<size)
first_x = Int.random(in: 0..<size)
second_y = Int.random(in: 0..<size)
second_x = Int.random(in: 0..<size)
}
init() {
first_x = 0
first_y = 0
// ะะพะพัะดะธะฝะฐัั ะฒัะพัะพะณะพ ะธะณัะพะบะฐ.
second_x = 0
second_y = 0
size = 0
// ะะฐััะฐ ะฒััะพั.
heights = [[Int]]()
// ะะฐััะฐ ัะตััััะพะฒ.
resources = [[Int]]()
}
// ---------------------------------------ะัะฟะพะผะพะฝะฐัะตะปัะฝัะต ะผะฐััะธะฒั---------------------------------------
var stock: [[Square]] = [[Square]]()
//var under_development: Deque<(Int, Int)> = []
var turn_cleaning: [Square] = [Square]()
var interpolated_map: [[Int]] = [[Int]]()
var resources_map: [[Int]] = [[Int]]()
//var resources_lists: [(Int, Int)] = [(Int, Int)]()
}
| 28.195876 | 108 | 0.542596 |
d5cacfa5c666bac84b47b38f9ea8517125d038f9 | 1,582 | c | C | d/guilds/order/hall/path4.c | Dbevan/SunderingShadows | 6c15ec56cef43c36361899bae6dc08d0ee907304 | [
"MIT"
] | 13 | 2019-07-19T05:24:44.000Z | 2021-11-18T04:08:19.000Z | d/guilds/order/hall/path4.c | Dbevan/SunderingShadows | 6c15ec56cef43c36361899bae6dc08d0ee907304 | [
"MIT"
] | 4 | 2021-03-15T18:56:39.000Z | 2021-08-17T17:08:22.000Z | d/guilds/order/hall/path4.c | Dbevan/SunderingShadows | 6c15ec56cef43c36361899bae6dc08d0ee907304 | [
"MIT"
] | 13 | 2019-09-12T06:22:38.000Z | 2022-01-31T01:15:12.000Z | #include <std.h>
inherit ROOM;
void create(){
::create();
set_terrain(OLD_MOUNTS);
set_travel(FOOT_PATH);
set_short("Torn path toward the ruins of a once grand stronghold");
set_long(
@OLI
%^BOLD%^%^RED%^Before the broken gate of a once grand stronghold%^RESET%^
The rushing stream that once was here is now a shallow murky mess.
Obviously whatever attacked and took over this stronghold filled in the
stream. The drawbridge that was once on the opposite side is now no more
than a few blunted boards. The once white stone of the walls is now gray
with ashes. Streaks of black where siege towers burned dot the tops of the
now broken walls. The attackers must have had grand sappers, for at least two gaping holes exist in the walls.
OLI
);
set_property("light",2);
set_smell("default","You can smell the blackened walls and the now slow and fetid stream.");
set_listen("default","There is only the creak of wind from deep within the ruins.");
set_exits(([
"northeast":"/d/guilds/order/hall/path3",
"south":"/d/guilds/order/hall/main"
]));
}
void init(){
::init();
//add_action("call","lower");
}
int call(string str){
if(member_array("Order of the Metallic Dragon",TP->query_guild()) < 0) return 0;
if(!str || (str != "bridge" && str != "draw bridge"))
return notify_fail("lower bridge\n");
tell_object(TP,"The draw bridge lowers and allows you to enter.");
tell_room(TO,"The draw bridge lowers and allows "+TPQCN+" to enter",TP);
TP->move_player("/d/guilds/order/hall/main");
return 1;
}
| 32.285714 | 110 | 0.694058 |
e76f2748aeaec0e66eb5cf34fd9b37387d6782e8 | 1,107 | kt | Kotlin | box/src/main/kotlin/com/mrt/box/core/Vm.kt | myrealtrip/box | c62c29ac8325c359c40d1edf6c6b1fa0fd9bc0c3 | [
"Unlicense",
"MIT"
] | 33 | 2020-02-18T08:35:10.000Z | 2022-03-23T04:38:22.000Z | box/src/main/kotlin/com/mrt/box/core/Vm.kt | jaeho/box | 8f8b8a33cfc0f8e89a113f992653f6f922cd3333 | [
"Unlicense",
"MIT"
] | 1 | 2020-03-06T01:48:11.000Z | 2020-03-09T01:08:36.000Z | box/src/main/kotlin/com/mrt/box/core/Vm.kt | jaeho/box | 8f8b8a33cfc0f8e89a113f992653f6f922cd3333 | [
"Unlicense",
"MIT"
] | 5 | 2020-02-19T06:12:36.000Z | 2021-09-07T11:56:07.000Z | package com.mrt.box.core
/**
* Created by jaehochoe on 2020-01-03.
*/
interface Vm {
fun intent(event: Any): Any?
fun intentIf(condition: Boolean, className: String, vararg arguments: Any): Any? {
return if (condition)
intent(className, *arguments)
else null
}
fun intent(className: String, vararg arguments: Any): Any? {
return try {
Class.forName(className)?.let { clazz ->
try {
intent(clazz.constructors[0].newInstance(*arguments))
} catch (e: Exception) {
try {
intent(
clazz.getConstructor(*arguments.map { it::class.java as Class<*> }
.toTypedArray()).newInstance(
*arguments
)
)
} catch (e: Exception) {
Box.log { e }
}
}
}
} catch (e: Exception) {
Box.log { e }
}
}
} | 31.628571 | 94 | 0.424571 |
6b69a70c42f47439cd3dd773a7c131ecdda2e956 | 3,173 | swift | Swift | Chapter 6/Drawing/Drawing/CustomView.swift | PacktPublishing/iOS-Programming-Cookbook | deb86a746de26194aa6a1e5d92fc9990d8e891d9 | [
"MIT"
] | 6 | 2017-04-07T23:26:23.000Z | 2021-08-21T03:35:24.000Z | Chapter 6/Drawing/Drawing/CustomView.swift | PacktPublishing/iOS-Programming-Cookbook | deb86a746de26194aa6a1e5d92fc9990d8e891d9 | [
"MIT"
] | null | null | null | Chapter 6/Drawing/Drawing/CustomView.swift | PacktPublishing/iOS-Programming-Cookbook | deb86a746de26194aa6a1e5d92fc9990d8e891d9 | [
"MIT"
] | 5 | 2017-03-30T06:36:31.000Z | 2021-08-21T22:16:11.000Z | //
// CustomView.swift
// Drawing
//
// Created by Hossam Ghareeb on 9/16/16.
// Copyright ยฉ 2016 Hossam Ghareeb. All rights reserved.
//
import UIKit
class CustomView: UIView {
var satisfaction: CGFloat = 0.5{
didSet{
self.setNeedsDisplay()
}
}
override func draw(_ rect: CGRect) {
// Drawing code
if let context = UIGraphicsGetCurrentContext(){
let yellow = UIColor.yellow
context.setFillColor(yellow.cgColor)
context.fill(self.bounds)
// Drawing the face.
context.setStrokeColor(UIColor.black.cgColor)
context.setLineWidth(3.0)
let radius = min(rect.width, rect.height) * 0.75 / 2
context.addArc(center: CGPoint(x: rect.midX, y: rect.midY), radius: radius, startAngle: 0, endAngle: CGFloat(2 * M_PI), clockwise: false)
// Gradient color
let colorSpace = CGColorSpaceCreateDeviceRGB()
let componentCount : Int = 2
let components : [CGFloat] = [
0.0, 1.0, 0.0, 1.0,
0.0, 0.0, 1.0, 1.0
]
let locations : [CGFloat] = [0, 1]
let gradient = CGGradient(colorSpace: colorSpace, colorComponents: components, locations: locations, count: componentCount)
context.drawLinearGradient(gradient!, start: CGPoint.zero, end: CGPoint(x: rect.maxX, y: rect.maxY), options: .drawsBeforeStartLocation)
context.strokePath()
/// Drawing Eyes
// Left eye
context.addArc(center: CGPoint(x: rect.midX - radius / 2, y: rect.midY - radius / 2), radius: 4.0, startAngle: 0, endAngle: CGFloat(2 * M_PI), clockwise: false)
// Right eye
context.addArc(center: CGPoint(x: rect.midX + radius / 2, y: rect.midY - radius / 2), radius: 4.0, startAngle: 0, endAngle: CGFloat(2 * M_PI), clockwise: false)
let noseSize = CGSize(width: 4, height: 16)
context.addRect(CGRect(x: rect.midX - noseSize.width / 2, y: rect.midY - noseSize.height / 2, width: noseSize.width, height: noseSize.height))
context.setFillColor(UIColor.red.cgColor)
context.fillPath()
let startPoint = CGPoint(x: rect.midX - radius / 2, y: rect.midY + radius / 2)
let endPoint = CGPoint(x: rect.midX + radius / 2, y: startPoint.y)
context.move(to: startPoint)
let cp = CGPoint(x: rect.midX, y: (startPoint.y) * (satisfaction + 0.5))
context.addQuadCurve(to: endPoint, control: cp)
// Filling
context.strokePath()
var status: NSString
switch satisfaction {
case let val where val == 0.5:
status = "Neutral"
case let val where val < 0.5:
status = "Sad"
default:
status = "Happy"
}
status.draw(at: CGPoint(x: 5, y: 5), withAttributes: nil)
}
}
}
| 38.228916 | 172 | 0.541128 |
b981a2e4b231e8be551f16c5534415ea3744fcc2 | 2,639 | h | C | src/error.h | timvdm/Helium | 79db85da43f20606710263f800deac52534d437e | [
"BSD-3-Clause"
] | 13 | 2015-02-04T17:02:25.000Z | 2018-04-25T22:48:52.000Z | src/error.h | timvdm/Helium | 79db85da43f20606710263f800deac52534d437e | [
"BSD-3-Clause"
] | null | null | null | src/error.h | timvdm/Helium | 79db85da43f20606710263f800deac52534d437e | [
"BSD-3-Clause"
] | 4 | 2015-11-27T06:19:40.000Z | 2021-04-20T17:35:41.000Z | /*
* Copyright (c) 2013, Tim Vandermeersch
* 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 the <organization> 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 <COPYRIGHT HOLDER> 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.
*/
#ifndef HELIUM_ERROR_H
#define HELIUM_ERROR_H
namespace Helium {
/**
* @file error.h
* @brief Error class.
*/
/**
* @class Error error.h <Helium/error.h>
* @brief Class representing an error.
*/
class Error
{
public:
/**
* @brief Default constructor.
*
* This constructor creates a non-error Error object.
*/
Error() : m_error(false)
{
}
/**
* @brief Constructor.
*
* @param what The error message.
*/
Error(const std::string &what) : m_error(true), m_what(what)
{
}
/**
* @brief Check whether the error is set.
*
* @return True if the error is set.
*/
operator bool() const
{
return m_error;
}
/**
* @brief Get the error message.
*/
const std::string& what() const
{
return m_what;
}
private:
bool m_error; //!< True if error is set.
std::string m_what; //!< The error message.
};
}
#endif
| 29.988636 | 82 | 0.653657 |
72cd38179de51a65822eadb582c3d244464b56bf | 268 | sql | SQL | src/main/resources/database/changes/release-9.39.0/sample_initial_data.sql | ONSdigital/rm-sample-service | 8c898486b364bc50047b640daa22d30724b605a8 | [
"MIT"
] | 4 | 2017-05-02T12:57:50.000Z | 2018-11-13T14:39:36.000Z | src/main/resources/database/changes/release-9.39.0/sample_initial_data.sql | ONSdigital/rm-sample-service | 8c898486b364bc50047b640daa22d30724b605a8 | [
"MIT"
] | 139 | 2017-04-26T14:16:58.000Z | 2022-03-30T09:46:59.000Z | src/main/resources/database/changes/release-9.39.0/sample_initial_data.sql | ONSdigital/rm-sample-service | 8c898486b364bc50047b640daa22d30724b605a8 | [
"MIT"
] | 3 | 2018-10-05T11:35:19.000Z | 2021-04-11T07:45:50.000Z | SET SCHEMA 'sample';
INSERT INTO sample.samplesummarystate(state) VALUES('INIT');
INSERT INTO sample.samplesummarystate(state) VALUES('ACTIVE');
INSERT INTO sample.sampleunitstate(state) VALUES('INIT');
INSERT INTO sample.sampleunitstate(state) VALUES('DELIVERED');
| 33.5 | 62 | 0.791045 |