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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4db70b8b0d8a54f8d0e1ab96ecfc9b4bc3d99348 | 307 | asm | Assembly | programs/oeis/055/A055156.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/055/A055156.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/055/A055156.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A055156: Powers of 3 which are not powers of 3^3.
; 3,9,81,243,2187,6561,59049,177147,1594323,4782969,43046721,129140163,1162261467,3486784401,31381059609,94143178827,847288609443,2541865828329,22876792454961,68630377364883,617673396283947
mul $0,3
div $0,2
mov $1,3
pow $1,$0
div $1,2
mul $1,6
add $1,3
| 27.909091 | 189 | 0.778502 |
e2da55f4268b857e5da928404648475143ac67a0 | 4,876 | swift | Swift | MLDialogFlow/src/speech/SpeechManager.swift | seatcode/MLDialogFlow | 7d1bd13a292642e474d2a1252d6069d57d75365b | [
"MIT"
] | 1 | 2020-04-18T03:46:27.000Z | 2020-04-18T03:46:27.000Z | MLDialogFlow/src/speech/SpeechManager.swift | seatcode/MLDialogFlow | 7d1bd13a292642e474d2a1252d6069d57d75365b | [
"MIT"
] | null | null | null | MLDialogFlow/src/speech/SpeechManager.swift | seatcode/MLDialogFlow | 7d1bd13a292642e474d2a1252d6069d57d75365b | [
"MIT"
] | null | null | null | //
// SpeechManager.swift
// MLDialogFlow
//
// Created by Eli Kohen on 25/01/2018.
// Copyright © 2018 Metropolis Lab. All rights reserved.
//
import Foundation
import Speech
class SpeechManager {
private let audioEngine = AVAudioEngine()
private var speechRecognizer: SFSpeechRecognizer?
private var recognitionTask: SFSpeechRecognitionTask?
private let speechSynthesizer = AVSpeechSynthesizer()
private let speechDelegate = SpeechSynthesizerDelegate()
var locale: Locale = Locale.current {
didSet {
speechRecognizer = SFSpeechRecognizer(locale: locale)
}
}
init() {
self.speechRecognizer = SFSpeechRecognizer(locale: locale)
speechSynthesizer.delegate = speechDelegate
}
}
extension SpeechManager: SpeechPermissions {
func requestPermissions(completion: @escaping (SpeechPermissionsState) -> Void) {
//Requesting microphone permission
AVAudioSession.sharedInstance().requestRecordPermission { granted in
if granted {
//Request speech recognition permission
SFSpeechRecognizer.requestAuthorization{ status in
DispatchQueue.main.async {
switch status {
case .authorized:
completion(.enabled)
case .notDetermined:
completion(.notDetermined)
case .denied, .restricted:
completion(.disabled)
}
}
}
} else {
DispatchQueue.main.async {
completion(.disabled)
}
}
}
}
}
extension SpeechManager: SpeechToText {
func startRecognizing(textHandler: @escaping (String?, Error?) -> Void) {
checkPermissions { [weak self] in self?.startRecording(textHandler: textHandler) }
}
func stopRecognizing() {
cancelRecording()
}
private func checkPermissions(completion: @escaping () -> Void) {
switch SFSpeechRecognizer.authorizationStatus() {
case .notDetermined:
SFSpeechRecognizer.requestAuthorization { status in
OperationQueue.main.addOperation {
switch status {
case .authorized:
completion()
default: break
}
}
}
case .authorized:
OperationQueue.main.addOperation {
completion()
}
case .denied, .restricted:
break
}
}
private func startRecording(textHandler: @escaping (String?, Error?) -> Void) {
cancelRecording()
let request = SFSpeechAudioBufferRecognitionRequest()
// Setup audio engine and speech recognizer
audioEngine.inputNode.installTap(onBus: 0, bufferSize: 1024, format: nil) { buffer, _ in
request.append(buffer)
}
// Prepare and start recording
audioEngine.prepare()
do {
try audioEngine.start()
} catch {
textHandler(nil, error)
return
}
// Analyze the speech
recognitionTask = speechRecognizer?.recognitionTask(with: request, resultHandler: { result, error in
if let resultText = result?.bestTranscription.formattedString, !resultText.isEmpty {
textHandler(resultText, nil)
} else if let error = error {
print(error.localizedDescription)
}
})
}
private func cancelRecording() {
audioEngine.stop()
audioEngine.inputNode.removeTap(onBus: 0)
recognitionTask?.cancel()
}
}
extension SpeechManager: TextToSpeech {
func speak(text: String, completion: (() -> Void)?) {
speechDelegate.completion = completion
setCorrectOutput()
let speechUtterance = AVSpeechUtterance(string: text)
speechUtterance.voice = AVSpeechSynthesisVoice(language: locale.identifier)
speechSynthesizer.speak(speechUtterance)
}
func cancelSpeak() {
speechSynthesizer.stopSpeaking(at: .immediate)
speechDelegate.completion?()
speechDelegate.completion = nil
}
private func setCorrectOutput() {
let audioSession = AVAudioSession.sharedInstance()
do {
try audioSession.setCategory(AVAudioSessionCategoryPlayAndRecord, with: [.mixWithOthers, .allowBluetooth, .defaultToSpeaker])
try audioSession.setMode(AVAudioSessionModeSpokenAudio)
} catch {
print("audioSession properties weren't set because of an error.")
}
}
}
| 31.662338 | 137 | 0.58347 |
1f5f45bc21734918ce6d249a58c99acda03818e6 | 1,841 | cpp | C++ | middleware/service/source/forward/main.cpp | casualcore/casual | 047a4eaabbba52ad3ce63dc698a9325ad5fcec6d | [
"MIT"
] | null | null | null | middleware/service/source/forward/main.cpp | casualcore/casual | 047a4eaabbba52ad3ce63dc698a9325ad5fcec6d | [
"MIT"
] | null | null | null | middleware/service/source/forward/main.cpp | casualcore/casual | 047a4eaabbba52ad3ce63dc698a9325ad5fcec6d | [
"MIT"
] | 1 | 2022-02-21T18:30:25.000Z | 2022-02-21T18:30:25.000Z | //!
//! Copyright (c) 2015, The casual project
//!
//! This software is licensed under the MIT license, https://opensource.org/licenses/MIT
//!
#include "service/forward/instance.h"
#include "service/forward/handle.h"
#include "service/forward/state.h"
#include "service/common.h"
#include "common/exception/guard.h"
#include "common/argument.h"
namespace casual
{
using namespace common;
namespace service::forward
{
namespace local
{
namespace
{
auto initialize()
{
Trace trace{ "service::forward::initialize"};
State result;
communication::instance::whitelist::connect( instance::identity);
return result;
}
auto condition( State& state)
{
return message::dispatch::condition::compose(
message::dispatch::condition::done( [&state]() { return state.done();})
);
}
void start( State state)
{
Trace trace{ "service::forward::start"};
log::line( verbose::log, "state: ", state);
auto handler = handle::create( state);
message::dispatch::pump(
local::condition( state),
handler,
communication::ipc::inbound::device());
}
void main( int argc, char **argv)
{
argument::Parse{ "service forward"}( argc, argv);
start( initialize());
}
} // <unnamed>
} // local
} // service::forward
} // casual
int main( int argc, char **argv)
{
return casual::common::exception::main::log::guard( [=]()
{
casual::service::forward::local::main( argc, argv);
});
}
| 23.602564 | 89 | 0.514938 |
90533185d499aa271967e27acac02dd110edb91e | 5,649 | py | Python | sympy/microlie/se3.py | evbernardes/sympy | 7bb56b0b8c5c05eed43e395ba1783ddda9230b67 | [
"BSD-3-Clause"
] | null | null | null | sympy/microlie/se3.py | evbernardes/sympy | 7bb56b0b8c5c05eed43e395ba1783ddda9230b67 | [
"BSD-3-Clause"
] | null | null | null | sympy/microlie/se3.py | evbernardes/sympy | 7bb56b0b8c5c05eed43e395ba1783ddda9230b67 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 10 16:00:21 2021
@author: evbernardes
"""
#from sympy.utilies import isiterable
from sympy import sqrt, sin, cos, acos, exp, ln, zeros
from sympy import sympify
from sympy import Matrix, BlockMatrix, ZeroMatrix, ones
from sympy import MatrixSymbol, Identity
from .base import LieGroupBase, TangentBase
from .helpers import I3, v0
from .helpers import V, Vinv
from .helpers import Exp_R3, Log_R3
from sympy.matrices.expressions.vee import vee, Vee
from sympy.matrices.expressions.hat import hat, Hat
class SE3(LieGroupBase):
def __init__(self, pos=v0, rot=I3):
if type(pos) == list:
pos = Matrix(pos)
pos = sympify(pos)
rot = sympify(rot)
try:
if pos.shape == (3, 1):
self.pos = pos
elif pos.shape == (1, 3):
self.pos = pos.T
else:
raise TypeError
except TypeError:
raise ValueError('Position must be a length 3 vector.')
try:
if rot.shape == (3, 3):
self.rot = rot
else:
raise TypeError
except TypeError:
raise ValueError('Rotation must be a 3x3 Matrix.')
if len(pos.atoms(MatrixSymbol)) > 0 and len(rot.atoms(MatrixSymbol)) > 0:
self.is_symbolic = True
else:
self.is_symbolic = False
def _identity(self):
"""Identity element."""
raise NotImplemented('Not yet implemented')
def _inverse(self):
""" ."""
return SE3(-self.rot.T * self.pos, self.rot.T)
def _compose(self,Elem):
"""With another Group element."""
if not isinstance(Elem,SE3):
raise NotImplemented
R1 = self.rot
R2 = Elem.rot
p1 = self.pos
p2 = Elem.pos
return SE3(p1 + R1*p2,R1*R2)
def _act(self,v):
"""Act on a vector."""
if v.shape == (1, 3):
return self.pos + self.rot * (v.T)
elif v.shape == (3, 1):
return self.pos + self.rot * v
else:
raise ValueError('Vector must have length == 3')
def _log(self):
"""Lift to tangent space."""
# ang = Log_R3(Matrix(self.rot)).vee()
ang = vee(ln(self.rot))
lin = Vinv(ang) * self.pos
return TgSE3(lin,ang)
def _Ad(self):
if self.is_symbolic:
return BlockMatrix([
[self.rot, self.pos.hat() * self.rot],
[0*self.rot, self.rot]])
else:
return Matrix([
[self.rot, self.pos.hat() * self.rot],
[zeros(3,3), self.rot]])
def _as_Matrix(self):
if self.is_symbolic:
return BlockMatrix([
[self.rot, self.pos],
[0*self.pos.T, ones(1)]])
else:
return Matrix([
[self.rot, self.pos],
[0, 0, 0, 1]])
def diff(self,*symbols, **assumptions):
pos = self.pos.diff(*symbols, **assumptions)
rot = self.rot.diff(*symbols, **assumptions)
return SE3(pos, rot)
def __print__(self):
return f'Matrix([[{self.pos}, {self.rot}], [0, 1]])'
class TgSE3(TangentBase):
def __init__(self, lin=v0, ang=v0):
if type(lin) == list:
lin = Matrix(lin)
if type(ang) == list:
ang = Matrix(ang)
lin = sympify(lin)
ang = sympify(ang)
try:
if lin.shape == (3, 1):
self.lin = lin
elif lin.shape == (1, 3):
self.lin = lin.T
else:
raise TypeError
except TypeError:
raise ValueError('Linear velocity must be a length 3 vector.')
try:
if ang.shape == (3, 1):
self.ang = ang
elif lin.shape == (1, 3):
self.ang = ang.T
else:
raise TypeError
except TypeError:
raise ValueError('Angular velocity must be a length 3 vector.')
if len(lin.atoms(MatrixSymbol)) > 0 and len(ang.atoms(MatrixSymbol)) > 0:
self.is_symbolic = True
else:
self.is_symbolic = False
def _as_Matrix(self):
if self.is_symbolic:
return BlockMatrix([[self.lin],[self.ang]])
else:
return Matrix([self.lin,self.ang])
def _hat(self):
"""Lie Algebra isomorphism."""
if self.is_symbolic:
return BlockMatrix([
[self.ang.hat(), self.lin],
[ZeroMatrix(1,3),ZeroMatrix(1,1)]])
else:
return Matrix([
[self.ang.hat(), self.lin],
[0,0,0,0]])
def _exp(self):
"""Retract to group element."""
# theta = Matrix(self.ang)
theta = self.ang
pos = V(theta) * self.lin
rot = exp(theta.hat())
return SE3(pos,rot)
def _ad(self):
if self.is_symbolic:
return BlockMatrix([
[self.ang.hat(), self.lin.hat()],
[ZeroMatrix(3,3), self.ang.hat()]])
else:
return Matrix([
[self.ang.hat(), self.lin.hat()],
[zeros(3,3), self.ang.hat()]])
def __print__(self):
return f'Matrix([{self.lin}, {self.ang}])'
| 29.731579 | 81 | 0.487166 |
f7368893685ccb430e6c47eb21b09cc072525ac1 | 1,398 | h | C | Debugo/Classes/API/DGConfiguration.h | SKCodeing/Debugo | 52d60c462a0637594d37493329444ed4825b6a57 | [
"MIT"
] | 123 | 2019-02-21T10:54:30.000Z | 2022-03-01T01:49:32.000Z | Debugo/Classes/API/DGConfiguration.h | SKCodeing/Debugo | 52d60c462a0637594d37493329444ed4825b6a57 | [
"MIT"
] | 11 | 2019-05-09T12:10:55.000Z | 2019-09-16T06:15:01.000Z | Debugo/Classes/API/DGConfiguration.h | SKCodeing/Debugo | 52d60c462a0637594d37493329444ed4825b6a57 | [
"MIT"
] | 27 | 2019-04-16T06:19:25.000Z | 2022-03-17T03:23:30.000Z | //
// DGConfiguration.h
// Debugo
//
// GitHub https://github.com/ripperhe/Debugo
// Created by ripper on 2018/9/1.
// Copyright © 2018年 ripper. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "DGActionPlugin.h"
#import "DGFilePlugin.h"
#import "DGAppInfoPlugin.h"
#import "DGAccountPlugin.h"
#import "DGApplePlugin.h"
#import "DGTouchPlugin.h"
#import "DGColorPlugin.h"
#import "DGPodPlugin.h"
NS_ASSUME_NONNULL_BEGIN
@interface DGConfiguration : NSObject
/// 添加自定义工具,需继承自 DGPlugin 或遵守 DGPluginProtocol 协议
- (void)addCustomPlugin:(Class<DGPluginProtocol>)plugin;
/// 将工具放到 tabBar 上;默认是 DGActionPlugin
/// 目前支持 DGActionPlugin DGFilePlugin DGAppInfoPlugin DGAccountPlugin DGColorPlugin DGPodPlugin
/// 以及实现了 pluginViewController 的自定义工具
- (void)putPluginsToTabBar:(nullable NSArray<Class<DGPluginProtocol>> *)plugins;
/// 自定义悬浮球的长按事件,可用于某些需要快捷操作的事情(点击事件是开启和关闭 Debug Window)
- (void)setupBubbleLongPressAction:(void (^)(void))block;
/// 配置指令
- (void)setupActionPlugin:(void (^)(DGActionPluginConfiguration *actionConfiguration))block;
/// 配置文件
- (void)setupFilePlugin:(void (^)(DGFilePluginConfiguration *fileConfiguration))block;
/// 配置快速登录
- (void)setupAccountPlugin:(void (^)(DGAccountPluginConfiguration *accountConfiguration))block;
/// 配置CocoaPods
- (void)setupPodPlugin:(void (^)(DGPodPluginConfiguration *podConfiguration))block;
@end
NS_ASSUME_NONNULL_END
| 27.411765 | 95 | 0.776109 |
68407b1c2b450649756870b13e09f8d192b25d44 | 1,453 | cpp | C++ | dbms/src/Common/tests/gtest_redact.cpp | solotzg/tiflash | 66f45c76692e941bc845c01349ea89de0f2cc210 | [
"Apache-2.0"
] | 85 | 2022-03-25T09:03:16.000Z | 2022-03-25T09:45:03.000Z | dbms/src/Common/tests/gtest_redact.cpp | solotzg/tiflash | 66f45c76692e941bc845c01349ea89de0f2cc210 | [
"Apache-2.0"
] | 7 | 2022-03-25T08:59:10.000Z | 2022-03-25T09:40:13.000Z | dbms/src/Common/tests/gtest_redact.cpp | solotzg/tiflash | 66f45c76692e941bc845c01349ea89de0f2cc210 | [
"Apache-2.0"
] | 11 | 2022-03-25T09:15:36.000Z | 2022-03-25T09:45:07.000Z | // Copyright 2022 PingCAP, Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <Common/RedactHelpers.h>
#include <TestUtils/TiFlashTestBasic.h>
namespace DB
{
namespace tests
{
TEST(RedactLog_test, Basic)
{
const char * test_key = "\x01\x0a\xff";
const size_t key_sz = strlen(test_key);
const DB::HandleID test_handle = 10009;
Redact::setRedactLog(false);
EXPECT_EQ(Redact::keyToDebugString(test_key, key_sz), "010AFF");
EXPECT_EQ(Redact::keyToHexString(test_key, key_sz), "010AFF");
EXPECT_EQ(Redact::handleToDebugString(test_handle), "10009");
Redact::setRedactLog(true);
EXPECT_EQ(Redact::keyToDebugString(test_key, key_sz), "?");
EXPECT_EQ(Redact::keyToHexString(test_key, key_sz), "010AFF"); // Unaffected by readact-log status
EXPECT_EQ(Redact::handleToDebugString(test_handle), "?");
Redact::setRedactLog(false); // restore flags
}
} // namespace tests
} // namespace DB
| 33.022727 | 102 | 0.72746 |
e532845017c16ad62598f3aaf21d5937b15fb5d4 | 21,433 | ts | TypeScript | X Card/scripts/not_opened.ts | HJOW/X-Card | 56daf48bb1b0144c109dc32b92300025a0ca9978 | [
"Apache-2.0"
] | null | null | null | X Card/scripts/not_opened.ts | HJOW/X-Card | 56daf48bb1b0144c109dc32b92300025a0ca9978 | [
"Apache-2.0"
] | null | null | null | X Card/scripts/not_opened.ts | HJOW/X-Card | 56daf48bb1b0144c109dc32b92300025a0ca9978 | [
"Apache-2.0"
] | null | null | null |
/*
This source is made by HJOW (hujinone22@naver.com)
This source should be imported after 'xcard.js' file is imported.
이 소스는 'xcard.js' 보다 나중에 삽입되어야 합니다.
*/
var hjow_processSecurityProcess = function (engineObject) {
// The code not opened will be placed here
// 이 곳에는 오픈소스로 공개할 수 없는 코드들이 위치할 예정입니다.
};
// var sampleReplay = { "date": "2019.1.7.16.37.56", "actions": [{ "date": "2019.1.7.16.37.57", "actionPlayerIndex": 1, "payTargetPlayerIndex": 0, "card": { "op": "-", "no": 5, "uniqueId": "p962360595728490892515515185180248987" } }, { "date": "2019.1.7.16.37.57", "actionPlayerIndex": 2, "payTargetPlayerIndex": 2, "card": { "op": "+", "no": 6, "uniqueId": "p841503778130676009739601646888313233" } }, { "date": "2019.1.7.16.37.58", "actionPlayerIndex": 3, "payTargetPlayerIndex": 3, "card": { "op": "+", "no": 9, "uniqueId": "p98151985460966916449152602597068263" } }, { "date": "2019.1.7.16.37.58", "actionPlayerIndex": 0, "payTargetPlayerIndex": -1, "card": null }, { "date": "2019.1.7.16.37.59", "actionPlayerIndex": 1, "payTargetPlayerIndex": 0, "card": { "op": "-", "no": 3, "uniqueId": "p307571150996011648187717378203390238" } }, { "date": "2019.1.7.16.37.59", "actionPlayerIndex": 2, "payTargetPlayerIndex": 0, "card": { "op": "-", "no": 6, "uniqueId": "p59232935216587099536327802144833041" } }, { "date": "2019.1.7.16.38.0", "actionPlayerIndex": 3, "payTargetPlayerIndex": 3, "card": { "op": "×", "no": 9, "uniqueId": "p3770715784279064697903410270519259" } }, { "date": "2019.1.7.16.38.0", "actionPlayerIndex": 0, "payTargetPlayerIndex": 3, "card": { "op": "×", "no": -1, "uniqueId": "p574551238478613277188669306712094781" } }, { "date": "2019.1.7.16.38.1", "actionPlayerIndex": 1, "payTargetPlayerIndex": 3, "card": { "op": "×", "no": 10, "uniqueId": "p259289427300961147871986366639180563" } }, { "date": "2019.1.7.16.38.1", "actionPlayerIndex": 2, "payTargetPlayerIndex": 3, "card": { "op": "×", "no": 4, "uniqueId": "p837782389837835597325314414698043" } }, { "date": "2019.1.7.16.38.2", "actionPlayerIndex": 3, "payTargetPlayerIndex": 3, "card": { "op": "×", "no": 0, "uniqueId": "p1020079795151087283620549594339886" } }, { "date": "2019.1.7.16.38.2", "actionPlayerIndex": 0, "payTargetPlayerIndex": -1, "card": null }, { "date": "2019.1.7.16.38.3", "actionPlayerIndex": 1, "payTargetPlayerIndex": 3, "card": { "op": "-", "no": 1, "uniqueId": "p796459581320118144473590122533407524" } }, { "date": "2019.1.7.16.38.3", "actionPlayerIndex": 2, "payTargetPlayerIndex": 0, "card": { "op": "-", "no": 4, "uniqueId": "p4287178344301545435520034547874859" } }, { "date": "2019.1.7.16.38.4", "actionPlayerIndex": 3, "payTargetPlayerIndex": 2, "card": { "op": "-", "no": 1, "uniqueId": "p228058477959010902167055237200914493" } }, { "date": "2019.1.7.16.38.4", "actionPlayerIndex": 0, "payTargetPlayerIndex": 3, "card": { "op": "-", "no": 8, "uniqueId": "p52952042353467095387389923737411203" } }, { "date": "2019.1.7.16.38.5", "actionPlayerIndex": 1, "payTargetPlayerIndex": 1, "card": { "op": "×", "no": 3, "uniqueId": "p23838062397223492927627537722827469" } }, { "date": "2019.1.7.16.38.5", "actionPlayerIndex": 2, "payTargetPlayerIndex": 0, "card": { "op": "×", "no": 1, "uniqueId": "p17240379638844141747800334930942356" } }, { "date": "2019.1.7.16.38.6", "actionPlayerIndex": 3, "payTargetPlayerIndex": 1, "card": { "op": "×", "no": 7, "uniqueId": "p76860486040104810489758123928529216" } }, { "date": "2019.1.7.16.38.6", "actionPlayerIndex": 0, "payTargetPlayerIndex": 3, "card": { "op": "-", "no": 7, "uniqueId": "p249346322433918603826591671957912836" } }, { "date": "2019.1.7.16.38.7", "actionPlayerIndex": 1, "payTargetPlayerIndex": 0, "card": { "op": "×", "no": 4, "uniqueId": "p42610166195918904298498166455015074" } }, { "date": "2019.1.7.16.38.7", "actionPlayerIndex": 2, "payTargetPlayerIndex": 2, "card": { "op": "-", "no": -1, "uniqueId": "p461206747471394653127157471586438155" } }, { "date": "2019.1.7.16.38.8", "actionPlayerIndex": 3, "payTargetPlayerIndex": -1, "card": null }, { "date": "2019.1.7.16.38.8", "actionPlayerIndex": 0, "payTargetPlayerIndex": 2, "card": { "op": "×", "no": 1, "uniqueId": "p21659588953961893337853966511392940" } }, { "date": "2019.1.7.16.38.9", "actionPlayerIndex": 1, "payTargetPlayerIndex": 2, "card": { "op": "×", "no": -1, "uniqueId": "p542385367629237263965544087356686240" } }, { "date": "2019.1.7.16.38.9", "actionPlayerIndex": 2, "payTargetPlayerIndex": 0, "card": { "op": "+", "no": 4, "uniqueId": "p506847927512151643480809387471646011" } }, { "date": "2019.1.7.16.38.10", "actionPlayerIndex": 3, "payTargetPlayerIndex": -1, "card": null }, { "date": "2019.1.7.16.38.10", "actionPlayerIndex": 0, "payTargetPlayerIndex": 0, "card": { "op": "+", "no": 5, "uniqueId": "p3869630593948102965996610796181457" } }, { "date": "2019.1.7.16.38.11", "actionPlayerIndex": 1, "payTargetPlayerIndex": 2, "card": { "op": "×", "no": 2, "uniqueId": "p36024507276471055697946743814305381" } }, { "date": "2019.1.7.16.38.11", "actionPlayerIndex": 2, "payTargetPlayerIndex": 0, "card": { "op": "+", "no": -1, "uniqueId": "p287193766464353936716686431833349833" } }, { "date": "2019.1.7.16.38.12", "actionPlayerIndex": 3, "payTargetPlayerIndex": 0, "card": { "op": "+", "no": 3, "uniqueId": "p25551679380243608555891132439916072" } }, { "date": "2019.1.7.16.38.12", "actionPlayerIndex": 0, "payTargetPlayerIndex": 2, "card": { "op": "×", "no": 5, "uniqueId": "p96683570474155243636215004150350283" } }, { "date": "2019.1.7.16.38.13", "actionPlayerIndex": 1, "payTargetPlayerIndex": -1, "card": null }, { "date": "2019.1.7.16.38.13", "actionPlayerIndex": 2, "payTargetPlayerIndex": 0, "card": { "op": "+", "no": 6, "uniqueId": "p208931444957341164568819322493004811" } }, { "date": "2019.1.7.16.38.14", "actionPlayerIndex": 3, "payTargetPlayerIndex": 2, "card": { "op": "×", "no": 9, "uniqueId": "p675222356451743034877004056115249342" } }, { "date": "2019.1.7.16.38.14", "actionPlayerIndex": 0, "payTargetPlayerIndex": 2, "card": { "op": "-", "no": 1, "uniqueId": "p43532492583279026822202688656300388" } }, { "date": "2019.1.7.16.38.15", "actionPlayerIndex": 1, "payTargetPlayerIndex": 2, "card": { "op": "-", "no": 4, "uniqueId": "p389513793109550519488477946228846116" } }, { "date": "2019.1.7.16.38.15", "actionPlayerIndex": 2, "payTargetPlayerIndex": -1, "card": null }, { "date": "2019.1.7.16.38.16", "actionPlayerIndex": 3, "payTargetPlayerIndex": 3, "card": { "op": "-", "no": 9, "uniqueId": "p364399922698082043876950032890656794" } }, { "date": "2019.1.7.16.38.16", "actionPlayerIndex": 0, "payTargetPlayerIndex": 3, "card": { "op": "-", "no": 5, "uniqueId": "p413084051101626473909788322651006499" } }, { "date": "2019.1.7.16.38.17", "actionPlayerIndex": 1, "payTargetPlayerIndex": -1, "card": null }, { "date": "2019.1.7.16.38.17", "actionPlayerIndex": 2, "payTargetPlayerIndex": -1, "card": null }, { "date": "2019.1.7.16.38.18", "actionPlayerIndex": 3, "payTargetPlayerIndex": -1, "card": null }, { "date": "2019.1.7.16.38.18", "actionPlayerIndex": 0, "payTargetPlayerIndex": 2, "card": { "op": "-", "no": 4, "uniqueId": "p277176733383137574857885598474619835" } }, { "date": "2019.1.7.16.38.19", "actionPlayerIndex": 1, "payTargetPlayerIndex": 3, "card": { "op": "-", "no": 0, "uniqueId": "p373853329536560451428556171411817497" } }, { "date": "2019.1.7.16.38.19", "actionPlayerIndex": 2, "payTargetPlayerIndex": 0, "card": { "op": "+", "no": 6, "uniqueId": "p795586282595973823359351758486107676" } }, { "date": "2019.1.7.16.38.20", "actionPlayerIndex": 3, "payTargetPlayerIndex": 2, "card": { "op": "-", "no": 0, "uniqueId": "p42511492167628487751198936193684884" } }, { "date": "2019.1.7.16.38.20", "actionPlayerIndex": 0, "payTargetPlayerIndex": -1, "card": null }, { "date": "2019.1.7.16.38.21", "actionPlayerIndex": 1, "payTargetPlayerIndex": -1, "card": null }, { "date": "2019.1.7.16.38.21", "actionPlayerIndex": 2, "payTargetPlayerIndex": 2, "card": { "op": "-", "no": 1, "uniqueId": "p37510290751165015787225680388318378" } }, { "date": "2019.1.7.16.38.22", "actionPlayerIndex": 3, "payTargetPlayerIndex": 0, "card": { "op": "+", "no": 9, "uniqueId": "p1196671872511427192711507734131394" } }, { "date": "2019.1.7.16.38.22", "actionPlayerIndex": 0, "payTargetPlayerIndex": 0, "card": { "op": "+", "no": 2, "uniqueId": "p127312155693358599219851215422121989" } }, { "date": "2019.1.7.16.38.23", "actionPlayerIndex": 1, "payTargetPlayerIndex": 0, "card": { "op": "+", "no": 8, "uniqueId": "p374666992185079866341001410694079969" } }, { "date": "2019.1.7.16.38.23", "actionPlayerIndex": 2, "payTargetPlayerIndex": -1, "card": null }, { "date": "2019.1.7.16.38.24", "actionPlayerIndex": 3, "payTargetPlayerIndex": -1, "card": null }, { "date": "2019.1.7.16.38.24", "actionPlayerIndex": 0, "payTargetPlayerIndex": 0, "card": { "op": "+", "no": 10, "uniqueId": "p936617269790450773871347782742065746" } }, { "date": "2019.1.7.16.38.25", "actionPlayerIndex": 1, "payTargetPlayerIndex": 3, "card": { "op": "-", "no": 10, "uniqueId": "p77253878126252182223825333255451023" } }, { "date": "2019.1.7.16.38.25", "actionPlayerIndex": 2, "payTargetPlayerIndex": -1, "card": null }, { "date": "2019.1.7.16.38.26", "actionPlayerIndex": 3, "payTargetPlayerIndex": -1, "card": null }, { "date": "2019.1.7.16.38.26", "actionPlayerIndex": 0, "payTargetPlayerIndex": 0, "card": { "op": "+", "no": 9, "uniqueId": "p514510703361077268967348713420439929" } }, { "date": "2019.1.7.16.38.27", "actionPlayerIndex": 1, "payTargetPlayerIndex": 0, "card": { "op": "+", "no": 5, "uniqueId": "p632055479915138631563063842842895707" } }], "players": [{ "type": "XCardAIPlayer", "name": "AI 0", "inventory": [{ "op": "-", "no": 5, "uniqueId": "p413084051101626473909788322651006499" }, { "op": "×", "no": 5, "uniqueId": "p96683570474155243636215004150350283" }, { "op": "×", "no": -1, "uniqueId": "p574551238478613277188669306712094781" }, { "op": "×", "no": 1, "uniqueId": "p21659588953961893337853966511392940" }, { "op": "-", "no": 8, "uniqueId": "p52952042353467095387389923737411203" }, { "op": "+", "no": 2, "uniqueId": "p249976678335086633887428585163728022" }, { "op": "-", "no": 1, "uniqueId": "p43532492583279026822202688656300388" }, { "op": "-", "no": 4, "uniqueId": "p277176733383137574857885598474619835" }, { "op": "+", "no": 9, "uniqueId": "p514510703361077268967348713420439929" }, { "op": "-", "no": 7, "uniqueId": "p249346322433918603826591671957912836" }], "applied": [], "uniqueId": "p126715540452454727834422531744445812", "difficulty": 0, "customAIScript": null }, { "type": "XCardAIPlayer", "name": "AI 1", "inventory": [{ "op": "×", "no": 3, "uniqueId": "p23838062397223492927627537722827469" }, { "op": "×", "no": -1, "uniqueId": "p542385367629237263965544087356686240" }, { "op": "-", "no": 5, "uniqueId": "p962360595728490892515515185180248987" }, { "op": "×", "no": 10, "uniqueId": "p259289427300961147871986366639180563" }, { "op": "-", "no": 0, "uniqueId": "p373853329536560451428556171411817497" }, { "op": "-", "no": 4, "uniqueId": "p389513793109550519488477946228846116" }, { "op": "-", "no": 1, "uniqueId": "p796459581320118144473590122533407524" }, { "op": "×", "no": 2, "uniqueId": "p36024507276471055697946743814305381" }, { "op": "×", "no": 4, "uniqueId": "p42610166195918904298498166455015074" }, { "op": "-", "no": 3, "uniqueId": "p307571150996011648187717378203390238" }], "applied": [], "uniqueId": "p726508666672546974278065362901075011", "difficulty": 0, "customAIScript": null }, { "type": "XCardAIPlayer", "name": "AI 2", "inventory": [{ "op": "+", "no": 6, "uniqueId": "p208931444957341164568819322493004811" }, { "op": "+", "no": 6, "uniqueId": "p795586282595973823359351758486107676" }, { "op": "-", "no": -1, "uniqueId": "p461206747471394653127157471586438155" }, { "op": "+", "no": 4, "uniqueId": "p506847927512151643480809387471646011" }, { "op": "×", "no": 4, "uniqueId": "p837782389837835597325314414698043" }, { "op": "×", "no": 1, "uniqueId": "p17240379638844141747800334930942356" }, { "op": "-", "no": 6, "uniqueId": "p59232935216587099536327802144833041" }, { "op": "-", "no": 4, "uniqueId": "p4287178344301545435520034547874859" }, { "op": "+", "no": -1, "uniqueId": "p287193766464353936716686431833349833" }, { "op": "+", "no": 6, "uniqueId": "p841503778130676009739601646888313233" }], "applied": [], "uniqueId": "p343529031534554333369707167887919211", "difficulty": 0, "customAIScript": null }, { "type": "XCardAIPlayer", "name": "AI 3", "inventory": [{ "op": "×", "no": 0, "uniqueId": "p1020079795151087283620549594339886" }, { "op": "+", "no": 9, "uniqueId": "p98151985460966916449152602597068263" }, { "op": "×", "no": 7, "uniqueId": "p76860486040104810489758123928529216" }, { "op": "×", "no": 9, "uniqueId": "p675222356451743034877004056115249342" }, { "op": "-", "no": 1, "uniqueId": "p228058477959010902167055237200914493" }, { "op": "-", "no": 9, "uniqueId": "p364399922698082043876950032890656794" }, { "op": "×", "no": 9, "uniqueId": "p3770715784279064697903410270519259" }, { "op": "×", "no": 5, "uniqueId": "p691636855301550260143065076602433675" }, { "op": "+", "no": 3, "uniqueId": "p25551679380243608555891132439916072" }, { "op": "-", "no": 0, "uniqueId": "p42511492167628487751198936193684884" }], "applied": [], "uniqueId": "p13596065288293288565867287725360676", "difficulty": 0, "customAIScript": null }], "deck": [{ "op": "+", "no": 2, "uniqueId": "p127312155693358599219851215422121989" }, { "op": "+", "no": 5, "uniqueId": "p3869630593948102965996610796181457" }, { "op": "×", "no": 5, "uniqueId": "p61411496694301025715790056913657459" }, { "op": "×", "no": 7, "uniqueId": "p632478542523572243526354268407123495" }, { "op": "+", "no": 8, "uniqueId": "p374666992185079866341001410694079969" }, { "op": "×", "no": -1, "uniqueId": "p130376815156164484640395718710334204" }, { "op": "-", "no": 10, "uniqueId": "p77253878126252182223825333255451023" }, { "op": "-", "no": 1, "uniqueId": "p37510290751165015787225680388318378" }, { "op": "+", "no": 9, "uniqueId": "p1196671872511427192711507734131394" }, { "op": "+", "no": 10, "uniqueId": "p936617269790450773871347782742065746" }, { "op": "+", "no": 5, "uniqueId": "p632055479915138631563063842842895707" }, { "op": "+", "no": 8, "uniqueId": "p29446353844988192613502414397906676" }, { "op": "×", "no": 3, "uniqueId": "p705708976160372955147340502989666097" }, { "op": "+", "no": 1, "uniqueId": "p61622768952789132948174273173097569" }, { "op": "+", "no": 8, "uniqueId": "p300171246917261000563038851613748896" }, { "op": "×", "no": 3, "uniqueId": "p4808905664886429468532784384954064" }, { "op": "×", "no": 10, "uniqueId": "p817880709480637779746648082104834303" }, { "op": "-", "no": 7, "uniqueId": "p20153839751459050677381091437229514" }, { "op": "-", "no": 10, "uniqueId": "p632706971354115876578326515377386651" }, { "op": "-", "no": 7, "uniqueId": "p87881888139837989274953181409722334" }, { "op": "+", "no": 1, "uniqueId": "p431268013250622934277044651686344" }, { "op": "×", "no": 0, "uniqueId": "p513603631144968248894832999227867839" }, { "op": "+", "no": 3, "uniqueId": "p2610680135441501405293481973959281" }, { "op": "+", "no": 5, "uniqueId": "p990545633770219234994529815639589261" }, { "op": "×", "no": 9, "uniqueId": "p173008771896707360138528099205114120" }, { "op": "×", "no": 7, "uniqueId": "p4079084496139384038364074395674754" }, { "op": "-", "no": 10, "uniqueId": "p80181695024025112021261568104978100" }, { "op": "+", "no": 0, "uniqueId": "p87514655528015413497423123489634993" }, { "op": "×", "no": 1, "uniqueId": "p995769131557387621878444977586523648" }, { "op": "+", "no": 7, "uniqueId": "p617581724749029042949365475254934317" }, { "op": "+", "no": 9, "uniqueId": "p46232472335891698209825074447219527" }, { "op": "+", "no": 6, "uniqueId": "p431718610133871155348212133402919119" }, { "op": "-", "no": 9, "uniqueId": "p38531016156434451682708449250000569" }, { "op": "+", "no": 5, "uniqueId": "p455420440641694026322628678543901502" }, { "op": "×", "no": 10, "uniqueId": "p805961159252785078771446501102564409" }, { "op": "+", "no": 2, "uniqueId": "p817165529302641973909088665967333712" }, { "op": "-", "no": 6, "uniqueId": "p390199675406551769785168499984169286" }, { "op": "-", "no": 9, "uniqueId": "p986300716932503168402837331683670896" }, { "op": "×", "no": 2, "uniqueId": "p7021099439628785245733159286313950" }, { "op": "+", "no": 3, "uniqueId": "p36445133821075897867934586315918965" }, { "op": "×", "no": 0, "uniqueId": "p70058745887263016229116680130544779" }, { "op": "+", "no": 1, "uniqueId": "p715561030442032500359076454282694981" }, { "op": "-", "no": 3, "uniqueId": "p9639909828189601257579175105265918" }, { "op": "-", "no": 2, "uniqueId": "p8827596736157279412020417230039913" }, { "op": "×", "no": 8, "uniqueId": "p620313500821393422436712043459954235" }, { "op": "+", "no": 10, "uniqueId": "p468344256464145685310612834601536640" }, { "op": "-", "no": 5, "uniqueId": "p228974033418547623960373358813545263" }, { "op": "×", "no": 2, "uniqueId": "p981603955335656413151885930139968790" }, { "op": "+", "no": 10, "uniqueId": "p107398498875698435372485952530272629" }, { "op": "+", "no": 4, "uniqueId": "p780030084259573947436168779857782955" }, { "op": "×", "no": 4, "uniqueId": "p30865324056026174547740316457745190" }, { "op": "-", "no": 9, "uniqueId": "p535691073829932014950493773706407734" }, { "op": "+", "no": 8, "uniqueId": "p252415625139002389303081176514235368" }, { "op": "+", "no": 0, "uniqueId": "p313972376619437637234893855840642" }, { "op": "+", "no": 7, "uniqueId": "p1327131337802578686386697722978202" }, { "op": "-", "no": -1, "uniqueId": "p89558798395510978830196876759159085" }, { "op": "+", "no": 3, "uniqueId": "p935606111516057167944983434384007465" }, { "op": "×", "no": 8, "uniqueId": "p912782409364681927143776245115420872" }, { "op": "+", "no": 4, "uniqueId": "p342232175234943341770050964139828903" }, { "op": "×", "no": 6, "uniqueId": "p826869089827462846295484220470684275" }, { "op": "+", "no": 2, "uniqueId": "p28700831585032451442902624425667870" }, { "op": "-", "no": 3, "uniqueId": "p71256579763924523252433169904563511" }, { "op": "-", "no": 2, "uniqueId": "p239752103401828553541186906740794577" }, { "op": "×", "no": 8, "uniqueId": "p566304601326268136199288003679561114" }, { "op": "×", "no": 1, "uniqueId": "p893827474816352288881583789491770303" }, { "op": "+", "no": -1, "uniqueId": "p220026958312612110533776268733384893" }, { "op": "×", "no": 2, "uniqueId": "p460225261104579369653830502863109633" }, { "op": "-", "no": 5, "uniqueId": "p15600192565281296384299437264998195" }, { "op": "+", "no": 7, "uniqueId": "p569767908240279058526538868149137928" }, { "op": "×", "no": -1, "uniqueId": "p402864130198975388258008014697834820" }, { "op": "+", "no": 0, "uniqueId": "p66472142785636485770386947615066119" }, { "op": "×", "no": 4, "uniqueId": "p835255842784119136967043866865224943" }, { "op": "×", "no": 3, "uniqueId": "p885693550448578782775079647616302271" }, { "op": "×", "no": 6, "uniqueId": "p250388274487266891268897351859171019" }, { "op": "-", "no": 7, "uniqueId": "p241696086855810796704984345635668855" }, { "op": "-", "no": -1, "uniqueId": "p433203409717046242992770332866569587" }, { "op": "×", "no": 8, "uniqueId": "p556563094370133537878209017868037387" }, { "op": "-", "no": 2, "uniqueId": "p336256294477645655870374672301526297" }, { "op": "-", "no": 2, "uniqueId": "p910465473703007659397534638531940146" }, { "op": "×", "no": 5, "uniqueId": "p8614110274823852227842317145119526" }, { "op": "×", "no": 6, "uniqueId": "p341414260634388453861837525556670539" }, { "op": "-", "no": 0, "uniqueId": "p268116437888870947104213087999933245" }, { "op": "+", "no": 0, "uniqueId": "p409393143607814104637679614343673281" }, { "op": "-", "no": 8, "uniqueId": "p182488422876847108468616929139295900" }, { "op": "×", "no": 6, "uniqueId": "p250588765684695695269549568140908933" }, { "op": "-", "no": 3, "uniqueId": "p84166375652505580819679824278826089" }, { "op": "-", "no": 8, "uniqueId": "p651999434506292429905141204962511367" }, { "op": "-", "no": 6, "uniqueId": "p3140375686697042449377120457760382" }, { "op": "-", "no": -1, "uniqueId": "p507094108481633931493915262636146981" }, { "op": "+", "no": 10, "uniqueId": "p525159895734871882269152104502638157" }, { "op": "-", "no": 4, "uniqueId": "p198021911970827423608200945864183514" }, { "op": "+", "no": 1, "uniqueId": "p24212921976461826196213305321490000" }, { "op": "-", "no": 0, "uniqueId": "p77074749137251801480572070575348482" }, { "op": "-", "no": 8, "uniqueId": "p64566652989898869319602184833580763" }, { "op": "-", "no": 10, "uniqueId": "p945497662229498186165815936660837378" }, { "op": "×", "no": 9, "uniqueId": "p293000942960162286395082695584656598" }, { "op": "+", "no": -1, "uniqueId": "p24016228458129764068500247983504592" }, { "op": "×", "no": 0, "uniqueId": "p441610524721795941436265426456180052" }, { "op": "+", "no": 7, "uniqueId": "p385364293258067129177788264665471049" }, { "op": "-", "no": 6, "uniqueId": "p529380276600145862620989144801737044" }, { "op": "×", "no": 10, "uniqueId": "p669719595690030181133909014437222956" }, { "op": "×", "no": 7, "uniqueId": "p22565350096316399966150859319195120" }, { "op": "+", "no": 4, "uniqueId": "p439031498830436362483239993784962821" }, { "op": "+", "no": -1, "uniqueId": "p94492476165940669748338501856443" }], "gameMode": "XCardGameDefaultMode", "reason": "플레이어 'AI 1' 이/가 보유한 카드가 없습니다.", "debugModeUsed": true }; | 1,786.083333 | 21,118 | 0.646013 |
027181a0b6ed80bbeb5cf2cf68433833a93a323d | 6,326 | h | C | contrib/librdns/rdns_event.h | msuslu/rspamd | 95764f816a9e1251a755c6edad339637345cfe28 | [
"Apache-2.0"
] | 1 | 2017-10-24T22:23:44.000Z | 2017-10-24T22:23:44.000Z | contrib/librdns/rdns_event.h | msuslu/rspamd | 95764f816a9e1251a755c6edad339637345cfe28 | [
"Apache-2.0"
] | null | null | null | contrib/librdns/rdns_event.h | msuslu/rspamd | 95764f816a9e1251a755c6edad339637345cfe28 | [
"Apache-2.0"
] | 1 | 2022-02-20T17:41:48.000Z | 2022-02-20T17:41:48.000Z | /*
* Copyright (c) 2014, Vsevolod Stakhov
*
* 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.
*
* THIS SOFTWARE IS PROVIDED BY AUTHOR ''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 AUTHOR 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 RDNS_EVENT_H_
#define RDNS_EVENT_H_
#include <event.h>
#include <stdlib.h>
#include <string.h>
#include "rdns.h"
#ifdef __cplusplus
extern "C" {
#endif
static void* rdns_libevent_add_read (void *priv_data, int fd, void *user_data);
static void rdns_libevent_del_read(void *priv_data, void *ev_data);
static void* rdns_libevent_add_write (void *priv_data, int fd, void *user_data);
static void rdns_libevent_del_write (void *priv_data, void *ev_data);
static void* rdns_libevent_add_timer (void *priv_data, double after, void *user_data);
static void* rdns_libevent_add_periodic (void *priv_data, double after,
rdns_periodic_callback cb, void *user_data);
static void rdns_libevent_del_periodic (void *priv_data, void *ev_data);
static void rdns_libevent_repeat_timer (void *priv_data, void *ev_data);
static void rdns_libevent_del_timer (void *priv_data, void *ev_data);
struct rdns_event_periodic_cbdata {
struct event *ev;
rdns_periodic_callback cb;
void *cbdata;
};
static void
rdns_bind_libevent (struct rdns_resolver *resolver, struct event_base *ev_base)
{
struct rdns_async_context ev_ctx = {
.add_read = rdns_libevent_add_read,
.del_read = rdns_libevent_del_read,
.add_write = rdns_libevent_add_write,
.del_write = rdns_libevent_del_write,
.add_timer = rdns_libevent_add_timer,
.add_periodic = rdns_libevent_add_periodic,
.del_periodic = rdns_libevent_del_periodic,
.repeat_timer = rdns_libevent_repeat_timer,
.del_timer = rdns_libevent_del_timer,
.cleanup = NULL
}, *nctx;
/* XXX: never got freed */
nctx = malloc (sizeof (struct rdns_async_context));
if (nctx != NULL) {
memcpy (nctx, &ev_ctx, sizeof (struct rdns_async_context));
nctx->data = ev_base;
}
rdns_resolver_async_bind (resolver, nctx);
}
static void
rdns_libevent_read_event (int fd, short what, void *ud)
{
rdns_process_read (fd, ud);
}
static void
rdns_libevent_write_event (int fd, short what, void *ud)
{
rdns_process_write (fd, ud);
}
static void
rdns_libevent_timer_event (int fd, short what, void *ud)
{
rdns_process_timer (ud);
}
static void
rdns_libevent_periodic_event (int fd, short what, void *ud)
{
struct rdns_event_periodic_cbdata *cbdata = ud;
cbdata->cb (cbdata->cbdata);
}
static void*
rdns_libevent_add_read (void *priv_data, int fd, void *user_data)
{
struct event *ev;
ev = malloc (sizeof (struct event));
if (ev != NULL) {
event_set (ev, fd, EV_READ | EV_PERSIST, rdns_libevent_read_event, user_data);
event_base_set (priv_data, ev);
event_add (ev, NULL);
}
return ev;
}
static void
rdns_libevent_del_read(void *priv_data, void *ev_data)
{
struct event *ev = ev_data;
if (ev != NULL) {
event_del (ev);
free (ev);
}
}
static void*
rdns_libevent_add_write (void *priv_data, int fd, void *user_data)
{
struct event *ev;
ev = malloc (sizeof (struct event));
if (ev != NULL) {
event_set (ev, fd, EV_WRITE | EV_PERSIST,
rdns_libevent_write_event, user_data);
event_base_set (priv_data, ev);
event_add (ev, NULL);
}
return ev;
}
static void
rdns_libevent_del_write (void *priv_data, void *ev_data)
{
struct event *ev = ev_data;
if (ev != NULL) {
event_del (ev);
free (ev);
}
}
#define rdns_event_double_to_tv(dbl, tv) do { \
(tv)->tv_sec = (int)(dbl); \
(tv)->tv_usec = ((dbl) - (int)(dbl))*1000*1000; \
} while(0)
static void*
rdns_libevent_add_timer (void *priv_data, double after, void *user_data)
{
struct event *ev;
struct timeval tv;
ev = malloc (sizeof (struct event));
if (ev != NULL) {
rdns_event_double_to_tv (after, &tv);
event_set (ev, -1, EV_TIMEOUT|EV_PERSIST, rdns_libevent_timer_event, user_data);
event_base_set (priv_data, ev);
event_add (ev, &tv);
}
return ev;
}
static void*
rdns_libevent_add_periodic (void *priv_data, double after,
rdns_periodic_callback cb, void *user_data)
{
struct event *ev;
struct timeval tv;
struct rdns_event_periodic_cbdata *cbdata = NULL;
ev = malloc (sizeof (struct event));
if (ev != NULL) {
cbdata = malloc (sizeof (struct rdns_event_periodic_cbdata));
if (cbdata != NULL) {
rdns_event_double_to_tv (after, &tv);
cbdata->cb = cb;
cbdata->cbdata = user_data;
cbdata->ev = ev;
event_set (ev, -1, EV_TIMEOUT|EV_PERSIST, rdns_libevent_periodic_event, cbdata);
event_base_set (priv_data, ev);
event_add (ev, &tv);
}
else {
free (ev);
return NULL;
}
}
return cbdata;
}
static void
rdns_libevent_del_periodic (void *priv_data, void *ev_data)
{
struct rdns_event_periodic_cbdata *cbdata = ev_data;
if (cbdata != NULL) {
event_del (cbdata->ev);
free (cbdata->ev);
free (cbdata);
}
}
static void
rdns_libevent_repeat_timer (void *priv_data, void *ev_data)
{
/* XXX: libevent hides timeval, so timeouts are persistent here */
}
#undef rdns_event_double_to_tv
static void
rdns_libevent_del_timer (void *priv_data, void *ev_data)
{
struct event *ev = ev_data;
if (ev != NULL) {
event_del (ev);
free (ev);
}
}
#ifdef __cplusplus
}
#endif
#endif /* RDNS_EV_H_ */
| 27.267241 | 86 | 0.730161 |
c4380f7966661efbc6cf68d75ea24089f0146547 | 342 | h | C | source/pkgsrc/mail/dovecot2/patches/patch-src_lib_connection.h | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | 1 | 2021-11-20T22:46:39.000Z | 2021-11-20T22:46:39.000Z | source/pkgsrc/mail/dovecot2/patches/patch-src_lib_connection.h | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | null | null | null | source/pkgsrc/mail/dovecot2/patches/patch-src_lib_connection.h | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | null | null | null | $NetBSD: patch-src_lib_connection.h,v 1.2 2018/05/22 20:49:45 triaxx Exp $
* Require header for timeval structure.
--- src/lib/connection.h.orig 2018-03-20 10:15:40.000000000 +0000
+++ src/lib/connection.h
@@ -3,6 +3,10 @@
#include "net.h"
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
struct ioloop;
struct connection;
| 19 | 74 | 0.692982 |
40c6faf5555fd82651e7933b0e0fca8f35e192fe | 270 | py | Python | tests/test_roleplay.py | kintaclausin01/GHG-reduction-project | afd5b0967756ce5b67e3a664a082f17f9b91063b | [
"BSD-3-Clause"
] | null | null | null | tests/test_roleplay.py | kintaclausin01/GHG-reduction-project | afd5b0967756ce5b67e3a664a082f17f9b91063b | [
"BSD-3-Clause"
] | null | null | null | tests/test_roleplay.py | kintaclausin01/GHG-reduction-project | afd5b0967756ce5b67e3a664a082f17f9b91063b | [
"BSD-3-Clause"
] | 6 | 2021-03-31T05:08:47.000Z | 2021-07-18T03:58:03.000Z | import sys
import os
parent_dir = os.path.join(os.path.dirname(__file__), '..')
sys.path.append(parent_dir)
from roleplay import *
#main.roleplayRun(sys.argv[1],sys.argv[2],sys.argv[3])
#main2.roleplayRun(sys.argv[1],sys.argv[2],sys.argv[3])
main2.roleplayRun() | 30 | 59 | 0.718519 |
8ac22cb776dc896de54624045f7f633418fa7648 | 3,072 | rs | Rust | common/functions/src/scalars/strings/soundex.rs | RainnyNightLover/databend | b3e4c25aea5036b7c16ed8311d1dd426ae166c38 | [
"Apache-2.0"
] | null | null | null | common/functions/src/scalars/strings/soundex.rs | RainnyNightLover/databend | b3e4c25aea5036b7c16ed8311d1dd426ae166c38 | [
"Apache-2.0"
] | 11 | 2021-11-17T17:28:40.000Z | 2022-02-10T02:26:50.000Z | common/functions/src/scalars/strings/soundex.rs | RainnyNightLover/databend | b3e4c25aea5036b7c16ed8311d1dd426ae166c38 | [
"Apache-2.0"
] | null | null | null | // Copyright 2021 Datafuse Labs.
//
// 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.
use bytes::BufMut;
use common_datavalues2::Column;
use common_datavalues2::StringColumn;
use common_exception::Result;
use super::String2StringFunction;
use super::StringOperator;
#[derive(Clone, Default)]
pub struct Soundex {
buf: String,
}
impl Soundex {
#[inline(always)]
fn number_map(i: char) -> Option<u8> {
match i.to_ascii_lowercase() {
'b' | 'f' | 'p' | 'v' => Some(b'1'),
'c' | 'g' | 'j' | 'k' | 'q' | 's' | 'x' | 'z' => Some(b'2'),
'd' | 't' => Some(b'3'),
'l' => Some(b'4'),
'm' | 'n' => Some(b'5'),
'r' => Some(b'6'),
_ => Some(b'0'),
}
}
#[inline(always)]
fn is_drop(c: char) -> bool {
matches!(
c.to_ascii_lowercase(),
'a' | 'e' | 'i' | 'o' | 'u' | 'y' | 'h' | 'w'
)
}
// https://github.com/mysql/mysql-server/blob/3290a66c89eb1625a7058e0ef732432b6952b435/sql/item_strfunc.cc#L1919
#[inline(always)]
fn is_uni_alphabetic(c: char) -> bool {
('a'..='z').contains(&c) || ('A'..='Z').contains(&c) || c as i32 >= 0xC0
}
}
impl StringOperator for Soundex {
#[inline]
fn try_apply<'a>(&'a mut self, data: &'a [u8], mut buffer: &mut [u8]) -> Result<usize> {
let mut last = None;
let mut count = 0;
self.buf.clear();
for ch in String::from_utf8_lossy(data).chars() {
let score = Self::number_map(ch);
if last.is_none() {
if !Self::is_uni_alphabetic(ch) {
continue;
}
last = score;
self.buf.push(ch.to_ascii_uppercase());
} else {
if !ch.is_ascii_alphabetic()
|| Self::is_drop(ch)
|| score.is_none()
|| score == last
{
continue;
}
last = score;
self.buf.push(score.unwrap() as char);
}
count += 1;
}
// add '0'
if !self.buf.is_empty() && count < 4 {
self.buf.extend(vec!['0'; 4 - count])
}
let bytes = self.buf.as_bytes();
buffer.put_slice(bytes);
Ok(bytes.len())
}
fn estimate_bytes(&self, array: &StringColumn) -> usize {
usize::max(array.values().len(), 4 * array.len())
}
}
pub type SoundexFunction = String2StringFunction<Soundex>;
| 29.257143 | 116 | 0.523438 |
e83680950ddb55f499be81483cb576f51f0d17ee | 9,185 | rs | Rust | src/can0/flt_id2_idmask.rs | s32k-rust/s32k144.rs | 444b0e87d1c6479ac6dccf8ae2e77633045ee764 | [
"Apache-2.0",
"MIT"
] | 1 | 2018-12-02T00:05:53.000Z | 2018-12-02T00:05:53.000Z | src/can0/flt_id2_idmask.rs | kjetilkjeka/s32k144.rs | 444b0e87d1c6479ac6dccf8ae2e77633045ee764 | [
"Apache-2.0",
"MIT"
] | 4 | 2017-07-29T10:09:35.000Z | 2020-07-07T19:19:37.000Z | src/can0/flt_id2_idmask.rs | s32k-rust/s32k144.rs | 444b0e87d1c6479ac6dccf8ae2e77633045ee764 | [
"Apache-2.0",
"MIT"
] | 3 | 2018-05-29T13:34:23.000Z | 2020-04-27T13:30:04.000Z | #[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r" Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::FLT_ID2_IDMASK {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
{
let bits = self.register.get();
let r = R { bits: bits };
let mut w = W { bits: bits };
f(&r, &mut w);
self.register.set(w.bits);
}
#[doc = r" Reads the contents of the register"]
#[inline]
pub fn read(&self) -> R {
R { bits: self.register.get() }
}
#[doc = r" Writes to the register"]
#[inline]
pub fn write<F>(&self, f: F)
where
F: FnOnce(&mut W) -> &mut W,
{
let mut w = W::reset_value();
f(&mut w);
self.register.set(w.bits);
}
#[doc = r" Writes the reset value to the register"]
#[inline]
pub fn reset(&self) {
self.write(|w| w)
}
}
#[doc = r" Value of the field"]
pub struct FLT_ID2_IDMASKR {
bits: u32,
}
impl FLT_ID2_IDMASKR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u32 {
self.bits
}
}
#[doc = "Possible values of the field `RTR_MSK`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RTR_MSKR {
#[doc = "The corresponding bit in the filter is \"don't care\""]
_0,
#[doc = "The corresponding bit in the filter is checked"]
_1,
}
impl RTR_MSKR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
RTR_MSKR::_0 => false,
RTR_MSKR::_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> RTR_MSKR {
match value {
false => RTR_MSKR::_0,
true => RTR_MSKR::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline]
pub fn is_0(&self) -> bool {
*self == RTR_MSKR::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline]
pub fn is_1(&self) -> bool {
*self == RTR_MSKR::_1
}
}
#[doc = "Possible values of the field `IDE_MSK`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum IDE_MSKR {
#[doc = "The corresponding bit in the filter is \"don't care\""]
_0,
#[doc = "The corresponding bit in the filter is checked"]
_1,
}
impl IDE_MSKR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
IDE_MSKR::_0 => false,
IDE_MSKR::_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> IDE_MSKR {
match value {
false => IDE_MSKR::_0,
true => IDE_MSKR::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline]
pub fn is_0(&self) -> bool {
*self == IDE_MSKR::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline]
pub fn is_1(&self) -> bool {
*self == IDE_MSKR::_1
}
}
#[doc = r" Proxy"]
pub struct _FLT_ID2_IDMASKW<'a> {
w: &'a mut W,
}
impl<'a> _FLT_ID2_IDMASKW<'a> {
#[doc = r" Writes raw bits to the field"]
#[inline]
pub unsafe fn bits(self, value: u32) -> &'a mut W {
const MASK: u32 = 536870911;
const OFFSET: u8 = 0;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `RTR_MSK`"]
pub enum RTR_MSKW {
#[doc = "The corresponding bit in the filter is \"don't care\""]
_0,
#[doc = "The corresponding bit in the filter is checked"]
_1,
}
impl RTR_MSKW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
RTR_MSKW::_0 => false,
RTR_MSKW::_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _RTR_MSKW<'a> {
w: &'a mut W,
}
impl<'a> _RTR_MSKW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: RTR_MSKW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "The corresponding bit in the filter is \"don't care\""]
#[inline]
pub fn _0(self) -> &'a mut W {
self.variant(RTR_MSKW::_0)
}
#[doc = "The corresponding bit in the filter is checked"]
#[inline]
pub fn _1(self) -> &'a mut W {
self.variant(RTR_MSKW::_1)
}
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 29;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `IDE_MSK`"]
pub enum IDE_MSKW {
#[doc = "The corresponding bit in the filter is \"don't care\""]
_0,
#[doc = "The corresponding bit in the filter is checked"]
_1,
}
impl IDE_MSKW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
IDE_MSKW::_0 => false,
IDE_MSKW::_1 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _IDE_MSKW<'a> {
w: &'a mut W,
}
impl<'a> _IDE_MSKW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: IDE_MSKW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "The corresponding bit in the filter is \"don't care\""]
#[inline]
pub fn _0(self) -> &'a mut W {
self.variant(IDE_MSKW::_0)
}
#[doc = "The corresponding bit in the filter is checked"]
#[inline]
pub fn _1(self) -> &'a mut W {
self.variant(IDE_MSKW::_1)
}
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 30;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
impl R {
#[doc = r" Value of the register as raw bits"]
#[inline]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bits 0:28 - ID Filter 2 for Pretended Networking Filtering / ID Mask Bits for Pretended Networking ID Filtering"]
#[inline]
pub fn flt_id2_idmask(&self) -> FLT_ID2_IDMASKR {
let bits = {
const MASK: u32 = 536870911;
const OFFSET: u8 = 0;
((self.bits >> OFFSET) & MASK as u32) as u32
};
FLT_ID2_IDMASKR { bits }
}
#[doc = "Bit 29 - Remote Transmission Request Mask Bit"]
#[inline]
pub fn rtr_msk(&self) -> RTR_MSKR {
RTR_MSKR::_from({
const MASK: bool = true;
const OFFSET: u8 = 29;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 30 - ID Extended Mask Bit"]
#[inline]
pub fn ide_msk(&self) -> IDE_MSKR {
IDE_MSKR::_from({
const MASK: bool = true;
const OFFSET: u8 = 30;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
}
impl W {
#[doc = r" Reset value of the register"]
#[inline]
pub fn reset_value() -> W {
W { bits: 0 }
}
#[doc = r" Writes raw bits to the register"]
#[inline]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bits 0:28 - ID Filter 2 for Pretended Networking Filtering / ID Mask Bits for Pretended Networking ID Filtering"]
#[inline]
pub fn flt_id2_idmask(&mut self) -> _FLT_ID2_IDMASKW {
_FLT_ID2_IDMASKW { w: self }
}
#[doc = "Bit 29 - Remote Transmission Request Mask Bit"]
#[inline]
pub fn rtr_msk(&mut self) -> _RTR_MSKW {
_RTR_MSKW { w: self }
}
#[doc = "Bit 30 - ID Extended Mask Bit"]
#[inline]
pub fn ide_msk(&mut self) -> _IDE_MSKW {
_IDE_MSKW { w: self }
}
}
| 26.856725 | 126 | 0.5227 |
5bf2daf40ca0f71532f4f43727b3cce50974b58f | 569 | cs | C# | WPinternalsSDK/Properties/AssemblyInfo.cs | MagicAndre1981/WPinternals | dc5ac1e7d4c3bdd55a062be385593b182b260ebd | [
"MIT"
] | 509 | 2018-10-25T21:14:48.000Z | 2022-03-18T20:05:39.000Z | WPinternalsSDK/Properties/AssemblyInfo.cs | MagicAndre1981/WPinternals | dc5ac1e7d4c3bdd55a062be385593b182b260ebd | [
"MIT"
] | 33 | 2018-10-26T18:02:55.000Z | 2022-03-16T20:05:04.000Z | WPinternalsSDK/Properties/AssemblyInfo.cs | MagicAndre1981/WPinternals | dc5ac1e7d4c3bdd55a062be385593b182b260ebd | [
"MIT"
] | 129 | 2018-10-26T00:57:51.000Z | 2022-03-09T08:00:17.000Z | using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
[assembly: AssemblyVersion("1.0.5795.42493")]
[assembly: AssemblyTitle("WPinternals SDK")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("WPinternals")]
[assembly: AssemblyProduct("WPinternals SDK")]
[assembly: AssemblyCopyright("Copyright by Heathcliff74 / WPinternals")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
| 33.470588 | 72 | 0.794376 |
044c9b698bc84df7df89fd4bcc0645961f25e828 | 18,144 | java | Java | app/src/main/java/com/mosam/resumemaker/fragments/PreviewFragment.java | RealMosam/Resume-Maker | 71e26174c2cd001aaaea8026d04c467ab2d670ee | [
"MIT"
] | 2 | 2021-01-27T21:09:00.000Z | 2021-07-30T08:20:05.000Z | app/src/main/java/com/mosam/resumemaker/fragments/PreviewFragment.java | RealMosam/Resume-Maker | 71e26174c2cd001aaaea8026d04c467ab2d670ee | [
"MIT"
] | null | null | null | app/src/main/java/com/mosam/resumemaker/fragments/PreviewFragment.java | RealMosam/Resume-Maker | 71e26174c2cd001aaaea8026d04c467ab2d670ee | [
"MIT"
] | 1 | 2022-01-10T15:40:21.000Z | 2022-01-10T15:40:21.000Z | package com.mosam.resumemaker.fragments;
import android.content.Context;
import android.os.Bundle;
import android.print.PrintAttributes;
import android.print.PrintDocumentAdapter;
import android.print.PrintJob;
import android.print.PrintManager;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebSettings;
import com.mosam.resumemaker.R;
import com.mosam.resumemaker.datamodel.Experience;
import com.mosam.resumemaker.datamodel.PersonalInfo;
import com.mosam.resumemaker.datamodel.Project;
import com.mosam.resumemaker.datamodel.Resume;
import com.mosam.resumemaker.datamodel.School;
import com.mosam.resumemaker.helper.ResumeFragment;
/**
* A simple {@link Fragment} subclass.
*/
public class PreviewFragment extends ResumeFragment {
WebView webView;
public static ResumeFragment newInstance(Resume resume) {
ResumeFragment fragment = new PreviewFragment();
fragment.setResume(resume);
return fragment;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_preview, container, false);
webView = view.findViewById(R.id.webView);
WebSettings webSetting = webView.getSettings();
webSetting.setBuiltInZoomControls(true);
StringBuilder htmlContent = new StringBuilder();
Resume resume = getResume();
PersonalInfo personalInfo = resume.personalInfo;
htmlContent.append(String.format("<!DOCTYPE html>\n" +
"<html>\n" +
"<head>\n" +
"<title>Resume</title>\n" +
"<meta charset=UTF-8>\n" +
"<link rel=\"shortcut icon\" href=https://ssl.gstatic.com/docs/documents/images/kix-favicon6.ico>\n" +
"<style type=text/css>body{font-family:arial,sans,sans-serif;margin:0}iframe{border:0;frameborder:0;height:100%%;width:100%%}#header,#footer{background:#f0f0f0;padding:10px 10px}#header{border-bottom:1px #ccc solid}#footer{border-top:1px #ccc solid;border-bottom:1px #ccc solid;font-size:13}#contents{margin:6px}.dash{padding:0 6px}</style>\n" +
"</head>\n" +
"<body>\n" +
"<div id=contents>\n" +
"<style type=text/css>@import url('https://themes.googleusercontent.com/fonts/css?kit=xTOoZr6X-i3kNg7pYrzMsnEzyYBuwf3lO_Sc3Mw9RUVbV0WvE1cEyAoIq5yYZlSc');ol{margin:0;padding:0}table td,table th{padding:0}.c26{border-right-style:solid;padding:3.6pt 3.6pt 3.6pt 3.6pt;border-bottom-color:#fff;border-top-width:0;border-right-width:0;border-left-color:#fff;vertical-align:top;border-right-color:#fff;border-left-width:0;border-top-style:solid;border-left-style:solid;border-bottom-width:0;width:176.3pt;border-top-color:#fff;border-bottom-style:solid}.c4{border-right-style:solid;padding:5pt 5pt 5pt 5pt;border-bottom-color:#fff;border-top-width:0;border-right-width:0;border-left-color:#fff;vertical-align:top;border-right-color:#fff;border-left-width:0;border-top-style:solid;border-left-style:solid;border-bottom-width:0;width:327.7pt;border-top-color:#fff;border-bottom-style:solid}.c16{color:#000;font-weight:700;text-decoration:none;vertical-align:baseline;font-size:12pt;font-family:\"Raleway\";font-style:normal}.c7{color:#000;font-weight:400;text-decoration:none;vertical-align:baseline;font-size:10pt;font-family:\"Lato\";font-style:normal}.c13{color:#000;font-weight:700;text-decoration:none;vertical-align:baseline;font-size:10pt;font-family:\"Lato\";font-style:normal}.c1{color:#666;font-weight:400;text-decoration:none;vertical-align:baseline;font-size:9pt;font-family:\"Lato\";font-style:normal}.c19{color:#000;font-weight:400;text-decoration:none;vertical-align:baseline;font-size:6pt;font-family:\"Lato\";font-style:normal}.c20{color:#f2511b;font-weight:700;text-decoration:none;vertical-align:baseline;font-size:16pt;font-family:\"Raleway\";font-style:normal}.c6{padding-top:0;padding-bottom:0;line-height:1.0;text-align:left}.c32{padding-top:5pt;padding-bottom:0;line-height:1.15;text-align:left}.c0{padding-top:10pt;padding-bottom:0;line-height:1.0;text-align:left}.c22{padding-top:5pt;padding-bottom:0;line-height:1.0;text-align:left}.c10{color:#d44500;text-decoration:none;vertical-align:baseline;font-style:normal}.c2{padding-top:0;padding-bottom:0;line-height:1.15;text-align:left}.c33{padding-top:3pt;padding-bottom:0;line-height:1.0;text-align:left}.c9{padding-top:4pt;padding-bottom:0;line-height:1.15;text-align:left}.c23{border-spacing:0;border-collapse:collapse;margin:0 auto}.c30{color:#000;text-decoration:none;vertical-align:baseline;font-style:normal}.c3{padding-top:6pt;padding-bottom:0;line-height:1.15;text-align:left}.c14{padding-top:16pt;padding-bottom:0;line-height:1.15;text-align:left}.c28{padding-top:6pt;padding-bottom:0;line-height:1.0;text-align:left}.c18{font-size:9pt;font-family:\"Lato\";font-weight:400}.c24{font-size:14pt;font-family:\"Lato\";font-weight:700}.c8{font-size:10pt;font-family:\"Lato\";font-weight:400}.c5{font-size:11pt;font-family:\"Lato\";font-weight:400}.c31{background-color:#fff;max-width:504pt;padding:36pt 54pt 36pt 54pt}.c35{font-weight:700;font-size:24pt;font-family:\"Raleway\"}.c11{orphans:2;widows:2;height:11pt}.c21{height:auto}.c15{height:auto}.c27{height:auto}.c34{height:auto}.c29{height:auto}.c25{font-size:10pt}.c12{page-break-after:avoid}.c17{height:265pt}.title{padding-top:6pt;color:#000;font-weight:700;font-size:24pt;padding-bottom:0;font-family:\"Raleway\";line-height:1.0;page-break-after:avoid;orphans:2;widows:2;text-align:left}.subtitle{padding-top:3pt;color:#f2511b;font-weight:700;font-size:16pt;padding-bottom:0;font-family:\"Raleway\";line-height:1.0;page-break-after:avoid;orphans:2;widows:2;text-align:left}li{color:#000;font-size:11pt;font-family:\"Lato\"}p{margin:0;color:#000;font-size:11pt;font-family:\"Lato\"}h1{padding-top:4pt;color:#000;font-weight:700;font-size:12pt;padding-bottom:0;font-family:\"Raleway\";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h2{padding-top:6pt;color:#000;font-weight:700;font-size:11pt;padding-bottom:0;font-family:\"Lato\";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h3{padding-top:6pt;color:#666;font-size:9pt;padding-bottom:0;font-family:\"Lato\";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h4{padding-top:8pt;-webkit-text-decoration-skip:none;color:#666;text-decoration:underline;font-size:11pt;padding-bottom:0;line-height:1.15;page-break-after:avoid;text-decoration-skip-ink:none;font-family:\"Trebuchet MS\";orphans:2;widows:2;text-align:left}h5{padding-top:8pt;color:#666;font-size:11pt;padding-bottom:0;font-family:\"Trebuchet MS\";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h6{padding-top:8pt;color:#666;font-size:11pt;padding-bottom:0;font-family:\"Trebuchet MS\";line-height:1.15;page-break-after:avoid;font-style:italic;orphans:2;widows:2;text-align:left}</style>\n" +
"<p class=\"c2 c29\"><span class=c19></span></p>\n" +
"<a id=t.b7144d62fc47a2bfcf177a3c3dd72df0e868051e></a>\n" +
"<a id=t.0></a>\n" +
"<table class=c23>\n" +
" <tbody>\n" +
" <tr class=\"c21\">\n" +
" <td class=\"c26\" colspan=\"1\" rowspan=\"1\">\n" +
" <p class=\"c6 c12 title\" id=\"h.4prkjmzco10w\"><span>%s</span></p>\n" +
" <p class=\"c33 subtitle\" id=\"h.o2iwx3vdck7p\"><span class=\"c20\">%s</span></p>\n" +
" </td>\n" +
" <td class=\"c4\" colspan=\"1\" rowspan=\"1\">\n" +
" <p class=\"c6\"><span style=\"overflow: hidden; display: inline-block; margin: 0.00px 0.00px; border: 0.00px solid #000000; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px); width: 418.00px; height: 2.67px;\"><img alt=\"\" src=\"https://lh4.googleusercontent.com/j7t3_XjsJ1PHIrgcWuJOWmQ2fFs9q-TT_LNTDfAXGnVu49aapNgutWcfK1k7pPzGtsu9lOvPynvLW07b_KwpVV0ituspJAXOQ_IBZyN087cqGsXawUahO2qDRCQZ8-qq4esAcP7M\" style=\"width: 418.00px; height: 2.67px; margin-left: 0.00px; margin-top: 0.00px; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px);\" title=\"horizontal line\"></span></p>\n" +
/* " <h1 class=\"c3\" id=\"h.lf5wiiqsu4ub\"><span>%s</span></h1>\n" +*/
" <p class=\"c6\"><span class=\"c7\">%s</span></p>\n" +
" <p class=\"c6\"><span class=\"c25\">%s</span></p>\n" +
" <p class=\"c0\"><span class=\"c10 c8\">%s</span></p>\n" +
" <p class=\"c6\"><span class=\"c8 c10\">%s</span></p>\n" +
" </td>\n" +
" </tr>", personalInfo.getName(), personalInfo.getJobTitle(), /*personalInfo.getName(),*/ personalInfo.getAddressLine1(), personalInfo.getAddressLine2(), personalInfo.getPhone(), personalInfo.getEmail()));
if (!resume.skills.isEmpty()) {
htmlContent.append(String.format("\n" +
" <tr class=\"c27\">\n" +
" <td class=\"c26\" colspan=\"1\" rowspan=\"1\">\n" +
" <p class=\"c6\"><span class=\"c24\">ㅡ</span></p>\n" +
" <h1 class=\"c9\" id=\"h.61e3cm1p1fln\"><span class=\"c16\">"+getString(R.string.hint_skills)+"</span></h1></td>\n" +
" <td class=\"c4\" colspan=\"1\" rowspan=\"1\">\n" +
" <p class=\"c2\"><span style=\"overflow: hidden; display: inline-block; margin: 0.00px 0.00px; border: 0.00px solid #000000; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px); width: 418.00px; height: 2.67px;\"><img alt=\"\" src=\"https://lh3.googleusercontent.com/n8bZfGajkthDbPpbjeiRJ4w7rNUmj1iFxdZKCHUOVnfH9FgHVt5EBo3vOYIIoE3augYQ_DCZJUzdlStyJ5RaldVrSG36sTE0CjIot2qaiJ3YRyr2i87bt9Y9d0ngdseS9PpG0HzM\" style=\"width: 418.00px; height: 2.67px; margin-left: 0.00px; margin-top: 0.00px; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px);\" title=\"horizontal line\"></span></p>\n" +
" <p class=\"c3\"><span class=\"c7\">%s</span></p>\n" +
" </td>\n" +
" </tr>", resume.skills));
}
if (!resume.languages.isEmpty()) {
htmlContent.append(String.format("\n" +
" <tr class=\"c27\">\n" +
" <td class=\"c26\" colspan=\"1\" rowspan=\"1\">\n" +
" <p class=\"c6\"><span class=\"c24\">ㅡ</span></p>\n" +
" <h1 class=\"c9\" id=\"h.61e3cm1p1fln\"><span class=\"c16\">"+getString(R.string.hint_languages)+"</span></h1></td>\n" +
" <td class=\"c4\" colspan=\"1\" rowspan=\"1\">\n" +
" <p class=\"c2\"><span style=\"overflow: hidden; display: inline-block; margin: 0.00px 0.00px; border: 0.00px solid #000000; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px); width: 418.00px; height: 2.67px;\"><img alt=\"\" src=\"https://lh3.googleusercontent.com/n8bZfGajkthDbPpbjeiRJ4w7rNUmj1iFxdZKCHUOVnfH9FgHVt5EBo3vOYIIoE3augYQ_DCZJUzdlStyJ5RaldVrSG36sTE0CjIot2qaiJ3YRyr2i87bt9Y9d0ngdseS9PpG0HzM\" style=\"width: 418.00px; height: 2.67px; margin-left: 0.00px; margin-top: 0.00px; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px);\" title=\"horizontal line\"></span></p>\n" +
" <p class=\"c3\"><span class=\"c7\">%s</span></p>\n" +
" </td>\n" +
" </tr>", resume.languages));
}
if (resume.schools.size() != 0) {
htmlContent.append("\n" +
" <tr class=\"c15\">\n" +
" <td class=\"c26\" colspan=\"1\" rowspan=\"1\">\n" +
" <p class=\"c6\"><span class=\"c24\">ㅡ</span></p>\n" +
" <h1 class=\"c9\" id=\"h.tk538brb1kdf\"><span class=\"c16\">"+getString(R.string.education)+"</span></h1></td>\n" +
" <td class=\"c4\" colspan=\"1\" rowspan=\"1\">\n");
boolean first = true;
for (School school : resume.schools) {
htmlContent.append(String.format("<h2 class=\"%s\" id=\"h.u3uy0857ab2n\"><span class=\"c5\">%s </span><span class=\"c30 c5\">/ %s</span></h2>\n" +
" <h3 class=\"c2\" id=\"h.re1qtuma0rpm\"><span class=\"c1\">%s</span></h3>\n" +
" <p class=\"c32\"><span class=\"c7\">%s</span></p>\n", first ? "c3" : "c14", school.getSchoolName(), school.getDegree(), school.getLocation(), school.getDescription()));
first = false;
}
htmlContent.append("</td>\n" +
" </tr>");
}
if (resume.projects.size() != 0) {
htmlContent.append("\n" +
" <tr class=\"c15\">\n" +
" <td class=\"c26\" colspan=\"1\" rowspan=\"1\">\n" +
" <p class=\"c6\"><span class=\"c24\">ㅡ</span></p>\n" +
" <h1 class=\"c9\" id=\"h.tk538brb1kdf\"><span class=\"c16\">"+getString(R.string.hint_project_name)+"</span></h1></td>\n" +
" <td class=\"c4\" colspan=\"1\" rowspan=\"1\">\n");
boolean first = true;
for (Project project : resume.projects) {
htmlContent.append(String.format("<h2 class=\"%s\" id=\"h.u3uy0857ab2n\"><span class=\"c5\">%s </span><span class=\"c30 c5\">/ %s</span></h2>\n" +
" <p class=\"c32\"><span class=\"c7\">%s</span></p>\n", first ? "c3" : "c14", project.getName(), project.getDetail(), project.getDescription()));
first = false;
}
htmlContent.append("</td>\n" +
" </tr>");
}
if (resume.experience.size() != 0) {
htmlContent.append("\n" +
" <tr class=\"c15\">\n" +
" <td class=\"c26\" colspan=\"1\" rowspan=\"1\">\n" +
" <p class=\"c6\"><span class=\"c24\">ㅡ</span></p>\n" +
" <h1 class=\"c9\" id=\"h.tk538brb1kdf\"><span class=\"c16\">"+getString(R.string.navigation_experience)+"</span></h1></td>\n" +
" <td class=\"c4\" colspan=\"1\" rowspan=\"1\">\n");
boolean first = true;
for (Experience experience : resume.experience) {
htmlContent.append(String.format("<h2 class=\"%s\" id=\"h.u3uy0857ab2n\"><span class=\"c5\">%s </span><span class=\"c30 c5\">/ %s</span></h2>\n" +
" <h3 class=\"c2\" id=\"h.re1qtuma0rpm\"><span class=\"c1\">%s</span></h3>\n" +
" <p class=\"c32\"><span class=\"c7\">%s</span></p>\n", first ? "c3" : "c14", experience.getCompany(), experience.getLocation(), experience.getJobTitle(), experience.getDescription()));
first = false;
}
htmlContent.append("</td>\n" +
" </tr>");
}
htmlContent.append("</tbody>\n" +
"</table>\n" +
"<p class=\"c2 c11\"><span class=\"c30 c5\"></span></p>\n" +
"</div>\n" +
"</body>\n" +
"</html>");
webView.loadDataWithBaseURL(null, htmlContent.toString(), "text/html", "utf-8", null);
return view;
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.print, menu);
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.action_print) {
createWebPrintJob(webView);
}
return super.onOptionsItemSelected(item);
}
private void createWebPrintJob(WebView webView) {
// Get a PrintManager instance
PrintManager printManager = (PrintManager) getActivity()
.getSystemService(Context.PRINT_SERVICE);
// Get a print adapter instance
PrintDocumentAdapter printAdapter = webView.createPrintDocumentAdapter();
// Create a print job with name and adapter instance
String jobName = getString(R.string.app_name) + " Document";
PrintJob printJob = printManager.print(jobName, printAdapter,
new PrintAttributes.Builder().build());
}
}
| 88.507317 | 4,753 | 0.588845 |
6daeab2d7c92c60ce7ce92533a73d9e55356c4f5 | 306 | asm | Assembly | programs/oeis/044/A044187.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/044/A044187.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/044/A044187.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A044187: Numbers n such that string 0,0 occurs in the base 8 representation of n but not of n-1.
; 64,128,192,256,320,384,448,512,576,640,704,768,832,896,960,1024,1088,1152,1216,1280,1344,1408,1472,1536,1600,1664,1728,1792,1856,1920,1984,2048,2112,2176,2240,2304,2368,2432,2496,2560
mul $0,64
add $0,64
| 51 | 185 | 0.751634 |
f12c4c8b222c2b72e8524568a98d556196387865 | 1,080 | swift | Swift | TeamGenFoundation/Sources/Components/Functional/ReactiveCocoa+Extensions.swift | RuiAAPeres/TeamGen | 1ce8ff32908e293ee4d63ce821df4d05afb10205 | [
"MIT"
] | 3 | 2018-02-08T19:41:24.000Z | 2018-04-30T09:42:16.000Z | TeamGenFoundation/Sources/Components/Functional/ReactiveCocoa+Extensions.swift | RuiAAPeres/TeamGen | 1ce8ff32908e293ee4d63ce821df4d05afb10205 | [
"MIT"
] | null | null | null | TeamGenFoundation/Sources/Components/Functional/ReactiveCocoa+Extensions.swift | RuiAAPeres/TeamGen | 1ce8ff32908e293ee4d63ce821df4d05afb10205 | [
"MIT"
] | null | null | null | import ReactiveSwift
import enum Result.NoError
public extension Signal {
@discardableResult
public func injectSideEffect(_ next: @escaping (Value) -> Void) -> Signal<Value, Error> {
return self.on(value: next)
}
public func discardValues() -> Signal<Void, Error> {
return map { _ in }
}
}
public extension SignalProducer {
func ignoreError() -> SignalProducer<Value, NoError> {
return self.flatMapError { _ in return SignalProducer<Value, NoError>.empty }
}
static func action(run: @escaping () -> Void) -> SignalProducer {
return SignalProducer { o, _ in
defer { o.sendCompleted() }
run()
}
}
public func discardValues() -> SignalProducer<Void, Error> {
return map { _ in }
}
}
public extension Action where Output == Void, Error == NoError {
public convenience init(_ execute: @escaping (Input) -> Void) {
self.init { input -> SignalProducer<Output, Error> in
execute(input)
return .empty
}
}
}
| 27 | 93 | 0.60463 |
b7ce4670fb0eddc3cb1b156d1df495bab01aea91 | 1,697 | asm | Assembly | programs/oeis/017/A017130.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/017/A017130.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/017/A017130.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A017130: a(n) = (8*n + 5)^6.
; 15625,4826809,85766121,594823321,2565726409,8303765625,22164361129,51520374361,107918163081,208422380089,377149515625,646990183449,1061520150601,1677100110841,2565164201769,3814697265625,5534900853769,7858047974841,10942526586601,14976071831449,20179187015625,26808753332089,35161828327081,45579633110361,58451728309129,74220378765625,93385106978409,116507435287321,144215816802121,177210755074809,216270112515625,262254607552729,316113500535561,378890468381881,451729667968489,535881988265625,632711491215049,743702041351801,870464124169641,1014741853230169,1178420166015625,1363532208525369,1572266908616041,1806976738085401,2070185663499849,2364597285765625,2693103168443689,3058791354808281,3464955073649161,3915101633817529,4412961507515625,4962497602330009,5567914722008521,6233669215980921,6964478817623209,7765332671265625,8641501547944329,9598548249896761,10642338203800681,11779050242756889,13015187577015625,14357588953446649,15813440003753001,17390284781428441,19096037487458569,20938994384765625,22927845901396969,25071688922457241,27380039270784201,29862844376368249,32530496134515625,35393843952755289,38464207986489481,41753392563387961,45273699796525929,49037943386265625,53059462610881609,57352136505929721,61930398232359721,66809249633371609,72004275980015625,77531660905535929,83408201528457961,89651323764419481,96279097826745289,103310253915765625,110764198096878249,118661028367354201,127021550911887241,135867296546886969,145220537353515625,155104303499468569,165542400249498441,176559425164683001,188180785490436649,200432715733265625,213342295426266889,226937467083370681,241247054342326761,256300780296434329
mul $0,8
add $0,5
pow $0,6
| 242.428571 | 1,637 | 0.921626 |
2f6f9615cb616ee6a011c540d8eff1e33f405795 | 282 | cshtml | C# | Views/Home/Index.cshtml | uvedula/UrlRedirector | b08190115468f4cc033941c2d8280ce45edb4724 | [
"Unlicense"
] | null | null | null | Views/Home/Index.cshtml | uvedula/UrlRedirector | b08190115468f4cc033941c2d8280ce45edb4724 | [
"Unlicense"
] | null | null | null | Views/Home/Index.cshtml | uvedula/UrlRedirector | b08190115468f4cc033941c2d8280ce45edb4724 | [
"Unlicense"
] | 1 | 2020-09-02T14:56:51.000Z | 2020-09-02T14:56:51.000Z | @{
ViewData["Title"] = "Home Page";
}
<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>This is an example ASP.Net core application. It allows you to redirect a short name to a different URL, and provides an administrative interface to do so.</p>
</div>
| 31.333333 | 165 | 0.680851 |
0b373158f05135f2dafba65a6ba39cdf0ba87c6d | 1,348 | py | Python | Badger/scripts/besdirac-wms-decaycard-get.py | zhangxt-ihep/IHEPDIRAC | fb53500a998adc43ff0c65c02caf492da2965de5 | [
"MIT"
] | null | null | null | Badger/scripts/besdirac-wms-decaycard-get.py | zhangxt-ihep/IHEPDIRAC | fb53500a998adc43ff0c65c02caf492da2965de5 | [
"MIT"
] | 1 | 2021-03-04T08:48:38.000Z | 2021-03-04T08:48:38.000Z | Badger/scripts/besdirac-wms-decaycard-get.py | zhangxt-ihep/IHEPDIRAC | fb53500a998adc43ff0c65c02caf492da2965de5 | [
"MIT"
] | 2 | 2020-08-26T06:36:51.000Z | 2021-03-04T08:08:34.000Z | #!/usr/bin/env python
import DIRAC
from DIRAC import S_OK, S_ERROR
from DIRAC.Core.Base import Script
Script.setUsageMessage( """
Insert random trigger file into the File Catalog
Usage:
%s [option] lfn
""" % Script.scriptName )
fcType = 'FileCatalog'
Script.parseCommandLine( ignoreErrors = False )
options = Script.getUnprocessedSwitches()
args = Script.getPositionalArgs()
from DIRAC.Interfaces.API.Dirac import Dirac
dirac = Dirac()
from DIRAC.Resources.Catalog.FileCatalogClient import FileCatalogClient
fccType = 'DataManagement/FileCatalog'
fcc = FileCatalogClient(fccType)
def getMeta(lfn, metaname):
'''Get metadata'''
result = fcc.getDirectoryMetadata(lfn)
if not result['OK']:
print result['Message']
return
if result['Value'].has_key(metaname):
return result['Value'][metaname]
def main():
lfns = args
for lfn in lfns:
print '================================================================================'
print 'Decay card for: %s' % lfn
print '--------------------------------------------------------------------------------'
# print getMeta(lfn, 'jobOptions')
print getMeta(lfn, 'decayCard')
print '--------------------------------------------------------------------------------'
if __name__ == '__main__':
main()
| 25.923077 | 96 | 0.557864 |
c81925a1a1c284fba14aa56e5676b38318ae70a3 | 12,116 | ps1 | PowerShell | scripts/kubernetes/ingress/Upgrade-Nginx-IC-Auto.ps1 | guidemetothemoon/div-dev-resources | 72df3e550be57c04687c6f4cda63572e9ffec624 | [
"MIT"
] | null | null | null | scripts/kubernetes/ingress/Upgrade-Nginx-IC-Auto.ps1 | guidemetothemoon/div-dev-resources | 72df3e550be57c04687c6f4cda63572e9ffec624 | [
"MIT"
] | null | null | null | scripts/kubernetes/ingress/Upgrade-Nginx-IC-Auto.ps1 | guidemetothemoon/div-dev-resources | 72df3e550be57c04687c6f4cda63572e9ffec624 | [
"MIT"
] | null | null | null | # This script provides guidance and necessary commands to automatically upgrade Ingress Controller with zero downtime. Script has been used to upgrade NGINX Ingress Controller in Azure Kubernetes Service clusters
# but it can be easily adjusted to any other Kubernetes infrastructure as well.
# Before doing the upgrade, make a note of following information:
# - Ensure that you're using latest version of Azure CLI and PowerShell 7.0 or newer (due to usage of parallel execution)
# - Ensure that the command shell session is allowed to execute Azure commands (az login command to your service ;))
param (
[Parameter(Mandatory = $true)] [string]$ClusterId, # Id of the Kubernetes cluster where Ingress Controller is deployed
[Parameter(Mandatory = $true)] [string]$ClusterResourceGroup, # Resource group that AKS cluster was deployed to
[Parameter(Mandatory = $true)] [string]$DnsZoneName, # DNS zone that's being used by applications running in respective AKS cluster
[Parameter(Mandatory = $true)] [string]$DnsResourceGroup, # Resource group that DNS zone is created in
[Parameter(Mandatory = $false)] [string]$SubscriptionId # (Optional) Azure subscription where DNS zone is created - it will be set as active subscription for the shell session
)
$global:DebugPreference = "Continue";
function Update-DNS()
{
param
(
[Parameter(Mandatory=$true)][string]$DnsZoneName,
[Parameter(Mandatory=$true)][string]$DnsResourceGroup,
[Parameter(Mandatory=$true)][string]$IpToRemove,
[Parameter(Mandatory=$true)][string]$IpToAdd
)
# Get DNS records pointing to the IC IP that is about to be removed
Write-Debug "Retrieving DNS records for $DnsZoneName..."
$dns_recs = Get-DnsRecs -DnsZoneName $DnsZoneName -DnsResourceGroup $DnsResourceGroup -IpToCheck $IpToRemove
while ($dns_recs.count -ne 0)
{
Write-Debug "Updating DNS records..."
$dns_recs | ForEach-Object -Parallel {
$DebugPreference = "Continue";
Write-Debug "Updating IP of the DNS record $($_.Name) -> $($_.IP) with External IP of the new Ingress Controller -> $($using:IpToAdd)"
az network dns record-set a add-record --resource-group $using:DnsResourceGroup --zone-name $using:DnsZoneName --record-set-name $_.Name --ipv4-address $using:IpToAdd
az network dns record-set a remove-record --resource-group $using:DnsResourceGroup --zone-name $using:DnsZoneName --record-set-name $_.Name --ipv4-address $using:IpToRemove
} -ThrottleLimit 3 # here you can customize parallel threads count based on how many records you have but I wouldn't recommend to use more that 15 depending on how resourceful your system is
Write-Debug "DNS records are updated - checking if there are any dangling records that must be updated..."
# We need to check if any new DNS records were added pointing on the to-be-removed IP while we were updating DNS records so that we don't leave any DNS records dangling
$dns_recs = Get-DnsRecs -DnsZoneName $DnsZoneName -DnsResourceGroup $DnsResourceGroup -IpToCheck $IpToRemove
}
# Now wait for all traffic to be drained from original IC and moved to the new IC - check DNS resolution in the meantime to confirm that all DNS records are updated
Write-Debug "Getting DNS records for the new IP to verify DNS resolution..."
$updated_dns_recs = Get-DnsRecs -DnsZoneName $DnsZoneName -DnsResourceGroup $DnsResourceGroup -IpToCheck $IpToAdd
do
{
Write-Debug "Waiting for DNS records to be resolved to new IP..."
# Get DNS records that point to the new IP but are still being resolved to the old IP
$dns_resolution_res = $updated_dns_recs | Where-Object { (Resolve-DnsName -Name $_.FQDN).IPAddress -eq $IpToRemove }
if($dns_resolution_res.Count -ne 0)
{
Write-Debug "Not all DNS records are updated yet - sleeping for 1 minute before re-try..."
Start-Sleep -Seconds 60
}
}
while($dns_resolution_res.Count -ne 0)
Write-Debug "All DNS records have now been resolved!"
}
function Get-DnsRecs()
{
param
(
[Parameter(Mandatory=$true)][string]$DnsZoneName,
[Parameter(Mandatory=$true)][string]$DnsResourceGroup,
[Parameter(Mandatory=$true)][string]$IpToCheck
)
$dns_recs_to_update = az network dns record-set a list -g $DnsResourceGroup -z $DnsZoneName --query "[].{Name:name, FQDN:fqdn, IP:aRecords[].ipv4Address}[?contains(IP[],'$IpToCheck')]" | ConvertFrom-Json
Write-Debug "Found $($dns_recs_to_update.count) DNS records using IP $IpToCheck in DNS zone $DnsZoneName..."
return $dns_recs_to_update
}
function Get-Ingress-Pip()
{
param
(
[Parameter(Mandatory=$true)][string]$IngressNs
)
# Get external IP of the newly created Ingress Controller (service of type LoadBalancer in $temp_ingress_ns namespace)
$retryCount = 0
$ingress_ip = ""
do {
if ($retryCount -ge 10) {
Write-Warning "Can't retrieve external IP of Ingress Controller after more than 10 attempts - please update the deployment or abort operation!"
}
$ingress_ip = k get svc -n $IngressNs --output jsonpath='{.items[?(@.spec.type contains 'LoadBalancer')].status.loadBalancer.ingress[0].ip}' # get external ip of LoadBalancer service
if ($null -eq $ingress_ip) {
Write-Debug "External IP of Ingress Controller is not ready - sleeping for 10 seconds before re-try..."
Start-Sleep -Seconds 10
$retryCount++
}
else {
Write-Debug "External IP of Ingress Controller is $ingress_ip"
return $ingress_ip
}
} while ($null -eq $ingress_ip)
}
# 0 - Set alias for kubectl to not type the whole command every single time ;)
Write-Debug "Setting alias for kubectl command.."
Set-Alias -Name k -Value kubectl
if ($null -ne $SubscriptionId) {
Write-Debug "Setting active Azure subscription to $SubscriptionId .."
az account set --subscription $SubscriptionId # Set active subscription to the one where your DNS zones are defined
}
# 1 - Prepare namespace and Helm charts before creating temp Ingress Controller
Write-Debug "Setting active Kubernetes cluster to $ClusterId .."
k config use-context $ClusterId
$temp_ingress_ns = "ingress-temp"
$create_temp_ingress_ns = $null -eq (k get ns $temp_ingress_ns --ignore-not-found=true)
if ($create_temp_ingress_ns)
{
Write-Debug "ingress-temp namespace doesn't exist - creating..."
}
else
{
Write-Debug "ingress-temp namespace already exists - creating another namespace..."
$ns_guid = (New-Guid).Guid.Substring(0, 8)
$temp_ingress_ns = -join ($temp_ingress_ns, $ns_guid)
}
k create ns $temp_ingress_ns
# Add old and new Helm charts to ensure that the repo is up-to-date - here you can update the repo to any other repo you would like to use to deploy NGINX Ingress Controller
Write-Debug "Adding old and new Helm Charts repo for NGINX Ingress..."
helm repo add nginx-stable https://helm.nginx.com/stable
helm repo add stable https://charts.helm.sh/stable
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
# 2 - Create temp Ingress Controller based on the same Helm chart as the existing Ingress Controller that will be upgraded
Write-Debug "Creating temporary NGINX Ingress Controller based on the old Helm chart..."
helm upgrade nginx-ingress-temp stable/nginx-ingress --install --namespace $temp_ingress_ns --set controller.config.proxy-buffer-size="32k" --set controller.config.large-client-header-buffers="4 32k" --set controller.replicaCount=2 --set controller.nodeSelector."beta\.kubernetes\.io/os"=linux --set defaultBackend.nodeSelector."beta\.kubernetes\.io/os"=linux --set controller.metrics.service.annotations."prometheus\.io/port"="10254" --set controller.metrics.service.annotations."prometheus\.io/scrape"="true" --set controller.metrics.enabled=true --version=1.41.2
Write-Debug "Retrieving External IP of the original and temporary Ingress Controller... "
$original_ingress_ip= Get-Ingress-Pip -IngressNs "ingress-basic"
Write-Debug "External IP of the original Ingress Controller is $original_ingress_ip"
# Get external IP of the newly created Ingress Controller (service of type LoadBalancer in $temp_ingress_ns namespace)
$temp_ingress_ip = Get-Ingress-Pip -IngressNs $temp_ingress_ns
Write-Debug "External IP of the temporary Ingress Controller is $temp_ingress_ip"
# Commands to monitor traffic in both Ingress Controllers to identify when the traffic is only routed to the temporary IC so that the original IC can be taken offline
# For manual check of traffic flow in original and temporary Ingress Controller
#kubectl logs -l component=controller -n ingress-basic -f # Monitor traffic in original IC
#kubectl logs -l component=controller -n ingress-temp -f # Monitor traffic in temporary IC
# 4 - Update DNS records to route traffic to temp Ingress Controller
Update-DNS -DnsZoneName $DnsZoneName -DnsResourceGroup $DnsResourceGroup -IpToRemove $original_ingress_ip -IpToAdd $temp_ingress_ip
# 5 - Once DNS records were updated and all traffic has been re-routed to temp IC, uninstall original Ingress Controller with Helm and install new Ingress Controller with Helm
# In this case new Ingress Controller is configured to use Public IP of Azure Load Balancer and not create a new IP
Write-Debug "Getting cluster's Load Balancer Public IP..."
$cluster_lb_rg = az aks show --resource-group $ClusterResourceGroup --name $ClusterId --query nodeResourceGroup
$cluster_lb_ip = (az network public-ip list -g $cluster_lb_rg --query "[?tags.type=='aks-slb-managed-outbound-ip']" | ConvertFrom-Json)[0].ipAddress # Public IP of Azure Load Balancer that AKS cluster is connected to
Write-Debug "$ClusterId cluster's Azure Load Balancer Public IP is $cluster_lb_ip..."
Write-Debug "Uninstalling original NGINX IC and deploying an updated version to ingress-basic namespace..."
helm uninstall nginx-ingress -n ingress-basic
helm upgrade nginx-ingress ingress-nginx/ingress-nginx --install --create-namespace --namespace ingress-basic --set controller.config.proxy-buffer-size="32k" --set controller.config.large-client-header-buffers="4 32k" --set controller.replicaCount=2 --set controller.nodeSelector."kubernetes\.io/os"=linux --set defaultBackend.nodeSelector."kubernetes\.io/os"=linux --set-string controller.metrics.service.annotations."prometheus\.io/port"="10254" --set-string controller.metrics.service.annotations."prometheus\.io/scrape"="true" --set controller.metrics.enabled=true --set controller.service.loadBalancerIP=$cluster_lb_ip #you can also remove loadBalancerIP if you don't want new Ingress Controller to use Azure Load Balancer's Public IP - then new external IP will be generated automatically for this new IC
Get-Ingress-Pip -IngressNs "ingress-basic"
# Commands to monitor the newly created Ingress Controller since the initial one was removed in previous step - be aware that the Kubernetes label for in new NGINX Ingress Controller template has changed!
# For manual check of traffic flow in original and temporary Ingress Controller:
#kubectl logs -l app.kubernetes.io/component=controller -n ingress-basic -f # New IC
#kubectl logs -l component=controller -n ingress-temp -f # Temporary IC, should still be actively monitoring as per actions in step 3
# 7 - Redirect traffic back to the newly created Ingress Controller and monitor traffic routing together with DNS resolution
Update-DNS -DnsZoneName $DnsZoneName -DnsResourceGroup $DnsResourceGroup -IpToRemove $temp_ingress_ip -IpToAdd $cluster_lb_ip
# 8 - Remove temp resources once traffic is drained from temporary IC and newly created IC is fully in use and successfully running in respective Kubernetes cluster
Write-Debug "Cleaning up temp NGINX IC Helm deployment and namespace..."
helm uninstall nginx-ingress-temp -n $temp_ingress_ns
k delete ns $temp_ingress_ns
Write-Debug "Ingress Controller has been successfully updated!" | 60.884422 | 810 | 0.746781 |
e1cb8f3ee72e9608e0737a9bb189f5d1c8323da1 | 1,039 | dart | Dart | lib/dynamic_widget/basic/offstage_widget_parser.dart | iquns/dynamic_widget | 87b86a993677e3e52eb52436a2a81aad6023faa2 | [
"Apache-2.0"
] | null | null | null | lib/dynamic_widget/basic/offstage_widget_parser.dart | iquns/dynamic_widget | 87b86a993677e3e52eb52436a2a81aad6023faa2 | [
"Apache-2.0"
] | null | null | null | lib/dynamic_widget/basic/offstage_widget_parser.dart | iquns/dynamic_widget | 87b86a993677e3e52eb52436a2a81aad6023faa2 | [
"Apache-2.0"
] | null | null | null | import 'package:dynamic_widget/dynamic_widget.dart';
import 'package:dynamic_widget/dynamic_widget/attr_helper.dart';
import 'package:dynamic_widget/dynamic_widget/utils.dart';
import 'package:flutter/widgets.dart';
class OffstageWidgetParser extends WidgetParser {
@override
Map<String, List> attrMapping() {
return <String, List>{
"offstage": [bool, true],
"child": [Widget, null],
};
}
@override
Map<String, dynamic> export(Widget? widget, BuildContext? buildContext) {
Offstage realWidget = widget as Offstage;
return <String, dynamic>{
"type": widgetName,
"offstage": realWidget.offstage,
"child": DynamicWidgetBuilder.export(realWidget.child, buildContext)
};
}
@override
Widget parse(
AttrSet attr, BuildContext buildContext, ClickListener? listener) {
return Offstage(
offstage: attr.get('offstage'),
child: attr.get('child'),
);
}
@override
String get widgetName => "Offstage";
@override
Type get widgetType => Offstage;
}
| 25.975 | 75 | 0.692012 |
bf91ab66fe87c42e205087fbbe614cf7009acc63 | 2,611 | swift | Swift | Music/Views/Trending/TrendingView.swift | nerdsupremacist/graphaello-music-example | 9a6579fa11af31a9e63923f71e0d6dd0abf360db | [
"MIT"
] | 3 | 2020-02-25T16:53:58.000Z | 2021-01-11T08:40:18.000Z | Music/Views/Trending/TrendingView.swift | nerdsupremacist/graphaello-music-example | 9a6579fa11af31a9e63923f71e0d6dd0abf360db | [
"MIT"
] | 1 | 2021-04-27T20:08:15.000Z | 2021-05-07T13:20:22.000Z | Music/Views/Trending/TrendingView.swift | nerdsupremacist/graphaello-music-example | 9a6579fa11af31a9e63923f71e0d6dd0abf360db | [
"MIT"
] | null | null | null | //
// ArtistsSearchResults.swift
// Music
//
// Created by Mathias Quintero on 12/22/19.
// Copyright © 2019 Mathias Quintero. All rights reserved.
//
import SwiftUI
import FancyScrollView
struct TrendingArtistsList: View {
let api: Music
@GraphQL(Music.lastFm.chart.topArtists)
var artists: Paging<TrendingArtistCell.LastFmArtist>?
@GraphQL(Music.lastFm.chart.topTracks)
var tracks: Paging<TrendingTrackCell.LastFmTrack>?
var body: some View {
FancyScrollView {
VStack(alignment: .leading) {
Text("Top Songs")
.font(.largeTitle)
.foregroundColor(.primary)
.fontWeight(.black)
.padding([.horizontal, .top], 16)
tracks.map { tracks in
VStack {
ForEach(tracks.values, id: \.title) { track in
TrendingTrackCell(api: self.api, lastFmTrack: track)
}
}
}
tracks.map { tracks in
HStack {
Spacer()
NavigationLink(destination: TopSongsList(api: api, paging: tracks)) {
Text("More")
.foregroundColor(.orange)
.font(.callout)
.frame(alignment: .center)
}.frame(alignment: .center)
Spacer()
}
}
Text("Top Artists")
.font(.largeTitle)
.foregroundColor(.primary)
.fontWeight(.black)
.padding([.horizontal, .top], 16)
artists.map { artists in
ForEach(artists.values, id: \.name) { artist in
TrendingArtistCell(api: self.api, lastFmArtist: artist)
}
}
artists.map { artists in
HStack {
Spacer()
NavigationLink(destination: TopArtistsList(api: api, paging: artists)) {
Text("More")
.foregroundColor(.orange)
.font(.callout)
.frame(alignment: .center)
}.frame(alignment: .center)
Spacer()
}
}
Spacer()
}
}
}
}
| 32.234568 | 96 | 0.424358 |
9858cf0b6c1d93794964ccf5c3e7a9924e20ee24 | 2,693 | html | HTML | index.html | shaakya-weerasundera/HIT238-Sprint-3 | 1e6578d05dd5d06905100ba7d760bfd77936a17e | [
"Apache-2.0"
] | null | null | null | index.html | shaakya-weerasundera/HIT238-Sprint-3 | 1e6578d05dd5d06905100ba7d760bfd77936a17e | [
"Apache-2.0"
] | 2 | 2020-10-07T03:49:48.000Z | 2020-10-07T04:17:45.000Z | index.html | shaakya-weerasundera/HIT238-Sprint-3 | 1e6578d05dd5d06905100ba7d760bfd77936a17e | [
"Apache-2.0"
] | null | null | null | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Travel App</title>
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
crossorigin="anonymous"
/>
<link rel="stylesheet" href="styles/explore.css">
<script src="https://kit.fontawesome.com/a076d05399.js"></script>
<link rel="manifest" href="manifest.json">
<link rel="apple-touch-icon" href="styles/images/icons/plane-96x96.png">
</head>
<body>
<nav>
<input type="checkbox" id="check">
<label for="check" class="checkbtn">
<i class="fas fa-bars"></i>
</label>
<label class="logo">Travel Now</label>
<ul>
<li><a class="current" href="#">Explore</a></li>
<li><a href="plan.html"></a></li>
<li><a href="#">Book</a></li>
<li><a href="#">Map</a></li>
<li><a href="#">Update</a></li>
<li><a href="https://docs.google.com/forms/d/e/1FAIpQLSeqTRw3OLmGge-mrESZ-K_gz6gTTyy2rX8s8VardLIGi0ufYg/viewform?usp=sf_link">Feedback</a></li>
</ul>
</nav>
<section>
<div class="container"></div>
<form class="search-loaction">
<input
type="text"
name="city"
placeholder="Search for a Destination"
autocomplete="off"
class="form-control text-muted form-rounded p-4 shadow-sm"
/>
</form>
<div class="card-top text-center">
<div class="city-name my-3">
<h1 class="search-head">Search any Place...</h1>
</div>
</div>
<div class="card-body">
<div class="card-mid row">
<div class="col-8 text-center temp">
</div>
<div class="col-4 condition-temp">
<p class="condition"></p>
<p class="high"></p>
<p class="low"></p>
</div>
</div>
<div class="icon-container card shadow mx-auto">
</div>
<div class="card-bottom px-5 py-4 row">
<div class="col text-center">
<p></p>
</div>
<div class="col text-center">
<p></p>
</div>
</div>
</div>
</section>
<script src="scripts/explore.js"></script>
<script src="scripts/dest-requests.js"></script>
</body>
</html>
| 34.088608 | 156 | 0.509469 |
388a430de3e49594af52377155c7e7d2b26cf197 | 2,205 | h | C | sys/include/fb.h | henesy/plan9-1e | 47575dc4a4638a1ee0d9eed78d88a9f1720a4430 | [
"MIT"
] | null | null | null | sys/include/fb.h | henesy/plan9-1e | 47575dc4a4638a1ee0d9eed78d88a9f1720a4430 | [
"MIT"
] | null | null | null | sys/include/fb.h | henesy/plan9-1e | 47575dc4a4638a1ee0d9eed78d88a9f1720a4430 | [
"MIT"
] | null | null | null | #pragma lib "libfb.a"
/*
* picfile
*
* Not working: TYPE=ccitt-g31, TYPE=ccitt-g32, TYPE=ccitt-g4, TYPE=ccir601.
* picconf.c has unimplemented TYPEs commented out.
*/
typedef struct PICFILE PICFILE;
struct PICFILE{
int fd;
int nchan;
int x, y;
int width, height;
char *type;
char *chan;
char *cmap;
int argc;
char **argv;
int flags;
int line;
int depth; /* TYPE=plan9 only */
unsigned char *buf;
unsigned char *ebuf;
unsigned char *bufp;
int (*rd)(PICFILE *, void *);
int (*wr)(PICFILE *, void *);
int (*cl)(PICFILE *);
};
#define PIC_NCHAN(p) ((p)->nchan)
#define PIC_WIDTH(p) ((p)->width)
#define PIC_HEIGHT(p) ((p)->height)
#define PIC_XOFFS(p) ((p)->x)
#define PIC_YOFFS(p) ((p)->y)
#define PIC_RECT(p) Rect((p)->x, (p)->y, (p)->x+(p)->width, (p)->y+(p)->height) /* needs <geometry.h> */
#define PIC_SAMEARGS(p) (p)->type, (p)->x, (p)->y, (p)->width, (p)->height, (p)->chan, argv, (p)->cmap
#define picread(f, buf) (*(f)->rd)(f, buf)
#define picwrite(f, buf) (*(f)->wr)(f, buf)
PICFILE *picopen_r(char *);
PICFILE *picopen_w(char *, char *, int, int, int, int, char *, char *[], char *);
PICFILE *picputprop(PICFILE *, char *, char *);
char *picgetprop(PICFILE *, char *);
void picclose(PICFILE *);
void picpack(PICFILE *, char *, char *, ...);
void picunpack(PICFILE *, char *, char *, ...); /* wrong? */
void picerror(char *);
int getcmap(char *, unsigned char *);
/*
* Private data
*/
char *_PICcommand;
char *_PICerror;
void _PWRheader(PICFILE *);
int _PICplan9header(PICFILE *, char *);
int _PICread(int, void *, int);
#define PIC_NOCLOSE 1 /* don't close p->fd on picclose */
#define PIC_INPUT 2 /* open for input */
struct _PICconf{
char *type;
int (*rd)(PICFILE *, void *);
int (*wr)(PICFILE *, void *);
int (*cl)(PICFILE *);
int nchan;
}_PICconf[];
/*
* getflags
*/
#define NFLAG 128
#define NCMDLINE 512
#define NGETFLAGSARGV 256
extern char **flag[NFLAG];
extern char cmdline[NCMDLINE+1];
extern char *cmdname;
extern char *flagset[];
extern char *getflagsargv[NGETFLAGSARGV+2];
extern getflags(int, char **, char *);
extern void usage(char *);
/*
* rdpicfile, wrpicfile
*/
Bitmap *rdpicfile(PICFILE *, int);
int wrpicfile(PICFILE *, Bitmap *);
| 26.566265 | 105 | 0.640363 |
ee920a97a0e7e929afcfc9077adb11eac64df438 | 1,806 | sql | SQL | pgAdmin/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/9.2_plus/stats.sql | WeilerWebServices/PostgreSQL | ae594ed077bebbad1be3c1d95c38b7c2c2683e8c | [
"PostgreSQL"
] | 4 | 2019-10-03T21:58:22.000Z | 2021-02-12T13:33:32.000Z | openresty-win32-build/thirdparty/x86/pgsql/pgAdmin 4/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/9.2_plus/stats.sql | nneesshh/openresty-oss | bfbb9d7526020eda1788a0ed24f2be3c8be5c1c3 | [
"MIT"
] | 10 | 2020-06-05T19:42:26.000Z | 2022-03-11T23:38:35.000Z | openresty-win32-build/thirdparty/x86/pgsql/pgAdmin 4/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/9.2_plus/stats.sql | nneesshh/openresty-oss | bfbb9d7526020eda1788a0ed24f2be3c8be5c1c3 | [
"MIT"
] | 1 | 2021-01-13T09:30:29.000Z | 2021-01-13T09:30:29.000Z | SELECT
{% if not did %}db.datname AS {{ conn|qtIdent(_('Database')) }}, {% endif %}
numbackends AS {{ conn|qtIdent(_('Backends')) }},
xact_commit AS {{ conn|qtIdent(_('Xact committed')) }},
xact_rollback AS {{ conn|qtIdent(_('Xact rolled back')) }},
blks_read AS {{ conn|qtIdent(_('Blocks read')) }},
blks_hit AS {{ conn|qtIdent(_('Blocks hit')) }},
tup_returned AS {{ conn|qtIdent(_('Tuples returned')) }},
tup_fetched AS {{ conn|qtIdent(_('Tuples fetched')) }},
tup_inserted AS {{ conn|qtIdent(_('Tuples inserted')) }},
tup_updated AS {{ conn|qtIdent(_('Tuples updated')) }},
tup_deleted AS {{ conn|qtIdent(_('Tuples deleted')) }},
stats_reset AS {{ conn|qtIdent(_('Last statistics reset')) }},
slave.confl_tablespace AS {{ conn|qtIdent(_('Tablespace conflicts')) }},
slave.confl_lock AS {{ conn|qtIdent(_('Lock conflicts')) }},
slave.confl_snapshot AS {{ conn|qtIdent(_('Snapshot conflicts')) }},
slave.confl_bufferpin AS {{ conn|qtIdent(_('Bufferpin conflicts')) }},
slave.confl_deadlock AS {{ conn|qtIdent(_('Deadlock conflicts')) }},
temp_files AS {{ conn|qtIdent(_("Temporary files")) }},
temp_bytes AS {{ conn|qtIdent(_("Size of temporary files")) }},
deadlocks AS {{ conn|qtIdent(_("Deadlocks")) }},
blk_read_time AS {{ conn|qtIdent(_("Block read time")) }},
blk_write_time AS {{ conn|qtIdent(_("Block write time")) }},
pg_database_size(db.datid) AS {{ conn|qtIdent(_('Size')) }}
FROM
pg_stat_database db
LEFT JOIN pg_stat_database_conflicts slave ON db.datid=slave.datid
WHERE {% if did %}
db.datid = {{ did|qtLiteral }}::OID{% else %}
db.datid > {{ last_system_oid|qtLiteral }}::OID
{% endif %}
{% if db_restrictions %}
AND
db.datname in ({{db_restrictions}})
{% endif %}
ORDER BY db.datname;
| 46.307692 | 80 | 0.648394 |
c8f3cad8ba7cb5cd7f19df85b07c83879a53bcf7 | 1,707 | dart | Dart | lib/src/models/permission.dart | approachableGeek/qonversion-presentCodeRedemptionSheet | d7546ea0aff6ca37b3e4809fe1b4b26d408345e9 | [
"MIT"
] | 77 | 2020-03-15T11:50:34.000Z | 2021-12-10T08:27:58.000Z | lib/src/models/permission.dart | approachableGeek/qonversion-presentCodeRedemptionSheet | d7546ea0aff6ca37b3e4809fe1b4b26d408345e9 | [
"MIT"
] | 24 | 2020-05-10T04:39:20.000Z | 2022-03-30T14:55:52.000Z | lib/src/models/permission.dart | approachableGeek/qonversion-presentCodeRedemptionSheet | d7546ea0aff6ca37b3e4809fe1b4b26d408345e9 | [
"MIT"
] | 16 | 2021-01-04T19:35:14.000Z | 2022-03-25T03:44:03.000Z | import 'package:json_annotation/json_annotation.dart';
import 'package:qonversion_flutter/src/models/product_renew_state.dart';
import 'package:qonversion_flutter/src/models/utils/mapper.dart';
part 'permission.g.dart';
@JsonSerializable(createToJson: false)
class QPermission {
/// Qonversion Permission ID, like premium.
///
/// See [Create Permission](https://qonversion.io/docs/create-permission)
@JsonKey(name: 'id')
final String permissionId;
/// Product ID created in Qonversion Dashboard.
///
/// See [Create Products](https://qonversion.io/docs/create-products)
@JsonKey(name: 'associated_product')
final String productId;
/// A renew state for an associate product that unlocked permission
@JsonKey(
name: 'renew_state',
unknownEnumValue: QProductRenewState.unknown,
)
final QProductRenewState renewState;
/// Purchase date
@JsonKey(
name: 'started_timestamp',
fromJson: QMapper.dateTimeFromSecondsTimestamp,
)
final DateTime? startedDate;
/// Expiration date for subscription
@JsonKey(
name: 'expiration_timestamp',
fromJson: QMapper.dateTimeFromSecondsTimestamp,
)
final DateTime? expirationDate;
/// Use for checking permission for current user.
/// Pay attention, isActive == true does not mean that subscription is renewable.
/// Subscription could be canceled, but the user could still have a permission
@JsonKey(name: 'active')
final bool isActive;
const QPermission(
this.permissionId,
this.productId,
this.renewState,
this.startedDate,
this.expirationDate,
this.isActive,
);
factory QPermission.fromJson(Map<String, dynamic> json) =>
_$QPermissionFromJson(json);
}
| 28.45 | 83 | 0.734036 |
f1b69833a5675704928d9fd40cbbaf4b99a5d124 | 296 | swift | Swift | Sources/Graffeine/Animation/Data/Line/GraffeineDataAnimators_Line.swift | lukasz-pomianek/graffeine | bbbfec4b136598c6ac06e82cdc00d8261df04d9d | [
"MIT"
] | 21 | 2020-01-29T14:29:30.000Z | 2020-02-25T08:13:35.000Z | Sources/Graffeine/Animation/Data/Line/GraffeineDataAnimators_Line.swift | lukasz-pomianek/graffeine | bbbfec4b136598c6ac06e82cdc00d8261df04d9d | [
"MIT"
] | null | null | null | Sources/Graffeine/Animation/Data/Line/GraffeineDataAnimators_Line.swift | lukasz-pomianek/graffeine | bbbfec4b136598c6ac06e82cdc00d8261df04d9d | [
"MIT"
] | 3 | 2020-01-15T22:47:13.000Z | 2022-01-25T20:16:09.000Z | import UIKit
public protocol GraffeineLineDataAnimating: GraffeineDataAnimating {
var delay: TimeInterval { get set }
func animate(line: GraffeineLineLayer.Line, from: CGPath, to: CGPath)
}
extension GraffeineAnimation.Data {
public struct Line {
private init() {}
}
}
| 21.142857 | 73 | 0.716216 |
34b7a744262477b0b138eef5fec9042765db9341 | 2,446 | dart | Dart | tam_kin_aeng_mobile_app/lib/screen/recipe/ingredientChecklist.dart | TamKinAeng/TamKinAeng | f4432d3c4f3e53a9291f84f38d0f82e74d0964f7 | [
"MIT"
] | null | null | null | tam_kin_aeng_mobile_app/lib/screen/recipe/ingredientChecklist.dart | TamKinAeng/TamKinAeng | f4432d3c4f3e53a9291f84f38d0f82e74d0964f7 | [
"MIT"
] | null | null | null | tam_kin_aeng_mobile_app/lib/screen/recipe/ingredientChecklist.dart | TamKinAeng/TamKinAeng | f4432d3c4f3e53a9291f84f38d0f82e74d0964f7 | [
"MIT"
] | 2 | 2021-11-25T07:06:16.000Z | 2022-02-21T08:10:13.000Z | import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:tam_kin_aeng_mobile_app/component/my_bottom_nav_bar.dart';
import 'package:tam_kin_aeng_mobile_app/screen/recipe/CookingPage.dart';
import 'package:tam_kin_aeng_mobile_app/screen/recipe/RecipePage.dart';
import 'package:tam_kin_aeng_mobile_app/screen/recipe/ingredientCheckbox.dart';
import 'package:tam_kin_aeng_mobile_app/screen/recipe/model/cookingstepDatabase.dart';
import '../../size_config.dart';
class IngredientChecklist extends StatelessWidget {
//
final DocumentSnapshot RecipeDB;
const IngredientChecklist({Key key, this.RecipeDB}) : super(key: key);
@override
Widget build(BuildContext context) {
SizeConfig().init(context);
return Container(
margin: EdgeInsets.only(top:10),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/test.jpg"),
fit: BoxFit.fill)),
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: buildAppBar(context),
body: CheckboxList(
IngredientDB: RecipeDB,
),
floatingActionButton: FloatingActionButton.extended(
backgroundColor: Color.fromRGBO(60, 9, 108, 1),
label: Text("Next"),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => CookingScreen(
index: 0,
RecipeDB: RecipeDB,
),
));
}),
bottomNavigationBar: MyBottomNavBar()),
);
}
AppBar buildAppBar(BuildContext context) {
double defaultSize = SizeConfig.defaultSize;
return AppBar(
backgroundColor: Colors.transparent,
// This is icons and logo on our app bar
leading: IconButton(
icon: SvgPicture.asset("assets/icons/back.svg",color: Colors.white,),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => RecipeScreen(
recipeIndex: RecipeDB,
),
));
},
),
);
}
} | 35.970588 | 86 | 0.584628 |
7b0902dfcb5ab8b4e7914b86dbff0f023f9b1692 | 340 | sql | SQL | backend/migrations/20190316224337_create_table_users.up.sql | mrbrownt/gitreleased | cae61ca8c3284e6633e14cd2cb60c77107942fad | [
"MIT"
] | null | null | null | backend/migrations/20190316224337_create_table_users.up.sql | mrbrownt/gitreleased | cae61ca8c3284e6633e14cd2cb60c77107942fad | [
"MIT"
] | 5 | 2019-07-17T03:35:58.000Z | 2022-02-17T23:34:49.000Z | backend/migrations/20190316224337_create_table_users.up.sql | mrbrownt/gitreleased | cae61ca8c3284e6633e14cd2cb60c77107942fad | [
"MIT"
] | null | null | null | CREATE EXTENSION IF NOT EXISTS pgcrypto;
CREATE TABLE users (
id UUID PRIMARY KEY DEFAULT gen_random_uuid (),
created_at TIMESTAMPTZ NOT NULL,
updated_at TIMESTAMPTZ NOT NULL,
email VARCHAR NULL,
github_id VARCHAR NULL,
github_user_name VARCHAR NULL,
first_name VARCHAR NULL,
last_name VARCHAR NULL,
access_token VARCHAR NULL
);
| 24.285714 | 48 | 0.797059 |
2f1c764cab4b41451374debe22db018bed338820 | 537 | php | PHP | Output/fakeserver/form.php | PeterTognola/Mailify | f7caec11d67d6b802f71348668d0f40e7eba9725 | [
"Apache-2.0"
] | 2 | 2015-05-11T19:19:28.000Z | 2015-07-06T15:41:02.000Z | Output/fakeserver/form.php | PeterTognola/Mailify | f7caec11d67d6b802f71348668d0f40e7eba9725 | [
"Apache-2.0"
] | null | null | null | Output/fakeserver/form.php | PeterTognola/Mailify | f7caec11d67d6b802f71348668d0f40e7eba9725 | [
"Apache-2.0"
] | null | null | null | {
"PartnerForm": ["FormName", "#"],
"Name": ["Textbox", "Name", "validate"],
"Organisation": ["Textbox", "Organistation"],
"Email": ["Email", "Your Email", "validate"],
"Employees": ["Textbox", "No. of Employees", "validate"],
"Details": ["Textarea", "Quote Details", "validate"],
"Agree": ["Checkbox", "I'm happy to receive news, event invitations and general marketing updates from Phoenix Software Ltd"],
"Submit": ["Submit", "SEND", "PartnerForm"],
"Location": ["Hidden", "window.location.href"]
} | 48.818182 | 130 | 0.612663 |
22fabe7c8c7ff770dadb9bb2d301f61de58b877c | 855 | cpp | C++ | src_multispec/ProjectOntoEOS.cpp | PeculiarOvertones/FHDeX | 60e285101704196db24afe8b2461283753526fc5 | [
"BSD-3-Clause-LBNL"
] | 3 | 2018-06-25T13:23:13.000Z | 2021-12-28T21:31:54.000Z | src_multispec/ProjectOntoEOS.cpp | PeculiarOvertones/FHDeX | 60e285101704196db24afe8b2461283753526fc5 | [
"BSD-3-Clause-LBNL"
] | 44 | 2019-09-24T15:31:52.000Z | 2022-02-24T21:05:21.000Z | src_multispec/ProjectOntoEOS.cpp | PeculiarOvertones/FHDeX | 60e285101704196db24afe8b2461283753526fc5 | [
"BSD-3-Clause-LBNL"
] | 7 | 2019-10-01T15:47:08.000Z | 2022-02-22T23:04:58.000Z | #include "multispec_functions.H"
void ProjectOntoEOS(MultiFab& rho_in)
{
if (algorithm_type == 4 || algorithm_type == 6) {
if (nspecies == 1) {
rho_in.setVal(rho0);
return;
}
for ( MFIter mfi(rho_in,TilingIfNotGPU()); mfi.isValid(); ++mfi ) {
const Box& bx = mfi.tilebox();
const Array4<Real>& rho = rho_in.array(mfi);
amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
Real sum = 0.;
for (int n=0; n<nspecies-1; ++n) {
sum += rho(i,j,k,n);
}
rho(i,j,k,nspecies-1) = rho0 - sum;
});
}
} else {
Abort("ProjectOntoEOS algorithm_type = 0, 2, 3, 5 not written");
}
}
| 24.428571 | 86 | 0.450292 |
11a9ac52016b5432210070b60505180c78bf8cb0 | 17,006 | dart | Dart | front/lib/XD/XD_Signup.dart | jphacks/D_2017 | 28749f5b25a8af75b08a7a928e9963f8d4f8cbea | [
"MIT"
] | 4 | 2020-11-01T12:13:07.000Z | 2021-07-14T06:19:09.000Z | front/lib/XD/XD_Signup.dart | jphacks/D_2017 | 28749f5b25a8af75b08a7a928e9963f8d4f8cbea | [
"MIT"
] | 61 | 2020-11-02T13:08:56.000Z | 2020-11-27T17:32:59.000Z | front/lib/XD/XD_Signup.dart | jphacks/D_2017 | 28749f5b25a8af75b08a7a928e9963f8d4f8cbea | [
"MIT"
] | 1 | 2021-10-02T19:52:14.000Z | 2021-10-02T19:52:14.000Z | import 'package:flutter/material.dart';
import 'package:adobe_xd/pinned.dart';
import './XD_EnterAuthcode.dart';
import 'package:adobe_xd/page_link.dart';
import 'package:flutter_svg/flutter_svg.dart';
class XD_Signup extends StatelessWidget {
XD_Signup({
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xffffffff),
body: Stack(
children: <Widget>[
Transform.translate(
offset: Offset(0.0, 90.0),
child: Container(
width: 375.0,
height: 40.0,
decoration: BoxDecoration(
color: const Color(0xffe0e0e0),
),
),
),
Container(),
Container(),
Transform.translate(
offset: Offset(30.0, 101.0),
child: Text(
'アカウント登録',
style: TextStyle(
fontFamily: 'Helvetica Neue',
fontSize: 18,
color: const Color(0xff393939),
fontWeight: FontWeight.w700,
height: 1.1666666666666667,
),
textAlign: TextAlign.left,
),
),
Transform.translate(
offset: Offset(82.0, 241.0),
child: Text(
'Mail Address',
style: TextStyle(
fontFamily: 'Helvetica Neue',
fontSize: 16,
color: const Color(0xff000000),
),
textAlign: TextAlign.left,
),
),
Transform.translate(
offset: Offset(82.0, 301.0),
child: Text(
'Password',
style: TextStyle(
fontFamily: 'Helvetica Neue',
fontSize: 16,
color: const Color(0xff000000),
),
textAlign: TextAlign.left,
),
),
Transform.translate(
offset: Offset(41.0, 240.0),
child:
// Adobe XD layer: 'Free Mail icon' (group)
SizedBox(
width: 25.0,
height: 19.0,
child: Stack(
children: <Widget>[
Pinned.fromSize(
bounds: Rect.fromLTWH(22.0, 5.2, 3.3, 6.2),
size: Size(25.3, 19.0),
pinRight: true,
fixedWidth: true,
fixedHeight: true,
child: SvgPicture.string(
_svg_w2s7fu,
allowDrawingOutsideViewBox: true,
fit: BoxFit.fill,
),
),
Pinned.fromSize(
bounds: Rect.fromLTWH(0.0, 5.2, 3.3, 6.2),
size: Size(25.3, 19.0),
pinLeft: true,
fixedWidth: true,
fixedHeight: true,
child: SvgPicture.string(
_svg_ca7ikg,
allowDrawingOutsideViewBox: true,
fit: BoxFit.fill,
),
),
Pinned.fromSize(
bounds: Rect.fromLTWH(0.0, 9.4, 25.3, 9.6),
size: Size(25.3, 19.0),
pinLeft: true,
pinRight: true,
pinBottom: true,
fixedHeight: true,
child: SvgPicture.string(
_svg_jv16te,
allowDrawingOutsideViewBox: true,
fit: BoxFit.fill,
),
),
Pinned.fromSize(
bounds: Rect.fromLTWH(0.0, 0.0, 25.3, 13.2),
size: Size(25.3, 19.0),
pinLeft: true,
pinRight: true,
pinTop: true,
pinBottom: true,
child: SvgPicture.string(
_svg_951p1o,
allowDrawingOutsideViewBox: true,
fit: BoxFit.fill,
),
),
],
),
),
),
Transform.translate(
offset: Offset(44.0, 300.0),
child:
// Adobe XD layer: 'key icon' (group)
SizedBox(
width: 19.0,
height: 19.0,
child: Stack(
children: <Widget>[
Pinned.fromSize(
bounds: Rect.fromLTWH(0.0, 0.0, 19.3, 19.0),
size: Size(19.3, 19.0),
pinLeft: true,
pinRight: true,
pinTop: true,
pinBottom: true,
child: SvgPicture.string(
_svg_w0vg0g,
allowDrawingOutsideViewBox: true,
fit: BoxFit.fill,
),
),
],
),
),
),
Transform.translate(
offset: Offset(37.5, 265.5),
child: SvgPicture.string(
_svg_satdzr,
allowDrawingOutsideViewBox: true,
),
),
Transform.translate(
offset: Offset(114.0, 451.0),
child: PageLink(
links: [
PageLinkInfo(
transition: LinkTransition.Fade,
ease: Curves.easeOut,
duration: 0.3,
pageBuilder: () => XD_EnterAuthcode(),
),
],
child: Container(
width: 147.0,
height: 43.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.0),
color: const Color(0xff459cf4),
),
),
),
),
Transform.translate(
offset: Offset(172.0, 465.0),
child: Text(
'登録',
style: TextStyle(
fontFamily: 'Helvetica Neue',
fontSize: 16,
color: const Color(0xffffffff),
height: 1.3125,
),
textAlign: TextAlign.left,
),
),
Transform.translate(
offset: Offset(47.0, 371.0),
child: Container(
width: 13.0,
height: 13.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3.0),
color: const Color(0xffffffff),
border: Border.all(width: 1.0, color: const Color(0xff707070)),
),
),
),
Transform.translate(
offset: Offset(82.0, 370.0),
child: Text.rich(
TextSpan(
style: TextStyle(
fontFamily: 'Helvetica Neue',
fontSize: 16,
color: const Color(0xff0046b5),
),
children: [
TextSpan(
text: '利用規約',
),
TextSpan(
text: 'に同意します',
style: TextStyle(
color: const Color(0xff000000),
),
),
],
),
textAlign: TextAlign.left,
),
),
Transform.translate(
offset: Offset(82.0, 180.0),
child: Text(
'Name',
style: TextStyle(
fontFamily: 'Helvetica Neue',
fontSize: 16,
color: const Color(0xff000000),
),
textAlign: TextAlign.left,
),
),
Transform.translate(
offset: Offset(37.5, 204.5),
child: SvgPicture.string(
_svg_rf605q,
allowDrawingOutsideViewBox: true,
),
),
Transform.translate(
offset: Offset(46.0, 178.8),
child:
// Adobe XD layer: 'People icon' (group)
SizedBox(
width: 13.0,
height: 19.0,
child: Stack(
children: <Widget>[
Pinned.fromSize(
bounds: Rect.fromLTWH(1.4, 0.0, 9.8, 9.9),
size: Size(12.7, 19.0),
pinLeft: true,
pinRight: true,
pinTop: true,
fixedHeight: true,
child: SvgPicture.string(
_svg_i3uaso,
allowDrawingOutsideViewBox: true,
fit: BoxFit.fill,
),
),
Pinned.fromSize(
bounds: Rect.fromLTWH(0.0, 10.4, 12.7, 8.6),
size: Size(12.7, 19.0),
pinLeft: true,
pinRight: true,
pinBottom: true,
fixedHeight: true,
child: SvgPicture.string(
_svg_4flkg0,
allowDrawingOutsideViewBox: true,
fit: BoxFit.fill,
),
),
],
),
),
),
],
),
);
}
}
const String _svg_w2s7fu =
'<svg viewBox="22.0 68.8 3.3 6.2" ><path transform="translate(-423.91, -100.85)" d="M 449.181396484375 175.7990112304688 L 445.9199829101562 172.4112548828125 L 449.181396484375 169.6000061035156 L 449.181396484375 175.7990112304688 Z" fill="#4b4b4b" stroke="none" stroke-width="1" stroke-miterlimit="4" stroke-linecap="butt" /></svg>';
const String _svg_ca7ikg =
'<svg viewBox="0.0 68.8 3.3 6.2" ><path transform="translate(0.0, -100.85)" d="M 3.265364646911621 172.4112548828125 L 0 175.8029479980469 L 0 169.6000061035156 L 3.265364646911621 172.4112548828125 Z" fill="#4b4b4b" stroke="none" stroke-width="1" stroke-miterlimit="4" stroke-linecap="butt" /></svg>';
const String _svg_jv16te =
'<svg viewBox="0.0 73.0 25.3 9.6" ><path transform="translate(0.0, -181.92)" d="M 25.27005195617676 259.9488525390625 L 25.27005195617676 263.068115234375 C 25.27005195617676 263.822265625 24.65804290771484 264.434326171875 23.90388870239258 264.434326171875 L 1.366162419319153 264.434326171875 C 0.6119597554206848 264.434326171875 0 263.8223266601562 0 263.068115234375 L 0 259.9488525390625 L 4.884177684783936 254.8789978027344 L 10.46338081359863 259.6842041015625 C 11.04380226135254 260.1818237304688 11.81369972229004 260.4581909179688 12.63502597808838 260.4581909179688 C 13.45635223388672 260.4581909179688 14.23019886016846 260.1818237304688 14.81062030792236 259.6842041015625 L 20.38577651977539 254.8789978027344 L 25.27005195617676 259.9488525390625 Z" fill="#4b4b4b" stroke="none" stroke-width="1" stroke-miterlimit="4" stroke-linecap="butt" /></svg>';
const String _svg_951p1o =
'<svg viewBox="0.0 63.5 25.3 13.2" ><path d="M 25.27005195617676 64.88121795654297 L 25.27005195617676 66.24737548828125 L 13.35354423522949 76.51334381103516 C 12.97054386138916 76.84500885009766 12.29935836791992 76.84500885009766 11.91635894775391 76.51334381103516 L 0 66.24737548828125 L 0 64.88121795654297 C 0 64.12711334228516 0.6119104027748108 63.51900482177734 1.366162419319153 63.51900482177734 L 23.90388870239258 63.51900482177734 C 24.65804290771484 63.51900482177734 25.27005195617676 64.12711334228516 25.27005195617676 64.88121795654297 Z" fill="#4b4b4b" stroke="none" stroke-width="1" stroke-miterlimit="4" stroke-linecap="butt" /></svg>';
const String _svg_w0vg0g =
'<svg viewBox="0.0 3.6 19.3 19.0" ><path transform="translate(0.0, 0.0)" d="M 18.97674369812012 11.00501251220703 L 11.91527843475342 3.943580627441406 C 11.49824333190918 3.526545524597168 10.79122638702393 3.550638675689697 10.34475326538086 3.997111797332764 L 7.096076011657715 7.245789527893066 C 6.649641036987305 7.692224979400635 6.354350090026855 8.546924591064453 6.440822124481201 9.144543647766113 L 7.089600086212158 13.64902973175049 L 4.355609893798828 16.38301849365234 C 4.24384069442749 16.49478912353516 4.023276805877686 16.5930061340332 3.865618467330933 16.60185241699219 L 3.000943422317505 16.65301322937012 C 2.843284845352173 16.66242027282715 2.715666770935059 16.79949188232422 2.717436790466309 16.95710945129395 L 2.727450132369995 17.72003173828125 C 2.729822397232056 17.87768936157227 2.602166414260864 18.0100154876709 2.44394326210022 18.0141544342041 L 1.631030440330505 18.03414535522461 C 1.472807049751282 18.03768157958984 1.356332421302795 18.16944122314453 1.371052026748657 18.32649612426758 L 1.434597373008728 18.98999786376953 C 1.449880957603455 19.14765357971191 1.333406567573547 19.28761863708496 1.176388144493103 19.30173683166504 L 0.2593860626220703 19.38467025756836 C 0.1017274782061577 19.39938926696777 -0.0141447652131319 19.53935050964355 0.001741554704494774 19.69701194763184 L 0.266425758600235 22.39102363586426 C 0.281709760427475 22.54808235168457 0.4228795766830444 22.66218376159668 0.5799358487129211 22.64396286010742 L 2.649260759353638 22.4051399230957 C 2.805714845657349 22.38748741149902 3.025714159011841 22.28102493286133 3.136881113052368 22.16925811767578 L 9.449548721313477 15.8571891784668 L 13.77582168579102 16.4801082611084 C 14.37344169616699 16.56597518920898 15.22810363769531 16.27068901062012 15.67457389831543 15.82425022125244 L 18.92325019836426 12.57557201385498 C 19.36964988708496 12.12906360626221 19.39438247680664 11.42204761505127 18.97674369812012 11.00501251220703 Z M 15.14159297943115 11.94143867492676 L 14.17753601074219 12.90549564361572 C 13.95343399047852 13.130202293396 13.58872509002686 13.12960052490234 13.36522483825684 12.90549564361572 L 10.01479244232178 9.555667877197266 C 9.790690422058105 9.331564903259277 9.790690422058105 8.967459678649902 10.01479244232178 8.743356704711914 L 10.97945308685303 7.778695583343506 C 11.20355701446533 7.553991794586182 11.56766033172607 7.555158615112305 11.79176330566406 7.778695583343506 L 15.14159297943115 11.12912845611572 C 15.36573219299316 11.35323238372803 15.36629581451416 11.7173376083374 15.14159297943115 11.94143867492676 Z" fill="#4b4b4b" stroke="none" stroke-width="1" stroke-miterlimit="4" stroke-linecap="butt" /></svg>';
const String _svg_satdzr =
'<svg viewBox="37.5 265.5 300.0 60.0" ><path transform="translate(37.5, 265.5)" d="M 0 0 L 300 0" fill="none" stroke="#707070" stroke-width="1" stroke-miterlimit="4" stroke-linecap="butt" /><path transform="translate(37.5, 325.5)" d="M 0 0 L 300 0" fill="none" stroke="#707070" stroke-width="1" stroke-miterlimit="4" stroke-linecap="butt" /></svg>';
const String _svg_i3uaso =
'<svg viewBox="86.1 0.0 9.8 9.9" ><path transform="translate(-37.3, 0.0)" d="M 128.2772979736328 9.859047889709473 C 130.9945220947266 9.859047889709473 133.1976318359375 7.652032852172852 133.1976318359375 4.929523944854736 C 133.1976318359375 2.207794904708862 130.9945220947266 0 128.2772979736328 0 C 125.559700012207 0 123.3569946289062 2.207794904708862 123.3569946289062 4.929523944854736 C 123.3569946289062 7.652032375335693 125.559700012207 9.859047889709473 128.2772979736328 9.859047889709473 Z" fill="#4b4b4b" stroke="none" stroke-width="1" stroke-miterlimit="4" stroke-linecap="butt" /></svg>';
const String _svg_4flkg0 =
'<svg viewBox="84.6 10.4 12.7 8.6" ><path transform="translate(0.0, -271.31)" d="M 97.2806396484375 285.8938598632812 C 97.06088256835938 284.5756225585938 95.9447021484375 282.7534484863281 95.14492034912109 281.9003601074219 C 94.92861938476562 281.6695251464844 94.55310821533203 281.7655639648438 94.42115020751953 281.8473510742188 C 93.41771697998047 282.4668884277344 92.23978424072266 282.828369140625 90.97669982910156 282.828369140625 C 89.71364593505859 282.828369140625 88.53572082519531 282.4668884277344 87.53228759765625 281.8473510742188 C 87.40036010742188 281.7655639648438 87.02481842041016 281.6695251464844 86.8084716796875 281.9003601074219 C 86.00875854492188 282.7534484863281 84.89258575439453 284.5756225585938 84.67279052734375 285.8938598632812 C 84.13277435302734 289.1394653320312 87.59522247314453 290.3121337890625 90.97673797607422 290.3121337890625 C 94.35824584960938 290.3121337890625 97.82069396972656 289.1394653320312 97.2806396484375 285.8938598632812 Z" fill="#4b4b4b" stroke="none" stroke-width="1" stroke-miterlimit="4" stroke-linecap="butt" /></svg>';
const String _svg_rf605q =
'<svg viewBox="37.5 204.5 300.0 1.0" ><path transform="translate(37.5, 204.5)" d="M 0 0 L 300 0" fill="none" stroke="#707070" stroke-width="1" stroke-miterlimit="4" stroke-linecap="butt" /></svg>';
| 53.987302 | 2,703 | 0.574738 |
11f0e204180c45512477c7098575fa0cb1b364c0 | 7,099 | cc | C++ | src/leveldb/helpers/memenv/memenv_test.cc | booog35/GiveCoin | 644c086e62c3835847c821d5b1f100cffe6105b0 | [
"MIT"
] | null | null | null | src/leveldb/helpers/memenv/memenv_test.cc | booog35/GiveCoin | 644c086e62c3835847c821d5b1f100cffe6105b0 | [
"MIT"
] | null | null | null | src/leveldb/helpers/memenv/memenv_test.cc | booog35/GiveCoin | 644c086e62c3835847c821d5b1f100cffe6105b0 | [
"MIT"
] | null | null | null | // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#include "helpers/memenv/memenv.h"
#include "db/db_impl.h"
#include "leveldb/db.h"
#include "leveldb/env.h"
#include "util/testharness.h"
#include <string>
#include <vector>
namespace leveldb {
class MemEnvTest {
public:
Env *env_;
MemEnvTest()
: env_(NewMemEnv(Env::Default())) {
}
~MemEnvTest() {
delete env_;
}
};
TEST(MemEnvTest, Basics
) {
uint64_t file_size;
WritableFile *writable_file;
std::vector <std::string> children;
ASSERT_OK(env_
->CreateDir("/dir"));
// Check that the directory is empty.
ASSERT_TRUE(!env_->FileExists("/dir/non_existent"));
ASSERT_TRUE(!env_->GetFileSize("/dir/non_existent", &file_size).
ok()
);
ASSERT_OK(env_
->GetChildren("/dir", &children));
ASSERT_EQ(0, children.
size()
);
// Create a file.
ASSERT_OK(env_
->NewWritableFile("/dir/f", &writable_file));
delete
writable_file;
// Check that the file exists.
ASSERT_TRUE(env_
->FileExists("/dir/f"));
ASSERT_OK(env_
->GetFileSize("/dir/f", &file_size));
ASSERT_EQ(0, file_size);
ASSERT_OK(env_
->GetChildren("/dir", &children));
ASSERT_EQ(1, children.
size()
);
ASSERT_EQ("f", children[0]);
// Write to the file.
ASSERT_OK(env_
->NewWritableFile("/dir/f", &writable_file));
ASSERT_OK(writable_file
->Append("abc"));
delete
writable_file;
// Check for expected size.
ASSERT_OK(env_
->GetFileSize("/dir/f", &file_size));
ASSERT_EQ(3, file_size);
// Check that renaming works.
ASSERT_TRUE(!env_->RenameFile("/dir/non_existent", "/dir/g").
ok()
);
ASSERT_OK(env_
->RenameFile("/dir/f", "/dir/g"));
ASSERT_TRUE(!env_->FileExists("/dir/f"));
ASSERT_TRUE(env_
->FileExists("/dir/g"));
ASSERT_OK(env_
->GetFileSize("/dir/g", &file_size));
ASSERT_EQ(3, file_size);
// Check that opening non-existent file fails.
SequentialFile *seq_file;
RandomAccessFile *rand_file;
ASSERT_TRUE(!env_->NewSequentialFile("/dir/non_existent", &seq_file).
ok()
);
ASSERT_TRUE(!seq_file);
ASSERT_TRUE(!env_->NewRandomAccessFile("/dir/non_existent", &rand_file).
ok()
);
ASSERT_TRUE(!rand_file);
// Check that deleting works.
ASSERT_TRUE(!env_->DeleteFile("/dir/non_existent").
ok()
);
ASSERT_OK(env_
->DeleteFile("/dir/g"));
ASSERT_TRUE(!env_->FileExists("/dir/g"));
ASSERT_OK(env_
->GetChildren("/dir", &children));
ASSERT_EQ(0, children.
size()
);
ASSERT_OK(env_
->DeleteDir("/dir"));
}
TEST(MemEnvTest, ReadWrite
) {
WritableFile *writable_file;
SequentialFile *seq_file;
RandomAccessFile *rand_file;
Slice result;
char scratch[100];
ASSERT_OK(env_
->CreateDir("/dir"));
ASSERT_OK(env_
->NewWritableFile("/dir/f", &writable_file));
ASSERT_OK(writable_file
->Append("hello "));
ASSERT_OK(writable_file
->Append("world"));
delete
writable_file;
// Read sequentially.
ASSERT_OK(env_
->NewSequentialFile("/dir/f", &seq_file));
ASSERT_OK(seq_file
->Read(5, &result, scratch)); // Read "hello".
ASSERT_EQ(0, result.compare("hello"));
ASSERT_OK(seq_file
->Skip(1));
ASSERT_OK(seq_file
->Read(1000, &result, scratch)); // Read "world".
ASSERT_EQ(0, result.compare("world"));
ASSERT_OK(seq_file
->Read(1000, &result, scratch)); // Try reading past EOF.
ASSERT_EQ(0, result.
size()
);
ASSERT_OK(seq_file
->Skip(100)); // Try to skip past end of file.
ASSERT_OK(seq_file
->Read(1000, &result, scratch));
ASSERT_EQ(0, result.
size()
);
delete
seq_file;
// Random reads.
ASSERT_OK(env_
->NewRandomAccessFile("/dir/f", &rand_file));
ASSERT_OK(rand_file
->Read(6, 5, &result, scratch)); // Read "world".
ASSERT_EQ(0, result.compare("world"));
ASSERT_OK(rand_file
->Read(0, 5, &result, scratch)); // Read "hello".
ASSERT_EQ(0, result.compare("hello"));
ASSERT_OK(rand_file
->Read(10, 100, &result, scratch)); // Read "d".
ASSERT_EQ(0, result.compare("d"));
// Too high offset.
ASSERT_TRUE(!rand_file->Read(1000, 5, &result, scratch).
ok()
);
delete
rand_file;
}
TEST(MemEnvTest, Locks
) {
FileLock *lock;
// These are no-ops, but we test they return success.
ASSERT_OK(env_
->LockFile("some file", &lock));
ASSERT_OK(env_
->
UnlockFile(lock)
);
}
TEST(MemEnvTest, Misc
) {
std::string test_dir;
ASSERT_OK(env_
->
GetTestDirectory(&test_dir)
);
ASSERT_TRUE(!test_dir.
empty()
);
WritableFile *writable_file;
ASSERT_OK(env_
->NewWritableFile("/a/b", &writable_file));
// These are no-ops, but we test they return success.
ASSERT_OK(writable_file
->
Sync()
);
ASSERT_OK(writable_file
->
Flush()
);
ASSERT_OK(writable_file
->
Close()
);
delete
writable_file;
}
TEST(MemEnvTest, LargeWrite
) {
const size_t kWriteSize = 300 * 1024;
char *scratch = new char[kWriteSize * 2];
std::string write_data;
for (
size_t i = 0;
i<kWriteSize;
++i) {
write_data.append(1, static_cast
<char>(i)
);
}
WritableFile *writable_file;
ASSERT_OK(env_
->NewWritableFile("/dir/f", &writable_file));
ASSERT_OK(writable_file
->Append("foo"));
ASSERT_OK(writable_file
->
Append(write_data)
);
delete
writable_file;
SequentialFile *seq_file;
Slice result;
ASSERT_OK(env_
->NewSequentialFile("/dir/f", &seq_file));
ASSERT_OK(seq_file
->Read(3, &result, scratch)); // Read "foo".
ASSERT_EQ(0, result.compare("foo"));
size_t read = 0;
std::string read_data;
while (read<kWriteSize) {
ASSERT_OK(seq_file
->
Read(kWriteSize
- read, &result, scratch));
read_data.
append(result
.
data(), result
.
size()
);
read += result.
size();
}
ASSERT_TRUE(write_data
== read_data);
delete
seq_file;
delete []
scratch;
}
TEST(MemEnvTest, DBTest
) {
Options options;
options.
create_if_missing = true;
options.
env = env_;
DB *db;
const Slice keys[] = {Slice("aaa"), Slice("bbb"), Slice("ccc")};
const Slice vals[] = {Slice("foo"), Slice("bar"), Slice("baz")};
ASSERT_OK(DB::Open(options, "/dir/db", &db));
for (
size_t i = 0;
i < 3; ++i) {
ASSERT_OK(db
->
Put(WriteOptions(), keys[i], vals[i]
));
}
for (
size_t i = 0;
i < 3; ++i) {
std::string res;
ASSERT_OK(db
->
Get(ReadOptions(), keys[i], &res
));
ASSERT_TRUE(res
== vals[i]);
}
Iterator *iterator = db->NewIterator(ReadOptions());
iterator->
SeekToFirst();
for (
size_t i = 0;
i < 3; ++i) {
ASSERT_TRUE(iterator
->
Valid()
);
ASSERT_TRUE(keys[i]
== iterator->
key()
);
ASSERT_TRUE(vals[i]
== iterator->
value()
);
iterator->
Next();
}
ASSERT_TRUE(!iterator->
Valid()
);
delete
iterator;
DBImpl *dbi = reinterpret_cast<DBImpl *>(db);
ASSERT_OK(dbi
->
TEST_CompactMemTable()
);
for (
size_t i = 0;
i < 3; ++i) {
std::string res;
ASSERT_OK(db
->
Get(ReadOptions(), keys[i], &res
));
ASSERT_TRUE(res
== vals[i]);
}
delete
db;
}
} // namespace leveldb
int main(int argc, char **argv) {
return leveldb::test::RunAllTests();
}
| 16.207763 | 77 | 0.653613 |
dd4ae2282719da30be3395461c9d5cc62e12abb0 | 4,041 | asm | Assembly | eurasia/services4/srvinit/devices/sgx/vdmcontextstore_use.asm | shaqfu786/GFX_Linux_DDK | f184ac914561fa100a5c92a488df777de8785f93 | [
"FSFAP"
] | 3 | 2020-03-13T23:37:00.000Z | 2021-09-03T06:34:04.000Z | eurasia/services4/srvinit/devices/sgx/vdmcontextstore_use.asm | zzpianoman/GFX_Linux_DDK | f184ac914561fa100a5c92a488df777de8785f93 | [
"FSFAP"
] | null | null | null | eurasia/services4/srvinit/devices/sgx/vdmcontextstore_use.asm | zzpianoman/GFX_Linux_DDK | f184ac914561fa100a5c92a488df777de8785f93 | [
"FSFAP"
] | 6 | 2015-02-05T03:01:01.000Z | 2021-07-24T01:07:18.000Z | /*****************************************************************************
Name : vdmcontextstore_use.asm
Title : USE programs for TQ
Author : PowerVR
Created : 03/19/2008
Copyright : 2008 by Imagination Technologies Limited. All rights reserved.
No part of this software, either material or conceptual
may be copied or distributed, transmitted, transcribed,
stored in a retrieval system or translated into any
human or computer language in any form by any means,
electronic, mechanical, manual or other-wise, or
disclosed to third parties without the express written
permission of Imagination Technologies Limited, HomePark
Industrial Estate, King's Langley, Hertfordshire,
WD4 8LZ, U.K.
Description : USE programs for different TQ shaders blits etc.
Program Type : USE assembly language
Version : $Revision: 1.14 $
Modifications :
$Log: vdmcontextstore_use.asm $
*****************************************************************************/
#include "usedefs.h"
.skipinvon;
#if defined(SGX_FEATURE_USE_UNLIMITED_PHASES)
/* No following phase. */
phas #0, #0, pixel, end, parallel;
#endif
#if defined(FIX_HW_BRN_33657) && defined(SUPPORT_SECURE_33657_FIX)
/* Is this a VDM state complete on terminate pass? */
TerminateFlagsBaseAddr:
mov r0, #0xDEADBEEF;
MK_MEM_ACCESS_BPCACHE(ldad.f2) r1, [r0, #0++], drc0;
wdf drc0;
and.testz p0, r1, #VDM_TERMINATE_COMPLETE_ONLY;
p0 br NoTerminate;
{
/* Set the MTE state update control (normal TA terminate, set bbox) */
mov o0, #EURASIA_TACTLPRES_TERMINATE;
mov o1, r2; /* ui32StateTARNDClip */
br StateEmit;
}
NoTerminate:
#endif/* FIX_HW_BRN_33657 && SUPPORT_SECURE_33657_FIX */
#if defined(SGX_FEATURE_USE_SA_COUNT_REGISTER)
/* TODO: Make use of the PBE to write the SAs to memory */
smlsi #0, #0, #0,#1,#0,#0,#0,#0,#0,#0,#0;
{
/* The immediate below will be replaced with the address at runtime */
SABufferBaseAddr:
mov r0, #0xDEADBEEF;
#if 0 // defined(SGX_FEATURE_MP) && !SGX_SUPPORT_MASTER_ONLY_SWITCHING
/* Load the DevVAddr and Stride directly from the TA3D in memory */
MK_MEM_ACCESS_BPCACHE(ldad.f2) r0, [r0, #0++], drc0;
mov r2, g45;
wdf drc0;
/* offset the base address by the core index */
imae r0, r1.low, r2.low, r0, u32;
#else
/* Load the DevVAddr directly from the TA3D in memory */
MK_MEM_ACCESS_BPCACHE(ldad) r0, [r0], drc0;
wdf drc0;
#endif
mov r1, g41;
mov r2, #0;
mov i.l, r2;
wdf drc0;
/* double the value as it reports number of 64bit register and we need 32bits */
shl r1, r1, #1;
/* The first value is the number of SA's stored */
MK_MEM_ACCESS_CACHED(stad) [r0, #1++], r1;
and.testz p0, g41, g41;
p0 br NoSASave;
{
/* There are secondary attributes allocated so save them off */
SaveNextBatch:
{
MK_MEM_ACCESS_CACHED(stad.f16) [r0, #0++], sa[i.l];
isub16.testnz r1, p0, r1, #1;
p0 iaddu32 r2, r2.low, #16;
p0 mov i.l, r2;
p0 br SaveNextBatch;
}
}
NoSASave:
/* Wait for all the memory accesses to flush */
idf drc0, st;
wdf drc0;
}
#endif /* SGX_FEATURE_USE_SA_COUNT_REGISTER */
#if defined(FIX_HW_BRN_33657)
#if !defined(SUPPORT_SECURE_33657_FIX)
/* Clear complete on terminate on this core */
mov r2, g45;
READCORECONFIG(r1, r2, #EUR_CR_TE_PSG >> 2, drc0);
wdf drc0;
and r1, r1, ~#(EUR_CR_TE_PSG_COMPLETEONTERMINATE_MASK | EUR_CR_TE_PSG_ZONLYRENDER_MASK);
WRITECORECONFIG(r2, #EUR_CR_TE_PSG >> 2, r1, r3);
idf drc0, st;
wdf drc0;
#endif /* SUPPORT_SECURE_33657_FIX */
/* Set the MTE state update control (ctx store terminate, bbox not applicable) */
mov o0, #EURASIA_TACTLPRES_TERMINATE;
#else
/* Set the MTE state update control */
mov o0, #(EURASIA_TACTLPRES_TERMINATE|EURASIA_TACTLPRES_CONTEXTSWITCH);
#endif
mov o1, #0;
StateEmit:
#if !defined(SGX545)
emitst.freep.end #0, #(EURASIA_TACTL_ALL_SIZEINDWORDS+1);
#else /* !defined(SGX545) */
emitvcbst #0, #0;
wop #0;
emitmtest.freep.end #0, #0, #0;
#endif /* !defined(SGX545) */
| 29.713235 | 89 | 0.671863 |
49accc847cb2d5ead1fd0d091f1519dfd765bf5f | 1,658 | html | HTML | apiratesduel.html | Topleftstyll/Portfolio | 61f3faf85f17afe7c1f345a5ce5286b23aea85b4 | [
"MIT"
] | null | null | null | apiratesduel.html | Topleftstyll/Portfolio | 61f3faf85f17afe7c1f345a5ce5286b23aea85b4 | [
"MIT"
] | null | null | null | apiratesduel.html | Topleftstyll/Portfolio | 61f3faf85f17afe7c1f345a5ce5286b23aea85b4 | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Josh Brackett - A Pirates Duel</title>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/skeleton.css">
<link rel="stylesheet" href="css/stylesheet.css">
<link rel="stylesheet" href="css/reset.css">
</head>
<body id="subpagebody">
<div id="lostboxmaindiv" class="container">
<div class="docs-section" id="intro">
<section class="header">
<nav>
<a class="homelink" href="index.html">Home</a>
</nav>
<h2 class="title">A Pirates Duel</h2>
<p class="gameparagraph">
A Pirates Duel is a game made by me and 3 other classmates in 32 hours + some polish time. I basically was core and fixed everyones issues and did all the networking besides making the lobby.
You left click to swing your sword and hold right click to block. First person to die loses (obviously).
</p>
<p class="gameparagraph">
A Pirates Duel was made in Unity for the PTBO Game Jam 04. My friends OBS wasn't recording his sound so the video has no sound.
</p>
<a id="gamelink" href="https://github.com/Devoture/PirateVPirate" target="_blank">Github Link</a>
<br/>
<a id="gamelink" href="https://itch.io/jam/ptbogamejam04/rate/230502" target="_blank">Download Link + Where I submited the game</a>
<iframe id="video" width="854" height="480" src="https://www.youtube.com/embed/pJPw1VAkV2c" frameborder="0" gesture="media" allow="encrypted-media" allowfullscreen></iframe>
</section>
</div>
</div>
<body>
</html> | 37.681818 | 197 | 0.675513 |
75266ce1b45a281e62ab9a865bd5b496e6d09c6e | 369 | cs | C# | Bronze/src/Graphics/Shader/SingularShader.cs | NathanielGlover/Bronze | 4bcbc673ad02ae0022e639b0db8b3fec59866c95 | [
"MIT"
] | 4 | 2017-08-11T23:29:43.000Z | 2019-03-16T16:28:14.000Z | Bronze/src/Graphics/Shader/SingularShader.cs | NathanielGlover/Bronze | 4bcbc673ad02ae0022e639b0db8b3fec59866c95 | [
"MIT"
] | null | null | null | Bronze/src/Graphics/Shader/SingularShader.cs | NathanielGlover/Bronze | 4bcbc673ad02ae0022e639b0db8b3fec59866c95 | [
"MIT"
] | null | null | null | namespace Bronze.Graphics
{
public class SingularShader : Shader
{
internal SingularShader(uint handle) : base(handle) { }
internal static SingularShader FromShader(Shader shader) => new SingularShader(shader.Handle);
public SingularShader(ShaderStage stage) : base(new ShaderBuilder().AddStage(stage).BuildShader().Handle) { }
}
} | 33.545455 | 117 | 0.707317 |
90f07a6e082f20bf1139d29711989e2475aa9318 | 38,545 | asm | Assembly | src/tictactoe.asm | timont02/cesp_timon | 7af1eb44ca493ece68f4e6b4a4b7bb144fd6b5e7 | [
"MIT"
] | null | null | null | src/tictactoe.asm | timont02/cesp_timon | 7af1eb44ca493ece68f4e6b4a4b7bb144fd6b5e7 | [
"MIT"
] | null | null | null | src/tictactoe.asm | timont02/cesp_timon | 7af1eb44ca493ece68f4e6b4a4b7bb144fd6b5e7 | [
"MIT"
] | null | null | null | #storage locations:
# -500 = ra
# -400 = current player
# -132 - -100 = field taken or not and from wich player: #-100 = field 1; -104 = field 2; etc. ...
# -20 = a0 = number of the field (from input)
# -204 = ra for draw gamefield return
# -208 = wins of Player 1 in current session
# -212 = wins of Player 2 in current session
# -216 = current winstreak
# -220 = player of the winstreak
# -224 = number of used fields
# -228 = ra for draw_cross
# -232 = ra in bot function
# -236 = bot or human
# -240 = test field counter of the bot function
# -244 = who is the real player human (1), bot(2), or testbot(3)
# -248 = current rule counter
# -252 - 372 = storage for registers
#all used text strings
.data
player1_text: .string "Player1 must select a field. "
player2_text: .string "Player2 must select a field. "
bot_or_human_text: .string "Welcome! Do you want to play against a bot or a human? Press 1 for a bot and 2 for a human."
error_message_1: .string "Field is already taken. Please enter e new number. "
error_message_2: .string "Your number was not between 1 and 9. Please enter a new number. "
error_message_3: .string "Your number was not between 1 and 4. Please enter a new number. "
error_message_4: .string "Wrong number, please try agein."
game_over_1: .string "Player 1 is the winner! Game over! "
game_over_2: .string "Player 2 is the winner! Game over! "
game_over_3: .string " New game: 1, End game: 2, Current score: 3, highest winstreak: 4 "
game_over_4: .string "All fields used. Game over. "
new_game_text: .string "You started a new game! "
score_1: .string " Player 1: "
score_2: .string " Player 2: "
score_3: .string "Score: "
winstreak_1: .string "Current winstreak: Player 1: "
winstreak_2: .string "Current winstreak: Player 2: "
.text
.eqv DISPLAY_ADDRESS 0x10010000
.eqv DISPLAY_WIDTH 512
.eqv DISPLAY_HEIGHT 512
#function for the settings before the start of the first game (draw gamefield etc.)
start_game:
sw ra, -500(sp) #store the return address
jal bot_or_human
jal ra, draw_gamefield
li a5, -1
sw a5, -224(sp)
j game
#function to start a game
game:
li t6, 1
sw t6, -400(sp) #save the first player as the current player
jal win_query
#Step 1: win query
win_query:
#Step 1.1 load all field information in registers
lw t1, -100(sp)
lw t2, -104(sp)
lw t3, -108(sp)
lw t4, -112(sp)
lw t5, -116(sp)
lw t6, -120(sp)
lw a1, -124(sp)
lw a2, -128(sp)
lw a3, -132(sp)
#Step 1.2 the win query
#Step 1.2.1 check all rows
row1:
beq t1, t2, step1_2 #are the users on field 1 and 2 equal?
j row2 #if not, check the next row
step1_2:
beq t2, t3, step1_3 #are the users on field 2 and 3 equal?
j row2 #if not, check the next row
step1_3:
li a4, 2
beq a4, t3, bot_or_not_2 #is the user on both fields player 2?
li a4, 1
beq a4, t3, bot_or_not_1 #is the user on both fields player 1?
j row2 #if not, check the next row
row2:
beq t4, t5, step2_2 #are the users on field 4 and 5 equal?
j row3 #if not, check the next row
step2_2:
beq t5, t6, step2_3 #are the users on field 5 and 6 equal?
j row3 #if not, check the next row
step2_3:
li a4, 2
beq a4, t6, bot_or_not_2 #is the user on both fields player 2?
li a4, 1
beq a4, t6, bot_or_not_1 #is the user on both fields player 1?
j row3 #if not, check the next row
row3:
beq a1, a2, step3_2 #are the users on field 7 and 8 equal?
j collumn1 #if not, check the the collumns
step3_2:
beq a2, a3, step3_3 #are the users on field 8 and 9 equal?
j collumn1 #if not, check the the collumns
step3_3:
li a4, 2
beq a4, a3, bot_or_not_2 #is the user on both fields player 2?
li a4, 1
beq a4, a3, bot_or_not_1 #is the user on both fields player 1?
j collumn1 #if not, check the the collumns
#Step 1.2.2 check all collumns
collumn1:
beq t1, t4, step4_2 #are the users on field 1 and 4 equal?
j collumn2 #if not, check the next collumn
step4_2:
beq t4, a1, step4_3 #are the users on field 4 and 7 equal?
j collumn2#if not, check the next collumn
step4_3:
li a4, 2
beq a4, a1, bot_or_not_2 #is the user on both fields player 2?
li a4, 1
beq a4, a1, bot_or_not_1 #is the user on both fields player 1?
j collumn2 #if not, check the next collumn
collumn2:
beq t2, t5, step5_2 #are the users on field 2 and 5 equal?
j collumn3 #if not, check the next collumn
step5_2:
beq t5, a2, step5_3 #are the users on field 5 and 8 equal?
j collumn3 #if not, check the next collumn
step5_3:
li a4, 2
beq a4, a2, bot_or_not_2 #is the user on both fields player 2?
li a4, 1
beq a4, a2, bot_or_not_1 #is the user on both fields player 1?
j collumn3 #if not, check the next collumn
collumn3:
beq t3, t6, step6_2 #are the users on field 3 and 6 equal?
j diagonal1 #if not, check the diagonals
step6_2:
beq t6, a3, step6_3 #are the users on field 6 and 9 equal?
j diagonal1 #if not, check the diagonals
step6_3:
li a4, 2
beq a4, a3, bot_or_not_2 #is the user on both fields player 2?
li a4, 1
beq a4, a3, bot_or_not_1 #is the user on both fields player 1?
j diagonal1 #if not, check the diagonals
#Step 1.2.3 check the two diagonals
diagonal1:
beq t1, t5, step7_2 #are the users on field 1 and 5 equal?
j diagonal2 #if not, check the next diagonal
step7_2:
beq t5, a3, step7_3 #are the users on field 5 and 9 equal?
j diagonal2 #if not, check the next diagonal
step7_3:
li a4, 2
beq a4, a3, bot_or_not_2 #is the user on both fields player 2?
li a4, 1
beq a4, a3, bot_or_not_1 #is the user on both fields player 1?
j diagonal2 #if not, check the next diagonal
diagonal2:
beq t3, t5, step8_2 #are the users on field 3 and 5 equal?
lw a0, -244(sp)
li a1, 3
beq a0, a1, bot #is the current player a bot with a test field?
j termination_condition
step8_2:
beq t5, a1, step8_3 #are the users on field 5 and 7 equal?
lw a0, -244(sp)
li a1, 3
beq a0, a1, bot #is the current player a bot with a test field?
j termination_condition
step8_3:
li a4, 2
beq a4, a1, bot_or_not_2 #is the user on both fields player 2?
li a4, 1
beq a4, a1, bot_or_not_1 #is the user on both fields player 1?
lw a0, -244(sp)
li a1, 3
beq a0, a1, bot #is the current player a bot with a test field? (this branch is only used if there is no possible win option for the bot or player 1)
j termination_condition
#Step 1.3: check, if the current player is a bot or a human for player 1
#is the current player a bot (testfield) or a human
bot_or_not_1:
lw a0, -244(sp)
li a1, 3
beq a0, a1, block_enemy # the current player is the bot with a test field, now the bot knows that the player can win and he has to block him
li a1, 1
beq a0, a1, player_1_winner # the current player is the human and he will win
#is the current player a bot (testfield) or a human for player 2
bot_or_not_2:
lw a0, -244(sp)
li a1, 3
beq a0, a1, win_the_game # the current player is the bot with a test field, now the bot knows that the player can win and he has to block him
li a1, 0
beq a0, a1, player_2_winner # the current player is the human and he will win
li a1, 2
beq a0, a1, player_2_winner # the current player is the human and he will win
#Step 1.4: check, if all fields are used
termination_condition:
lw t5, -224(sp)
addi t5, t5, 1
sw t5, -224(sp)
li t6, 9
beq, t5, t6, end_game_2 #if all field are used (9 fields), the game must restart
li t5, 0
li t6, 0
j player_select #if not, the programm can jump to the next step
#winner functions
#player 1 is the winner
player_1_winner:
lw a0, -208(sp)
addi a0, a0, 1 #add 1 win
sw a0, -208(sp) #load the win to the score on storage
lw a0, -220(sp) #load the player of the winstreak
li a1, 1
beq a0, a1, player_1_winstreak
bne a0, a1, player_1_new_winstreak
#if the player has already a winstreak, the winstreak counter mus get increased by one
player_1_winstreak:
lw a2, -216(sp)
addi a2, a2, 1
sw a2, -216(sp) #load the win to the score on storage
j exit_player_1_winner
#if the player has no winstrak, there must be a new one and the winstreak of the other player must get deleated
player_1_new_winstreak:
li a0, 1
sw a0, -216(sp) #load the win to the score on storage
sw a0, -220(sp) #safe the new winstreak player
j exit_player_1_winner
exit_player_1_winner:
la a0, game_over_1
li a7, 4
ecall #print the text from game_over_1
j end_menu
#player 2 is the winner
player_2_winner:
lw a0, -212(sp)
addi a0, a0, 1 #add 1 win
sw a0, -212(sp)
lw a0, -220(sp) #load the player of the winstreak
li a1, 2
beq a0, a1, player_2_winstreak
bne a0, a1, player_2_new_winstreak
#if the player has already a winstreak, the winstreak counter mus get increased by one
player_2_winstreak:
lw a2, -216(sp)
addi a2, a2, 1
sw a2, -216(sp) #load the win to the score on storage
j player_2_winner_exit
#if the player has no winstrak, there must be a new one and the winstreak of the other player must get deleated
player_2_new_winstreak:
li a0, 1
sw a0, -216(sp) #load the win to the score on storage
li a0, 2
sw a0, -220(sp) #safe the new winstreak player
j player_2_winner_exit
player_2_winner_exit:
la a0, game_over_2
li a7, 4
ecall #print the text from game_over_2
j end_menu
#the menu in the console at the end of a game
end_menu:
la a0, game_over_3
li a7, 4
ecall #print the text from game_over_3
li a7, 5
ecall #read the input number for the menu navigation
li a4, 1
beq a4, a0, new_game
li a4, 2
beq a4, a0, end_game
li a4, 3
beq a4, a0, score
li a4, 4
beq a4, a0, winstreak
la a0, error_message_3 #no correct input number -> error message
li a7, 4
ecall #print the text from error_message_3
j end_menu #jump to the begin of the function for new input
#the functions for the different options of the end menu
#if the user wants to start a new game
new_game:
#reset all fields on the display
li a7, 0x000000 #color black
j p1_top_left #now there will be a cross and a circle drawn on every field with the color black, so the symbols of the game are hidden on the display
new_game_2:
#reset all field information
li t1, 0
sw t1, -100(sp)
sw t1, -104(sp)
sw t1, -108(sp)
sw t1, -112(sp)
sw t1, -116(sp)
sw t1, -120(sp)
sw t1, -124(sp)
sw t1, -128(sp)
sw t1, -132(sp)
#reset the field counter
sw t1, -224(sp)
#reset the bot
sw t1, -136(sp)
sw t1, -140(sp)
sw t1, -144(sp)
li a5, -1
sw a5, -224(sp)
li a7, 1
sw a7, -248(sp) # that the bot can jump in rule 1
li a7, 1
sw a7, -236(sp)
#reset all registers
li t1, 0
li t1, 0
li t2, 0
li t3, 0
li t4, 0
li t5, 0
li t6, 0
li a1, 0
li a2, 0
li a3, 0
li a4, 0
li a5, 0
li a6, 0
li s0, 0
li s1, 0
li s2, 0
li s3, 0
li s4, 0
li s5, 0
li s6, 0
li s7, 0
li s8, 0
li s9, 0
li s10, 0
la a0, new_game_text
li a7, 4
ecall #print the text from new_game
j game
#if the user wants to end the game
end_game:
addi a7, zero, 10
ecall
end_game_2:
la a0, game_over_4
li a7, 4
ecall #print the text from game_over_4
j end_menu
#if the user wants to see the score
score:
la a0, score_3
li a7, 4
ecall #print the text from score_3
la a0, score_1
li a7, 4
ecall #print the text from score_1
lw a0, -208(sp)
li a7, 1
ecall #print the score of player 1
la a0, score_2
li a7, 4
ecall #print the text from score_2
lw a0, -212(sp)
li a7, 1
ecall #print the score of player
j end_menu
#if the user wants to see the winstreak
winstreak:
lw a0, -220(sp)
li a1, 1
beq a0, a1, print_player_1
li a1, 2
beq a0, a1, print_player_2
print_player_1:
la a0, winstreak_1
li a7, 4
ecall #print the text from score_1
j end_winstreak
print_player_2:
la a0, winstreak_2
li a7, 4
ecall #print the text from score_2
j end_winstreak
end_winstreak:
lw a0, -216(sp)
li a7, 1
ecall #print the winstreak
j end_menu
#Step 2: select the current player
player_select:
li t4, 1
li t5, 2
lw t6, -400(sp)
beq t4, t6, player_1_loop
beq t5, t6, player_2_loop
#Step 3: the two differnt players
player_1_loop:
la a0, player1_text
li a7, 4
ecall #print the text "PlayerX must select a field." on the console
li a7, 5
ecall #read the Number of the field as an integer from the console
sw a0, -20(sp) # store the input
jal ra, rules #jump to the rules
li a7, 0xffffff #color of player
#which field is the current field?
li t3, 1
beq t3, a0, p1_top_left
addi t3, t3, 1
beq t3, a0, p1_top_middle
addi t3, t3, 1
beq t3, a0, p1_top_right
addi t3, t3, 1
beq t3, a0, p1_middle_left
addi t3, t3, 1
beq t3, a0, p1_middle_middle
addi t3, t3, 1
beq t3, a0, p1_middle_right
addi t3, t3, 1
beq t3, a0, p1_bottom_left
addi t3, t3, 1
beq t3, a0, p1_bottom_middle
addi t3, t3, 1
beq t3, a0, p1_bottom_right
beq zero, zero, cond_exit
player_2_loop:
lw a0, -236(sp) #load if bot or human
li a1, 1
beq a0, a1, bot
la a0, player2_text
li a7, 4
ecall
li a7, 5
ecall #read the Number of the fiald as an integer from the console
sw a0, -20(sp) # store the input
jal ra, rules #jump to the rules
li a7, 0xffffff #color of player
#which field is the current field?
li t3, 1
beq t3, a0, p2_top_left
addi t3, t3, 1
beq t3, a0, p2_top_middle
addi t3, t3, 1
beq t3, a0, p2_top_right
addi t3, t3, 1
beq t3, a0, p2_middle_left
addi t3, t3, 1
beq t3, a0, p2_middle_middle
addi t3, t3, 1
beq t3, a0, p2_middle_right
addi t3, t3, 1
beq t3, a0, p2_bottom_left
addi t3, t3, 1
beq t3, a0, p2_bottom_middle
addi t3, t3, 1
beq t3, a0, p2_bottom_right
beq zero, zero, cond_exit
#Step 4: the rules
rules:
sw ra, -500(sp) #store the return address
#rule 1: if the input number is not between 1 and 9, you must enter a new one
li t1, 0
blt a0, t1, forbidden_number
li t1, 10
bge a0, t1, forbidden_number
j rule_2
forbidden_number:
la a0, error_message_2 #Print the error message "Your number was not between 1 and 9. Please enter a new number." on the console.
li a7, 4
ecall #Print the error message "Your number was not between 1 and 9. Please enter a new number." on the console.
lw a0, -20(sp) # load the field numvber from storage
lw ra, -500(sp) #load address of main function
jalr zero, -16(ra) #return to the player loop
#rule 2: if a field is already claimed, you cant use it
# a0: this is the field, wich the player want's to claim
rule_2:
jal ra, offset_determination
li a3, 0
beq a1, a3, cond_exit #if the field is empty, everything is ok
la a0, error_message_1
li a7, 4
ecall #Print the errormessage "Field is already taken. Please enter e new number." on the console.
lw ra, -500(sp) #load address of main function
jalr zero, -16(ra) #return to the player loop
#wich sp offset do we need?
offset_determination:
li t2, 1
beq a0, t2, offset_1
li t2, 2
beq a0, t2, offset_2
li t2, 3
beq a0, t2, offset_3
li t2, 4
beq a0, t2, offset_4
li t2, 5
beq a0, t2, offset_5
li t2, 6
beq a0, t2, offset_6
li t2, 7
beq a0, t2, offset_7
li t2, 8
beq a0, t2, offset_8
li t2, 9
beq a0, t2, offset_9
offset_1:
lw a1, -100(sp) #load the information about the field in a1
ret
offset_2:
lw a1, -104(sp) #load the information about the field in a1
ret
offset_3:
lw a1, -108(sp) #load the information about the field in a1
ret
offset_4:
lw a1, -112(sp) #load the information about the field in a1
ret
offset_5:
lw a1, -116(sp) #load the information about the field in a1
ret
offset_6:
lw a1, -120(sp) #load the information about the field in a1
ret
offset_7:
lw a1, -124(sp) #load the information about the field in a1
ret
offset_8:
lw a1, -128(sp) #load the information about the field in a1
ret
offset_9:
lw a1, -132(sp) #load the information about the field in a1
ret
cond_exit:
lw ra, -500(sp) #load Address of main function
ret
#Step 5: draw the players on the fild
#draw instruction for player 1 for every field
p1_top_left:
li a3, 85
li a4, 85
li a5, 50
jal draw_circle
li a5, 0x000000
beq a7, a5, p2_top_left #condition for reset the field
li t6, 1
sw t6, -100(sp) #now the field is taken (and stored at the memory)
li t6, 2
sw t6, -400(sp) #now the other player is the current player
beq zero, zero, win_query
p2_top_left:
li a3, 85
li a4, 85
jal draw_cross
li a5, 0x000000
beq a7, a5, p1_top_middle #condition for reset the field
li t6, 2
sw t6, -100(sp) #now the field is taken (and stored at the memory)
li t6, 1
sw t6, -400(sp) #now the other player is the current player
li t6, 0
sw t6, -244(sp) # reset the testbot or bot
li a4, 1
sw a4, -248(sp) # now the current rule is rule 1
beq zero, zero, win_query
p1_top_middle:
li a3, 256
li a4, 85
li a5, 50
jal draw_circle
li a5, 0x000000
beq a7, a5, p2_top_middle #condition for reset the field
li t6, 1
sw t6, -104(sp) #now the field is taken (and stored at the memory)
li t6, 2
sw t6, -400(sp) #now the other player is the current player
beq zero, zero, win_query
p2_top_middle:
li a3, 256
li a4, 85
jal draw_cross
li a5, 0x000000
beq a7, a5, p1_top_right #condition for reset the field
li t6, 2
sw t6, -104(sp) #now the field is taken (and stored at the memory)
li t6, 1
sw t6, -400(sp) #now the other player is the current player
li t6, 0
sw t6, -244(sp) # reset the testbot or bot
li a4, 1
sw a4, -248(sp) # now the current rule is rule 1
beq zero, zero, win_query
p1_top_right:
li a3, 427
li a4, 85
li a5, 50
jal draw_circle
li a5, 0x000000
beq a7, a5, p2_top_right #condition for reset the field
li t6, 1
sw t6, -108(sp) #now the field is taken (and stored at the memory)
li t6, 2
sw t6, -400(sp) #now the other player is the current player
beq zero, zero, win_query
p2_top_right:
li a3, 427
li a4, 85
jal draw_cross
li a5, 0x000000
beq a7, a5, p1_middle_left #condition for reset the field
li t6, 2
sw t6, -108(sp) #now the field is taken (and stored at the memory)
li t6, 1
sw t6, -400(sp) #now the other player is the current player
li t6, 0
sw t6, -244(sp) # reset the testbot or bot
li a4, 1
sw a4, -248(sp) # now the current rule is rule 1
beq zero, zero, win_query
p1_middle_left:
li a3, 85
li a4, 256
li a5, 50
jal draw_circle
li a5, 0x000000
beq a7, a5, p2_middle_left #condition for reset the field
li t6, 1
sw t6, -112(sp) #now the field is taken (and stored at the memory)
li t6, 2
sw t6, -400(sp) #now the other player is the current player
beq zero, zero, win_query
p2_middle_left:
li a3, 85
li a4, 256
jal draw_cross
li a5, 0x000000
beq a7, a5, p1_middle_middle #condition for reset the field
li t6, 2
sw t6, -112(sp) #now the field is taken (and stored at the memory)
li t6, 1
sw t6, -256(sp) #now the field is taken (and stored at the memory)
li t6, 1
sw t6, -400(sp) #now the other player is the current player#
li t6, 0
sw t6, -244(sp) # reset the testbot or bot
li a4, 1
sw a4, -248(sp) # now the current rule is rule 1
beq zero, zero, win_query
p1_middle_middle:
li a3, 256
li a4, 256
li a5, 50
jal draw_circle
li a5, 0x000000
beq a7, a5, p2_middle_middle #condition for reset the field
li t6, 1
sw t6, -116(sp) #now the field is taken (and stored at the memory)
li t6, 2
sw t6, -400(sp) #now the other player is the current player
beq zero, zero, win_query
p2_middle_middle:
li a3, 256
li a4, 256
jal draw_cross
li a5, 0x000000
beq a7, a5, p1_middle_right #condition for reset the field
li t6, 2
sw t6, -116(sp) #now the field is taken (and stored at the memory)
li t6, 1
sw t6, -400(sp) #now the other player is the current player
li t6, 0
sw t6, -244(sp) # reset the testbot or bot
li a4, 1
sw a4, -248(sp) # now the current rule is rule 1
beq zero, zero, win_query
p1_middle_right:
li a3, 427
li a4, 256
li a5, 50
jal draw_circle
li a5, 0x000000
beq a7, a5, p2_middle_right #condition for reset the field
li t6, 1
sw t6, -120(sp) #now the field is taken (and stored at the memory)
li t6, 2
sw t6, -400(sp) #now the other player is the current player
beq zero, zero, win_query
p2_middle_right:
li a3, 427
li a4, 256
jal draw_cross
li a5, 0x000000
beq a7, a5, p1_bottom_left #condition for reset the field
li t6, 2
sw t6, -120(sp) #now the field is taken (and stored at the memory)
li t6, 1
sw t6, -400(sp) #now the other player is the current player
li t6, 0
sw t6, -244(sp) # reset the testbot or bot
li a4, 1
sw a4, -248(sp) # now the current rule is rule 1
beq zero, zero, win_query
p1_bottom_left:
li a3, 85
li a4, 427
li a5, 50
jal draw_circle
li a5, 0x000000
beq a7, a5, p2_bottom_left #condition for reset the field
li t6, 1
sw t6, -124(sp) #now the field is taken (and stored at the memory)
li t6, 2
sw t6, -400(sp) #now the other player is the current player
beq zero, zero, win_query
p2_bottom_left:
li a3, 85
li a4, 427
jal draw_cross
li a5, 0x000000
beq a7, a5, p1_bottom_middle #condition for reset the field
li t6, 2
sw t6, -124(sp) #now the field is taken (and stored at the memory)
li t6, 1
sw t6, -400(sp) #now the other player is the current player
li t6, 0
sw t6, -244(sp) # reset the testbot or bot
li a4, 1
sw a4, -248(sp) # now the current rule is rule 1
beq zero, zero, win_query
p1_bottom_middle:
li a3, 256
li a4, 427
li a5, 50
jal draw_circle
li a5, 0x000000
beq a7, a5, p2_bottom_middle #condition for reset the field
li t6, 1
sw t6, -128(sp) #now the field is taken (and stored at the memory)
li t6, 2
sw t6, -400(sp) #now the other player is the current player
beq zero, zero, win_query
p2_bottom_middle:
li a3, 256
li a4, 427
jal draw_cross
li a5, 0x000000
beq a7, a5, p1_bottom_right #condition for reset the field
li t6, 2
sw t6, -128(sp) #now the field is taken (and stored at the memory)
li t6, 1
sw t6, -400(sp) #now the other player is the current player
li t6, 0
sw t6, -244(sp) # reset the testbot or bot
li a4, 1
sw a4, -248(sp) # now the current rule is rule 1
beq zero, zero, win_query
p1_bottom_right:
li a3, 427
li a4, 427
li a5, 50
jal draw_circle
li a5, 0x000000
beq a7, a5, p2_bottom_right #condition for reset the field
li t6, 1
sw t6, -132(sp) #now the field is taken (and stored at the memory)
li t6, 2
sw t6, -400(sp) #now the other player is the current player
beq zero, zero, win_query
p2_bottom_right:
li a3, 427
li a4, 427
jal draw_cross
li a5, 0x000000
beq a7, a5, new_game_2 #jump back the new_game
li t6, 2
sw t6, -132(sp) #now the field is taken (and stored at the memory)
li t6, 1
sw t6, -400(sp) #now the other player is the current player
li t6, 0
sw t6, -244(sp) # reset the testbot or bot
li a4, 1
sw a4, -248(sp) # now the current rule is rule 1
beq zero, zero, win_query
#are two humans playing or a bot and a human?
bot_or_human:
la a0, bot_or_human_text
li a7, 4
ecall
li a7, 5
ecall
li a7, 1
beq a7, a0, bot_select
li a7, 2
beq a7, a0, human_select
la, a0, error_message_4
li a7, 4
ecall
ret
bot_select: #a bot got selected
li a7, 1
sw a7, -248(sp) # that the bot can jump in rule 1
li a7, 1
sw a7, -236(sp)
la a7, start_game
jalr zero, 8(a7)
human_select: #two humans got selected
li a7, 2
sw a7, -236(sp)
la a7, start_game
jalr zero, 8(a7)
######################################################### bot #########################################################
bot:
#you dont need to save any registers here (except ra), because the information in the registers arte useless after the bot function
sw ra, -232(sp)
#load all field information
lw t1, -100(sp)
lw t2, -104(sp)
lw t3, -108(sp)
lw t4, -112(sp)
lw t5, -116(sp)
lw t6, -120(sp)
lw a1, -124(sp)
lw a2, -128(sp)
lw a3, -132(sp)
lw t0, -224(sp) #load the field counter
lw a6, -240(sp) #load the given test field
# the bot must reset the last test field
li a0, 1
beq a0, a6, reset_field_1
li a0, 2
beq a0, a6, reset_field_2
li a0, 3
beq a0, a6, reset_field_3
li a0, 4
beq a0, a6, reset_field_4
li a0, 5
beq a0, a6, reset_field_5
li a0, 6
beq a0, a6, reset_field_6
li a0, 7
beq a0, a6, reset_field_7
li a0, 8
beq a0, a6, reset_field_8
li a0, 9
beq a0, a6, reset_field_9
increase_testfield_counter: #increase the counter of the test fields (its important for the bot to know, which field he must test next)
addi a6, a6, 1 #next field
li a4, 1
beq a4, t0, first_move #the first move of the bot (field counter is 1), there are special rules
#wich rule is the current rule?
lw s1, -248(sp)
beq a4, s1, bot_rule_1
li a4, 2
beq a4, s1, bot_rule_2
li a4, 3
beq a4, s1, bot_rule_3
li a4, 4
beq a4, s1, bot_rule_4
first_move: #if the field in the middle (field 5) is empty, the bot must claim it. If its taken, he must claim field 1.
li a4, 0
beq a4, t5, place_middle
bne a4, t5, place_in_corner_1
place_middle:
li a7, 0xffffff #color of player 2
j p2_middle_middle
place_in_corner_1:
li a7, 0xffffff #color of player 2
j p2_top_left
#rule 1: if the bot can win, he should do this
bot_rule_1:
li a4, 1
sw a4, -248(sp) # now the current rule is rule 1
li a4, 3
sw a4, -244(sp) #here, the right player is th bot (2), because if the bot can win, he should instantly do it
li a4, 0 # for the test, if the field is free
li a0, 1
beq a0, a6, field_1_free #is this field the current field?
li a0, 2
beq a0, a6, field_2_free #is this field the current field?
li a0, 3
beq a0, a6, field_3_free #is this field the current field?
li a0, 4
beq a0, a6, field_4_free #is this field the current field?
li a0, 5
beq a0, a6, field_5_free #is this field the current field?
li a0, 6
beq a0, a6, field_6_free #is this field the current field?
li a0, 7
beq a0, a6, field_7_free #is this field the current field?
li a0, 8
beq a0, a6, field_8_free #is this field the current field?
li a0, 9
beq a0, a6, field_9_free #is this field the current field?
li a0, 0
sw a0, -240(sp) #reset the test field
li a0, 2
sw a0, -248(sp) # now the current rule is rule 2
li a6, 1
sw a6, -240(sp) #reset the test field
j bot_rule_2
field_1_free:
beq a4, t1, field_1_r1 #is this field free?
j increase_testfield_counter
field_2_free:
beq a4, t2, field_2_r1 #is this field free?
j increase_testfield_counter
field_3_free:
beq a4, t3, field_3_r1 #is this field free?
j increase_testfield_counter
field_4_free:
beq a4, t4, field_4_r1 #is this field free?
j increase_testfield_counter
field_5_free:
beq a4, t5, field_5_r1 #is this field free?
j increase_testfield_counter
field_6_free:
beq a4, t6, field_6_r1 #is this field free?
j increase_testfield_counter
field_7_free:
beq a4, a1, field_7_r1 #is this field free?
j increase_testfield_counter
field_8_free:
beq a4, a2, field_8_r1 #is this field free?
j increase_testfield_counter
field_9_free:
beq a4, a3, field_9_r1 #is this field free?
li a0, 2
sw a0, -248(sp) # now the current rule is rule 2
li a6, 1
sw a6, -240(sp) #reset the test field
j bot_rule_2 # if field 9 isn't free, the bot can jump to the next rule
win_the_game: #function in called from bot_or_not_2: if its called, the bot can win the game, if he claims the field, which is saved in -240(sp)
lw a4, -240(sp)
li a7, 0
sw a7, -240(sp) #reset the test field counter
li a7, 0xffffff #color of player 2
li a0, 1
beq a0, a4, p2_top_left
li a0, 2
beq a0, a4, p2_top_middle
li a0, 3
beq a0, a4, p2_top_right
li a0, 4
beq a0, a4, p2_middle_left
li a0, 5
beq a0, a4, p2_middle_middle
li a0, 6
beq a0, a4, p2_middle_right
li a0, 7
beq a0, a4, p2_bottom_left
li a0, 8
beq a0, a4, p2_bottom_middle
li a0, 9
beq a0, a4, p2_bottom_right
#rule 2: if the enemy can win, the bot should block him
bot_rule_2:
li a4, 2
sw a4, -248(sp) # now the current rule is rule 2
li a4, 3
sw a4, -244(sp) #here, the right player is th bot (2), because if the bot can win, he should instantly do it
li a4, 0 # for the test, if the field is free
li a0, 1
beq a0, a6, field_1_free_r2 #is this field the current field?
li a0, 2
beq a0, a6, field_2_free_r2 #is this field the current field?
li a0, 3
beq a0, a6, field_3_free_r2 #is this field the current field?
li a0, 4
beq a0, a6, field_4_free_r2 #is this field the current field?
li a0, 5
beq a0, a6, field_5_free_r2 #is this field the current field?
li a0, 6
beq a0, a6, field_6_free_r2 #is this field the current field?
li a0, 7
beq a0, a6, field_7_free_r2 #is this field the current field?
li a0, 8
beq a0, a6, field_8_free_r2 #is this field the current field?
li a0, 9
beq a0, a6, field_9_free_r2 #is this field the current field?
li a0, 0
sw a0, -240(sp) #reset the test field
li a0, 3
sw a0, -248(sp) # now the current rule is rule 3
j bot_rule_3
field_1_free_r2:
beq a4, t1, field_1_r2 #is this field free?
j increase_testfield_counter
field_2_free_r2:
beq a4, t2, field_2_r2 #is this field free?
j increase_testfield_counter
field_3_free_r2:
beq a4, t3, field_3_r2 #is this field free?
j increase_testfield_counter
field_4_free_r2:
beq a4, t4, field_4_r2 #is this field free?
j increase_testfield_counter
field_5_free_r2:
beq a4, t5, field_5_r2 #is this field free?
j increase_testfield_counter
field_6_free_r2:
beq a4, t6, field_6_r2 #is this field free?
j increase_testfield_counter
field_7_free_r2:
beq a4, a1, field_7_r2 #is this field free?
j increase_testfield_counter
field_8_free_r2:
beq a4, a2, field_8_r2 #is this field free?
j increase_testfield_counter
field_9_free_r2:
beq a4, a3, field_9_r2 #is this field free?
li a6, 1
sw a6, -240(sp) #reset the test field
li a0, 2
sw a0, -248(sp) # now the current rule is rule 2
j bot_rule_3 # if field 9 isn't free, the bot can jump to the next rule
#block the enemy, if he can win
block_enemy:
lw a4, -240(sp)
li a7, 0
sw a7, -240(sp) #reset the test field counter
li a7, 0xffffff #color of player 2
li a0, 1
beq a0, a4, p2_top_left
li a0, 2
beq a0, a4, p2_top_middle
li a0, 3
beq a0, a4, p2_top_right
li a0, 4
beq a0, a4, p2_middle_left
li a0, 5
beq a0, a4, p2_middle_middle
li a0, 6
beq a0, a4, p2_middle_right
li a0, 7
beq a0, a4, p2_bottom_left
li a0, 8
beq a0, a4, p2_bottom_middle
li a0, 9
beq a0, a4, p2_bottom_right
#rule 3: if there are exactly 3 fields used and the enemy (player 1) has 2 corners claimed and the bot has placed his field in the middle (field 5), the bot must use field 2, 4, 6 or 8
bot_rule_3:
li a4, 3
sw a4, -248(sp) # now the current rule is rule 3
li s3, 0 # reset the corner counter
li s2, 3
bne s2, t0, bot_rule_4
li a4, 1
beq a4, t1, corner_counter_1 # is field 1 taken by player 1?
beq a4, t3, corner_counter_2 # is field 3 taken by player 1?
beq a4, a1, corner_counter_3 # is field 7 taken by player 1?
beq a4, a3, corner_counter_4 # is field 9 taken by player 1?
li s5, 2
beq s3, s5, bot_rule_3_1 # does player 1 has exatly 2 corners?
j bot_rule_4 # here are no modifications needed, because we dont use field counter, testfields etc.
corner_counter_1:
addi s3, s3, 1 # counter for corner fields, taken by player 1
beq a4, t3, corner_counter_2 # is field 3 taken by player 1?
beq a4, a1, corner_counter_3 # is field 7 taken by player 1?
beq a4, a3, corner_counter_4 # is field 9 taken by player 1?
la s4, bot_rule_3
jalr zero, 40(s4)
corner_counter_2:
addi s3, s3, 1 # counter for corner fields, taken by player 1
beq a4, t3, corner_counter_3 # is field 7 taken by player 1?
beq a4, a1, corner_counter_4 # is field 9 taken by player 1?
la s4, bot_rule_3
jalr zero, 40(s4)
corner_counter_3:
addi s3, s3, 1 # counter for corner fields, taken by player 1
beq a3, t3, corner_counter_4 # is field 9 taken by player 1?
la s4, bot_rule_3
jalr zero, 40(s4)
corner_counter_4:
addi s3, s3, 1 # counter for corner fields, taken by player 1
la s4, bot_rule_3
jalr zero, 40(s4)
bot_rule_3_1: #is field 5 taken by the bot?
li a4, 2
bne a4, t5, bot_rule_4
#take field 2, 4, 6 or 8
li a7, 0xffffff #color of player 2
li a4, 0
beq t2, a4, p2_top_middle # if field 2 is free, the bot should use it
beq t4, a4, p2_middle_left # if field 4 is free, the bot should use it
beq t6, a4, p2_middle_right # if field 6 is free, the bot should use it
beq a2, a4, p2_bottom_middle # if field 8 is free, the bot should use it
j bot_rule_4
#rule 4: are there free corner? then the bot shloud use one of them
bot_rule_4:
li a7, 0xffffff #color of player 2
li a4, 0
beq t1, a4, p2_top_left # if field 1 is free, the bot should use it
beq t3, a4, p2_top_right # if field 3 is free, the bot should use it
beq a1, a4, p2_bottom_left # if field 7 is free, the bot should use it
beq a3, a4, p2_bottom_right # if field 9 is free, the bot should use it
j bot_rule_5 # if no field is free, jump to rule 5
#rule 5: the bot should use field 2, 4, 6 or 8
bot_rule_5:
li a7, 0xffffff #color of player 2
li a4, 0
beq t2, a4, p2_top_middle # if field 2 is free, the bot should use it
beq t4, a4, p2_middle_left # if field 4 is free, the bot should use it
beq t6, a4, p2_middle_right # if field 6 is free, the bot should use it
beq a2, a4, p2_bottom_middle # if field 8 is free, the bot should use it
field_1_r1:
li a4, 1
sw a4, -240(sp) #save the test field number
lw a4, -244(sp) #load the correct player number for the field information
li a4, 2
sw a4, -100(sp) #store the test field
j win_query
field_2_r1:
li a4, 2
sw a4, -240(sp) #save the test field number
lw a4, -244(sp) #load the correct player number for the field information
li a4, 2
sw a4, -104(sp) #store the test field
j win_query
field_3_r1:
li a4, 3
sw a4, -240(sp) #save the test field number
lw a4, -244(sp) #load the correct player number for the field information
li a4, 2
sw a4, -108(sp) #store the test field
j win_query
field_4_r1:
li a4, 4
sw a4, -240(sp) #save the test field number
lw a4, -244(sp) #load the correct player number for the field information
li a4, 2
sw a4, -112(sp) #store the test field
j win_query
field_5_r1:
li a4, 5
sw a4, -240(sp) #save the test field number
lw a4, -244(sp) #load the correct player number for the field information
li a4, 2
sw a4, -116(sp) #store the test field
j win_query
field_6_r1:
li a4, 6
sw a4, -240(sp) #save the test field number
lw a4, -244(sp) #load the correct player number for the field information
li a4, 2
sw a4, -120(sp) #store the test field
j win_query
field_7_r1:
li a4, 7
sw a4, -240(sp) #save the test field number
lw a4, -244(sp) #load the correct player number for the field information
li a4, 2
sw a4, -124(sp) #store the test field
j win_query
field_8_r1:
li a4, 8
sw a4, -240(sp) #save the test field number
lw a4, -244(sp) #load the correct player number for the field information
li a4, 2
sw a4, -128(sp) #store the test field
j win_query
field_9_r1:
li a4, 9
sw a4, -240(sp) #save the test field number
lw a4, -244(sp) #load the correct player number for the field information
li a4, 2
sw a4, -132(sp) #store the test field
j win_query
field_1_r2:
li a4, 1
sw a4, -240(sp) #save the test field number
lw a4, -244(sp) #load the correct player number for the field information
sw a4, -100(sp) #store the test field
j win_query
field_2_r2:
li a4, 2
sw a4, -240(sp) #save the test field number
lw a4, -244(sp) #load the correct player number for the field information
li a4, 1
sw a4, -104(sp) #store the test field
j win_query
field_3_r2:
li a4, 3
sw a4, -240(sp) #save the test field number
lw a4, -244(sp) #load the correct player number for the field information
li a4, 1
sw a4, -108(sp) #store the test field
j win_query
field_4_r2:
li a4, 4
sw a4, -240(sp) #save the test field number
lw a4, -244(sp) #load the correct player number for the field information
li a4, 1
sw a4, -112(sp) #store the test field
j win_query
field_5_r2:
li a4, 5
sw a4, -240(sp) #save the test field number
lw a4, -244(sp) #load the correct player number for the field information
li a4, 1
sw a4, -116(sp) #store the test field
j win_query
field_6_r2:
li a4, 6
sw a4, -240(sp) #save the test field number
lw a4, -244(sp) #load the correct player number for the field information
li a4, 1
sw a4, -120(sp) #store the test field
j win_query
field_7_r2:
li a4, 7
sw a4, -240(sp) #save the test field number
lw a4, -244(sp) #load the correct player number for the field information
li a4, 1
sw a4, -124(sp) #store the test field
j win_query
field_8_r2:
li a4, 8
sw a4, -240(sp) #save the test field number
lw a4, -244(sp) #load the correct player number for the field information
li a4, 1
sw a4, -128(sp) #store the test field
j win_query
field_9_r2:
li a4, 9
sw a4, -240(sp) #save the test field number
lw a4, -244(sp) #load the correct player number for the field information
li a4, 1
sw a4, -132(sp) #store the test field
j win_query
#the test field must get resetted
reset_field_1:
li a0, 0
sw a0, -100(sp)
j increase_testfield_counter
reset_field_2:
li a0, 0
sw a0, -104(sp)
j increase_testfield_counter
reset_field_3:
li a0, 0
sw a0, -108(sp)
j increase_testfield_counter
reset_field_4:
li a0, 0
sw a0, -112(sp)
j increase_testfield_counter
reset_field_5:
li a0, 0
sw a0, -116(sp)
j increase_testfield_counter
reset_field_6:
li a0, 0
sw a0, -120(sp)
j increase_testfield_counter
reset_field_7:
li a0, 0
sw a0, -124(sp)
j increase_testfield_counter
reset_field_8:
li a0, 0
sw a0, -128(sp)
j increase_testfield_counter
reset_field_9:
li a0, 0
sw a0, -132(sp)
lw a3, -132(sp) # for the correct value in a3
j increase_testfield_counter
.include "draw_gamefield.asm"
.include "draw_players.asm"
| 27.259547 | 184 | 0.681411 |
90a76bbeaf9a08dbd4510bed633e1fae53f70039 | 6,205 | py | Python | src/ssp/spark/streaming/nlp/spark_dl_text_classification.py | gyan42/spark-streaming-playground | 147ef9cbc31b7aed242663dee36143ebf0e8043f | [
"Apache-2.0"
] | 10 | 2020-03-12T11:51:46.000Z | 2022-03-24T04:56:05.000Z | src/ssp/spark/streaming/nlp/spark_dl_text_classification.py | gyan42/spark-streaming-playground | 147ef9cbc31b7aed242663dee36143ebf0e8043f | [
"Apache-2.0"
] | 12 | 2020-04-23T07:28:14.000Z | 2022-03-12T00:20:24.000Z | src/ssp/spark/streaming/nlp/spark_dl_text_classification.py | gyan42/spark-streaming-playground | 147ef9cbc31b7aed242663dee36143ebf0e8043f | [
"Apache-2.0"
] | 1 | 2020-04-20T14:48:38.000Z | 2020-04-20T14:48:38.000Z | #!/usr/bin/env python
__author__ = "Mageswaran Dhandapani"
__copyright__ = "Copyright 2020, The Spark Structured Playground Project"
__credits__ = []
__license__ = "Apache License"
__version__ = "2.0"
__maintainer__ = "Mageswaran Dhandapani"
__email__ = "mageswaran1989@gmail.com"
__status__ = "Education Purpose"
import gin
from datetime import datetime
from pyspark.sql import SparkSession
from pyspark.sql.functions import explode, col
from ssp.logger.pretty_print import print_error, print_info
from ssp.spark.streaming.common.twitter_streamer_base import TwitterStreamerBase
from ssp.spark.udf.tensorflow_serving_api_udf import get_text_classifier_udf
@gin.configurable
class SreamingTextClassifier(TwitterStreamerBase):
"""
Classifies the incoming tweet text using the DL model build using Tensorflow serving
:param kafka_bootstrap_servers: (str) host_url:port
:param kafka_topic: (str) Live stream Kafka topic
:param checkpoint_dir: (str) Spark Streaming checkpoint directory
:param bronze_parquet_dir: (str) Input stream directory path. For local paths prefix it with "file///"
:param warehouse_location: (str) Spark warehouse location
:param spark_master: (str) Spark master url
:param postgresql_host: (str) Postgresql host url
:param postgresql_port: (str) Postgres port
:param postgresql_database: (str) Database name
:param postgresql_user: (str) Postgresql user name
:param postgresql_password: (str) Postgresql user password
:param processing_time: (str) Spark Streaming process interval
:param is_live_stream: (bool) Use live stream or to use streamed directory as input
:param is_docker: (bool) Run environment local machine or docker, to use appropriate host name in REST endpoints
:param tokenizer_path: Keras tokenizer store / saved path
"""
def __init__(self,
kafka_bootstrap_servers="localhost:9092",
kafka_topic="ai_tweets_topic",
checkpoint_dir="hdfs://localhost:9000/tmp/ssp/data/lake/checkpoint/",
bronze_parquet_dir="hdfs://localhost:9000/tmp/ssp/data/lake/bronze/",
warehouse_location="/opt/spark-warehouse/",
spark_master="spark://IMCHLT276:7077",
postgresql_host="localhost",
postgresql_port="5432",
postgresql_database="sparkstreamingdb",
postgresql_user="sparkstreaming",
postgresql_password="sparkstreaming",
processing_time='5 seconds',
tokenizer_path=gin.REQUIRED,
is_live_stream=True,
is_docker=False):
TwitterStreamerBase.__init__(self,
spark_master=spark_master,
checkpoint_dir=checkpoint_dir,
warehouse_location=warehouse_location,
kafka_bootstrap_servers=kafka_bootstrap_servers,
kafka_topic=kafka_topic,
processing_time=processing_time)
self._spark_master = spark_master
self._checkpoint_dir = checkpoint_dir
self._bronze_parquet_dir = bronze_parquet_dir
self._warehouse_location = warehouse_location
self._postgresql_host = postgresql_host
self._postgresql_port = postgresql_port
self._postgresql_database = postgresql_database
self._postgresql_user = postgresql_user
self._postgresql_password = postgresql_password
self.spark = SparkSession.builder. \
appName("twitter_stream"). \
master(self._spark_master). \
config("spark.sql.streaming.checkpointLocation", self._checkpoint_dir). \
getOrCreate()
self.spark.sparkContext.setLogLevel("error")
self._tokenizer_path = tokenizer_path
self._is_live_stream = is_live_stream
self._is_docker = is_docker
def online_process(self):
tweet_stream = self._get_source_stream()
return tweet_stream
def hdfs_process(self):
userSchema = self.spark.read.parquet(self._bronze_parquet_dir).schema
tweet_stream = self.spark.readStream. \
schema(userSchema). \
format("parquet"). \
option("ignoreChanges", "true"). \
load(self._bronze_parquet_dir)
return tweet_stream
def process(self):
if self._is_live_stream:
tweet_stream = self.online_process()
else:
tweet_stream = self.hdfs_process()
# Note: UDF with wrapper for different URL based on from where the code is triggered docker/local machine
text_clsfier = get_text_classifier_udf(is_docker=self._is_docker, tokenizer_path=self._tokenizer_path)
tweet_stream.printSchema()
def foreach_batch_function(df, epoch_id):
# Transform and write batchDF
df.printSchema()
print_info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
print_info("Number of records in this batch : {}".format(df.count()))
t1 = datetime.now()
df = df.withColumn("ai_prob", text_clsfier(col("text")))
t2 = datetime.now()
delta = t2 - t1
print_info("Time taken to get predicted : {}".format(delta.total_seconds()))
print_info("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
mode = "append"
url = "jdbc:postgresql://{}:{}/{}".format(self._postgresql_host,
self._postgresql_port,
self._postgresql_database)
properties = {"user": self._postgresql_user,
"password": self._postgresql_password,
"driver": "org.postgresql.Driver"}
df.write.jdbc(url=url, table="ai_tweets", mode=mode, properties=properties)
tweet_stream.writeStream.foreachBatch(foreach_batch_function).start().awaitTermination()
| 43.090278 | 116 | 0.62917 |
9073ac4d0fa9fed69e8461334e82119016660b90 | 2,077 | lua | Lua | lua/luasocket/etc/forward.lua | vlinhd11/vlinhd11-android-scripting | c90f04eb26a3746f025a6a0beab92bb6aa88c084 | [
"Apache-2.0"
] | 2,293 | 2015-01-02T12:46:10.000Z | 2022-03-29T09:45:43.000Z | lua/luasocket/etc/forward.lua | weiqiangzheng/sl4a | d3c17dca978cbeee545e12ea240a9dbf2a6999e9 | [
"Apache-2.0"
] | 315 | 2015-05-31T11:55:46.000Z | 2022-01-12T08:36:37.000Z | lua/luasocket/etc/forward.lua | weiqiangzheng/sl4a | d3c17dca978cbeee545e12ea240a9dbf2a6999e9 | [
"Apache-2.0"
] | 1,033 | 2015-01-04T07:48:40.000Z | 2022-03-24T09:34:37.000Z | -- load our favourite library
local dispatch = require("dispatch")
local handler = dispatch.newhandler()
-- make sure the user knows how to invoke us
if table.getn(arg) < 1 then
print("Usage")
print(" lua forward.lua <iport:ohost:oport> ...")
os.exit(1)
end
-- function to move data from one socket to the other
local function move(foo, bar)
local live
while 1 do
local data, error, partial = foo:receive(2048)
live = data or error == "timeout"
data = data or partial
local result, error = bar:send(data)
if not live or not result then
foo:close()
bar:close()
break
end
end
end
-- for each tunnel, start a new server
for i, v in ipairs(arg) do
-- capture forwarding parameters
local _, _, iport, ohost, oport = string.find(v, "([^:]+):([^:]+):([^:]+)")
assert(iport, "invalid arguments")
-- create our server socket
local server = assert(handler.tcp())
assert(server:setoption("reuseaddr", true))
assert(server:bind("*", iport))
assert(server:listen(32))
-- handler for the server object loops accepting new connections
handler:start(function()
while 1 do
local client = assert(server:accept())
assert(client:settimeout(0))
-- for each new connection, start a new client handler
handler:start(function()
-- handler tries to connect to peer
local peer = assert(handler.tcp())
assert(peer:settimeout(0))
assert(peer:connect(ohost, oport))
-- if sucessful, starts a new handler to send data from
-- client to peer
handler:start(function()
move(client, peer)
end)
-- afte starting new handler, enter in loop sending data from
-- peer to client
move(peer, client)
end)
end
end)
end
-- simply loop stepping the server
while 1 do
handler:step()
end
| 31.469697 | 79 | 0.577275 |
29048dd70019acba23918a54f9a81732d4fee4b7 | 5,845 | py | Python | tests.py | Mariuki/AutomatedBruteForceAttack_to_FingerprintFuzzyVault | 99c6ab5138d5b548c5ea7e4ab639fa8b2963c75b | [
"MIT"
] | null | null | null | tests.py | Mariuki/AutomatedBruteForceAttack_to_FingerprintFuzzyVault | 99c6ab5138d5b548c5ea7e4ab639fa8b2963c75b | [
"MIT"
] | null | null | null | tests.py | Mariuki/AutomatedBruteForceAttack_to_FingerprintFuzzyVault | 99c6ab5138d5b548c5ea7e4ab639fa8b2963c75b | [
"MIT"
] | null | null | null | # Pruebas de diferentes operaciones sobre las bóvedas y los archivos.
# from lagrange_matlab import lagrange_poly_iter
import numpy as np
from sympy import *
import math
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def polev(coefs,rng):
'''Incertar coeficientes del polinomio comenzando
desde el valor independiente hacia la mayor potencia'''
res = []
if len(rng) == 2:
xs = range(rng[0],rng[1]+1)
else:
xs = range
print(type(rng))
for i in xs:
pr = 0
# print(i)
for p,j in enumerate(coefs):
pr += j*i**p
# print(j*i**p)
res.append(pr)
return res
def intercalar_mm(xs,y, valor):
xs = np.array(xs)
y = np.array(y)
mayores = xs[xs > valor][:]
menores = xs[xs[xs < valor].argsort()][::-1]
mayoresy = y[np.where(xs>valor)]
menoresy = y[np.where(xs<valor)][::-1]
traslp = []
traslpy = []
i=0
while i <= np.abs(len(mayores)-len(menores))+2 :
while i < (min(len(menores),len(mayores))):
traslp.append(mayores[i])
traslp.append(menores[i])
traslpy.append(mayoresy[i])
traslpy.append(menoresy[i])
i += 1
if i*2 == len(xs):
if len(traslp) == len(xs):
return traslp, traslpy
if len(mayores) == (min(len(menores),len(mayores))):
traslp.append(menores[i])
traslpy.append(menoresy[i])
if len(traslp) == len(xs):
return traslp, traslpy
else:
traslp.append(mayores[i])
traslpy.append(mayoresy[i])
if len(traslp) == len(xs):
return traslp, traslpy
i += 1
return traslp, traslpy
def Lagrange(x,y,val=0,orden=0, mgraphs=False):
'''Rubs, si quieres calcular un grado menor a dos, mejor calculalo a partir de 3 y tendrás los que necesite.'''
xg, yg = x,y
x,y = intercalar_mm(x,y,val)
X = Symbol('X')
if orden:
orden
else:
orden = len(x)-1
if mgraphs:
fig, axs = plt.subplots(int(np.ceil(orden/2)),2, figsize=(15,15))
fig.suptitle('Puntos ajustados distintos grados de polinomio')
for k in range(1,orden+1):
coef=[]
Li,Fx=1,0
for i in range(k+1):
Li=1
for j in range(k+1):
if i != j:
Li*=(X-x[j])/(x[i]-x[j])
Fx+=Li*y[i]
for m in range(k+1):
coef.append(simplify(collect(Fx,X)).coeff(X,m))
# print(coef)
Fxe = Fx.evalf(subs={X:val})
print('Polinomio de Lagrange de orden {}: {}'.format(k, simplify(Fx)))
print('\t Resultado con el polinomio de Lagrange de orden {}: {}'.format(k,Fxe))
if mgraphs:
poly = np.poly1d(coef[::-1])
new_x = np.linspace(xg[0], xg[-1])
new_y = poly(new_x)
kr = k -1
axs[int(np.floor(kr/2)), kr%2].plot(xg, yg, "kD", new_x, new_y,'c--')
axs[int(np.floor(kr/2)), kr%2].set_title('Poliniomio de grado: {}'.format(k))
gh = [float(i%(2**16)) for i in coef]
print(gh)
# coeffs= [2,8,1,5,3,4,6]
# pointsX = [i for i in range(50,60)]
# pointsY = polev(coeffs,[50,59])
# # print(lagrange_poly_iter(pointsX, pointsY, 7, 7))
# print(pointsX)
# print(pointsY)
pointsX = [23092,11028,20912,48308,49723,15791,51551,40568,58045]
pointsY = [41347,1691,63227,44986,49986,9722,7764,4267,15494]
# print(lagrange_poly_iter(pointsX, pointsY, 9, 9))
# Lagrange(pointsX,pointsY)
cofs = [21234,56847,55004,58836,32331,4274,60882,19908,16469]
xss = [23092,11028,20912,48308,49723,15791,51551,40568,58045]
print(type(xss))
polev(cofs,xss)
import random
from itertools import combinations
random.shuffle(combinations(pointsX,2))
for i in pointsX:
print(i)
for i in combinations(pointsX,2):
print(i)
for i in sorted(combinations(pointsX,2), key=lambda k: random.random()):
print(i)
import time
ght = [i for i in range(50000)]
ff = [i for i in range(50000*1000)]
# start_time = time.time()
start_time = time.time()
for i in range(len(ght)):
ght[i] = ght[i]+1
print("--- %s seconds ---" % (time.time() - start_time))
import random
from itertools import combinations
points = [(1,2),(3,4),(5,6),(7,8),(9,10),(11,12),(13.14),(15,16),(17,18),(19,20)]
for i in points
random.shuffle(combinations(pointsX,2))
for i in pointsX:
print(i)
for i in combinations(pointsX,2):
print(i)
for i in sorted(combinations(pointsX,2), key=lambda k: random.random()):
print(i)
grg = random.randrange(0,50)
grg
import itertools, random
import numpy as np
r = 10
k = 8
kCombinations = list(itertools.combinations(r, k + 1))
rpm = np.random.permutation(len(kCombinations))
for i in range(len(kCombinations)):
ri = i
i = rpm[i]
subset = kCombinations[i]
import math as m
import random
def combs(n,r):
return m.factorial(n)/(m.factorial(r)*m.factorial(n-r))
def readFile(textFile, method = 1):
vault = []
if method == 1:
with open(textFile) as file:
vault = [tuple(map(int,map(float, line.replace(' ','',2).split(' ')))) for line in file]
return vault
elif method == 2:
with open(textFile) as file:
vault = np.array([list(map(int,map(float, line.replace(' ','',2).split(' ')))) for line in file])
return vault
def random_combination(iterable, r):
"Random selection from itertools.combinations(iterable, r)"
pool = tuple(iterable)
n = len(pool)
indices = sorted(random.sample(range(n), r))
return tuple(pool[i] for i in indices)
FF = readFile('vault/PRU.txt')
FF
for i in range(int(combs(10,9))):
print(random_combination(FF,9))
FF = readFile('Real_XYs/Real_XY108_7.txt')
ff = readFile('Pruebas/Vaults/Vault108_7.txt')
# ff = readFile('Pruebas/Reals/Real_XY108_7.txt')
count = 0
for i in ff:
if i in FF:
count +=1
print(count)
combs(72,9)
| 27.060185 | 115 | 0.60941 |
96fe880dd6827043ef3bb6acb149e8469a47d7bb | 1,225 | hpp | C++ | include/GlobalNamespace/IOpenVRHaptics.hpp | darknight1050/BeatSaber-Quest-Codegen | a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032 | [
"Unlicense"
] | null | null | null | include/GlobalNamespace/IOpenVRHaptics.hpp | darknight1050/BeatSaber-Quest-Codegen | a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032 | [
"Unlicense"
] | null | null | null | include/GlobalNamespace/IOpenVRHaptics.hpp | darknight1050/BeatSaber-Quest-Codegen | a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032 | [
"Unlicense"
] | null | null | null | // Autogenerated from CppHeaderCreator
// Created by Sc2ad
// =========================================================================
#pragma once
// Begin includes
// Completed includes
// Begin forward declares
// Forward declaring namespace: UnityEngine::XR
namespace UnityEngine::XR {
// Forward declaring type: XRNode
struct XRNode;
}
// Completed forward declares
// Type namespace:
namespace GlobalNamespace {
// Size: 0x0
#pragma pack(push, 1)
// Autogenerated type: IOpenVRHaptics
class IOpenVRHaptics {
public:
// Creating value type constructor for type: IOpenVRHaptics
IOpenVRHaptics() noexcept {}
// public System.Void TriggerHapticPulse(UnityEngine.XR.XRNode node, System.Single duration, System.Single strength, System.Single frequency)
// Offset: 0xFFFFFFFF
void TriggerHapticPulse(UnityEngine::XR::XRNode node, float duration, float strength, float frequency);
// public System.Void Destroy()
// Offset: 0xFFFFFFFF
void Destroy();
}; // IOpenVRHaptics
#pragma pack(pop)
}
#include "extern/beatsaber-hook/shared/utils/il2cpp-type-check.hpp"
DEFINE_IL2CPP_ARG_TYPE(GlobalNamespace::IOpenVRHaptics*, "", "IOpenVRHaptics");
| 36.029412 | 146 | 0.678367 |
4a64896a27b8dda7fd4a8e443c9e904a755ee045 | 853 | cs | C# | CSharp/Contests2021/Paken2020Day2/B3.cs | sakapon/AtCoder-Contests | 720a5fe895be7bd0b0e286ea5b9c21531564fc49 | [
"MIT"
] | null | null | null | CSharp/Contests2021/Paken2020Day2/B3.cs | sakapon/AtCoder-Contests | 720a5fe895be7bd0b0e286ea5b9c21531564fc49 | [
"MIT"
] | null | null | null | CSharp/Contests2021/Paken2020Day2/B3.cs | sakapon/AtCoder-Contests | 720a5fe895be7bd0b0e286ea5b9c21531564fc49 | [
"MIT"
] | null | null | null | using System;
class B3
{
static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
static (int, int) Read2() { var a = Read(); return (a[0], a[1]); }
static void Main()
{
var (h, w) = Read2();
var s = Array.ConvertAll(new bool[h], _ => Console.ReadLine());
var dp = NewArray2(h, w, 1 << 30);
dp[h - 1][w - 1] = s[h - 1][w - 1] == 'E' ? 0 : 1;
for (int i = h - 1; i >= 0; i--)
for (int j = w - 1; j >= 0; j--)
{
if (i > 0) dp[i - 1][j] = Math.Min(dp[i - 1][j], dp[i][j] + (s[i - 1][j] == 'S' ? 0 : 1));
if (j > 0) dp[i][j - 1] = Math.Min(dp[i][j - 1], dp[i][j] + (s[i][j - 1] == 'E' ? 0 : 1));
}
Console.WriteLine(dp[0][0]);
}
static T[][] NewArray2<T>(int n1, int n2, T v = default) => Array.ConvertAll(new bool[n1], _ => Array.ConvertAll(new bool[n2], __ => v));
}
| 32.807692 | 139 | 0.474795 |
5b0c2a29fd4c5a74a958b6f1bd1e16bf65b6979a | 1,323 | cpp | C++ | Source/KEngine/src/KEngine/Event/IEventHandler.cpp | yxbh/KEngine | 04d2aced738984f53bf1b2b84b49fbbabfbe6587 | [
"Zlib"
] | 1 | 2020-05-29T03:30:08.000Z | 2020-05-29T03:30:08.000Z | Source/KEngine/src/KEngine/Event/IEventHandler.cpp | yxbh/KEngine | 04d2aced738984f53bf1b2b84b49fbbabfbe6587 | [
"Zlib"
] | null | null | null | Source/KEngine/src/KEngine/Event/IEventHandler.cpp | yxbh/KEngine | 04d2aced738984f53bf1b2b84b49fbbabfbe6587 | [
"Zlib"
] | null | null | null | #include <KEngine/Event/IEventHandler.hpp>
#include <KEngine/Event/EventManager.hpp>
namespace ke
{
IEventHandler::~IEventHandler(void)
{
if (this->isRegistered()) this->deregisterEventListener();
}
void IEventHandler::registerEventListener(void)
{
if (this->isRegistered())
{
ke::Debug::printError("IEventHandler::RegisterEventListener : handler already registered.");
assert(false);
}
this->setRegistered();
}
void IEventHandler::deregisterEventListener(void)
{
if (!this->isRegistered())
{
ke::Debug::printError("IEventHandler::RegisterEventListener : handler already deregistered.");
assert(false);
}
this->setRegistered(false);
}
void IEventHandler::receiveEvent(const ke::EventSptr p_spEvent)
{
m_EventQueue.push(p_spEvent);
}
void IEventHandler::processAllReceivedEvents(void)
{
ke::EventSptr event_sp;
while ((event_sp = this->firstEvent()))
{
if (!event_sp) break; // queue empty, so nullptr returned.
this->handleEvent(event_sp);
}
}
ke::EventSptr IEventHandler::firstEvent(void)
{
return m_EventQueue.pop();
}
bool IEventHandler::isRegistered(void) const
{
return m_IsRegistered;
}
void IEventHandler::setRegistered(const bool p_Registered)
{
m_IsRegistered = p_Registered;
}
} // KE ns | 21.33871 | 102 | 0.697657 |
01b42c301812ca04cc870d03532204bcfb86bd08 | 5,339 | rs | Rust | crates/trace/src/protobuf/mod.rs | lquerel/oltp-arrow | 5ba0ede334b19db37eb86bef6feff5a010aa77d4 | [
"Apache-2.0"
] | 3 | 2021-12-17T19:53:12.000Z | 2022-02-01T22:51:42.000Z | crates/trace/src/protobuf/mod.rs | lquerel/oltp-arrow | 5ba0ede334b19db37eb86bef6feff5a010aa77d4 | [
"Apache-2.0"
] | null | null | null | crates/trace/src/protobuf/mod.rs | lquerel/oltp-arrow | 5ba0ede334b19db37eb86bef6feff5a010aa77d4 | [
"Apache-2.0"
] | null | null | null | use std::time::Instant;
use prost::{EncodeError, Message};
use serde_json::Value;
use crate::BenchmarkResult;
use common::{Attributes, Span};
use oltp::opentelemetry::proto::common::v1::any_value;
use oltp::opentelemetry::proto::common::v1::{AnyValue, KeyValue};
use oltp::opentelemetry::proto::trace;
use oltp::opentelemetry::proto::trace::v1::span::{Event, Link};
use oltp::opentelemetry::proto::trace::v1::{InstrumentationLibrarySpans, ResourceSpans};
pub fn serialize(spans: &[Span], bench_result: &mut BenchmarkResult) -> Result<Vec<u8>, EncodeError> {
let start = Instant::now();
let resource_spans = ResourceSpans {
resource: None,
instrumentation_library_spans: vec![InstrumentationLibrarySpans {
instrumentation_library: None,
spans: spans
.iter()
.map(|span| trace::v1::Span {
trace_id: span.trace_id.clone().into_bytes(),
span_id: span.span_id.clone().into_bytes(),
trace_state: span.trace_state.clone().unwrap_or_else(|| "".into()),
parent_span_id: span.parent_span_id.clone().unwrap_or_else(|| "".into()).into_bytes(),
name: span.name.clone(),
kind: span.kind.unwrap_or(0),
start_time_unix_nano: span.start_time_unix_nano,
end_time_unix_nano: span.end_time_unix_nano.unwrap_or(0),
attributes: attributes(span.attributes.as_ref()),
dropped_attributes_count: span.dropped_attributes_count.unwrap_or(0),
events: span
.events
.as_ref()
.unwrap_or(&vec![])
.iter()
.map(|evt| Event {
time_unix_nano: evt.time_unix_nano,
name: evt.name.clone(),
attributes: attributes(Some(&evt.attributes)),
dropped_attributes_count: evt.dropped_attributes_count.unwrap_or(0),
})
.collect(),
dropped_events_count: span.dropped_events_count.unwrap_or(0),
links: span
.links
.as_ref()
.unwrap_or(&vec![])
.iter()
.map(|link| Link {
trace_id: link.trace_id.clone().into_bytes(),
span_id: link.span_id.clone().into_bytes(),
trace_state: link.trace_state.clone().unwrap_or_else(|| "".into()),
attributes: attributes(Some(&link.attributes)),
dropped_attributes_count: link.dropped_attributes_count.unwrap_or(0),
})
.collect(),
dropped_links_count: span.dropped_links_count.unwrap_or(0),
status: None,
})
.collect(),
schema_url: "".to_string(),
}],
schema_url: "".to_string(),
};
// dbg!(&resource_spans);
let elapse_time = Instant::now() - start;
bench_result.total_buffer_creation_ns += elapse_time.as_nanos();
let start = Instant::now();
let mut buf: Vec<u8> = Vec::new();
resource_spans.encode(&mut buf)?;
let elapse_time = Instant::now() - start;
bench_result.total_buffer_serialization_ns += elapse_time.as_nanos();
Ok(buf)
}
pub fn deserialize(buf: Vec<u8>, bench_result: &mut BenchmarkResult) {
let start = Instant::now();
let resource_spans = ResourceSpans::decode(bytes::Bytes::from(buf)).unwrap();
assert_eq!(resource_spans.instrumentation_library_spans.len(), 1);
let elapse_time = Instant::now() - start;
bench_result.total_buffer_deserialization_ns += elapse_time.as_nanos();
}
fn attributes(attributes: Option<&Attributes>) -> Vec<KeyValue> {
attributes
.iter()
.flat_map(|attributes| {
attributes.iter().filter(|(_, value)| !value.is_null()).map(|(key, value)| KeyValue {
key: key.clone(),
value: match value {
Value::Null => None,
Value::Bool(v) => Some(AnyValue {
value: Some(any_value::Value::BoolValue(*v)),
}),
Value::Number(v) => Some(AnyValue {
value: Some(if v.is_i64() {
any_value::Value::IntValue(v.as_i64().unwrap_or(0))
} else {
any_value::Value::DoubleValue(v.as_f64().unwrap_or(0.0))
}),
}),
Value::String(v) => Some(AnyValue {
value: Some(any_value::Value::StringValue(v.clone())),
}),
Value::Array(_) => unimplemented!("attribute array value not supported"),
Value::Object(_) => {
println!("{} -> {}", key, value);
unimplemented!("attribute object value not supported")
}
},
})
})
.collect()
}
| 44.123967 | 106 | 0.513767 |
4d14ee53e7690125ff1eb83d953aa3ac5cde95e6 | 4,098 | dart | Dart | lib/app/modules/recode/controller.dart | rainstsam/bluevoice | cf7d9faef372c5c8ee6dad9d542c3a71ede5f919 | [
"Apache-2.0"
] | null | null | null | lib/app/modules/recode/controller.dart | rainstsam/bluevoice | cf7d9faef372c5c8ee6dad9d542c3a71ede5f919 | [
"Apache-2.0"
] | null | null | null | lib/app/modules/recode/controller.dart | rainstsam/bluevoice | cf7d9faef372c5c8ee6dad9d542c3a71ede5f919 | [
"Apache-2.0"
] | null | null | null | // ignore_for_file: import_of_legacy_library_into_null_safe
/*
* @Descripttion:
* @version: 0.1.0
* @Author: rainstsam
* @Date: 2021-09-10 23:49:04
* @LastEditors: rainstsam
* @LastEditTime: 2021-09-23 23:04:44
*/
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter_sound/flutter_sound.dart';
import 'package:flutter_sound_platform_interface/flutter_sound_recorder_platform_interface.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:get/get.dart';
import 'package:bluevoice/app/routes/app_pages.dart';
import 'package:bluevoice/common/utils/fileutils.dart';
import 'package:bluevoice/common/utils/souldutils.dart';
// import './util/recorder_state.dart';
import 'index.dart';
typedef Fn = void Function();
class RecodeController extends GetxController {
RecodeController();
/// 响应式成员变量
// List<String> records = [];
final state = RecodeState();
/// 成员变量
FlutterSoundRecorder recorderModule = FlutterSoundRecorder();
static int _timer = 5 * 60 * 1000;
/// 事件
init() async {
var prefs = await SharedPreferences.getInstance();
var Source = prefs.getString('AudioSource');
if (Source == 'mic') {
state.audioSource = AudioSource.microphone;
} else if (Source == 'bluemic') {
state.audioSource = AudioSource.bluetoothHFP;
} else if (Source == 'blue') {
state.audioSource = AudioSource.defaultSource;
}
if (!state.initialized) {
await initializeDateFormatting();
await recorderModule.openAudioSession(focus: AudioFocus.requestFocus);
state.initialized = true;
}
state.basepash = await saveVoiceDirectory(Get.arguments.title);
if (!kIsWeb) {
var status = Permission.microphone.request();
status.then((stat) {
if (stat != PermissionStatus.granted) {
throw RecordingPermissionException(
'Microphone permission not granted');
}
});
}
}
Fn? onTapStartStop() {
if (!state.isDisabled) {
if (state.isRecording || state.isPaused) {
stopRecorder();
} else {
startRecorder();
}
}
}
void goHome() {
Get.offNamed(Paths.Tasklist);
}
/// stops the recorder.
void stopRecorder() async {
await recorderModule.stopRecorder();
state.isRecording = false;
state.isStopped = true;
}
/// starts the recorder.
void startRecorder() async {
try {
var fileurl = await strogeFile(state.basepash, suffix: 'aac');
print('fileurl is' + fileurl!);
await recorderModule.startRecorder(
toFile: fileurl, audioSource: state.audioSource);
state.isRecording = true;
state.isStopped = false;
} on Exception catch (err) {
print('startRecorder error: $err');
await recorderModule.stopRecorder();
}
}
/// toggles the pause/resume start of the recorder
void pauseRecorder() {
assert(recorderModule.isRecording || recorderModule.isPaused);
recorderModule.pauseRecorder();
}
void resumeRecorder() {
assert(recorderModule.isRecording || recorderModule.isPaused);
recorderModule.resumeRecorder();
}
/// 生命周期
///在 widget 内存中分配后立即调用。
///你可以用它来为控制器初始化 initialize 一些东西。
@override
void onInit() async {
super.onInit();
await init();
// new 对象
// 初始静态数据
}
///在 onInit() 之后调用 1 帧。这是进入的理想场所
///导航事件,例如 snackbar、对话框或新route,或
///async 异步请求。
@override
void onReady() async {
var fileurl = await strogeFile(state.basepash, suffix: 'aac');
print('fileurl is' + fileurl!);
state.track = Track(trackPath: fileurl, codec: ActiveCodec().codec!);
// state.track = track;
super.onReady();
}
///在 [onDelete] 方法之前调用。 [onClose] 可能用于
@override
void onClose() {
super.onClose();
// 1 stop & close 关闭对象
// 2 save 持久化数据
}
///dispose 释放内存
@override
void dispose() {
super.dispose();
state.initialized = false;
// dispose 释放对象
}
}
| 23.825581 | 97 | 0.663738 |
0b610800704e8c840fbc0a2a516adbeed8570f93 | 3,479 | py | Python | problems/problem3.py | JakobHavtorn/euler | b5ca0b4393dc9a6d6e0623e0df5b96f803e116ab | [
"MIT"
] | null | null | null | problems/problem3.py | JakobHavtorn/euler | b5ca0b4393dc9a6d6e0623e0df5b96f803e116ab | [
"MIT"
] | null | null | null | problems/problem3.py | JakobHavtorn/euler | b5ca0b4393dc9a6d6e0623e0df5b96f803e116ab | [
"MIT"
] | null | null | null | """Largest prime factor
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143?
"""
import math
import numpy as np
def largest_prime_factor_naive(number):
"""
Let the given number be n and let k = 2, 3, 4, 5, ... .
For each k, if it is a factor of n then we divide n by k and completely divide out each k before moving to the next k.
It can be seen that when k is a factor it will necessarily be prime, as all smaller factors have been removed,
and the final result of this process will be n = 1.
"""
factor = 2
factors = []
while number > 1:
if number % factor == 0:
factors.append(factor)
number = number // factor # Remainder guarenteed to be zero
while number % factor == 0:
number = number // factor # Remainder guarenteed to be zero
factor += 1
return factors
def largest_prime_factor_even_optimized(number):
"""
We know that, excluding 2, there are no even prime numbers.
So we can increase factor by 2 per iteration after having found the
"""
factors = []
factor = 2
if number % factor == 0:
number = number // factor
factors.append(factor)
while number % factor == 0:
number = number // factor
factor = 3
while number > 1:
if number % factor == 0:
factors.append(factor)
number = number // factor # Remainder guarenteed to be zero
while number % factor == 0:
number = number // factor # Remainder guarenteed to be zero
factor += 2
return factors
def largest_prime_factor_square_optimized(number):
"""
Every number n can at most have one prime factor greater than n.
If we, after dividing out some prime factor, calculate the square root of the remaining number
we can use that square root as upper limit for factor.
If factor exceeds this square root we know the remaining number is prime.
"""
factors = []
factor = 2
if number % factor == 0:
number = number // factor
factors.append(factor)
while number % factor == 0:
number = number // factor
factor = 3
max_factor = math.sqrt(number)
while number > 1 and factor <= max_factor:
if number % factor == 0:
factors.append(factor)
number = number // factor
while number % factor == 0:
number = number // factor
max_factor = math.sqrt(number)
factor += 2
return factors
def idx_sieve(length):
"""Static length sieve-based prime generator"""
primes = []
is_prime = np.array([True]*length)
i = 2
while i < length:
if is_prime[i]:
is_prime[np.arange(i, length, i)] = False
primes.append(i)
else:
i += 1
return primes
def prime_factor(n, primes):
i = 0
factors = []
while n != 1:
while (n % primes[i]) != 0:
i += 1
factors.append(primes[i])
n = n / primes[i]
return factors
if __name__ == '__main__':
number = 600851475143
print(largest_prime_factor_naive(number))
print(largest_prime_factor_even_optimized(number))
print(largest_prime_factor_square_optimized(number))
number = 600851475143
primes = idx_sieve(20000)
print(max(prime_factor(number, primes)))
| 28.516393 | 122 | 0.603334 |
166a6daeb6b5c17ae0ac5c685dad9678e54c0049 | 461 | c | C | lib/libc/musl/compat/time32/ftime32.c | aruniiird/zig | fd47839064775c0cc956f12a012f0893e1f3a440 | [
"MIT"
] | 12,718 | 2018-05-25T02:00:44.000Z | 2022-03-31T23:03:51.000Z | lib/libc/musl/compat/time32/ftime32.c | aruniiird/zig | fd47839064775c0cc956f12a012f0893e1f3a440 | [
"MIT"
] | 8,483 | 2018-05-23T16:22:39.000Z | 2022-03-31T22:18:16.000Z | lib/libc/musl/compat/time32/ftime32.c | aruniiird/zig | fd47839064775c0cc956f12a012f0893e1f3a440 | [
"MIT"
] | 1,400 | 2018-05-24T22:35:25.000Z | 2022-03-31T21:32:48.000Z | #include "time32.h"
#include <sys/timeb.h>
#include <errno.h>
#include <stdint.h>
struct timeb32 {
int32_t time;
unsigned short millitm;
short timezone, dstflag;
};
int __ftime32(struct timeb32 *tp)
{
struct timeb tb;
if (ftime(&tb) < 0) return -1;
if (tb.time < INT32_MIN || tb.time > INT32_MAX) {
errno = EOVERFLOW;
return -1;
}
tp->time = tb.time;
tp->millitm = tb.millitm;
tp->timezone = tb.timezone;
tp->dstflag = tb.dstflag;
return 0;
}
| 17.730769 | 50 | 0.663774 |
e633de9ec1a9732020f060bc780c14258acdc9df | 9,747 | go | Go | pkg/resourcewatcher/k8s_store.go | tyzbit/kubectl-fzf | bb281ccb776ebc1e30b32cccac7ba137b5887dfd | [
"MIT"
] | 357 | 2018-10-31T15:55:23.000Z | 2022-02-08T02:53:52.000Z | pkg/resourcewatcher/k8s_store.go | tyzbit/kubectl-fzf | bb281ccb776ebc1e30b32cccac7ba137b5887dfd | [
"MIT"
] | 23 | 2019-04-22T20:10:08.000Z | 2022-01-12T11:11:13.000Z | pkg/resourcewatcher/k8s_store.go | tyzbit/kubectl-fzf | bb281ccb776ebc1e30b32cccac7ba137b5887dfd | [
"MIT"
] | 30 | 2019-01-09T22:56:37.000Z | 2022-01-29T21:19:54.000Z | package resourcewatcher
import (
"context"
"fmt"
"os"
"path"
"sort"
"strings"
"sync"
"time"
"kubectlfzf/pkg/k8sresources"
"kubectlfzf/pkg/util"
"github.com/golang/glog"
"github.com/pkg/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/tools/cache"
)
type LabelKey struct {
Namespace string
Label string
}
type LabelPair struct {
Key LabelKey
Occurrences int
}
type LabelPairList []LabelPair
func (p LabelPairList) Len() int { return len(p) }
func (p LabelPairList) Less(i, j int) bool {
if p[i].Occurrences == p[j].Occurrences {
if p[i].Key.Namespace == p[j].Key.Namespace {
return p[i].Key.Label < p[j].Key.Label
}
return p[i].Key.Namespace < p[j].Key.Namespace
}
return p[i].Occurrences > p[j].Occurrences
}
func (p LabelPairList) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
// K8sStore stores the current state of k8s resources
type K8sStore struct {
data map[string]k8sresources.K8sResource
labelMap map[LabelKey]int
resourceCtor func(obj interface{}, config k8sresources.CtorConfig) k8sresources.K8sResource
ctorConfig k8sresources.CtorConfig
resourceName string
currentFile *os.File
storeConfig StoreConfig
firstWrite bool
destDir string
dataMutex sync.Mutex
labelMutex sync.Mutex
fileMutex sync.Mutex
labelToDump bool
lastFullDump time.Time
lastLabelDump time.Time
}
// StoreConfig defines parameters used for the cache location
type StoreConfig struct {
ClusterDir string
CacheDir string
TimeBetweenFullDump time.Duration
}
// NewK8sStore creates a new store
func NewK8sStore(ctx context.Context, cfg WatchConfig, storeConfig StoreConfig, ctorConfig k8sresources.CtorConfig) (*K8sStore, error) {
k := K8sStore{}
k.destDir = path.Join(storeConfig.CacheDir, storeConfig.ClusterDir)
k.data = make(map[string]k8sresources.K8sResource, 0)
k.labelMap = make(map[LabelKey]int, 0)
k.resourceCtor = cfg.resourceCtor
k.resourceName = cfg.resourceName
k.currentFile = nil
k.storeConfig = storeConfig
k.firstWrite = true
k.ctorConfig = ctorConfig
k.lastLabelDump = time.Time{}
k.lastFullDump = time.Time{}
go k.periodicLabelDump(ctx)
err := util.WriteStringToFile(cfg.header, k.destDir, k.resourceName, "header")
if err != nil {
return &k, err
}
return &k, nil
}
func resourceKey(obj interface{}) (string, string, map[string]string) {
name := "None"
namespace := "None"
var labels map[string]string
switch v := obj.(type) {
case metav1.ObjectMetaAccessor:
o := v.GetObjectMeta()
namespace = o.GetNamespace()
name = o.GetName()
labels = o.GetLabels()
case *unstructured.Unstructured:
metadata := v.Object["metadata"].(map[string]interface{})
name = metadata["name"].(string)
namespace = metadata["namespace"].(string)
labels = metadata["labels"].(map[string]string)
default:
glog.Warningf("Unknown type %v", obj)
}
return fmt.Sprintf("%s_%s", namespace, name), namespace, labels
}
func (k *K8sStore) periodicLabelDump(ctx context.Context) {
ticker := time.NewTicker(time.Second * 5)
for {
select {
case <-ctx.Done():
return
case <-ticker.C:
k.labelMutex.Lock()
if k.labelToDump {
k.dumpLabel()
}
k.labelMutex.Unlock()
}
}
}
func (k *K8sStore) resetLabelMap() {
k.labelMutex.Lock()
k.labelMap = make(map[LabelKey]int, 0)
k.labelMutex.Unlock()
}
func (k *K8sStore) updateLabelMap(namespace string, labels map[string]string, delta int) {
k.labelMutex.Lock()
for labelKey, labelValue := range labels {
k.labelMap[LabelKey{namespace, fmt.Sprintf("%s=%s", labelKey, labelValue)}] += delta
}
k.labelMutex.Unlock()
}
// AddResourceList clears current state add the objects to the store.
// It will trigger a full dump
// This is used for polled resources, no need for mutex
func (k *K8sStore) AddResourceList(lstRuntime []runtime.Object) {
k.data = make(map[string]k8sresources.K8sResource, 0)
k.resetLabelMap()
for _, runtimeObject := range lstRuntime {
key, ns, labels := resourceKey(runtimeObject)
resource := k.resourceCtor(runtimeObject, k.ctorConfig)
k.data[key] = resource
k.updateLabelMap(ns, labels, 1)
}
err := k.DumpFullState()
if err != nil {
glog.Warningf("Error when dumping state: %v", err)
}
}
// AddResource adds a new k8s object to the store
func (k *K8sStore) AddResource(obj interface{}) {
key, ns, labels := resourceKey(obj)
newObj := k.resourceCtor(obj, k.ctorConfig)
glog.V(11).Infof("%s added: %s", k.resourceName, key)
k.dataMutex.Lock()
k.data[key] = newObj
k.dataMutex.Unlock()
k.updateLabelMap(ns, labels, 1)
err := k.AppendNewObject(newObj)
if err != nil {
glog.Warningf("Error when appending new object to current state: %v", err)
}
}
// DeleteResource removes an existing k8s object to the store
func (k *K8sStore) DeleteResource(obj interface{}) {
key := "Unknown"
ns := "Unknown"
var labels map[string]string
switch v := obj.(type) {
case cache.DeletedFinalStateUnknown:
key, ns, labels = resourceKey(v.Obj)
case unstructured.Unstructured:
case metav1.ObjectMetaAccessor:
key, ns, labels = resourceKey(obj)
default:
glog.V(6).Infof("Unknown object type %v", obj)
return
}
glog.V(11).Infof("%s deleted: %s", k.resourceName, key)
k.dataMutex.Lock()
delete(k.data, key)
k.dataMutex.Unlock()
k.updateLabelMap(ns, labels, -1)
err := k.DumpFullState()
if err != nil {
glog.Warningf("Error when dumping state: %v", err)
}
}
// UpdateResource update an existing k8s object
func (k *K8sStore) UpdateResource(oldObj, newObj interface{}) {
key, _, _ := resourceKey(newObj)
k8sObj := k.resourceCtor(newObj, k.ctorConfig)
k.dataMutex.Lock()
if k8sObj.HasChanged(k.data[key]) {
glog.V(11).Infof("%s changed: %s", k.resourceName, key)
k.data[key] = k8sObj
k.dataMutex.Unlock()
// TODO Handle label diff
// k.updateLabelMap(ns, labels, 1)
err := k.DumpFullState()
if err != nil {
glog.Warningf("Error when dumping state: %v", err)
}
} else {
k.dataMutex.Unlock()
}
}
func (k *K8sStore) updateCurrentFile() (err error) {
destFile := path.Join(k.destDir, fmt.Sprintf("%s_%s", k.resourceName, "resource"))
k.currentFile, err = os.OpenFile(destFile, os.O_APPEND|os.O_WRONLY, 0644)
return err
}
// AppendNewObject appends a new object to the cache dump
func (k *K8sStore) AppendNewObject(resource k8sresources.K8sResource) error {
k.fileMutex.Lock()
if k.currentFile == nil {
var err error
err = util.WriteStringToFile(resource.ToString(), k.destDir, k.resourceName, "resource")
if err != nil {
k.fileMutex.Unlock()
return err
}
err = k.updateCurrentFile()
if err != nil {
k.fileMutex.Unlock()
return err
}
glog.Infof("Initial write of %s", k.currentFile.Name())
}
_, err := k.currentFile.WriteString(resource.ToString())
k.fileMutex.Unlock()
if err != nil {
return err
}
now := time.Now()
k.labelMutex.Lock()
delta := now.Sub(k.lastLabelDump)
if delta < time.Second {
k.labelToDump = true
}
k.labelMutex.Unlock()
return nil
}
func (k *K8sStore) dumpLabel() error {
glog.V(8).Infof("Dump of label file %s", k.resourceName)
k.lastLabelDump = time.Now()
labelOutput, err := k.generateLabel()
if err != nil {
return errors.Wrapf(err, "Error generating label output")
}
err = util.WriteStringToFile(labelOutput, k.destDir, k.resourceName, "label")
if err != nil {
return errors.Wrapf(err, "Error writing label file")
}
k.labelToDump = false
return nil
}
func (k *K8sStore) generateLabel() (string, error) {
k.labelMutex.Lock()
pl := make(LabelPairList, len(k.labelMap))
i := 0
for key, occurrences := range k.labelMap {
pl[i] = LabelPair{key, occurrences}
i++
}
k.labelMutex.Unlock()
sort.Sort(pl)
var res strings.Builder
for _, pair := range pl {
var str string
if pair.Key.Namespace == "" {
str = fmt.Sprintf("%s %s %d\n",
k.ctorConfig.Cluster, pair.Key.Label, pair.Occurrences)
} else {
str = fmt.Sprintf("%s %s %s %d\n",
k.ctorConfig.Cluster, pair.Key.Namespace, pair.Key.Label, pair.Occurrences)
}
_, err := res.WriteString(str)
if err != nil {
return "", errors.Wrapf(err, "Error writing string %s",
str)
}
}
return strings.Trim(res.String(), "\n"), nil
}
func (k *K8sStore) generateOutput() (string, error) {
k.dataMutex.Lock()
var res strings.Builder
keys := make([]string, len(k.data))
i := 0
for key := range k.data {
keys[i] = key
i = i + 1
}
sort.Strings(keys)
for _, key := range keys {
v := k.data[key]
_, err := res.WriteString(v.ToString())
if err != nil {
k.dataMutex.Unlock()
return "", errors.Wrapf(err, "Error writing string %s",
v.ToString())
}
}
k.dataMutex.Unlock()
return res.String(), nil
}
// DumpFullState writes the full state to the cache file
func (k *K8sStore) DumpFullState() error {
glog.V(8).Infof("Dump full state of %s", k.resourceName)
now := time.Now()
delta := now.Sub(k.lastFullDump)
if delta < k.storeConfig.TimeBetweenFullDump {
glog.V(10).Infof("Last full dump for %s happened %s ago, ignoring it", k.resourceName, delta)
return nil
}
k.lastFullDump = now
glog.V(8).Infof("Doing full dump %d %s", len(k.data), k.resourceName)
resourceOutput, err := k.generateOutput()
if err != nil {
return errors.Wrapf(err, "Error generating output")
}
err = util.WriteStringToFile(resourceOutput, k.destDir, k.resourceName, "resource")
if err != nil {
return err
}
err = k.updateCurrentFile()
if err != nil {
return err
}
labelOutput, err := k.generateLabel()
if err != nil {
return errors.Wrapf(err, "Error generating label output")
}
err = util.WriteStringToFile(labelOutput, k.destDir, k.resourceName, "label")
return err
}
| 26.414634 | 136 | 0.692521 |
75fc8ebedc9aebdd7b1568af97829dabc009fe3d | 494 | cs | C# | EventPlayer/Player/Player.cs | baseman/eventPlayer.Sharp | d40c049f0a1fc97d24b91c3bed4e6e41d3073d71 | [
"MIT"
] | null | null | null | EventPlayer/Player/Player.cs | baseman/eventPlayer.Sharp | d40c049f0a1fc97d24b91c3bed4e6e41d3073d71 | [
"MIT"
] | null | null | null | EventPlayer/Player/Player.cs | baseman/eventPlayer.Sharp | d40c049f0a1fc97d24b91c3bed4e6e41d3073d71 | [
"MIT"
] | null | null | null | using EventPlayer.Event;
namespace EventPlayer.Player
{
using Model;
public class Player<TModel>
where TModel : Aggregate<TModel>
{
public virtual void PlayFor(TModel model, PlayEvent<TModel>[] events)
{
foreach (var evt in events)
{
evt.ApplyTo(model);
}
}
public void PlayFor(TModel model, PlayEvent<TModel> actualEvt)
{
actualEvt.ApplyTo(model);
}
}
} | 21.478261 | 77 | 0.548583 |
8044ed2f0ccca7f88c3095eedf549b805b229bd9 | 5,840 | java | Java | hazelcast-sql/src/test/java/com/hazelcast/jet/sql/impl/index/IndexInFilterIterationTest.java | ivanthescientist/hazelcast | decb95e87a776056436e98c057112313b55b20fb | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2022-03-29T02:44:32.000Z | 2022-03-29T02:44:32.000Z | hazelcast-sql/src/test/java/com/hazelcast/jet/sql/impl/index/IndexInFilterIterationTest.java | ivanthescientist/hazelcast | decb95e87a776056436e98c057112313b55b20fb | [
"ECL-2.0",
"Apache-2.0"
] | 296 | 2022-01-10T10:22:34.000Z | 2022-03-31T02:34:25.000Z | hazelcast-sql/src/test/java/com/hazelcast/jet/sql/impl/index/IndexInFilterIterationTest.java | kedar-joshi/hazelcast | 8dad09e5249e95aaafe47eefc88267e67d952f01 | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2022-02-22T13:14:04.000Z | 2022-02-22T13:14:04.000Z | /*
* Copyright 2021 Hazelcast Inc.
*
* Licensed under the Hazelcast Community License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://hazelcast.com/hazelcast-community-license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hazelcast.jet.sql.impl.index;
import com.hazelcast.config.IndexConfig;
import com.hazelcast.config.IndexType;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.map.IMap;
import com.hazelcast.query.impl.InternalIndex;
import com.hazelcast.sql.impl.exec.scan.index.IndexEqualsFilter;
import com.hazelcast.sql.impl.exec.scan.index.IndexInFilter;
import com.hazelcast.sql.impl.expression.ExpressionEvalContext;
import com.hazelcast.test.HazelcastParallelParametersRunnerFactory;
import com.hazelcast.test.HazelcastParametrizedRunner;
import com.hazelcast.test.annotation.ParallelJVMTest;
import com.hazelcast.test.annotation.QuickTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.Arrays;
import java.util.Collection;
import static java.util.Arrays.asList;
import static org.junit.runners.Parameterized.UseParametersRunnerFactory;
@RunWith(HazelcastParametrizedRunner.class)
@UseParametersRunnerFactory(HazelcastParallelParametersRunnerFactory.class)
@Category({QuickTest.class, ParallelJVMTest.class})
public class IndexInFilterIterationTest extends IndexFilterIteratorTestSupport {
@Parameterized.Parameters(name = "descendingDirection:{0}")
public static Collection<Object[]> parameters() {
return asList(new Object[][]{{true}, {false}});
}
@Parameterized.Parameter
public boolean descendingDirection;
@Test
public void test_sorted() {
check(IndexType.SORTED);
}
@Test
public void test_hash() {
check(IndexType.HASH);
}
private void check(IndexType indexType) {
HazelcastInstance instance = factory.newHazelcastInstance(getConfig());
IMap<Integer, Value> map = instance.getMap(MAP_NAME);
map.addIndex(new IndexConfig().setName(INDEX_NAME).setType(indexType).addAttribute("value1"));
InternalIndex index = getIndex(instance);
ExpressionEvalContext evalContext = createExpressionEvalContext();
map.put(1, new Value(null));
map.put(2, new Value(0));
map.put(3, new Value(1));
// No values from both filters
checkIterator(indexType, descendingDirection, in(equals(2), equals(3)).getEntries(index, descendingDirection, evalContext));
checkIterator(indexType, descendingDirection, in(equals(3), equals(2)).getEntries(index, descendingDirection, evalContext));
// No values from one filter
checkIterator(indexType, descendingDirection, in(equals(1), equals(2)).getEntries(index, descendingDirection, evalContext), 3);
checkIterator(indexType, descendingDirection, in(equals(2), equals(1)).getEntries(index, descendingDirection, evalContext), 3);
checkIterator(indexType, descendingDirection, in(equals(null, true), equals(2)).getEntries(index, descendingDirection, evalContext), 1);
checkIterator(indexType, descendingDirection, in(equals(2), equals(null, true)).getEntries(index, descendingDirection, evalContext), 1);
// Values from both filters
checkIterator(indexType, descendingDirection, in(equals(0), equals(1)).getEntries(index, descendingDirection, evalContext), 2, 3);
checkIterator(indexType, descendingDirection, in(equals(1), equals(0)).getEntries(index, descendingDirection, evalContext), 2, 3);
checkIterator(indexType, descendingDirection, in(equals(null, true), equals(0)).getEntries(index, descendingDirection, evalContext), 1, 2);
checkIterator(indexType, descendingDirection, in(equals(0), equals(null, true)).getEntries(index, descendingDirection, evalContext), 1, 2);
// One distinct value
checkIterator(indexType, descendingDirection, in(equals(0), equals(0)).getEntries(index, descendingDirection, evalContext), 2);
checkIterator(indexType, descendingDirection, in(equals(null, true), equals(null, true)).getEntries(index, descendingDirection, evalContext), 1);
// One null value
checkIterator(indexType, descendingDirection, in(equals(0), equals(null, false)).getEntries(index, descendingDirection, evalContext), 2);
checkIterator(indexType, descendingDirection, in(equals(null, false), equals(0)).getEntries(index, descendingDirection, evalContext), 2);
checkIterator(indexType, descendingDirection, in(equals(null, false), equals(null, true)).getEntries(index, descendingDirection, evalContext), 1);
checkIterator(indexType, descendingDirection, in(equals(null, true), equals(null, false)).getEntries(index, descendingDirection, evalContext), 1);
// Two null values
checkIterator(indexType, descendingDirection, in(equals(null, false), equals(null, false)).getEntries(index, descendingDirection, evalContext));
}
private static IndexInFilter in(IndexEqualsFilter... filters) {
assert filters != null;
return new IndexInFilter(Arrays.asList(filters));
}
private static IndexEqualsFilter equals(Integer value) {
return equals(value, false);
}
private static IndexEqualsFilter equals(Integer value, boolean allowNulls) {
return new IndexEqualsFilter(intValue(value, allowNulls));
}
}
| 46.349206 | 154 | 0.747432 |
8f0c5f23ebc0df435f9800bc46d339fd2398b944 | 1,256 | java | Java | examples/movies/src-gen/com/robotoworks/example/movies/db/AbstractMovieDBOpenHelper.java | fluxtah/mechanoid | 1c35bab2a7d524aa4108b5b66fa0bd65368ff774 | [
"Apache-2.0"
] | null | null | null | examples/movies/src-gen/com/robotoworks/example/movies/db/AbstractMovieDBOpenHelper.java | fluxtah/mechanoid | 1c35bab2a7d524aa4108b5b66fa0bd65368ff774 | [
"Apache-2.0"
] | null | null | null | examples/movies/src-gen/com/robotoworks/example/movies/db/AbstractMovieDBOpenHelper.java | fluxtah/mechanoid | 1c35bab2a7d524aa4108b5b66fa0bd65368ff774 | [
"Apache-2.0"
] | null | null | null | /*
* Generated by Robotoworks Mechanoid
*/
package com.robotoworks.example.movies.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import com.robotoworks.mechanoid.db.MechanoidSQLiteOpenHelper;
import com.robotoworks.mechanoid.db.SQLiteMigration;
import com.robotoworks.example.movies.db.migrations.DefaultMovieDBMigrationV1;
public abstract class AbstractMovieDBOpenHelper extends MechanoidSQLiteOpenHelper {
private static final String DATABASE_NAME = "MovieDB.db";
public static final int VERSION = 1;
public interface Sources {
String MOVIES = "movies";
}
public AbstractMovieDBOpenHelper(Context context) {
super(context, DATABASE_NAME, null, VERSION);
}
public AbstractMovieDBOpenHelper(Context context, String name) {
super(context, name, null, VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
applyMigrations(db, 0, VERSION);
}
@Override
protected SQLiteMigration createMigration(int version) {
switch(version) {
case 0:
return createMovieDBMigrationV1();
default:
throw new IllegalStateException("No migration for version " + version);
}
}
protected SQLiteMigration createMovieDBMigrationV1() {
return new DefaultMovieDBMigrationV1();
}
}
| 25.12 | 83 | 0.778662 |
fe17e0a6f7e73df2d139e79e3218f74b84a01b57 | 807 | h | C | Source/Pineapple/Engine/Graphics/RenderSystem.h | JoshYaxley/Pineapple | 490b0ccdfa26e2bb6fd9ec290b43b355462dd9ec | [
"Zlib"
] | 11 | 2017-04-15T14:44:19.000Z | 2022-02-04T13:16:04.000Z | Source/Pineapple/Engine/Graphics/RenderSystem.h | JoshYaxley/Pineapple | 490b0ccdfa26e2bb6fd9ec290b43b355462dd9ec | [
"Zlib"
] | 25 | 2017-04-19T12:48:42.000Z | 2020-05-09T05:28:29.000Z | Source/Pineapple/Engine/Graphics/RenderSystem.h | JoshYaxley/Pineapple | 490b0ccdfa26e2bb6fd9ec290b43b355462dd9ec | [
"Zlib"
] | 1 | 2019-04-21T21:14:04.000Z | 2019-04-21T21:14:04.000Z | /*------------------------------------------------------------------------------
Pineapple Game Engine - Copyright (c) 2011-2017 Adam Yaxley
This software is licensed under the Zlib license (see license.txt for details)
------------------------------------------------------------------------------*/
#pragma once
#include <list>
namespace pa
{
class Render;
class RenderSystem
{
public:
friend Render;
using Handle = std::list<Render*>::const_iterator;
void renderUnordered();
void renderOrdered();
private:
Handle registerOrdered(Render* renderable);
void unregisterOrdered(const Handle handle);
Handle registerUnordered(Render* renderable);
void unregisterUnordered(const Handle handle);
std::list<Render*> m_unorderedList;
std::list<Render*> m_orderedList;
};
}
| 21.810811 | 80 | 0.592317 |
80d879ba449553e6232e804a6dc353d01e352835 | 5,753 | java | Java | src/main/java/com/btk5h/skriptmirror/skript/custom/effect/CustomEffectSection.java | Pikachu920/skript-reflect | a13915ccf05ed7d9b073abb28bd8fab9006dd367 | [
"MIT"
] | 33 | 2020-07-21T11:12:36.000Z | 2022-03-19T13:36:48.000Z | src/main/java/com/btk5h/skriptmirror/skript/custom/effect/CustomEffectSection.java | Tominous/skript-reflect | db111c67ccc85e6d2bb6fcd8d6aed9ea036f5381 | [
"MIT"
] | 27 | 2020-07-23T12:58:45.000Z | 2022-03-27T17:09:13.000Z | src/main/java/com/btk5h/skriptmirror/skript/custom/effect/CustomEffectSection.java | Tominous/skript-reflect | db111c67ccc85e6d2bb6fcd8d6aed9ea036f5381 | [
"MIT"
] | 17 | 2020-08-13T01:00:20.000Z | 2022-03-26T00:04:59.000Z | package com.btk5h.skriptmirror.skript.custom.effect;
import ch.njol.skript.Skript;
import ch.njol.skript.config.Node;
import ch.njol.skript.config.SectionNode;
import ch.njol.skript.lang.Effect;
import ch.njol.skript.lang.Literal;
import ch.njol.skript.lang.SkriptParser;
import ch.njol.skript.lang.SyntaxElementInfo;
import ch.njol.skript.lang.Trigger;
import ch.njol.skript.lang.TriggerItem;
import ch.njol.skript.log.SkriptLogger;
import com.btk5h.skriptmirror.skript.custom.CustomSyntaxSection;
import com.btk5h.skriptmirror.skript.custom.PreloadListener;
import com.btk5h.skriptmirror.skript.custom.SyntaxParseEvent;
import com.btk5h.skriptmirror.util.SkriptUtil;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Supplier;
public class CustomEffectSection extends CustomSyntaxSection<EffectSyntaxInfo> {
public static boolean customEffectsUsed = false;
static {
String[] syntax = {
"[(1¦local)] effect <.+>",
"[(1¦local)] effect"
};
CustomSyntaxSection.register("Define Effect", CustomEffectSection.class, syntax);
PreloadListener.addSyntax(CustomEffectSection.class, syntax);
}
private static final DataTracker<EffectSyntaxInfo> dataTracker = new DataTracker<>();
static final Map<EffectSyntaxInfo, Trigger> effectHandlers = new HashMap<>();
static final Map<EffectSyntaxInfo, Trigger> parserHandlers = new HashMap<>();
static final Map<EffectSyntaxInfo, List<Supplier<Boolean>>> usableSuppliers = new HashMap<>();
static final Map<EffectSyntaxInfo, Boolean> parseSectionLoaded = new HashMap<>();
static {
Skript.registerEffect(CustomEffect.class);
Optional<SyntaxElementInfo<? extends Effect>> info = Skript.getEffects().stream()
.filter(i -> i.c == CustomEffect.class)
.findFirst();
info.ifPresent(dataTracker::setInfo);
dataTracker.addManaged(effectHandlers);
dataTracker.addManaged(parserHandlers);
dataTracker.addManaged(usableSuppliers);
dataTracker.addManaged(parseSectionLoaded);
}
@Override
public DataTracker<EffectSyntaxInfo> getDataTracker() {
return dataTracker;
}
@Override
protected boolean init(Literal<?>[] args, int matchedPattern, SkriptParser.ParseResult parseResult,
SectionNode node, boolean isPreload) {
customEffectsUsed = true;
if (!isPreloaded) {
SectionNode patterns = (SectionNode) node.get("patterns");
File script = (parseResult.mark & 1) == 1 ? SkriptUtil.getCurrentScript() : null;
switch (matchedPattern) {
case 0:
register(EffectSyntaxInfo.create(script, parseResult.regexes.get(0).group(), 1));
break;
case 1:
if (patterns == null) {
Skript.error("Custom effects without inline patterns must have a patterns section.");
return false;
}
int i = 1;
for (Node subNode : patterns) {
register(EffectSyntaxInfo.create(script, subNode.getKey(), i++));
}
break;
}
if (matchedPattern != 1 && patterns != null) {
Skript.error("Custom effects with inline patterns may not have a patterns section.");
return false;
}
if (node.get("parse") != null) {
if (node.get("safe parse") != null) {
Skript.error("You can't have two parse sections");
return false;
}
whichInfo.forEach(which -> parseSectionLoaded.put(which, false));
} else {
SectionNode safeParseNode = (SectionNode) node.get("safe parse");
if (safeParseNode != null) {
SyntaxParseEvent.register(this, safeParseNode, whichInfo, parserHandlers);
whichInfo.forEach(which -> parseSectionLoaded.put(which, true));
}
}
}
AtomicBoolean hasTrigger = new AtomicBoolean();
boolean nodesOkay = handleEntriesAndSections(node,
entryNode -> false,
sectionNode -> {
String key = sectionNode.getKey();
assert key != null;
if (key.equalsIgnoreCase("patterns")) {
return true;
}
if (key.equalsIgnoreCase("usable in")) {
return handleUsableSection(sectionNode, usableSuppliers);
}
if (key.equalsIgnoreCase("trigger")) {
hasTrigger.set(true);
return true;
}
if (key.equalsIgnoreCase("parse"))
return true;
if (key.equalsIgnoreCase("safe parse"))
return true;
return false;
});
if (!nodesOkay)
return false;
if (!hasTrigger.get())
Skript.warning("Custom effects are useless without a trigger section");
if (!isPreload) {
SectionNode sectionNode = (SectionNode) node.get("parse");
if (sectionNode != null) {
SkriptLogger.setNode(sectionNode);
SyntaxParseEvent.register(this, sectionNode, whichInfo, parserHandlers);
whichInfo.forEach(which -> parseSectionLoaded.put(which, true));
}
sectionNode = (SectionNode) node.get("trigger");
if (sectionNode != null) {
SkriptLogger.setNode(sectionNode);
getParser().setCurrentEvent("custom effect trigger", EffectTriggerEvent.class);
List<TriggerItem> items = SkriptUtil.getItemsFromNode(sectionNode);
whichInfo.forEach(which ->
effectHandlers.put(which,
new Trigger(SkriptUtil.getCurrentScript(), "effect " + which, this, items)));
}
SkriptLogger.setNode(null);
}
return true;
}
public static EffectSyntaxInfo lookup(File script, int matchedPattern) {
return dataTracker.lookup(script, matchedPattern);
}
}
| 33.063218 | 101 | 0.670607 |
ee9ae9ca57720ed17cad72fe594104d9876acfb7 | 2,095 | sql | SQL | backend/de.metas.fresh/de.metas.fresh.base/src/main/sql/postgresql/system/75-de.metas.fresh.reports/5458320_sys_gh1140_fix_fresh_attributeprice.sql | dram/metasfresh | a1b881a5b7df8b108d4c4ac03082b72c323873eb | [
"RSA-MD"
] | 1,144 | 2016-02-14T10:29:35.000Z | 2022-03-30T09:50:41.000Z | backend/de.metas.fresh/de.metas.fresh.base/src/main/sql/postgresql/system/75-de.metas.fresh.reports/5458320_sys_gh1140_fix_fresh_attributeprice.sql | vestigegroup/metasfresh | 4b2d48c091fb2a73e6f186260a06c715f5e2fe96 | [
"RSA-MD"
] | 8,283 | 2016-04-28T17:41:34.000Z | 2022-03-30T13:30:12.000Z | backend/de.metas.fresh/de.metas.fresh.base/src/main/sql/postgresql/system/75-de.metas.fresh.reports/5458320_sys_gh1140_fix_fresh_attributeprice.sql | vestigegroup/metasfresh | 4b2d48c091fb2a73e6f186260a06c715f5e2fe96 | [
"RSA-MD"
] | 441 | 2016-04-29T08:06:07.000Z | 2022-03-28T06:09:56.000Z | CREATE OR REPLACE VIEW report.fresh_attributeprice AS
SELECT pp.m_productprice_id,
COALESCE(ai.m_attributesetinstance_id,pp.m_attributesetinstance_id) as m_attributesetinstance_id,
pp.pricestd,
pp.isactive,
pp.m_hu_pi_item_product_id,
string_agg(av.value::text, ', '::text ORDER BY (av.value::text)) AS attributes,
(COALESCE(pp.m_hu_pi_item_product_id || ' '::text, ''::text) || COALESCE(pp.isdefault::text || ' '::text, ''::text)) || COALESCE(string_agg((ai.m_attribute_id::text || ' '::text) || ai.m_attributevalue_id::text, ','::text ORDER BY ai.m_attribute_id), ''::text) AS signature
FROM m_productprice pp
LEFT JOIN m_attributeinstance ai ON pp.m_attributesetinstance_id = ai.m_attributesetinstance_id AND ai.isactive = 'Y'::bpchar
LEFT JOIN ( SELECT av_1.isactive,
av_1.m_attributevalue_id,
CASE
WHEN a.value::text = '1000015'::text AND av_1.value::text = '01'::text THEN NULL::character varying
WHEN a.value::text = '1000015'::text AND av_1.value IS NOT NULL THEN 'AdR'::character varying
WHEN a.value::text = '1000001'::text THEN av_1.value
ELSE av_1.name
END AS value
FROM m_attributevalue av_1
LEFT JOIN m_attribute a ON av_1.m_attribute_id = a.m_attribute_id) av ON ai.m_attributevalue_id = av.m_attributevalue_id AND av.isactive = 'Y'::bpchar AND av.value IS NOT NULL
WHERE pp.isactive = 'Y'::bpchar
GROUP BY pp.m_productprice_id, ai.m_attributesetinstance_id, pp.m_attributesetinstance_id, pp.pricestd, pp.isactive, pp.m_hu_pi_item_product_id;
ALTER TABLE report.fresh_attributeprice
OWNER TO metasfresh;
COMMENT ON VIEW report.fresh_attributeprice
IS 'This View is supposed to be used by the View RV_fresh_PriceList_Comparison and retrieves the Attribute price together with a rendered list of Attributes and a signature. Attribute prices of different Price list version but with the same attributes and packin instruction config can be matched and therefore compared with this.';
| 69.833333 | 334 | 0.71599 |
9c144f36e284e0c6dfc3ddfa7d10ffa07616aa80 | 53,490 | cpp | C++ | TomGine/tgTomGineThread.cpp | OpenNurbsFit/OpenNurbsFit | d1ca01437a6da6bbf921466013ff969def5dfe65 | [
"BSD-3-Clause"
] | 14 | 2015-07-06T13:04:49.000Z | 2022-02-06T10:09:05.000Z | TomGine/tgTomGineThread.cpp | OpenNurbsFit/OpenNurbsFit | d1ca01437a6da6bbf921466013ff969def5dfe65 | [
"BSD-3-Clause"
] | 1 | 2020-12-07T03:26:39.000Z | 2020-12-07T03:26:39.000Z | TomGine/tgTomGineThread.cpp | OpenNurbsFit/OpenNurbsFit | d1ca01437a6da6bbf921466013ff969def5dfe65 | [
"BSD-3-Clause"
] | 11 | 2015-07-06T13:04:43.000Z | 2022-03-29T10:57:04.000Z | /*
* Software License Agreement (GNU General Public License)
*
* Copyright (c) 2011, Thomas Mörwald
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author thomas.moerwald
*
*/
#include "tgTomGineThread.h"
#include <iomanip>
using namespace TomGine;
/** ThreadDrawing (OpenGL commands are only allowed in this thread) */
namespace TomGine {
void*
ThreadDrawing(void* c)
{
tgTomGineThread *tt = (tgTomGineThread*) c;
TomGine::tgEngine* render = new TomGine::tgEngine(tt->m_width, tt->m_height, tt->m_depth_max, tt->m_depth_min,
tt->m_windowname.c_str(), tt->m_bfc, true);
render->Update();
pthread_mutex_lock(&tt->dataMutex);
tt->m_engine = render;
bool stop = tt->m_stopTomGineThread;
pthread_mutex_unlock(&tt->dataMutex);
std::list<Event> eventlist;
float fTime;
unsigned fps;
while (!stop)
{
if (!tt->m_FPS)
sem_wait(&tt->renderSem);
pthread_mutex_lock(&tt->dataMutex);
if (tt->m_clearcommand != tt->GL_CLEAR_NONE)
{
tt->GL_Clear();
sem_post(&tt->clearFinishedSem);
}
pthread_mutex_unlock(&tt->dataMutex);
pthread_mutex_lock(&tt->eventMutex);
eventlist.clear();
while (!tt->m_eventlist.empty())
{
eventlist.push_back(tt->m_eventlist.front());
tt->m_eventlist.pop_front();
sem_trywait(&tt->renderSem);
}
tt->m_eventlist.clear();
pthread_mutex_unlock(&tt->eventMutex);
pthread_mutex_lock(&tt->dataMutex);
while (!eventlist.empty())
{
render->InputControl(eventlist.front());
eventlist.pop_front();
}
tt->GL_Update(render);
tt->GL_Draw(render);
stop = tt->m_stopTomGineThread;
pthread_mutex_unlock(&tt->dataMutex);
if (tt->m_waitForZBuffer)
{
pthread_mutex_lock(&tt->dataMutex);
tt->GL_ZBuffer(tt->m_zBuffer, render);
tt->m_waitForZBuffer = false;
pthread_mutex_unlock(&tt->dataMutex);
}
if (tt->m_snapshot)
{
pthread_mutex_lock(&tt->dataMutex);
tt->GL_Snapshot(tt->m_snapshotFile);
tt->m_snapshot = false;
pthread_mutex_unlock(&tt->dataMutex);
}
if (tt->m_record)
{
pthread_mutex_lock(&tt->dataMutex);
tt->GL_Record(render);
pthread_mutex_unlock(&tt->dataMutex);
}
render->Update(fTime);
if (tt->m_FPS)
{
fps = unsigned(round(1.0 / fTime));
pthread_mutex_lock(&tt->dataMutex);
if (fps > tt->m_maxFPS)
tt->m_fTime += 0.001;
else if (fps < tt->m_maxFPS)
tt->m_fTime -= 0.001;
tt->m_fTime < 0.0 ? fTime = -tt->m_fTime : fTime = tt->m_fTime;
pthread_mutex_unlock(&tt->dataMutex);
usleep(unsigned(fTime * 1e6));
}
sem_post(&tt->renderFinishedSem);
}
pthread_mutex_lock(&tt->dataMutex);
tt->GL_Clear();
tt->m_engine = NULL;
pthread_mutex_unlock(&tt->dataMutex);
render->UnWaitForEvent();
delete render;
pthread_mutex_lock(&tt->dataMutex);
tt->m_renderingStopped = true;
pthread_mutex_unlock(&tt->dataMutex);
sem_post(&tt->renderFinishedSem);
pthread_exit(NULL);
}
void*
ThreadEventHandling(void* c)
{
tgTomGineThread *tt = (tgTomGineThread*) c;
pthread_mutex_lock(&tt->dataMutex);
bool stop = tt->m_stopTomGineThread;
pthread_mutex_unlock(&tt->dataMutex);
bool engineExists = false;
Event event;
while (!stop)
{
if (engineExists)
{
tt->m_engine->WaitForEvent(event);
pthread_mutex_lock(&tt->dataMutex);
if (tt->KeyHandler(event))
tt->m_stopTomGineThread = true;
pthread_mutex_unlock(&tt->dataMutex);
if(tt->m_eventCallback)
tt->m_eventListner->EventFunction(event);
pthread_mutex_lock(&tt->eventMutex);
tt->m_eventlist.push_back(event);
if (tt->m_waitingForEvents)
if (event.type == TMGL_Press || event.type == TMGL_Release)
{
tt->m_waitingeventlist.push_back(event);
}
if (tt->m_listenForEvents)
{
tt->m_listenEventList.push_front(event);
if (tt->m_listenEventList.size() > tt->m_listenEventListSize) // avoid out-of-memory
tt->m_listenEventList.resize(tt->m_listenEventListSize);
}
sem_post(&tt->renderSem);
pthread_mutex_unlock(&tt->eventMutex);
} else
{
usleep(10000); // wait for render engine to start up
}
pthread_mutex_lock(&tt->dataMutex);
stop = tt->m_stopTomGineThread;
engineExists = tt->m_engine;
pthread_mutex_unlock(&tt->dataMutex);
}
pthread_mutex_lock(&tt->dataMutex);
tt->m_eventsStopped = true;
pthread_mutex_unlock(&tt->dataMutex);
pthread_exit(NULL);
}
}
/********************** tgTomGineThread ************************/
void tgTomGineThread::init()
{
m_stopTomGineThread = false;
m_renderingStopped = false;
m_eventsStopped = false;
m_clearcommand = GL_CLEAR_NONE;
m_clearindex = 0;
m_clearColor = TomGine::vec3(0.0f, 0.0f, 0.0f);
m_maxFPS = 0;
m_FPS = false;
m_fTime = 0.0;
m_snapshot = false;
m_record = false;
m_recorderFrame = 0;
m_numScreenShot = 0;
df.image = true;
df.pointclouds = true;
df.cameras = true;
df.lines = true;
df.points = true;
df.labels = true;
df.models = true;
df.normals = false;
df.textured = true;
m_loadImage = false;
m_showCoordinateFrame = false;
m_camChanged = false;
// m_tgCamChanged = false;
m_inputSpeedChanged = false;
m_rotCenterChanged = false;
m_waitingForEvents = false;
m_listenForEvents = false;
m_waitForZBuffer = false;
m_listenEventListSize = 100;
m_eventCallback = false;
m_engine = NULL;
sem_init(&renderSem, 0, 0);
sem_init(&renderFinishedSem, 0, 0);
sem_init(&clearFinishedSem, 0, 0);
sem_init(&snapshotSem, 0, 0);
pthread_mutex_init(&eventMutex, NULL);
pthread_mutex_init(&dataMutex, NULL);
pthread_create(&thread_gl, NULL, ThreadDrawing, this);
#ifndef TG_NO_EVENT_HANDLING
pthread_create(&thread_event, NULL, ThreadEventHandling, this);
#endif
}
tgTomGineThread::tgTomGineThread(int w, int h, std::string windowname, bool bfc, float depth_min, float depth_max) :
m_width(w), m_height(h), m_depth_min(depth_min), m_depth_max(depth_max), m_bfc(bfc), m_windowname(windowname),
m_normal_length(0.1)
{
init();
Update();
}
tgTomGineThread::~tgTomGineThread()
{
m_stopTomGineThread = true;
sem_post(&renderSem);
sem_post(&renderFinishedSem);
sem_post(&clearFinishedSem);
sem_post(&snapshotSem);
pthread_join(thread_gl, NULL);
pthread_join(thread_event, NULL);
sem_destroy(&renderSem);
sem_destroy(&renderFinishedSem);
sem_destroy(&clearFinishedSem);
sem_destroy(&snapshotSem);
pthread_mutex_destroy(&dataMutex);
pthread_mutex_destroy(&eventMutex);
}
void tgTomGineThread::GL_Clear()
{
const ClearCommand &cc = m_clearcommand;
if (cc == GL_CLEAR_ALL || cc == GL_CLEAR_POINTCLOUDS)
{
for (unsigned i = m_clearindex; i < this->m_pointclouds.size(); i++)
if (m_pointclouds[i] != NULL)
delete m_pointclouds[i];
m_pointclouds.resize(m_clearindex);
}
if (cc == GL_CLEAR_ALL || cc == GL_CLEAR_CAMERAS)
m_cameras.clear();
if (cc == GL_CLEAR_ALL || cc == GL_CLEAR_POINTS_2D)
{
m_points2D.clear();
m_pointSize2D.clear();
}
if (cc == GL_CLEAR_ALL || cc == GL_CLEAR_POINTS_3D)
{
m_points3D.clear();
m_pointSize3D.clear();
}
if (cc == GL_CLEAR_ALL || cc == GL_CLEAR_LINES_2D)
{
m_lines2D.clear();
m_lineCols2D.clear();
m_lineWidth2D.clear();
}
if (cc == GL_CLEAR_ALL || cc == GL_CLEAR_LINES_3D)
{
m_lines3D.clear();
m_lineCols3D.clear();
m_lineWidth3D.clear();
}
if (cc == GL_CLEAR_ALL || cc == GL_CLEAR_LABELS)
{
m_labels2D.clear();
m_labels3D.clear();
}
if (cc == GL_CLEAR_ALL || cc == GL_CLEAR_MODELS_2D)
{
for (size_t i = m_clearindex; i < m_models2D.size(); i++)
if (m_models2D[i] != NULL)
delete m_models2D[i];
m_models2D.resize(m_clearindex);
}
if (cc == GL_CLEAR_ALL || cc == GL_CLEAR_MODELS_3D)
{
for (size_t i = m_clearindex; i < m_models3D.size(); i++)
if (m_models3D[i] != NULL)
delete m_models3D[i];
m_models3D.resize(m_clearindex);
}
if (cc == GL_CLEAR_ALL || cc == GL_CLEAR_MODEL_POINTERS)
{
m_modelpointers.clear();
}
m_clearindex = 0;
}
void tgTomGineThread::PrintUsage()
{
printf("\n\n --- TomGine Render Engine ---\n\n");
printf(" [Escape,q] Quit\n");
printf(" [f] Show / Hide coordinate frame\n");
printf(" [d] Show / Hide points (dots)\n");
printf(" [i] Show / Hide background image\n");
printf(" [p] Show / Hide point-clouds\n");
printf(" [t] Show / Hide labels (text)\n");
printf(" [l] Show / Hide lines\n");
printf(" [m] Show / Hide models\n");
printf(" [o] Print camera info\n");
printf(" [r] Print current center of rotation\n");
printf(" [F11] Take screenshot\n");
printf("\n\n");
}
bool tgTomGineThread::KeyHandler(Event &event)
{
if (event.type == TMGL_Quit)
return true;
if (event.type == TMGL_Press)
{
if (event.input == TMGL_Escape || event.input == TMGL_q)
return true;
// [clear] internal events should not manipulate data (external processes might need it)
else if (event.input == TMGL_f)
m_showCoordinateFrame = !m_showCoordinateFrame;
else if (event.input == TMGL_c)
df.textured = !df.textured;
// df.cameras = !df.cameras;
else if (event.input == TMGL_d)
df.points = !df.points;
else if (event.input == TMGL_i)
df.image = !df.image;
else if (event.input == TMGL_p)
df.pointclouds = !df.pointclouds;
else if (event.input == TMGL_t)
df.labels = !df.labels;
else if (event.input == TMGL_l)
df.lines = !df.lines;
else if (event.input == TMGL_m)
df.models = !df.models;
else if (event.input == TMGL_n)
df.normals = !df.normals;
else if (event.input == TMGL_o)
m_engine->GetCamera().Print();
else if (event.input == TMGL_r)
printf("COR: %f %f %f\n", m_rotCenter.x, m_rotCenter.y, m_rotCenter.z);
else if (event.input == TMGL_KP_Add)
for (size_t i = 0; i < m_pointclouds.size(); i++)
m_pointclouds[i]->m_point_size += 1.0f;
else if (event.input == TMGL_KP_Subtract)
for (size_t i = 0; i < m_pointclouds.size(); i++)
{
float &ps = m_pointclouds[i]->m_point_size;
ps <= 1.0f ? ps = 1.0f : ps -= 1.0f;
}
else if (event.input == TMGL_F11)
{
std::ostringstream os;
os << "tgImg_" << std::setfill('0') << std::setw(4) << this->m_numScreenShot++ << ".png";
m_snapshotFile = os.str();
m_snapshot = true;
}
}
return false;
}
void tgTomGineThread::GL_DrawCameras()
{
glDisable(GL_LIGHTING);
glDisable(GL_TEXTURE_2D);
glLineWidth(1.0);
glColor3f(0.5f, 0.5f, 0.5f);
for (size_t i = 0; i < m_cameras.size(); i++)
m_cameras[i].GetFrustum()->DrawFrustum();
}
void tgTomGineThread::GL_DrawPointCloud()
{
glDisable (GL_POINT_SMOOTH);
for (unsigned i = 0; i < this->m_pointclouds.size(); i++)
{
this->m_pointclouds[i]->DrawColorPoints();
if (df.normals)
this->m_pointclouds[i]->DrawLines();
}
#ifdef DEBUG
tgCheckError("[tgTomGineThread::DrawPointCloud]");
#endif
}
void tgTomGineThread::GL_DrawPoints3D()
{
glDisable(GL_LIGHTING);
glEnable(GL_POINT_SMOOTH);
for (unsigned i = 0; i < m_points3D.size(); i++)
{
glPointSize(m_pointSize3D[i]);
glBegin(GL_POINTS);
glColor3ub(m_points3D[i].color[0], m_points3D[i].color[1], m_points3D[i].color[2]);
glVertex3f(m_points3D[i].pos.x, m_points3D[i].pos.y, m_points3D[i].pos.z);
glEnd();
}
glPointSize(1.0f);
#ifdef DEBUG
tgCheckError("[tgTomGineThread::DrawPoints3D]");
#endif
}
void tgTomGineThread::GL_DrawPoints2D()
{
glDisable(GL_LIGHTING);
//glEnable(GL_POINT_SMOOTH);
for (unsigned i = 0; i < m_points2D.size(); i++)
{
glPointSize(m_pointSize2D[i]);
glBegin(GL_POINTS);
glColor3ub(m_points2D[i].color[0], m_points2D[i].color[1], m_points2D[i].color[2]);
glVertex3f(m_points2D[i].pos.x, m_points2D[i].pos.y, m_points2D[i].pos.z);
glEnd();
}
glPointSize(1.0f);
#ifdef DEBUG
tgCheckError("[tgTomGineThread::DrawPoints2D]");
#endif
}
void tgTomGineThread::GL_DrawLines2D()
{
glDisable(GL_LIGHTING);
glDisable(GL_TEXTURE_2D);
for (unsigned i = 0; i < m_lines2D.size(); i++)
{
glLineWidth(m_lineWidth2D[i]);
glBegin(GL_LINES);
glColor3f(m_lineCols2D[i].x, m_lineCols2D[i].y, m_lineCols2D[i].z);
glVertex3f(m_lines2D[i].start.x, m_lines2D[i].start.y, m_lines2D[i].start.z);
glVertex3f(m_lines2D[i].end.x, m_lines2D[i].end.y, m_lines2D[i].end.z);
glEnd();
}
glLineWidth(1.0f);
#ifdef DEBUG
tgCheckError("[tgTomGineThread::DrawLines2D]");
#endif
}
void tgTomGineThread::GL_DrawLines3D()
{
glDisable(GL_LIGHTING);
glDisable(GL_TEXTURE_2D);
for (unsigned i = 0; i < m_lines3D.size(); i++)
{
glLineWidth(m_lineWidth3D[i]);
glBegin(GL_LINES);
glColor3f(m_lineCols3D[i].x, m_lineCols3D[i].y, m_lineCols3D[i].z);
glVertex3f(m_lines3D[i].start.x, m_lines3D[i].start.y, m_lines3D[i].start.z);
glVertex3f(m_lines3D[i].end.x, m_lines3D[i].end.y, m_lines3D[i].end.z);
glEnd();
}
glLineWidth(1.0f);
#ifdef DEBUG
tgCheckError("[tgTomGineThread::DrawLines3D]");
#endif
}
void tgTomGineThread::GL_DrawLabels(TomGine::tgEngine *render)
{
render->Activate3D();
mat4 modelview, projection;
vec4 viewport;
glGetFloatv(GL_MODELVIEW_MATRIX, modelview);
glGetFloatv(GL_PROJECTION_MATRIX, projection);
glGetFloatv(GL_VIEWPORT, viewport);
mat4 modelviewprojection = projection * modelview;
render->Activate2D();
for (unsigned i = 0; i < this->m_labels3D.size(); i++)
{
tgLabel3D l = m_labels3D[i];
vec4 texCoords = modelviewprojection * vec4(l.pos.x, l.pos.y, l.pos.z, 1.0);
float x = (texCoords.x / texCoords.w + 1.0f) * 0.5f;
float y = (texCoords.y / texCoords.w + 1.0f) * 0.5f;
g_font->Print(l.text.c_str(), l.size, int(viewport.z * x), int(viewport.w * y), l.rgba.x, l.rgba.y, l.rgba.z, l.rgba.w);
}
for (unsigned i = 0; i < this->m_labels2D.size(); i++)
{
tgLabel2D l = m_labels2D[i];
g_font->Print(l);
}
}
void tgTomGineThread::GL_DrawModels2D()
{
for (unsigned i = 0; i < this->m_models2D.size(); i++)
{
if (m_models2D[i] != NULL)
m_models2D[i]->Draw();
}
#ifdef DEBUG
tgCheckError("[tgTomGineThread::GL_DrawModels2D]");
#endif
}
void tgTomGineThread::GL_DrawModels3D(bool textured)
{
for (unsigned i = 0; i < this->m_models3D.size(); i++)
{
if (m_models3D[i] != NULL)
{
m_models3D[i]->Draw(textured);
if (df.normals)
m_models3D[i]->DrawNormals(m_normal_length);
}
}
for (unsigned i = 0; i < this->m_modelpointers.size(); i++)
{
if (m_modelpointers[i] != NULL)
{
m_modelpointers[i]->Draw();
if (df.normals)
m_modelpointers[i]->DrawNormals(m_normal_length);
}
}
#ifdef DEBUG
tgCheckError("[tgTomGineThread::GL_DrawModels3D]");
#endif
}
//void tgTomGineThread::GL_SyncNurbsData()
//{
// // add new nurbs
// while (this->m_nurbsSurface.size() < this->m_nurbsSurfaceData.size()) {
// unsigned id = this->m_nurbsSurface.size();
// TomGine::tgNurbsSurface *surf = new TomGine::tgNurbsSurface(this->m_nurbsSurfaceData[id],
// m_engine->m_NurbsSurfaceShader);
// this->m_nurbsSurface.push_back(surf);
// this->m_nurbsSurfaceData[id].sync = true;
// }
//#ifdef DEBUG
// tgCheckError("[tgTomGineThread::SyncNurbsData] add new nurbs");
//#endif
// // update out of sync nurbs
// for (unsigned i = 0; i < this->m_nurbsSurfaceData.size(); i++) {
// if (!this->m_nurbsSurfaceData[i].sync) {
// this->m_nurbsSurface[i]->Set(this->m_nurbsSurfaceData[i]);
// this->m_nurbsSurfaceData[i].sync = true;
// }
// }
//
//}
//
//void tgTomGineThread::GL_DrawNurbs()
//{
// for (unsigned i = 0; i < this->m_nurbsSurface.size(); i++) {
// glLineWidth(1.0f);
// this->m_nurbsSurface[i]->DrawFaces();
// glPointSize(5.0);
// glColor3f(0.6, 0.0, 0.6);
// this->m_nurbsSurface[i]->DrawCPs();
// }
//#ifdef DEBUG
// tgCheckError("[tgTomGineThread::DrawNurbs]");
//#endif
//}
void tgTomGineThread::GL_Record(TomGine::tgEngine *render)
{
char img_number[16];
sprintf(img_number, "img-%06d.jpg", m_recorderFrame++);
std::string filename = m_recorderPath;
filename.append(img_number);
GL_Snapshot(filename);
render->Activate2D();
glPointSize(20);
glBegin(GL_POINTS);
glColor3ub(255, 0, 0);
glVertex3f(m_width - 15, m_height - 15, 0.0);
glEnd();
render->DrawFPS();
}
void tgTomGineThread::GL_Snapshot(const std::string &filename)
{
TomGine::tgTexture2D tex;
tex.CopyTexImage2D(m_width, m_height, GL_RGB);
tex.Save(filename.c_str());
// printf("[tgTomGineThread::GL_Snapshot] Saved image to '%s'\n", filename.c_str());
sem_post(&snapshotSem);
}
void tgTomGineThread::GL_ZBuffer(cv::Mat1f &z, TomGine::tgEngine *render)
{
z = cv::Mat1f(m_height, m_width);
if (!z.isContinuous())
printf("[tgTomGineThread::GL_ZBuffer] Warning, cv::Mat1f is not memory aligned.\n");
float far = render->GetCamera().GetZFar();
float near = render->GetCamera().GetZNear();
float c = (far + near) / (far - near);
float d = (2 * far * near) / (far - near);
glReadPixels(0, 0, m_width, m_height, GL_DEPTH_COMPONENT, GL_FLOAT, &z(0, 0));
for (int i = 0; i < z.rows; i++)
for (int j = 0; j < z.cols; j++)
{
// z(i, j) = d / (c - z(i, j));
float &val = z(i, j);
val = 2.0f * val - 1.0f;
val = d / (c - val);
}
}
void tgTomGineThread::GL_Update(TomGine::tgEngine *render)
{
glClearColor(m_clearColor.x, m_clearColor.y, m_clearColor.z, 1.);
// set camera pose...
if (m_camChanged)
{
unsigned w = unsigned(m_width);
unsigned h = unsigned(m_height);
render->SetCamera(m_intrinsic, w, h, m_extR, m_extT);
m_camChanged = false;
#ifdef DEBUG
tgCheckError("[tgTomGineThread::GL_Update] SetCamera (cv):");
#endif
}
// if (m_tgCamChanged)
// {
// render->SetCamera(m_tgCamera);
// m_tgCamChanged = false;
//#ifdef DEBUG
// tgCheckError("[tgTomGineThread::GL_Update] SetCamera (tg):");
//#endif
// }
if (m_inputSpeedChanged)
{
render->SetSpeeds(m_inputSpeeds.x, m_inputSpeeds.y, m_inputSpeeds.z);
m_inputSpeedChanged = false;
}
// set center of rotation
if (m_rotCenterChanged)
{
render->SetCenterOfRotation(m_rotCenter.x, m_rotCenter.y, m_rotCenter.z);
#ifdef DEBUG
tgCheckError("[tgTomGineThread::GL_Update]");
#endif
}
// synchronize NURBS data
// if (df.nurbs)
// GL_SyncNurbsData();
}
void tgTomGineThread::GL_Draw(TomGine::tgEngine *render)
{
if (m_loadImage && !m_img.empty())
{
if (m_img.channels() == 1)
render->LoadBackgroundImage(m_img.data, m_img.cols, m_img.rows, GL_LUMINANCE, true);
if (m_img.channels() == 3)
render->LoadBackgroundImage(m_img.data, m_img.cols, m_img.rows, GL_BGR, true);
m_loadImage = false;
}
render->Activate2D();
if (df.image)
render->DrawBackgroundImage(NULL, true);
if (df.points)
GL_DrawPoints2D();
if (df.lines)
GL_DrawLines2D();
if (df.models)
GL_DrawModels2D();
render->Activate3D();
if (df.models)
GL_DrawModels3D(!render->GetWireframeMode() && df.textured);
if (df.pointclouds)
GL_DrawPointCloud();
if (df.points)
GL_DrawPoints3D();
if (df.lines)
GL_DrawLines3D();
if (df.cameras)
GL_DrawCameras();
if (m_showCoordinateFrame)
render->DrawCoordinates(1.0, 2.0);
if (df.labels)
GL_DrawLabels(render);
}
/***************************** PUBLIC *****************************/
Event tgTomGineThread::WaitForEvent(Type type)
{
Event event;
bool valid = false;
while (!valid && !this->m_renderingStopped)
{
pthread_mutex_lock(&eventMutex);
m_waitingForEvents = true;
pthread_mutex_unlock(&eventMutex);
sem_wait(&renderFinishedSem);
pthread_mutex_lock(&eventMutex);
m_waitingForEvents = false;
while (!m_waitingeventlist.empty())
{
event = m_waitingeventlist.front();
m_waitingeventlist.pop_front();
if (event.type == type)
valid = true;
}
pthread_mutex_unlock(&eventMutex);
}
if (!valid)
event.type = TMGL_None;
return event;
}
Event tgTomGineThread::WaitForEvent(Type type, Input input)
{
Event event;
bool valid = false;
while (!valid && !this->m_renderingStopped)
{
pthread_mutex_lock(&eventMutex);
m_waitingForEvents = true;
pthread_mutex_unlock(&eventMutex);
sem_wait(&renderFinishedSem);
pthread_mutex_lock(&eventMutex);
m_waitingForEvents = false;
while (!m_waitingeventlist.empty())
{
event = m_waitingeventlist.front();
m_waitingeventlist.pop_front();
if (event.type == type)
{
if (event.input == input)
{
valid = true;
}
}
}
pthread_mutex_unlock(&eventMutex);
}
if (!valid)
event.type = TMGL_Quit;
return event;
}
void tgTomGineThread::StartEventListener(unsigned max_events)
{
pthread_mutex_lock(&eventMutex);
this->m_listenForEvents = true;
this->m_listenEventListSize = max_events;
pthread_mutex_unlock(&eventMutex);
}
void tgTomGineThread::RegisterEventListener(tgEventListener *listener)
{
pthread_mutex_lock(&eventMutex);
this->m_eventListner = listener;
this->m_eventCallback = true;
pthread_mutex_unlock(&eventMutex);
}
void tgTomGineThread::StopEventListener()
{
pthread_mutex_lock(&eventMutex);
this->m_listenForEvents = false;
pthread_mutex_unlock(&eventMutex);
}
void tgTomGineThread::GetEventQueue(std::list<Event> &events, bool waiting)
{
if(waiting && this->m_listenEventList.empty())
sem_wait(&renderFinishedSem);
pthread_mutex_lock(&eventMutex);
events = this->m_listenEventList;
this->m_listenEventList.clear();
pthread_mutex_unlock(&eventMutex);
}
bool ascending(double i, double j)
{
return (i < j);
}
bool tgTomGineThread::SelectModels(int x, int y, std::vector<int> &ids)
{
if (this->m_renderingStopped)
return false;
ids.clear();
bool intersection(false);
tgRay ray;
GetCamera().GetViewRay(x, y, ray.start, ray.dir);
pthread_mutex_lock(&dataMutex);
// Get shortest distance to each model
// std::vector<double> dist(m_models3D.size(), DBL_MAX);
for (unsigned i = 0; i < m_models3D.size(); i++)
{
if (m_models3D[i] == NULL)
continue;
std::vector<vec3> pl, nl;
std::vector<double> zl;
bool tmp_intersect = tgCollission::IntersectRayModel(pl, nl, zl, ray, *m_models3D[i]);
intersection = (intersection || tmp_intersect);
if (tmp_intersect)
ids.push_back(i);
}
pthread_mutex_unlock(&dataMutex);
return intersection;
}
bool tgTomGineThread::SelectModels(int x, int y, const std::vector<int> &model_ids, int& id, double& z_min)
{
if (this->m_renderingStopped)
return false;
bool intersection(false);
tgRay ray;
GetCamera().GetViewRay(x, y, ray.start, ray.dir);
pthread_mutex_lock(&dataMutex);
// Get shortest distance to each model that intersects
std::vector<double> dist(model_ids.size(), DBL_MAX);
for (unsigned i = 0; i < model_ids.size(); i++)
{
const int& idx = model_ids[i];
if (m_models3D[idx] == NULL)
continue;
std::vector<vec3> pl, nl;
std::vector<double> zl;
bool tmp_intersect = tgCollission::IntersectRayModel(pl, nl, zl, ray, *m_models3D[idx]);
intersection = (intersection || tmp_intersect);
if (tmp_intersect)
{
double z_min(DBL_MAX);
for (unsigned j = 0; j < zl.size(); j++)
if (zl[j] < z_min)
z_min = zl[j];
dist[i] = z_min;
}
}
// get closest model id
z_min = DBL_MAX;
if (intersection)
{
for (unsigned i = 0; i < dist.size(); i++)
{
if (dist[i] < z_min)
{
z_min = dist[i];
id = model_ids[i];
}
}
}
pthread_mutex_unlock(&dataMutex);
return intersection;
}
bool tgTomGineThread::SelectModel(int x, int y, int &id)
{
if (this->m_renderingStopped)
return false;
bool intersection(false);
tgRay ray;
GetCamera().GetViewRay(x, y, ray.start, ray.dir);
pthread_mutex_lock(&dataMutex);
// Get shortest distance to each model that intersects
std::vector<double> dist(m_models3D.size(), DBL_MAX);
for (unsigned i = 0; i < m_models3D.size(); i++)
{
if (m_models3D[i] == NULL)
continue;
std::vector<vec3> pl, nl;
std::vector<double> zl;
bool tmp_intersect = tgCollission::IntersectRayModel(pl, nl, zl, ray, *m_models3D[i]);
intersection = (intersection || tmp_intersect);
if (tmp_intersect)
{
double z_min(DBL_MAX);
for (unsigned j = 0; j < zl.size(); j++)
if (zl[j] < z_min)
z_min = zl[j];
dist[i] = z_min;
}
}
// get closest model id
if (intersection)
{
double z_min(DBL_MAX);
for (unsigned i = 0; i < dist.size(); i++)
{
if (dist[i] < z_min)
{
z_min = dist[i];
id = i;
}
}
}
pthread_mutex_unlock(&dataMutex);
return intersection;
}
TomGine::tgCamera tgTomGineThread::GetCamera()
{
// sem_post(&renderSem);
// sem_wait(&renderFinishedSem);
TomGine::tgCamera cam;
pthread_mutex_lock(&dataMutex);
if(this->m_engine!=NULL)
cam = this->m_engine->GetCamera();
pthread_mutex_unlock(&dataMutex);
return cam;
}
void tgTomGineThread::SetClearColor(float r, float g, float b)
{
pthread_mutex_lock(&dataMutex);
m_clearColor = TomGine::vec3(r, g, b);
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetClearColor(float gray)
{
pthread_mutex_lock(&dataMutex);
m_clearColor = TomGine::vec3(gray, gray, gray);
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetCamera(cv::Mat &_intrinsic)
{
pthread_mutex_lock(&dataMutex);
_intrinsic.copyTo(m_intrinsic);
m_camChanged = true;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetCamera(cv::Mat &R, cv::Mat &t)
{
pthread_mutex_lock(&dataMutex);
R.copyTo(m_extR);
t.copyTo(m_extT);
m_camChanged = true;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetCamera(const TomGine::tgCamera &cam)
{
pthread_mutex_lock(&dataMutex);
// m_tgCamera = cam;
// m_tgCamChanged = true;
if(this->m_engine!=NULL)
this->m_engine->SetCamera(cam);
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetCameraDefault()
{
pthread_mutex_lock(&dataMutex);
m_extR = cv::Mat::eye(3, 3, CV_32F);
m_extT = cv::Mat::zeros(3, 1, CV_32F);
m_intrinsic = cv::Mat::zeros(3, 3, CV_64F);
m_intrinsic.at<double> (0, 0) = m_intrinsic.at<double> (1, 1) = 525;
m_intrinsic.at<double> (0, 2) = 320;
m_intrinsic.at<double> (1, 2) = 240;
m_intrinsic.at<double> (2, 2) = 1;
m_camChanged = true;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::LookAt(const TomGine::vec3& p)
{
TomGine::tgCamera cam = this->GetCamera();
pthread_mutex_lock(&dataMutex);
if(this->m_engine!=NULL)
{
// set extrinsic
cam.LookAt(p);
cam.ApplyTransform();
// check if point is within z-range
vec3 view_ray = cam.GetPos() - p;
float z = view_ray.length();
if(z >= cam.GetZFar())
cam.SetZRange(cam.GetZNear(), 2.0f*z);
if(z <= cam.GetZNear())
cam.SetZRange(z*0.5f, cam.GetZFar());
this->m_engine->SetCamera(cam);
// m_tgCamChanged = true;
}
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetRotationCenter(const cv::Vec3d &_rotCenter)
{
pthread_mutex_lock(&dataMutex);
m_rotCenter = vec3((float) _rotCenter[0], (float) _rotCenter[1], (float) _rotCenter[2]);
m_rotCenterChanged = true;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetRotationCenter(float x, float y, float z)
{
pthread_mutex_lock(&dataMutex);
m_rotCenter = vec3(x, y, z);
m_rotCenterChanged = true;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetRotationCenter(const TomGine::vec3 &cor)
{
pthread_mutex_lock(&dataMutex);
m_rotCenter = cor;
m_rotCenterChanged = true;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetCoordinateFrame()
{
pthread_mutex_lock(&dataMutex);
m_showCoordinateFrame = !m_showCoordinateFrame;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetImage(unsigned char* data, unsigned width, unsigned height)
{
cv::Mat _img(height, width, CV_8UC3, data);
pthread_mutex_lock(&dataMutex);
_img.copyTo(m_img);
m_loadImage = true;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetImage(const cv::Mat &_img, bool show, bool background)
{
if (_img.channels() != 3 && _img.channels() != 1)
{
printf("[tgTomGineThread::SetImage] Warning, image is no rgb image\n");
return;
}
pthread_mutex_lock(&dataMutex);
_img.copyTo(m_img);
m_loadImage = true;
df.image = show;
pthread_mutex_unlock(&dataMutex);
}
bool tgTomGineThread::GetImage(cv::Mat &_img)
{
if (m_img.empty())
return false;
else
{
m_img.copyTo(_img);
return true;
}
}
void tgTomGineThread::SetInputSpeeds(float rotation, float translation, float zoom)
{
pthread_mutex_lock(&dataMutex);
m_inputSpeeds = vec3(rotation, translation, zoom);
m_inputSpeedChanged = true;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::GetInputSpeeds(float &rotation, float &translation, float &zoom)
{
pthread_mutex_lock(&dataMutex);
rotation = m_inputSpeeds.x;
translation = m_inputSpeeds.y;
zoom = m_inputSpeeds.z;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetNormalLength(float n)
{
pthread_mutex_lock(&dataMutex);
m_normal_length = n;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetFrameRate(unsigned max_fps)
{
pthread_mutex_lock(&dataMutex);
m_maxFPS = max_fps;
m_FPS = !(m_maxFPS == 0);
pthread_mutex_unlock(&dataMutex);
}
int tgTomGineThread::AddCamera(const tgCamera& cam)
{
pthread_mutex_lock(&dataMutex);
int id = m_cameras.size();
m_cameras.push_back(cam);
pthread_mutex_unlock(&dataMutex);
return id;
}
int tgTomGineThread::AddPoint2D(float x, float y, uchar r, uchar g, uchar b, float size)
{
if (size <= 0.0f)
{
printf("tgTomGineThread::AddPoint2D] Warning invalid argument: size <= 0.0f\n");
size = 1.0f;
}
pthread_mutex_lock(&dataMutex);
tgColorPoint pt;
pt.pos = vec3(x, y, 0.0f);
pt.color[0] = r;
pt.color[1] = g;
pt.color[2] = b;
m_points2D.push_back(pt);
m_pointSize2D.push_back(size);
int id = (this->m_points2D.size() - 1);
pthread_mutex_unlock(&dataMutex);
return id;
}
int tgTomGineThread::AddPoint3D(float x, float y, float z, uchar r, uchar g, uchar b, float size)
{
if (size <= 0.0f)
{
printf("tgTomGineThread::AddPoint3D] Warning invalid argument: size <= 0.0f\n");
size = 1.0f;
}
pthread_mutex_lock(&dataMutex);
tgColorPoint pt;
pt.pos = vec3(x, y, z);
pt.color[0] = r;
pt.color[1] = g;
pt.color[2] = b;
m_points3D.push_back(pt);
m_pointSize3D.push_back(size);
int id = (this->m_points3D.size() - 1);
pthread_mutex_unlock(&dataMutex);
return id;
}
int tgTomGineThread::AddLine2D(float x1, float y1, float x2, float y2, uchar r, uchar g, uchar b, float width)
{
if (width <= 0.0f)
{
printf("tgTomGineThread::AddLine2D] Warning invalid argument: width <= 0.0f\n");
width = 1.0f;
}
pthread_mutex_lock(&dataMutex);
m_lines2D.push_back(TomGine::tgLine(vec3(x1, y1, 0.0), vec3(x2, y2, 0.0)));
m_lineCols2D.push_back(vec3(float(r) / 255.0f, float(g) / 255.0f, float(b) / 255.0f));
m_lineWidth2D.push_back(width);
int id = (this->m_lines2D.size() - 1);
pthread_mutex_unlock(&dataMutex);
return id;
}
int tgTomGineThread::AddLine3D(float x1, float y1, float z1, float x2, float y2, float z2,
uchar r, uchar g, uchar b, float width)
{
if (width <= 0.0f)
{
printf("tgTomGineThread::AddLine3D] Warning invalid argument: width <= 0.0f\n");
width = 1.0f;
}
pthread_mutex_lock(&dataMutex);
m_lines3D.push_back(TomGine::tgLine(vec3(x1, y1, z1), vec3(x2, y2, z2)));
m_lineCols3D.push_back(vec3(float(r) / 255.0f, float(g) / 255.0f, float(b) / 255.0f));
m_lineWidth3D.push_back(width);
int id = (this->m_lines3D.size() - 1);
pthread_mutex_unlock(&dataMutex);
return id;
}
int tgTomGineThread::AddLine3D(const TomGine::tgLine& line,
uchar r, uchar g, uchar b, float width)
{
if (width <= 0.0f)
{
printf("tgTomGineThread::AddLine3D] Warning invalid argument: width <= 0.0f\n");
width = 1.0f;
}
pthread_mutex_lock(&dataMutex);
m_lines3D.push_back(line);
m_lineCols3D.push_back(vec3(float(r) / 255.0f, float(g) / 255.0f, float(b) / 255.0f));
m_lineWidth3D.push_back(width);
int id = (this->m_lines3D.size() - 1);
pthread_mutex_unlock(&dataMutex);
return id;
}
int tgTomGineThread::AddLabel2D(std::string text, int size, int x, int y, float r, float g, float b)
{
pthread_mutex_lock(&dataMutex);
m_labels2D.push_back(TomGine::tgLabel2D(text, size, x, y, r, g, b));
int id = (this->m_labels2D.size() - 1);
pthread_mutex_unlock(&dataMutex);
return id;
}
int tgTomGineThread::AddLabel3D(std::string text, int size, vec3 pos, float r, float g, float b)
{
pthread_mutex_lock(&dataMutex);
TomGine::tgLabel3D label;
label.text = text;
label.size = size;
label.pos = pos;
label.rgba = vec4(r, g, b, 1.0f);
m_labels3D.push_back(label);
int id = (this->m_labels3D.size() - 1);
pthread_mutex_unlock(&dataMutex);
return id;
}
int tgTomGineThread::AddLabel3D(std::string text, int size, double x, double y, double z)
{
pthread_mutex_lock(&dataMutex);
TomGine::tgLabel3D label;
label.text = text;
label.size = size;
label.pos.x = x;
label.pos.y = y;
label.pos.z = z;
m_labels3D.push_back(label);
int id = (this->m_labels3D.size() - 1);
pthread_mutex_unlock(&dataMutex);
return id;
}
int tgTomGineThread::AddModel2D(const TomGine::tgTextureModel &model)
{
pthread_mutex_lock(&dataMutex);
this->m_models2D.push_back(new TomGine::tgTextureModel(model));
int id = (this->m_models2D.size() - 1);
pthread_mutex_unlock(&dataMutex);
return id;
}
int tgTomGineThread::AddModel3D(const TomGine::tgTextureModel &model)
{
pthread_mutex_lock(&dataMutex);
int id = this->m_models3D.size();
this->m_models3D.push_back(new TomGine::tgTextureModel(model));
pthread_mutex_unlock(&dataMutex);
return id;
}
int tgTomGineThread::AddModel(const TomGine::tgTextureModel &model)
{
pthread_mutex_lock(&dataMutex);
this->m_models3D.push_back(new TomGine::tgTextureModel(model));
int id = (this->m_models3D.size() - 1);
pthread_mutex_unlock(&dataMutex);
return id;
}
int tgTomGineThread::AddModel(TomGine::tgModel *model)
{
pthread_mutex_lock(&dataMutex);
this->m_modelpointers.push_back(model);
int id = (this->m_modelpointers.size() - 1);
pthread_mutex_unlock(&dataMutex);
return id;
}
int tgTomGineThread::AddPointCloud(const std::vector<TomGine::vec3> &cloud, TomGine::vec3 color, float pointsize)
{
tgModel* tg_cloud = new tgModel;
tg_cloud->m_point_size = pointsize;
tg_cloud->m_colorpoints.resize(cloud.size());
for (size_t i = 0; i < cloud.size(); i++)
{
TomGine::tgColorPoint& cpt = tg_cloud->m_colorpoints[i];
const TomGine::vec3 &pt = cloud[i];
cpt.color[0] = static_cast<unsigned char>(255*color.x);
cpt.color[1] = static_cast<unsigned char>(255*color.y);
cpt.color[2] = static_cast<unsigned char>(255*color.z);
cpt.pos = vec3(pt[0], pt[1], pt[2]);
}
pthread_mutex_lock(&dataMutex);
this->m_pointclouds.push_back(tg_cloud);
int id = (this->m_pointclouds.size() - 1);
pthread_mutex_unlock(&dataMutex);
return id;
}
int tgTomGineThread::AddPointCloud(const cv::Mat_<cv::Vec4f>& cloud, float pointsize)
{
tgRGBValue color;
tgModel* tg_cloud = new tgModel;
tg_cloud->m_point_size = pointsize;
tg_cloud->m_colorpoints.resize(cloud.rows*cloud.cols);
for (int i = 0; i < cloud.rows; i++)
{
for (int j = 0; j < cloud.cols; j++)
{
TomGine::tgColorPoint& cpt = tg_cloud->m_colorpoints[i*cloud.cols + j];
const cv::Vec4f &pt = cloud(i, j);
color.float_value = pt[3];
cpt.color[0] = color.Red;
cpt.color[1] = color.Green;
cpt.color[2] = color.Blue;
cpt.pos = vec3(pt[0], pt[1], pt[2]);
}
}
pthread_mutex_lock(&dataMutex);
this->m_pointclouds.push_back(tg_cloud);
int id = (this->m_pointclouds.size() - 1);
pthread_mutex_unlock(&dataMutex);
return id;
}
int tgTomGineThread::AddPointCloud(const std::vector<cv::Vec4f> &cloud, float pointsize)
{
tgRGBValue color;
tgModel* tg_cloud = new tgModel;
tg_cloud->m_point_size = pointsize;
tg_cloud->m_colorpoints.resize(cloud.size());
for (unsigned i = 0; i < cloud.size(); i++)
{
TomGine::tgColorPoint& cpt = tg_cloud->m_colorpoints[i];
const cv::Vec4f &pt = cloud[i];
color.float_value = pt[3];
cpt.color[0] = color.Red;
cpt.color[1] = color.Green;
cpt.color[2] = color.Blue;
cpt.pos = vec3(pt[0], pt[1], pt[2]);
}
pthread_mutex_lock(&dataMutex);
this->m_pointclouds.push_back(tg_cloud);
int id = (this->m_pointclouds.size() - 1);
pthread_mutex_unlock(&dataMutex);
return id;
}
int tgTomGineThread::AddPointCloud(const cv::Mat_<cv::Vec3f> &cloud, uchar r, uchar g, uchar b, float pointsize)
{
tgModel* tg_cloud = new tgModel;
tg_cloud->m_point_size = pointsize;
tg_cloud->m_colorpoints.resize(cloud.rows*cloud.cols);
for (int i = 0; i < cloud.rows*cloud.cols; i++)
{
TomGine::tgColorPoint& cpt = tg_cloud->m_colorpoints[i];
const cv::Vec3f &pt = cloud(i);
cpt.color[0] = r;
cpt.color[1] = g;
cpt.color[2] = b;
cpt.pos = vec3(pt[0], pt[1], pt[2]);
}
pthread_mutex_lock(&dataMutex);
this->m_pointclouds.push_back(tg_cloud);
int id = (this->m_pointclouds.size() - 1);
pthread_mutex_unlock(&dataMutex);
return id;
}
int tgTomGineThread::AddPointCloud(const cv::Mat_<cv::Vec3f> &cloud, const cv::Mat_<cv::Vec3b> &image, float pointsize)
{
tgModel* tg_cloud = new tgModel;
tg_cloud->m_point_size = pointsize;
int s = std::min<int>(cloud.rows*cloud.cols, image.rows*image.cols);
tg_cloud->m_colorpoints.resize(s);
for (int i = 0; i < s; i++)
{
TomGine::tgColorPoint& cpt = tg_cloud->m_colorpoints[i];
const cv::Vec3f &pt = cloud(i);
const cv::Vec3b &col = image(i);
cpt.color[0] = col[2];
cpt.color[1] = col[1];
cpt.color[2] = col[0];
cpt.pos = vec3(pt[0], pt[1], pt[2]);
}
pthread_mutex_lock(&dataMutex);
this->m_pointclouds.push_back(tg_cloud);
int id = (this->m_pointclouds.size() - 1);
pthread_mutex_unlock(&dataMutex);
return id;
}
void tgTomGineThread::SetPoint2D(int id, float x, float y)
{
if (this->m_renderingStopped)
return;
pthread_mutex_lock(&dataMutex);
if (id < 0 || id >= (int) this->m_points2D.size())
{
pthread_mutex_unlock(&dataMutex);
printf("[tgTomGineThread::SetPoint2D] Warning index out of bounds: %d.\n", id);
return;
}
TomGine::tgColorPoint &pt = this->m_points2D[id];
pt.pos.x = x;
pt.pos.y = y;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetPoint3D(int id, float x, float y, float z)
{
if (this->m_renderingStopped)
return;
pthread_mutex_lock(&dataMutex);
if (id < 0 || id >= (int) this->m_points3D.size())
{
pthread_mutex_unlock(&dataMutex);
printf("[tgTomGineThread::SetPoint3D] Warning index out of bounds: %d.\n", id);
return;
}
m_points3D[id].pos.x = x;
m_points3D[id].pos.y = y;
m_points3D[id].pos.z = z;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetLine2D(int id,
float x1, float y1, float x2, float y2,
uchar r, uchar g, uchar b, float width)
{
if (this->m_renderingStopped)
return;
pthread_mutex_lock(&dataMutex);
if (id < 0 || id >= (int) this->m_lines2D.size())
{
pthread_mutex_unlock(&dataMutex);
printf("[tgTomGineThread::SetLine2D] Warning index out of bounds: %d.\n", id);
return;
}
m_lines2D[id] = TomGine::tgLine(vec3(x1, y1, 0.0), vec3(x2, y2, 0.0));
m_lineCols2D[id] = vec3(float(r) / 255.0f, float(g) / 255.0f, float(b) / 255.0f);
m_lineWidth2D[id] = width;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetLine3D(int id,
float x1, float y1, float z1, float x2, float y2, float z2,
uchar r, uchar g, uchar b, float width)
{
if (this->m_renderingStopped)
return;
pthread_mutex_lock(&dataMutex);
if (id < 0 || id >= (int) this->m_lines3D.size())
{
pthread_mutex_unlock(&dataMutex);
printf("[tgTomGineThread::SetLine3D] Warning index out of bounds: %d.\n", id);
return;
}
m_lines3D[id] = TomGine::tgLine(vec3(x1, y1, z1), vec3(x2, y2, z2));
m_lineCols3D[id] = vec3(float(r) / 255.0f, float(g) / 255.0f, float(b) / 255.0f);
m_lineWidth3D[id] = width;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetLine3D(int id, const TomGine::tgLine& line,
uchar r, uchar g, uchar b, float width)
{
if (this->m_renderingStopped)
return;
pthread_mutex_lock(&dataMutex);
if (id < 0 || id >= (int) this->m_lines3D.size())
{
pthread_mutex_unlock(&dataMutex);
printf("[tgTomGineThread::SetLine3D] Warning index out of bounds: %d.\n", id);
return;
}
m_lines3D[id] = line;
m_lineCols3D[id] = vec3(float(r) / 255.0f, float(g) / 255.0f, float(b) / 255.0f);
m_lineWidth3D[id] = width;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetLabel2D(int id, std::string text, int size, int x, int y, float r, float g, float b)
{
if (this->m_renderingStopped)
return;
pthread_mutex_lock(&dataMutex);
if (id < 0 || id >= (int) this->m_labels2D.size())
{
pthread_mutex_unlock(&dataMutex);
printf("[tgTomGineThread::SetLabel2D] Warning index out of bounds: %d.\n", id);
return;
}
this->m_labels2D[id] = TomGine::tgLabel2D(text, size, x, y, r, g, b);
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetModel2D(int id, const TomGine::tgTextureModel &model)
{
if (this->m_renderingStopped)
return;
pthread_mutex_lock(&dataMutex);
if (id < 0 || id >= (int) this->m_models2D.size())
{
pthread_mutex_unlock(&dataMutex);
printf("[tgTomGineThread::SetModel2D] Warning index out of bounds: %d.\n", id);
return;
}
if (m_models2D[id] != NULL)
delete m_models2D[id];
m_models2D[id] = new TomGine::tgTextureModel(model);
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetModel3D(int id, const TomGine::tgTextureModel &model)
{
if (this->m_renderingStopped)
return;
pthread_mutex_lock(&dataMutex);
if (id < 0 || id >= (int) this->m_models3D.size())
{
pthread_mutex_unlock(&dataMutex);
printf("[tgTomGineThread::SetModel] Warning index out of bounds: %d.\n", id);
return;
}
if (m_models3D[id] != NULL)
delete m_models3D[id];
m_models3D[id] = new TomGine::tgTextureModel(model);
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetModelPose(int id, const TomGine::tgPose &pose)
{
if (this->m_renderingStopped)
return;
pthread_mutex_lock(&dataMutex);
if (id < 0 || id >= (int) this->m_models3D.size())
{
pthread_mutex_unlock(&dataMutex);
printf("[tgTomGineThread::SetModelPose] Warning index out of bounds: %d.\n", id);
return;
}
this->m_models3D[id]->m_pose = pose;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetModelColor(int id, uchar r, uchar g, uchar b)
{
if (this->m_renderingStopped)
return;
pthread_mutex_lock(&dataMutex);
if (id < 0 || id >= (int) this->m_models3D.size())
{
pthread_mutex_unlock(&dataMutex);
printf("[tgTomGineThread::SetModelColor] Warning index out of bounds: %d.\n", id);
return;
}
this->m_models3D[id]->SetColor(r,g,b);
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetModel(int id, TomGine::tgModel *model)
{
if (this->m_renderingStopped)
return;
pthread_mutex_lock(&dataMutex);
if (id < 0 || id >= (int) this->m_modelpointers.size())
{
pthread_mutex_unlock(&dataMutex);
printf("[tgTomGineThread::SetModel] Warning index out of bounds: %d.\n", id);
return;
}
this->m_modelpointers[id] = model;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetPointCloud(int id, const TomGine::tgModel &pcl)
{
if (this->m_renderingStopped)
return;
tgModel* tg_cloud = new tgModel;
tg_cloud->m_colorpoints = pcl.m_colorpoints;
pthread_mutex_lock(&dataMutex);
if (id < 0 || id >= (int) this->m_pointclouds.size())
{
pthread_mutex_unlock(&dataMutex);
if (this->m_renderingStopped)
return;
printf("[tgTomGineThread::SetPointCloud] Warning index out of bounds: %d.\n", id);
return;
}
if (m_pointclouds[id] != NULL)
delete m_pointclouds[id];
m_pointclouds[id] = tg_cloud;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::SetPointCloud(int id, cv::Mat_<cv::Vec4f> cloud)
{
if (this->m_renderingStopped)
return;
tgRGBValue color;
tgModel* tg_cloud = new tgModel;
for (int i = 0; i < cloud.rows; i++)
{
for (int j = 0; j < cloud.cols; j++)
{
TomGine::tgColorPoint cpt;
cv::Vec4f &pt = cloud(i, j);
color.float_value = pt[3];
cpt.color[0] = color.Red;
cpt.color[1] = color.Green;
cpt.color[2] = color.Blue;
cpt.pos = vec3(pt[0], pt[1], pt[2]);
tg_cloud->m_colorpoints.push_back(cpt);
}
}
pthread_mutex_lock(&dataMutex);
if (id < 0 || id >= (int) this->m_pointclouds.size())
{
if (this->m_renderingStopped)
{
pthread_mutex_unlock(&dataMutex);
return;
} else
{
pthread_mutex_unlock(&dataMutex);
printf("[tgTomGineThread::SetPointCloud] Warning index out of bounds: %d.\n", id);
return;
}
}
if (m_pointclouds[id] != NULL)
delete m_pointclouds[id];
m_pointclouds[id] = tg_cloud;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::Update()
{
if (this->m_renderingStopped)
return;
Event event;
event.type = TMGL_None;
pthread_mutex_lock(&eventMutex);
m_eventlist.push_back(event);
sem_post(&renderSem);
pthread_mutex_unlock(&eventMutex);
sem_wait(&renderFinishedSem);
}
bool tgTomGineThread::Stopped()
{
pthread_mutex_lock(&dataMutex);
bool stopped = (this->m_renderingStopped && this->m_eventsStopped);
pthread_mutex_unlock(&dataMutex);
return stopped;
}
void tgTomGineThread::Snapshot(const char* filename)
{
if (this->m_renderingStopped)
return;
pthread_mutex_lock(&dataMutex);
m_snapshotFile = std::string(filename);
m_snapshot = true;
sem_post(&renderSem);
pthread_mutex_unlock(&dataMutex);
sem_wait(&snapshotSem);
}
void tgTomGineThread::StartRecording(std::string path, unsigned fps)
{
if (this->m_renderingStopped)
return;
SetFrameRate(fps);
pthread_mutex_lock(&dataMutex);
m_recorderFrame = 0;
m_recorderPath = path;
m_record = true;
sem_post(&renderSem);
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::StopRecording()
{
if(this->m_renderingStopped)
return;
SetFrameRate(0);
pthread_mutex_lock(&dataMutex);
m_record = false;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::GetDepthBuffer(cv::Mat1f &z, TomGine::tgCamera &cam)
{
if (this->m_renderingStopped)
return;
pthread_mutex_lock(&dataMutex);
this->m_waitForZBuffer = true;
sem_post(&renderSem);
pthread_mutex_unlock(&dataMutex);
sem_wait(&renderFinishedSem);
pthread_mutex_lock(&dataMutex);
this->m_zBuffer.copyTo(z);
cam = this->m_engine->GetCamera();
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::Clear()
{
if (this->m_renderingStopped)
return;
pthread_mutex_lock(&dataMutex);
m_clearcommand = GL_CLEAR_ALL;
m_clearindex = 0;
sem_post(&renderSem);
pthread_mutex_unlock(&dataMutex);
sem_wait(&clearFinishedSem);
pthread_mutex_lock(&dataMutex);
m_clearcommand = GL_CLEAR_NONE;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::ClearPointClouds()
{
if(m_renderingStopped)
return;
pthread_mutex_lock(&dataMutex);
m_clearcommand = GL_CLEAR_POINTCLOUDS;
sem_post(&renderSem);
pthread_mutex_unlock(&dataMutex);
sem_wait(&clearFinishedSem);
pthread_mutex_lock(&dataMutex);
m_clearcommand = GL_CLEAR_NONE;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::ClearCameras()
{
pthread_mutex_lock(&dataMutex);
m_cameras.clear();
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::ClearPoints2D()
{
pthread_mutex_lock(&dataMutex);
m_points2D.clear();
m_pointSize2D.clear();
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::ClearPoints3D()
{
pthread_mutex_lock(&dataMutex);
m_points3D.clear();
m_pointSize3D.clear();
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::ClearLabels()
{
pthread_mutex_lock(&dataMutex);
m_labels2D.clear();
m_labels3D.clear();
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::ClearLines2D()
{
pthread_mutex_lock(&dataMutex);
m_lines2D.clear();
m_lineCols2D.clear();
m_lineWidth2D.clear();
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::ClearLines3D()
{
pthread_mutex_lock(&dataMutex);
m_lines3D.clear();
m_lineCols3D.clear();
m_lineWidth3D.clear();
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::ClearModels()
{
if(m_renderingStopped)
return;
ClearModels2D();
ClearModels3D();
ClearModelPointers();
}
void tgTomGineThread::ClearModels2D()
{
if(m_renderingStopped)
return;
pthread_mutex_lock(&dataMutex);
m_clearcommand = GL_CLEAR_MODELS_2D;
sem_post(&renderSem);
pthread_mutex_unlock(&dataMutex);
sem_wait(&clearFinishedSem);
pthread_mutex_lock(&dataMutex);
m_clearcommand = GL_CLEAR_NONE;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::ClearModels3D()
{
if(m_renderingStopped)
return;
pthread_mutex_lock(&dataMutex);
m_clearcommand = GL_CLEAR_MODELS_3D;
sem_post(&renderSem);
pthread_mutex_unlock(&dataMutex);
sem_wait(&clearFinishedSem);
pthread_mutex_lock(&dataMutex);
m_clearcommand = GL_CLEAR_NONE;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::ClearModels3DFrom(int id)
{
if(m_renderingStopped)
return;
pthread_mutex_lock(&dataMutex);
m_clearcommand = GL_CLEAR_MODELS_3D;
m_clearindex = id;
sem_post(&renderSem);
pthread_mutex_unlock(&dataMutex);
sem_wait(&clearFinishedSem);
pthread_mutex_lock(&dataMutex);
m_clearcommand = GL_CLEAR_NONE;
m_clearindex = 0;
pthread_mutex_unlock(&dataMutex);
}
void tgTomGineThread::ClearModelPointers()
{
m_modelpointers.clear(); // vector of pointers cleared; the models are not deleted
}
void tgTomGineThread::DragDropModels(float speed)
{
if(m_renderingStopped)
return;
this->StartEventListener(100);
bool stopDragDrop(false);
while (!this->Stopped() && !stopDragDrop)
{
int id;
std::list<TomGine::Event> events;
this->GetEventQueue(events);
while (!events.empty())
{
TomGine::Event ev = events.front();
events.pop_front();
if (ev.type == TomGine::TMGL_Press && ev.input == TomGine::TMGL_Return)
{
return;
}
if (ev.type == TomGine::TMGL_Release && ev.input == TomGine::TMGL_x)
{
bool return1(false);
bool return2(false);
TomGine::Event::Motion motion;
motion.x = ev.motion.x;
motion.y = ev.motion.y;
this->SelectModel(ev.motion.x, ev.motion.y, id);
// look if a release event is in event que
while (!events.empty())
{
ev = events.front();
events.pop_front();
if (ev.type == TomGine::TMGL_Release && ev.input == TomGine::TMGL_x)
return1 = true;
}
if (!return1)
{
while (!return2)
{
// move object
this->GetEventQueue(events);
while (!events.empty())
{
ev = events.front();
events.pop_front();
if (ev.type == TomGine::TMGL_Release && ev.input == TomGine::TMGL_x)
return2 = true;
else if (ev.type == TomGine::TMGL_Motion)
{
motion.x = ev.motion.x - motion.x;
motion.y = ev.motion.y - motion.y;
pthread_mutex_lock(&dataMutex);
m_models3D[id]->m_pose.Translate(TomGine::vec3(speed * motion.x, speed * motion.y, 0.0));
pthread_mutex_unlock(&dataMutex);
motion.x = ev.motion.x;
motion.y = ev.motion.y;
}
}
}
}
}
}
}
this->StopEventListener();
}
| 26.04187 | 124 | 0.661712 |
cc5c859f39867ecec18528735035bd3a53df4cf7 | 958 | dart | Dart | test/all_test.dart | angel-dart/angel_hbs | d0335a925d7199f3a5988ca10da36fee38ce0c43 | [
"MIT"
] | 1,208 | 2016-06-24T02:57:56.000Z | 2022-03-09T18:53:10.000Z | test/all_test.dart | angel-dart/angel_hbs | d0335a925d7199f3a5988ca10da36fee38ce0c43 | [
"MIT"
] | 277 | 2016-10-21T14:15:58.000Z | 2021-04-26T16:33:54.000Z | test/all_test.dart | angel-dart/angel_hbs | d0335a925d7199f3a5988ca10da36fee38ce0c43 | [
"MIT"
] | 104 | 2016-04-22T03:06:59.000Z | 2022-03-09T18:53:12.000Z | import 'dart:async';
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_mustache/angel_mustache.dart';
import 'package:file/local.dart';
import 'package:test/test.dart';
main() async {
Angel angel = new Angel();
await angel.configure(mustache(const LocalFileSystem().directory('./test')));
test('can render templates', () async {
var hello = await angel.viewGenerator('hello', {'name': 'world'});
var bar = await angel.viewGenerator('foo/bar', {'framework': 'angel'});
expect(hello, equals("Hello, world!"));
expect(bar, equals("angel_framework"));
});
test('throws if view is not found', () {
expect(new Future(() async {
var fails = await angel.viewGenerator('fail', {'this_should': 'fail'});
print(fails);
}), throws);
});
test("partials", () async {
var withPartial = await angel.viewGenerator('with-partial');
expect(withPartial, equals("Hello, world!"));
});
}
| 30.903226 | 79 | 0.660752 |
8865ab564a185406d6abe997729383b80ea05e9f | 623 | dart | Dart | lib/commons/theme.dart | tareqalmousa/booking-hotel | c03d5bde4f55e88dab0037b98fa0c21fb87eaabc | [
"Apache-2.0"
] | 153 | 2019-07-31T23:04:11.000Z | 2022-03-28T12:36:16.000Z | lib/commons/theme.dart | tareqalmousa/booking-hotel | c03d5bde4f55e88dab0037b98fa0c21fb87eaabc | [
"Apache-2.0"
] | 13 | 2019-09-28T04:59:47.000Z | 2021-11-12T20:01:16.000Z | lib/commons/theme.dart | tareqalmousa/booking-hotel | c03d5bde4f55e88dab0037b98fa0c21fb87eaabc | [
"Apache-2.0"
] | 49 | 2019-10-10T05:43:49.000Z | 2022-03-30T02:06:53.000Z | import 'dart:ui' as ui show Color;
import 'package:flutter/material.dart' as material show Colors, MaterialColor;
const material.MaterialColor primarySwatch = material.Colors.purple;
const ui.Color primaryColor = ui.Color(0xff6732c1);
const ui.Color secondaryColor = ui.Color(0xffe60073);
const ui.Color accentColor = ui.Color(0xfffd8c00);
const ui.Color notificationColor = ui.Color(0xFFff8300);
const ui.Color buttonColor = ui.Color(0xfffcb813);
const ui.Color backgroundColor = ui.Color(0xFFe2d7f5); // => grey[200]
const ui.Color textColor = primaryColor;
const ui.Color secondaryTextColor = material.Colors.grey;
| 36.647059 | 78 | 0.788122 |
40bd05dde57bd873dfab16b73f5202cc997e960a | 3,113 | py | Python | pi/emo_reco/helpers/nn/mxconv/mxsqueezenet.py | danielbrenners/buzz-lightyear | e6eb526b124d55e31917bf445875de27110cae16 | [
"MIT"
] | null | null | null | pi/emo_reco/helpers/nn/mxconv/mxsqueezenet.py | danielbrenners/buzz-lightyear | e6eb526b124d55e31917bf445875de27110cae16 | [
"MIT"
] | null | null | null | pi/emo_reco/helpers/nn/mxconv/mxsqueezenet.py | danielbrenners/buzz-lightyear | e6eb526b124d55e31917bf445875de27110cae16 | [
"MIT"
] | 1 | 2018-11-23T10:50:46.000Z | 2018-11-23T10:50:46.000Z | # import the necessary packages
import mxnet as mx
class MxSqueezeNet:
@staticmethod
def squeeze(input, numFilter):
# the first part of a FIRE module consists of a number of 1x1
# filter squeezes on the input data followed by an activation
squeeze_1x1 = mx.sym.Convolution(data=input, kernel=(1, 1),
stride=(1, 1), num_filter=numFilter)
act_1x1 = mx.sym.LeakyReLU(data=squeeze_1x1,
act_type="elu")
# return the activation for the squeeze
return act_1x1
@staticmethod
def fire(input, numSqueezeFilter, numExpandFilter):
# construct the 1x1 squeeze followed by the 1x1 expand
squeeze_1x1 = MxSqueezeNet.squeeze(input, numSqueezeFilter)
expand_1x1 = mx.sym.Convolution(data=squeeze_1x1,
kernel=(1, 1), stride=(1, 1), num_filter=numExpandFilter)
relu_expand_1x1 = mx.sym.LeakyReLU(data=expand_1x1,
act_type="elu")
# construct the 3x3 expand
expand_3x3 = mx.sym.Convolution(data=squeeze_1x1, pad=(1, 1),
kernel=(3, 3), stide=(1, 1), num_filter=numExpandFilter)
relu_expand_3x3 = mx.sym.LeakyReLU(data=expand_3x3,
act_type="elu")
# the output of the FIRE module is the concatenation of the
# activation for the 1x1 and 3x3 expands along the channel
# dimension
output = mx.sym.Concat(relu_expand_1x1, relu_expand_3x3,
dim=1)
# return the output of the FIRE module
return output
@staticmethod
def build(classes):
# data input
data = mx.sym.Variable("data")
# Block #1: CONV => RELU => POOL
conv_1 = mx.sym.Convolution(data=data, kernel=(7, 7),
stride=(2, 2), num_filter=96)
relu_1 = mx.sym.LeakyReLU(data=conv_1, act_type="elu")
pool_1 = mx.sym.Pooling(data=relu_1, kernel=(3, 3),
stride=(2, 2), pool_type="max")
# Block #2-4: (FIRE * 3) => POOL
fire_2 = MxSqueezeNet.fire(pool_1, numSqueezeFilter=16,
numExpandFilter=64)
fire_3 = MxSqueezeNet.fire(fire_2, numSqueezeFilter=16,
numExpandFilter=64)
fire_4 = MxSqueezeNet.fire(fire_3, numSqueezeFilter=32,
numExpandFilter=128)
pool_4 = mx.sym.Pooling(data=fire_4, kernel=(3, 3),
stride=(2, 2), pool_type="max")
# Block #5-8: (FIRE * 4) => POOL
fire_5 = MxSqueezeNet.fire(pool_4, numSqueezeFilter=32,
numExpandFilter=128)
fire_6 = MxSqueezeNet.fire(fire_5, numSqueezeFilter=48,
numExpandFilter=192)
fire_7 = MxSqueezeNet.fire(fire_6, numSqueezeFilter=48,
numExpandFilter=192)
fire_8 = MxSqueezeNet.fire(fire_7, numSqueezeFilter=64,
numExpandFilter=256)
pool_8 = mx.sym.Pooling(data=fire_8, kernel=(3, 3),
stride=(2, 2), pool_type="max")
# Block #9-10: FIRE => DROPOUT => CONV => RELU => POOL
fire_9 = MxSqueezeNet.fire(pool_8, numSqueezeFilter=64,
numExpandFilter=256)
do_9 = mx.sym.Dropout(data=fire_9, p=0.5)
conv_10 = mx.sym.Convolution(data=do_9, num_filter=classes,
kernel=(1, 1), stride=(1, 1))
relu_10 = mx.sym.LeakyReLU(data=conv_10, act_type="elu")
pool_10 = mx.sym.Pooling(data=relu_10, kernel=(13, 13),
pool_type="avg")
# softmax classifier
flatten = mx.sym.Flatten(data=pool_10)
model = mx.sym.SoftmaxOutput(data=flatten, name="softmax")
# return the network architecture
return model | 34.588889 | 63 | 0.716672 |
f8d8b1765c57674455d6fc662146fb49f3256143 | 2,657 | ps1 | PowerShell | ExportNotebookToPowerShellScript.ps1 | Markus-Hanisch/PowerShellNotebook | d2166bad817a409d37c91613619bc2bb9f370a5e | [
"MIT"
] | 73 | 2019-10-20T11:47:37.000Z | 2022-03-25T05:56:05.000Z | ExportNotebookToPowerShellScript.ps1 | Markus-Hanisch/PowerShellNotebook | d2166bad817a409d37c91613619bc2bb9f370a5e | [
"MIT"
] | 15 | 2020-06-25T22:43:48.000Z | 2021-11-01T13:45:01.000Z | ExportNotebookToPowerShellScript.ps1 | Markus-Hanisch/PowerShellNotebook | d2166bad817a409d37c91613619bc2bb9f370a5e | [
"MIT"
] | 18 | 2019-11-02T17:36:07.000Z | 2022-03-07T19:07:10.000Z | function Export-NotebookToPowerShellScript {
<#
.SYNOPSIS
Exports all code blocks from a PowerShell Notebook to a PowerShell script
.DESCRIPTION
Exports from either a local notebook or one on the internet
.Example
Export-NotebookToPowerShellScript .\TestPS.ipynb
Get-Content .\TestPS.ps1
.Example
Export-NotebookToPowerShellScript "https://raw.githubusercontent.com/dfinke/PowerShellNotebook/AddJupyterNotebookMetaInfo/samplenotebook/powershell.ipynb"
Get-Content .\powershell.ps1
.Example
Export-NotebookToPowerShellScript .\TestPS.ipynb -IncludeTextCells
Get-Content .\TestPS.ps1
Include exporting the the Text cells from the .IPYNB file to the .PS1 file.
#>
[CmdletBinding()]
param(
[parameter(ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0)]
$FullName,
[Alias("OutPath")]
$Destination = $PWD,
[switch]$IncludeTextCells,
[switch]$AsText
)
Process {
Write-Progress -Activity "Exporting PowerShell Notebook" -Status $FullName
if (Test-Path $Destination -PathType Container) {
#split-path works for well from URIs as well as filesystem paths
$outFile = (Split-Path -Leaf $FullName) -replace ".ipynb", ".ps1"
$Destination = Join-Path -Path $Destination -ChildPath $outFile
}
#ensure date is formated for local culture.
$result = , (@'
<#
Created from: {1}
Created by: Export-NotebookToPowerShellScript
Created on: {0:D} {0:t}
#>
'@ -f (Get-Date), $FullName)
if ($IncludeTextCells) {$sourceBlocks = Get-NotebookContent $FullName}
else {$sourceBlocks = Get-NotebookContent $FullName -JustCode}
#if the last cell is empty don't output it
if ($sourceBlocks.count -gt 1 -and [string]::IsNullOrEmpty($sourceBlocks[-1].source)) {
$sourceBlocks = $sourceBlocks[0..($sourceBlocks.count -2)]
}
$prevCode = $false
$result += switch ($sourceBlocks) {
{$_.type -eq 'code'} {
if ($prevCode) {"<# #>"} #Avoid concatenating Code cells.
($_.Source.trimend() )
$prevCode = $true
}
default {
"<#`r`n"+ $_.Source.TrimEnd() +"`r`n#>"
$prevCode = $false
}
}
if ($AsText) {return $result}
else {
$result| Set-Content $Destination
Get-item $Destination
}
}
} | 34.064103 | 162 | 0.582988 |
41b56a8071a71a5a3cc773faa73fcd64e9adfaf9 | 3,202 | dart | Dart | myapp/lib/main.dart | Hemanth10081999/flutter_apps | fde724d9ed32168addf9d77ab5e05eb845d8e267 | [
"Apache-2.0"
] | null | null | null | myapp/lib/main.dart | Hemanth10081999/flutter_apps | fde724d9ed32168addf9d77ab5e05eb845d8e267 | [
"Apache-2.0"
] | null | null | null | myapp/lib/main.dart | Hemanth10081999/flutter_apps | fde724d9ed32168addf9d77ab5e05eb845d8e267 | [
"Apache-2.0"
] | null | null | null | import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(
home: Home(),
));
class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
int age = 0;
String name = 'Hemantha rajan' ;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[700],
appBar: AppBar(
title: Text('Your Profile'),
centerTitle: true,
backgroundColor: Colors.grey[900],
elevation: 0.0,
),
body: Padding(
padding: EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Center(
child: CircleAvatar(
backgroundImage: AssetImage('assets/123.jpg'),
radius: 100.0,
),
),
Divider(
height: 40.0,
color: Colors.grey[100],
),
Text(
'NAME',
style: TextStyle(
color: Colors.white,
letterSpacing: 2.0,
),
),
SizedBox(
height: 10,
),
Text(
'$name',
style: TextStyle(
color: Colors.amberAccent[200],
letterSpacing: 2.0,
fontSize: 30.0,
fontWeight: FontWeight.bold,
),
),
SizedBox(
height: 30.0,
),
Text(
'Age',
style: TextStyle(
color: Colors.white,
letterSpacing: 2.0,
),
),
SizedBox(
height: 10,
),
Text(
'$age',
style: TextStyle(
color: Colors.amberAccent[200],
letterSpacing: 2.0,
fontSize: 30.0,
fontWeight: FontWeight.bold,
),
),
SizedBox(
height: 30.0,
),
Row(
children: <Widget>[
Icon(
Icons.email,
color: Colors.grey[100],
),
SizedBox(
width: 5,
),
Text(
'Email',
style: TextStyle(
color: Colors.white,
letterSpacing: 2.0,
),
),
],
),
Text(
'vhemantharajan@gmal.com',
style: TextStyle(
color: Colors.amberAccent[200],
letterSpacing: 2.0,
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
setState(() {
age+=1;
});
},
child: Icon(Icons.add),
backgroundColor: Colors.grey[800],
),
);
}
}
| 23.372263 | 62 | 0.395378 |
2870864bf641c4ee77049adec850925843091880 | 2,590 | cc | C++ | src/kudu/twitter-demo/parser-test.cc | AnupamaGupta01/kudu-1 | 79ee29db5ac1b458468b11f16f57f124601788e6 | [
"Apache-2.0"
] | 2 | 2016-09-12T06:53:49.000Z | 2016-09-12T15:47:46.000Z | src/kudu/twitter-demo/parser-test.cc | AnupamaGupta01/kudu-1 | 79ee29db5ac1b458468b11f16f57f124601788e6 | [
"Apache-2.0"
] | null | null | null | src/kudu/twitter-demo/parser-test.cc | AnupamaGupta01/kudu-1 | 79ee29db5ac1b458468b11f16f57f124601788e6 | [
"Apache-2.0"
] | 2 | 2018-04-03T05:49:03.000Z | 2020-05-29T21:18:46.000Z | // Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#include "kudu/twitter-demo/parser.h"
#include <glog/logging.h>
#include <gtest/gtest.h>
#include "kudu/gutil/strings/split.h"
#include "kudu/util/env.h"
#include "kudu/util/path_util.h"
#include "kudu/util/test_util.h"
#include "kudu/util/status.h"
namespace kudu {
namespace twitter_demo {
// Return the directory of the currently-running executable.
static string GetExecutableDir() {
string exec;
CHECK_OK(Env::Default()->GetExecutablePath(&exec));
return DirName(exec);
}
static Status LoadFile(const string& name, vector<string>* lines) {
string path = JoinPathSegments(GetExecutableDir(), name);
faststring data;
RETURN_NOT_OK(ReadFileToString(Env::Default(), path, &data));
*lines = strings::Split(data.ToString(), "\n");
return Status::OK();
}
static void EnsureFileParses(const char* file, TwitterEventType expected_type) {
TwitterEventParser p;
TwitterEvent event;
SCOPED_TRACE(file);
vector<string> jsons;
CHECK_OK(LoadFile(file, &jsons));
int line_number = 1;
for (const string& json : jsons) {
if (json.empty()) continue;
SCOPED_TRACE(json);
SCOPED_TRACE(line_number);
ASSERT_OK(p.Parse(json, &event));
ASSERT_EQ(expected_type, event.type);
line_number++;
}
}
// example-tweets.txt includes a few hundred tweets collected
// from the sample hose.
TEST(ParserTest, TestParseTweets) {
EnsureFileParses("example-tweets.txt", TWEET);
}
// example-deletes.txt includes a few hundred deletes collected
// from the sample hose.
TEST(ParserTest, TestParseDeletes) {
EnsureFileParses("example-deletes.txt", DELETE_TWEET);
}
TEST(ParserTest, TestReformatTime) {
ASSERT_EQ("20130814063107", TwitterEventParser::ReformatTime("Wed Aug 14 06:31:07 +0000 2013"));
}
} // namespace twitter_demo
} // namespace kudu
| 30.470588 | 98 | 0.73861 |
0b3c26a3b1dbbd4be4b8d43d41ff25332e79a3be | 390 | dart | Dart | lib/features/notes/presentation/home/home_binding.dart | snehilarya/demo | 47437ebdd6f18a3e4830de30cc834b82fc91df45 | [
"MIT"
] | 1 | 2021-12-25T13:29:24.000Z | 2021-12-25T13:29:24.000Z | lib/features/notes/presentation/home/home_binding.dart | K018C1248/FFNote | 12dffe6d8551c3acc01cede977248c3306161386 | [
"MIT"
] | null | null | null | lib/features/notes/presentation/home/home_binding.dart | K018C1248/FFNote | 12dffe6d8551c3acc01cede977248c3306161386 | [
"MIT"
] | null | null | null | import 'package:get/get.dart';
import '../../domain/usecases/get_notes_stream_use_case.dart';
import 'home_controller.dart';
class HomeBindings extends Bindings {
@override
void dependencies() {
Get.lazyPut<GetNotesSteamNoteUseCase>(
() => GetNotesSteamNoteUseCase(Get.find(), Get.find()));
Get.lazyPut(() => HomeController(Get.find(), Get.find(), Get.find()));
}
}
| 27.857143 | 74 | 0.692308 |
d2530052f980b1674e2788fb2df56e16b3e298b2 | 255 | php | PHP | application/lib/exception/WeChatException.php | 1521350289/TP5-zerg | 72917adccd76ccc293d211d99543deba34a4b13c | [
"Apache-2.0"
] | null | null | null | application/lib/exception/WeChatException.php | 1521350289/TP5-zerg | 72917adccd76ccc293d211d99543deba34a4b13c | [
"Apache-2.0"
] | null | null | null | application/lib/exception/WeChatException.php | 1521350289/TP5-zerg | 72917adccd76ccc293d211d99543deba34a4b13c | [
"Apache-2.0"
] | null | null | null | <?php
/**
* Created by PhpStorm.
* User: Hasee
* Date: 2018/10/13
* Time: 下午 8:28
*/
namespace app\lib\exception;
class WeChatException extends BaseException
{
public $code = 404;
public $msg = '微信服务器接口调用失败';
public $errorCode = 999;
} | 15 | 43 | 0.647059 |
ab24673bae54518cc0817db6d78d09230e7d00ab | 1,073 | cs | C# | parts/0000-library/Assets/Vendor/FPCSharpUnity/unity/Android/Bindings/Binding.cs | FPCSharpUnity/FPCSharpUnity | 7310539b535ceafedc0dec69dd0db9703a953d09 | [
"MIT"
] | 1 | 2022-02-10T03:45:23.000Z | 2022-02-10T03:45:23.000Z | parts/0000-library/Assets/Vendor/FPCSharpUnity/unity/Android/Bindings/Binding.cs | FPCSharpUnity/FPCSharpUnity | 7310539b535ceafedc0dec69dd0db9703a953d09 | [
"MIT"
] | null | null | null | parts/0000-library/Assets/Vendor/FPCSharpUnity/unity/Android/Bindings/Binding.cs | FPCSharpUnity/FPCSharpUnity | 7310539b535ceafedc0dec69dd0db9703a953d09 | [
"MIT"
] | 1 | 2022-02-03T23:34:05.000Z | 2022-02-03T23:34:05.000Z | #if UNITY_ANDROID
using System;
using UnityEngine;
namespace FPCSharpUnity.unity.Android.Bindings {
public abstract class Binding : IEquatable<Binding>, IDisposable {
public readonly AndroidJavaObject java;
protected Binding(AndroidJavaObject java) { this.java = java; }
public override string ToString() => java.Call<string>("toString");
public override int GetHashCode() => java.Call<int>("hashCode");
public override bool Equals(object obj) => Equals(obj as Binding);
public void Dispose() => java.Dispose();
public bool Equals(Binding other) {
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
if (ReferenceEquals(java, other.java)) return true;
return java.Call<bool>("equals", other.java);
}
public static bool operator ==(Binding left, Binding right) => Equals(left, right);
public static bool operator !=(Binding left, Binding right) => !Equals(left, right);
public static implicit operator AndroidJavaObject(Binding b) => b.java;
}
}
#endif | 37 | 88 | 0.707363 |
4888f0e9414c744c1df791e0b6fa74e266b48a6b | 431 | kt | Kotlin | coroutines/src/main/kotlin/org/neo4j/driver/coroutines/extensions.kt | latinovitsantal/vertx-neo4j | cf1fbf391543559f1cd399fafb004c556231b494 | [
"Apache-2.0"
] | null | null | null | coroutines/src/main/kotlin/org/neo4j/driver/coroutines/extensions.kt | latinovitsantal/vertx-neo4j | cf1fbf391543559f1cd399fafb004c556231b494 | [
"Apache-2.0"
] | null | null | null | coroutines/src/main/kotlin/org/neo4j/driver/coroutines/extensions.kt | latinovitsantal/vertx-neo4j | cf1fbf391543559f1cd399fafb004c556231b494 | [
"Apache-2.0"
] | null | null | null | package org.neo4j.driver.coroutines
import org.neo4j.driver.Driver
import org.neo4j.driver.async.AsyncSession
import org.neo4j.driver.async.AsyncTransaction
import org.neo4j.driver.async.ResultCursor
fun Driver.suspending() = SuspendingDriver(this)
fun AsyncSession.suspending() = SuspendingSession(this)
fun ResultCursor.suspending() = SuspendingResultCursor(this)
fun AsyncTransaction.suspending() = SuspendingTransaction(this) | 39.181818 | 63 | 0.839907 |
c5b881469d0689d6b9f877bfbbfee4455c738b9a | 8,834 | cc | C++ | src/sstable.cc | dosco/devildb | 05969c766ab17b44a141e04804c2638bd4ac2d05 | [
"MIT"
] | 3 | 2015-01-30T08:15:08.000Z | 2021-12-01T13:25:56.000Z | src/sstable.cc | dosco/devildb | 05969c766ab17b44a141e04804c2638bd4ac2d05 | [
"MIT"
] | null | null | null | src/sstable.cc | dosco/devildb | 05969c766ab17b44a141e04804c2638bd4ac2d05 | [
"MIT"
] | 2 | 2020-09-12T22:28:48.000Z | 2021-09-16T07:37:34.000Z | #include <boost/thread.hpp>
#include <fstream>
#include "sstable.h"
#include "iterator.h"
void ThreadFunction()
{
int counter = 0;
for(;;)
{
std::cout << "thread iteration " << ++counter << " Press Enter to stop" << std::endl;
try
{
// Sleep and check for interrupt.
// To check for interrupt without sleep,
// use boost::this_thread::interruption_point()
// which also throws boost::thread_interrupted
boost::this_thread::sleep(boost::posix_time::milliseconds(500));
}
catch(boost::thread_interrupted&)
{
std::cout << "Thread is stopped" << std::endl;
return;
}
}
}
class ValueIterator : public Iterator {
private:
const char *data_;
const char *data_start_;
const char *data_current_;
const char *data_next_;
size_t data_len_;
const char *key_;
size_t key_len_;
const char *value_;
size_t value_len_;
long int timestamp_;
inline const char* process_block() {
const char *base = data_current_;
key_len_ = value_len_ = 0;
memcpy(&key_len_, base, sizeof(size_t));
base += sizeof(size_t);
key_ = base;
base += key_len_;
memcpy(&value_len_, base, sizeof(size_t));
base += sizeof(size_t);
value_ = base;
base += value_len_;
memcpy(×tamp_, base, sizeof(long int));
base += sizeof(long int);
return base;
}
public:
ValueIterator(const char *start, size_t len)
: Iterator() {
data_len_ = len;
data_ = start + sizeof(size_t);
data_start_ = data_;
data_current_ = data_;
data_next_ = process_block();
}
~ValueIterator() { }
virtual void SeekToFirst() {
data_current_ = data_start_;
}
virtual void SeekToLast() { }
virtual void Seek(const Slice& target) {
for(;Valid() && key() != target; Next());
}
virtual void Next() {
data_current_ = data_next_;
data_next_ = process_block();
}
virtual void Prev() { }
virtual bool Valid() const {
return data_next_ < (data_start_ + data_len_);
}
Slice key() const {
return Slice(key_, key_len_);
}
Slice value() const {
return Slice(value_, value_len_);
}
};
class IndexIterator : public Iterator {
private:
const char *data_;
const char *index_start_;
const char *index_current_;
const char *index_next_;
size_t index_len_;
const char *key_;
size_t key_len_;
size_t value_index_;
size_t value_len_;
inline const char* process_block() {
const char *base = index_current_;
key_len_ = value_len_ = 0;
memcpy(&key_len_, base, sizeof(size_t));
base += sizeof(size_t);
key_ = base;
base += key_len_;
memcpy(&value_index_, base, sizeof(size_t));
base += sizeof(size_t);
memcpy(&value_len_, base, sizeof(size_t));
base += sizeof(size_t);
return base;
}
public:
IndexIterator(const char *data, const char *start, size_t len)
: Iterator(),
data_(data),
index_start_(start),
index_len_(len),
index_current_(start),
index_next_(0) {
index_next_ = process_block();
}
~IndexIterator() { }
virtual void SeekToFirst() {
index_current_ = index_start_;
}
virtual void SeekToLast() { }
virtual void Seek(const Slice& target) {
for(;Valid() && key() != target; Next());
}
virtual void Next() {
index_current_ = index_next_;
index_next_ = process_block();
}
virtual void Prev() { }
virtual bool Valid() const {
return index_next_ < (index_start_ + index_len_);
}
Slice key() const {
return Slice(key_, key_len_);
}
Slice value() const {
return NULL;
}
size_t value_index() const {
return value_index_;
}
size_t value_len() const {
return value_len_;
}
};
int SSTable::Write(const char *data, size_t len) {
//sst_->write((const char *) &len, sizeof(size_t));
//sst_->write((const char *) data, len);
return len;
}
void SSTable::ReadBloomFilter() {
std::cout << "Reading Bloomfilter from disk..." << std::endl;
std::ifstream is(filename_ + ".filter", std::ios::in | std::ios::binary);
bf_.deserialize(is);
is.close();
}
void SSTable::ReadIndex() {
const char *base = reinterpret_cast<const char*>(mmapped_region_);
const char *end = base + length_;
Slice signature(end - 3, 3);
memcpy(&index_length_, end - signature.size() - sizeof(size_t), sizeof(size_t));
index_ = end - signature.size() - sizeof(size_t) - index_length_;
std::cout << "Signature: " << signature << std::endl;
std::cout << "Index Length: " << index_length_ << std::endl;
IndexIterator *i = new IndexIterator(base, index_, index_length_);
Slice s("zvZUwt`7tg53c3U88UzyNl0gL0fEuZylir2YngQCiESOBwgKjuXTAvyuHVA747kHnjOEL8az9TXI3hYEZryC8izXPy9KYdsEwTg1s", 100);
//for(i->Seek(s);i->Valid() ;i->Next()) {
for(;i->Valid() ;i->Next()) {
std::cout << i->key().ToString() << " = " << i->value().size() << std::endl;
ValueIterator *v = new ValueIterator(base + i->value_index(), i->value_len());
//for(;v->Valid() ;v->Next()) {
//std::cout << v->key().ToString() << " = " << v->value().ToString() << std::endl;
//}
}
}
void SSTable::WriteBloomFilter() {
std::cout << "Writing Bloomfilter to disk..." << std::endl;
//TODO: Could by optimized in the future
int row_column_count = mt_.count();
for(Rows::RowMap::const_iterator it = mt_.begin(); it != mt_.end(); ++it) {
Columns *c = it->second;
row_column_count += c->count();
}
//Create the filter
BloomFilter bf(row_column_count, 0.2);
for(Rows::RowMap::const_iterator it = mt_.begin(); it != mt_.end(); ++it) {
Columns *c = it->second;
bf.add(it->first);
for(Columns::const_iterator cit = c->begin(); cit != c->end(); ++cit) {
bf.add(it->first + ":" + cit->name());
}
}
std::ofstream os(filename_ + ".filter", std::ios::out | std::ios::binary);
os.rdbuf()->pubsetbuf(0, 0);
bf.serialize(os);
os.close();
}
inline size_t write_column(std::ofstream &os, const Column &c) {
size_t bytes_written = 0;
size_t name_len = c.name().size();
os.write((const char *) &name_len, sizeof(size_t));
os.write((const char *) c.name().c_str(), name_len);
bytes_written += sizeof(size_t) + name_len;
size_t value_len = c.value().size();
os.write((const char *) &value_len, sizeof(size_t));
os.write((const char *) c.value().data(), value_len);
bytes_written += sizeof(size_t) + value_len;
long int ts = c.timestamp();
os.write((const char *) &ts, sizeof(long int));
bytes_written += sizeof(long int);
return bytes_written;
}
struct CFIndexInfo {
size_t index;
size_t size;
};
void SSTable::WriteData() {
std::cout << "Writing SSTable to disk..." << std::endl;
std::map<std::string, CFIndexInfo *> rowindex;
size_t i = 0;
//int BLOCK_SIZE = 8192;
std::ofstream os(filename_ + ".sst", std::ios::out | std::ios::binary);
os.rdbuf()->pubsetbuf(0, 0);
// write columns
for(Rows::RowMap::const_iterator it = mt_.begin(); it != mt_.end(); ++it) {
CFIndexInfo *cfif = new CFIndexInfo();
cfif->index = i;
Columns *c = it->second;
for(Columns::const_iterator cit = c->begin(); cit != c->end(); ++cit) {
i += write_column(os, *cit);
}
cfif->size = i - cfif->index - i;
rowindex.insert(std::make_pair(it->first, cfif));
}
// write index
size_t index_block_size = 0;
for(std::map<std::string, CFIndexInfo *>::const_iterator it = rowindex.begin(); it != rowindex.end(); ++it) {
size_t row_key_len = it->first.size();
os.write((const char *) &row_key_len, sizeof(size_t));
os.write((const char *) it->first.c_str(), row_key_len);
CFIndexInfo *cfif = it->second;
//std::cout << block_pos << std::endl;
os.write((const char *) &cfif->index, sizeof(size_t));
os.write((const char *) &cfif->size, sizeof(size_t));
index_block_size += row_key_len + sizeof(size_t) + sizeof(size_t) + sizeof(size_t);
}
// write index size
os.write((const char *) &index_block_size, sizeof(size_t));
os.write((const char *) "SST", 3);
os.close();
}
SSTable::SSTable(MemTable &mt) : mt_(mt), filename_("data/" + mt_.GetColumnFamily().name()) {
//boost::thread t(&ThreadFunction);
std::cout << "Initializing SSTable..." << std::endl;
std::string fname = filename_ + ".sst";
int fd = open(fname.c_str(), O_RDONLY);
//is_ = new std::ifstream(filename_ + ".filter", std::ios::in | std::ios::binary | std::ios::ate);
if(fd < 0) {
WriteBloomFilter();
WriteData();
return;
}
// File size
struct stat buf;
fstat(fd, &buf);
length_ = buf.st_size;
mmapped_region_ = mmap(NULL, length_, PROT_READ, MAP_SHARED, fd, 0);
std::cout << "Length: " << length_ << std::endl;
//ReadBloomFilter();
ReadIndex();
}
| 24.814607 | 120 | 0.621236 |
63e360d0aaa6383f845761ddd06d6b2fb35b76e8 | 154 | dart | Dart | lib/nsgApiException.dart | zenalex/nsg_data | aaab71e36ad73590cff9dcb201e8946a063291e5 | [
"BSD-3-Clause"
] | 1 | 2021-01-12T17:52:01.000Z | 2021-01-12T17:52:01.000Z | lib/nsgApiException.dart | zenalex/nsg_data | aaab71e36ad73590cff9dcb201e8946a063291e5 | [
"BSD-3-Clause"
] | null | null | null | lib/nsgApiException.dart | zenalex/nsg_data | aaab71e36ad73590cff9dcb201e8946a063291e5 | [
"BSD-3-Clause"
] | null | null | null | import 'package:nsg_data/nsgDataApiError.dart';
class NsgApiException implements Exception {
final NsgApiError error;
NsgApiException(this.error);
}
| 22 | 47 | 0.805195 |
5c88766929418b23e3df6d0926a86d504f5a5b21 | 530 | c | C | 0x0B-malloc_free/2-str_concat.c | JRodriguez9510/holbertonschool-low_level_programming | 3a0343f948a0586f5834f3e92f203aaa2a8a4757 | [
"MIT"
] | 1 | 2021-01-27T03:13:38.000Z | 2021-01-27T03:13:38.000Z | 0x0B-malloc_free/2-str_concat.c | JRodriguez9510/holbertonschool-low_level_programming | 3a0343f948a0586f5834f3e92f203aaa2a8a4757 | [
"MIT"
] | null | null | null | 0x0B-malloc_free/2-str_concat.c | JRodriguez9510/holbertonschool-low_level_programming | 3a0343f948a0586f5834f3e92f203aaa2a8a4757 | [
"MIT"
] | 1 | 2020-10-22T04:55:08.000Z | 2020-10-22T04:55:08.000Z | #include "holberton.h"
#include <stdlib.h>
/**
*str_concat - Concatenates 2 strings
*@s1: string to concatenate
*@s2: string to concatenate
*Return: Always 0
*/
char *str_concat(char *s1, char *s2)
{
int i = 0, j = 0, c;
char *con;
if (s1 == NULL)
s1 = ("");
if (s2 == NULL)
s2 = ("");
while (s1[i] != '\0')
i++;
while (s2[j] != '\0')
j++;
con = malloc(sizeof(char) * (i + j + 1));
if (con != NULL)
{
for (c = 0; c <= i; c++)
con[c] = s1[c];
for (c = 0; c <= j; c++)
con[i + c] = s2[c];
}
else
return ('\0');
return (con);
}
| 16.060606 | 41 | 0.526415 |
2dc395b0fa9c6c1c650fc58ed27f383e6f945cc0 | 5,939 | lua | Lua | src/main/resources/orange/plugins/proxy/handler.lua | biticcf/phoenix-baseapi-platform | 7be4b8a48f9d883cc051020ac90b59b0e3e69f53 | [
"Apache-2.0"
] | 1 | 2019-03-04T01:33:24.000Z | 2019-03-04T01:33:24.000Z | src/main/resources/orange/plugins/proxy/handler.lua | biticcf/phoenix-baseapi-platform | 7be4b8a48f9d883cc051020ac90b59b0e3e69f53 | [
"Apache-2.0"
] | null | null | null | src/main/resources/orange/plugins/proxy/handler.lua | biticcf/phoenix-baseapi-platform | 7be4b8a48f9d883cc051020ac90b59b0e3e69f53 | [
"Apache-2.0"
] | null | null | null | local BasePlugin = require("orange.plugins.base_handler")
local cjson = require("cjson.safe")
local http = require("orange.utils.http")
local string_gsub = string.gsub
local stringy = require("orange.utils.stringy")
local responses = require("orange.lib.responses")
local ProxyHandler = BasePlugin:extend()
ProxyHandler.PRIORITY = 2000
function ProxyHandler:new(store, redis, config)
ProxyHandler.super.new(self, "proxy-plugin")
self.store = store
self.redis = redis
self.config = config
end
local function validateToken(env,urls,src,token,puid,account)
if not src then return false end
if not token then return false end
if src ~= "c" and src ~= "b" then return false end
if src == "c" and not puid then return false end
if src == "b" and not account then return false end
local url, host, path, schame, schame_host
local query, param = "", {}
if src == "c" then
url = urls.validate_token_c
if env ~= "prod" then
url = (string_gsub(url,"{{puid}}",puid))
end
query = "puid=" .. puid .. "&ploginToken=" .. token
elseif src == "b" then
url = urls.validate_token_b
query = "account=" .. account .. "&sessionToken=" .. token
end
local httpc = http.new()
httpc:set_keepalive(60000, 10)
httpc:set_timeout(5000)
local uri = url .. "?" .. query
local res, err = httpc:request_uri(uri)
if res ~= nil then
local body = cjson.decode(res.body)
if src == "c" then
if body and body.status and tonumber(body.status) == 200 then
return true
end
elseif src == "b" then
if body and body.status and tonumber(body.status) == 200 and body.data == true then
return true
end
end
end
return false
end
function makeMessage(returnCode, returnMsg, returnData)
local result = {}
result.status = returnCode
result.message = returnMsg
result.data = returnData
return result
end
local function wait()
ngx.sleep(1)
end
function ProxyHandler:proxy(accessType)
ProxyHandler.super.proxy(self)
local ngx_var = ngx.var
local ngx_var_uri = ngx_var.uri
local ngx_var_host = ngx_var.http_host
local ngx_var_scheme = ngx_var.scheme
local ngx_var_args = ngx_var.args
local host, port, uriId, newUrl = self.redis:queryHostByUri(ngx_var_uri)
if not host then
ngx.log(ngx.ERR, "[Proxy][ngx_var_uri:" .. tostring(ngx_var_uri) .. "]Error!")
-- 404
return responses.send(ngx.HTTP_NOT_FOUND, makeMessage(ngx.HTTP_NOT_FOUND, '接口不存在'))
end
ngx.log(ngx.INFO, "self.redis:queryHostByUri.result:".." host : " .. tostring(host) .. " port : " .. tostring(port) .. "uriId : " .. tostring(uriId) .. " newUrl : " .. tostring(newUrl))
local method_type = ngx.req.get_method()
local key = "API_VER_METHOD_MAP_"..uriId
local res, err = self.redis:queryUriMethod(key, method_type)
if err or not res then
ngx.log(ngx.ERR, "[Proxy][self.redis:hget]Error!")
-- 405
return responses.send(ngx.HTTP_NOT_ALLOWED, makeMessage(ngx.HTTP_NOT_ALLOWED, '接口不支持该METHOD类型'))
end
local method = cjson.decode(res)
-- 检查是否允许外网访问begin 0-不允许外网访问,1-允许外网访问
local accessFlagSrc = method["accessFlag"]
local accessFlag = accessFlagSrc
if not accessFlag or type(accessFlag) ~= "number" or accessFlag ~= 1 then accessFlag = 0 end
-- 访问类型,0-内网访问,1-外网访问
local accessTypeSrc = accessType
if not accessType or type(accessType) ~= "number" or accessType ~= 0 then accessType = 1 end
if accessFlag == 0 and accessType == 1 then
ngx.log(ngx.ERR, "[Proxy][" .. ngx_var_uri .. "][accessFlag:" .. tostring(accessFlagSrc) .. "][accessType:" .. tostring(accessTypeSrc) .. "]不允许外网访问!")
-- 403
return responses.send(ngx.HTTP_FORBIDDEN, makeMessage(ngx.HTTP_FORBIDDEN, '接口禁止外网访问'))
end
-- 检查是否允许外网访问end
-- 限流代码块 开始
local traffic_limit_flag = method["trafficLimitFlag"]
if traffic_limit_flag and type(traffic_limit_flag) == "number" and traffic_limit_flag == 1 then
local expire_time = 1
local rate_count
if accessFlag == 0 then
rate_count = method["insideRate"]
end
if accessFlag == 1 then
rate_count = method["outsideRate"]
end
if rate_count > 0 then
local rate_key = "rate_key_" .. uriId .. "_" .. method_type .. "_" .. accessType
local limit_res, limit_err = self.redis:rate_limiting(rate_key,expire_time)
if not limit_res then
ngx.log(ngx.ERR, "[Proxy][self.redis:rate_limiting]Error!")
return ngx.exit(ngx.HTTP_NOT_FOUND)
end
ngx.log(ngx.ERR, "limit_res:[" .. limit_res .. "], rate_count : [" .. rate_count .. "]" )
if limit_res > rate_count then
return ngx.exit(ngx.HTTP_FORBIDDEN)
end
end
end
-- 限流代码块 结束
-- 增加token校验begin
local tokenFlag = method["tokenFlag"]
if not tokenFlag or type(tokenFlag) ~= "number" or tokenFlag ~= 1 then tokenFlag = 0 end
if tokenFlag == 0 then
local token = ngx.var.http_token
local src = ngx.var.http_src
local puid = ngx.var.http_puid
local account = ngx.var.http_account
local env = self.config.env
local url = self.config.url
local res = validateToken(env,url,src,token,puid,account)
if not res then
-- 401
return responses.send(ngx.HTTP_UNAUTHORIZED, makeMessage(ngx.HTTP_UNAUTHORIZED, '接口鉴权失败'))
end
end
-- 增加token校验end
ngx.var.upstream_host = host .. ":" .. port
-- 支持uri地址重写
ngx.req.set_uri(newUrl)
ngx.var.backend_proxy = host .. ":" .. port
end
return ProxyHandler
| 33.178771 | 189 | 0.625021 |
7624c17a2b378d751699e305016401e0c06fb307 | 277 | asm | Assembly | libsrc/_DEVELOPMENT/stdio/c/sccz80/vasprintf.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/stdio/c/sccz80/vasprintf.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/stdio/c/sccz80/vasprintf.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
; int vasprintf(char **ptr, const char *format, void *arg)
SECTION code_clib
SECTION code_stdio
PUBLIC vasprintf
EXTERN asm_vasprintf
vasprintf:
pop af
pop bc
pop de
exx
pop de
push de
exx
push de
push bc
push af
jp asm_vasprintf
| 10.653846 | 58 | 0.65704 |
fbddab97ea6182e8203b0ae65c481d05b5211d88 | 280 | java | Java | src/main/java/com/metronom/simpleconfluenceconnector/model/ConfluencePageVersion.java | metro-nom/simpleconfluenceconnector | 1c4db9d1d55eddb5325c53d673c6ad627cce487f | [
"BSD-3-Clause"
] | null | null | null | src/main/java/com/metronom/simpleconfluenceconnector/model/ConfluencePageVersion.java | metro-nom/simpleconfluenceconnector | 1c4db9d1d55eddb5325c53d673c6ad627cce487f | [
"BSD-3-Clause"
] | null | null | null | src/main/java/com/metronom/simpleconfluenceconnector/model/ConfluencePageVersion.java | metro-nom/simpleconfluenceconnector | 1c4db9d1d55eddb5325c53d673c6ad627cce487f | [
"BSD-3-Clause"
] | null | null | null | package com.metronom.simpleconfluenceconnector.model;
public class ConfluencePageVersion {
private final int number;
public ConfluencePageVersion(final int number) {
this.number = number;
}
public int getNumber() {
return this.number;
}
}
| 17.5 | 53 | 0.685714 |
05ef5b16b4a4ca0abce934de874527c5963fa640 | 693 | html | HTML | geoportal/geoportailv3_geoportal/static-ngeo/js/infobar/projectionselector.html | arnaud-morvan/geoportailv3 | b9d676cf78e45e12894f7d1ceea99b915562d64f | [
"MIT"
] | 17 | 2015-01-14T08:40:22.000Z | 2021-05-08T04:39:50.000Z | geoportal/geoportailv3_geoportal/static-ngeo/js/infobar/projectionselector.html | arnaud-morvan/geoportailv3 | b9d676cf78e45e12894f7d1ceea99b915562d64f | [
"MIT"
] | 1,477 | 2015-01-05T09:58:41.000Z | 2022-03-18T11:07:09.000Z | geoportal/geoportailv3_geoportal/static-ngeo/js/infobar/projectionselector.html | arnaud-morvan/geoportailv3 | b9d676cf78e45e12894f7d1ceea99b915562d64f | [
"MIT"
] | 14 | 2015-07-24T07:33:13.000Z | 2021-03-02T13:51:48.000Z | <div class="projection-container hidden-xs hidden-sm">
<div class="projection-select">
<div class="dropdown dropup">
<button type="button" class="btn btn-default projectionselector-button" data-toggle="dropdown">
<span>{{ctrl.projection.label}}</span> <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li ng-repeat="projitem in ::ctrl.projectionOptions">
<a href ng-click="ctrl.switchProjection(projitem.value)" ng-bind-html="::projitem.label"></a>
</li>
</ul>
</div>
</div>
<div class="mouse-coordinates" ngeo-control="ctrl.mousePositionControl" ngeo-control-map="ctrl.map"></div>
</div>
| 43.3125 | 108 | 0.65368 |
8569aedba80689ed405a2371b22e171b8a89e805 | 716 | js | JavaScript | seeds/user-seeds.js | rickhill543/tech-talker-blog | 65595c022944764e301db55dd348afccf1990137 | [
"W3C"
] | null | null | null | seeds/user-seeds.js | rickhill543/tech-talker-blog | 65595c022944764e301db55dd348afccf1990137 | [
"W3C"
] | 4 | 2021-03-29T02:06:30.000Z | 2021-03-29T03:43:44.000Z | seeds/user-seeds.js | rickhill543/tech-talker-blog | 65595c022944764e301db55dd348afccf1990137 | [
"W3C"
] | null | null | null | const sequelize = require('../config/connection');
const { User } = require('../models');
const userdata = [
{
username: 'John Doe',
email: 'johndoe@email.email',
password: 'password123'
},
{
username: 'Jane Doe',
email: 'janedoe@email.email',
password: 'password123'
},
{
username: 'Bob Smith',
email: 'bobsmith@email.email',
password: 'password123'
},
{
username: 'Barb Smith',
email: 'barbsmith@email.email',
password: 'password123'
},
{
username: 'Super Double Dragon',
email: 'sdd@email.email',
password: 'password123'
}
];
const seedUsers = () => User.bulkCreate(userdata, {individualHooks: true});
module.exports = seedUsers;
| 20.457143 | 75 | 0.615922 |
aca35dd6d1a50bba1e4a7fb6e194cde9a9c02e37 | 2,436 | cpp | C++ | CsWeapon/Source/CsWp/Public/Trace/CsTraceWeapon.cpp | closedsum/core | c3cae44a177b9684585043a275130f9c7b67fef0 | [
"Unlicense"
] | 2 | 2019-03-17T10:43:53.000Z | 2021-04-20T21:24:19.000Z | CsWeapon/Source/CsWp/Public/Trace/CsTraceWeapon.cpp | closedsum/core | c3cae44a177b9684585043a275130f9c7b67fef0 | [
"Unlicense"
] | null | null | null | CsWeapon/Source/CsWp/Public/Trace/CsTraceWeapon.cpp | closedsum/core | c3cae44a177b9684585043a275130f9c7b67fef0 | [
"Unlicense"
] | null | null | null | // Copyright 2017-2021 Closed Sum Games, LLC. All Rights Reserved.
#include "Trace/CsTraceWeapon.h"
#include "CsWp.h"
// Weapon
#include "CsWeapon.h"
// Update
#include "Managers/Time/CsUpdate.h"
UCsTraceWeapon::UCsTraceWeapon(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
}
// FCsTraceWeapon
#pragma region
const FCsTraceWeapon FCsTraceWeapon::Empty;
// TCsInterfaceObject
#pragma region
void FCsTraceWeapon::SetInterface(ICsTraceWeapon* InInterface)
{
Super::SetInterface(InInterface);
if (!Object)
{
checkf(0, TEXT("FCsTraceWeapon::SetInterface: Currently do NOT support a non-UObject based weapon implmenting the interface: ICsTraceWeapon."));
}
}
void FCsTraceWeapon::SetObject(UObject* InObject)
{
Super::SetObject(InObject);
if (Object)
{
// ICsWeapon
{
// Interface
if (ICsWeapon* O = Cast<ICsWeapon>(Object))
{
SetWeapon(O);
}
// Script Interface
else
if (Class->ImplementsInterface(UCsWeapon::StaticClass()))
{
SetScriptWeapon();
}
else
{
checkf(false, TEXT("FCsTraceWeapon:SetObject: Object: %s with Class: %s does NOT implement the interface: ICsWeapon."), *(Object->GetName()));
}
}
// ICsTraceWeapon
{
// Interface
if (ICsTraceWeapon* O = Cast<ICsTraceWeapon>(Object))
{
SetInterface(O);
}
// Script Interface
else
if (Class->ImplementsInterface(UCsTraceWeapon::StaticClass()))
{
SetScript();
}
else
{
checkf(false, TEXT("FCsTraceWeapon:SetObject: Object: %s with Class: %s does NOT implement the interface: ICsTraceWeapon."), *(Object->GetName()));
}
}
// ICsUpdate
{
// Interface
if (ICsUpdate* U = Cast<ICsUpdate>(Object))
{
SetUpdate(U);
}
// Script Interface
else
if (Class->ImplementsInterface(UCsUpdate::StaticClass()))
{
SetScriptUpdate();
}
}
}
}
void FCsTraceWeapon::Reset()
{
Super::Reset();
Weapon = nullptr;
bScriptWeapon = false;
_Update = nullptr;
bScriptUpdate = false;
Script_GetData_Impl.Unbind();
Script_StartFire_Impl.Unbind();
Script_StopFire_Impl.Unbind();
Script_Update_Impl.Unbind();
}
#pragma endregion TCsInterfaceObject
// ICsUpdate
#pragma region
void FCsTraceWeapon::Update(const FCsDeltaTime& DeltaTime)
{
if (bScriptUpdate)
Script_Update_Impl.Execute(Object, DeltaTime);
else
_Update->Update(DeltaTime);
}
#pragma endregion ICsUpdate
#pragma endregion FCsProjectileWeapon | 19.967213 | 151 | 0.700739 |
2dbb4d919a46a591e707cb9f7d2942b5f5197749 | 990 | dart | Dart | packages/common_dimensions/lib/corners.dart | helloyeseul/flutter_general_packages | 0979f02f50ea6e95ee7c715259a0d2aee60a23e9 | [
"MIT"
] | null | null | null | packages/common_dimensions/lib/corners.dart | helloyeseul/flutter_general_packages | 0979f02f50ea6e95ee7c715259a0d2aee60a23e9 | [
"MIT"
] | null | null | null | packages/common_dimensions/lib/corners.dart | helloyeseul/flutter_general_packages | 0979f02f50ea6e95ee7c715259a0d2aee60a23e9 | [
"MIT"
] | null | null | null | part of 'common_dimensions.dart';
abstract class Corners {
static const all2 = BorderRadius.all(Radius.circular(Sizes.s2));
static const all4 = BorderRadius.all(Radius.circular(Sizes.s4));
static const all8 = BorderRadius.all(Radius.circular(Sizes.s8));
static const all12 = BorderRadius.all(Radius.circular(Sizes.s12));
static const all16 = BorderRadius.all(Radius.circular(Sizes.s16));
static const all20 = BorderRadius.all(Radius.circular(Sizes.s20));
static const all24 = BorderRadius.all(Radius.circular(Sizes.s24));
static const all28 = BorderRadius.all(Radius.circular(Sizes.s28));
static const all36 = BorderRadius.all(Radius.circular(Sizes.s36));
static const all40 = BorderRadius.all(Radius.circular(Sizes.s40));
static const all48 = BorderRadius.all(Radius.circular(Sizes.s48));
static const top16 = BorderRadius.vertical(top: Radius.circular(Sizes.s16));
static const top28 = BorderRadius.vertical(top: Radius.circular(Sizes.s28));
Corners._();
}
| 47.142857 | 78 | 0.761616 |
d792ac5ce478c1d3b56b53c3719181dc7b8426f2 | 65,122 | asm | Assembly | maps/template/MapOut.asm | sleepingburrito/BackIsle | 546b4ac35136144c9103e0266bfa8d02a2834e17 | [
"MIT"
] | 1 | 2019-07-23T15:43:01.000Z | 2019-07-23T15:43:01.000Z | maps/template/MapOut.asm | sleepingburrito/BackIsle | 546b4ac35136144c9103e0266bfa8d02a2834e17 | [
"MIT"
] | null | null | null | maps/template/MapOut.asm | sleepingburrito/BackIsle | 546b4ac35136144c9103e0266bfa8d02a2834e17 | [
"MIT"
] | null | null | null | DB 001, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 001, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 003, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 003, 003, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 003, 003, 000, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 003, 003, 003, 003, 003, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 003, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 003, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 003, 003, 003, 003, 003, 003, 003, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 003, 003, 003, 003, 003, 003, 003, 003, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 127, 001, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 112, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 001, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 001, 001, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 051, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 002
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 071, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 071, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 071, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 071, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 071, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 071, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 071, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 071, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 071, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 071, 071, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 071, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 071, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 071, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 071, 071, 071, 071, 071, 071, 071, 071, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
DB 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 127 | 602.981481 | 602 | 0.60035 |
d5f6814614a36ae960cae94668b084a21969b376 | 352 | ps1 | PowerShell | ch07/build.ps1 | pratik-shah2611/docker-on-windows | 06c6f1c5050bf9f63fa9e636a0e3ec22142473e1 | [
"Apache-2.0"
] | 230 | 2017-06-19T16:03:30.000Z | 2022-03-30T03:07:42.000Z | ch07/build.ps1 | pratik-shah2611/docker-on-windows | 06c6f1c5050bf9f63fa9e636a0e3ec22142473e1 | [
"Apache-2.0"
] | 15 | 2017-07-01T01:24:34.000Z | 2021-02-23T17:59:57.000Z | ch07/build.ps1 | pratik-shah2611/docker-on-windows | 06c6f1c5050bf9f63fa9e636a0e3ec22142473e1 | [
"Apache-2.0"
] | 120 | 2017-07-15T13:06:45.000Z | 2022-03-22T19:21:04.000Z | docker image build -t dockeronwindows/ch07-nerd-dinner-web:2e ./ch07-nerd-dinner-web
docker image build -t dockeronwindows/ch07-nerd-dinner-api:2e ./ch07-nerd-dinner-api
docker image build -t dockeronwindows/ch07-nerd-dinner-db:2e ./ch07-nerd-dinner-db
docker image build -t dockeronwindows/ch07-nerd-dinner-homepage:2e ./ch07-nerd-dinner-homepage
| 39.111111 | 94 | 0.795455 |
fb466ca8b754e5ebad46227503b6b1bc1651d469 | 11,340 | java | Java | Application/Kewbr Quiz/src/App/Controllers/PackEditor.java | Bulbash3r/Lab-Tracker | a93c631e2711265b14ec9129b4c5154d7bc7131f | [
"MIT"
] | null | null | null | Application/Kewbr Quiz/src/App/Controllers/PackEditor.java | Bulbash3r/Lab-Tracker | a93c631e2711265b14ec9129b4c5154d7bc7131f | [
"MIT"
] | null | null | null | Application/Kewbr Quiz/src/App/Controllers/PackEditor.java | Bulbash3r/Lab-Tracker | a93c631e2711265b14ec9129b4c5154d7bc7131f | [
"MIT"
] | null | null | null | package App.Controllers;
import App.Main;
import App.Models.Pack;
import App.Models.Question;
import com.google.gson.Gson;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.DirectoryChooser;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.util.Callback;
import java.io.*;
import java.net.URL;
import java.nio.file.Files;
import java.util.*;
public class PackEditor implements Initializable {
@FXML
private Button btnBackLauncher;
@FXML
private ImageView imgvDots;
@FXML
private HBox hboxAdd;
@FXML
private TableView<Pack> tbvPacks;
@FXML
private VBox vboxLauncher;
@FXML
private Button btnAdd;
@FXML
private Button btnEdit;
@FXML
private Button btnRemove;
@FXML
private Button btnSave;
@FXML
private Button btnBackEditor;
@FXML
private ComboBox<String> cmbBoxDifficulty;
@FXML
private TextField txtFieldName;
@FXML
private TableView<Question> tbvQuestions;
@FXML
private VBox vboxEditor;
@FXML
private Label lblWriteName;
private ControllersManager manager;
private Stage stage;
private File dir = null;
private Pack curPack = null;
private Gson GSON = new Gson();
@Override
public void initialize(URL location, ResourceBundle resources) {
launcherInit();
editorInit();
}
private void launcherInit() {
TableColumn<Pack, String> nameColumn = new TableColumn<Pack, String>("Name");
nameColumn.setCellValueFactory(new PropertyValueFactory<Pack, String>("name"));
TableColumn<Pack, Integer> difficultyColumn = new TableColumn<Pack, Integer>("Difficulty");
difficultyColumn.setCellValueFactory(new PropertyValueFactory<Pack, Integer>("difficulty"));
TableColumn<Pack, Date> dateColumn = new TableColumn<Pack, Date>("Date");
dateColumn.setCellValueFactory(new PropertyValueFactory<Pack, Date>("date"));
tbvPacks.getColumns().addAll(nameColumn, difficultyColumn, dateColumn);
tbvPacks.setRowFactory(new Callback<TableView<Pack>, TableRow<Pack>>() {
@Override
public TableRow<Pack> call(TableView<Pack> param) {
TableRow<Pack> row = new TableRow<>();
row.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
if (event.getClickCount() == 2 && !row.isEmpty())
openEditor(row.getItem());
}
});
return row;
}
});
tbvPacks.setOnKeyReleased(new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent event) {
if (event.getCode() == KeyCode.DELETE && tbvPacks.getSelectionModel().getSelectedIndex() >= 0) {
File file = new File(dir.getPath() + "\\" + tbvPacks.getItems().get(tbvPacks.getSelectionModel().getSelectedIndex()).getName() + ".kwq");
if (file.exists()) {
try {
Files.delete(file.toPath());
} catch (IOException e) {
e.printStackTrace();
}
update();
}
}
}
});
File file = new File("Directory.txt");
if (file.exists()) {
try {
Scanner scanner = new Scanner(file);
dir = new File(scanner.nextLine());
scanner.close();
} catch (FileNotFoundException ex) {
ex.printStackTrace();
}
update();
}
btnBackLauncher.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
savePath();
stage.close();
}
});
hboxAdd.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
openEditor();
}
});
imgvDots.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
choose();
}
});
}
private void editorInit() {
TableColumn<Question, String> questionColumn = new TableColumn<Question, String>("Question");
questionColumn.setCellValueFactory(new PropertyValueFactory<Question, String>("question"));
TableColumn<Question, String> answerColumn = new TableColumn<Question, String>("Answer");
answerColumn.setCellValueFactory(new PropertyValueFactory<Question, String>("answer"));
tbvQuestions.getColumns().addAll(questionColumn, answerColumn);
cmbBoxDifficulty.getItems().addAll("1 - Novice", "2 - Apprentice", "3 - Adept", "4 - Expert", "5 - Master");
cmbBoxDifficulty.setValue("1 - Novice");
btnBackEditor.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
openLauncher();
}
});
btnAdd.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
insertQuestionWindow(tbvQuestions.getItems().size());
}
});
btnEdit.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
insertQuestionWindow(tbvQuestions.getSelectionModel().getSelectedIndex());
}
});
btnRemove.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
removeQuestion(tbvQuestions.getSelectionModel().getSelectedIndex());
}
});
btnSave.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
saveQuestion();
}
});
}
PackEditor(ControllersManager manager) {
this.manager = manager;
stage = new Stage();
stage.setTitle("Pack Editor");
stage.initModality(Modality.WINDOW_MODAL);
stage.initOwner(manager.getMainMenu().getStage().getScene().getWindow());
stage.getIcons().add(new Image("Images/icon.png"));
stage.setResizable(false);
try {
FXMLLoader loader = new FXMLLoader(Main.class.getResource("View/PackEditor.fxml"));
loader.setController(this);
stage.setScene(new Scene(loader.load()));
} catch (IOException ex) {
ex.printStackTrace();
}
stage.show();
}
private void choose() {
DirectoryChooser dirChooser = new DirectoryChooser();
dirChooser.setTitle("Choose path to the folder with your packs");
if (dir != null) {
if (dir.exists())
dirChooser.setInitialDirectory(dir);
}
File temp = dirChooser.showDialog(stage);
if (temp != null) {
dir = temp;
update();
}
}
private void savePath() {
if (dir == null || !dir.exists())
return;
try {
FileWriter fileWriter = new FileWriter(new File("Directory.txt"), false);
fileWriter.write(dir.getAbsolutePath());
fileWriter.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
private void update() {
if (dir == null || !dir.exists())
return;
File[] files = dir.listFiles(new Pack.Filter());
tbvPacks.getItems().clear();
try {
if (files != null && files.length != 0) {
Scanner scanner;
for (File file : files) {
scanner = new Scanner(file);
tbvPacks.getItems().add(GSON.fromJson(scanner.nextLine(), Pack.class));
scanner.close();
}
}
} catch (FileNotFoundException ex) {
ex.printStackTrace();
}
}
private void openEditor() {
if (dir == null || !dir.exists())
return;
vboxEditor.setVisible(true);
vboxLauncher.setVisible(false);
}
private void openEditor(Pack pack) {
if (dir == null || !dir.exists())
return;
curPack = pack;
txtFieldName.setText(pack.getName());
tbvQuestions.getItems().addAll(pack.getQuestions());
cmbBoxDifficulty.setValue(cmbBoxDifficulty.getItems().get(pack.getDifficulty() - 1));
vboxEditor.setVisible(true);
vboxLauncher.setVisible(false);
}
private void openLauncher() {
txtFieldName.clear();
tbvQuestions.getItems().clear();
cmbBoxDifficulty.setValue(cmbBoxDifficulty.getItems().get(0));
vboxEditor.setVisible(false);
vboxLauncher.setVisible(true);
update();
}
private void insertQuestionWindow(int index) {
if (index >= 0) {
QuestionWindow questionWindow;
if (index == tbvQuestions.getItems().size())
questionWindow = new QuestionWindow(this, index);
else
questionWindow = new QuestionWindow(this, tbvQuestions.getItems().get(index), index);
}
}
private void removeQuestion(int index) {
tbvQuestions.getItems().remove(index);
}
private void saveQuestion() {
int difficulty = Character.getNumericValue(cmbBoxDifficulty.getValue().charAt(0));
if (curPack == null)
curPack = new Pack(txtFieldName.getText(), difficulty, new Date());
else {
File file = new File(dir.getPath() + "\\" + curPack.getName() + ".kwq");
if (file.exists())
if (file.delete())
curPack = new Pack(txtFieldName.getText(), difficulty, new Date());
}
curPack.setQuestions(tbvQuestions.getItems());
try {
FileWriter fileWriter = new FileWriter(new File(dir.getPath() + "\\" + curPack.getName() + ".kwq"), false);
fileWriter.write(GSON.toJson(curPack));
fileWriter.close();
} catch (IOException ex) {
ex.printStackTrace();
}
curPack = null;
}
public void insertQuestion(Question question, int index) {
if (index >= tbvQuestions.getItems().size())
tbvQuestions.getItems().add(question);
else
tbvQuestions.getItems().set(index, question);
}
public Stage getStage() {
return stage;
}
} | 32.215909 | 157 | 0.579365 |
4a7ffdc37eaa57df533cbe4b033f63cdab8097da | 454 | cs | C# | FoxTunes.UI.Windows.Lyrics/Extensions.cs | aidan-g/FoxTunes | 1494e62918b679d7939d5010f3fc9f3b53812711 | [
"MIT"
] | 22 | 2017-07-26T08:09:38.000Z | 2021-02-20T09:00:00.000Z | FoxTunes.UI.Windows.Lyrics/Extensions.cs | DJCALIEND/FoxTunes | fa37aaf991d2a0ff7d28fb74698e80b53ec377b5 | [
"MIT"
] | 97 | 2017-08-11T22:57:58.000Z | 2021-03-17T15:49:58.000Z | FoxTunes.UI.Windows.Lyrics/Extensions.cs | DJCALIEND/FoxTunes | fa37aaf991d2a0ff7d28fb74698e80b53ec377b5 | [
"MIT"
] | 4 | 2020-02-22T05:19:31.000Z | 2021-02-16T19:43:34.000Z | using System.Diagnostics;
using System.Threading.Tasks;
namespace FoxTunes
{
public static partial class Extensions
{
public static Task WaitForExitAsync(this Process process)
{
var source = new TaskCompletionSource<object>();
process.EnableRaisingEvents = true;
process.Exited += (sender, args) => source.TrySetResult(null);
return source.Task;
}
}
}
| 26.705882 | 75 | 0.610132 |
df88574f71273c00f727af29e81a5d747bab7745 | 1,393 | ts | TypeScript | zealot/zed/types/type-union.ts | brimsec/brim | a74c9abb2342e9e9ea4c9b7e8c6d871dfdc152ce | [
"BSD-3-Clause"
] | 996 | 2020-03-23T08:39:38.000Z | 2021-03-29T07:16:29.000Z | zealot/zed/types/type-union.ts | brimsec/brim | a74c9abb2342e9e9ea4c9b7e8c6d871dfdc152ce | [
"BSD-3-Clause"
] | 601 | 2020-03-23T18:13:44.000Z | 2021-03-26T15:24:02.000Z | zealot/zed/types/type-union.ts | brimsec/brim | a74c9abb2342e9e9ea4c9b7e8c6d871dfdc152ce | [
"BSD-3-Clause"
] | 135 | 2020-03-24T00:30:47.000Z | 2021-03-29T03:09:31.000Z | import {isNull} from "../utils"
import {Value} from "zealot/zjson"
import {Union} from "../values/union"
import {TypeNull} from "./type-null"
import {ContainerTypeInterface, ZedType} from "./types"
import {typeId} from "../utils"
type UnionValue = [string, Value] | null
export class TypeUnion implements ContainerTypeInterface {
kind = "union"
constructor(public types: ZedType[]) {}
static stringify(types: ZedType[]) {
return `(${types.map(typeId).join(",")})`
}
create(value: UnionValue, typedefs) {
if (value === null) {
return new Union(this, TypeNull, null, null)
} else {
const index = parseInt(value[0])
const innerType = this.types[index]
const innerValue = innerType.create(value[1], typedefs)
return new Union(this, innerType, index, innerValue)
}
}
serialize(typedefs: object) {
return {
kind: "union",
types: this.types.map((t) => t.serialize(typedefs))
}
}
hasTypeType(ctx) {
return this.types.some((t) => ctx.hasTypeType(t))
}
walkTypeValues(ctx, value: UnionValue, visit) {
if (isNull(value)) return
const index = parseInt(value[0])
const innerType = this.types[index]
const innerValue = value[1]
if (value === null) ctx.walkTypeValue(innerType, innerValue, visit)
}
toString() {
return `(${this.types.map((t) => t.toString()).join(",")})`
}
}
| 25.796296 | 71 | 0.641062 |
7fb5f9a76f2998017c6ef5bb57f96dfe95ae7ef9 | 3,033 | sql | SQL | DB/perpus.sql | Dedi455/UTSK | c1bcc9ac57e49af7d1f6706d1f9ff370b6c4b041 | [
"MIT"
] | null | null | null | DB/perpus.sql | Dedi455/UTSK | c1bcc9ac57e49af7d1f6706d1f9ff370b6c4b041 | [
"MIT"
] | null | null | null | DB/perpus.sql | Dedi455/UTSK | c1bcc9ac57e49af7d1f6706d1f9ff370b6c4b041 | [
"MIT"
] | null | null | null | -- phpMyAdmin SQL Dump
-- version 4.8.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 08 Nov 2021 pada 11.48
-- Versi server: 10.1.37-MariaDB
-- Versi PHP: 7.3.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `perpus`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `buku`
--
CREATE TABLE `buku` (
`id_buku` int(11) NOT NULL,
`Gambar_sampul` varchar(255) NOT NULL,
`judul` varchar(255) NOT NULL,
`pengarang` varchar(255) NOT NULL,
`penerbit` varchar(255) NOT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Struktur dari tabel `kategor`
--
CREATE TABLE `kategor` (
`id_kategori` int(11) NOT NULL,
`kategori` varchar(20) NOT NULL,
`diskripsi` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tbl_users`
--
CREATE TABLE `tbl_users` (
`id` int(11) NOT NULL,
`name` varchar(120) DEFAULT NULL,
`email` varchar(120) DEFAULT NULL,
`phone_no` varchar(120) DEFAULT NULL,
`role` enum('admin','editor') NOT NULL,
`password` varchar(120) DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `tbl_users`
--
INSERT INTO `tbl_users` (`id`, `name`, `email`, `phone_no`, `role`, `password`, `created_at`) VALUES
(3, 'dedi', 'dediasriadi45@gmail.com', '085879580052', 'admin', '$2y$10$FJkInsRuLhwK/BE/Eh3RHey7z7co4.9EAiAAvJhKAKpQ3i9YlkJZO', '2021-11-06 09:43:28'),
(4, 'kims', 'kiims12@gmail.com', '097634635456', 'editor', '$2y$10$I8Sas7hKV1rxgB5TbBtt3exUlgnipS.tOcPJ7e9otVaQPI6CAz4.i', '2021-11-06 09:43:28'),
(5, 'dedi', 'dediasriadi45@gmail.com', '085879580052', 'admin', '$2y$10$FJkInsRuLhwK/BE/Eh3RHey7z7co4.9EAiAAvJhKAKpQ3i9YlkJZO', '0000-00-00 00:00:00');
--
-- Indexes for dumped tables
--
--
-- Indeks untuk tabel `buku`
--
ALTER TABLE `buku`
ADD PRIMARY KEY (`id_buku`);
--
-- Indeks untuk tabel `tbl_users`
--
ALTER TABLE `tbl_users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT untuk tabel yang dibuang
--
--
-- AUTO_INCREMENT untuk tabel `buku`
--
ALTER TABLE `buku`
MODIFY `id_buku` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT untuk tabel `tbl_users`
--
ALTER TABLE `tbl_users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| 26.605263 | 151 | 0.667326 |
fca4e09643e56e1c75c7e8ddbad50d87bea95249 | 938 | dart | Dart | lib/features/image/domain/repository/image_repository.dart | wikiclimb/ftr-frontend | 7e88ecb5d08096d5e99927d7f16dc846447afa91 | [
"MIT"
] | null | null | null | lib/features/image/domain/repository/image_repository.dart | wikiclimb/ftr-frontend | 7e88ecb5d08096d5e99927d7f16dc846447afa91 | [
"MIT"
] | null | null | null | lib/features/image/domain/repository/image_repository.dart | wikiclimb/ftr-frontend | 7e88ecb5d08096d5e99927d7f16dc846447afa91 | [
"MIT"
] | null | null | null | import 'package:built_collection/built_collection.dart';
import 'package:dartz/dartz.dart';
import '../../../../core/collections/page.dart';
import '../../../../core/error/failure.dart';
import '../entities/image.dart';
import '../usecases/add_images_to_node.dart';
/// This class provides contracts to interact with the image data layer.
abstract class ImageRepository {
/// Subscribe to a stream of [Image] data.
Stream<Either<Failure, Page<Image>>> get subscribe;
/// Request one page of [Image] data. The page number can be passed to the
/// method inside the [params] [Map] like `page: n`.
/// The results will be pushed to the subscription.
Future<Either<Failure, Page<Image>>> fetchPage(
{Map<String, dynamic>? params});
/// Create new [Image]s with the given data.
Future<Either<Failure, BuiltList<Image>>> create(Params params);
/// Clear up resources created by this repository.
void dispose();
}
| 36.076923 | 76 | 0.704691 |
4beb9ef6193859200fa068280c06b94f6c7351ea | 40,292 | asm | Assembly | zombie.asm | cassianomaia/SO1-P2 | 8152b4bb2e60b2907f1c34d77ff4b739b6da73be | [
"MIT-0"
] | null | null | null | zombie.asm | cassianomaia/SO1-P2 | 8152b4bb2e60b2907f1c34d77ff4b739b6da73be | [
"MIT-0"
] | null | null | null | zombie.asm | cassianomaia/SO1-P2 | 8152b4bb2e60b2907f1c34d77ff4b739b6da73be | [
"MIT-0"
] | null | null | null |
_zombie: file format elf32-i386
Disassembly of section .text:
00001000 <main>:
#include "stat.h"
#include "user.h"
int
main(void)
{
1000: 55 push %ebp
1001: 89 e5 mov %esp,%ebp
1003: 83 e4 f0 and $0xfffffff0,%esp
1006: 83 ec 10 sub $0x10,%esp
if(fork() > 0)
1009: e8 75 02 00 00 call 1283 <fork>
100e: 85 c0 test %eax,%eax
1010: 7e 0c jle 101e <main+0x1e>
sleep(5); // Let child exit before parent.
1012: c7 04 24 05 00 00 00 movl $0x5,(%esp)
1019: e8 0d 03 00 00 call 132b <sleep>
exit();
101e: e8 78 02 00 00 call 129b <exit>
00001023 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
1023: 55 push %ebp
1024: 89 e5 mov %esp,%ebp
1026: 57 push %edi
1027: 53 push %ebx
asm volatile("cld; rep stosb" :
1028: 8b 4d 08 mov 0x8(%ebp),%ecx
102b: 8b 55 10 mov 0x10(%ebp),%edx
102e: 8b 45 0c mov 0xc(%ebp),%eax
1031: 89 cb mov %ecx,%ebx
1033: 89 df mov %ebx,%edi
1035: 89 d1 mov %edx,%ecx
1037: fc cld
1038: f3 aa rep stos %al,%es:(%edi)
103a: 89 ca mov %ecx,%edx
103c: 89 fb mov %edi,%ebx
103e: 89 5d 08 mov %ebx,0x8(%ebp)
1041: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
1044: 5b pop %ebx
1045: 5f pop %edi
1046: 5d pop %ebp
1047: c3 ret
00001048 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
1048: 55 push %ebp
1049: 89 e5 mov %esp,%ebp
104b: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
104e: 8b 45 08 mov 0x8(%ebp),%eax
1051: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
1054: 90 nop
1055: 8b 45 08 mov 0x8(%ebp),%eax
1058: 8d 50 01 lea 0x1(%eax),%edx
105b: 89 55 08 mov %edx,0x8(%ebp)
105e: 8b 55 0c mov 0xc(%ebp),%edx
1061: 8d 4a 01 lea 0x1(%edx),%ecx
1064: 89 4d 0c mov %ecx,0xc(%ebp)
1067: 0f b6 12 movzbl (%edx),%edx
106a: 88 10 mov %dl,(%eax)
106c: 0f b6 00 movzbl (%eax),%eax
106f: 84 c0 test %al,%al
1071: 75 e2 jne 1055 <strcpy+0xd>
;
return os;
1073: 8b 45 fc mov -0x4(%ebp),%eax
}
1076: c9 leave
1077: c3 ret
00001078 <strcmp>:
int
strcmp(const char *p, const char *q)
{
1078: 55 push %ebp
1079: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
107b: eb 08 jmp 1085 <strcmp+0xd>
p++, q++;
107d: 83 45 08 01 addl $0x1,0x8(%ebp)
1081: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
1085: 8b 45 08 mov 0x8(%ebp),%eax
1088: 0f b6 00 movzbl (%eax),%eax
108b: 84 c0 test %al,%al
108d: 74 10 je 109f <strcmp+0x27>
108f: 8b 45 08 mov 0x8(%ebp),%eax
1092: 0f b6 10 movzbl (%eax),%edx
1095: 8b 45 0c mov 0xc(%ebp),%eax
1098: 0f b6 00 movzbl (%eax),%eax
109b: 38 c2 cmp %al,%dl
109d: 74 de je 107d <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
109f: 8b 45 08 mov 0x8(%ebp),%eax
10a2: 0f b6 00 movzbl (%eax),%eax
10a5: 0f b6 d0 movzbl %al,%edx
10a8: 8b 45 0c mov 0xc(%ebp),%eax
10ab: 0f b6 00 movzbl (%eax),%eax
10ae: 0f b6 c0 movzbl %al,%eax
10b1: 29 c2 sub %eax,%edx
10b3: 89 d0 mov %edx,%eax
}
10b5: 5d pop %ebp
10b6: c3 ret
000010b7 <strlen>:
uint
strlen(char *s)
{
10b7: 55 push %ebp
10b8: 89 e5 mov %esp,%ebp
10ba: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
10bd: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
10c4: eb 04 jmp 10ca <strlen+0x13>
10c6: 83 45 fc 01 addl $0x1,-0x4(%ebp)
10ca: 8b 55 fc mov -0x4(%ebp),%edx
10cd: 8b 45 08 mov 0x8(%ebp),%eax
10d0: 01 d0 add %edx,%eax
10d2: 0f b6 00 movzbl (%eax),%eax
10d5: 84 c0 test %al,%al
10d7: 75 ed jne 10c6 <strlen+0xf>
;
return n;
10d9: 8b 45 fc mov -0x4(%ebp),%eax
}
10dc: c9 leave
10dd: c3 ret
000010de <memset>:
void*
memset(void *dst, int c, uint n)
{
10de: 55 push %ebp
10df: 89 e5 mov %esp,%ebp
10e1: 83 ec 0c sub $0xc,%esp
stosb(dst, c, n);
10e4: 8b 45 10 mov 0x10(%ebp),%eax
10e7: 89 44 24 08 mov %eax,0x8(%esp)
10eb: 8b 45 0c mov 0xc(%ebp),%eax
10ee: 89 44 24 04 mov %eax,0x4(%esp)
10f2: 8b 45 08 mov 0x8(%ebp),%eax
10f5: 89 04 24 mov %eax,(%esp)
10f8: e8 26 ff ff ff call 1023 <stosb>
return dst;
10fd: 8b 45 08 mov 0x8(%ebp),%eax
}
1100: c9 leave
1101: c3 ret
00001102 <strchr>:
char*
strchr(const char *s, char c)
{
1102: 55 push %ebp
1103: 89 e5 mov %esp,%ebp
1105: 83 ec 04 sub $0x4,%esp
1108: 8b 45 0c mov 0xc(%ebp),%eax
110b: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
110e: eb 14 jmp 1124 <strchr+0x22>
if(*s == c)
1110: 8b 45 08 mov 0x8(%ebp),%eax
1113: 0f b6 00 movzbl (%eax),%eax
1116: 3a 45 fc cmp -0x4(%ebp),%al
1119: 75 05 jne 1120 <strchr+0x1e>
return (char*)s;
111b: 8b 45 08 mov 0x8(%ebp),%eax
111e: eb 13 jmp 1133 <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
1120: 83 45 08 01 addl $0x1,0x8(%ebp)
1124: 8b 45 08 mov 0x8(%ebp),%eax
1127: 0f b6 00 movzbl (%eax),%eax
112a: 84 c0 test %al,%al
112c: 75 e2 jne 1110 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
112e: b8 00 00 00 00 mov $0x0,%eax
}
1133: c9 leave
1134: c3 ret
00001135 <gets>:
char*
gets(char *buf, int max)
{
1135: 55 push %ebp
1136: 89 e5 mov %esp,%ebp
1138: 83 ec 28 sub $0x28,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
113b: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
1142: eb 4c jmp 1190 <gets+0x5b>
cc = read(0, &c, 1);
1144: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
114b: 00
114c: 8d 45 ef lea -0x11(%ebp),%eax
114f: 89 44 24 04 mov %eax,0x4(%esp)
1153: c7 04 24 00 00 00 00 movl $0x0,(%esp)
115a: e8 54 01 00 00 call 12b3 <read>
115f: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
1162: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
1166: 7f 02 jg 116a <gets+0x35>
break;
1168: eb 31 jmp 119b <gets+0x66>
buf[i++] = c;
116a: 8b 45 f4 mov -0xc(%ebp),%eax
116d: 8d 50 01 lea 0x1(%eax),%edx
1170: 89 55 f4 mov %edx,-0xc(%ebp)
1173: 89 c2 mov %eax,%edx
1175: 8b 45 08 mov 0x8(%ebp),%eax
1178: 01 c2 add %eax,%edx
117a: 0f b6 45 ef movzbl -0x11(%ebp),%eax
117e: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
1180: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1184: 3c 0a cmp $0xa,%al
1186: 74 13 je 119b <gets+0x66>
1188: 0f b6 45 ef movzbl -0x11(%ebp),%eax
118c: 3c 0d cmp $0xd,%al
118e: 74 0b je 119b <gets+0x66>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
1190: 8b 45 f4 mov -0xc(%ebp),%eax
1193: 83 c0 01 add $0x1,%eax
1196: 3b 45 0c cmp 0xc(%ebp),%eax
1199: 7c a9 jl 1144 <gets+0xf>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
119b: 8b 55 f4 mov -0xc(%ebp),%edx
119e: 8b 45 08 mov 0x8(%ebp),%eax
11a1: 01 d0 add %edx,%eax
11a3: c6 00 00 movb $0x0,(%eax)
return buf;
11a6: 8b 45 08 mov 0x8(%ebp),%eax
}
11a9: c9 leave
11aa: c3 ret
000011ab <stat>:
int
stat(char *n, struct stat *st)
{
11ab: 55 push %ebp
11ac: 89 e5 mov %esp,%ebp
11ae: 83 ec 28 sub $0x28,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
11b1: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
11b8: 00
11b9: 8b 45 08 mov 0x8(%ebp),%eax
11bc: 89 04 24 mov %eax,(%esp)
11bf: e8 17 01 00 00 call 12db <open>
11c4: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
11c7: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
11cb: 79 07 jns 11d4 <stat+0x29>
return -1;
11cd: b8 ff ff ff ff mov $0xffffffff,%eax
11d2: eb 23 jmp 11f7 <stat+0x4c>
r = fstat(fd, st);
11d4: 8b 45 0c mov 0xc(%ebp),%eax
11d7: 89 44 24 04 mov %eax,0x4(%esp)
11db: 8b 45 f4 mov -0xc(%ebp),%eax
11de: 89 04 24 mov %eax,(%esp)
11e1: e8 0d 01 00 00 call 12f3 <fstat>
11e6: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
11e9: 8b 45 f4 mov -0xc(%ebp),%eax
11ec: 89 04 24 mov %eax,(%esp)
11ef: e8 cf 00 00 00 call 12c3 <close>
return r;
11f4: 8b 45 f0 mov -0x10(%ebp),%eax
}
11f7: c9 leave
11f8: c3 ret
000011f9 <atoi>:
int
atoi(const char *s)
{
11f9: 55 push %ebp
11fa: 89 e5 mov %esp,%ebp
11fc: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
11ff: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
1206: eb 25 jmp 122d <atoi+0x34>
n = n*10 + *s++ - '0';
1208: 8b 55 fc mov -0x4(%ebp),%edx
120b: 89 d0 mov %edx,%eax
120d: c1 e0 02 shl $0x2,%eax
1210: 01 d0 add %edx,%eax
1212: 01 c0 add %eax,%eax
1214: 89 c1 mov %eax,%ecx
1216: 8b 45 08 mov 0x8(%ebp),%eax
1219: 8d 50 01 lea 0x1(%eax),%edx
121c: 89 55 08 mov %edx,0x8(%ebp)
121f: 0f b6 00 movzbl (%eax),%eax
1222: 0f be c0 movsbl %al,%eax
1225: 01 c8 add %ecx,%eax
1227: 83 e8 30 sub $0x30,%eax
122a: 89 45 fc mov %eax,-0x4(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
122d: 8b 45 08 mov 0x8(%ebp),%eax
1230: 0f b6 00 movzbl (%eax),%eax
1233: 3c 2f cmp $0x2f,%al
1235: 7e 0a jle 1241 <atoi+0x48>
1237: 8b 45 08 mov 0x8(%ebp),%eax
123a: 0f b6 00 movzbl (%eax),%eax
123d: 3c 39 cmp $0x39,%al
123f: 7e c7 jle 1208 <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
1241: 8b 45 fc mov -0x4(%ebp),%eax
}
1244: c9 leave
1245: c3 ret
00001246 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
1246: 55 push %ebp
1247: 89 e5 mov %esp,%ebp
1249: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
124c: 8b 45 08 mov 0x8(%ebp),%eax
124f: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
1252: 8b 45 0c mov 0xc(%ebp),%eax
1255: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
1258: eb 17 jmp 1271 <memmove+0x2b>
*dst++ = *src++;
125a: 8b 45 fc mov -0x4(%ebp),%eax
125d: 8d 50 01 lea 0x1(%eax),%edx
1260: 89 55 fc mov %edx,-0x4(%ebp)
1263: 8b 55 f8 mov -0x8(%ebp),%edx
1266: 8d 4a 01 lea 0x1(%edx),%ecx
1269: 89 4d f8 mov %ecx,-0x8(%ebp)
126c: 0f b6 12 movzbl (%edx),%edx
126f: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
1271: 8b 45 10 mov 0x10(%ebp),%eax
1274: 8d 50 ff lea -0x1(%eax),%edx
1277: 89 55 10 mov %edx,0x10(%ebp)
127a: 85 c0 test %eax,%eax
127c: 7f dc jg 125a <memmove+0x14>
*dst++ = *src++;
return vdst;
127e: 8b 45 08 mov 0x8(%ebp),%eax
}
1281: c9 leave
1282: c3 ret
00001283 <fork>:
1283: b8 01 00 00 00 mov $0x1,%eax
1288: cd 40 int $0x40
128a: c3 ret
0000128b <cowfork>:
128b: b8 0f 00 00 00 mov $0xf,%eax
1290: cd 40 int $0x40
1292: c3 ret
00001293 <procdump>:
1293: b8 10 00 00 00 mov $0x10,%eax
1298: cd 40 int $0x40
129a: c3 ret
0000129b <exit>:
129b: b8 02 00 00 00 mov $0x2,%eax
12a0: cd 40 int $0x40
12a2: c3 ret
000012a3 <wait>:
12a3: b8 03 00 00 00 mov $0x3,%eax
12a8: cd 40 int $0x40
12aa: c3 ret
000012ab <pipe>:
12ab: b8 04 00 00 00 mov $0x4,%eax
12b0: cd 40 int $0x40
12b2: c3 ret
000012b3 <read>:
12b3: b8 05 00 00 00 mov $0x5,%eax
12b8: cd 40 int $0x40
12ba: c3 ret
000012bb <write>:
12bb: b8 12 00 00 00 mov $0x12,%eax
12c0: cd 40 int $0x40
12c2: c3 ret
000012c3 <close>:
12c3: b8 17 00 00 00 mov $0x17,%eax
12c8: cd 40 int $0x40
12ca: c3 ret
000012cb <kill>:
12cb: b8 06 00 00 00 mov $0x6,%eax
12d0: cd 40 int $0x40
12d2: c3 ret
000012d3 <exec>:
12d3: b8 07 00 00 00 mov $0x7,%eax
12d8: cd 40 int $0x40
12da: c3 ret
000012db <open>:
12db: b8 11 00 00 00 mov $0x11,%eax
12e0: cd 40 int $0x40
12e2: c3 ret
000012e3 <mknod>:
12e3: b8 13 00 00 00 mov $0x13,%eax
12e8: cd 40 int $0x40
12ea: c3 ret
000012eb <unlink>:
12eb: b8 14 00 00 00 mov $0x14,%eax
12f0: cd 40 int $0x40
12f2: c3 ret
000012f3 <fstat>:
12f3: b8 08 00 00 00 mov $0x8,%eax
12f8: cd 40 int $0x40
12fa: c3 ret
000012fb <link>:
12fb: b8 15 00 00 00 mov $0x15,%eax
1300: cd 40 int $0x40
1302: c3 ret
00001303 <mkdir>:
1303: b8 16 00 00 00 mov $0x16,%eax
1308: cd 40 int $0x40
130a: c3 ret
0000130b <chdir>:
130b: b8 09 00 00 00 mov $0x9,%eax
1310: cd 40 int $0x40
1312: c3 ret
00001313 <dup>:
1313: b8 0a 00 00 00 mov $0xa,%eax
1318: cd 40 int $0x40
131a: c3 ret
0000131b <getpid>:
131b: b8 0b 00 00 00 mov $0xb,%eax
1320: cd 40 int $0x40
1322: c3 ret
00001323 <sbrk>:
1323: b8 0c 00 00 00 mov $0xc,%eax
1328: cd 40 int $0x40
132a: c3 ret
0000132b <sleep>:
132b: b8 0d 00 00 00 mov $0xd,%eax
1330: cd 40 int $0x40
1332: c3 ret
00001333 <uptime>:
1333: b8 0e 00 00 00 mov $0xe,%eax
1338: cd 40 int $0x40
133a: c3 ret
0000133b <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
133b: 55 push %ebp
133c: 89 e5 mov %esp,%ebp
133e: 83 ec 18 sub $0x18,%esp
1341: 8b 45 0c mov 0xc(%ebp),%eax
1344: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
1347: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
134e: 00
134f: 8d 45 f4 lea -0xc(%ebp),%eax
1352: 89 44 24 04 mov %eax,0x4(%esp)
1356: 8b 45 08 mov 0x8(%ebp),%eax
1359: 89 04 24 mov %eax,(%esp)
135c: e8 5a ff ff ff call 12bb <write>
}
1361: c9 leave
1362: c3 ret
00001363 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
1363: 55 push %ebp
1364: 89 e5 mov %esp,%ebp
1366: 56 push %esi
1367: 53 push %ebx
1368: 83 ec 30 sub $0x30,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
136b: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
1372: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
1376: 74 17 je 138f <printint+0x2c>
1378: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
137c: 79 11 jns 138f <printint+0x2c>
neg = 1;
137e: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
1385: 8b 45 0c mov 0xc(%ebp),%eax
1388: f7 d8 neg %eax
138a: 89 45 ec mov %eax,-0x14(%ebp)
138d: eb 06 jmp 1395 <printint+0x32>
} else {
x = xx;
138f: 8b 45 0c mov 0xc(%ebp),%eax
1392: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
1395: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
139c: 8b 4d f4 mov -0xc(%ebp),%ecx
139f: 8d 41 01 lea 0x1(%ecx),%eax
13a2: 89 45 f4 mov %eax,-0xc(%ebp)
13a5: 8b 5d 10 mov 0x10(%ebp),%ebx
13a8: 8b 45 ec mov -0x14(%ebp),%eax
13ab: ba 00 00 00 00 mov $0x0,%edx
13b0: f7 f3 div %ebx
13b2: 89 d0 mov %edx,%eax
13b4: 0f b6 80 34 2a 00 00 movzbl 0x2a34(%eax),%eax
13bb: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
13bf: 8b 75 10 mov 0x10(%ebp),%esi
13c2: 8b 45 ec mov -0x14(%ebp),%eax
13c5: ba 00 00 00 00 mov $0x0,%edx
13ca: f7 f6 div %esi
13cc: 89 45 ec mov %eax,-0x14(%ebp)
13cf: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
13d3: 75 c7 jne 139c <printint+0x39>
if(neg)
13d5: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
13d9: 74 10 je 13eb <printint+0x88>
buf[i++] = '-';
13db: 8b 45 f4 mov -0xc(%ebp),%eax
13de: 8d 50 01 lea 0x1(%eax),%edx
13e1: 89 55 f4 mov %edx,-0xc(%ebp)
13e4: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
13e9: eb 1f jmp 140a <printint+0xa7>
13eb: eb 1d jmp 140a <printint+0xa7>
putc(fd, buf[i]);
13ed: 8d 55 dc lea -0x24(%ebp),%edx
13f0: 8b 45 f4 mov -0xc(%ebp),%eax
13f3: 01 d0 add %edx,%eax
13f5: 0f b6 00 movzbl (%eax),%eax
13f8: 0f be c0 movsbl %al,%eax
13fb: 89 44 24 04 mov %eax,0x4(%esp)
13ff: 8b 45 08 mov 0x8(%ebp),%eax
1402: 89 04 24 mov %eax,(%esp)
1405: e8 31 ff ff ff call 133b <putc>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
140a: 83 6d f4 01 subl $0x1,-0xc(%ebp)
140e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
1412: 79 d9 jns 13ed <printint+0x8a>
putc(fd, buf[i]);
}
1414: 83 c4 30 add $0x30,%esp
1417: 5b pop %ebx
1418: 5e pop %esi
1419: 5d pop %ebp
141a: c3 ret
0000141b <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
141b: 55 push %ebp
141c: 89 e5 mov %esp,%ebp
141e: 83 ec 38 sub $0x38,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
1421: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
1428: 8d 45 0c lea 0xc(%ebp),%eax
142b: 83 c0 04 add $0x4,%eax
142e: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
1431: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
1438: e9 7c 01 00 00 jmp 15b9 <printf+0x19e>
c = fmt[i] & 0xff;
143d: 8b 55 0c mov 0xc(%ebp),%edx
1440: 8b 45 f0 mov -0x10(%ebp),%eax
1443: 01 d0 add %edx,%eax
1445: 0f b6 00 movzbl (%eax),%eax
1448: 0f be c0 movsbl %al,%eax
144b: 25 ff 00 00 00 and $0xff,%eax
1450: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
1453: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
1457: 75 2c jne 1485 <printf+0x6a>
if(c == '%'){
1459: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
145d: 75 0c jne 146b <printf+0x50>
state = '%';
145f: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
1466: e9 4a 01 00 00 jmp 15b5 <printf+0x19a>
} else {
putc(fd, c);
146b: 8b 45 e4 mov -0x1c(%ebp),%eax
146e: 0f be c0 movsbl %al,%eax
1471: 89 44 24 04 mov %eax,0x4(%esp)
1475: 8b 45 08 mov 0x8(%ebp),%eax
1478: 89 04 24 mov %eax,(%esp)
147b: e8 bb fe ff ff call 133b <putc>
1480: e9 30 01 00 00 jmp 15b5 <printf+0x19a>
}
} else if(state == '%'){
1485: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
1489: 0f 85 26 01 00 00 jne 15b5 <printf+0x19a>
if(c == 'd'){
148f: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
1493: 75 2d jne 14c2 <printf+0xa7>
printint(fd, *ap, 10, 1);
1495: 8b 45 e8 mov -0x18(%ebp),%eax
1498: 8b 00 mov (%eax),%eax
149a: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp)
14a1: 00
14a2: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
14a9: 00
14aa: 89 44 24 04 mov %eax,0x4(%esp)
14ae: 8b 45 08 mov 0x8(%ebp),%eax
14b1: 89 04 24 mov %eax,(%esp)
14b4: e8 aa fe ff ff call 1363 <printint>
ap++;
14b9: 83 45 e8 04 addl $0x4,-0x18(%ebp)
14bd: e9 ec 00 00 00 jmp 15ae <printf+0x193>
} else if(c == 'x' || c == 'p'){
14c2: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
14c6: 74 06 je 14ce <printf+0xb3>
14c8: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
14cc: 75 2d jne 14fb <printf+0xe0>
printint(fd, *ap, 16, 0);
14ce: 8b 45 e8 mov -0x18(%ebp),%eax
14d1: 8b 00 mov (%eax),%eax
14d3: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
14da: 00
14db: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
14e2: 00
14e3: 89 44 24 04 mov %eax,0x4(%esp)
14e7: 8b 45 08 mov 0x8(%ebp),%eax
14ea: 89 04 24 mov %eax,(%esp)
14ed: e8 71 fe ff ff call 1363 <printint>
ap++;
14f2: 83 45 e8 04 addl $0x4,-0x18(%ebp)
14f6: e9 b3 00 00 00 jmp 15ae <printf+0x193>
} else if(c == 's'){
14fb: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
14ff: 75 45 jne 1546 <printf+0x12b>
s = (char*)*ap;
1501: 8b 45 e8 mov -0x18(%ebp),%eax
1504: 8b 00 mov (%eax),%eax
1506: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
1509: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
150d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
1511: 75 09 jne 151c <printf+0x101>
s = "(null)";
1513: c7 45 f4 e7 17 00 00 movl $0x17e7,-0xc(%ebp)
while(*s != 0){
151a: eb 1e jmp 153a <printf+0x11f>
151c: eb 1c jmp 153a <printf+0x11f>
putc(fd, *s);
151e: 8b 45 f4 mov -0xc(%ebp),%eax
1521: 0f b6 00 movzbl (%eax),%eax
1524: 0f be c0 movsbl %al,%eax
1527: 89 44 24 04 mov %eax,0x4(%esp)
152b: 8b 45 08 mov 0x8(%ebp),%eax
152e: 89 04 24 mov %eax,(%esp)
1531: e8 05 fe ff ff call 133b <putc>
s++;
1536: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
153a: 8b 45 f4 mov -0xc(%ebp),%eax
153d: 0f b6 00 movzbl (%eax),%eax
1540: 84 c0 test %al,%al
1542: 75 da jne 151e <printf+0x103>
1544: eb 68 jmp 15ae <printf+0x193>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
1546: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
154a: 75 1d jne 1569 <printf+0x14e>
putc(fd, *ap);
154c: 8b 45 e8 mov -0x18(%ebp),%eax
154f: 8b 00 mov (%eax),%eax
1551: 0f be c0 movsbl %al,%eax
1554: 89 44 24 04 mov %eax,0x4(%esp)
1558: 8b 45 08 mov 0x8(%ebp),%eax
155b: 89 04 24 mov %eax,(%esp)
155e: e8 d8 fd ff ff call 133b <putc>
ap++;
1563: 83 45 e8 04 addl $0x4,-0x18(%ebp)
1567: eb 45 jmp 15ae <printf+0x193>
} else if(c == '%'){
1569: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
156d: 75 17 jne 1586 <printf+0x16b>
putc(fd, c);
156f: 8b 45 e4 mov -0x1c(%ebp),%eax
1572: 0f be c0 movsbl %al,%eax
1575: 89 44 24 04 mov %eax,0x4(%esp)
1579: 8b 45 08 mov 0x8(%ebp),%eax
157c: 89 04 24 mov %eax,(%esp)
157f: e8 b7 fd ff ff call 133b <putc>
1584: eb 28 jmp 15ae <printf+0x193>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
1586: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp)
158d: 00
158e: 8b 45 08 mov 0x8(%ebp),%eax
1591: 89 04 24 mov %eax,(%esp)
1594: e8 a2 fd ff ff call 133b <putc>
putc(fd, c);
1599: 8b 45 e4 mov -0x1c(%ebp),%eax
159c: 0f be c0 movsbl %al,%eax
159f: 89 44 24 04 mov %eax,0x4(%esp)
15a3: 8b 45 08 mov 0x8(%ebp),%eax
15a6: 89 04 24 mov %eax,(%esp)
15a9: e8 8d fd ff ff call 133b <putc>
}
state = 0;
15ae: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
15b5: 83 45 f0 01 addl $0x1,-0x10(%ebp)
15b9: 8b 55 0c mov 0xc(%ebp),%edx
15bc: 8b 45 f0 mov -0x10(%ebp),%eax
15bf: 01 d0 add %edx,%eax
15c1: 0f b6 00 movzbl (%eax),%eax
15c4: 84 c0 test %al,%al
15c6: 0f 85 71 fe ff ff jne 143d <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
15cc: c9 leave
15cd: c3 ret
000015ce <free>:
15ce: 55 push %ebp
15cf: 89 e5 mov %esp,%ebp
15d1: 83 ec 10 sub $0x10,%esp
15d4: 8b 45 08 mov 0x8(%ebp),%eax
15d7: 83 e8 08 sub $0x8,%eax
15da: 89 45 f8 mov %eax,-0x8(%ebp)
15dd: a1 50 2a 00 00 mov 0x2a50,%eax
15e2: 89 45 fc mov %eax,-0x4(%ebp)
15e5: eb 24 jmp 160b <free+0x3d>
15e7: 8b 45 fc mov -0x4(%ebp),%eax
15ea: 8b 00 mov (%eax),%eax
15ec: 3b 45 fc cmp -0x4(%ebp),%eax
15ef: 77 12 ja 1603 <free+0x35>
15f1: 8b 45 f8 mov -0x8(%ebp),%eax
15f4: 3b 45 fc cmp -0x4(%ebp),%eax
15f7: 77 24 ja 161d <free+0x4f>
15f9: 8b 45 fc mov -0x4(%ebp),%eax
15fc: 8b 00 mov (%eax),%eax
15fe: 3b 45 f8 cmp -0x8(%ebp),%eax
1601: 77 1a ja 161d <free+0x4f>
1603: 8b 45 fc mov -0x4(%ebp),%eax
1606: 8b 00 mov (%eax),%eax
1608: 89 45 fc mov %eax,-0x4(%ebp)
160b: 8b 45 f8 mov -0x8(%ebp),%eax
160e: 3b 45 fc cmp -0x4(%ebp),%eax
1611: 76 d4 jbe 15e7 <free+0x19>
1613: 8b 45 fc mov -0x4(%ebp),%eax
1616: 8b 00 mov (%eax),%eax
1618: 3b 45 f8 cmp -0x8(%ebp),%eax
161b: 76 ca jbe 15e7 <free+0x19>
161d: 8b 45 f8 mov -0x8(%ebp),%eax
1620: 8b 40 04 mov 0x4(%eax),%eax
1623: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
162a: 8b 45 f8 mov -0x8(%ebp),%eax
162d: 01 c2 add %eax,%edx
162f: 8b 45 fc mov -0x4(%ebp),%eax
1632: 8b 00 mov (%eax),%eax
1634: 39 c2 cmp %eax,%edx
1636: 75 24 jne 165c <free+0x8e>
1638: 8b 45 f8 mov -0x8(%ebp),%eax
163b: 8b 50 04 mov 0x4(%eax),%edx
163e: 8b 45 fc mov -0x4(%ebp),%eax
1641: 8b 00 mov (%eax),%eax
1643: 8b 40 04 mov 0x4(%eax),%eax
1646: 01 c2 add %eax,%edx
1648: 8b 45 f8 mov -0x8(%ebp),%eax
164b: 89 50 04 mov %edx,0x4(%eax)
164e: 8b 45 fc mov -0x4(%ebp),%eax
1651: 8b 00 mov (%eax),%eax
1653: 8b 10 mov (%eax),%edx
1655: 8b 45 f8 mov -0x8(%ebp),%eax
1658: 89 10 mov %edx,(%eax)
165a: eb 0a jmp 1666 <free+0x98>
165c: 8b 45 fc mov -0x4(%ebp),%eax
165f: 8b 10 mov (%eax),%edx
1661: 8b 45 f8 mov -0x8(%ebp),%eax
1664: 89 10 mov %edx,(%eax)
1666: 8b 45 fc mov -0x4(%ebp),%eax
1669: 8b 40 04 mov 0x4(%eax),%eax
166c: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
1673: 8b 45 fc mov -0x4(%ebp),%eax
1676: 01 d0 add %edx,%eax
1678: 3b 45 f8 cmp -0x8(%ebp),%eax
167b: 75 20 jne 169d <free+0xcf>
167d: 8b 45 fc mov -0x4(%ebp),%eax
1680: 8b 50 04 mov 0x4(%eax),%edx
1683: 8b 45 f8 mov -0x8(%ebp),%eax
1686: 8b 40 04 mov 0x4(%eax),%eax
1689: 01 c2 add %eax,%edx
168b: 8b 45 fc mov -0x4(%ebp),%eax
168e: 89 50 04 mov %edx,0x4(%eax)
1691: 8b 45 f8 mov -0x8(%ebp),%eax
1694: 8b 10 mov (%eax),%edx
1696: 8b 45 fc mov -0x4(%ebp),%eax
1699: 89 10 mov %edx,(%eax)
169b: eb 08 jmp 16a5 <free+0xd7>
169d: 8b 45 fc mov -0x4(%ebp),%eax
16a0: 8b 55 f8 mov -0x8(%ebp),%edx
16a3: 89 10 mov %edx,(%eax)
16a5: 8b 45 fc mov -0x4(%ebp),%eax
16a8: a3 50 2a 00 00 mov %eax,0x2a50
16ad: c9 leave
16ae: c3 ret
000016af <morecore>:
16af: 55 push %ebp
16b0: 89 e5 mov %esp,%ebp
16b2: 83 ec 28 sub $0x28,%esp
16b5: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
16bc: 77 07 ja 16c5 <morecore+0x16>
16be: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
16c5: 8b 45 08 mov 0x8(%ebp),%eax
16c8: c1 e0 03 shl $0x3,%eax
16cb: 89 04 24 mov %eax,(%esp)
16ce: e8 50 fc ff ff call 1323 <sbrk>
16d3: 89 45 f4 mov %eax,-0xc(%ebp)
16d6: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
16da: 75 07 jne 16e3 <morecore+0x34>
16dc: b8 00 00 00 00 mov $0x0,%eax
16e1: eb 22 jmp 1705 <morecore+0x56>
16e3: 8b 45 f4 mov -0xc(%ebp),%eax
16e6: 89 45 f0 mov %eax,-0x10(%ebp)
16e9: 8b 45 f0 mov -0x10(%ebp),%eax
16ec: 8b 55 08 mov 0x8(%ebp),%edx
16ef: 89 50 04 mov %edx,0x4(%eax)
16f2: 8b 45 f0 mov -0x10(%ebp),%eax
16f5: 83 c0 08 add $0x8,%eax
16f8: 89 04 24 mov %eax,(%esp)
16fb: e8 ce fe ff ff call 15ce <free>
1700: a1 50 2a 00 00 mov 0x2a50,%eax
1705: c9 leave
1706: c3 ret
00001707 <malloc>:
1707: 55 push %ebp
1708: 89 e5 mov %esp,%ebp
170a: 83 ec 28 sub $0x28,%esp
170d: 8b 45 08 mov 0x8(%ebp),%eax
1710: 83 c0 07 add $0x7,%eax
1713: c1 e8 03 shr $0x3,%eax
1716: 83 c0 01 add $0x1,%eax
1719: 89 45 ec mov %eax,-0x14(%ebp)
171c: a1 50 2a 00 00 mov 0x2a50,%eax
1721: 89 45 f0 mov %eax,-0x10(%ebp)
1724: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
1728: 75 23 jne 174d <malloc+0x46>
172a: c7 45 f0 48 2a 00 00 movl $0x2a48,-0x10(%ebp)
1731: 8b 45 f0 mov -0x10(%ebp),%eax
1734: a3 50 2a 00 00 mov %eax,0x2a50
1739: a1 50 2a 00 00 mov 0x2a50,%eax
173e: a3 48 2a 00 00 mov %eax,0x2a48
1743: c7 05 4c 2a 00 00 00 movl $0x0,0x2a4c
174a: 00 00 00
174d: 8b 45 f0 mov -0x10(%ebp),%eax
1750: 8b 00 mov (%eax),%eax
1752: 89 45 f4 mov %eax,-0xc(%ebp)
1755: 8b 45 f4 mov -0xc(%ebp),%eax
1758: 8b 40 04 mov 0x4(%eax),%eax
175b: 3b 45 ec cmp -0x14(%ebp),%eax
175e: 72 4d jb 17ad <malloc+0xa6>
1760: 8b 45 f4 mov -0xc(%ebp),%eax
1763: 8b 40 04 mov 0x4(%eax),%eax
1766: 3b 45 ec cmp -0x14(%ebp),%eax
1769: 75 0c jne 1777 <malloc+0x70>
176b: 8b 45 f4 mov -0xc(%ebp),%eax
176e: 8b 10 mov (%eax),%edx
1770: 8b 45 f0 mov -0x10(%ebp),%eax
1773: 89 10 mov %edx,(%eax)
1775: eb 26 jmp 179d <malloc+0x96>
1777: 8b 45 f4 mov -0xc(%ebp),%eax
177a: 8b 40 04 mov 0x4(%eax),%eax
177d: 2b 45 ec sub -0x14(%ebp),%eax
1780: 89 c2 mov %eax,%edx
1782: 8b 45 f4 mov -0xc(%ebp),%eax
1785: 89 50 04 mov %edx,0x4(%eax)
1788: 8b 45 f4 mov -0xc(%ebp),%eax
178b: 8b 40 04 mov 0x4(%eax),%eax
178e: c1 e0 03 shl $0x3,%eax
1791: 01 45 f4 add %eax,-0xc(%ebp)
1794: 8b 45 f4 mov -0xc(%ebp),%eax
1797: 8b 55 ec mov -0x14(%ebp),%edx
179a: 89 50 04 mov %edx,0x4(%eax)
179d: 8b 45 f0 mov -0x10(%ebp),%eax
17a0: a3 50 2a 00 00 mov %eax,0x2a50
17a5: 8b 45 f4 mov -0xc(%ebp),%eax
17a8: 83 c0 08 add $0x8,%eax
17ab: eb 38 jmp 17e5 <malloc+0xde>
17ad: a1 50 2a 00 00 mov 0x2a50,%eax
17b2: 39 45 f4 cmp %eax,-0xc(%ebp)
17b5: 75 1b jne 17d2 <malloc+0xcb>
17b7: 8b 45 ec mov -0x14(%ebp),%eax
17ba: 89 04 24 mov %eax,(%esp)
17bd: e8 ed fe ff ff call 16af <morecore>
17c2: 89 45 f4 mov %eax,-0xc(%ebp)
17c5: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
17c9: 75 07 jne 17d2 <malloc+0xcb>
17cb: b8 00 00 00 00 mov $0x0,%eax
17d0: eb 13 jmp 17e5 <malloc+0xde>
17d2: 8b 45 f4 mov -0xc(%ebp),%eax
17d5: 89 45 f0 mov %eax,-0x10(%ebp)
17d8: 8b 45 f4 mov -0xc(%ebp),%eax
17db: 8b 00 mov (%eax),%eax
17dd: 89 45 f4 mov %eax,-0xc(%ebp)
17e0: e9 70 ff ff ff jmp 1755 <malloc+0x4e>
17e5: c9 leave
17e6: c3 ret
| 38.483286 | 63 | 0.412315 |
a19885378fa1aa097be9ca2490a45d2010070bfe | 11,190 | go | Go | raftmeta/apply.go | lichong2005/influxdb-cluster | 0f39d36e9d21d7f600af787baa4054048f1d60f1 | [
"MIT"
] | 13 | 2020-02-05T13:30:42.000Z | 2022-03-29T06:19:07.000Z | raftmeta/apply.go | lichong2005/influxdb-cluster | 0f39d36e9d21d7f600af787baa4054048f1d60f1 | [
"MIT"
] | 1 | 2020-06-19T07:27:46.000Z | 2020-06-19T07:27:46.000Z | raftmeta/apply.go | lichong2005/influxdb-cluster | 0f39d36e9d21d7f600af787baa4054048f1d60f1 | [
"MIT"
] | 8 | 2020-09-04T09:59:37.000Z | 2022-03-30T02:26:27.000Z | package raftmeta
import (
"encoding/json"
"errors"
"fmt"
"github.com/influxdb-cluster/raftmeta/internal"
"github.com/influxdb-cluster/x"
"github.com/influxdata/influxdb/services/meta"
"go.uber.org/zap"
"time"
)
func (s *RaftNode) applyCommitted(proposal *internal.Proposal, index uint64) error {
if s.ApplyCallBack != nil {
//only for test
s.ApplyCallBack(proposal, index)
}
msgName, _ := internal.MessageTypeName[proposal.Type]
s.Logger.Info("applyCommitted ", zap.String("type", msgName))
pctx := s.props.pctx(proposal.Key)
if pctx == nil {
pctx = &proposalCtx{}
}
pctx.index = index
switch proposal.Type {
case internal.CreateDatabase:
var req CreateDatabaseReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("apply create database %+v", req))
db, err := s.MetaCli.CreateDatabase(req.Name)
pctx.err = err
if err == nil && pctx.retData != nil {
x.AssertTrue(db != nil)
*pctx.retData.(*meta.DatabaseInfo) = *db //TODO:db pointer是否有风险?
}
return err
case internal.DropDatabase:
var req DropDatabaseReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
return s.MetaCli.DropDatabase(req.Name)
case internal.DropRetentionPolicy:
var req DropRetentionPolicyReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
return s.MetaCli.DropRetentionPolicy(req.Database, req.Policy)
case internal.CreateShardGroup:
var req CreateShardGroupReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
sg, err := s.MetaCli.CreateShardGroup(req.Database, req.Policy, time.Unix(req.Timestamp, 0))
if err == nil && pctx.retData != nil {
if sg != nil {
*pctx.retData.(*meta.ShardGroupInfo) = *sg
} else {
return errors.New("create shard group fail. have no data nodes available")
}
}
return err
case internal.CreateDataNode:
var req CreateDataNodeReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
ni, err := s.MetaCli.CreateDataNode(req.HttpAddr, req.TcpAddr)
if err == nil && pctx.retData != nil {
x.AssertTrue(ni != nil)
*pctx.retData.(*meta.NodeInfo) = *ni
}
return err
case internal.DeleteDataNode:
var req DeleteDataNodeReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
return s.MetaCli.DeleteDataNode(req.Id)
case internal.CreateRetentionPolicy:
var req CreateRetentionPolicyReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
var duration *time.Duration
if req.Rps.Duration > 0 {
duration = &req.Rps.Duration
}
spec := meta.RetentionPolicySpec{
Name: req.Rps.Name,
ReplicaN: &req.Rps.ReplicaN,
Duration: duration,
ShardGroupDuration: req.Rps.ShardGroupDuration,
}
rpi, err := s.MetaCli.CreateRetentionPolicy(req.Database, &spec, req.MakeDefault)
if err == nil && pctx.retData != nil {
x.AssertTrue(rpi != nil)
*pctx.retData.(*meta.RetentionPolicyInfo) = *rpi
}
return err
case internal.UpdateRetentionPolicy:
var req UpdateRetentionPolicyReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
var duration *time.Duration
if req.Rps.Duration > 0 {
duration = &req.Rps.Duration
}
var sduration *time.Duration
if req.Rps.ShardGroupDuration > 0 {
sduration = &req.Rps.ShardGroupDuration
}
var rpName *string
if req.Rps.Name != "" {
rpName = &req.Rps.Name
}
up := meta.RetentionPolicyUpdate{
Name: rpName,
ReplicaN: &req.Rps.ReplicaN,
Duration: duration,
ShardGroupDuration: sduration,
}
return s.MetaCli.UpdateRetentionPolicy(req.Database, req.Name, &up, req.MakeDefault)
case internal.CreateDatabaseWithRetentionPolicy:
var req CreateDatabaseWithRetentionPolicyReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
var duration *time.Duration
if req.Rps.Duration > 0 {
duration = &req.Rps.Duration
}
spec := meta.RetentionPolicySpec{
Name: req.Rps.Name,
ReplicaN: &req.Rps.ReplicaN,
Duration: duration,
ShardGroupDuration: req.Rps.ShardGroupDuration,
}
db, err := s.MetaCli.CreateDatabaseWithRetentionPolicy(req.Name, &spec)
if err == nil && pctx.retData != nil {
x.AssertTrue(db != nil)
*pctx.retData.(*meta.DatabaseInfo) = *db
}
return err
case internal.CreateUser:
var req CreateUserReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
user, err := s.MetaCli.CreateUser(req.Name, req.Password, req.Admin)
if err == nil && pctx.retData != nil {
x.AssertTrue(user != nil)
*pctx.retData.(*meta.UserInfo) = *(user.(*meta.UserInfo))
}
return err
case internal.DropUser:
var req DropUserReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
return s.MetaCli.DropUser(req.Name)
case internal.UpdateUser:
var req UpdateUserReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
return s.MetaCli.UpdateUser(req.Name, req.Password)
case internal.SetPrivilege:
var req SetPrivilegeReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
return s.MetaCli.SetPrivilege(req.UserName, req.Database, req.Privilege)
case internal.SetAdminPrivilege:
var req SetAdminPrivilegeReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
return s.MetaCli.SetAdminPrivilege(req.UserName, req.Admin)
case internal.Authenticate:
var req AuthenticateReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
user, err := s.MetaCli.Authenticate(req.UserName, req.Password)
if err == nil {
x.AssertTrue(user != nil)
*pctx.retData.(*meta.UserInfo) = *(user.(*meta.UserInfo))
}
return err
case internal.AddShardOwner:
var req AddShardOwnerReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("add shard owner req %+v", req))
return s.MetaCli.AddShardOwner(req.ShardID, req.NodeID)
case internal.RemoveShardOwner:
var req RemoveShardOwnerReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("remove shard owner req %+v", req))
return s.MetaCli.RemoveShardOwner(req.ShardID, req.NodeID)
case internal.DropShard:
var req DropShardReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
return s.MetaCli.DropShard(req.Id)
case internal.TruncateShardGroups:
var req TruncateShardGroupsReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
return s.MetaCli.TruncateShardGroups(req.Time)
case internal.PruneShardGroups:
return s.MetaCli.PruneShardGroups()
case internal.DeleteShardGroup:
var req DeleteShardGroupReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
return s.MetaCli.DeleteShardGroup(req.Database, req.Policy, req.Id)
case internal.PrecreateShardGroups:
var req PrecreateShardGroupsReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
return s.MetaCli.PrecreateShardGroups(req.From, req.To)
case internal.CreateContinuousQuery:
var req CreateContinuousQueryReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
return s.MetaCli.CreateContinuousQuery(req.Database, req.Name, req.Query)
case internal.DropContinuousQuery:
var req DropContinuousQueryReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
return s.MetaCli.DropContinuousQuery(req.Database, req.Name)
case internal.CreateSubscription:
var req CreateSubscriptionReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
return s.MetaCli.CreateSubscription(req.Database, req.Rp, req.Name, req.Mode, req.Destinations)
case internal.DropSubscription:
var req DropSubscriptionReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
return s.MetaCli.DropSubscription(req.Database, req.Rp, req.Name)
case internal.AcquireLease:
var req AcquireLeaseReq
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
s.Logger.Info(fmt.Sprintf("req %+v", req))
lease, err := s.leases.Acquire(req.Name, req.NodeId)
if err == nil && pctx.retData != nil {
x.AssertTrue(lease != nil)
*pctx.retData.(*meta.Lease) = *lease
}
return err
case internal.SnapShot:
md, err := s.MetaCli.MarshalBinary()
x.Check(err)
var sndata internal.SnapshotData
sndata.Data = md
sndata.PeersAddr = s.Transport.ClonePeers()
data, err := json.Marshal(&sndata)
x.Check(err)
conf := s.ConfState()
return s.Storage.CreateSnapshot(index, conf, data)
case internal.CreateChecksumMsg:
//TODO:optimize, reduce block time
start := time.Now()
mcd := s.MetaCli.Data()
//消除DeleteAt和TruncatedAt对checksum的影响
for i, _ := range mcd.Databases {
db := &mcd.Databases[i]
for j, _ := range db.RetentionPolicies {
rp := &db.RetentionPolicies[j]
for k, _ := range rp.ShardGroups {
sg := &rp.ShardGroups[k]
sg.DeletedAt = time.Unix(0, 0)
sg.TruncatedAt = time.Unix(0, 0)
}
}
}
data, err := (&mcd).MarshalBinary()
x.Check(err)
s.lastChecksum.index = index
s.lastChecksum.checksum = x.Md5(data)
s.lastChecksum.needVerify = true
detail := fmt.Sprintf("index:%d, checksum:%s, data:%+v", index, s.lastChecksum.checksum, mcd)
s.Logger.Info(fmt.Sprintf("create checksum costs:%s detail:%s", time.Now().Sub(start), detail))
case internal.VerifyChecksumMsg:
start := time.Now()
var req internal.VerifyChecksum
err := json.Unmarshal(proposal.Data, &req)
x.Check(err)
if req.NodeID == s.ID {
s.Logger.Info("ignore checksum. self trigger this verify")
s.lastChecksum.needVerify = false
return nil
}
if s.lastChecksum.index == 0 {
//have no checksum only when restart
s.Logger.Info("ignore checksum. have no checksum", zap.Uint64("index", req.Index))
return nil
}
if s.lastChecksum.index != req.Index {
s.Logger.Warn("ingore checksum", zap.Uint64("last index:", s.lastChecksum.index), zap.Uint64("index", req.Index))
return nil
}
s.Logger.Info("checksum", zap.Uint64("index", req.Index), zap.String("checksum", s.lastChecksum.checksum))
x.AssertTruef(s.lastChecksum.checksum == req.Checksum, "verify checksum fail")
s.Logger.Info(fmt.Sprintf("verify checksum success. costs %s", time.Now().Sub(start)))
default:
return fmt.Errorf("Unkown msg type:%d", proposal.Type)
}
return nil
}
| 30.490463 | 116 | 0.697408 |
c7fe58c5ff63a8d82110ee281eb7701aa25d3c92 | 405 | java | Java | lib_common/src/main/java/com/qunar/im/base/jsonbean/SystemResult.java | wittech/imsdk-android | 65c021f796bc539f5bce58da9e11ab1fd52e2a50 | [
"MIT"
] | 15 | 2019-11-15T04:53:20.000Z | 2021-09-08T02:06:11.000Z | lib_common/src/main/java/com/qunar/im/base/jsonbean/SystemResult.java | wittech/imsdk-android | 65c021f796bc539f5bce58da9e11ab1fd52e2a50 | [
"MIT"
] | 3 | 2019-11-20T02:42:25.000Z | 2020-06-01T04:02:03.000Z | lib_common/src/main/java/com/qunar/im/base/jsonbean/SystemResult.java | wittech/imsdk-android | 65c021f796bc539f5bce58da9e11ab1fd52e2a50 | [
"MIT"
] | 7 | 2019-11-28T16:04:27.000Z | 2020-11-14T05:19:28.000Z | package com.qunar.im.base.jsonbean;
import java.util.List;
/**
* Created by zhaokai on 15-11-11.
*/
public class SystemResult extends BaseResult{
public String title;
public List<Content> content;
public String operation_url;
public String prompt;
public String order_id;
public static class Content{
public String sub_title;
public String sub_content;
}
}
| 21.315789 | 45 | 0.698765 |
1dc88b486d76bea6ad286a6eb8a295e6b2861687 | 2,608 | sql | SQL | scripts/build/functions/functions/update_bus.sql | huynhsamha/transport-passenger | 4e254a54500effbf1fa00d34c50ee2c03e2fa8bb | [
"MIT"
] | 1 | 2019-02-22T16:46:53.000Z | 2019-02-22T16:46:53.000Z | scripts/build/functions/functions/update_bus.sql | delta94/transport-passenger | 4e254a54500effbf1fa00d34c50ee2c03e2fa8bb | [
"MIT"
] | null | null | null | scripts/build/functions/functions/update_bus.sql | delta94/transport-passenger | 4e254a54500effbf1fa00d34c50ee2c03e2fa8bb | [
"MIT"
] | 1 | 2021-01-27T15:48:45.000Z | 2021-01-27T15:48:45.000Z | create or replace FUNCTION UPDATE_BUS(ID1 IN BUSES.ID%TYPE, BUS_TYPE_ID1 IN BUSES.BUS_TYPE_ID%TYPE, REGISTRATION1 IN BUSES.REGISTRATION%TYPE, PRICE1 IN BUSES.PRICE%TYPE,
STATUS1 IN BUSES.STATUS%TYPE, MILES1 IN BUSES.MILES%TYPE,WARRANTY_MONTH1 IN BUSES.WARRANTY_MONTH%TYPE, WARRANTY_MILES1 IN BUSES.WARRANTY_MILES%TYPE
, DESCRIPTION1 IN BUSES.DESCRIPTION%TYPE)
RETURNS INTEGER
AS $$
DECLARE
ROW_COUNT INTEGER := 0;
ROW_BUS BUSES%ROWTYPE;
v_result varchar(250);
BEGIN
SELECT COUNT(*) INTO ROW_COUNT FROM BUSES WHERE ID = ID1;
IF ROW_COUNT = 0 THEN
select show_message('ID DOES NOT EXIST !') into v_result;
RETURN 1;
ELSE
SELECT * INTO ROW_BUS FROM BUSES WHERE ID = ID1;
IF BUS_TYPE_ID1 IS NULL THEN
BUS_TYPE_ID1 := ROW_BUS.BUS_TYPE_ID;
ELSE
SELECT COUNT(*) INTO ROW_COUNT FROM BUS_TYPES WHERE ID = BUS_TYPE_ID1;
IF ROW_COUNT = 0 THEN
select show_message('BUS_TYPE_ID DOES NOT EXIST !') into v_result;
RETURN 2;
END IF;
END IF;
IF REGISTRATION1 IS NULL THEN
REGISTRATION1 := ROW_BUS.REGISTRATION;
ELSE
SELECT COUNT(*) INTO ROW_COUNT FROM BUSES WHERE REGISTRATION = REGISTRATION1;
IF ROW_COUNT > 0 THEN
select show_message('REGISTRATION DOES NOT EXIST !') into v_result;
RETURN 3;
END IF;
END IF;
IF PRICE1 IS NULL THEN
PRICE1 := ROW_BUS.PRICE;
END IF;
IF STATUS1 IS NULL THEN
STATUS1 := ROW_BUS.STATUS;
END IF;
IF MILES1 IS NULL THEN
MILES1 := ROW_BUS.MILES;
END IF;
IF WARRANTY_MONTH1 IS NULL THEN
WARRANTY_MONTH1 := ROW_BUS.WARRANTY_MONTH;
END IF;
IF WARRANTY_MILES1 IS NULL THEN
WARRANTY_MILES1 := ROW_BUS.WARRANTY_MILES;
END IF;
IF DESCRIPTION1 IS NULL THEN
DESCRIPTION1 := ROW_BUS.DESCRIPTION;
END IF;
UPDATE BUSES SET BUS_TYPE_ID = BUS_TYPE_ID1, REGISTRATION = REGISTRATION1, PRICE = PRICE1, STATUS = STATUS1, MILES = MILES1,WARRANTY_MONTH = WARRANTY_MONTH1, WARRANTY_MILES = WARRANTY_MILES1,
DESCRIPTION = DESCRIPTION1,CREATED_AT = CREATED_AT, UPDATED_AT = CURRENT_TIMESTAMP
WHERE ID = ID1;
select show_message('UPDATING BUSES IS SUCCESSFUL !') into v_result;
END IF;
RETURN 0;
END;
$$ language plpgsql; | 37.257143 | 201 | 0.607745 |
00f7b2c8fe19a48ffdbbdc0a824d2881c78a193e | 166 | ps1 | PowerShell | keyhub-cli/tools/chocolateyUninstall.ps1 | esrahofstede/keyhub-cli | a043abb4789a7772dfdaee8f6c98251c063c4b9f | [
"MIT"
] | 1 | 2022-01-28T13:06:55.000Z | 2022-01-28T13:06:55.000Z | keyhub-cli/tools/chocolateyUninstall.ps1 | esrahofstede/keyhub-cli | a043abb4789a7772dfdaee8f6c98251c063c4b9f | [
"MIT"
] | null | null | null | keyhub-cli/tools/chocolateyUninstall.ps1 | esrahofstede/keyhub-cli | a043abb4789a7772dfdaee8f6c98251c063c4b9f | [
"MIT"
] | null | null | null | $ErrorActionPreference = 'Stop';
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
Uninstall-BinFile -Name keyhub -Path $toolsDir/keyhub.cmd | 33.2 | 72 | 0.759036 |
e3e180be0845da2d816323ae57e4a5fac13c4f49 | 1,938 | go | Go | pkg/vdri/trustbloc/selection/staticselection/service.go | rolsonquadras/trustbloc-did-method | 10c5d48686a6c20b8d3774274dc91bf025770887 | [
"Apache-2.0"
] | null | null | null | pkg/vdri/trustbloc/selection/staticselection/service.go | rolsonquadras/trustbloc-did-method | 10c5d48686a6c20b8d3774274dc91bf025770887 | [
"Apache-2.0"
] | null | null | null | pkg/vdri/trustbloc/selection/staticselection/service.go | rolsonquadras/trustbloc-did-method | 10c5d48686a6c20b8d3774274dc91bf025770887 | [
"Apache-2.0"
] | null | null | null | /*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package staticselection
import (
"crypto/rand"
"fmt"
"math/big"
mathrand "math/rand"
"github.com/trustbloc/trustbloc-did-method/pkg/vdri/trustbloc/models"
)
type config interface {
GetConsortium(url, domain string) (*models.ConsortiumFileData, error)
GetStakeholder(url, domain string) (*models.StakeholderFileData, error)
}
// SelectionService implements a static selection service
type SelectionService struct {
config config
}
// NewService return static selection service
func NewService(config config) *SelectionService {
return &SelectionService{config: config}
}
// SelectEndpoints select a random endpoint for each of N random stakeholders in a consortium
// Where N is the numQueries parameter in the consortium's policy configuration
func (ds *SelectionService) SelectEndpoints(consortiumDomain string, endpoints []*models.Endpoint) ([]*models.Endpoint, error) { // nolint: lll
consortiumData, err := ds.config.GetConsortium(consortiumDomain, consortiumDomain)
if err != nil {
return nil, fmt.Errorf("getting consortium: %w", err)
}
var out []*models.Endpoint
// map from each domain to its endpoints
domains := map[string][]*models.Endpoint{}
for _, ep := range endpoints {
domains[ep.Domain] = append(domains[ep.Domain], ep)
}
// list of domains
var d []string
for domain := range domains {
d = append(d, domain)
}
consortium := consortiumData.Config
n := 0
if consortium != nil {
n = consortium.Policy.NumQueries
}
// if ds.numStakeholders is 0, then we use all stakeholders
if n == 0 {
n = len(d)
}
perm := mathrand.Perm(len(d))
for i := 0; i < n && i < len(d); i++ {
list := domains[d[perm[i]]]
n, err := rand.Int(rand.Reader, big.NewInt(int64(len(list))))
if err != nil {
return nil, err
}
out = append(out, list[n.Uint64()])
}
return out, nil
}
| 23.349398 | 143 | 0.711558 |
2d99c4aa139a7061d665a628632d6c07c803e399 | 352 | html | HTML | 02_index.html | aslange/HTML_Basics | 774cb3484bae8032fbb41e2345f03b6d6bc841bf | [
"Apache-2.0"
] | null | null | null | 02_index.html | aslange/HTML_Basics | 774cb3484bae8032fbb41e2345f03b6d6bc841bf | [
"Apache-2.0"
] | null | null | null | 02_index.html | aslange/HTML_Basics | 774cb3484bae8032fbb41e2345f03b6d6bc841bf | [
"Apache-2.0"
] | 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>Imagens</title>
</head>
<body>
<img src="01-Imagens/Desenhos_Cubos.png">
<a href="04_index.html">Retornar</a>
</body>
</html> | 19.555556 | 74 | 0.639205 |
98df7eec6c54535f2055be21802df1f77c6a93e3 | 941 | html | HTML | manuscript/page-715/body.html | marvindanig/jane-eyre | 13cdd83ebbc9fdb3f99882d39569cc638c3c97e4 | [
"CECILL-B"
] | null | null | null | manuscript/page-715/body.html | marvindanig/jane-eyre | 13cdd83ebbc9fdb3f99882d39569cc638c3c97e4 | [
"CECILL-B"
] | null | null | null | manuscript/page-715/body.html | marvindanig/jane-eyre | 13cdd83ebbc9fdb3f99882d39569cc638c3c97e4 | [
"CECILL-B"
] | null | null | null | <div class="leaf flex"><div class="inner justify"><p> and both attempts he smothered in secrecy and sank in oblivion! Lastly, I saw Mr. Mason was submissive to Mr. Rochester; that the impetuous will of the latter held complete sway over the inertness of the former: the few words which had passed between them assured me of this. It was evident that in their former intercourse, the passive disposition of the one had been habitually influenced by the active energy of the other: whence then had arisen Mr. Rochester’s dismay when he heard of Mr. Mason’s arrival? Why had the mere name of this unresisting individual—whom his word now sufficed to control like a child—fallen on him, a few hours since, as a thunderbolt might fall on an oak?</p><p>Oh! I could not forget his look and his paleness when he whispered: “Jane, I have got a blow—I have got a blow, Jane.</p></div> </div> | 941 | 941 | 0.772582 |
1d559bf22a6803b2c11055b0b8cdd2e5cba3dddc | 359 | asm | Assembly | programs/oeis/194/A194756.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/194/A194756.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/194/A194756.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A194756: Number of k such that {-k*pi} < {-n*pi}, where { } = fractional part.
; 1,1,1,1,1,1,1,8,7,6,5,4,3,2,15,13,11,9,7,5,3,22,19,16,13,10,7,4,29,25,21,17,13,9,5,36,31,26,21,16,11,6,43,37,31,25,19,13,7,50,43,36,29,22,15,8,57,49,41,33,25,17,9,64,55,46,37,28,19,10,71,61,51,41,31
mov $1,7
mov $2,$0
mod $0,7
sub $1,$0
sub $2,$0
mul $1,$2
div $1,7
add $1,1
| 29.916667 | 200 | 0.593315 |
c2f651a887298b6a4e843a895c8449842ccae3fe | 6,302 | ps1 | PowerShell | src/NetAppFiles/NetAppFiles.Test/ScenarioTests/ActiveDirectoryTests.ps1 | nimaller/azure-powershell | a31eaed8e1d4f52752222d138436ce975b05dd5f | [
"MIT"
] | 3 | 2021-02-08T06:47:47.000Z | 2021-02-08T09:53:19.000Z | src/NetAppFiles/NetAppFiles.Test/ScenarioTests/ActiveDirectoryTests.ps1 | nimaller/azure-powershell | a31eaed8e1d4f52752222d138436ce975b05dd5f | [
"MIT"
] | 12 | 2015-02-05T09:42:44.000Z | 2021-04-16T13:19:58.000Z | src/NetAppFiles/NetAppFiles.Test/ScenarioTests/ActiveDirectoryTests.ps1 | nimaller/azure-powershell | a31eaed8e1d4f52752222d138436ce975b05dd5f | [
"MIT"
] | 4 | 2015-08-09T10:30:06.000Z | 2019-12-12T10:33:41.000Z | # ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# 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.
# ----------------------------------------------------------------------------------
<#
.SYNOPSIS
Test Active Directory cmdLet CRUD operations
#>
function Test-ActiveDirectoryCrud
{
$resourceGroup = Get-ResourceGroupName
$accName1 = Get-ResourceName
$activeDirectoryName1 = Get-ResourceName
$activeDirectoryName2 = Get-ResourceName
$accName2 = Get-ResourceName
#$resourceLocation = Get-ProviderLocation "Microsoft.NetApp"
$resourceLocation = 'westus2'
$adUsername = "sdkuser"
<#[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="...")]#>
$adPassword = "sdkpass"
$adDomain = "sdkdomain"
$adDns = "192.0.2.2"
$adSmbServerName = "PSSMBSName"
$adSmbServerName2 = "PSMBSName2"
try
{
# create the resource group
New-AzResourceGroup -Name $resourceGroup -Location $resourceLocation
# try creating an Account -
$newTagName = "tag1"
$newTagValue = "tagValue1"
$retrievedAcc = New-AzNetAppFilesAccount -ResourceGroupName $resourceGroup -Location $resourceLocation -Name $accName1 -Tag @{$newTagName = $newTagValue}
Assert-AreEqual $accName1 $retrievedAcc.Name
$sPass = ConvertTo-SecureString $adPassword -AsPlainText -Force
# create and check ActiveDirectory
$retrievedAd = New-AzNetAppFilesActiveDirectory -ResourceGroupName $resourceGroup -AccountName $accName1 -AdName $activeDirectoryName1 -Username $adUsername -Password $sPass -Domain $adDomain -Dns $adDns -SmbServerName $adSmbServerName
$activeDirectoryId = $retrievedAd.ActiveDirectoryId
Assert-AreEqual $adDomain $retrievedAd.Domain
Assert-AreEqual $adUsername $retrievedAd.Username
Assert-AreEqual $adDns $retrievedAd.Dns
Assert-AreEqual $adSmbServerName $retrievedAd.SmbServerName
# get and check account
$retrievedAcc = Get-AzNetAppFilesAccount -ResourceGroupName $resourceGroup -Name $accName1
Assert-AreEqual $adSmbServerName $retrievedAcc.ActiveDirectories[0].SmbServerName
Assert-AreEqual $adUsername $retrievedAcc.ActiveDirectories[0].Username
# get and check a ActiveDirectory by id and check again
$getRetrievedAd = Get-AzNetAppFilesActiveDirectory -ResourceGroupName $resourceGroup -AccountName $accName1 -ActiveDirectoryId $activeDirectoryId
Assert-AreEqual $activeDirectoryName1 $getRetrievedAd.AdName
Assert-AreEqual $adDomain $getRetrievedAd.Domain
Assert-AreEqual $adUsername $getRetrievedAd.Username
Assert-AreEqual $adDns $getRetrievedAd.Dns
Assert-AreEqual $adSmbServerName $getRetrievedAd.SmbServerName
#update AD
$getUpdateddAd = Update-AzNetAppFilesActiveDirectory -ResourceGroupName $resourceGroup -AccountName $accName1 -ActiveDirectoryId $getRetrievedAd.ActiveDirectoryId -SmbServerName $adSmbServerName2 -Password $sPass
Assert-AreEqual $adSmbServerName2 $getUpdateddAd.SmbServerName
# delete activeDirectory retrieved
# but test the WhatIf first, should not be removed
Remove-AzNetAppFilesActiveDirectory -ResourceGroupName $resourceGroup -AccountName $accName1 -ActiveDirectoryId $getRetrievedAd.ActiveDirectoryId -WhatIf
$retrievedActiveDirectoryList = Get-AzNetAppFilesActiveDirectory -ResourceGroupName $resourceGroup -AccountName $accName1
Assert-AreEqual 1 $retrievedActiveDirectoryList.Length
#remove by name
Remove-AzNetAppFilesActiveDirectory -ResourceGroupName $resourceGroup -AccountName $accName1 -ActiveDirectoryId $getRetrievedAd.ActiveDirectoryId
Start-Sleep -s 15
$retrievedActiveDirectoryList = Get-AzNetAppFilesActiveDirectory -ResourceGroupName $resourceGroup -AccountName $accName1
Assert-AreEqual 0 $retrievedActiveDirectoryList.Length
}
finally
{
# Cleanup
Clean-ResourceGroup $resourceGroup
}
}
<#
.SYNOPSIS
Test activeDirectory Pipeline operations (uses command aliases)
#>
function Test-ActiveDirectoryPipelines
{
$resourceGroup = Get-ResourceGroupName
$accName1 = Get-ResourceName
#$resourceLocation = Get-ProviderLocation "Microsoft.NetApp"
$resourceLocation = 'westus2'
$activeDirectoryName1 = Get-ResourceName
$adUsername = "sdkuser"
<#[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="...")]#>
$adPassword = "sdkpass"
$adDomain = "sdkdomain"
$adDns = "192.0.2.2"
$adSmbServerName = "PSSMBSName"
try
{
# create the resource group
New-AzResourceGroup -Name $resourceGroup -Location $resourceLocation
New-AnfAccount -ResourceGroupName $resourceGroup -Location $resourceLocation -Name $accName1
$sPass = ConvertTo-SecureString $adPassword -AsPlainText -Force
#create AD piping in Account
$retrievedAd = Get-AzNetAppFilesAccount -ResourceGroupName $resourceGroup -Name $accName1 | New-AzNetAppFilesActiveDirectory -AdName $activeDirectoryName1 -Username $adUsername -Password $sPass -Domain $adDomain -Dns $adDns -SmbServerName $adSmbServerName
$getRetrievedAd = Get-AzNetAppFilesAccount -ResourceGroupName $resourceGroup -Name $accName1 | Get-AzNetAppFilesActiveDirectory -ActiveDirectoryId $retrievedAd.ActiveDirectoryId
}
finally
{
# Cleanup
Clean-ResourceGroup $resourceGroup
}
}
| 49.622047 | 264 | 0.696763 |
a3c5bd8fffef629b556d6215fc5c977a2d6781b3 | 292 | asm | Assembly | oeis/173/A173598.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/173/A173598.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/173/A173598.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A173598: Period 6: repeat [1, 8, 7, 2, 4, 5].
; Submitted by Christian Krause
; 1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8
mul $0,15
add $0,2
dif $0,2
mod $0,9
| 32.444444 | 173 | 0.544521 |
cb089fb5ca7e03e6bf600040c670a0e7b7ea5acd | 821 | h | C | usr/libexec/itunesstored/SKProductSubscriptionPeriod.h | lechium/tvOS144Headers | e22dcf52662ae03002e3a6d57273f54e74013cb0 | [
"MIT"
] | 2 | 2021-04-15T10:50:21.000Z | 2021-08-19T19:00:09.000Z | usr/sbin/usr/libexec/itunesstored/SKProductSubscriptionPeriod.h | lechium/tvOS144Headers | e22dcf52662ae03002e3a6d57273f54e74013cb0 | [
"MIT"
] | null | null | null | usr/sbin/usr/libexec/itunesstored/SKProductSubscriptionPeriod.h | lechium/tvOS144Headers | e22dcf52662ae03002e3a6d57273f54e74013cb0 | [
"MIT"
] | null | null | null | //
// Generated by classdumpios 1.0.1 (64 bit) (iOS port by DreamDevLost)(Debug version compiled Sep 26 2020 13:48:20).
//
// Copyright (C) 1997-2019 Steve Nygard.
//
#import <objc/NSObject.h>
@interface SKProductSubscriptionPeriod : NSObject
{
id _internal; // 8 = 0x8
}
- (void).cxx_destruct; // IMP=0x000000010004a2a4
- (id)copyXPCEncoding; // IMP=0x000000010004a244
- (id)initWithXPCEncoding:(id)arg1; // IMP=0x000000010004a19c
- (id)initWithISO8601String:(id)arg1; // IMP=0x0000000100049f68
- (id)init; // IMP=0x0000000100049f04
- (void)_setUnit:(unsigned long long)arg1; // IMP=0x0000000100049ef8
- (void)_setNumberOfUnits:(unsigned long long)arg1; // IMP=0x0000000100049eec
@property(readonly, nonatomic) unsigned long long unit;
@property(readonly, nonatomic) unsigned long long numberOfUnits;
@end
| 31.576923 | 120 | 0.744214 |
9669e0ff1501ac37151d98057f73ba608f3cb51c | 899 | asm | Assembly | programs/oeis/018/A018918.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/018/A018918.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/018/A018918.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A018918: Define the generalized Pisot sequence T(a(0),a(1)) by: a(n+2) is the greatest integer such that a(n+2)/a(n+1) < a(n+1)/a(n). This is T(3,6).
; 3,6,11,20,36,64,113,199,350,615,1080,1896,3328,5841,10251,17990,31571,55404,97228,170624,299425,525455,922110,1618191,2839728,4983376,8745216,15346785,26931731,47261894,82938843,145547524,255418100,448227520,786584465,1380359511,2422362078,4250949111,7459895656,13091204280,22973462016,40315615409,70748973083,124155792774,217878227875,382349636060,670976837020,1177482265856,2066337330753,3626169232671,6363483400446,11167134898975,19596955630176,34390259761824,60350698792448,105908093453249,185855747875875,326154101090950,572360547759275,1004422742303476,1762639037938628,3093215881333056,5428215467030961
add $0,3
mov $2,$0
sub $2,1
lpb $0
mov $3,$4
mov $4,$1
sub $1,$3
trn $4,$0
sub $0,1
add $1,$2
add $2,$4
add $4,$0
lpe
| 52.882353 | 611 | 0.786429 |
85a582fa53e06a36dcb97bf92965156cf6322f68 | 3,375 | dart | Dart | lib/models/response_coupon_model.dart | msi-shamim/pendu_customer | c6610a2002f24595157203837b8dd22ec1d0f409 | [
"BSD-3-Clause"
] | null | null | null | lib/models/response_coupon_model.dart | msi-shamim/pendu_customer | c6610a2002f24595157203837b8dd22ec1d0f409 | [
"BSD-3-Clause"
] | null | null | null | lib/models/response_coupon_model.dart | msi-shamim/pendu_customer | c6610a2002f24595157203837b8dd22ec1d0f409 | [
"BSD-3-Clause"
] | null | null | null |
import 'dart:convert';
class ResponseCouponDataModel {
ResponseCouponDataModel({
this.status,
this.message,
this.data,
});
final int status;
final String message;
final List<Datum> data;
factory ResponseCouponDataModel.fromJson(String str) => ResponseCouponDataModel.fromMap(json.decode(str));
String toJson() => json.encode(toMap());
factory ResponseCouponDataModel.fromMap(Map<String, dynamic> json) => ResponseCouponDataModel(
status: json["status"] == null ? null : json["status"],
message: json["message"] == null ? null : json["message"],
data: json["data"] == null ? null : List<Datum>.from(json["data"].map((x) => Datum.fromMap(x))),
);
Map<String, dynamic> toMap() => {
"status": status == null ? null : status,
"message": message == null ? null : message,
"data": data == null ? null : List<dynamic>.from(data.map((x) => x.toMap())),
};
}
class Datum {
Datum({
this.id,
this.title,
this.promoCode,
this.details,
this.discountPercentage,
this.status,
this.startedAt,
this.expiredAt,
this.createdAt,
this.updatedAt,
this.validRange,
this.validRangeYear,
});
final int id;
final String title;
final String promoCode;
final String details;
final String discountPercentage;
final String status;
final DateTime startedAt;
final DateTime expiredAt;
final DateTime createdAt;
final DateTime updatedAt;
final String validRange;
final String validRangeYear;
factory Datum.fromJson(String str) => Datum.fromMap(json.decode(str));
String toJson() => json.encode(toMap());
factory Datum.fromMap(Map<String, dynamic> json) => Datum(
id: json["id"] == null ? null : json["id"],
title: json["title"] == null ? null : json["title"],
promoCode: json["promo_code"] == null ? null : json["promo_code"],
details: json["details"] == null ? null : json["details"],
discountPercentage: json["discount_percentage"] == null ? null : json["discount_percentage"],
status: json["status"] == null ? null : json["status"],
startedAt: json["started_at"] == null ? null : DateTime.parse(json["started_at"]),
expiredAt: json["expired_at"] == null ? null : DateTime.parse(json["expired_at"]),
createdAt: json["created_at"] == null ? null : DateTime.parse(json["created_at"]),
updatedAt: json["updated_at"] == null ? null : DateTime.parse(json["updated_at"]),
validRange: json["valid_range"] == null ? null : json["valid_range"],
validRangeYear: json["valid_range_year"] == null ? null : json["valid_range_year"],
);
Map<String, dynamic> toMap() => {
"id": id == null ? null : id,
"title": title == null ? null : title,
"promo_code": promoCode == null ? null : promoCode,
"details": details == null ? null : details,
"discount_percentage": discountPercentage == null ? null : discountPercentage,
"status": status == null ? null : status,
"started_at": startedAt == null ? null : startedAt.toIso8601String(),
"expired_at": expiredAt == null ? null : expiredAt.toIso8601String(),
"created_at": createdAt == null ? null : createdAt.toIso8601String(),
"updated_at": updatedAt == null ? null : updatedAt.toIso8601String(),
"valid_range": validRange == null ? null : validRange,
"valid_range_year": validRangeYear == null ? null : validRangeYear,
};
}
| 35.526316 | 108 | 0.658667 |
c7d74a67789026bc5b8c444524ef66aea1efaebc | 6,299 | py | Python | ptmc/processing.py | kr-hansen/ptmc | e0830bfd1e454c9d36e1ef390e218df7decdcbea | [
"Apache-2.0"
] | null | null | null | ptmc/processing.py | kr-hansen/ptmc | e0830bfd1e454c9d36e1ef390e218df7decdcbea | [
"Apache-2.0"
] | null | null | null | ptmc/processing.py | kr-hansen/ptmc | e0830bfd1e454c9d36e1ef390e218df7decdcbea | [
"Apache-2.0"
] | 1 | 2018-10-12T17:43:12.000Z | 2018-10-12T17:43:12.000Z | """
Code for processing operations for numpy arrays of tif stacks
"""
#Import packages
#Dependences
import numpy as np
from numpy.fft import fft2, ifft2, fftshift
from scipy.ndimage import median_filter, gaussian_filter, shift
import itertools
import gc
def doMedianFilter(imgstack, med_fsize=3):
'''
Median Filter (Takes 303.37 sec, 5 min 3 sec)
imgstack is (nframes, height, width) numpy array of images
med_fsize is the median filter size
Returns medstack, a (nframes, height, width) numpy array of median filtered images
'''
medstack = np.empty(imgstack.shape, dtype=np.uint16)
for idx, frame in enumerate(imgstack):
medstack[idx,...] = median_filter(frame, size=med_fsize)
return medstack
def doHomomorphicFilter(imgstack, sigmaVal=7):
'''
Homomorphic Filter (Takes 323.1 sec, 5 min 23 sec)
imgstack is (nframes, height, width) numpy array of images
sigmaVal is the gaussian_filter size for subtracing the low frequency component
Returns homomorphimgs, a (nframes, height, width) numpy array of homomorphic filtered images
'''
#Constants to scale from between 0 and 1
eps = 7./3 - 4./3 -1
maxval = imgstack.max()
ScaleFactor = 1./maxval
Baseline = imgstack.min()
# Subtract minimum baseline, and multiply by scale factor. Force minimum of eps before taking log.
logimgs = np.log1p(np.maximum((imgstack-Baseline)*ScaleFactor, eps))
# Get Low Frequency Component from Gaussian Filter
lpComponent = np.empty(logimgs.shape)
for idx, frame in enumerate(logimgs):
lpComponent[idx,...] = gaussian_filter(frame, sigma=sigmaVal)
# Remove Low Frequency Component and Shift Values
adjimgs = logimgs - lpComponent
del logimgs, lpComponent
gc.collect()
logmin = adjimgs.min()
adjimgs = adjimgs - logmin #Shift by minimum logged difference value, so lowest value is 0
#Undo the log and shift back to standard image space
homomorphimgs = (np.expm1(adjimgs)/ScaleFactor) + Baseline
return homomorphimgs
def registerImages(imgstack, Ref=None, method='CrossCorrelation'):
'''
Perform frame-by-frame Image Registration to a reference image using a default of Cross Correlation (465.43 sec. 7 min 45 sec)
imgstack is (nframes, height, width) numpy array of images
Ref is a (height, width) numpy array as a reference image to use for motion correction
If no Ref is given, then the mean across all frames is used
method is the method to use to register the images, with the default being cross-correlation between the Reference frame and each individual frame
Returns stackshift, a (nframes, height, width) numpy array of motion corrected and shifted images
Returns yshift is the number of pixels to shift each frame in the y-direction (height)
Returns xshift is the number of pixels to shift each frame in the x-direction (width)
'''
#Insert functions for different registration methods
def CrossCorrelation(imgstack, Ref):
#Precalculate Static Values
if Ref is None:
Ref = imgstack.mean(axis=0)
imshape = Ref.shape
nframes = imgstack.shape[0]
imcenter = np.array(imshape)/2
yshift = np.empty((nframes,1)); xshift = np.empty((nframes,1));
Ref_fft = fft2(Ref).conjugate()
#Measure shifts from Images and apply those shifts to the Images
stackshift = np.zeros_like(imgstack, dtype=np.uint16)
for idx, frame in enumerate(imgstack):
xcfft = fft2(frame) * Ref_fft
xcim = abs(ifft2(xcfft))
xcpeak = np.array(np.unravel_index(np.argmax(fftshift(xcim)), imshape))
disps = imcenter - xcpeak
stackshift[idx,...] = np.uint16(shift(frame, disps))
yshift[idx] = disps[0]
xshift[idx] = disps[1]
return stackshift, yshift, xshift
#Dictionary for method selection and return
method_select = {
'CrossCorrelation': CrossCorrelation(imgstack, Ref),
}
#Run the selected method from the dictionary the method_select dictionary
return method_select.get(method, "ERROR: No function defined for Provided Method")
def calculateFramewiseCrossCorrelation(imgstack1, imgstack2):
'''
Calculate frame-by-frame Cross Correlation between two image stacks (465.43 sec. 7 min 45 sec)
imgstack1 is (nframes, height, width) numpy array of images
imgstack2 is (nframes, height, width) numpy array of images
imgstack1 and imgstack2 should be the same dimensions, however if one video is shorter than the other, then the values will be calculated for all of the length of the shorter video
Returns yshift is the number of pixels to shift each frame in the y-direction (height)
Returns xshift is the number of pixels to shift each frame in the x-direction (width)
'''
#Precalculate Static Values
nframes = imgstack1.shape[0]
imshape = imgstack1.shape[1:]
imcenter = np.array(imshape)/2
yshift = np.empty((nframes,1)); xshift = np.empty((nframes,1));
#Loop through frames and compute cross correlation between each frame in the stack
for idx, (frame1, frame2) in enumerate(itertools.izip(imgstack1,imgstack2)):
xcfft = fft2(frame1) * fft2(frame2).conjugate()
xcim = abs(ifft2(xcfft))
xcpeak = np.array(np.unravel_index(np.argmax(fftshift(xcim)), imshape))
disps = imcenter - xcpeak
yshift[idx] = disps[0]
xshift[idx] = disps[1]
return yshift, xshift
def applyFrameShifts(imgstack, yshift, xshift):
'''
Apply frame shifts to each frame of an image stack (301.28 sec. 5 min 2 sec)
imgstack is (nframes, height, width) numpy array of images
yshift is the number of pixels to shift each frame in the y-direction (height)
xshift is the number of pixels to shift each frame in the x-direction (width)
Returns stackshift, a (nframes, height, width) numpy array of images shifted according to yshift & xshift
'''
#Precalculate Static Values
stackshift = np.zeros_like(imgstack, dtype=np.uint16)
for idx, frame in enumerate(imgstack):
stackshift[idx,...] = np.uint16(shift(frame, (yshift[idx],xshift[idx])))
return stackshift
| 44.048951 | 184 | 0.697095 |
064cc13cdeab4630add04833902fc3256cd1e8aa | 4,474 | sql | SQL | leetcode_SQL/count-the-number-of-experiments.sql | yennanliu/Python_basics | 6a597442d39468295946cefbfb11d08f61424dc3 | [
"Unlicense"
] | 18 | 2019-08-01T07:45:02.000Z | 2022-03-31T18:05:44.000Z | leetcode_SQL/count-the-number-of-experiments.sql | yennanliu/Python_basics | 6a597442d39468295946cefbfb11d08f61424dc3 | [
"Unlicense"
] | null | null | null | leetcode_SQL/count-the-number-of-experiments.sql | yennanliu/Python_basics | 6a597442d39468295946cefbfb11d08f61424dc3 | [
"Unlicense"
] | 15 | 2019-12-29T08:46:20.000Z | 2022-03-08T14:14:05.000Z | /*
Count the Number of Experiments Problem
Description
LeetCode Problem 1990.
Table: Experiments
+-----------------+------+
| Column Name | Type |
+-----------------+------+
| experiment_id | int |
| platform | enum |
| experiment_name | enum |
+-----------------+------+
experiment_id is the primary key for this table.
platform is an enum with one of the values ('Android', 'IOS', 'Web').
experiment_name is an enum with one of the values ('Reading', 'Sports', 'Programming').
This table contains information about the ID of an experiment done with a random person, the platform used to do the experiment, and the name of the experiment.
Write an SQL query to report the number of experiments done on each of the three platforms for each of the three given experiments. Notice that all the pairs of (platform, experiment) should be included in the output including the pairs with zero experiments.
Return the result table in any order.
The query result format is in the following example.
Example 1:
Input:
Experiments table:
+---------------+----------+-----------------+
| experiment_id | platform | experiment_name |
+---------------+----------+-----------------+
| 4 | IOS | Programming |
| 13 | IOS | Sports |
| 14 | Android | Reading |
| 8 | Web | Reading |
| 12 | Web | Reading |
| 18 | Web | Programming |
+---------------+----------+-----------------+
Output:
+----------+-----------------+-----------------+
| platform | experiment_name | num_experiments |
+----------+-----------------+-----------------+
| Android | Reading | 1 |
| Android | Sports | 0 |
| Android | Programming | 0 |
| IOS | Reading | 0 |
| IOS | Sports | 1 |
| IOS | Programming | 1 |
| Web | Reading | 2 |
| Web | Sports | 0 |
| Web | Programming | 1 |
+----------+-----------------+-----------------+
Explanation:
On the platform "Android", we had only one "Reading" experiment.
On the platform "IOS", we had one "Sports" experiment and one "Programming" experiment.
On the platform "Web", we had two "Reading" experiments and one "Programming" experiment.
*/
# V0
# IEEA : CROSS JOIN
WITH platforms_cte AS (
SELECT 'IOS' AS platform
UNION ALL
SELECT 'Android'
UNION ALL
SELECT 'Web'
),
experiment_names_cte AS (
SELECT 'Programming' AS experiment_name
UNION ALL
SELECT 'Sports'
UNION ALL
SELECT 'Reading'
),
platforms_and_experiments_cte AS (
SELECT * FROM platforms_cte CROSS JOIN experiment_names_cte
)
SELECT
a.platform,
a.experiment_name,
COUNT(b.platform) AS num_experiments
FROM
platforms_and_experiments_cte a
LEFT JOIN Experiments b
ON a.platform = b.platform AND a.experiment_name = b.experiment_name
GROUP BY a.platform, a.experiment_name
ORDER BY NULL;
# V1
# https://circlecoder.com/count-the-number-of-experiments/
select
platform,
experiment_name,
ifnull(num_experiments, 0) as num_experiments
from
(select "Android" as platform
union
select "IOS" as platform
union
select "Web" as platform) a
cross join (select "Reading" as experiment_name
union
select "Sports" as experiment_name
union
select "Programming" as experiment_name) b
left join (select platform, experiment_name, count(*) as num_experiments
from Experiments
group by 1, 2) c
using (platform, experiment_name)
order by 1, 2
# V2
# Time: O(n)
# Space: O(n)
WITH platforms_cte AS (
SELECT 'IOS' AS platform
UNION ALL
SELECT 'Android'
UNION ALL
SELECT 'Web'
),
experiment_names_cte AS (
SELECT 'Programming' AS experiment_name
UNION ALL
SELECT 'Sports'
UNION ALL
SELECT 'Reading'
),
platforms_and_experiments_cte AS (
SELECT * FROM platforms_cte CROSS JOIN experiment_names_cte
)
SELECT
a.platform,
a.experiment_name,
COUNT(b.platform) AS num_experiments
FROM
platforms_and_experiments_cte a
LEFT JOIN Experiments b
ON a.platform = b.platform AND a.experiment_name = b.experiment_name
GROUP BY a.platform, a.experiment_name
ORDER BY NULL; | 30.22973 | 259 | 0.583147 |
28fe2e689d86ae7e5346a104107d521d3ab3b236 | 5,420 | cpp | C++ | source/core/plugin_loader.cpp | mbenkmann/moltengamepad | 7fc91a4ac2dee105745e1a81ca2cbb293be4c4a8 | [
"MIT"
] | 204 | 2015-12-25T06:40:16.000Z | 2022-03-14T06:27:20.000Z | source/core/plugin_loader.cpp | mbenkmann/moltengamepad | 7fc91a4ac2dee105745e1a81ca2cbb293be4c4a8 | [
"MIT"
] | 96 | 2016-04-03T23:53:56.000Z | 2022-03-06T16:24:38.000Z | source/core/plugin_loader.cpp | mbenkmann/moltengamepad | 7fc91a4ac2dee105745e1a81ca2cbb293be4c4a8 | [
"MIT"
] | 37 | 2016-01-02T01:04:13.000Z | 2022-03-22T19:31:02.000Z | #include "plugin_loader.h"
#include "moltengamepad.h"
#ifndef NO_PLUGIN_LOADING
#include <dlfcn.h>
#endif
plugin_api plugin_methods;
std::vector<std::function<int (plugin_api)>> builtin_plugins;
bool LOAD_PLUGINS = false;
int register_plugin( int (*init) (plugin_api)) {
if (init) {
builtin_plugins.push_back(init);
}
return 0;
};
moltengamepad* loader_mg;
int load_builtins(moltengamepad* mg) {
loader_mg = mg;
plugin_api reset = plugin_methods;
for (auto func : builtin_plugins) {
//Be overly cautious, keep one plugin from clearing methods for others.
try {
plugin_methods = reset;
func(plugin_methods);
} catch (std::exception& e) {
std::cout << "PLGIN: " << e.what() << std::endl;
}
}
return 0;
};
int load_plugin(const std::string& path) {
#ifndef NO_PLUGIN_LOADING
char* err = dlerror();
void* handle = dlopen(path.c_str(),RTLD_LAZY | RTLD_NODELETE);
if (!handle) {
err = dlerror();
debug_print(DEBUG_NONE, 2, "plugin: ", err);
return -1;
}
int (*plugin_init) (plugin_api);
err = dlerror();
*(void **) &plugin_init = dlsym(handle, "plugin_init");
err = dlerror();
if (err || !plugin_init) {
debug_print(DEBUG_NONE, 2, "plugin: ", err);
return -1;
}
debug_print(DEBUG_INFO, 2, "plugin: initializing ", path.c_str());
plugin_api api = plugin_methods;
int ret = (*plugin_init)(api);
if (ret)
debug_print(DEBUG_NONE, 3, "plugin: init ", path.c_str(), " failed.");
dlclose(handle);
#endif
return 0;
}
void init_plugin_api() {
memset(&plugin_methods, 0, sizeof(plugin_methods));
plugin_methods.head.size = sizeof(plugin_methods.head);
plugin_methods.mg.size = sizeof(plugin_methods.mg);
plugin_methods.device.size = sizeof(plugin_methods.device);
plugin_methods.manager.size = sizeof(plugin_methods.manager);
plugin_methods.mg.add_manager = [] (manager_plugin raw_manager, void* manager_plug_data) {
manager_plugin manager;
memset(&manager,0,sizeof(manager));
memcpy(&manager,&raw_manager,raw_manager.size);
return loader_mg->add_manager(manager, manager_plug_data);
};
plugin_methods.mg.request_slot = [] (input_source* dev) {
return loader_mg->slots->request_slot(dev);
};
plugin_methods.mg.grab_permissions = [] (udev_device* dev, bool grabbed) {
return loader_mg->udev.grab_permissions(dev, grabbed);
};
plugin_methods.mg.virtual_device_ref = [] (virtual_device* dev) {
dev->ref();
return 0;
};
plugin_methods.mg.virtual_device_unref = [] (virtual_device* dev) {
dev->unref();
return 0;
};
plugin_methods.mg.grab_permissions_specific = [] (udev_device* dev, bool grabbed, int flags) {
return loader_mg->udev.grab_permissions(dev, grabbed, flags);
};
plugin_methods.manager.plug_data = [] (const device_manager* man) {
return man->plug_data;
};
plugin_methods.manager.register_event = [] (device_manager* man, event_decl ev) {
return man->register_event(ev);
};
plugin_methods.manager.register_dev_option = [] (device_manager* man, option_decl opt) {
return man->register_device_option(opt);
};
plugin_methods.manager.register_manager_option = [] (device_manager* man, option_decl opt) {
return man->register_manager_option(opt);
};
plugin_methods.manager.register_alias = [] (device_manager* man, const char* external, const char* local) {
return man->register_alias(external, local);
};
plugin_methods.manager.add_device = [] (device_manager* man, device_plugin raw_dev, void* dev_plug_data) {
device_plugin dev;
memset(&dev,0,sizeof(dev));
memcpy(&dev,&raw_dev,raw_dev.size);
return man->add_device(dev, dev_plug_data);
};
plugin_methods.manager.remove_device = [] (device_manager* man, input_source* dev) {
return man->mg->remove_device(dev);
};
plugin_methods.manager.print = [] (device_manager* man, const char* message) -> int {
man->log.take_message(0,std::string(message));
return 0;
};
plugin_methods.manager.register_event_group = [] (device_manager* man, event_group_decl decl) {
return man->register_event_group(decl);
};
plugin_methods.device.plug_data = [] (const input_source* dev) {
return dev->plug_data;
};
plugin_methods.device.watch_file = [] (input_source* dev, int fd, void* tag) -> int {
dev->watch_file(fd, tag);
return 0;
};
plugin_methods.device.toggle_event = [] (input_source* dev, int id, event_state state) -> int {
dev->toggle_event(id, state);
return 0;
};
plugin_methods.device.send_value = [] (input_source* dev, int id, int64_t value) -> int {
dev->send_value(id, value);
return 0;
};
plugin_methods.device.send_syn_report = [] (input_source* dev) -> int {
dev->send_syn_report();
return 0;
};
plugin_methods.device.remove_option = [] (input_source* dev, const char* opname) -> int {
dev->devprofile->remove_option(std::string(opname));
return 0;
};
plugin_methods.device.print = [] (input_source* dev, const char* text) -> int {
dev->print(std::string(text));
return 0;
};
plugin_methods.device.request_recurring_events = [] (input_source* dev, bool wants_recurring) -> int {
dev->set_plugin_recurring(wants_recurring);
return 0;
};
plugin_methods.head.mg = &plugin_methods.mg;
plugin_methods.head.device = &plugin_methods.device;
plugin_methods.head.manager = &plugin_methods.manager;
};
| 32.45509 | 109 | 0.691513 |
0b8cb9211db86e8a3c8e8b138c17ac41f7b2fae4 | 3,001 | py | Python | wgan/updater.py | Aixile/chainer-gan-experiments | 4371e8369d2805e8ace6d7aacc397aa6e62680a6 | [
"MIT"
] | 70 | 2017-06-24T10:55:57.000Z | 2021-11-23T22:52:37.000Z | wgan/updater.py | Aixile/chainer-gan-experiments | 4371e8369d2805e8ace6d7aacc397aa6e62680a6 | [
"MIT"
] | 1 | 2017-08-21T06:19:31.000Z | 2017-08-21T07:54:28.000Z | wgan/updater.py | Aixile/chainer-gan-experiments | 4371e8369d2805e8ace6d7aacc397aa6e62680a6 | [
"MIT"
] | 16 | 2017-08-22T07:00:16.000Z | 2018-11-18T16:15:21.000Z | import numpy as np
import chainer
import chainer.functions as F
import chainer.links as L
from chainer import cuda, optimizers, serializers, Variable
import sys
sys.path.insert(0, '../')
from common.loss_functions import *
class Updater(chainer.training.StandardUpdater):
def __init__(self, *args, **kwargs):
self.gen, self.dis = kwargs.pop('models')
self._iter = 0
params = kwargs.pop('params')
self._img_size = params['img_size']
self._img_chan = params['img_chan']
self._latent_len = params['latent_len']
self._dis_iter = params['dis_iter']
self._batch_size = params['batch_size']
self._lambda_gp = params['lambda_gp']
self._mode = params['mode']
super(Updater, self).__init__(*args, **kwargs)
def get_real_image_batch(self):
xp = self.gen.xp
batch = self.get_iterator('main').next()
t_out = xp.zeros((self._batch_size, self._img_chan, self._img_size, self._img_size)).astype("f")
for i in range(self._batch_size):
t_out[i, :] = xp.asarray(batch[i])
return t_out
def get_fake_image_batch(self):
z = self.get_latent_code_batch()
x_out = self.gen(Variable(z, volatile=True), test=True).data
return x_out
def get_latent_code_batch(self):
xp = self.gen.xp
z_in = xp.random.normal(size=(self._batch_size, self._latent_len)).astype("f")
return z_in
def update_core(self):
xp = self.gen.xp
self._iter += 1
opt_d = self.get_optimizer('dis')
for i in range(self._dis_iter):
d_fake = self.get_fake_image_batch()
d_real = self.get_real_image_batch()
y_fake = self.dis(Variable(d_fake), test=False)
y_real = self.dis(Variable(d_real), test=False)
w1 = F.average(y_fake-y_real)
loss_dis = w1
if self._mode == 'gp':
eta = np.random.rand()
c = (d_real * eta + (1.0 - eta) * d_fake).astype('f')
y = self.dis(Variable(c), test=False, retain_forward=True)
g = xp.ones_like(y.data)
grad_c = self.dis.differentiable_backward(Variable(g))
grad_c_l2 = F.sqrt(F.sum(grad_c**2, axis=(1, 2, 3)))
loss_gp = loss_l2(grad_c_l2, 1.0)
loss_dis += self._lambda_gp * loss_gp
opt_d.zero_grads()
loss_dis.backward()
opt_d.update()
if self._mode == 'clip':
self.dis.clip()
chainer.report({'loss': loss_dis,'loss_w1': w1}, self.dis)
z_in = self.get_latent_code_batch()
x_out = self.gen(Variable(z_in), test=False)
opt_g = self.get_optimizer('gen')
y_fake = self.dis(x_out, test=False)
loss_gen = - F.average(y_fake)
chainer.report({'loss': loss_gen}, self.gen)
opt_g.zero_grads()
loss_gen.backward()
opt_g.update()
| 31.589474 | 104 | 0.587471 |