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
39f865ce69c50c1d29448d8b28b7474c53a7f2c8
2,798
java
Java
src/test/java/seedu/weeblingo/model/flashcard/FlashcardTest.java
Cheng20010201/tp
3ea45d818313460c8e4b26de2f9140eaa1cfa37f
[ "MIT" ]
null
null
null
src/test/java/seedu/weeblingo/model/flashcard/FlashcardTest.java
Cheng20010201/tp
3ea45d818313460c8e4b26de2f9140eaa1cfa37f
[ "MIT" ]
143
2021-02-17T15:55:19.000Z
2021-04-11T18:01:55.000Z
src/test/java/seedu/weeblingo/model/flashcard/FlashcardTest.java
Cheng20010201/tp
3ea45d818313460c8e4b26de2f9140eaa1cfa37f
[ "MIT" ]
4
2021-02-15T11:46:02.000Z
2021-02-21T09:29:57.000Z
package seedu.weeblingo.model.flashcard; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static seedu.weeblingo.logic.commands.CommandTestUtil.VALID_ANSWER_I; import static seedu.weeblingo.logic.commands.CommandTestUtil.VALID_QUESTION_I; import static seedu.weeblingo.logic.commands.CommandTestUtil.VALID_TAG_DIFFICULT; import static seedu.weeblingo.testutil.Assert.assertThrows; import static seedu.weeblingo.testutil.TypicalFlashcards.A_CARD; import static seedu.weeblingo.testutil.TypicalFlashcards.I_CARD; import org.junit.jupiter.api.Test; import seedu.weeblingo.testutil.FlashcardBuilder; public class FlashcardTest { @Test public void asObservableList_modifyList_throwsUnsupportedOperationException() { Flashcard flashcard = new FlashcardBuilder().build(); assertThrows(UnsupportedOperationException.class, () -> flashcard.getWeeblingoTags().remove(0)); } @Test public void isSameFlashcard() { // same object -> returns true assertTrue(A_CARD.isSameFlashcard(A_CARD)); // null -> returns false assertFalse(A_CARD.isSameFlashcard(null)); // different question, all other attributes same -> returns false Flashcard editedFlashcardQuestion = new FlashcardBuilder(A_CARD).withQuestion(VALID_QUESTION_I).build(); assertFalse(A_CARD.isSameFlashcard(editedFlashcardQuestion)); } @Test public void equals() { // same values -> returns true Flashcard aCardCopy = new FlashcardBuilder(A_CARD).build(); assertTrue(A_CARD.equals(aCardCopy)); // same object -> returns true assertTrue(A_CARD.equals(A_CARD)); // null -> returns false assertFalse(A_CARD.equals(null)); // different type -> returns false assertFalse(A_CARD.equals(5)); // different flashcard -> returns false assertFalse(A_CARD.equals(I_CARD)); // different question -> returns false Flashcard editedFlashcardA = new FlashcardBuilder(A_CARD).withQuestion(VALID_QUESTION_I).build(); assertFalse(A_CARD.equals(editedFlashcardA)); // different answer -> returns false editedFlashcardA = new FlashcardBuilder(A_CARD).withAnswer(VALID_ANSWER_I).build(); assertFalse(A_CARD.equals(editedFlashcardA)); // different default tags -> returns false editedFlashcardA = new FlashcardBuilder(A_CARD).withTags(VALID_TAG_DIFFICULT).build(); assertFalse(A_CARD.equals(editedFlashcardA)); // different user tags -> returns false editedFlashcardA = new FlashcardBuilder(A_CARD).withUserTags(VALID_TAG_DIFFICULT).build(); assertFalse(A_CARD.equals(editedFlashcardA)); } }
38.861111
112
0.72802
6ae7e20c202f0ba15c9daee42e86baeccf7476f2
3,095
swift
Swift
Gravity Kit/Gravity Controller/Actions+Particles.swift
moosefactory/MF-Metal-Example
6227e3760718c91ba3f28c4b9ef139a5bcaae10c
[ "MIT" ]
null
null
null
Gravity Kit/Gravity Controller/Actions+Particles.swift
moosefactory/MF-Metal-Example
6227e3760718c91ba3f28c4b9ef139a5bcaae10c
[ "MIT" ]
null
null
null
Gravity Kit/Gravity Controller/Actions+Particles.swift
moosefactory/MF-Metal-Example
6227e3760718c91ba3f28c4b9ef139a5bcaae10c
[ "MIT" ]
null
null
null
// // Actions+Particles.swift // MF Metal Example // // Created by Tristan Leblanc on 13/12/2020. // import MoofFoundation //protocol ParameterIdentifierProtocol { // //} /// User actions that control World parameters enum ParticlesParametersIdentifier: Int, CaseIterable { /// setParticlesGridSize : Set the particles grid size. Number of particles will be gridSize^2. case setParticlesGridSize = 101 /// Lock particles on the grid. case lockOnGrid = 110 /// setSpringForce : Set the spring force. /// - O : Spring can grow infinitely /// - 1 : Spring can't grow - Equivalent to gridLock case setSpringForce = 111 /// drawSpring : Draw the spring that pull particles back to their position on grid. case drawSpring = 112 /// showParticles : Render the particles in the particles view. case showParticles = 120 /// showAttractors : Render the attractors in the particles view. case showAttractors = 121 /// setGravityConstant : Set the gravity constant. case setParticlesSensitivity = 211 static var sliders: [ParticlesParametersIdentifier] { return [.setParticlesGridSize, .setSpringForce, .setParticlesSensitivity] } static var switches: [ParticlesParametersIdentifier] { return [.showParticles, .showAttractors, .lockOnGrid, .drawSpring] } } extension ParticlesParametersIdentifier: ParameterIdentifierProtocol { var controlType: ActionControlType { switch self { case .lockOnGrid, .drawSpring: return .switch case .showParticles, .showAttractors: return .switch default: return .slider } } var identifier: String { switch self { case .setParticlesSensitivity: return "ParticlesSensitivity" case .setParticlesGridSize: return "SetParticlesGridSize" case .lockOnGrid: return "LockOnGrid" case .setSpringForce: return "SetSpringForce" case .drawSpring: return "DrawSpring" case .showParticles: return "ShowParticles" case .showAttractors: return "ShowAttractors" } } var tag: Int { rawValue } var min: Double { switch self { case .setParticlesSensitivity: return 0.01 default: return 0 } } var max: Double { switch self { case .setParticlesGridSize: return 80 case .setSpringForce: return 0.2 case .setParticlesSensitivity: return 100 default: return 1 } } var `default`: Double { switch self { case .setParticlesGridSize: return 10 case .setParticlesSensitivity: return 1 case .lockOnGrid, .setSpringForce, .drawSpring: return 0 case .showParticles, .showAttractors: return 0 } } }
25.162602
99
0.601292
33725cc2887439803269c191d59e5c5bf9049c38
1,342
swift
Swift
MyTabBarController/MyTabBarController/ViewController/MyTabBarController.swift
William-Weng/Swift-5
3462085ac8f95014a94937d8fc52588c65d15b91
[ "MIT" ]
10
2019-09-09T07:30:50.000Z
2021-12-17T07:56:12.000Z
MyTabBarController/MyTabBarController/ViewController/MyTabBarController.swift
William-Weng/Swift-5
3462085ac8f95014a94937d8fc52588c65d15b91
[ "MIT" ]
null
null
null
MyTabBarController/MyTabBarController/ViewController/MyTabBarController.swift
William-Weng/Swift-5
3462085ac8f95014a94937d8fc52588c65d15b91
[ "MIT" ]
1
2019-09-09T07:30:12.000Z
2019-09-09T07:30:12.000Z
// // MyTabBarController.swift // MyTabBarController // // Created by William.Weng on 2021/6/7. // import UIKit // MARK: - 自訂UITabBarController背景 final class MyTabBarController: UITabBarController { private let stackView = UIStackView() private let notificationCenter = NotificationCenter.default override func viewDidLoad() { super.viewDidLoad() initStackView() initTabbarViews() } override func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) { notificationCenter._post(name: ._tabbarDidSelected, object: item) } } // MARK: - 小工具 extension MyTabBarController { /// 初始化StackView => 到最底層 (index = 0) private func initStackView() { stackView._constraint(on: self.tabBar) stackView.alignment = .fill stackView.distribution = .fillEqually tabBar.insertSubview(stackView, at: .zero) } /// 初始化Tabbar的背景 (只有一次) private func initTabbarViews() { notificationCenter._register(name: ._tabbarStackViews) { notification in guard let views = notification.object as? [UIView] else { return } self.stackView._addArrangedSubviews(views) self.notificationCenter._remove(observer: self, name: ._tabbarStackViews) } } }
25.807692
85
0.646796
9c32661139c8304ae679463b331421a581004e86
279
js
JavaScript
src/lang/maxWith.js
brianneisler/moltres
eca8abe6cdac9a86172a14fe5f095ec0a780f3be
[ "Apache-2.0" ]
14
2016-09-16T01:47:23.000Z
2021-07-13T04:04:14.000Z
src/lang/maxWith.js
brianneisler/moltres
eca8abe6cdac9a86172a14fe5f095ec0a780f3be
[ "Apache-2.0" ]
71
2020-08-04T15:37:25.000Z
2021-09-22T01:18:22.000Z
src/lang/maxWith.js
brianneisler/moltres
eca8abe6cdac9a86172a14fe5f095ec0a780f3be
[ "Apache-2.0" ]
1
2020-04-22T01:17:11.000Z
2020-04-22T01:17:11.000Z
import curryN from './curryN' import first from './first' import reduceRight from './reduceRight' const maxWith = curryN(2, (func, ...values) => { if (values.length === 1) { return values[0] } return reduceRight(func, first(values), values) }) export default maxWith
21.461538
49
0.677419
d27624484e85ce8c6469eb7966075088a322b7ee
2,855
php
PHP
src/Triv/CoreBundle/Entity/Vote.php
EroStackOverFlow/nippanim
d0f065d4ece8e3d25bb599ead0c5de8978a0285e
[ "MIT" ]
1
2019-11-04T21:33:43.000Z
2019-11-04T21:33:43.000Z
src/Triv/CoreBundle/Entity/Vote.php
EroStackOverFlow/nippanim
d0f065d4ece8e3d25bb599ead0c5de8978a0285e
[ "MIT" ]
1
2019-12-03T07:39:48.000Z
2019-12-03T07:39:48.000Z
src/Triv/CoreBundle/Entity/Vote.php
EroStackOverFlow/nippanim
d0f065d4ece8e3d25bb599ead0c5de8978a0285e
[ "MIT" ]
null
null
null
<?php namespace Triv\CoreBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** * vote * * @ORM\Table() * @ORM\Entity(repositoryClass="Triv\CoreBundle\Entity\VoteRepository") */ class Vote { /** * @var integer * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @var integer * * @ORM\Column(name="ref_id", type="integer") */ private $refId; /** * @var string * * @ORM\Column(name="ref", type="string", length=100) */ private $ref; /** * @var integer * * @ORM\Column(name="user_id", type="integer") */ private $userId; /** * @var integer * * @ORM\Column(name="vote", type="integer") */ private $vote; /** * @var \DateTime * * @ORM\Column(name="created_at", type="datetime") */ private $createdAt; public function __construct() { $this->createdAt = new \Datetime(); } /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set refId * * @param integer $refId * * @return vote */ public function setRefId($refId) { $this->refId = $refId; return $this; } /** * Get refId * * @return integer */ public function getRefId() { return $this->refId; } /** * Set ref * * @param string $ref * * @return vote */ public function setRef($ref) { $this->ref = $ref; return $this; } /** * Get ref * * @return string */ public function getRef() { return $this->ref; } /** * Set userId * * @param integer $userId * * @return vote */ public function setUserId($userId) { $this->userId = $userId; return $this; } /** * Get userId * * @return integer */ public function getUserId() { return $this->userId; } /** * Set vote * * @param integer $vote * * @return vote */ public function setVote($vote) { $this->vote = $vote; return $this; } /** * Get vote * * @return integer */ public function getVote() { return $this->vote; } /** * Set createdAt * * @param \DateTime $createdAt * * @return vote */ public function setCreatedAt($createdAt) { $this->createdAt = $createdAt; return $this; } /** * Get createdAt * * @return \DateTime */ public function getCreatedAt() { return $this->createdAt; } }
14.716495
71
0.463398
7f05b425144b29c4157d0ce1c880ceb304abc972
2,721
rs
Rust
compiler/crates/relay-codegen/src/ast.rs
morrys/relay
30e2a47d21bdc145270f954698aa754a5e925e55
[ "MIT" ]
1
2020-10-01T22:33:41.000Z
2020-10-01T22:33:41.000Z
compiler/crates/relay-codegen/src/ast.rs
morrys/relay
30e2a47d21bdc145270f954698aa754a5e925e55
[ "MIT" ]
10
2021-01-23T06:54:00.000Z
2022-02-27T11:08:42.000Z
compiler/crates/relay-codegen/src/ast.rs
morrys/relay
30e2a47d21bdc145270f954698aa754a5e925e55
[ "MIT" ]
1
2020-12-31T23:35:43.000Z
2020-12-31T23:35:43.000Z
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ use fnv::{FnvBuildHasher, FnvHashMap}; use graphql_syntax::FloatValue; use graphql_syntax::OperationKind; use indexmap::IndexMap; use interner::StringKey; #[derive(Eq, PartialEq, Hash, Debug)] pub struct ObjectEntry { pub key: StringKey, pub value: Primitive, } /// An interned codegen AST #[derive(Eq, PartialEq, Hash, Debug)] pub enum Ast { Object(Vec<ObjectEntry>), Array(Vec<Primitive>), } impl Ast { pub fn assert_object(&self) -> &[ObjectEntry] { match self { Ast::Object(result) => result, Ast::Array(_) => panic!("Expected an object"), } } pub fn assert_array(&self) -> &[Primitive] { match self { Ast::Object(_) => panic!("Expected an array"), Ast::Array(result) => result, } } } #[derive(Eq, PartialEq, Hash, Debug)] pub enum Primitive { Key(AstKey), String(StringKey), Float(FloatValue), Int(i64), Bool(bool), Null, StorageKey(StringKey, AstKey), RawString(String), GraphQLModuleDependency(StringKey), JSModuleDependency(StringKey), } impl Primitive { pub fn assert_string(&self) -> StringKey { if let Primitive::String(key) = self { *key } else { panic!("Expected a string"); } } pub fn assert_key(&self) -> AstKey { if let Primitive::Key(key) = self { *key } else { panic!("Expected a key"); } } pub fn string_or_null(str: Option<StringKey>) -> Primitive { match str { None => Primitive::Null, Some(str) => Primitive::String(str), } } } type Table = IndexMap<Ast, usize, FnvBuildHasher>; #[derive(Eq, PartialEq, Hash, Copy, Clone, Debug)] pub struct AstKey(usize); impl AstKey { pub fn as_usize(self) -> usize { self.0 } } #[derive(Default)] pub struct AstBuilder { table: Table, } impl AstBuilder { pub fn intern(&mut self, ast: Ast) -> AstKey { if let Some(ix) = self.table.get(&ast) { AstKey(*ix) } else { let ix = self.table.len(); self.table.insert(ast, ix); AstKey(ix) } } pub fn lookup(&self, key: AstKey) -> &Ast { self.table.get_index(key.as_usize()).unwrap().0 } } pub struct RequestParameters { pub id: Option<String>, pub metadata: FnvHashMap<String, String>, pub name: StringKey, pub operation_kind: OperationKind, pub text: Option<String>, }
22.487603
66
0.583976
9682e7377247f096f554f9be8ee1324893d39e72
1,099
php
PHP
admin/simpan_setting.php
doc22940/candycbt
dc0bd244efe55adfcd3475093bf855c8daa383b0
[ "MIT" ]
3
2020-03-31T16:44:36.000Z
2020-09-22T04:23:27.000Z
admin/simpan_setting.php
doc22940/candycbt
dc0bd244efe55adfcd3475093bf855c8daa383b0
[ "MIT" ]
5
2020-04-30T14:45:10.000Z
2022-03-02T07:23:43.000Z
admin/simpan_setting.php
doc22940/candycbt
dc0bd244efe55adfcd3475093bf855c8daa383b0
[ "MIT" ]
14
2020-03-05T08:38:34.000Z
2020-11-25T11:34:47.000Z
<?php require "../config/config.default.php"; $alamat = nl2br($_POST['alamat']); $header = nl2br($_POST['header']); $exec = mysqli_query($koneksi, "UPDATE setting SET aplikasi='$_POST[aplikasi]',sekolah='$_POST[sekolah]',kode_sekolah='$_POST[kode]',jenjang='$_POST[jenjang]',kepsek='$_POST[kepsek]',nip='$_POST[nip]',alamat='$alamat',kecamatan='$_POST[kecamatan]',kota='$_POST[kota]',telp='$_POST[telp]',fax='$_POST[fax]',web='$_POST[web]',email='$_POST[email]',header='$header',ip_server='$_POST[ipserver]',waktu='$_POST[waktu]' WHERE id_setting='1'"); if ($exec) { if ($_FILES['logo']['name'] <> '') { $logo = $_FILES['logo']['name']; $temp = $_FILES['logo']['tmp_name']; $ext = explode('.', $logo); $ext = end($ext); $dest = 'dist/img/logo' . rand(1, 100) . '.' . $ext; $upload = move_uploaded_file($temp, '../' . $dest); if ($upload) { $exec = mysqli_query($koneksi, "UPDATE setting SET logo='$dest' WHERE id_setting='1'"); } else { echo "gagal"; } } } else { echo "Gagal menyimpan"; }
45.791667
437
0.577798
1b0be02c8f3b441c49c1f26cd1429b7746f67d1b
3,223
swift
Swift
Aerial/Source/Controllers/PWC Tabs/PWC+Displays.swift
aitor/Aerial
6972c3c1418b6376dd0e9b00f89671a66522b00b
[ "MIT" ]
1
2019-08-20T14:28:03.000Z
2019-08-20T14:28:03.000Z
Aerial/Source/Controllers/PWC Tabs/PWC+Displays.swift
Ashesove/Aerial
9fb904d05d9b180ce5af0b5cb617bdf749f0e423
[ "MIT" ]
null
null
null
Aerial/Source/Controllers/PWC Tabs/PWC+Displays.swift
Ashesove/Aerial
9fb904d05d9b180ce5af0b5cb617bdf749f0e423
[ "MIT" ]
null
null
null
// // PWC+Displays.swift // Aerial // This is the controller code for the Displays Tab // // Created by Guillaume Louel on 03/06/2019. // Copyright © 2019 John Coates. All rights reserved. // import Cocoa extension PreferencesWindowController { func setupDisplaysTab() { horizontalDisplayMarginTextfield.doubleValue = preferences.horizontalMargin! verticalDisplayMarginTextfield.doubleValue = preferences.verticalMargin! if preferences.newViewingMode == Preferences.NewViewingMode.spanned.rawValue { displayMarginBox.isHidden = false } else { displayMarginBox.isHidden = true } // Displays Tab newDisplayModePopup.selectItem(at: preferences.newDisplayMode!) newViewingModePopup.selectItem(at: preferences.newViewingMode!) aspectModePopup.selectItem(at: preferences.aspectMode!) if preferences.newDisplayMode == Preferences.NewDisplayMode.selection.rawValue { displayInstructionLabel.isHidden = false } } @IBAction func newDisplayModeClick(_ sender: NSPopUpButton) { debugLog("UI newDisplayModeClick: \(sender.indexOfSelectedItem)") preferences.newDisplayMode = sender.indexOfSelectedItem if preferences.newDisplayMode == Preferences.NewDisplayMode.selection.rawValue { displayInstructionLabel.isHidden = false } else { displayInstructionLabel.isHidden = true } displayView.needsDisplay = true } @IBAction func newViewingModeClick(_ sender: NSPopUpButton) { debugLog("UI newViewingModeClick: \(sender.indexOfSelectedItem)") preferences.newViewingMode = sender.indexOfSelectedItem let displayDetection = DisplayDetection.sharedInstance displayDetection.detectDisplays() // Force redetection to update our margin calculations in spanned mode displayView.needsDisplay = true if preferences.newViewingMode == Preferences.NewViewingMode.spanned.rawValue { displayMarginBox.isHidden = false } else { displayMarginBox.isHidden = true } } @IBAction func aspectModePopupClick(_ sender: NSPopUpButton) { debugLog("UI aspectModeClick: \(sender.indexOfSelectedItem)") preferences.aspectMode = sender.indexOfSelectedItem } @IBAction func horizontalDisplayMarginChange(_ sender: NSTextField) { debugLog("UI horizontalDisplayMarginChange \(sender.stringValue)") preferences.horizontalMargin = sender.doubleValue let displayDetection = DisplayDetection.sharedInstance displayDetection.detectDisplays() // Force redetection to update our margin calculations in spanned mode displayView.needsDisplay = true } @IBAction func verticalDisplayMarginChange(_ sender: NSTextField) { debugLog("UI verticalDisplayMarginChange \(sender.stringValue)") preferences.verticalMargin = sender.doubleValue let displayDetection = DisplayDetection.sharedInstance displayDetection.detectDisplays() // Force redetection to update our margin calculations in spanned mode displayView.needsDisplay = true } }
39.790123
114
0.714552
1651b50cd0979bac7ba807341902b9f97bbc0027
102
h
C
fw/nav/pose.h
Octanis1/Octanis1-Mainboard-Firmware
71963910e4b835c060a05123e39c4fa4ec40fc22
[ "MIT" ]
null
null
null
fw/nav/pose.h
Octanis1/Octanis1-Mainboard-Firmware
71963910e4b835c060a05123e39c4fa4ec40fc22
[ "MIT" ]
null
null
null
fw/nav/pose.h
Octanis1/Octanis1-Mainboard-Firmware
71963910e4b835c060a05123e39c4fa4ec40fc22
[ "MIT" ]
null
null
null
/* * File: pose.h * Description: Manupulators for rover body pose (mostly struts) * Author: */
17
65
0.647059
92373f48e7117366209d47fc3d4354f8dd0907b2
3,396
sql
SQL
AdventureWorksDW-MySQL-install-script/adventureworksDW-constraints.sql
d-stephenson/PRJ701
92bd55a024140ccba2ecb659e1566baa094a7c74
[ "MIT" ]
1
2021-09-23T09:20:24.000Z
2021-09-23T09:20:24.000Z
AdventureWorksDW-MySQL-install-script/adventureworksDW-constraints.sql
d-stephenson/PRJ701
92bd55a024140ccba2ecb659e1566baa094a7c74
[ "MIT" ]
null
null
null
AdventureWorksDW-MySQL-install-script/adventureworksDW-constraints.sql
d-stephenson/PRJ701
92bd55a024140ccba2ecb659e1566baa094a7c74
[ "MIT" ]
null
null
null
use aw; ALTER TABLE DimAccount ADD CONSTRAINT FK_DimAccount_DimAccount FOREIGN KEY(ParentAccountKey) REFERENCES DimAccount (AccountKey) ; ALTER TABLE DimCustomer ADD CONSTRAINT FK_DimCustomer_DimGeography FOREIGN KEY(GeographyKey) REFERENCES DimGeography (GeographyKey) ; ALTER TABLE DimDepartmentGroup ADD CONSTRAINT FK_DimDeptGroup_DimDeptGroup FOREIGN KEY(ParentDepartmentGroupKey) REFERENCES DimDepartmentGroup (DepartmentGroupKey) ; ALTER TABLE DimEmployee ADD CONSTRAINT FK_DimEmployee_DimEmployee FOREIGN KEY(ParentEmployeeKey) REFERENCES DimEmployee (EmployeeKey) ; ALTER TABLE DimEmployee ADD CONSTRAINT FK_DimEmployee_DimSalesTerr FOREIGN KEY(SalesTerritoryKey) REFERENCES DimSalesTerritory (SalesTerritoryKey) ; ALTER TABLE DimGeography ADD CONSTRAINT FK_DimGeography_DimSalesTerr FOREIGN KEY(SalesTerritoryKey) REFERENCES DimSalesTerritory (SalesTerritoryKey) ; ALTER TABLE DimOrganization ADD CONSTRAINT FK_DimOrg_DimCurrency FOREIGN KEY(CurrencyKey) REFERENCES DimCurrency (CurrencyKey) ; ALTER TABLE DimOrganization ADD CONSTRAINT FK_DimOrg_DimOrg FOREIGN KEY(ParentOrganizationKey) REFERENCES DimOrganization (OrganizationKey) ; ALTER TABLE DimProduct ADD CONSTRAINT FK_DimProduct_DimProductSubcat FOREIGN KEY(ProductSubcategoryKey) REFERENCES DimProductSubcategory (ProductSubcategoryKey) ; ALTER TABLE DimProductSubcategory ADD CONSTRAINT FK_DimProdSubcat_DimProdCat FOREIGN KEY(ProductCategoryKey) REFERENCES DimProductCategory (ProductCategoryKey) ; ALTER TABLE DimReseller ADD CONSTRAINT FK_DimReseller_DimGeo FOREIGN KEY(GeographyKey) REFERENCES DimGeography (GeographyKey) ; ALTER TABLE FactCurrencyRate ADD CONSTRAINT FK_FactCurrRate_DimCurr FOREIGN KEY(CurrencyKey) REFERENCES DimCurrency (CurrencyKey) ; ALTER TABLE FactCurrencyRate ADD CONSTRAINT FK_FactCurrRate_DimTime FOREIGN KEY(TimeKey) REFERENCES DimTime (TimeKey) ; ALTER TABLE FactFinance ADD CONSTRAINT FK_FactFinance_DimAccount FOREIGN KEY(AccountKey) REFERENCES DimAccount (AccountKey) ; ALTER TABLE FactFinance ADD CONSTRAINT FK_FactFinance_DimDeptGroup FOREIGN KEY(DepartmentGroupKey) REFERENCES DimDepartmentGroup (DepartmentGroupKey) ; ALTER TABLE FactFinance ADD CONSTRAINT FK_FactFinance_DimOrg FOREIGN KEY(OrganizationKey) REFERENCES DimOrganization (OrganizationKey) ; ALTER TABLE FactFinance ADD CONSTRAINT FK_FactFinance_DimScenario FOREIGN KEY(ScenarioKey) REFERENCES DimScenario (ScenarioKey) ; ALTER TABLE FactFinance ADD CONSTRAINT FK_FactFinance_DimTime FOREIGN KEY(TimeKey) REFERENCES DimTime (TimeKey) ; ALTER TABLE FactInternetSales ADD CONSTRAINT FK_FactInternetSales_DimCurr FOREIGN KEY(CurrencyKey) REFERENCES DimCurrency (CurrencyKey) ; ALTER TABLE FactInternetSales ADD CONSTRAINT FK_FactInternetSales_DimCust FOREIGN KEY(CustomerKey) REFERENCES DimCustomer (CustomerKey) ; ALTER TABLE FactInternetSales ADD CONSTRAINT FK_FactInternetSales_DimProd FOREIGN KEY(ProductKey) REFERENCES DimProduct (ProductKey) ; ALTER TABLE FactInternetSales ADD CONSTRAINT FK_FactInternetSales_DimPromo FOREIGN KEY(PromotionKey) REFERENCES DimPromotion (PromotionKey) ; ALTER TABLE FactInternetSales ADD CONSTRAINT FK_FactNetSales_DimSalesTerr FOREIGN KEY(SalesTerritoryKey) REFERENCES DimSalesTerritory (SalesTerritoryKey) ; ALTER TABLE FactInternetSales ADD CONSTRAINT FK_FactInternetSales_DimTime FOREIGN KEY(OrderDateKey) REFERENCES DimTime (TimeKey) ;
35.010309
113
0.865135
575a6e3b42f69920214c5530915e7222566e81a5
1,327
c
C
src/gbpLib/gbpCalc/calc_mean.c
gbpoole/gbpCode
5157d2e377edbd4806258d1c16b329373186d43a
[ "MIT" ]
1
2015-10-20T11:39:53.000Z
2015-10-20T11:39:53.000Z
src/gbpLib/gbpCalc/calc_mean.c
gbpoole/gbpCode
5157d2e377edbd4806258d1c16b329373186d43a
[ "MIT" ]
2
2017-07-30T11:10:49.000Z
2019-06-18T00:40:46.000Z
src/gbpLib/gbpCalc/calc_mean.c
gbpoole/gbpCode
5157d2e377edbd4806258d1c16b329373186d43a
[ "MIT" ]
4
2015-01-23T00:50:40.000Z
2016-08-01T08:14:24.000Z
#include <gbpSID.h> #include <gbpCalc.h> void calc_mean(void *data, void *result, size_t n_data, SID_Datatype type, int mode) { double temp; int flag_abs; if(SID_CHECK_BITFIELD_SWITCH(mode, CALC_MODE_ABS)) flag_abs = CALC_MODE_ABS; else flag_abs = GBP_FALSE; if(n_data < 1) { if(type == SID_DOUBLE || SID_CHECK_BITFIELD_SWITCH(mode, CALC_MODE_RETURN_DOUBLE)) ((double *)result)[0] = 0.; else if(type == SID_FLOAT) ((float *)result)[0] = 0.; else if(type == SID_INT) ((int *)result)[0] = 0; else if(type == SID_UNSIGNED) ((unsigned int *)result)[0] = 0; else if(type == SID_SIZE_T) ((size_t *)result)[0] = 0; else SID_exit_error("Unknown variable type in calc_min", SID_ERROR_LOGIC); } else { calc_sum(data, &temp, n_data, type, CALC_MODE_RETURN_DOUBLE | flag_abs); temp /= (double)n_data; if(type == SID_DOUBLE) ((double *)result)[0] = (double)temp; else if(type == SID_FLOAT) ((float *)result)[0] = (float)temp; else if(type == SID_UNSIGNED) ((unsigned int *)result)[0] = (unsigned int)temp; else if(type == SID_SIZE_T) ((size_t *)result)[0] = (size_t)temp; } }
35.864865
90
0.560663
4c2a491806ba025da2edbd79228422bd11980d01
4,203
php
PHP
node_modules/elation/components/elation/components/orm/elation_orm.php
aadityavaze/janusweb-prac
17ffd59d9c2f2b43dfa7a0fd2d077590f6d7dabe
[ "MIT" ]
null
null
null
node_modules/elation/components/elation/components/orm/elation_orm.php
aadityavaze/janusweb-prac
17ffd59d9c2f2b43dfa7a0fd2d077590f6d7dabe
[ "MIT" ]
null
null
null
node_modules/elation/components/elation/components/orm/elation_orm.php
aadityavaze/janusweb-prac
17ffd59d9c2f2b43dfa7a0fd2d077590f6d7dabe
[ "MIT" ]
null
null
null
<?php include_once("include/component_class.php"); include_once("include/ormmanager_class.php"); class Component_elation_orm extends Component { function controller_orm($args) { /* if (!User::authorized("orm")) throw new Exception("not allowed"); */ /* $user = User::singleton(); if (!($user->isLoggedIn() && $user->HasRole("ORM"))) // display the access violation message $vars->SetTemplate("access_violation.tpl"); */ if (!empty($args["ormaction"]) && !empty($args["model"])) { $vars["model"] = $args["model"]; $vars["ormcfg"] = new OrmModel($args["model"]); if ($args["ormaction"] == "create" && !empty($args["classname"])) { $ormclass = new OrmClass($vars["ormcfg"]->classes->{$args["classname"]}); //$sql = $ormclass->getCreateSql(); $sqlkey = "db." . $args["model"] . "." . $ormclass->table . ".create:nocache"; /* $outlet = Outlet::getInstance(); $pdo = $outlet->getConnection()->getPDO(); if ($pdo) { $vars["sql"] = $ormclass->getCreateSQL(); try { $pdo->query($vars["sql"]); $vars["success"] = "Table '{$ormclass->table}' created successfully"; } catch(Exception $e) { $vars["error"] = $e->getMessage(); } } */ try { if (DataManager::create($sqlkey, $ormclass->table, $ormclass->getColumns())) { $ret["success"] = "Table '{$ormclass->table}' created successfully"; } } catch(Exception $e) { $ret["error"] = $e->getMessage(); } } } return $this->GetComponentResponse("./orm.tpl", $vars); } function controller_models($args) { /* $user = User::singleton(); if (!($user->isLoggedIn() && $user->HasRole("ORM"))) // display the access violation message $ret->SetTemplate("access_violation.tpl"); */ $orm = OrmManager::singleton(); $vars["models"] = $orm->getModels(); $vars["model"] = $args["model"]; return $this->GetComponentResponse("./orm_models.tpl", $vars); } function controller_view($args) { $vars["ormcfg"] = $args["ormcfg"]; $vars["model"] = any($args["model"], ""); return $this->GetComponentResponse("./orm_view.tpl", $vars); } function controller_view_class($args) { $vars["ormclass"] = new OrmClass($args["ormcfg"]); $vars["classname"] = $args["classname"]; $vars["model"] = any($args["model"], ""); $vars["classname"] = any($args["classname"], ""); $vars["sql"] = $vars["ormclass"]->getCreateSQL(); return $this->GetComponentResponse("./orm_view_class.tpl", $vars); } function controller_generate($args, $output="text") { // Only return this data when run from the commandline if ($output == "commandline") { $ret = "[not found]"; if (!empty($args["model"])) { $data = DataManager::singleton(); $model = new ORMModel($args["model"]); $ret = $model->Generate(); } } else { $ret = ""; } return $ret; } function controller_thrift($args) { $vars["objects"] = array( "product" => array( array("type" => "i64", "name" => "ddkey"), array("type" => "string", "name" => ""), array("type" => "string", "name" => "ddkey"), array("type" => "string", "name" => "ddkey"), array("type" => "i64", "name" => "ddkey"), ) ); return $this->GetComponentResponse("./thrift.tpl", $vars); } function controller_model($args) { $vars["model"] = any($args["model"], "space"); $models = explode(",", $vars["model"]); $vars["classes"] = array(); foreach ($models as $i=>$model) { $foo = OrmManager::LoadModel($model); foreach ($foo[$model]->classes as $k=>$v) { $vars["classes"][$k] = $v; } } return $this->GetComponentResponse("./model.tpl", $vars); } function controller_class($args) { $vars["classname"] = any($args["classname"], "unnamed"); $vars["classdef"] = any($args["classdef"], array()); return $this->GetComponentResponse("./class.tpl", $vars); } function controller_test($args) { $foo = OrmManager::create(); } }
34.170732
96
0.551273
f99998b63e26a5580f21527f7c9f69fdfc0054db
1,126
go
Go
lib/crypto/zone/algorithms.go
markkurossi/backup
4f831cf6111a469ee550251901aaf9086710d44b
[ "MIT" ]
null
null
null
lib/crypto/zone/algorithms.go
markkurossi/backup
4f831cf6111a469ee550251901aaf9086710d44b
[ "MIT" ]
null
null
null
lib/crypto/zone/algorithms.go
markkurossi/backup
4f831cf6111a469ee550251901aaf9086710d44b
[ "MIT" ]
null
null
null
// // algorithms.go // // Copyright (c) 2018 Markku Rossi // // All rights reserved. // package zone import ( "fmt" ) type Suite byte func (s Suite) String() string { name, ok := suites[s] if ok { return name } return fmt.Sprintf("{Suite %d}", s) } func (s Suite) IDHashKeyLen() int { len, ok := suiteIDHashKeyLengths[s] if !ok { panic(fmt.Sprintf("Unknown suite: %d", s)) } return len } func (s Suite) CipherKeyLen() int { len, ok := suiteCipherKeyLengths[s] if !ok { panic(fmt.Sprintf("Unknown suite: %d", s)) } return len } func (s Suite) HMACKeyLen() int { len, ok := suiteHMACKeyLengths[s] if !ok { panic(fmt.Sprintf("Unknown suite: %d", s)) } return len } func (s Suite) KeyLen() int { return s.IDHashKeyLen() + s.CipherKeyLen() + s.HMACKeyLen() } const ( AES256CBCHMACSHA256 Suite = 0 ) var suites = map[Suite]string{ AES256CBCHMACSHA256: "AES256-CBC-HMAC-SHA256", } var suiteIDHashKeyLengths = map[Suite]int{ AES256CBCHMACSHA256: 32, } var suiteCipherKeyLengths = map[Suite]int{ AES256CBCHMACSHA256: 32, } var suiteHMACKeyLengths = map[Suite]int{ AES256CBCHMACSHA256: 32, }
15.638889
60
0.671403
029489b5d87f4aeb3e288308c4d191601c9274d6
857
kt
Kotlin
backend/mlreef-rest/src/main/kotlin/com/mlreef/rest/external_api/gitlab/dto/GitlabUserInProject.kt
MLReef/mlreef
ec90e000fecde04a8256b0400fe40bc81ebb6f04
[ "MIT" ]
1,607
2020-08-31T18:15:51.000Z
2022-03-18T09:13:21.000Z
backend/mlreef-rest/src/main/kotlin/com/mlreef/rest/external_api/gitlab/dto/GitlabUserInProject.kt
Bronmus/mlreef
4063f937f2f65e87ee24174b2ac89dac5c255854
[ "MIT" ]
9
2021-07-13T11:10:05.000Z
2022-01-12T16:48:54.000Z
backend/mlreef-rest/src/main/kotlin/com/mlreef/rest/external_api/gitlab/dto/GitlabUserInProject.kt
Bronmus/mlreef
4063f937f2f65e87ee24174b2ac89dac5c255854
[ "MIT" ]
318
2020-11-04T05:33:18.000Z
2022-03-04T10:05:25.000Z
package com.mlreef.rest.external_api.gitlab.dto import com.fasterxml.jackson.annotation.JsonAutoDetect import com.fasterxml.jackson.annotation.JsonIgnoreProperties import com.fasterxml.jackson.annotation.JsonInclude import com.mlreef.rest.external_api.gitlab.GitlabAccessLevel import com.mlreef.rest.external_api.gitlab.GitlabActivityState import java.io.Serializable @JsonIgnoreProperties(ignoreUnknown = true) @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) @JsonInclude(JsonInclude.Include.NON_NULL) class GitlabUserInProject( val id: Long, val webUrl: String, val name: String, val username: String, val state: GitlabActivityState = GitlabActivityState.ACTIVE, val avatarUrl: String = "", val accessLevel: GitlabAccessLevel = GitlabAccessLevel.DEVELOPER, val expiresAt: String? = null ) : Serializable
37.26087
69
0.809802
7754fee1b7ce65df549e5a45252e9801be5ae2c8
635
html
HTML
src/STAIExtensions/Example Projects/Examples.Client.Angular/src/app/shared/augmented-card/augmented-card.component.html
TrevorMare/STAIExtensions
e5454b6f7d3138479fa159fcfc9474bed76157f8
[ "MIT" ]
null
null
null
src/STAIExtensions/Example Projects/Examples.Client.Angular/src/app/shared/augmented-card/augmented-card.component.html
TrevorMare/STAIExtensions
e5454b6f7d3138479fa159fcfc9474bed76157f8
[ "MIT" ]
5
2022-01-22T06:56:34.000Z
2022-02-21T13:51:54.000Z
src/STAIExtensions/Example Projects/Examples.Client.Angular/src/app/shared/augmented-card/augmented-card.component.html
TrevorMare/STAIExtensions
e5454b6f7d3138479fa159fcfc9474bed76157f8
[ "MIT" ]
null
null
null
<div class="augmented-glow " [ngClass]="{'selected': selected}" > <div class="augmented-card {{ cardClass }}" [attr.data-augmented-ui]="GetBorderStyle()" [ngClass]="{'color2': colorStyle == 2, 'color3': colorStyle == 3, 'show-over': showOver}"> <div class="augmented-card-header"> <ng-content select="[aug-card-header]"></ng-content> </div> <div class="augmented-card-body"> <ng-content select="[aug-card-body]"></ng-content> </div> <div class="augmented-card-footer"> <ng-content select="[aug-card-footer]"></ng-content> </div> </div> </div>
45.357143
182
0.577953
b397f882e59b13378a096b626cdc1790c4d99f74
7,206
swift
Swift
BitcoinCore/Classes/Network/Peer/PeerGroup.swift
baboaisystem/lib_bitcoin_swift
e7feecdfe9e413426e7afba4c692c21f97acec6e
[ "MIT" ]
203
2018-11-02T08:32:06.000Z
2022-03-28T06:43:27.000Z
BitcoinCore/Classes/Network/Peer/PeerGroup.swift
baboaisystem/lib_bitcoin_swift
e7feecdfe9e413426e7afba4c692c21f97acec6e
[ "MIT" ]
198
2018-10-17T12:00:39.000Z
2022-03-31T17:53:20.000Z
BitcoinCore/Classes/Network/Peer/PeerGroup.swift
baboaisystem/lib_bitcoin_swift
e7feecdfe9e413426e7afba4c692c21f97acec6e
[ "MIT" ]
71
2018-12-10T05:44:33.000Z
2022-03-01T02:07:06.000Z
import Foundation import RxSwift import HsToolKit import NIO public enum PeerGroupEvent { case onStart case onStop case onPeerCreate(peer: IPeer) case onPeerConnect(peer: IPeer) case onPeerDisconnect(peer: IPeer, error: Error?) case onPeerReady(peer: IPeer) case onPeerBusy(peer: IPeer) } class PeerGroup { private static let acceptableBlockHeightDifference = 50_000 private static let peerCountToConnect = 100 private let factory: IFactory private let reachabilityManager: IReachabilityManager private var peerAddressManager: IPeerAddressManager private var peerManager: IPeerManager private let localDownloadedBestBlockHeight: Int32 private let peerCountToHold: Int // number of peers held private var peerCountToConnect: Int? // number of peers to connect to private var peerCountConnected = 0 // number of peers connected to private var started: Bool = false private let peersQueue: DispatchQueue private let inventoryQueue: DispatchQueue private let subjectQueue: DispatchQueue private var eventLoopGroup: MultiThreadedEventLoopGroup private let logger: Logger? weak var inventoryItemsHandler: IInventoryItemsHandler? = nil weak var peerTaskHandler: IPeerTaskHandler? = nil private let subject = PublishSubject<PeerGroupEvent>() let observable: Observable<PeerGroupEvent> init(factory: IFactory, reachabilityManager: IReachabilityManager, peerAddressManager: IPeerAddressManager, peerCount: Int = 10, localDownloadedBestBlockHeight: Int32, peerManager: IPeerManager, peersQueue: DispatchQueue = DispatchQueue(label: "io.horizontalsystems.bitcoin-core.peer-group.peers", qos: .userInitiated), inventoryQueue: DispatchQueue = DispatchQueue(label: "io.horizontalsystems.bitcoin-core.peer-group.inventory", qos: .background), subjectQueue: DispatchQueue = DispatchQueue(label: "io.horizontalsystems.bitcoin-core.peer-group.subject", qos: .background), scheduler: SchedulerType = SerialDispatchQueueScheduler(qos: .background), logger: Logger? = nil) { self.factory = factory self.reachabilityManager = reachabilityManager self.peerAddressManager = peerAddressManager self.localDownloadedBestBlockHeight = localDownloadedBestBlockHeight self.peerCountToHold = peerCount self.peerManager = peerManager self.peersQueue = peersQueue self.inventoryQueue = inventoryQueue self.subjectQueue = subjectQueue self.eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: peerCount) self.logger = logger self.observable = subject.asObservable().observeOn(scheduler) self.peerAddressManager.delegate = self } deinit { eventLoopGroup.shutdownGracefully { _ in } } private func connectPeersIfRequired() { peersQueue.async { guard self.started, self.reachabilityManager.isReachable else { return } var peersToConnect = [IPeer]() for _ in self.peerManager.totalPeersCount..<self.peerCountToHold { if let host = self.peerAddressManager.ip { let peer = self.factory.peer(withHost: host, eventLoopGroup: self.eventLoopGroup, logger: self.logger) peer.delegate = self peersToConnect.append(peer) } else { break } } for peer in peersToConnect { self.peerCountConnected += 1 self.onNext(.onPeerCreate(peer: peer)) self.peerManager.add(peer: peer) peer.connect() } } } private func onNext(_ event: PeerGroupEvent) { subjectQueue.async { self.subject.onNext(event) } } } extension PeerGroup: IPeerGroup { func start() { guard started == false else { return } started = true peerCountConnected = 0 onNext(.onStart) connectPeersIfRequired() } func stop() { started = false peerManager.disconnectAll() onNext(.onStop) } func reconnectPeers() { peerManager.disconnectAll() } func isReady(peer: IPeer) -> Bool { peer.ready } } extension PeerGroup: PeerDelegate { func peerReady(_ peer: IPeer) { onNext(.onPeerReady(peer: peer)) } func peerBusy(_ peer: IPeer) { onNext(.onPeerBusy(peer: peer)) } func peerDidConnect(_ peer: IPeer) { peerAddressManager.markConnected(peer: peer) onNext(.onPeerConnect(peer: peer)) if let peerCountToConnect = peerCountToConnect { disconnectSlowestPeer(peerCountToConnect: peerCountToConnect) } else { setPeerCountToConnect(for: peer) } } private func setPeerCountToConnect(for peer: IPeer) { if peer.announcedLastBlockHeight - localDownloadedBestBlockHeight > PeerGroup.acceptableBlockHeightDifference { peerCountToConnect = PeerGroup.peerCountToConnect } else { peerCountToConnect = 0 } } private func disconnectSlowestPeer(peerCountToConnect: Int) { if peerCountToConnect > peerCountConnected && peerCountToHold > 1 && peerAddressManager.hasFreshIps { let sortedPeers = peerManager.sorted if sortedPeers.count >= peerCountToHold { sortedPeers.last?.disconnect(error: nil) } } } func peerDidDisconnect(_ peer: IPeer, withError error: Error?) { peersQueue.async { self.peerManager.peerDisconnected(peer: peer) } if let error = error { logger?.warning("Peer \(peer.logName)(\(peer.host)) disconnected. Network reachable: \(reachabilityManager.isReachable). Error: \(error)") } if reachabilityManager.isReachable && error != nil { peerAddressManager.markFailed(ip: peer.host) } else { peerAddressManager.markSuccess(ip: peer.host) } onNext(.onPeerDisconnect(peer: peer, error: error)) connectPeersIfRequired() } func peer(_ peer: IPeer, didCompleteTask task: PeerTask) { _ = peerTaskHandler?.handleCompletedTask(peer: peer, task: task) } func peer(_ peer: IPeer, didReceiveMessage message: IMessage) { switch message { case let addressMessage as AddressMessage: let addresses = addressMessage.addressList .filter { $0.supportsBloomFilter() } .map { $0.address } peerAddressManager.add(ips: addresses) case let inventoryMessage as InventoryMessage: inventoryQueue.async { self.inventoryItemsHandler?.handleInventoryItems(peer: peer, inventoryItems: inventoryMessage.inventoryItems) } default: () } } } extension PeerGroup: IPeerAddressManagerDelegate { func newIpsAdded() { connectPeersIfRequired() } }
31.605263
160
0.650014
65c9bbf5fb12e20a5bc145a9b60abf4bad59fe6e
134
sql
SQL
C# DB Fundamentals/Databases Basics - MS SQL Server/Data Definition and Data Types - Exercise/17. Backup Database.sql
DanielBankov/SoftUni
378b55e249cdaa9570b101238c289cf0102ba946
[ "MIT" ]
null
null
null
C# DB Fundamentals/Databases Basics - MS SQL Server/Data Definition and Data Types - Exercise/17. Backup Database.sql
DanielBankov/SoftUni
378b55e249cdaa9570b101238c289cf0102ba946
[ "MIT" ]
null
null
null
C# DB Fundamentals/Databases Basics - MS SQL Server/Data Definition and Data Types - Exercise/17. Backup Database.sql
DanielBankov/SoftUni
378b55e249cdaa9570b101238c289cf0102ba946
[ "MIT" ]
null
null
null
BACKUP DATABASE SoftUni TO DISK = 'D:\SoftUni\SoftUniBackUp.bak' RESTORE DATABASE SoftUni FROM DISK = 'D:\SoftUni\SoftUniBackUp.bak'
26.8
42
0.783582
0bdf92592c1802c1e77430f512d75bb85dfef702
286
js
JavaScript
keys.js
dianachriswhite/node
cdafcc9441ea0c28be4a9c4a7c8de2cf56112f9a
[ "MIT" ]
null
null
null
keys.js
dianachriswhite/node
cdafcc9441ea0c28be4a9c4a7c8de2cf56112f9a
[ "MIT" ]
null
null
null
keys.js
dianachriswhite/node
cdafcc9441ea0c28be4a9c4a7c8de2cf56112f9a
[ "MIT" ]
null
null
null
exports.twitterKeys = { consumer_key: 'n0F8QMNK0aGqGl4OcUTNIRYtM', consumer_secret: 'whwqdvbqbL7aBEnKXoUJZdDgx6Dif5FvMw4sim72Rl9uk17XNW', access_token_key: '940392819553742848-uA0ps65BiLYU7dyYKvUsDZCcai9iNIc', access_token_secret: 'IXVEcRxAa7GSSckxVc6w30UxUt6DhnR9xBhM8463QBk30', }
26
71
0.870629
7425f53689a13b6db7df6f1b0e1a62ed877649b2
872
h
C
q.h
jcavalieri8619/XINU_emulation
efd9d2632f3993356dd0007646f8e50411677198
[ "MIT" ]
null
null
null
q.h
jcavalieri8619/XINU_emulation
efd9d2632f3993356dd0007646f8e50411677198
[ "MIT" ]
null
null
null
q.h
jcavalieri8619/XINU_emulation
efd9d2632f3993356dd0007646f8e50411677198
[ "MIT" ]
null
null
null
/* q.h - firstid, firstkey, isempty, lastkey, nonempty */ /* q structure declarations, constants, and inline procedures */ #ifndef _Q_H #define _Q_H #ifndef NQENT #define NQENT NPROC + NSEM + NSEM + 4 /* for ready & sleep */ #endif struct qent { /* one for each process plus two for */ /* each list */ int qkey; /* key on which the queue is ordered */ short qnext; /* pointer to next process or tail */ short qprev; /* pointer to previous process or head */ }; extern struct qent q[]; extern int nextqueue; /* inline list manipulation procedures */ #define isempty(list) (q[(list)].qnext >= NPROC) #define nonempty(list) (q[(list)].qnext < NPROC) #define firstkey(list) (q[q[(list)].qnext].qkey) #define lastkey(tail) (q[q[(tail)].qprev].qkey) #define firstid(list) (q[(list)].qnext) #define EMPTY -1 /* equivalent of null pointer */ #endif
26.424242
65
0.667431
b6a31435f12aae6a664648f7c030945e358ff878
510
rake
Ruby
lib/tasks/change_person_family_member_linkage.rake
bgalloway1/enroll
e69c5af25278dfae17bc3db701e45f4bc9c4c7e1
[ "Unlicense", "MIT" ]
43
2015-03-08T18:35:47.000Z
2020-10-07T18:23:49.000Z
lib/tasks/change_person_family_member_linkage.rake
bgalloway1/enroll
e69c5af25278dfae17bc3db701e45f4bc9c4c7e1
[ "Unlicense", "MIT" ]
911
2015-03-18T13:31:04.000Z
2021-02-25T20:43:22.000Z
lib/tasks/change_person_family_member_linkage.rake
lisyk/enroll-copy-my
8cf50e9e39a72977ef9002331bea3711e6ac3176
[ "MIT", "Unlicense" ]
55
2015-03-06T14:20:53.000Z
2020-10-27T20:43:04.000Z
require File.join(Rails.root, "app", "data_migrations", "change_person_family_member_linkage") # This rake task is to change the linkage between a person and a family member. # RAILS_ENV=production bundle exec rake migrations:change_person_family_member_linkage hbx_id='person hbx id' family_member_id='mongo id of the family member' namespace :migrations do desc "changing person family member linkage" ChangePersonFamilyMemberLinkage.define_task :change_person_family_member_linkage => :environment end
63.75
158
0.829412
4da1c02444109d2d54809e0c829057a1aa439a53
1,213
html
HTML
templates/index.html
CDInstitute/cdinstitute.github.io
a5cb7105cb9886ab0241fc156da33b83c53fc4d5
[ "MIT" ]
5
2020-02-22T20:15:33.000Z
2021-04-25T14:50:08.000Z
templates/index.html
CDInstitute/cdinstitute.github.io
a5cb7105cb9886ab0241fc156da33b83c53fc4d5
[ "MIT" ]
4
2020-02-22T20:27:15.000Z
2020-02-24T14:10:56.000Z
templates/index.html
CDInstitute/cdinstitute.github.io
a5cb7105cb9886ab0241fc156da33b83c53fc4d5
[ "MIT" ]
1
2020-10-27T23:15:05.000Z
2020-10-27T23:15:05.000Z
<!DOCTYPE html> <html> <head> <title>CDI</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- add icon link --> <link rel = "icon" href = "https://media.geeksforgeeks.org/wp-content/cdn-uploads/gfg_200X200.png" type = "image/x-icon"> <link rel = "stylesheet" href = "styles.css"> </head> <body> <p class = "screen-only">Computational Design Institute </p> This is the place for passionate about computational design in many different fields: <div> <ul> <li>Architecture Engineering and Construction</li> <li>Bio-Informatics</li> <li>Computer Science</li> <li>Design and Fashion</li> <li>Game Development</li> <li>Mathematic and Statistic</li> <li>Quantum Computing</li> <li>...</li> </ul> </div> <h1>Hackathons</h1> <a href="hackathons.html">Hackathons</a> <h1>About</h1> <h3>Board Members</h3> <a href="board.html">Board of Directors</a> <h1>Example</h1> <a href="example.html">Example</a> </body> </html>
34.657143
131
0.544106
11a22bba3ce76a41a9f77d7fdd765257641882c1
468
swift
Swift
Sources/SwiftDocC/Semantics/Redirected.swift
talzag/swift-docc
41f116f72cd3cf6392c2f82d7b72ed3c5ccb735a
[ "Apache-2.0" ]
335
2021-10-13T20:23:45.000Z
2022-03-28T05:22:03.000Z
Sources/SwiftDocC/Semantics/Redirected.swift
talzag/swift-docc
41f116f72cd3cf6392c2f82d7b72ed3c5ccb735a
[ "Apache-2.0" ]
106
2021-10-15T09:20:50.000Z
2022-03-31T23:59:10.000Z
Sources/SwiftDocC/Semantics/Redirected.swift
talzag/swift-docc
41f116f72cd3cf6392c2f82d7b72ed3c5ccb735a
[ "Apache-2.0" ]
45
2021-10-14T02:22:06.000Z
2022-03-29T23:10:27.000Z
/* This source file is part of the Swift.org open source project Copyright (c) 2021 Apple Inc. and the Swift project authors Licensed under Apache License v2.0 with Runtime Library Exception See https://swift.org/LICENSE.txt for license information See https://swift.org/CONTRIBUTORS.txt for Swift project authors */ protocol Redirected { /** The redirects; listing the previous URLs for this element. */ var redirects: [Redirect]? { get } }
27.529412
66
0.730769
46462e4b0015662ee29089a9fa52d429d2a87c1f
10,494
swift
Swift
InstantGramz/ProfileViewController.swift
oliviaeg2/instantgramz
0d05f16d32288bcb74fdf87ffe4a976b89642675
[ "Apache-2.0" ]
null
null
null
InstantGramz/ProfileViewController.swift
oliviaeg2/instantgramz
0d05f16d32288bcb74fdf87ffe4a976b89642675
[ "Apache-2.0" ]
1
2016-06-25T03:10:15.000Z
2016-06-26T01:00:17.000Z
InstantGramz/ProfileViewController.swift
ohliveyeah/instagram
0d05f16d32288bcb74fdf87ffe4a976b89642675
[ "Apache-2.0" ]
null
null
null
// // ProfileViewController.swift // InstantGramz // // Created by Olivia Gregory on 6/22/16. // Copyright © 2016 Olivia Gregory. All rights reserved. // import UIKit import Parse import ParseUI class ProfileViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate { @IBOutlet weak var collectionView: UICollectionView! @IBOutlet weak var userLabel: UILabel! @IBOutlet weak var profilePicture: PFImageView! @IBOutlet weak var bioLabel: UILabel! @IBOutlet weak var postsLabel: UILabel! @IBOutlet weak var taggedCollectionView: UICollectionView! @IBOutlet weak var myPostsButton: UIButton! @IBOutlet weak var tagsButton: UIButton! var isMoreDataLoading = false var taggedPost: [PFObject] = [] var userPosts: [PFObject] = [] override func viewDidLoad() { super.viewDidLoad() myPostsButton.hidden = true let currentUser = PFUser.currentUser()!.username userLabel.text = "\(currentUser!)'s Gramz" var bio = PFUser.currentUser()!["bio"] if let bio = bio { bioLabel.text = (bio as! String) } else { bioLabel.text = "" } taggedCollectionView.dataSource = self taggedCollectionView.delegate = self taggedCollectionView.hidden = true collectionView.dataSource = self collectionView.delegate = self // // NSTimer.scheduledTimerWithTimeInterval(2, target: self, selector: #selector(ProfileViewController.onTimer), userInfo: nil, repeats: true) self.profilePicture.layer.cornerRadius = 30 self.profilePicture.layer.masksToBounds = true let refreshControl = UIRefreshControl() refreshControl.addTarget(self, action: #selector(refreshControlAction(_:)), forControlEvents: UIControlEvents.ValueChanged) collectionView.insertSubview(refreshControl, atIndex: 0) // construct query let query = PFQuery(className: "Post") query.whereKey("author", equalTo: PFUser.currentUser()!) // fetch data asynchronously query.findObjectsInBackgroundWithBlock { (posts: [PFObject]?, error: NSError?) -> Void in if let posts = posts { self.userPosts = posts self.postsLabel.text = "\(self.userPosts.count) Posts" self.collectionView.reloadData() } else { print(error?.localizedDescription) } // construct query let secondQuery = PFQuery(className: "Post") secondQuery.includeKey("taggedUser") secondQuery.whereKey("taggedUser", equalTo: PFUser.currentUser()!) // fetch data asynchronously secondQuery.findObjectsInBackgroundWithBlock { (secondPosts: [PFObject]?, error: NSError?) -> Void in if let secondPosts = secondPosts { self.taggedPost = secondPosts self.taggedCollectionView.reloadData() } else { print(error?.localizedDescription) } } } let currentProfilePic = PFUser.currentUser()!["profilePicture"] var instagramPost: PFObject! { didSet { self.profilePicture.file = PFUser.currentUser()!["profilePicture"] as? PFFile self.profilePicture.loadInBackground() } } instagramPost = PFUser.currentUser() } @IBAction func didTapTags(sender: AnyObject) { collectionView.hidden = true taggedCollectionView.hidden = false tagsButton.hidden = true myPostsButton.hidden = false postsLabel.text = "\(taggedPost.count) Posts" } @IBAction func didTapMyPosts(sender: AnyObject) { collectionView.hidden = false taggedCollectionView.hidden = true tagsButton.hidden = false myPostsButton.hidden = true postsLabel.text = "\(userPosts.count)" } override func viewDidDisappear(animated: Bool) { var bio = PFUser.currentUser()!["bio"] if let bio = bio { bioLabel.text = (bio as! String) } else { bioLabel.text = "" } let currentProfilePic = PFUser.currentUser()!["profilePicture"] var instagramPost: PFObject! { didSet { self.profilePicture.file = PFUser.currentUser()!["profilePicture"] as? PFFile self.profilePicture.loadInBackground() } } instagramPost = PFUser.currentUser() } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } func refreshControlAction(refreshControl: UIRefreshControl) { // construct query let query = PFQuery(className: "Post") query.whereKey("author", equalTo: PFUser.currentUser()!) // fetch data asynchronously query.findObjectsInBackgroundWithBlock { (posts: [PFObject]?, error: NSError?) -> Void in if let posts = posts { self.userPosts = posts } else { print(error?.localizedDescription) } } self.collectionView.reloadData() let currentProfilePic = PFUser.currentUser()!["profilePicture"] var instagramPost: PFObject! { didSet { self.profilePicture.file = PFUser.currentUser()!["profilePicture"] as? PFFile self.profilePicture.loadInBackground() } } instagramPost = PFUser.currentUser() // Tell the refreshControl to stop spinning refreshControl.endRefreshing() } func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { if (collectionView.restorationIdentifier == "Posts Collection View") { return userPosts.count } else { return taggedPost.count } } func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { if (collectionView.restorationIdentifier == "Posts Collection View") { let cell = collectionView.dequeueReusableCellWithReuseIdentifier("ProfilePostCell", forIndexPath: indexPath) as! ProfileCollectionViewCell let post = userPosts[indexPath.row] cell.profileImageView.file = post["media"] as? PFFile cell.profileImageView.loadInBackground() cell.likeLabel.text = post["likesCount"].stringValue cell.commentsLabel.text = post["commentsCount"].stringValue return cell } else { let cell = taggedCollectionView.dequeueReusableCellWithReuseIdentifier("ProfilePostCell", forIndexPath: indexPath) as! ProfileCollectionViewCell let post = taggedPost[indexPath.row] cell.profileImageView.file = post["media"] as? PFFile cell.profileImageView.loadInBackground() cell.likeLabel.text = post["likesCount"].stringValue cell.commentsLabel.text = post["commentsCount"].stringValue return cell } } override func viewDidAppear(animated: Bool) { super.viewDidAppear(true) var bio = PFUser.currentUser()!["bio"] if let bio = bio { bioLabel.text = (bio as! String) } else { bioLabel.text = "" } // construct query let query = PFQuery(className: "Post") query.whereKey("author", equalTo: PFUser.currentUser()!) // fetch data asynchronously query.findObjectsInBackgroundWithBlock { (posts: [PFObject]?, error: NSError?) -> Void in if let posts = posts { self.userPosts = posts self.collectionView.reloadData() } else { print(error?.localizedDescription) } } let currentProfilePic = PFUser.currentUser()!["profilePicture"] var instagramPost: PFObject! { didSet { self.profilePicture.file = PFUser.currentUser()!["profilePicture"] as? PFFile self.profilePicture.loadInBackground() } } instagramPost = PFUser.currentUser() } override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if (segue.identifier == "profilePostDetailsSegue") { var indexPath: NSIndexPath let vc = segue.destinationViewController as! PostDetailsViewController indexPath = collectionView.indexPathForCell(sender as! UICollectionViewCell)! let dateFormatter = NSDateFormatter() dateFormatter.locale = NSLocale.currentLocale() let post = userPosts[indexPath.row] vc.currentPost = post let caption = post["caption"] vc.captionText = caption as! String let likesCount = post["likesCount"] vc.likesText = likesCount.stringValue let timestamp = post.createdAt dateFormatter.dateStyle = NSDateFormatterStyle.FullStyle let convertedDate = timestamp?.timeIntervalSinceNow let newDate = convertedDate! * -1 var finalDate = Int(newDate) if finalDate > 3600 { print(finalDate) finalDate = finalDate / 3600 vc.timestampText = "Posted:\(finalDate) hours ago" } else if finalDate > 60 { print(finalDate) finalDate = finalDate / 60 vc.timestampText = "Posted:\(finalDate) minutes ago" } else { print(finalDate) vc.timestampText = "Posted:\(finalDate) seconds ago" } let oldImage = post["media"] as? PFFile vc.image = oldImage } } }
35.693878
166
0.589003
d5e98b8643f1c7d6b31bf6258aee0867234e2d1b
2,320
h
C
src/valve_sdk/interfaces/CClientState.h
cristyanul/Sensum
8ce42e4095c09ea508eb75e91315a0cf2125e892
[ "MIT" ]
259
2019-08-25T21:55:00.000Z
2021-12-18T19:17:12.000Z
src/valve_sdk/interfaces/CClientState.h
cristyanul/Sensum
8ce42e4095c09ea508eb75e91315a0cf2125e892
[ "MIT" ]
184
2019-08-25T11:14:48.000Z
2021-12-20T03:32:17.000Z
src/valve_sdk/interfaces/CClientState.h
cristyanul/Sensum
8ce42e4095c09ea508eb75e91315a0cf2125e892
[ "MIT" ]
105
2019-08-31T14:48:09.000Z
2022-01-05T14:59:59.000Z
#pragma once #include <cstdint> // Created with ReClass.NET by KN4CK3R #pragma pack(push, 1) class INetChannel { public: char pad_0000[20]; //0x0000 bool m_bProcessingMessages; //0x0014 bool m_bShouldDelete; //0x0015 char pad_0016[2]; //0x0016 int32_t m_nOutSequenceNr; //0x0018 last send outgoing sequence number int32_t m_nInSequenceNr; //0x001C last received incoming sequnec number int32_t m_nOutSequenceNrAck; //0x0020 last received acknowledge outgoing sequnce number int32_t m_nOutReliableState; //0x0024 state of outgoing reliable data (0/1) flip flop used for loss detection int32_t m_nInReliableState; //0x0028 state of incoming reliable data int32_t m_nChokedPackets; //0x002C number of choked packets char pad_0030[1044]; //0x0030 }; //Size: 0x0444 class CClockDriftMgr { public: float m_ClockOffsets[0x10]; uint32_t m_iCurClockOffset; uint32_t m_nServerTick; uint32_t m_nClientTick; }; class CClientState { public: /*void ForceFullUpdate() { *reinterpret_cast<int*>(std::uintptr_t(this) + 0x174) = -1; }*/ char pad000[0x9C]; INetChannel* m_NetChannel; int m_nChallengeNr; char pad001[0x4]; double m_connect_time; int m_retry_number; char pad002[0x54]; int m_nSignonState; char pad003[0x4]; double m_flNextCmdTime; int m_nServerCount; int m_nCurrentSequence; char pad004[0x8]; CClockDriftMgr m_ClockDriftMgr; int m_nDeltaTick; char pad005[0x4]; int m_nViewEntity; int m_nPlayerSlot; bool m_bPaused; char pad006[0x3]; char m_szLevelName[0x104]; char m_szLevelNameShort[0x28]; char pad007[0xD4]; int m_nMaxClients; char pad008[0x4994]; int oldtickcount; float m_tickRemainder; float m_frameTime; int lastoutgoingcommand; int chokedcommands; int last_command_ack; int m_last_server_tick; int command_ack; int m_nSoundSequence; int m_last_progress_percent; bool m_is_hltv; char pad009[0x4B]; QAngle viewangles; char pad010[0xCC]; void* m_events; void ForceFullUpdate() { m_nDeltaTick = -1; } }; #pragma pack(pop) static_assert(FIELD_OFFSET(CClientState, m_NetChannel) == 0x009C, "Wrong struct offset"); static_assert(FIELD_OFFSET(CClientState, m_nCurrentSequence) == 0x011C, "Wrong struct offset"); static_assert(FIELD_OFFSET(CClientState, m_nDeltaTick) == 0x0174, "Wrong struct offset");
25.777778
110
0.759914
759f3acc2d5242b3f84135eaa2c4aaeefb1468e9
1,865
h
C
ofdEditor/start/Settings/RecentFileItem.h
mcoder2014/ofdEditor
c241f69447992cacb29d4ddae17fa4d7abd76b21
[ "MIT" ]
30
2018-09-27T09:26:57.000Z
2022-03-31T01:45:20.000Z
ofdEditor/start/Settings/RecentFileItem.h
mcoder2014/ofdEditor
c241f69447992cacb29d4ddae17fa4d7abd76b21
[ "MIT" ]
1
2019-09-06T04:54:16.000Z
2019-09-06T04:54:16.000Z
ofdEditor/start/Settings/RecentFileItem.h
mcoder2014/ofdEditor
c241f69447992cacb29d4ddae17fa4d7abd76b21
[ "MIT" ]
15
2018-04-23T02:49:20.000Z
2021-09-27T03:06:55.000Z
#ifndef RECENTFILEITEM_H #define RECENTFILEITEM_H #include <QObject> #include <QDateTime> class RecentFileItem : public QObject { Q_OBJECT public: explicit RecentFileItem(QObject *parent = 0); RecentFileItem( QString fileName, QString author, QString recentEditTime, QString recentOpenTime, QString filePath); QString getFileName(){return this->fileName;} QString getAuthor(){return this->author;} QDateTime getRecentOpenTime(){return this->recentOpenTime;} QString getRecentOpenTime_str(){ return this->recentOpenTime.toString( "yyyy-MM-dd HH:mm:ss");} QDateTime getRecentEditTime(){return this->recentEditTime;} QString getRecentEditTime_str(){ return this->recentEditTime.toString( "yyyy-MM-dd");} QString getFilePath(){return this->filePath;} void setFileName(QString fileName){this->fileName = fileName;} void setAuthor(QString author){this->author = author;} void setRecentOpenTime(QString recentOpenTime); void setRecentOpenTime(QDateTime recentOpenTime); void setRecentEditTime(QString recentEditTime); void setRecentEditTime(QDateTime recentEditTime); void setFilePath(QString filePath); void init( QString fileName, QString author, QString recentEditTime, QString recentOpenTime, QString filePath); void print(); // 通过qDebug方式输出 bool isExist(); // 检查该文件是否存在 private: QString fileName; // 文件名 QString author; // 作者 // 根据文件格式,资金修改的时间精确到天 QDateTime recentOpenTime; // 最近打开文件时间 QDateTime recentEditTime; // 最近编辑文件时间 QString filePath; // 文件路径 signals: public slots: }; #endif // RECENTFILEITEM_H
27.426471
66
0.646649
5eda884c10b4f8f63e2f10e8b350ef82f963bd5d
1,548
kt
Kotlin
app/src/main/kotlin/com/awesome/un/data/api/APIClient.kt
stanfit/android-crean-architecture
fa67068d66e6d821a02aa50610a5c6a7bbfc8c43
[ "MIT" ]
null
null
null
app/src/main/kotlin/com/awesome/un/data/api/APIClient.kt
stanfit/android-crean-architecture
fa67068d66e6d821a02aa50610a5c6a7bbfc8c43
[ "MIT" ]
null
null
null
app/src/main/kotlin/com/awesome/un/data/api/APIClient.kt
stanfit/android-crean-architecture
fa67068d66e6d821a02aa50610a5c6a7bbfc8c43
[ "MIT" ]
null
null
null
package com.awesome.un.data.api import io.ktor.client.HttpClient import io.ktor.client.features.websocket.wss import io.ktor.client.request.get import io.ktor.client.request.post import io.ktor.http.cio.websocket.Frame import io.ktor.http.cio.websocket.readBytes import io.ktor.http.cio.websocket.readText import io.ktor.http.cio.websocket.send import kotlinx.coroutines.channels.BroadcastChannel /** * RestAPI Client for Ktor. * * @property httpClient HttpClient fot Ktor */ class APIClient(val httpClient: HttpClient) { /** * RestAPI GET Method. * * @param T Response Entity Class * @param url Request URL * @return Response Entity Instance */ suspend inline fun <reified T> get(url: String): T = httpClient.get(url) /** * RestAPI POST Method. * * @param T Response Entity Class * @param url Request URL * @return Response Entity Instance */ suspend inline fun <reified T> post(url: String): T = httpClient.post(url) val channel: BroadcastChannel<String> = BroadcastChannel(1) suspend inline fun <reified T> wss(url: String) { httpClient.wss(urlString = url) { // Send text frame. send("Hello, Text frame") // Send text frame. send(Frame.Text("Hello World")) // Receive frame. when (val frame = incoming.receive()) { is Frame.Text -> println(frame.readText()) is Frame.Binary -> println(frame.readBytes()) } } } }
27.642857
78
0.639535
475d0a430fe347074669b3aaf6192be6adb78d92
542
sql
SQL
sql/user.sql
cuo9958/user_center
d43e6dd149380cd4a4ece2c49c5f44995501a3bf
[ "MIT" ]
null
null
null
sql/user.sql
cuo9958/user_center
d43e6dd149380cd4a4ece2c49c5f44995501a3bf
[ "MIT" ]
null
null
null
sql/user.sql
cuo9958/user_center
d43e6dd149380cd4a4ece2c49c5f44995501a3bf
[ "MIT" ]
null
null
null
CREATE TABLE IF NOT EXISTS `t_user` ( `id` INTEGER auto_increment, `uuid` VARCHAR(40) DEFAULT '' COMMENT '用户的uuid', `username` VARCHAR(255) DEFAULT '' COMMENT '用户名', `headimg` VARCHAR(255) DEFAULT '' COMMENT '头像', `tell` VARCHAR(255) DEFAULT '' COMMENT '手机号', `openid` VARCHAR(255) DEFAULT '' COMMENT '微信的openid', `status` TINYINT DEFAULT 0 COMMENT '状态;0:失效;1:使用', `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`) ) ENGINE = InnoDB; ALTER TABLE `t_user` ADD INDEX `t_user_uuid` (`uuid`)
33.875
55
0.682657
40b4bf19fca0a00c615ba2c3e22a3936506e92e5
40,097
py
Python
tests/system_tests_qdstat.py
pwright/qpid-dispatch
94f523a12631d592503d8e4acbe075b879c8d3bd
[ "Apache-2.0" ]
1
2019-07-16T10:24:40.000Z
2019-07-16T10:24:40.000Z
tests/system_tests_qdstat.py
finp/qpid-dispatch
94f523a12631d592503d8e4acbe075b879c8d3bd
[ "Apache-2.0" ]
101
2020-10-15T06:49:34.000Z
2022-03-31T04:04:25.000Z
tests/system_tests_qdstat.py
pwright/qpid-dispatch
94f523a12631d592503d8e4acbe075b879c8d3bd
[ "Apache-2.0" ]
null
null
null
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License # from __future__ import unicode_literals from __future__ import division from __future__ import absolute_import from __future__ import print_function import os import re import system_test import unittest import sys from subprocess import PIPE from proton import Url, SSLDomain, SSLUnavailable, SASL from system_test import main_module, SkipIfNeeded from proton.utils import BlockingConnection class QdstatTest(system_test.TestCase): """Test qdstat tool output""" @classmethod def setUpClass(cls): super(QdstatTest, cls).setUpClass() config = system_test.Qdrouterd.Config([ ('router', {'id': 'QDR.A', 'workerThreads': 1}), ('listener', {'port': cls.tester.get_port()}), ]) cls.router = cls.tester.qdrouterd('test-router', config) def run_qdstat(self, args, regexp=None, address=None): if args: popen_args = ['qdstat', '--bus', str(address or self.router.addresses[0]), '--timeout', str(system_test.TIMEOUT) ] + args else: popen_args = ['qdstat', '--bus', str(address or self.router.addresses[0]), '--timeout', str(system_test.TIMEOUT)] p = self.popen(popen_args, name='qdstat-'+self.id(), stdout=PIPE, expect=None, universal_newlines=True) out = p.communicate()[0] assert p.returncode == 0, \ "qdstat exit status %s, output:\n%s" % (p.returncode, out) if regexp: assert re.search(regexp, out, re.I), "Can't find '%s' in '%s'" % (regexp, out) return out def test_help(self): self.run_qdstat(['--help'], r'Usage: qdstat') def test_general(self): out = self.run_qdstat(['--general'], r'(?s)Router Statistics.*Mode\s*Standalone') self.assertTrue(re.match(r"(.*)\bConnections\b[ \t]+\b1\b(.*)", out, flags=re.DOTALL) is not None, out) self.assertTrue(re.match(r"(.*)\bNodes\b[ \t]+\b0\b(.*)", out, flags=re.DOTALL) is not None, out) self.assertTrue(re.match(r"(.*)\bAuto Links\b[ \t]+\b0\b(.*)", out, flags=re.DOTALL) is not None, out) self.assertTrue(re.match(r"(.*)\bLink Routes\b[ \t]+\b0\b(.*)", out, flags=re.DOTALL) is not None, out) self.assertTrue(re.match(r"(.*)\bWorker Threads\b[ \t]+\b1\b(.*)", out, flags=re.DOTALL) is not None, out) self.assertTrue(re.match(r"(.*)\bRouter Id\b[ \t]+\bQDR.A\b(.*)", out, flags=re.DOTALL) is not None, out) self.assertTrue(re.match(r"(.*)\bMode\b[ \t]+\bstandalone\b(.*)", out, flags=re.DOTALL) is not None, out) self.assertEqual(out.count("QDR.A"), 2) def test_general_csv(self): out = self.run_qdstat(['--general', '--csv'], r'(?s)Router Statistics.*Mode","Standalone') self.assertIn('"Connections","1"', out) self.assertIn('"Worker Threads","1"', out) self.assertIn('"Nodes","0"', out) self.assertIn('"Auto Links","0"', out) self.assertIn('"Link Routes","0"', out) self.assertIn('"Router Id","QDR.A"', out) self.assertIn('"Mode","standalone"', out) self.assertEqual(out.count("QDR.A"), 2) def test_connections(self): self.run_qdstat(['--connections'], r'host.*container.*role') outs = self.run_qdstat(['--connections'], 'no-auth') outs = self.run_qdstat(['--connections'], 'QDR.A') def test_connections_csv(self): self.run_qdstat(['--connections', "--csv"], r'host.*container.*role') outs = self.run_qdstat(['--connections'], 'no-auth') outs = self.run_qdstat(['--connections'], 'QDR.A') def test_links(self): self.run_qdstat(['--links'], r'QDR.A') out = self.run_qdstat(['--links'], r'endpoint.*out.*local.*temp.') parts = out.split("\n") self.assertEqual(len(parts), 9) def test_links_csv(self): self.run_qdstat(['--links', "--csv"], r'QDR.A') out = self.run_qdstat(['--links'], r'endpoint.*out.*local.*temp.') parts = out.split("\n") self.assertEqual(len(parts), 9) def test_links_with_limit(self): out = self.run_qdstat(['--links', '--limit=1']) parts = out.split("\n") self.assertEqual(len(parts), 8) def test_links_with_limit_csv(self): out = self.run_qdstat(['--links', '--limit=1', "--csv"]) parts = out.split("\n") self.assertEqual(len(parts), 7) def test_nodes(self): self.run_qdstat(['--nodes'], r'No Router List') def test_nodes_csv(self): self.run_qdstat(['--nodes', "--csv"], r'No Router List') def test_address(self): out = self.run_qdstat(['--address'], r'QDR.A') out = self.run_qdstat(['--address'], r'\$management') parts = out.split("\n") self.assertEqual(len(parts), 11) def test_address_csv(self): out = self.run_qdstat(['--address'], r'QDR.A') out = self.run_qdstat(['--address'], r'\$management') parts = out.split("\n") self.assertEqual(len(parts), 11) def test_qdstat_no_args(self): outs = self.run_qdstat(args=None) self.assertTrue("Presettled Count" in outs) self.assertTrue("Dropped Presettled Count" in outs) self.assertTrue("Accepted Count" in outs) self.assertTrue("Rejected Count" in outs) self.assertTrue("Deliveries from Route Container" in outs) self.assertTrue("Deliveries to Route Container" in outs) self.assertTrue("Deliveries to Fallback" in outs) self.assertTrue("Egress Count" in outs) self.assertTrue("Ingress Count" in outs) self.assertTrue("Uptime" in outs) def test_qdstat_no_other_args_csv(self): outs = self.run_qdstat(["--csv"]) self.assertTrue("Presettled Count" in outs) self.assertTrue("Dropped Presettled Count" in outs) self.assertTrue("Accepted Count" in outs) self.assertTrue("Rejected Count" in outs) self.assertTrue("Deliveries from Route Container" in outs) self.assertTrue("Deliveries to Route Container" in outs) self.assertTrue("Deliveries to Fallback" in outs) self.assertTrue("Egress Count" in outs) self.assertTrue("Ingress Count" in outs) self.assertTrue("Uptime" in outs) def test_address_priority(self): out = self.run_qdstat(['--address']) lines = out.split("\n") # make sure the output contains a header line self.assertTrue(len(lines) >= 2) # see if the header line has the word priority in it priorityregexp = r'pri' priority_column = re.search(priorityregexp, lines[4]).start() self.assertTrue(priority_column > -1) # extract the number in the priority column of every address for i in range(6, len(lines) - 1): pri = re.findall(r'[-\d]+', lines[i][priority_column:]) # make sure the priority found is a hyphen or a legal number if pri[0] == '-': pass # naked hypnen is allowed else: self.assertTrue(len(pri) > 0, "Can not find numeric priority in '%s'" % lines[i]) priority = int(pri[0]) # make sure the priority is from -1 to 9 self.assertTrue(priority >= -1, "Priority was less than -1") self.assertTrue(priority <= 9, "Priority was greater than 9") def test_address_priority_csv(self): HEADER_ROW = 4 PRI_COL = 4 out = self.run_qdstat(['--address', "--csv"]) lines = out.split("\n") # make sure the output contains a header line self.assertTrue(len(lines) >= 2) # see if the header line has the word priority in it header_line = lines[HEADER_ROW].split(',') self.assertTrue(header_line[PRI_COL] == '"pri"') # extract the number in the priority column of every address for i in range(HEADER_ROW + 1, len(lines) - 1): line = lines[i].split(',') pri = line[PRI_COL][1:-1] # unquoted value # make sure the priority found is a hyphen or a legal number if pri == '-': pass # naked hypnen is allowed else: priority = int(pri) # make sure the priority is from -1 to 9 self.assertTrue(priority >= -1, "Priority was less than -1") self.assertTrue(priority <= 9, "Priority was greater than 9") def test_address_with_limit(self): out = self.run_qdstat(['--address', '--limit=1']) parts = out.split("\n") self.assertEqual(len(parts), 8) def test_address_with_limit_csv(self): out = self.run_qdstat(['--address', '--limit=1', '--csv']) parts = out.split("\n") self.assertEqual(len(parts), 7) def test_memory(self): out = self.run_qdstat(['--memory']) if out.strip() == "No memory statistics available": # router built w/o memory pools enabled] return self.skipTest("Router's memory pools disabled") self.assertTrue("QDR.A" in out) self.assertTrue("UTC" in out) regexp = r'qdr_address_t\s+[0-9]+' assert re.search(regexp, out, re.I), "Can't find '%s' in '%s'" % (regexp, out) def test_memory_csv(self): out = self.run_qdstat(['--memory', '--csv']) if out.strip() == "No memory statistics available": # router built w/o memory pools enabled] return self.skipTest("Router's memory pools disabled") self.assertTrue("QDR.A" in out) self.assertTrue("UTC" in out) regexp = r'qdr_address_t","[0-9]+' assert re.search(regexp, out, re.I), "Can't find '%s' in '%s'" % (regexp, out) def test_policy(self): out = self.run_qdstat(['--policy']) self.assertTrue("Maximum Concurrent Connections" in out) self.assertTrue("Total Denials" in out) def test_policy_csv(self): out = self.run_qdstat(['-p', "--csv"]) self.assertTrue("Maximum Concurrent Connections" in out) self.assertTrue("Total Denials" in out) def test_log(self): self.run_qdstat(['--log', '--limit=5'], r'AGENT \(debug\).*GET-LOG') def test_yy_query_many_links(self): # This test will fail without the fix for DISPATCH-974 c = BlockingConnection(self.router.addresses[0]) count = 0 links = [] COUNT = 5000 ADDRESS_SENDER = "examples-sender" ADDRESS_RECEIVER = "examples-receiver" # This loop creates 5000 consumer and 5000 producer links while True: count += 1 r = c.create_receiver(ADDRESS_RECEIVER + str(count)) links.append(r) s = c.create_sender(ADDRESS_SENDER + str(count)) links.append(c) if count == COUNT: break # Now we run qdstat command and check if we got back details # about all the 10000 links # We do not specify the limit which means unlimited # which means get everything that is there. outs = self.run_qdstat(['--links']) out_list = outs.split("\n") out_links = 0 in_links = 0 for out in out_list: if "endpoint in" in out and ADDRESS_SENDER in out: in_links += 1 if "endpoint out" in out and ADDRESS_RECEIVER in out: out_links += 1 self.assertEqual(in_links, COUNT) self.assertEqual(out_links, COUNT) # Run qdstat with a limit more than 10,000 outs = self.run_qdstat(['--links', '--limit=15000']) out_list = outs.split("\n") out_links = 0 in_links = 0 for out in out_list: if "endpoint in" in out and ADDRESS_SENDER in out: in_links += 1 if "endpoint out" in out and ADDRESS_RECEIVER in out: out_links += 1 self.assertEqual(in_links, COUNT) self.assertEqual(out_links, COUNT) # Run qdstat with a limit less than 10,000 outs = self.run_qdstat(['--links', '--limit=2000']) out_list = outs.split("\n") links = 0 for out in out_list: if "endpoint" in out and "examples" in out: links += 1 self.assertEqual(links, 2000) # Run qdstat with a limit less than 10,000 # repeat with --csv outs = self.run_qdstat(['--links', '--limit=2000', '--csv']) out_list = outs.split("\n") links = 0 for out in out_list: if "endpoint" in out and "examples" in out: links += 1 self.assertEqual(links, 2000) # Run qdstat with a limit of 700 because 700 # is the maximum number of rows we get per request outs = self.run_qdstat(['--links', '--limit=700']) out_list = outs.split("\n") links = 0 for out in out_list: if "endpoint" in out and "examples" in out: links += 1 self.assertEqual(links, 700) # Run qdstat with a limit of 700 because 700 # is the maximum number of rows we get per request # repeat with --csv outs = self.run_qdstat(['--links', '--limit=700', '--csv']) out_list = outs.split("\n") links = 0 for out in out_list: if "endpoint" in out and "examples" in out: links += 1 self.assertEqual(links, 700) # Run qdstat with a limit of 500 because 700 # is the maximum number of rows we get per request # and we want to try something less than 700 outs = self.run_qdstat(['--links', '--limit=500']) out_list = outs.split("\n") links = 0 for out in out_list: if "endpoint" in out and "examples" in out: links += 1 self.assertEqual(links, 500) # Run qdstat with a limit of 500 because 700 # is the maximum number of rows we get per request # and we want to try something less than 700 # repeat with --csv outs = self.run_qdstat(['--links', '--limit=500', '--csv']) out_list = outs.split("\n") links = 0 for out in out_list: if "endpoint" in out and "examples" in out: links += 1 self.assertEqual(links, 500) # DISPATCH-1485. Try to run qdstat with a limit=0. Without the fix for DISPATCH-1485 # this following command will hang and the test will fail. outs = self.run_qdstat(['--links', '--limit=0']) out_list = outs.split("\n") links = 0 for out in out_list: if "endpoint" in out and "examples" in out: links += 1 self.assertEqual(links, COUNT*2) # DISPATCH-1485. Try to run qdstat with a limit=0. Without the fix for DISPATCH-1485 # this following command will hang and the test will fail. # repeat with --csv outs = self.run_qdstat(['--links', '--limit=0', '--csv']) out_list = outs.split("\n") links = 0 for out in out_list: if "endpoint" in out and "examples" in out: links += 1 self.assertEqual(links, COUNT*2) # This test would fail without the fix for DISPATCH-974 outs = self.run_qdstat(['--address']) out_list = outs.split("\n") sender_addresses = 0 receiver_addresses = 0 for out in out_list: if ADDRESS_SENDER in out: sender_addresses += 1 if ADDRESS_RECEIVER in out: receiver_addresses += 1 self.assertEqual(sender_addresses, COUNT) self.assertEqual(receiver_addresses, COUNT) # Test if there is a non-zero uptime for the router in the output of # qdstat -g non_zero_seconds = False outs = self.run_qdstat(args=None) parts = outs.split("\n") for part in parts: if "Uptime" in part: uptime_parts = part.split(" ") for uptime_part in uptime_parts: if uptime_part.startswith("000"): time_parts = uptime_part.split(":") if int(time_parts[3]) > 0: non_zero_seconds = True if not non_zero_seconds: if int(time_parts[2]) > 0: non_zero_seconds = True self.assertTrue(non_zero_seconds) c.close() class QdstatTestVhostPolicy(system_test.TestCase): """Test qdstat-with-policy tool output""" @classmethod def setUpClass(cls): super(QdstatTestVhostPolicy, cls).setUpClass() config = system_test.Qdrouterd.Config([ ('router', {'id': 'QDR.A', 'workerThreads': 1}), ('listener', {'port': cls.tester.get_port()}), ('policy', {'maxConnections': 100, 'enableVhostPolicy': 'true'}), ('vhost', { 'hostname': '$default', 'maxConnections': 2, 'allowUnknownUser': 'true', 'groups': { '$default': { 'users': '*', 'remoteHosts': '*', 'sources': '*', 'targets': '*', 'allowDynamicSource': True }, 'HGCrawler': { 'users': 'Farmers', 'remoteHosts': '*', 'sources': '*', 'targets': '*', 'allowDynamicSource': True }, }, }) ]) cls.router = cls.tester.qdrouterd('test-router', config) def run_qdstat(self, args, regexp=None, address=None): if args: popen_args = ['qdstat', '--bus', str(address or self.router.addresses[0]), '--timeout', str(system_test.TIMEOUT) ] + args else: popen_args = ['qdstat', '--bus', str(address or self.router.addresses[0]), '--timeout', str(system_test.TIMEOUT)] p = self.popen(popen_args, name='qdstat-'+self.id(), stdout=PIPE, expect=None, universal_newlines=True) out = p.communicate()[0] assert p.returncode == 0, \ "qdstat exit status %s, output:\n%s" % (p.returncode, out) if regexp: assert re.search(regexp, out, re.I), "Can't find '%s' in '%s'" % (regexp, out) return out def test_vhost(self): out = self.run_qdstat(['--vhosts']) self.assertTrue("Vhosts" in out) self.assertTrue("allowUnknownUser" in out) def test_vhost_csv(self): out = self.run_qdstat(['--vhosts', '--csv']) self.assertTrue("Vhosts" in out) self.assertTrue("allowUnknownUser" in out) def test_vhostgroups(self): out = self.run_qdstat(['--vhostgroups']) self.assertTrue("Vhost Groups" in out) self.assertTrue("allowAdminStatusUpdate" in out) self.assertTrue("Vhost '$default' UserGroup '$default'" in out) self.assertTrue("Vhost '$default' UserGroup 'HGCrawler'" in out) def test_vhostgroups_csv(self): out = self.run_qdstat(['--vhostgroups', '--csv']) self.assertTrue("Vhost Groups" in out) self.assertTrue("allowAdminStatusUpdate" in out) self.assertTrue("Vhost '$default' UserGroup '$default'" in out) self.assertTrue("Vhost '$default' UserGroup 'HGCrawler'" in out) def test_vhoststats(self): out = self.run_qdstat(['--vhoststats']) self.assertTrue("Vhost Stats" in out) self.assertTrue("maxMessageSizeDenied" in out) self.assertTrue("Vhost User Stats" in out) self.assertTrue("remote hosts" in out) def test_vhoststats_csv(self): out = self.run_qdstat(['--vhoststats', '--csv']) self.assertTrue("Vhost Stats" in out) self.assertTrue("maxMessageSizeDenied" in out) self.assertTrue("Vhost User Stats" in out) self.assertTrue("remote hosts" in out) class QdstatLinkPriorityTest(system_test.TestCase): """Need 2 routers to get inter-router links for the link priority test""" @classmethod def setUpClass(cls): super(QdstatLinkPriorityTest, cls).setUpClass() cls.inter_router_port = cls.tester.get_port() config_1 = system_test.Qdrouterd.Config([ ('router', {'mode': 'interior', 'id': 'R1'}), ('listener', {'port': cls.tester.get_port()}), ('connector', {'role': 'inter-router', 'port': cls.inter_router_port}) ]) config_2 = system_test.Qdrouterd.Config([ ('router', {'mode': 'interior', 'id': 'R2'}), ('listener', {'role': 'inter-router', 'port': cls.inter_router_port}), ]) cls.router_2 = cls.tester.qdrouterd('test_router_2', config_2, wait=True) cls.router_1 = cls.tester.qdrouterd('test_router_1', config_1, wait=True) cls.router_1.wait_router_connected('R2') def address(self): return self.router_1.addresses[0] def run_qdstat(self, args): p = self.popen( ['qdstat', '--bus', str(self.address()), '--timeout', str(system_test.TIMEOUT) ] + args, name='qdstat-'+self.id(), stdout=PIPE, expect=None, universal_newlines=True) out = p.communicate()[0] assert p.returncode == 0, \ "qdstat exit status %s, output:\n%s" % (p.returncode, out) return out def test_link_priority(self): out = self.run_qdstat(['--links']) lines = out.split("\n") # make sure the output contains a header line self.assertTrue(len(lines) >= 2) # see if the header line has the word priority in it priorityregexp = r'pri' priority_column = re.search(priorityregexp, lines[4]).start() self.assertTrue(priority_column > -1) # extract the number in the priority column of every inter-router link priorities = {} for i in range(6, len(lines) - 1): if re.search(r'inter-router', lines[i]): pri = re.findall(r'[-\d]+', lines[i][priority_column:]) # make sure the priority found is a number self.assertTrue(len(pri) > 0, "Can not find numeric priority in '%s'" % lines[i]) self.assertTrue(pri[0] != '-') # naked hypen disallowed priority = int(pri[0]) # make sure the priority is from 0 to 9 self.assertTrue(priority >= 0, "Priority was less than 0") self.assertTrue(priority <= 9, "Priority was greater than 9") # mark this priority as present priorities[priority] = True # make sure that all priorities are present in the list (currently 0-9) self.assertEqual(len(priorities.keys()), 10, "Not all priorities are present") def test_link_priority_csv(self): HEADER_ROW = 4 TYPE_COL = 0 PRI_COL = 9 out = self.run_qdstat(['--links', '--csv']) lines = out.split("\n") # make sure the output contains a header line self.assertTrue(len(lines) >= 2) # see if the header line has the word priority in it header_line = lines[HEADER_ROW].split(',') self.assertTrue(header_line[PRI_COL] == '"pri"') # extract the number in the priority column of every inter-router link priorities = {} for i in range(HEADER_ROW + 1, len(lines) - 1): line = lines[i].split(',') if line[TYPE_COL] == '"inter-router"': pri = line[PRI_COL][1:-1] # make sure the priority found is a number self.assertTrue(len(pri) > 0, "Can not find numeric priority in '%s'" % lines[i]) self.assertTrue(pri != '-') # naked hypen disallowed priority = int(pri) # make sure the priority is from 0 to 9 self.assertTrue(priority >= 0, "Priority was less than 0") self.assertTrue(priority <= 9, "Priority was greater than 9") # mark this priority as present priorities[priority] = True # make sure that all priorities are present in the list (currently 0-9) self.assertEqual(len(priorities.keys()), 10, "Not all priorities are present") def _test_links_all_routers(self, command): out = self.run_qdstat(command) self.assertTrue(out.count('UTC') == 1) self.assertTrue(out.count('Router Links') == 2) self.assertTrue(out.count('inter-router') == 40) self.assertTrue(out.count('router-control') == 4) def test_links_all_routers(self): self._test_links_all_routers(['--links', '--all-routers']) def test_links_all_routers_csv(self): self._test_links_all_routers(['--links', '--all-routers', '--csv']) def _test_all_entities(self, command): out = self.run_qdstat(command) self.assertTrue(out.count('UTC') == 1) self.assertTrue(out.count('Router Links') == 1) self.assertTrue(out.count('Router Addresses') == 1) self.assertTrue(out.count('Connections') == 6) self.assertTrue(out.count('AutoLinks') == 2) self.assertTrue(out.count('Link Routes') == 3) self.assertTrue(out.count('Router Statistics') == 1) self.assertTrue(out.count('Memory Pools') == 1) def test_all_entities(self): self._test_all_entities(['--all-entities']) def test_all_entities_csv(self): self._test_all_entities(['--all-entities', '--csv']) def _test_all_entities_all_routers(self, command): out = self.run_qdstat(command) self.assertTrue(out.count('UTC') == 1) self.assertTrue(out.count('Router Links') == 2) self.assertTrue(out.count('Router Addresses') == 2) self.assertTrue(out.count('Connections') == 12) self.assertTrue(out.count('AutoLinks') == 4) self.assertTrue(out.count('Link Routes') == 6) self.assertTrue(out.count('Router Statistics') == 2) self.assertTrue(out.count('Memory Pools') == 2) def test_all_entities_all_routers(self): self._test_all_entities_all_routers(['--all-entities', '--all-routers']) def test_all_entities_all_routers_csv(self): self._test_all_entities_all_routers(['--all-entities', '--csv', '--all-routers']) try: SSLDomain(SSLDomain.MODE_CLIENT) class QdstatSslTest(system_test.TestCase): """Test qdstat tool output""" @staticmethod def ssl_file(name): return os.path.join(system_test.DIR, 'ssl_certs', name) @staticmethod def sasl_path(): return os.path.join(system_test.DIR, 'sasl_configs') @classmethod def setUpClass(cls): super(QdstatSslTest, cls).setUpClass() # Write SASL configuration file: with open('tests-mech-EXTERNAL.conf', 'w') as sasl_conf: sasl_conf.write("mech_list: EXTERNAL ANONYMOUS DIGEST-MD5 PLAIN\n") # qdrouterd configuration: config = system_test.Qdrouterd.Config([ ('router', {'id': 'QDR.B', 'saslConfigPath': os.getcwd(), 'workerThreads': 1, 'saslConfigName': 'tests-mech-EXTERNAL'}), ('sslProfile', {'name': 'server-ssl', 'caCertFile': cls.ssl_file('ca-certificate.pem'), 'certFile': cls.ssl_file('server-certificate.pem'), 'privateKeyFile': cls.ssl_file('server-private-key.pem'), 'password': 'server-password'}), ('listener', {'port': cls.tester.get_port()}), ('listener', {'port': cls.tester.get_port(), 'sslProfile': 'server-ssl', 'authenticatePeer': 'no', 'requireSsl': 'yes'}), ('listener', {'port': cls.tester.get_port(), 'sslProfile': 'server-ssl', 'authenticatePeer': 'no', 'requireSsl': 'no'}), ('listener', {'port': cls.tester.get_port(), 'sslProfile': 'server-ssl', 'authenticatePeer': 'yes', 'requireSsl': 'yes', 'saslMechanisms': 'EXTERNAL'}) ]) cls.router = cls.tester.qdrouterd('test-router', config) def run_qdstat(self, args, regexp=None, address=None): p = self.popen( ['qdstat', '--bus', str(address or self.router.addresses[0]), '--ssl-disable-peer-name-verify', '--timeout', str(system_test.TIMEOUT) ] + args, name='qdstat-'+self.id(), stdout=PIPE, expect=None, universal_newlines=True) out = p.communicate()[0] assert p.returncode == 0, \ "qdstat exit status %s, output:\n%s" % (p.returncode, out) if regexp: assert re.search(regexp, out, re.I), "Can't find '%s' in '%s'" % (regexp, out) return out def get_ssl_args(self): args = dict( sasl_external = ['--sasl-mechanisms', 'EXTERNAL'], trustfile = ['--ssl-trustfile', self.ssl_file('ca-certificate.pem')], bad_trustfile = ['--ssl-trustfile', self.ssl_file('bad-ca-certificate.pem')], client_cert = ['--ssl-certificate', self.ssl_file('client-certificate.pem')], client_key = ['--ssl-key', self.ssl_file('client-private-key.pem')], client_pass = ['--ssl-password', 'client-password']) args['client_cert_all'] = args['client_cert'] + args['client_key'] + args['client_pass'] return args def ssl_test(self, url_name, arg_names): """Run simple SSL connection test with supplied parameters. See test_ssl_* below. """ args = self.get_ssl_args() addrs = [self.router.addresses[i] for i in range(4)]; urls = dict(zip(['none', 'strict', 'unsecured', 'auth'], addrs)) urls.update(zip(['none_s', 'strict_s', 'unsecured_s', 'auth_s'], (Url(a, scheme="amqps") for a in addrs))) self.run_qdstat(['--general'] + sum([args[n] for n in arg_names], []), regexp=r'(?s)Router Statistics.*Mode\s*Standalone', address=str(urls[url_name])) def ssl_test_bad(self, url_name, arg_names): self.assertRaises(AssertionError, self.ssl_test, url_name, arg_names) # Non-SSL enabled listener should fail SSL connections. def test_ssl_none(self): self.ssl_test('none', []) def test_ssl_scheme_to_none(self): self.ssl_test_bad('none_s', []) def test_ssl_cert_to_none(self): self.ssl_test_bad('none', ['client_cert']) # Strict SSL listener, SSL only def test_ssl_none_to_strict(self): self.ssl_test_bad('strict', []) def test_ssl_schema_to_strict(self): self.ssl_test('strict_s', []) def test_ssl_cert_to_strict(self): self.ssl_test('strict_s', ['client_cert_all']) def test_ssl_trustfile_to_strict(self): self.ssl_test('strict_s', ['trustfile']) def test_ssl_trustfile_cert_to_strict(self): self.ssl_test('strict_s', ['trustfile', 'client_cert_all']) def test_ssl_bad_trustfile_to_strict(self): self.ssl_test_bad('strict_s', ['bad_trustfile']) # Require-auth SSL listener def test_ssl_none_to_auth(self): self.ssl_test_bad('auth', []) def test_ssl_schema_to_auth(self): self.ssl_test_bad('auth_s', []) def test_ssl_trustfile_to_auth(self): self.ssl_test_bad('auth_s', ['trustfile']) def test_ssl_cert_to_auth(self): self.ssl_test('auth_s', ['client_cert_all']) def test_ssl_trustfile_cert_to_auth(self): self.ssl_test('auth_s', ['trustfile', 'client_cert_all']) def test_ssl_bad_trustfile_to_auth(self): self.ssl_test_bad('auth_s', ['bad_trustfile', 'client_cert_all']) def test_ssl_cert_explicit_external_to_auth(self): self.ssl_test('auth_s', ['sasl_external', 'client_cert_all']) # Unsecured SSL listener, allows non-SSL def test_ssl_none_to_unsecured(self): self.ssl_test('unsecured', []) def test_ssl_schema_to_unsecured(self): self.ssl_test('unsecured_s', []) def test_ssl_cert_to_unsecured(self): self.ssl_test('unsecured_s', ['client_cert_all']) def test_ssl_trustfile_to_unsecured(self): self.ssl_test('unsecured_s', ['trustfile']) def test_ssl_trustfile_cert_to_unsecured(self): self.ssl_test('unsecured_s', ['trustfile', 'client_cert_all']) def test_ssl_bad_trustfile_to_unsecured(self): self.ssl_test_bad('unsecured_s', ['bad_trustfile']) except SSLUnavailable: class QdstatSslTest(system_test.TestCase): def test_skip(self): self.skipTest("Proton SSL support unavailable.") try: SSLDomain(SSLDomain.MODE_CLIENT) class QdstatSslTestSslPasswordFile(QdstatSslTest): """ Tests the --ssl-password-file command line parameter """ def get_ssl_args(self): args = dict( sasl_external = ['--sasl-mechanisms', 'EXTERNAL'], trustfile = ['--ssl-trustfile', self.ssl_file('ca-certificate.pem')], bad_trustfile = ['--ssl-trustfile', self.ssl_file('bad-ca-certificate.pem')], client_cert = ['--ssl-certificate', self.ssl_file('client-certificate.pem')], client_key = ['--ssl-key', self.ssl_file('client-private-key.pem')], client_pass = ['--ssl-password-file', self.ssl_file('client-password-file.txt')]) args['client_cert_all'] = args['client_cert'] + args['client_key'] + args['client_pass'] return args except SSLUnavailable: class QdstatSslTest(system_test.TestCase): def test_skip(self): self.skipTest("Proton SSL support unavailable.") try: SSLDomain(SSLDomain.MODE_CLIENT) class QdstatSslNoExternalTest(system_test.TestCase): """Test qdstat can't connect without sasl_mech EXTERNAL""" @staticmethod def ssl_file(name): return os.path.join(system_test.DIR, 'ssl_certs', name) @staticmethod def sasl_path(): return os.path.join(system_test.DIR, 'sasl_configs') @classmethod def setUpClass(cls): super(QdstatSslNoExternalTest, cls).setUpClass() # Write SASL configuration file: with open('tests-mech-NOEXTERNAL.conf', 'w') as sasl_conf: sasl_conf.write("mech_list: ANONYMOUS DIGEST-MD5 PLAIN\n") # qdrouterd configuration: config = system_test.Qdrouterd.Config([ ('router', {'id': 'QDR.C', 'saslConfigPath': os.getcwd(), 'workerThreads': 1, 'saslConfigName': 'tests-mech-NOEXTERNAL'}), ('sslProfile', {'name': 'server-ssl', 'caCertFile': cls.ssl_file('ca-certificate.pem'), 'certFile': cls.ssl_file('server-certificate.pem'), 'privateKeyFile': cls.ssl_file('server-private-key.pem'), 'password': 'server-password'}), ('listener', {'port': cls.tester.get_port()}), ('listener', {'port': cls.tester.get_port(), 'sslProfile': 'server-ssl', 'authenticatePeer': 'no', 'requireSsl': 'yes'}), ('listener', {'port': cls.tester.get_port(), 'sslProfile': 'server-ssl', 'authenticatePeer': 'no', 'requireSsl': 'no'}), ('listener', {'port': cls.tester.get_port(), 'sslProfile': 'server-ssl', 'authenticatePeer': 'yes', 'requireSsl': 'yes', 'saslMechanisms': 'EXTERNAL'}) ]) cls.router = cls.tester.qdrouterd('test-router', config) def run_qdstat(self, args, regexp=None, address=None): p = self.popen( ['qdstat', '--bus', str(address or self.router.addresses[0]), '--timeout', str(system_test.TIMEOUT) ] + args, name='qdstat-'+self.id(), stdout=PIPE, expect=None, universal_newlines=True) out = p.communicate()[0] assert p.returncode == 0, \ "qdstat exit status %s, output:\n%s" % (p.returncode, out) if regexp: assert re.search(regexp, out, re.I), "Can't find '%s' in '%s'" % (regexp, out) return out def ssl_test(self, url_name, arg_names): """Run simple SSL connection test with supplied parameters. See test_ssl_* below. """ args = dict( trustfile = ['--ssl-trustfile', self.ssl_file('ca-certificate.pem')], bad_trustfile = ['--ssl-trustfile', self.ssl_file('bad-ca-certificate.pem')], client_cert = ['--ssl-certificate', self.ssl_file('client-certificate.pem')], client_key = ['--ssl-key', self.ssl_file('client-private-key.pem')], client_pass = ['--ssl-password', 'client-password']) args['client_cert_all'] = args['client_cert'] + args['client_key'] + args['client_pass'] addrs = [self.router.addresses[i] for i in range(4)]; urls = dict(zip(['none', 'strict', 'unsecured', 'auth'], addrs)) urls.update(zip(['none_s', 'strict_s', 'unsecured_s', 'auth_s'], (Url(a, scheme="amqps") for a in addrs))) self.run_qdstat(['--general'] + sum([args[n] for n in arg_names], []), regexp=r'(?s)Router Statistics.*Mode\s*Standalone', address=str(urls[url_name])) def ssl_test_bad(self, url_name, arg_names): self.assertRaises(AssertionError, self.ssl_test, url_name, arg_names) @SkipIfNeeded(not SASL.extended(), "Cyrus library not available. skipping test") def test_ssl_cert_to_auth_fail_no_sasl_external(self): self.ssl_test_bad('auth_s', ['client_cert_all']) def test_ssl_trustfile_cert_to_auth_fail_no_sasl_external(self): self.ssl_test_bad('auth_s', ['trustfile', 'client_cert_all']) except SSLUnavailable: class QdstatSslTest(system_test.TestCase): def test_skip(self): self.skipTest("Proton SSL support unavailable.") if __name__ == '__main__': unittest.main(main_module())
41.252058
137
0.57513
b9e6ec9227a128604285788b8ce1f1a02982cc48
7,256
lua
Lua
scripts/prefabs/balloon_beefalo.lua
Ophaneom/Balloons-2-Wes
4f1f0f3c9a291c012dfc56aaca6b1547ba1fba59
[ "MIT" ]
null
null
null
scripts/prefabs/balloon_beefalo.lua
Ophaneom/Balloons-2-Wes
4f1f0f3c9a291c012dfc56aaca6b1547ba1fba59
[ "MIT" ]
null
null
null
scripts/prefabs/balloon_beefalo.lua
Ophaneom/Balloons-2-Wes
4f1f0f3c9a291c012dfc56aaca6b1547ba1fba59
[ "MIT" ]
null
null
null
local assets = { Asset("ANIM", "anim/balloon.zip"), Asset("ANIM", "anim/balloon_shapes.zip"), } local prefabs = { "collapse_small", } local colours = { { 198/255, 43/255, 43/255, 1 }, { 79/255, 153/255, 68/255, 1 }, { 35/255, 105/255, 235/255, 1 }, { 233/255, 208/255, 69/255, 1 }, { 109/255, 50/255, 163/255, 1 }, { 222/255, 126/255, 39/255, 1 }, } local easing = require("easing") local repeatcount = 0 local balloons = {} local MAX_BALLOONS = 100 local num_balloons = 0 local function onsave(inst, data) data.num = inst.balloon_num data.colour_idx = inst.colour_idx end local function onload(inst, data) if data ~= nil then if data.num ~= nil and inst.balloon_num ~= data.num then inst.balloon_num = data.num inst.AnimState:OverrideSymbol("swap_balloon", "balloon_shapes", "balloon_"..tostring(inst.balloon_num)) end if data.colour_idx ~= nil and inst.colour_idx ~= data.colour_idx then inst.colour_idx = math.clamp(data.colour_idx, 1, #colours) inst.AnimState:SetMultColour(unpack(colours[inst.colour_idx])) end end end local function oncollide(inst, other) if (inst:IsValid() and Vector3(inst.Physics:GetVelocity()):LengthSq() > .1) or (other ~= nil and other:IsValid() and other.Physics ~= nil and Vector3(other.Physics:GetVelocity()):LengthSq() > .1) then --inst.SoundEmitter:PlaySound("dontstarve/common/balloon_bounce") end end local function updatemotorvel(inst, xvel, yvel, zvel, t0) local x, y, z = inst.Transform:GetWorldPosition() if y >= 35 then inst:Remove() return end local time = GetTime() - t0 if time >= 15 then inst:Remove() return elseif time < 1 then local scale = easing.inQuad(time, 1, -1, 1) inst.DynamicShadow:SetSize(scale, .5 * scale) else inst.DynamicShadow:Enable(false) end local hthrottle = easing.inQuad(math.clamp(time - 1, 0, 3), 0, 1, 3) yvel = easing.inQuad(math.min(time, 3), 1, yvel - 1, 3) inst.Physics:SetMotorVel(xvel * hthrottle, yvel, zvel * hthrottle) end local function UnregisterBalloon(inst) if balloons[inst] == nil then return end balloons[inst] = nil num_balloons = num_balloons - 1 inst.OnRemoveEntity = nil end local function flyoff(inst) UnregisterBalloon(inst) inst:AddTag("notarget") inst.Physics:SetCollisionCallback(nil) inst.persists = false local xvel = math.random() * 2 - 1 local yvel = 5 local zvel = math.random() * 2 - 1 inst:DoPeriodicTask(FRAMES, updatemotorvel, nil, xvel, yvel, zvel, GetTime()) end local function RegisterBalloon(inst) if balloons[inst] then return end if num_balloons >= TUNING.BALLOON_MAX_COUNT then local rand = math.random(num_balloons) for k, v in pairs(balloons) do if rand > 1 then rand = rand - 1 else flyoff(k) break end end end balloons[inst] = true num_balloons = num_balloons + 1 inst.OnRemoveEntity = UnregisterBalloon end --local function ontimerdone(inst, data) -- if data.name == "flyoff" then -- flyoff(inst) -- end --end local AREAATTACK_EXCLUDETAGS = { "INLIMBO", "notarget", "noattack", "flight", "invisible", "playerghost", "mime" } local function DoAreaAttack(inst) inst.components.combat:DoAreaAttack(inst, 2, nil, nil, nil, AREAATTACK_EXCLUDETAGS) end ------------------------------------------------------------------------------------------------------------------ local function OnDeath(inst) inst.AnimState:PlayAnimation("pop") inst.SoundEmitter:PlaySound("dontstarve/common/balloon_pop") SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition()) local x, y, z = inst.Transform:GetWorldPosition() for i = 1, TUNING.BTWS_BEEFALO_QNT do if TUNING.BTWS_BEEFALO_QNT == 1 then SpawnPrefab("babybeefalo").Transform:SetPosition(x, y, z) else local randx = x + math.random(- TUNING.BTWS_BEEFALO_RANGE, TUNING.BTWS_BEEFALO_RANGE) local randz = z + math.random(- TUNING.BTWS_BEEFALO_RANGE, TUNING.BTWS_BEEFALO_RANGE) SpawnPrefab("collapse_small").Transform:SetPosition(randx,y,randz) SpawnPrefab("babybeefalo").Transform:SetPosition(randx,y,randz) end end UnregisterBalloon(inst) RemovePhysicsColliders(inst) inst.DynamicShadow:Enable(false) inst:AddTag("NOCLICK") inst.persists = false local attack_delay = .1 + math.random() * .2 local remove_delay = math.max(attack_delay, inst.AnimState:GetCurrentAnimationLength()) + FRAMES inst:DoTaskInTime(attack_delay, DoAreaAttack) inst:DoTaskInTime(remove_delay, inst.Remove) end local function OnHaunt(inst) return true end ------------------------------------------------------------------------------------------------------------------ local function WaitExplosion(inst) inst.task = inst:DoPeriodicTask(1, OnDeath) end ------------------------------------------------------------------------------------------------------------------ local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddSoundEmitter() inst.entity:AddDynamicShadow() inst.entity:AddNetwork() MakeCharacterPhysics(inst, 10, .25) inst.Physics:SetFriction(.3) inst.Physics:SetDamping(0) inst.Physics:SetRestitution(1) inst.AnimState:SetBank("balloon") inst.AnimState:SetBuild("balloon") inst.AnimState:PlayAnimation("idle", true) inst.AnimState:SetRayTestOnBB(true) inst.DynamicShadow:SetSize(1, .5) inst:AddTag("cattoyairborne") inst:AddTag("balloon") inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst.Physics:SetCollisionCallback(oncollide) inst.AnimState:SetTime(math.random() * 2) inst.balloon_num = 2 inst.AnimState:OverrideSymbol("swap_balloon", "balloon_shapes", "balloon_"..tostring(inst.balloon_num)) inst.colour_idx = math.random(#colours) inst.AnimState:SetMultColour(unpack(colours[inst.colour_idx])) inst:AddComponent("inspectable") --------------------------------------------------------------------------------------------------------------------------------------- --// repeatcount = 0 inst.task = inst:DoPeriodicTask(TUNING.BTWS_DELAY_BEEFALO_BALLOON, WaitExplosion) inst:AddComponent("combat") inst.components.combat:SetDefaultDamage(0) inst:ListenForEvent("death", OnDeath) inst:AddComponent("health") inst.components.health:SetMaxHealth(1) inst.components.health.nofadeout = true inst:AddComponent("hauntable") inst.components.hauntable.cooldown_on_successful_haunt = false inst.components.hauntable:SetHauntValue(TUNING.HAUNT_TINY) inst.components.hauntable:SetOnHauntFn(OnHaunt) inst.OnSave = onsave inst.OnLoad = onload RegisterBalloon(inst) return inst end return Prefab("balloon_beefalo", fn, assets)
30.616034
135
0.626516
12bcb747cbd918c2a7815245225d6c56ebda427b
12,775
lua
Lua
technic/tools/multimeter.lua
mightyjoe781/technic
bc9a7759f3d902d2c72cd2763fe08e0e9fce4340
[ "DOC" ]
17
2020-02-20T06:32:56.000Z
2021-11-23T02:10:00.000Z
technic/tools/multimeter.lua
mightyjoe781/technic
bc9a7759f3d902d2c72cd2763fe08e0e9fce4340
[ "DOC" ]
193
2020-02-18T18:34:20.000Z
2022-03-30T12:22:03.000Z
technic/tools/multimeter.lua
mightyjoe781/technic
bc9a7759f3d902d2c72cd2763fe08e0e9fce4340
[ "DOC" ]
18
2020-06-30T11:55:52.000Z
2022-03-05T17:56:46.000Z
local S = technic.getter local remote_start_ttl = technic.config:get_int("multimeter_remote_start_ttl") local max_charge = 50000 local power_usage = 100 -- Normal network reading uses this much energy local rs_charge_multiplier = 100 -- Remote start energy requirement multiplier local texture = "technic_multimeter.png" local texture_logo = "technic_multimeter_logo.png" local texture_bg9 = "technic_multimeter_bg.png" local texture_button = "technic_multimeter_button.png" local texture_button_pressed = "technic_multimeter_button_pressed.png" local bgcolor = "#FFC00F" local bgcolor_lcd = "#4B8E66" local bghiglight_lcd = "#5CAA77" local textcolor = "#101010" --local bgcolor_button = "#626E41" local form_width = 8 local form_height = 11.5 local btn_count = 3 local btn_spacing = 0.1 local btn_width = (form_width - ((btn_count + 1) * btn_spacing)) / btn_count local open_formspecs = {} local formspec_escape = minetest.formspec_escape local function fmtf(n) return type(n) == "number" and ("%0.3f"):format(n) or n end local function fs_x_pos(i) return (btn_spacing * i) + (btn_width * (i - 1)) end local function create_button(index, y, h, name, label, exit, modifier) local x = fs_x_pos(index) local t1 = texture_button .. (modifier and formspec_escape(modifier) or "") local t2 = texture_button_pressed .. (modifier and formspec_escape(modifier) or "") local dimensions = ("%s,%s;%s,%s"):format(fmtf(x),fmtf(y),fmtf(btn_width),h) local properties = ("%s;%s;%s;false;false;%s"):format(t1, name, label, t2) return ("image_button%s[%s;%s]"):format(exit and "_exit" or "", dimensions, properties) end local formspec_format_string = "formspec_version[3]" .. ("size[%s,%s;]bgcolor[%s;both;]"):format(fmtf(form_width), fmtf(form_height), bgcolor) .. ("style_type[*;textcolor=%s;font_size=*1]"):format(textcolor) .. ("style_type[table;textcolor=%s;font_size=*1;font=mono]"):format(textcolor) .. ("style_type[label;textcolor=%s;font_size=*2]"):format(textcolor) .. ("background9[0,0;%s,%s;%s;false;3]"):format(fmtf(form_width), fmtf(form_height), texture_bg9) .. ("image[0.3,0.3;5.75,1;%s]"):format(texture_logo) .. "label[0.6,1.5;Network %s]" .. ("field[%s,2.5;%s,0.8;net;Network ID:;%%s]"):format(fmtf(fs_x_pos(2)),fmtf(btn_width)) .. create_button(3, "2.5", "0.8", "rs", "Remote start", false, "^[colorize:#10E010:125") .. create_button(1, form_height - 0.9, "0.8", "wp", "Waypoint", true) .. create_button(2, form_height - 0.9, "0.8", "up", "Update", false) .. create_button(3, form_height - 0.9, "0.8", "exit", "Exit", true) .. ("tableoptions[border=false;background=%s;highlight=%s;color=%s]"):format(bgcolor_lcd,bghiglight_lcd,textcolor) .. "tablecolumns[indent,width=0.2;text,width=13;text,width=13;text,align=center]" .. ("table[0.1,3.4;%s,%s;items;1,Property,Value,Unit%%s]"):format(fmtf(form_width - 0.2), fmtf(form_height - 4.4)) minetest.register_craft({ output = 'technic:multimeter', recipe = { {'basic_materials:copper_strip', 'technic:rubber', 'basic_materials:copper_strip'}, {'basic_materials:plastic_sheet', 'basic_materials:ic', 'basic_materials:plastic_sheet'}, {'technic:battery', 'basic_materials:ic', 'technic:copper_coil'}, } }) local function use_charge(itemstack, multiplier) if technic.creative_mode then -- Do not check charge in creative mode return true end local real_pwr_use = power_usage * (multiplier or 1) local meta = minetest.deserialize(itemstack:get_metadata()) if not meta or not meta.charge or meta.charge < real_pwr_use then -- Not enough energy available return false end meta.charge = meta.charge - real_pwr_use technic.set_RE_wear(itemstack, meta.charge, max_charge) itemstack:set_metadata(minetest.serialize(meta)) -- Charge used successfully return true end local function async_itemstack_get(player, refstack) local inv = player:get_inventory() local invindex, invstack if inv and refstack then local invsize = inv:get_size('main') local name = refstack:get_name() local count = refstack:get_count() local meta = refstack:get_meta() for i=1,invsize do local stack = inv:get_stack('main', i) if stack:get_count() == count and stack:get_name() == name and stack:get_meta():equals(meta) then -- This item stack seems very similar to one that were used originally, use this invindex = i invstack = stack break end end end return inv, invindex, invstack end --[[ Base58 local alpha = { "1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H", "J","K","L","M","N","P","Q","R","S","T","U","V","W","X","Y","Z", "a","b","c","d","e","f","g","h","i","j","k","m","n","o", "p","q","r","s","t","u","v","w","x","y","z" } --]] -- Base36 local alpha = { "0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H", "I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z" } local function base36(num) if type(num) ~= "number" then return end if num < 36 then return alpha[num + 1] end local result = "" while num ~= 0 do result = alpha[(num % 36) + 1] .. result num = math.floor(num / 36) end return result end -- Clean version of minetest.pos_to_string local function v2s(v) return ("%s,%s,%s"):format(v.x,v.y,v.z) end -- Size of hash table local function count(t) if type(t) ~= "table" then return 0 end local c=0 for _ in pairs(t) do c=c+1 end return c end -- Percentage value as string local function percent(val, max) if type(val) ~= "number" or type(max) ~= "number" then return "" end local p = (val / max) * 100 return p > 99.99 and "100" or ("%0.2f"):format(p) end -- Get network TTL local function net_ttl(net) return type(net.timeout) == "number" and (net.timeout - minetest.get_us_time()) end -- Microseconds to milliseconds local function us2ms(val) return type(val) == "number" and (val / 1000) or 0 end -- Microseconds to seconds local function us2s(val) return type(val) == "number" and (val / 1000 / 1000) or 0 end local function formspec(data) local tablerows = "" for _,row in ipairs(data.rows) do tablerows = tablerows .. ",1" .. "," .. formspec_escape(row[1] or "-") .. "," .. formspec_escape(row[2] or "-") .. "," .. formspec_escape(row[3] or "-") end local base36_net = base36(data.network_id) or "N/A" return formspec_format_string:format(base36_net, base36_net, tablerows) end local function multimeter_inspect(itemstack, player, pos, fault) local id = pos and technic.pos2network(pos) local rows = {} local data = { network_id = id, rows = rows } local name = player:get_player_name() if id and itemstack and not fault then table.insert(rows, { "Ref. point", v2s(technic.network2pos(id)), "coord" }) table.insert(rows, { "Activated", technic.active_networks[id] and "yes" or "no", "active" }) local net = technic.networks[id] if net then table.insert(rows, { "Timeout", ("%0.1f"):format(us2s(net_ttl(net))), "s" }) table.insert(rows, { "Lag", ("%0.2f"):format(us2ms(net.lag)), "ms" }) table.insert(rows, { "Skip", net.skip, "cycles" }) table.insert(rows, {}) local PR = net.PR_nodes local RE = net.RE_nodes local BA = net.BA_nodes local C = count(net.all_nodes) table.insert(rows, { "Supply", net.supply, "EU" }) table.insert(rows, { "Demand", net.demand, "EU" }) table.insert(rows, { "Battery charge", net.battery_charge, "EU" }) table.insert(rows, { "Battery charge", percent(net.battery_charge, net.battery_charge_max), "%" }) table.insert(rows, { "Battery capacity", net.battery_charge_max, "EU" }) table.insert(rows, {}) table.insert(rows, { "Nodes", C, "count" }) table.insert(rows, { "Cables", C - #PR - #RE - #BA, "count" }) -- FIXME: Do not count PR+RE duplicates table.insert(rows, { "Generators", #PR, "count" }) table.insert(rows, { "Consumers", #RE, "count" }) table.insert(rows, { "Batteries", #BA, "count" }) end else table.insert(rows, { "Operation failed", "", "" }) if not id then table.insert(rows, {}) table.insert(rows, { "Bad contact", "No network", "Fault" }) end if fault then table.insert(rows, {}) end if fault == "battery" then table.insert(rows, { "Recharge", "Insufficient charge", "Fault" }) elseif fault == "decode" then table.insert(rows, { "Decoder error", "Net ID decode", "Fault" }) elseif fault == "switchload" then table.insert(rows, { "Remote load error", "Load switching station", "Fault" }) elseif fault == "cableload" then table.insert(rows, { "Remote load error", "Load ref. cable", "Fault" }) elseif fault == "protected" then table.insert(rows, { "Protection error", "Area is protected", "Access" }) end if not itemstack then table.insert(rows, {}) table.insert(rows, { "Missing FLUTE", "FLUTE not found", "Fault" }) end end open_formspecs[name] = { pos = pos, itemstack = itemstack } minetest.show_formspec(name, "technic:multimeter", formspec(data)) end local function remote_start_net(player, pos) local sw_pos = {x=pos.x,y=pos.y+1,z=pos.z} -- Try to load switch network node with VoxelManip local sw_node = technic.get_or_load_node(sw_pos) or minetest.get_node(sw_pos) if sw_node.name ~= "technic:switching_station" then return "switchload" end -- Try to load network node with VoxelManip local tier = technic.sw_pos2tier(sw_pos, true) if not tier then return "cableload" end -- Check protections if minetest.is_protected(pos, player:get_player_name()) then return "protected" end -- All checks passed, start network local network_id = technic.sw_pos2network(sw_pos) or technic.create_network(sw_pos) technic.activate_network(network_id, remote_start_ttl) end local function async_itemstack_use_charge(itemstack, player, multiplier) local fault = nil local inv, invindex, invstack = async_itemstack_get(player, itemstack) if not inv or not invindex or not use_charge(invstack, multiplier) then -- Multimeter battery empty fault = "battery" elseif invstack then inv:set_stack('main', invindex, invstack) end return invstack, fault end minetest.register_on_player_receive_fields(function(player, formname, fields) if formname ~= "technic:multimeter" then -- Not our formspec, tell engine to continue with other registered handlers return end local name = player:get_player_name() local flute = open_formspecs[name] if fields and name then local pos = flute and flute.pos if fields.up then local itemstack = flute and flute.itemstack local invstack, fault = async_itemstack_use_charge(itemstack, player) multimeter_inspect(invstack, player, pos, fault) return true elseif fields.wp and pos then local network_id = technic.pos2network(pos) local encoded_net_id = base36(network_id) if encoded_net_id then local net_pos = technic.network2pos(network_id) local id = player:hud_add({ hud_elem_type = "waypoint", name = ("Network %s"):format(encoded_net_id), text = "m", number = 0xE0B020, world_pos = net_pos }) minetest.after(90, function() if player then player:hud_remove(id) end end) end elseif fields.rs and fields.net and fields.net ~= "" then -- Use charge first before even attempting remote start local itemstack = flute and flute.itemstack local invstack, fault = async_itemstack_use_charge(itemstack, player, rs_charge_multiplier) if not fault then local net_id = tonumber(fields.net, 36) local net_pos = net_id and technic.network2pos(net_id) if net_pos then fault = remote_start_net(player, net_pos) else fault = "decode" end end multimeter_inspect(invstack, player, pos, fault) return true elseif fields.quit then open_formspecs[name] = nil end end -- Tell engine to skip rest of formspec handlers return true end) local function check_node(pos) local name = minetest.get_node(pos).name if technic.machine_tiers[name] or technic.get_cable_tier(name) or name == "technic:switching_station" then return name end end technic.register_power_tool("technic:multimeter", max_charge) minetest.register_tool("technic:multimeter", { description = S("Multimeter"), inventory_image = texture, wield_image = texture, stack_max = 1, liquids_pointable = false, wear_represents = "technic_RE_charge", on_refill = technic.refill_RE_charge, on_use = function(itemstack, player, pointed_thing) local pos = minetest.get_pointed_thing_position(pointed_thing, false) if pos and pointed_thing.type == "node" then local name = check_node(pos) if name then if name == "technic:switching_station" then -- Switching station compatibility shim pos.y = pos.y - 1 end open_formspecs[player:get_player_name()] = nil multimeter_inspect(itemstack, player, pos, not use_charge(itemstack) and "battery") end end return itemstack end, })
39.067278
115
0.69456
c70a5624f3dfb35a9a3edf199a890b60dd5d21a0
246
sql
SQL
db/migrations/2004190227_add_column_ended_at_into_attempts_table.sql
France-ioi/algorea-backend
578dccae3254eb8f87b0b163c5bd98d8029a84a7
[ "MIT" ]
null
null
null
db/migrations/2004190227_add_column_ended_at_into_attempts_table.sql
France-ioi/algorea-backend
578dccae3254eb8f87b0b163c5bd98d8029a84a7
[ "MIT" ]
794
2018-11-26T07:31:58.000Z
2022-03-30T15:25:21.000Z
db/migrations/2004190227_add_column_ended_at_into_attempts_table.sql
France-ioi/algorea-backend
578dccae3254eb8f87b0b163c5bd98d8029a84a7
[ "MIT" ]
4
2018-12-20T02:51:08.000Z
2021-07-02T02:55:22.000Z
-- +migrate Up ALTER TABLE `attempts` ADD COLUMN `ended_at` DATETIME DEFAULT NULL COMMENT 'Time at which the attempt was (typically manually) ended' AFTER `created_at`; -- +migrate Down ALTER TABLE `attempts` DROP COLUMN `ended_at`;
30.75
70
0.723577
7f4b76e6247f360098416f226d1d903847ff3283
114
go
Go
vendor/src/github.com/juju/utils/filestorage/export_test.go
cmars/oo
b6985945fcf62258a1e153f7e805021a85114cd6
[ "Apache-2.0" ]
54
2017-06-25T18:58:09.000Z
2020-07-23T15:23:55.000Z
vendor/src/github.com/juju/utils/filestorage/export_test.go
cmars/oo
b6985945fcf62258a1e153f7e805021a85114cd6
[ "Apache-2.0" ]
39
2017-07-10T07:06:23.000Z
2019-03-06T21:08:15.000Z
vendor/src/github.com/juju/utils/filestorage/export_test.go
cmars/oo
b6985945fcf62258a1e153f7e805021a85114cd6
[ "Apache-2.0" ]
8
2017-07-06T09:53:35.000Z
2018-11-20T18:21:56.000Z
// Copyright 2014 Canonical Ltd. // Licensed under the LGPLv3, see LICENCE file for details. package filestorage
22.8
59
0.780702
3c64437e16b4087e3c70475011ffb689c7f1d6f0
3,238
kt
Kotlin
compiler/tests-spec/testData/diagnostics/helpers/classes.kt
AndrewReitz/kotlin
ec6904afd15ba6f9aefafdfa8d5618aab25e334e
[ "ECL-2.0", "Apache-2.0" ]
1
2021-02-27T19:54:10.000Z
2021-02-27T19:54:10.000Z
compiler/tests-spec/testData/diagnostics/helpers/classes.kt
AndrewReitz/kotlin
ec6904afd15ba6f9aefafdfa8d5618aab25e334e
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
compiler/tests-spec/testData/diagnostics/helpers/classes.kt
AndrewReitz/kotlin
ec6904afd15ba6f9aefafdfa8d5618aab25e334e
[ "ECL-2.0", "Apache-2.0" ]
1
2021-04-30T12:59:05.000Z
2021-04-30T12:59:05.000Z
class Class { val prop_1 = 1 val prop_2 = 2 val prop_3 = 3 val prop_4: Float? = 3f val prop_5: Float = 3f val prop_6: String = "..." val prop_7: Nothing? = null val prop_8: Class? = null var prop_9: Boolean = true val prop_10: Number? = 3f val prop_11: Int = 10 var prop_12: String = "" val prop_13: Any? = "" val prop_14: Comparable<*>? = "" val prop_15: Iterable<*>? = "" fun fun_1(): (Int) -> (Int) -> Int = {number: Int -> { number * 5 }} fun fun_2(value_1: Int): Int = value_1 * 2 fun fun_3(value_1: Int): (Int) -> Int = fun(value_2: Int): Int = value_1 * value_2 * 2 fun fun_4(): Class? = Class() operator fun get(i1: Int, i2: Int) = 10 operator fun set(i1: Int, i2: Int, el: Int) {} operator fun get(i1: Int) = 10 operator fun set(i1: Int, el: Int) {} operator fun invoke() {} operator fun invoke(x) = { x: Any -> x } operator fun invoke(x: Any, y: Any) {} operator fun contains(a: Int) = a > 30 operator fun contains(a: Long) = a > 30L operator fun contains(a: Char) = a > 30.toChar() fun getIntArray() = intArrayOf(1, 2, 3, 4, 5) fun getLongArray() = longArrayOf(1L, 2L, 3L, 4L, 5L) fun getCharArray() = charArrayOf(1.toChar(), 2.toChar(), 3.toChar(), 4.toChar(), 5.toChar()) class NestedClass { val prop_4 = 4 val prop_5 = 5 } } operator fun Class?.inc(): Class? = null operator fun Class?.dec(): Class? = null operator fun Class?.plus(x: Class?): Class? = null operator fun Class?.minus(x: Class?): Class? = null open class ClassWithCustomEquals { override fun equals(other: Any?) = true } open class ClassWithCostructorParam(val x: Any) open class ClassWithCostructorTwoParams(val x: Any, val y: Any) class EmptyClass {} class ClassWithCompanionObject { companion object {} } open class ClassLevel1 { fun test1() {} } open class ClassLevel2: ClassLevel1() { fun test2() {} } open class ClassLevel21: ClassLevel1() { fun test21() {} } open class ClassLevel22: ClassLevel1() { fun test22() {} } open class ClassLevel23: ClassLevel1() { fun test23() {} } open class ClassLevel3: ClassLevel2() { fun test3() {} } open class ClassLevel4: ClassLevel3() { fun test4() {} } open class ClassLevel5: ClassLevel4() { fun test5() {} } class ClassLevel6: ClassLevel5() { fun test6() {} } class Inv<T>(val x: T = null as T) { val prop_1: Inv<T>? = null val prop_2: T? = null val prop_3: T = null val prop_4 = 10 fun test() {} fun get() = x fun put(x: T) {} fun getNullable(): T? = select(x, null) } class In<in T>() { fun put(x: T) {} fun <K : T> getWithUpperBoundT(): K = x <!UNCHECKED_CAST!>as K<!> } class Out<out T>(val x: T = null as T) { val prop_1: Inv<T>? = null val prop_2: T? = null fun get() = x } open class ClassWithTwoTypeParameters<K, L> { fun test1(): T? { return null } fun test2(): K? { return null } } open class ClassWithThreeTypeParameters<K, L, M>( val x: K, val y: L, val z: M ) open class ClassWithSixTypeParameters<K, in L, out M, O, in P, out R>( val u: R, val x: K, val y: M, val z: O ) { fun test() = 10 }
24.345865
96
0.595738
290548ed0a0011616663924ce78ad31d49d08574
3,473
py
Python
org/tradesafe/bt/position.py
shenbai/tradesafe
b6bb843288f535d7d146426fd40750f7484a16e6
[ "MIT" ]
null
null
null
org/tradesafe/bt/position.py
shenbai/tradesafe
b6bb843288f535d7d146426fd40750f7484a16e6
[ "MIT" ]
null
null
null
org/tradesafe/bt/position.py
shenbai/tradesafe
b6bb843288f535d7d146426fd40750f7484a16e6
[ "MIT" ]
2
2021-08-21T17:26:29.000Z
2022-02-18T21:40:24.000Z
# coding: utf-8 __author__ = 'tack' class Position(object): ''' position ''' def __init__(self, code, num, price, commission, date): ''' Args: code: stock code price: cost price commission: commission num: num date: date ''' self.code = code self.num = num self.date = date self.commission = commission self.cost = price * self.num + commission self.cost_price = self.cost / self.num self.market_price = price def add(self, position): ''' buy some ''' if position is None: raise Exception('position is none') if position.code != self.code: raise Exception('add op can not apply on different stocks') self.cost += position.cost self.num += position.num self.cost_price = self.cost / self.num self.market_price = position.market_price return True, 'buy' def sub(self, sell_position=None): ''' sell some ''' if sell_position is None: raise Exception('position is none') if sell_position.code != self.code: raise Exception('sub op can not apply on different stocks') if sell_position.num <= self.num: self.cost -= sell_position.get_market_value() # total cost - market value self.num -= sell_position.num self.update(market_price=sell_position.market_price) if self.num == 0: self.cost_price = 0. return True, 'sell' self.cost_price = self.cost / self.num return True, 'sell' else: return False, 'no enough stocks to sell' def update(self, market_price=None): ''' update market price ''' self.market_price = market_price def get_cost_value(self): ''' value ''' # return self.cost_price * self.num return self.cost def get_market_value(self, market_price=None): ''' get market value of the position ''' if market_price is not None: self.market_price = market_price if self.market_price is None: raise Exception('you need to update market price.') return self.market_price * self.num def get_profit(self): ''' paper loss, paper gain ''' return self.get_market_value() - self.cost def get_profit_ratio(self): return (self.get_market_value() - self.cost) / self.cost * 100 def __repr__(self): return 'code=%s,cost=%f,cost_price=%f, market_price=%f,num=%d,value=%f,profit=%f,date=%s' % (self.code, self.cost, self.cost_price,self.market_price, self.num, self.get_market_value(), self.get_profit(), self.date) def get(self): return (self.code, self.num, self.cost_price, self.date) class PosstionHistory(object): ''' history of position ''' def __init__(self): self.phs = {} def update(self, position): ''' when the market close, update positions :param position: :return: ''' if position.code in self.phs: self.phs[position.code].append(position) else: self.phs[position.code] = [position] def get_history(self, code): return self.phs.get(code, None)
28.702479
222
0.564354
233eac3b98d24498454a9f05750a55bea63a1d9a
1,583
swift
Swift
SMABannerView/ViewController.swift
simplymadeapps/SMABannerView
fcfee39b35c3054d20889f61ffc05275345ce5b6
[ "MIT" ]
1
2016-05-05T16:30:10.000Z
2016-05-05T16:30:10.000Z
SMABannerView/ViewController.swift
simplymadeapps/SMABannerView
fcfee39b35c3054d20889f61ffc05275345ce5b6
[ "MIT" ]
null
null
null
SMABannerView/ViewController.swift
simplymadeapps/SMABannerView
fcfee39b35c3054d20889f61ffc05275345ce5b6
[ "MIT" ]
null
null
null
// // ViewController.swift // SMABannerView // // Created by Bill Burgess on 5/5/16. // Copyright © 2016 Simply Made Apps. All rights reserved. // import UIKit class ViewController: UIViewController { var simpleBannerView: SMABannerView? override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } @IBAction func showSimpleButtonPressed() { if simpleBannerView == nil { simpleBannerView = SMABannerView(title: "Simple Title", message: "Simple Message to display", view: self.view) simpleBannerView?.backgroundColor = UIColor.blueColor() simpleBannerView?.titleColor = UIColor.whiteColor() simpleBannerView?.messageColor = UIColor.whiteColor() } simpleBannerView?.show() } @IBAction func hideSimpleButtonPressed() { simpleBannerView?.hide() simpleBannerView = nil } @IBAction func showBannerWithDuration() { let banner = SMABannerView(title: "Banner View", message: "This banner will dismiss automatically.", view: self.view) banner.backgroundColor = UIColor.redColor() banner.titleColor = UIColor.whiteColor() banner.messageColor = UIColor.whiteColor() banner.show(5) { print("This is the dismiss completion block") } } }
29.314815
125
0.646241
7d1e2f3299cce350837571f2913eed0bf67e2647
4,688
swift
Swift
iOSExample/Pods/BDNetworking/BDNetworking/Components/Generators/RequestGenerator/BDRequestGenerator.swift
BDogs/BDNetworking
50c556698ab23aad1f3bdf7876b0970b36f679d9
[ "MIT" ]
null
null
null
iOSExample/Pods/BDNetworking/BDNetworking/Components/Generators/RequestGenerator/BDRequestGenerator.swift
BDogs/BDNetworking
50c556698ab23aad1f3bdf7876b0970b36f679d9
[ "MIT" ]
null
null
null
iOSExample/Pods/BDNetworking/BDNetworking/Components/Generators/RequestGenerator/BDRequestGenerator.swift
BDogs/BDNetworking
50c556698ab23aad1f3bdf7876b0970b36f679d9
[ "MIT" ]
null
null
null
// // BDRequestGenerator.swift // BDNetworkForSwift // // Created by 诸葛游 on 2017/4/13. // Copyright © 2017年 品驰医疗. All rights reserved. // import Foundation import Alamofire public enum BDParameterEncoding { case json case url case propertyList var encoding: ParameterEncoding { get { switch self { case .json: return JSONEncoding.default case .url: return URLEncoding.default case .propertyList: return PropertyListEncoding.default } } } } class BDRequestGenerator { static let shareInstance = BDRequestGenerator() // MARK: - public func /// public func gernerateApiRequest ( serviceIdentifier: String, requestParams: [String: Any]? = nil, relativeUrl: String, method: BDAPIRequestType = .get, encodingType: BDParameterEncoding) -> URLRequest? { guard let service = BDServiceFactory.shareInstance.serviceWithIdentifier(identifier: serviceIdentifier) else { // 这里认为 Service 为 nil,它的生成失败是派生类的定义有问题,需要提醒开发者 return nil } var urlString = service.appendURL(relativeUrl: relativeUrl) var params: [String: Any]? = requestParams == nil ? [:] : requestParams! // 添加全局公共参数 let commonParams = BDCommonParamsGenerator.commonParamsDictionary() for (key, value) in commonParams { params?[key] = value } // // 添加 Service 的 extraParmas // let extraParmas = service?.extraParams // for (key, value) in extraParmas! { // params?[key] = value // } if method == .get { if let theParams = params { urlString += "?" for (key, value) in theParams { urlString += "\(key)=\(value)&" } urlString.remove(at: urlString.index(before: urlString.endIndex)) } params = nil } // Alamofire 创建 URLRequest var request: URLRequest? let encoding: ParameterEncoding = encodingType.encoding//URLEncoding.default//JSONEncoding.default do { request = try URLRequest(url: urlString, method: HTTPMethod(rawValue: method.rawValue)!, headers: service.headerFields) request = try encoding.encode(request!, with: params) } catch { request = nil } // request?.requestParams = params // request?.service = service return request } public func generateGETRequest( serviceIdentifier: String, requestParams: [String: Any]? = nil, relativeUrl: String, encodingType: BDParameterEncoding) -> URLRequest? { return gernerateApiRequest(serviceIdentifier: serviceIdentifier, requestParams: requestParams, relativeUrl: relativeUrl, method: .get, encodingType: encodingType) } func generatePOSTRequest( serviceIdentifier: String, requestParams: [String: Any]? = nil, relativeUrl: String, encodingType: BDParameterEncoding) -> URLRequest? { return gernerateApiRequest(serviceIdentifier: serviceIdentifier, requestParams: requestParams, relativeUrl: relativeUrl, method: .post, encodingType: encodingType) } func generatePUTRequest( serviceIdentifier: String, requestParams: [String: Any]? = nil, relativeUrl: String, encodingType: BDParameterEncoding) -> URLRequest? { return gernerateApiRequest(serviceIdentifier: serviceIdentifier, requestParams: requestParams, relativeUrl: relativeUrl, method: .put, encodingType: encodingType) } func generateDELETERequest( serviceIdentifier: String, requestParams: [String: Any]? = nil, relativeUrl: String, encodingType: BDParameterEncoding) -> URLRequest? { return gernerateApiRequest(serviceIdentifier: serviceIdentifier, requestParams: requestParams, relativeUrl: relativeUrl, method: .delete, encodingType: encodingType) } // TODO: TODO:上传和下载 func generateUPLOADRequest() -> URLRequest? { return nil } func generateDOWNLOADRequest() -> URLRequest? { return nil } }
32.783217
177
0.573166
fe50a809a3aafa8d3ad0794167206214dba91995
95,502
c
C
obfs_analysis/test_bins/wc/obfs_9.c
whj0401/RLOBF
2755eb5e21e4f2445a7791a1159962e80a5739ca
[ "MIT" ]
3
2020-12-11T06:15:17.000Z
2021-04-24T07:09:03.000Z
obfs_analysis/test_bins/wc/obfs_9.c
whj0401/RLOBF
2755eb5e21e4f2445a7791a1159962e80a5739ca
[ "MIT" ]
null
null
null
obfs_analysis/test_bins/wc/obfs_9.c
whj0401/RLOBF
2755eb5e21e4f2445a7791a1159962e80a5739ca
[ "MIT" ]
2
2021-03-10T17:46:33.000Z
2021-03-31T08:00:27.000Z
/* This file has been generated by the Hex-Rays decompiler. Copyright (c) 2007-2017 Hex-Rays <info@hex-rays.com> Detected compiler: GNU C++ */ #include <defs.h> #include <stdarg.h> //------------------------------------------------------------------------- // Function declarations void *init_proc(); int sub_8048E90(); // int strcmp(const char *s1, const char *s2); // int __cdecl open64(_DWORD, _DWORD); weak // ssize_t read(int fd, void *buf, size_t nbytes); // int printf(const char *format, ...); // int fflush(FILE *stream); // void free(void *ptr); // void *memcpy(void *dest, const void *src, size_t n); // int fclose(FILE *stream); // int getc_unlocked(FILE *stream); // int __stdcall fseeko64(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); weak // int memcmp(const void *s1, const void *s2, size_t n); // int sysconf(int name); // int ferror_unlocked(FILE *stream); // size_t fwrite(const void *ptr, size_t size, size_t n, FILE *s); // int __cdecl __fxstat64(_DWORD, _DWORD, _DWORD); weak // size_t __ctype_get_mb_cur_max(void); // char *strcpy(char *dest, const char *src); // size_t __fpending(FILE *fp); // size_t mbrtowc(wchar_t *pwc, const char *s, size_t n, mbstate_t *p); // int __cdecl __cxa_atexit(_DWORD, _DWORD, _DWORD); weak // void error(int status, int errnum, const char *format, ...); // char *getenv(const char *name); // void *realloc(void *ptr, size_t size); // void *malloc(size_t size); // int sysinfo(struct sysinfo *info); // int __freading(FILE *fp); // void exit(int status); // char *gettext(const char *msgid); // FILE *fdopen(int fd, const char *modes); // int feof(FILE *stream); // int __cdecl fputs_unlocked(_DWORD, _DWORD); weak // char *strchr(const char *s, int c); // int fscanf(FILE *stream, const char *format, ...); // size_t strlen(const char *s); // int fprintf(FILE *stream, const char *format, ...); // void *memset(void *s, int c, size_t n); // int ungetc(int c, FILE *stream); // int *__errno_location(void); // void *memchr(const void *s, int c, size_t n); // int fileno(FILE *stream); // int fgetc(FILE *stream); // char *nl_langinfo(nl_item item); // char *setlocale(int category, const char *locale); // char *strrchr(const char *s, int c); // int __cdecl getdelim(_DWORD, _DWORD, _DWORD, _DWORD); weak // int __stdcall lseek64(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); weak // int __cdecl posix_fadvise64(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); weak // int strncmp(const char *s1, const char *s2, size_t n); // void abort(void); // int __cdecl __xstat64(_DWORD, _DWORD, _DWORD); weak // int close(int fd); // const unsigned __int16 **__ctype_b_loc(void); // int putchar_unlocked(int c); // int _gmon_start__(void); weak void sub_8049353(); void sub_8049370(); int sub_8049380(); int sub_80493F0(); int sub_8049410(); void sub_804946F(); void sub_804948A(); signed int sub_804949A(); void sub_804957C(); void sub_8049597(); int sub_80495A7(); int sub_80495ED(); void sub_80496B5(); void sub_80496D0(); int sub_80496E0(); void sub_80497C2(); void sub_80497DD(); int sub_80497ED(); int nullsub_3(void); // weak int sub_804984B(); void sub_80498FB(); void sub_8049916(); signed int sub_8049926(); void sub_8049A08(); void sub_8049A23(); int sub_8049A33(); // int __usercall sub_8049AE5@<eax>(void (__cdecl *a1)(int *)@<eax>); void sub_8049B31(); void sub_8049B4C(); int sub_8049B5C(); int __cdecl sub_8049C31(unsigned __int8 a1); int sub_8049C43(); int __cdecl sub_8049E25(int a1); void __cdecl __noreturn sub_8049E5D(int status); // idb // unsigned int __usercall sub_8049F93@<eax>(int a1@<edi>, int a2@<esi>, unsigned __int64 a3, unsigned __int64 a4, unsigned __int64 a5, unsigned __int64 a6, unsigned __int64 a7, char *a8); // int __usercall sub_804A1B6@<eax>(const unsigned __int16 *a1@<edi>, unsigned int a2@<esi>, int fd, int a4, int a5, int a6, int a7); // int __usercall sub_804B29C@<eax>(const unsigned __int16 *a1@<edi>, unsigned int a2@<esi>, char *s1, int a4); _DWORD *__cdecl sub_804B411(unsigned int a1, int a2); int __cdecl sub_804B5B2(int argc, char **argv); // idb _DWORD *__cdecl sub_804C121(int a1); _DWORD *__cdecl sub_804C18B(int a1); int __cdecl sub_804C1F2(int *a1, signed int *a2); int __cdecl sub_804C2D8(_DWORD *a1); int __cdecl sub_804C327(void *ptr); // idb int __cdecl sub_804C4E6(int a1, int a2, int a3, int a4, int a5, int a6); // int __usercall sub_804C58F@<eax>(int a1@<edi>, int a2@<esi>, unsigned __int64 a3, int a4); bool __cdecl sub_804C6FD(unsigned __int8 a1); long double sub_804C744(); long double sub_804C80D(); char *__cdecl sub_804C8E4(char *s); int __fastcall sub_804CA30(int ecx0, int edx0, int a1, char a2, int a3); int *__cdecl sub_804CB4F(int *a1, int a2, int a3); // int *__userpurge sub_804CBB0@<eax>(int *a1, int a2); int __cdecl sub_804CC66(char *msgid, int); // idb // unsigned int __usercall sub_804CD21@<eax>(size_t a1@<ebx>, int a2, unsigned int a3, char *a4, size_t a5, signed int a6, int a7, int a8, char *a9, char *a10); void *__cdecl sub_804DB31(char *a1, size_t a2, _DWORD *a3, int *a4); void *__cdecl sub_804DD50(signed int a1, char *a2, size_t a3, int a4); void *__cdecl sub_804DFE4(signed int a1, char *a2); void *__cdecl sub_804E00E(signed int a1, char *a2, size_t a3); void *__cdecl sub_804E084(signed int a1, int a2, char *a3); void *__cdecl sub_804E0C2(signed int a1, int a2, char *a3, size_t a4); void *__cdecl sub_804E0FF(int a1, char *a2); // void *__usercall sub_804E15A@<eax>(int a1@<edx>, int a2@<ecx>, char *a3, size_t a4, char a5); // void *__usercall sub_804E214@<eax>(int a1@<edx>, int a2@<ecx>, char *a3, char a4); // void *__usercall sub_804E281@<eax>(int a1@<edx>, int a2@<ecx>, char *a3); void *__cdecl sub_804E2E6(signed int a1, int a2, char *a3); void *__cdecl sub_804E397(signed int a1, int a2, int a3, char *a4); void *__cdecl sub_804E3EB(signed int a1, int a2, int a3, char *a4, size_t a5); void *__cdecl sub_804E515(signed int a1, char *a2, size_t a3); void *__cdecl sub_804E570(signed int a1, char *a2); int __cdecl sub_804E5CD(int a1); int __cdecl sub_804E6B0(_DWORD *a1); _DWORD *__cdecl sub_804E7E7(_DWORD *a1); int __cdecl sub_804EA18(FILE *stream, int); // idb ssize_t __cdecl sub_804ED4F(int fd, void *buf, size_t nbytes); int __cdecl sub_804EDB1(FILE *stream, int, int, int, int, int); // idb int __cdecl sub_804F40A(FILE *stream, int, int, int, int); // idb int sub_804F480(FILE *stream, int a2, int a3, int a4, ...); int __cdecl sub_804F538(unsigned int a1, unsigned int a2); int sub_804F577(); // weak void *__cdecl sub_804F5DF(void *ptr, int a2, int a3); int __cdecl sub_804F676(size_t size); // idb int __cdecl sub_804F689(size_t size); // idb int sub_804F6D2(); // weak void *__cdecl sub_804F6D7(void *ptr, size_t size); void *__cdecl sub_804F7AF(void *src, size_t n); void __noreturn sub_804F7FD(); void sub_804F836(); void sub_804F83B(); int __cdecl sub_804F85E(FILE *stream); // idb int __cdecl sub_804F93A(FILE *a1); int __cdecl sub_804F973(FILE *fp); // idb int __cdecl sub_804F9B3(FILE *stream, int a2, int a3, int a4); size_t __cdecl sub_804FAC2(wchar_t *pwc, char *s, size_t n, mbstate_t *p); int __cdecl sub_804FB34(int a1, int a2); int __cdecl sub_804FB72(int a1, int a2); int __cdecl sub_804FBBC(char *format, int, int); // idb int __cdecl sub_804FCE8(char *format, int, int, int, int); // idb int __cdecl sub_804FD91(int a1, int a2); _BOOL4 __cdecl sub_804FF8A(int a1, unsigned int a2); int __cdecl sub_804FFCE(int a1, unsigned int a2); void __noreturn sub_80500B0(); int sub_80500E9(); int sub_80500F3(); int sub_80500FD(); int __cdecl sub_8050130(unsigned __int8 *a1, unsigned __int8 *a2); int __cdecl sub_80501A1(FILE *fp); // idb int __cdecl sub_8050222(int category); // idb void *sub_8050280(); const char *sub_8050788(); int __cdecl sub_8050A20(int a1); // int __usercall sub_8050A5C@<eax>(int a1@<edi>, int a2@<esi>, int a3, int a4, unsigned int a5, int a6); int __cdecl sub_8050C8B(unsigned __int64 a1, __int64 a2); int __cdecl sub_8050E7E(int a1); int __cdecl sub_8050EAD(int a1, int a2); int __cdecl sub_8050EEC(int a1, int a2); int sub_805104D(void); // weak int sub_80510DD(void); // weak int __stdcall sub_80511B7(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // weak int (**sub_80511D0())(); void term_proc(); //------------------------------------------------------------------------- // Data declarations _UNKNOWN loc_804A37E; // weak _UNKNOWN loc_804A3B1; // weak _UNKNOWN loc_804A3F7; // weak _UNKNOWN loc_804A70F; // weak _UNKNOWN loc_804A855; // weak _UNKNOWN loc_804A8BC; // weak _UNKNOWN loc_804A94F; // weak _UNKNOWN loc_804A9DB; // weak _UNKNOWN loc_804AA2A; // weak _UNKNOWN loc_804AFFC; // weak _UNKNOWN loc_804B04C; // weak _UNKNOWN loc_804B060; // weak _UNKNOWN loc_804B0E4; // weak _UNKNOWN loc_804B5A9; // weak _UNKNOWN loc_804CA94; // weak _UNKNOWN loc_804CA99; // weak _UNKNOWN loc_804CE02; // weak _UNKNOWN loc_804CE19; // weak _UNKNOWN loc_804CF62; // weak _UNKNOWN loc_804CFC8; // weak _UNKNOWN loc_804D453; // weak _UNKNOWN loc_804D45C; // weak _UNKNOWN loc_804D696; // weak _UNKNOWN loc_804D71A; // weak _UNKNOWN loc_804D7A7; // weak _UNKNOWN loc_804D7AC; // weak _UNKNOWN loc_804D8FF; // weak _UNKNOWN loc_804D982; // weak _UNKNOWN locret_804FAC0; // weak _UNKNOWN loc_805074F; // weak _UNKNOWN loc_8050AD5; // weak _UNKNOWN loc_8050AFC; // weak _UNKNOWN loc_8050B87; // weak int dword_8051BC0[8] = { 6656, 4294967279, 4294967294, 2147483646, 0, 0, 0, 0 }; // idb _UNKNOWN unk_8051D25; // weak _UNKNOWN unk_8052457; // weak int dword_8053F0C = 3326152718; // weak int (*off_8055EEC[2])() = { &sub_8049410, &sub_80493F0 }; // weak int (*off_8055EF0)() = &sub_80493F0; // weak int (*dword_8056008)(void) = NULL; // weak int dword_8056134 = 0; // weak int dword_8056154 = 0; // weak int dword_8056168 = 0; // weak int (__fastcall *dword_8056184)(_DWORD, _DWORD) = NULL; // weak int dword_805619C = 0; // weak int status = 1; // idb int dword_80561B8 = 1; // weak int dword_80561BC = 256; // weak void *off_80561C0 = &unk_80565FB; // weak int *off_80561C4 = &dword_80561BC; // weak _UNKNOWN unk_80561D8; // weak _UNKNOWN unk_80561F8; // weak _UNKNOWN unk_80561FB; // weak _UNKNOWN unk_80561FC; // weak _UNKNOWN unk_80561FF; // weak _UNKNOWN unk_8056200; // weak _UNKNOWN unk_8056203; // weak void (__noreturn *off_8056208)() = &sub_80500B0; // weak _UNKNOWN unk_805620C; // weak _UNKNOWN unk_805620F; // weak int program_invocation_short_name; // weak FILE *stderr; // idb int program_invocation_name; // weak FILE *stdout; // idb int (*obstack_alloc_failed_handler)(void); // weak char byte_805628C; // weak char byte_8056366; // weak __int64 qword_805656B; // weak __int64 qword_8056573; // weak __int64 qword_805657B; // weak __int64 qword_8056583; // weak __int64 qword_805658B; // weak char byte_8056593; // weak char byte_8056594; // weak char byte_8056595; // weak char byte_8056596; // weak char byte_8056597; // weak int dword_805659B; // weak char byte_805659F; // weak int dword_80565A3; // weak int dword_80565B3; // weak int dword_80565BB; // weak int dword_80565BF; // weak int dword_80565C3; // weak int dword_80565C7; // weak int dword_80565CB; // weak int dword_80565CF; // weak int dword_80565D3; // weak int dword_80565D7; // weak int dword_80565DB; // weak int dword_80565DF; // weak int dword_80565E3; // weak int dword_80565E7; // weak _UNKNOWN unk_80565FB; // weak int dword_80566FB; // weak // extern _UNKNOWN __gmon_start__; weak //----- (08048E64) -------------------------------------------------------- void *init_proc() { void *result; // eax result = &__gmon_start__; if ( &__gmon_start__ ) result = (void *)_gmon_start__(); return result; } // 8049310: using guessed type int _gmon_start__(void); //----- (08048E90) -------------------------------------------------------- int sub_8048E90() { return dword_8056008(); } // 8056008: using guessed type int (*dword_8056008)(void); //----- (08049320) -------------------------------------------------------- #error "8049323: positive sp value has been found (funcsize=2)" //----- (08049353) -------------------------------------------------------- void sub_8049353() { ; } //----- (08049370) -------------------------------------------------------- void sub_8049370() { ; } //----- (08049380) -------------------------------------------------------- int sub_8049380() { int result; // eax result = &unk_805620F - &unk_805620C; if ( (unsigned int)(&unk_805620F - &unk_805620C) > 6 ) result = 0; return result; } // 8049380: could not find valid save-restore pair for ebp //----- (080493F0) -------------------------------------------------------- int sub_80493F0() { int result; // eax if ( !byte_805628C ) { result = sub_8049380(); byte_805628C = 1; } return result; } // 80493F0: could not find valid save-restore pair for ebp // 805628C: using guessed type char byte_805628C; //----- (08049410) -------------------------------------------------------- int sub_8049410() { return 0; } // 8049410: could not find valid save-restore pair for ebp //----- (0804946F) -------------------------------------------------------- void sub_804946F() { ; } //----- (0804948A) -------------------------------------------------------- void sub_804948A() { ; } //----- (0804949A) -------------------------------------------------------- signed int sub_804949A() { return 3; } // 804949A: could not find valid save-restore pair for ebp //----- (0804957C) -------------------------------------------------------- void sub_804957C() { ; } //----- (08049597) -------------------------------------------------------- void sub_8049597() { ; } //----- (080495A7) -------------------------------------------------------- int sub_80495A7() { int result; // eax result = &unk_8056203 - &unk_8056200; if ( (unsigned int)(&unk_8056203 - &unk_8056200) > 6 ) result = 0; return result; } // 80495A7: could not find valid save-restore pair for ebp //----- (080495ED) -------------------------------------------------------- int sub_80495ED() { int result; // eax result = sub_80495A7(); byte_8056366 = 1; return result; } // 8056366: using guessed type char byte_8056366; //----- (080496B5) -------------------------------------------------------- void sub_80496B5() { ; } //----- (080496D0) -------------------------------------------------------- void sub_80496D0() { ; } //----- (080496E0) -------------------------------------------------------- int sub_80496E0() { int result; // eax result = &unk_80561FB - &unk_80561F8; if ( (unsigned int)(&unk_80561FB - &unk_80561F8) > 6 ) result = 0; return result; } // 80496E0: could not find valid save-restore pair for ebp //----- (080497C2) -------------------------------------------------------- void sub_80497C2() { ; } //----- (080497DD) -------------------------------------------------------- void sub_80497DD() { ; } //----- (080497ED) -------------------------------------------------------- int sub_80497ED() { int result; // eax result = &unk_80561FB - &unk_80561F8; if ( (unsigned int)(&unk_80561FB - &unk_80561F8) > 6 ) result = 0; return result; } // 80497ED: could not find valid save-restore pair for ebp //----- (0804984B) -------------------------------------------------------- int sub_804984B() { return nullsub_3(); } // 804984B: could not find valid save-restore pair for ebp // 804984A: using guessed type int nullsub_3(void); //----- (080498FB) -------------------------------------------------------- void sub_80498FB() { ; } //----- (08049916) -------------------------------------------------------- void sub_8049916() { ; } //----- (08049926) -------------------------------------------------------- signed int sub_8049926() { return 3; } // 8049926: could not find valid save-restore pair for ebp //----- (08049A08) -------------------------------------------------------- void sub_8049A08() { ; } //----- (08049A23) -------------------------------------------------------- void sub_8049A23() { ; } //----- (08049A33) -------------------------------------------------------- int sub_8049A33() { int result; // eax result = &unk_80561FF - &unk_80561FC; if ( (unsigned int)(&unk_80561FF - &unk_80561FC) > 6 ) result = 0; return result; } // 8049A33: could not find valid save-restore pair for ebp //----- (08049AE5) -------------------------------------------------------- int __usercall sub_8049AE5@<eax>(void (__cdecl *a1)(int *)@<eax>) { a1(&dword_8053F0C); return 0; } // 8053F0C: using guessed type int dword_8053F0C; //----- (08049B31) -------------------------------------------------------- void sub_8049B31() { ; } //----- (08049B4C) -------------------------------------------------------- void sub_8049B4C() { ; } //----- (08049B5C) -------------------------------------------------------- int sub_8049B5C() { int result; // eax result = &unk_80561F8 - (_UNKNOWN *)&off_8056208; if ( (unsigned int)(&unk_80561F8 - (_UNKNOWN *)&off_8056208) > 6 ) result = 0; return result; } // 8049B5C: could not find valid save-restore pair for ebp // 8056208: using guessed type void (__noreturn *off_8056208)(); //----- (08049C31) -------------------------------------------------------- int __cdecl sub_8049C31(unsigned __int8 a1) { return a1; } //----- (08049C43) -------------------------------------------------------- int sub_8049C43() { FILE *v0; // ebx char *v1; // eax v0 = stdout; v1 = gettext("\nWith no FILE, or when FILE is -, read standard input.\n"); return fputs_unlocked(v1, v0); } // 8049130: using guessed type int __cdecl fputs_unlocked(_DWORD, _DWORD); //----- (08049C6E) -------------------------------------------------------- #error "8049C9F: call analysis failed (funcsize=16)" //----- (08049CA4) -------------------------------------------------------- #error "8049E22: positive sp value has been found (funcsize=0)" //----- (08049E25) -------------------------------------------------------- int __cdecl sub_8049E25(int a1) { return (*(_DWORD *)(a1 + 16) & 0xF000) == 0x8000 || (*(_DWORD *)(a1 + 16) & 0xF000) == 40960; } //----- (08049E5D) -------------------------------------------------------- #error "8049E7F: call analysis failed (funcsize=27)" //----- (08049F93) -------------------------------------------------------- unsigned int __usercall sub_8049F93@<eax>(int a1@<edi>, int a2@<esi>, unsigned __int64 a3, unsigned __int64 a4, unsigned __int64 a5, unsigned __int64 a6, unsigned __int64 a7, char *a8) { void *v8; // eax __int64 v10; // [esp+0h] [ebp-68h] int v11; // [esp+8h] [ebp-60h] char *s; // [esp+14h] [ebp-54h] unsigned __int64 v13; // [esp+18h] [ebp-50h] unsigned __int64 v14; // [esp+20h] [ebp-48h] unsigned __int64 v15; // [esp+28h] [ebp-40h] unsigned __int64 v16; // [esp+30h] [ebp-38h] unsigned __int64 v17; // [esp+38h] [ebp-30h] char *format; // [esp+40h] [ebp-28h] char v19; // [esp+47h] [ebp-21h] unsigned int v20; // [esp+5Ch] [ebp-Ch] v17 = a3; v16 = a4; v15 = a5; v14 = a6; v13 = a7; s = a8; v20 = __readgsdword(0x14u); format = "%*s"; if ( byte_8056593 ) { v11 = sub_804C58F(a1, a2, v17, (int)&v19); HIDWORD(v10) = dword_805659B; printf(format, dword_805659B, v11); format = " %*s"; } if ( byte_8056594 ) { v11 = sub_804C58F(a1, a2, v16, (int)&v19); HIDWORD(v10) = dword_805659B; printf(format, dword_805659B, v11); format = " %*s"; } if ( byte_8056595 ) { v11 = sub_804C58F(a1, a2, v15, (int)&v19); HIDWORD(v10) = dword_805659B; printf(format, dword_805659B, v11); format = " %*s"; } if ( byte_8056596 ) { v11 = sub_804C58F(a1, a2, v14, (int)&v19); HIDWORD(v10) = dword_805659B; printf(format, dword_805659B, v11); format = " %*s"; } if ( byte_8056597 ) { v11 = sub_804C58F(a1, a2, v13, (int)&v19); HIDWORD(v10) = dword_805659B; printf(format, dword_805659B, v11); } if ( s ) { if ( strchr(s, 10) ) v8 = sub_804E2E6(0, 3, s); else v8 = s; HIDWORD(v10) = v8; printf(" %s", v8); } putchar_unlocked(10); return __readgsdword(0x14u) ^ v20; } // 8056593: using guessed type char byte_8056593; // 8056594: using guessed type char byte_8056594; // 8056595: using guessed type char byte_8056595; // 8056596: using guessed type char byte_8056596; // 8056597: using guessed type char byte_8056597; // 805659B: using guessed type int dword_805659B; //----- (0804A1B6) -------------------------------------------------------- int __usercall sub_804A1B6@<eax>(const unsigned __int16 *a1@<edi>, unsigned int a2@<esi>, int fd, int a4, int a5, int a6, int a7) { char *v7; // eax bool v8; // al bool v9; // al void *v10; // eax void *v11; // eax int v12; // eax int v13; // eax int v14; // edx __int64 v15; // rax __int64 v16; // rax int v17; // edx void *v18; // ebx int v19; // eax void *v20; // ebx int v21; // eax _BYTE *v22; // eax void *v23; // eax bool v24; // zf void *v25; // eax void *v26; // eax void *v27; // ebx int v28; // eax size_t v29; // eax void *v30; // ebx int v31; // eax char *v32; // eax const unsigned __int16 *v33; // edi void *v34; // eax int v36; // [esp-38h] [ebp-4108h] int v37; // [esp-34h] [ebp-4104h] int v38; // [esp-30h] [ebp-4100h] void *v39; // [esp-2Ch] [ebp-40FCh] int v40; // [esp-28h] [ebp-40F8h] int v41; // [esp-24h] [ebp-40F4h] int v42; // [esp-20h] [ebp-40F0h] int v43; // [esp-1Ch] [ebp-40ECh] int v44; // [esp-18h] [ebp-40E8h] int v45; // [esp-14h] [ebp-40E4h] int v46; // [esp-10h] [ebp-40E0h] int v47; // [esp-Ch] [ebp-40DCh] int v48; // [esp-8h] [ebp-40D8h] int v49; // [esp-4h] [ebp-40D4h] int v50; // [esp+0h] [ebp-40D0h] int v51; // [esp+4h] [ebp-40CCh] __int64 v52; // [esp+8h] [ebp-40C8h] int *v53; // [esp+10h] [ebp-40C0h] char *v54; // [esp+14h] [ebp-40BCh] int v55; // [esp+18h] [ebp-40B8h] int v56; // [esp+1Ch] [ebp-40B4h] int v57; // [esp+20h] [ebp-40B0h] char v58; // [esp+24h] [ebp-40ACh] unsigned __int8 v59; // [esp+25h] [ebp-40ABh] char v60; // [esp+26h] [ebp-40AAh] bool i; // [esp+27h] [ebp-40A9h] int v62; // [esp+28h] [ebp-40A8h] wint_t wc; // [esp+2Ch] [ebp-40A4h] size_t n; // [esp+30h] [ebp-40A0h] void *s; // [esp+34h] [ebp-409Ch] int v66; // [esp+38h] [ebp-4098h] char *v67; // [esp+44h] [ebp-408Ch] char *v68; // [esp+48h] [ebp-4088h] unsigned int v69; // [esp+4Ch] [ebp-4084h] char *v70; // [esp+50h] [ebp-4080h] unsigned __int64 v71; // [esp+58h] [ebp-4078h] unsigned __int64 v72; // [esp+60h] [ebp-4070h] unsigned __int64 v73; // [esp+68h] [ebp-4068h] unsigned __int64 v74; // [esp+70h] [ebp-4060h] unsigned __int64 v75; // [esp+78h] [ebp-4058h] unsigned __int64 v76; // [esp+80h] [ebp-4050h] unsigned __int64 v77; // [esp+88h] [ebp-4048h] __int64 v78; // [esp+90h] [ebp-4040h] unsigned __int64 v79; // [esp+98h] [ebp-4038h] mbstate_t ps; // [esp+A0h] [ebp-4030h] char dest[16385]; // [esp+B3h] [ebp-401Dh] unsigned int v82; // [esp+40B4h] [ebp-1Ch] v54 = (char *)a4; v53 = (int *)a5; v52 = __PAIR__(a7, a6); v82 = __readgsdword(0x14u); HIBYTE(v57) = 1; if ( a4 ) v7 = v54; else v7 = gettext("standard input"); v68 = v7; v75 = 0LL; v74 = 0LL; v73 = 0LL; v72 = 0LL; v71 = 0LL; if ( __ctype_get_mb_cur_max() <= 1 ) { v8 = byte_8056596 || byte_8056595; v58 = v8; v59 = 0; } else { v58 = byte_8056596; v59 = byte_8056595; } v9 = byte_8056594 || byte_8056597; HIBYTE(v62) = v9; if ( v58 == 1 && !v59 && !byte_8056593 ) { v10 = &loc_804A37E; if ( !HIBYTE(v62) ) v10 = &loc_804A3B1; dword_8056154 = (int)v10; sub_80510DD(); } sub_804C4E6(fd, 0, 0, 0, 0, 2); if ( !v58 || v59 == 1 ) goto LABEL_106; v11 = &loc_804A3F7; if ( byte_8056593 == 1 ) v11 = &loc_804A70F; dword_8056134 = (int)v11; sub_80511B7( v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, HIDWORD(v52), v53, v54, v55, v56, v57, *(_DWORD *)&v58, v62, wc, n); if ( HIBYTE(v62) != 1 ) { v60 = 0; if ( *v53 > 0 ) { v12 = sub_8050EEC(fd, (int)(v53 + 1)); *v53 = v12; } if ( !*v53 ) { if ( (unsigned __int8)sub_8049E25((int)(v53 + 1)) ) { v13 = v53[12]; if ( v53[13] >= 0 ) { v14 = v53[13]; v69 = v53[12]; if ( v52 < 0 ) { LODWORD(v15) = lseek64(fd, 0, 0, 1, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49); v52 = v15; } if ( v69 % dword_80565A3 ) { if ( v69 < v52 ) v16 = 0LL; else v16 = v69 - v52; v74 = v16; v60 = 1; } else { if ( v53[14] <= 0 || (unsigned int)v53[14] > 0x20000000 ) a2 = 513; else a2 = v53[14] + 1; v78 = v69 - v69 % a2; if ( v52 >= 0 && v52 < v78 ) { lseek64(fd, v78, HIDWORD(v78), 1, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49); if ( v17 >= 0 ) v74 = v78 - v52; } } } } } if ( v60 != 1 ) { sub_804C4E6(fd, 0, 0, 0, 0, 2); while ( 1 ) { n = sub_804ED4F(fd, dest, 0x4000u); if ( !n ) break; if ( n == -1 ) { v18 = sub_804E2E6(0, 3, v68); v19 = *__errno_location(); v39 = v18; error(0, v19, "%s", v18); HIBYTE(v57) = 0; break; } v74 += n; } } } else { LABEL_106: if ( v59 != 1 && HIBYTE(v62) != 1 ) { for ( i = 0; ; i = v71 - v79 <= n / 0xF ) { n = sub_804ED4F(fd, dest, 0x4000u); if ( !n ) break; if ( n == -1 ) { v20 = sub_804E2E6(0, 3, v68); v21 = *__errno_location(); v39 = v20; error(0, v21, "%s"); HIBYTE(v57) = 0; dword_8056168 = (int)&loc_804A94F; sub_805104D(); } v74 += n; s = dest; v70 = &dest[n]; v79 = v71; if ( i == 1 ) { v23 = memchr(s, 10, v70 - (_BYTE *)s); s = v23; v24 = v23 == 0; v25 = &loc_804A8BC; if ( !v24 ) v25 = &loc_804A855; dword_8056154 = (int)v25; sub_80510DD(); } else { while ( s != v70 ) { v22 = s; s = (char *)s + 1; v71 += *v22 == 10; } } } dword_8056154 = (int)&loc_804B0E4; sub_80510DD(); } if ( __ctype_get_mb_cur_max() <= 1 ) { BYTE2(v62) = 0; v77 = 0LL; dword_8056134 = (int)&loc_804B060; sub_80511B7( v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, HIDWORD(v52), v53, v54, v55, v56, v57, *(_DWORD *)&v58, v62, wc, n); while ( 1 ) { v67 = dest; if ( n == -1 ) break; v74 += n; while ( 2 ) { v32 = v67++; switch ( *v32 ) { case 9: a2 = HIDWORD(v77); v77 = __PAIR__(HIDWORD(v77), (unsigned int)v77 & 0xFFFFFFF8) + 8; goto LABEL_89; case 10: ++v71; goto LABEL_84; case 11: goto LABEL_89; case 12: case 13: LABEL_84: if ( v77 > v75 ) v75 = v77; v77 = 0LL; goto LABEL_89; case 32: ++v77; goto LABEL_89; default: v33 = *__ctype_b_loc(); v36 = *(v67 - 1); v24 = (v33[(unsigned __int8)sub_8049C31(v36)] & 0x4000) == 0; v34 = &loc_804AFFC; if ( v24 ) v34 = &loc_804B04C; dword_8056168 = (int)v34; sub_805104D(); ++v77; a1 = *__ctype_b_loc(); v36 = *(v67 - 1); if ( a1[(unsigned __int8)sub_8049C31(v36)] & 0x2000 ) { LABEL_89: v72 += BYTE2(v62); BYTE2(v62) = 0; } else { BYTE2(v62) = 1; } if ( --n ) continue; n = sub_804ED4F(fd, dest, 0x4000u); if ( !n ) goto LABEL_96; break; } break; } } v30 = sub_804E2E6(0, 3, v68); v31 = *__errno_location(); v39 = v30; error(0, v31, "%s", v30); HIBYTE(v57) = 0; LABEL_96: if ( v77 > v75 ) v75 = v77; v72 += BYTE2(v62); } else { LOWORD(v62) = 0; v76 = 0LL; ps.__count = 0; ps.__wch = 0; v66 = 0; v29 = sub_804ED4F(fd, dest, 0x4000u); n = v29; if ( v29 ) { v26 = &loc_804A9DB; if ( n != -1 ) v26 = &loc_804AA2A; dword_8056134 = (int)v26; sub_80511B7( v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, HIDWORD(v52), v53, v54, v55, v56, v57, *(_DWORD *)&v58, v62, wc, n); v27 = sub_804E2E6(0, 3, v68); v28 = *__errno_location(); v39 = v27; error(0, v28, "%s", v27); HIBYTE(v57) = 0; } if ( v76 > v75 ) v75 = v76; v72 += (unsigned __int8)v62; } } if ( v59 < (signed int)(unsigned __int8)byte_8056595 ) v73 = v74; sub_8049F93((int)a1, a2, v71, v72, v73, v74, v75, v54); qword_805656B += v71; qword_8056573 += v72; qword_805657B += v73; qword_8056583 += v74; if ( v75 > qword_805658B ) qword_805658B = v75; return HIBYTE(v57); } // 8049260: using guessed type int __stdcall lseek64(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // 805104D: using guessed type int sub_805104D(void); // 80510DD: using guessed type int sub_80510DD(void); // 80511B7: using guessed type int __stdcall sub_80511B7(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // 8056134: using guessed type int dword_8056134; // 8056154: using guessed type int dword_8056154; // 8056168: using guessed type int dword_8056168; // 805656B: using guessed type __int64 qword_805656B; // 8056573: using guessed type __int64 qword_8056573; // 805657B: using guessed type __int64 qword_805657B; // 8056583: using guessed type __int64 qword_8056583; // 805658B: using guessed type __int64 qword_805658B; // 8056593: using guessed type char byte_8056593; // 8056594: using guessed type char byte_8056594; // 8056595: using guessed type char byte_8056595; // 8056596: using guessed type char byte_8056596; // 8056597: using guessed type char byte_8056597; // 80565A3: using guessed type int dword_80565A3; // 804A1B6: using guessed type char dest[16385]; //----- (0804B29C) -------------------------------------------------------- int __usercall sub_804B29C@<eax>(const unsigned __int16 *a1@<edi>, unsigned int a2@<esi>, char *s1, int a4) { int result; // eax void *v5; // ebx int *v6; // eax void *v7; // ebx int *v8; // eax unsigned __int8 v9; // [esp+2Bh] [ebp-Dh] int fd; // [esp+2Ch] [ebp-Ch] if ( s1 && strcmp(s1, "-") ) { fd = open64(s1, 0); if ( fd == -1 ) { v5 = sub_804E2E6(0, 3, s1); v6 = __errno_location(); error(0, *v6, "%s", v5); result = 0; } else { v9 = sub_804A1B6(a1, a2, fd, (int)s1, a4, 0, 0); if ( close(fd) ) { v7 = sub_804E2E6(0, 3, s1); v8 = __errno_location(); error(0, *v8, "%s", v7); result = 0; } else { result = v9; } } } else { byte_805659F = 1; sub_804F83B(); result = sub_804A1B6(a1, a2, 0, (int)s1, a4, -1, -1); } return result; } // 8048EB0: using guessed type int __cdecl open64(_DWORD, _DWORD); // 805659F: using guessed type char byte_805659F; //----- (0804B411) -------------------------------------------------------- _DWORD *__cdecl sub_804B411(unsigned int a1, int a2) { unsigned int v2; // eax int *v3; // ebx int v4; // eax int v5; // eax _DWORD *v7; // [esp+4h] [ebp-24h] unsigned int i; // [esp+18h] [ebp-10h] _DWORD *v9; // [esp+1Ch] [ebp-Ch] if ( a1 ) v2 = a1; else v2 = 1; v9 = (_DWORD *)sub_804F538(v2, 0x64u); if ( !a1 || a1 == 1 && (unsigned __int8)byte_8056596 + (unsigned __int8)byte_8056595 + (unsigned __int8)byte_8056594 + (unsigned __int8)byte_8056593 + (unsigned __int8)byte_8056597 == 1 ) { *v9 = 1; dword_8056154 = (int)&loc_804B5A9; sub_80510DD(); } for ( i = 0; i < a1; ++i ) { v3 = &v9[25 * i]; if ( *(_DWORD *)(4 * i + a2) && strcmp(*(const char **)(4 * i + a2), "-") ) { v5 = *(_DWORD *)(4 * i + a2); v7 = &v9[25 * i + 1]; v4 = sub_8050EAD(v5, (int)v7); } else { v7 = &v9[25 * i + 1]; v4 = sub_8050EEC(0, (int)v7); } *v3 = v4; } return v9; } // 80510DD: using guessed type int sub_80510DD(void); // 8056154: using guessed type int dword_8056154; // 8056593: using guessed type char byte_8056593; // 8056594: using guessed type char byte_8056594; // 8056595: using guessed type char byte_8056595; // 8056596: using guessed type char byte_8056596; // 8056597: using guessed type char byte_8056597; //----- (0804B5B2) -------------------------------------------------------- #error "804B5E6: call analysis failed (funcsize=89)" //----- (0804C121) -------------------------------------------------------- _DWORD *__cdecl sub_804C121(int a1) { _DWORD *v2; // [esp+1Ch] [ebp-Ch] v2 = malloc(0x18u); if ( !v2 ) return 0; *v2 = 0; v2[4] = a1; v2[5] = a1; return v2; } //----- (0804C18B) -------------------------------------------------------- _DWORD *__cdecl sub_804C18B(int a1) { _DWORD *v2; // [esp+1Ch] [ebp-Ch] v2 = malloc(0x18u); if ( !v2 ) return 0; *v2 = a1; v2[2] = 0; v2[3] = 0; v2[1] = 0; v2[4] = 0; return v2; } //----- (0804C1F2) -------------------------------------------------------- int __cdecl sub_804C1F2(int *a1, signed int *a2) { signed int v2; // eax int result; // eax int *v4; // eax FILE *v5; // [esp+0h] [ebp-28h] FILE *v6; // [esp+Ch] [ebp-1Ch] int v7; // [esp+1Ch] [ebp-Ch] if ( *a1 ) { v6 = (FILE *)*a1; v7 = getdelim(a1 + 2, a1 + 3, 0, v6); if ( v7 >= 0 ) { *a2 = 1; ++a1[1]; result = a1[2]; } else { v5 = (FILE *)*a1; if ( feof(v5) ) v2 = 2; else v2 = 4; *a2 = v2; result = 0; } } else if ( *(_DWORD *)a1[5] ) { *a2 = 1; v4 = (int *)a1[5]; a1[5] = (int)(v4 + 1); result = *v4; } else { *a2 = 2; result = 0; } return result; } // 8049250: using guessed type int __cdecl getdelim(_DWORD, _DWORD, _DWORD, _DWORD); //----- (0804C2D8) -------------------------------------------------------- int __cdecl sub_804C2D8(_DWORD *a1) { int result; // eax if ( *a1 ) result = a1[1]; else result = (a1[5] - a1[4]) >> 2; return result; } //----- (0804C327) -------------------------------------------------------- #error "804C366: positive sp value has been found (funcsize=15)" //----- (0804C4E6) -------------------------------------------------------- int __cdecl sub_804C4E6(int a1, int a2, int a3, int a4, int a5, int a6) { int v7; // [esp+20h] [ebp-28h] int v8; // [esp+24h] [ebp-24h] int v9; // [esp+28h] [ebp-20h] int v10; // [esp+2Ch] [ebp-1Ch] v9 = a2; v10 = a3; v7 = a4; v8 = a5; return posix_fadvise64(a1, a2, a3, a4, a5, a6); } // 8049280: using guessed type int __cdecl posix_fadvise64(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); //----- (0804C58F) -------------------------------------------------------- int __usercall sub_804C58F@<eax>(int a1@<edi>, int a2@<esi>, unsigned __int64 a3, int a4) { unsigned __int64 v4; // rax unsigned __int64 v6; // [esp+18h] [ebp-20h] int v7; // [esp+2Ch] [ebp-Ch] v6 = a3; v7 = a4 + 20; *(_BYTE *)(a4 + 20) = 0; do { *(_BYTE *)--v7 = sub_8050C8B(v6, 10LL) + 48; LODWORD(v4) = sub_8050A5C(a1, a2, v6, SHIDWORD(v6), 0xAu, 0); v6 = v4; } while ( v4 ); return v7; } //----- (0804C6FD) -------------------------------------------------------- bool __cdecl sub_804C6FD(unsigned __int8 a1) { return (((unsigned int)dword_8051BC0[a1 >> 5] >> (a1 & 0x1F)) & 1) != 0; } //----- (0804C744) -------------------------------------------------------- long double sub_804C744() { double v1; // [esp+18h] [ebp-60h] double v2; // [esp+20h] [ebp-58h] char v3; // [esp+2Ch] [ebp-4Ch] unsigned int v4; // [esp+3Ch] [ebp-3Ch] unsigned int v5; // [esp+60h] [ebp-18h] unsigned int v6; // [esp+6Ch] [ebp-Ch] v6 = __readgsdword(0x14u); v1 = (long double)sysconf(85); v2 = (long double)sysconf(30); if ( v1 >= 0.0 && v2 >= 0.0 ) return v1 * v2; if ( sysinfo((struct sysinfo *)&v3) ) return 67108864.0; return (long double)v4 * (long double)v5; } //----- (0804C80D) -------------------------------------------------------- long double sub_804C80D() { double v1; // [esp+18h] [ebp-60h] double v2; // [esp+20h] [ebp-58h] char v3; // [esp+2Ch] [ebp-4Ch] unsigned int v4; // [esp+40h] [ebp-38h] unsigned int v5; // [esp+48h] [ebp-30h] unsigned int v6; // [esp+60h] [ebp-18h] unsigned int v7; // [esp+6Ch] [ebp-Ch] v7 = __readgsdword(0x14u); v1 = (long double)sysconf(86); v2 = (long double)sysconf(30); if ( v1 >= 0.0 && v2 >= 0.0 ) return v1 * v2; if ( sysinfo((struct sysinfo *)&v3) ) return sub_804C744() / 4.0; return ((long double)v4 + (long double)v5) * (long double)v6; } //----- (0804C8E4) -------------------------------------------------------- char *__cdecl sub_804C8E4(char *s) { char *v1; // eax char *result; // eax char *v3; // [esp+18h] [ebp-10h] char *s1; // [esp+1Ch] [ebp-Ch] if ( !s ) { fwrite("A NULL argv[0] was passed through an exec system call.\n", 1u, 0x37u, stderr); abort(); } v3 = strrchr(s, 47); if ( v3 ) v1 = v3 + 1; else v1 = s; s1 = v1; if ( v1 - s > 6 && !strncmp(v1 - 7, "/.libs/", 7u) ) { s = s1; if ( !strncmp(s1, "lt-", 3u) ) { s = s1 + 3; program_invocation_short_name = (int)(s1 + 3); } } dword_80565B3 = (int)s; result = s; program_invocation_name = (int)s; return result; } // 8056220: using guessed type int program_invocation_short_name; // 8056230: using guessed type int program_invocation_name; // 80565B3: using guessed type int dword_80565B3; //----- (0804CA30) -------------------------------------------------------- int __fastcall sub_804CA30(int ecx0, int edx0, int a1, char a2, int a3) { dword_8056184 = (int (__fastcall *)(_DWORD, _DWORD))&loc_804CA94; if ( a1 ) dword_8056184 = (int (__fastcall *)(_DWORD, _DWORD))&loc_804CA99; return dword_8056184(ecx0, edx0); } // 8056184: using guessed type int (__fastcall *dword_8056184)(_DWORD, _DWORD); //----- (0804CB4F) -------------------------------------------------------- int *__cdecl sub_804CB4F(int *a1, int a2, int a3) { int *result; // eax if ( !a1 ) a1 = &dword_80565BB; *a1 = 10; if ( !a2 || !a3 ) abort(); a1[10] = a2; result = a1; a1[11] = a3; return result; } // 80565BB: using guessed type int dword_80565BB; //----- (0804CBB0) -------------------------------------------------------- int *__userpurge sub_804CBB0@<eax>(int *a1, int a2) { int v3; // [esp+0h] [ebp-38h] int v4; // [esp+4h] [ebp-34h] int v5; // [esp+8h] [ebp-30h] int v6; // [esp+Ch] [ebp-2Ch] int v7; // [esp+10h] [ebp-28h] int v8; // [esp+14h] [ebp-24h] int v9; // [esp+18h] [ebp-20h] int v10; // [esp+1Ch] [ebp-1Ch] int v11; // [esp+20h] [ebp-18h] int v12; // [esp+24h] [ebp-14h] int v13; // [esp+28h] [ebp-10h] int v14; // [esp+2Ch] [ebp-Ch] memset(&v3 - 14, 0, 0x30u); if ( a2 == 10 ) abort(); v3 = a2; *a1 = a2; a1[1] = v4; a1[2] = v5; a1[3] = v6; a1[4] = v7; a1[5] = v8; a1[6] = v9; a1[7] = v10; a1[8] = v11; a1[9] = v12; a1[10] = v13; a1[11] = v14; return a1; } //----- (0804CC66) -------------------------------------------------------- #error "804CD08: call analysis failed (funcsize=54)" //----- (0804CD21) -------------------------------------------------------- unsigned int __usercall sub_804CD21@<eax>(size_t a1@<ebx>, int a2, unsigned int a3, char *a4, size_t a5, signed int a6, int a7, int a8, char *a9, char *a10) { void *v10; // eax void *v11; // eax size_t v12; // eax int v13; // eax bool v14; // al size_t v15; // eax void *v16; // eax void *v17; // eax int v18; // eax void *v19; // eax unsigned int result; // eax size_t v21; // [esp-34h] [ebp-90h] int v22; // [esp-30h] [ebp-8Ch] int v23; // [esp-2Ch] [ebp-88h] int v24; // [esp-28h] [ebp-84h] size_t v25; // [esp-24h] [ebp-80h] int v26; // [esp-20h] [ebp-7Ch] int v27; // [esp-1Ch] [ebp-78h] int v28; // [esp-18h] [ebp-74h] int v29; // [esp-14h] [ebp-70h] int v30; // [esp-10h] [ebp-6Ch] int v31; // [esp-Ch] [ebp-68h] int v32; // [esp-8h] [ebp-64h] int v33; // [esp-4h] [ebp-60h] char *v34; // [esp+0h] [ebp-5Ch] char *v35; // [esp+4h] [ebp-58h] int v36; // [esp+8h] [ebp-54h] char *v37; // [esp+Ch] [ebp-50h] int v38; // [esp+10h] [ebp-4Ch] char v39; // [esp+14h] [ebp-48h] bool v40; // [esp+15h] [ebp-47h] char v41; // [esp+16h] [ebp-46h] char v42; // [esp+17h] [ebp-45h] char v43; // [esp+18h] [ebp-44h] unsigned __int8 v44; // [esp+19h] [ebp-43h] unsigned __int8 v45; // [esp+1Ah] [ebp-42h] unsigned __int8 v46; // [esp+1Bh] [ebp-41h] char v47; // [esp+1Ch] [ebp-40h] bool v48; // [esp+1Dh] [ebp-3Fh] bool v49; // [esp+1Eh] [ebp-3Eh] bool v50; // [esp+1Fh] [ebp-3Dh] wint_t wc; // [esp+20h] [ebp-3Ch] int v52; // [esp+24h] [ebp-38h] unsigned int v53; // [esp+28h] [ebp-34h] unsigned int v54; // [esp+2Ch] [ebp-30h] char *s; // [esp+30h] [ebp-2Ch] size_t n; // [esp+34h] [ebp-28h] unsigned int v57; // [esp+38h] [ebp-24h] int v58; // [esp+3Ch] [ebp-20h] size_t v59; // [esp+40h] [ebp-1Ch] unsigned int v60; // [esp+44h] [ebp-18h] mbstate_t ps; // [esp+48h] [ebp-14h] unsigned int v62; // [esp+50h] [ebp-Ch] v38 = a2; v37 = a4; v36 = a8; v35 = a9; v34 = a10; v62 = __readgsdword(0x14u); v53 = 0; v54 = 0; s = 0; n = 0; v39 = 0; v50 = __ctype_get_mb_cur_max() == 1; v40 = (a7 & 2) != 0; v41 = 0; v42 = 0; v43 = 1; while ( 1 ) { switch ( a6 ) { case 0: v40 = 0; break; case 1: goto LABEL_20; case 2: goto LABEL_23; case 3: v39 = 1; LABEL_20: v40 = 1; goto LABEL_21; case 4: LABEL_21: if ( v40 != 1 ) v39 = 1; LABEL_23: a6 = 2; if ( v40 != 1 ) { if ( v53 < a3 ) *(_BYTE *)(v38 + v53) = 39; ++v53; } s = "'"; n = 1; break; case 5: goto LABEL_4; case 6: a6 = 5; v40 = 1; LABEL_4: v22 = !v40; v21 = a1; v10 = &loc_804CE02; if ( v40 == 1 ) v10 = &loc_804CE19; dword_8056168 = (int)v10; a1 = v21; sub_805104D(); if ( v53 < a3 ) *(_BYTE *)(v38 + v53) = 34; ++v53; v39 = 1; s = (char *)&unk_8051D25; n = 1; break; case 7: v39 = 1; v40 = 0; break; case 8: case 9: case 10: if ( a6 != 10 ) { v35 = (char *)sub_804CC66("`", a6); v34 = (char *)sub_804CC66("'", a6); } if ( v40 != 1 ) { for ( s = v35; *s; ++s ) { if ( v53 < a3 ) *(_BYTE *)(v53 + v38) = *s; ++v53; } } v39 = 1; s = v34; n = strlen(v34); break; default: abort(); return result; } v52 = 0; LABEL_197: if ( a5 == -1 ) { v18 = (unsigned __int8)v37[v52]; LOBYTE(v18) = (_BYTE)v18 != 0; } else { v18 = v52; LOBYTE(v18) = v52 != a5; } if ( (_BYTE)v18 ) break; if ( !v53 && a6 == 2 && v40 ) goto LABEL_223; if ( a6 != 2 ) goto LABEL_229; v22 = !v40; v21 = a1; v19 = &loc_804D8FF; if ( v40 == 1 ) v19 = &loc_804D982; dword_8056134 = (int)v19; a1 = v21; sub_80511B7( v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, *(_DWORD *)&v39, *(_DWORD *)&v43, *(_DWORD *)&v47, wc, v52, v53, v54, s, n, v57, v58); if ( !v42 ) goto LABEL_229; if ( v43 ) return sub_804CD21(v38, v54, v37, a5, 5, a7, v36, v35, v34); if ( a3 || !v54 ) { LABEL_229: if ( s && v40 != 1 ) { while ( *s ) { if ( v53 < a3 ) *(_BYTE *)(v53 + v38) = *s; ++v53; ++s; } } if ( v53 < a3 ) *(_BYTE *)(v38 + v53) = 0; return v53; } a3 = v54; v53 = 0; } v46 = 0; v47 = 0; v48 = 0; if ( v39 ) { v22 = v18; v21 = a1; v11 = &loc_804CF62; if ( a6 == 2 ) v11 = &loc_804CFC8; dword_8056134 = (int)v11; a1 = v21; sub_80511B7( v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, *(_DWORD *)&v39, *(_DWORD *)&v43, *(_DWORD *)&v47, wc, v52, v53, v54, s, n, v57, v58); if ( n ) { a1 = v52 + n; if ( a5 != -1 || n <= 1 ) { v12 = a5; } else { v12 = strlen(v37); a5 = v12; } if ( a1 <= v12 && !memcmp(&v37[v52], s, n) ) { if ( v40 ) goto LABEL_223; v46 = 1; } } } v44 = v37[v52]; switch ( v44 ) { case 0u: if ( v39 ) { if ( v40 ) goto LABEL_223; v47 = 1; if ( a6 == 2 && v41 != 1 ) { if ( v53 < a3 ) *(_BYTE *)(v38 + v53) = 39; if ( ++v53 < a3 ) *(_BYTE *)(v38 + v53) = 36; if ( ++v53 < a3 ) *(_BYTE *)(v38 + v53) = 39; ++v53; v41 = 1; } if ( v53 < a3 ) *(_BYTE *)(v38 + v53) = 92; ++v53; if ( a6 != 2 && v52 + 1 < a5 && v37[v52 + 1] > 47 && v37[v52 + 1] <= 57 ) { if ( v53 < a3 ) *(_BYTE *)(v38 + v53) = 48; if ( ++v53 < a3 ) *(_BYTE *)(v38 + v53) = 48; ++v53; } v44 = 48; } else if ( a7 & 1 ) { goto LABEL_196; } goto LABEL_176; case 7u: v45 = 97; goto LABEL_104; case 8u: v45 = 98; goto LABEL_104; case 9u: v45 = 116; goto LABEL_102; case 0xAu: v45 = 110; goto LABEL_102; case 0xBu: v45 = 118; goto LABEL_104; case 0xCu: v45 = 102; goto LABEL_104; case 0xDu: v45 = 114; goto LABEL_102; case 0x20u: goto LABEL_112; case 0x21u: case 0x22u: case 0x24u: case 0x26u: case 0x28u: case 0x29u: case 0x2Au: case 0x3Bu: case 0x3Cu: case 0x3Du: case 0x3Eu: case 0x5Bu: case 0x5Eu: case 0x60u: case 0x7Cu: goto LABEL_113; case 0x23u: case 0x7Eu: goto LABEL_111; case 0x25u: case 0x2Bu: case 0x2Cu: case 0x2Du: case 0x2Eu: case 0x2Fu: case 0x30u: case 0x31u: case 0x32u: case 0x33u: case 0x34u: case 0x35u: case 0x36u: case 0x37u: case 0x38u: case 0x39u: case 0x3Au: case 0x41u: case 0x42u: case 0x43u: case 0x44u: case 0x45u: case 0x46u: case 0x47u: case 0x48u: case 0x49u: case 0x4Au: case 0x4Bu: case 0x4Cu: case 0x4Du: case 0x4Eu: case 0x4Fu: case 0x50u: case 0x51u: case 0x52u: case 0x53u: case 0x54u: case 0x55u: case 0x56u: case 0x57u: case 0x58u: case 0x59u: case 0x5Au: case 0x5Du: case 0x5Fu: case 0x61u: case 0x62u: case 0x63u: case 0x64u: case 0x65u: case 0x66u: case 0x67u: case 0x68u: case 0x69u: case 0x6Au: case 0x6Bu: case 0x6Cu: case 0x6Du: case 0x6Eu: case 0x6Fu: case 0x70u: case 0x71u: case 0x72u: case 0x73u: case 0x74u: case 0x75u: case 0x76u: case 0x77u: case 0x78u: case 0x79u: case 0x7Au: v48 = 1; goto LABEL_176; case 0x27u: v42 = 1; v48 = 1; if ( a6 != 2 ) goto LABEL_176; if ( v40 ) goto LABEL_223; if ( a3 && !v54 ) { v54 = a3; a3 = 0; } if ( v53 < a3 ) *(_BYTE *)(v38 + v53) = 39; if ( ++v53 < a3 ) *(_BYTE *)(v38 + v53) = 92; if ( ++v53 < a3 ) *(_BYTE *)(v38 + v53) = 39; ++v53; v41 = 0; goto LABEL_176; case 0x3Fu: if ( a6 == 2 ) { if ( v40 ) goto LABEL_223; } else if ( a6 == 5 && a7 & 4 && v52 + 2 < a5 && v37[v52 + 1] == 63 ) { switch ( v37[v52 + 2] ) { case 33: case 39: case 40: case 41: case 45: case 47: case 60: case 61: case 62: if ( v40 ) goto LABEL_223; v44 = v37[v52 + 2]; v52 += 2; if ( v53 < a3 ) *(_BYTE *)(v38 + v53) = 63; if ( ++v53 < a3 ) *(_BYTE *)(v38 + v53) = 34; if ( ++v53 < a3 ) *(_BYTE *)(v38 + v53) = 34; if ( ++v53 < a3 ) *(_BYTE *)(v38 + v53) = 63; ++v53; break; default: goto LABEL_176; } } goto LABEL_176; case 0x5Cu: v45 = v44; if ( a6 == 2 ) { if ( v40 ) goto LABEL_223; goto LABEL_185; } if ( v39 && v40 && n ) goto LABEL_185; LABEL_102: if ( a6 == 2 && v40 ) goto LABEL_223; LABEL_104: if ( !v39 ) { dword_8056154 = (int)&loc_804D71A; sub_80510DD(); LABEL_107: if ( a5 == -1 ) v14 = v37[1] != 0; else v14 = a5 != 1; if ( !v14 ) { LABEL_111: if ( !v52 ) { LABEL_112: v48 = 1; LABEL_113: if ( a6 == 2 && v40 ) goto LABEL_223; } } LABEL_176: if ( v39 == 1 && a6 != 2 || v40 == 1 ) { if ( v36 ) { v13 = (*(_DWORD *)(4 * (v44 >> 5) + v36) >> (v44 & 0x1F)) & 1; if ( v13 ) goto LABEL_182; } } v13 = v46 ^ 1; if ( v46 == 1 ) goto LABEL_182; LABEL_185: if ( v41 && v47 != 1 ) { if ( v53 < a3 ) *(_BYTE *)(v38 + v53) = 39; if ( ++v53 < a3 ) *(_BYTE *)(v38 + v53) = 39; ++v53; v41 = 0; } if ( v53 < a3 ) *(_BYTE *)(v53 + v38) = v44; ++v53; if ( v48 != 1 ) v43 = 0; LABEL_196: ++v52; goto LABEL_197; } v13 = v45; v44 = v45; LABEL_182: v22 = v13; v21 = a1; v17 = &loc_804D7A7; if ( !v40 ) v17 = &loc_804D7AC; dword_8056154 = (int)v17; sub_80510DD(); LABEL_223: if ( a6 == 2 && v39 ) a6 = 4; return sub_804CD21(v38, a3, v37, a5, a6, a7 & 0xFFFFFFFD, 0, v35, v34); case 0x7Bu: case 0x7Du: goto LABEL_107; default: if ( v50 ) { v57 = 1; v49 = ((*__ctype_b_loc())[v44] & 0x4000) != 0; } else { memset(&ps, 0, 8u); v57 = 0; v49 = 1; if ( a5 == -1 ) a5 = strlen(v37); v25 = a5 - (v57 + v52); v15 = sub_804FAC2(&v23 - 15, &v37[v57 + v52], v25, (mbstate_t *)(&v23 - 5)); v59 = v15; if ( v15 ) { v22 = v15; v21 = a1; v16 = &loc_804D453; if ( v59 != -1 ) v16 = &loc_804D45C; dword_8056134 = (int)v16; a1 = v21; sub_80511B7( v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, *(_DWORD *)&v39, *(_DWORD *)&v43, *(_DWORD *)&v47, wc, v52, v53, v54, s, n, v57, v58); v49 = 0; } } v48 = v49; if ( v57 <= 1 && (!v39 || v49 == 1) ) goto LABEL_176; v60 = v52 + v57; while ( 2 ) { if ( !v39 || v49 == 1 ) goto LABEL_161; if ( v40 ) goto LABEL_223; v47 = 1; if ( a6 == 2 && v41 != 1 ) { if ( v53 < a3 ) *(_BYTE *)(v38 + v53) = 39; if ( ++v53 < a3 ) *(_BYTE *)(v38 + v53) = 36; if ( ++v53 < a3 ) *(_BYTE *)(v38 + v53) = 39; ++v53; v41 = 1; } if ( v53 < a3 ) *(_BYTE *)(v38 + v53) = 92; if ( ++v53 < a3 ) *(_BYTE *)(v53 + v38) = (v44 >> 6) + 48; if ( ++v53 < a3 ) *(_BYTE *)(v53 + v38) = ((v44 >> 3) & 7) + 48; ++v53; v44 = (v44 & 7) + 48; dword_8056154 = (int)&loc_804D696; sub_80510DD(); LABEL_161: if ( v46 ) { if ( v53 < a3 ) *(_BYTE *)(v38 + v53) = 92; ++v53; v46 = 0; } if ( v52 + 1 < v60 ) { if ( v41 && v47 != 1 ) { if ( v53 < a3 ) *(_BYTE *)(v38 + v53) = 39; if ( ++v53 < a3 ) *(_BYTE *)(v38 + v53) = 39; ++v53; v41 = 0; } if ( v53 < a3 ) *(_BYTE *)(v53 + v38) = v44; ++v53; v44 = v37[++v52]; continue; } goto LABEL_185; } } } // 805104D: using guessed type int sub_805104D(void); // 80510DD: using guessed type int sub_80510DD(void); // 80511B7: using guessed type int __stdcall sub_80511B7(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // 8056134: using guessed type int dword_8056134; // 8056154: using guessed type int dword_8056154; // 8056168: using guessed type int dword_8056168; //----- (0804DB31) -------------------------------------------------------- void *__cdecl sub_804DB31(char *a1, size_t a2, _DWORD *a3, int *a4) { int *v4; // eax int *v5; // ST44_4 int v6; // ST48_4 int v7; // ST4C_4 unsigned int size; // [esp+48h] [ebp-10h] void *ptr; // [esp+4Ch] [ebp-Ch] if ( a4 ) v4 = a4; else v4 = &dword_80565BB; v5 = v4; v6 = *__errno_location(); v7 = v5[1] | (a3 == 0); size = sub_804CD21((size_t)(v5 + 2), 0, 0, a1, a2, *v5, v7, (int)(v5 + 2), (char *)v5[10], (char *)v5[11]) + 1; ptr = (void *)sub_804F676(size); sub_804CD21((size_t)(v5 + 2), (int)ptr, size, a1, a2, *v5, v7, (int)(v5 + 2), (char *)v5[10], (char *)v5[11]); *__errno_location() = v6; if ( a3 ) *a3 = size - 1; return ptr; } // 80565BB: using guessed type int dword_80565BB; //----- (0804DD50) -------------------------------------------------------- void *__cdecl sub_804DD50(signed int a1, char *a2, size_t a3, int a4) { int *v4; // eax void *v5; // edx unsigned int v6; // ST44_4 bool v8; // [esp+37h] [ebp-21h] int *v9; // [esp+38h] [ebp-20h] void *ptr; // [esp+3Ch] [ebp-1Ch] int v11; // [esp+40h] [ebp-18h] int size; // [esp+44h] [ebp-14h] int v13; // [esp+48h] [ebp-10h] unsigned int v14; // [esp+4Ch] [ebp-Ch] v11 = *__errno_location(); v9 = off_80561C4; if ( a1 < 0 ) abort(); if ( dword_80561B8 <= a1 ) { v8 = off_80561C4 == &dword_80561BC; if ( (unsigned int)a1 > 0xFFFFFFE ) sub_804F7FD(); if ( v8 ) v4 = 0; else v4 = off_80561C4; v9 = (int *)sub_804F6D7(v4, 8 * (a1 + 1)); off_80561C4 = v9; if ( v8 ) { v5 = off_80561C0; *v9 = dword_80561BC; v9[1] = (int)v5; } memset(&v9[2 * dword_80561B8], 0, 8 * (a1 + 1 - dword_80561B8)); dword_80561B8 = a1 + 1; } v6 = v9[2 * a1]; ptr = (void *)v9[2 * a1 + 1]; v13 = *(_DWORD *)(a4 + 4) | 1; v14 = sub_804CD21(a4 + 8, (int)ptr, v6, a2, a3, *(_DWORD *)a4, v13, a4 + 8, *(char **)(a4 + 40), *(char **)(a4 + 44)); if ( v6 <= v14 ) { size = v14 + 1; v9[2 * a1] = v14 + 1; if ( ptr != &unk_80565FB ) free(ptr); ptr = (void *)sub_804F676(size); v9[2 * a1 + 1] = (int)ptr; sub_804CD21(a4 + 8, (int)ptr, size, a2, a3, *(_DWORD *)a4, v13, a4 + 8, *(char **)(a4 + 40), *(char **)(a4 + 44)); } *__errno_location() = v11; return ptr; } // 80561B8: using guessed type int dword_80561B8; // 80561BC: using guessed type int dword_80561BC; // 80561C0: using guessed type void *off_80561C0; // 80561C4: using guessed type int *off_80561C4; //----- (0804DFE4) -------------------------------------------------------- void *__cdecl sub_804DFE4(signed int a1, char *a2) { return sub_804DD50(a1, a2, 0xFFFFFFFF, (int)&dword_80565BB); } // 80565BB: using guessed type int dword_80565BB; //----- (0804E00E) -------------------------------------------------------- void *__cdecl sub_804E00E(signed int a1, char *a2, size_t a3) { return sub_804DD50(a1, a2, a3, (int)&dword_80565BB); } // 80565BB: using guessed type int dword_80565BB; //----- (0804E084) -------------------------------------------------------- void *__cdecl sub_804E084(signed int a1, int a2, char *a3) { char v4; // [esp+10h] [ebp-38h] sub_804CBB0((int *)&v4, a2); return sub_804DD50(a1, a3, 0xFFFFFFFF, (int)&v4); } //----- (0804E0C2) -------------------------------------------------------- void *__cdecl sub_804E0C2(signed int a1, int a2, char *a3, size_t a4) { char v5; // [esp+10h] [ebp-38h] sub_804CBB0((int *)&v5, a2); return sub_804DD50(a1, a3, a4, (int)&v5); } //----- (0804E0FF) -------------------------------------------------------- void *__cdecl sub_804E0FF(int a1, char *a2) { return sub_804E084(0, a1, a2); } //----- (0804E15A) -------------------------------------------------------- void *__usercall sub_804E15A@<eax>(int a1@<edx>, int a2@<ecx>, char *a3, size_t a4, char a5) { int v6; // [esp+0h] [ebp-58h] char v7; // [esp+1Ch] [ebp-3Ch] int v8; // [esp+20h] [ebp-38h] int v9; // [esp+24h] [ebp-34h] int v10; // [esp+28h] [ebp-30h] int v11; // [esp+2Ch] [ebp-2Ch] int v12; // [esp+30h] [ebp-28h] int v13; // [esp+34h] [ebp-24h] int v14; // [esp+38h] [ebp-20h] int v15; // [esp+3Ch] [ebp-1Ch] int v16; // [esp+40h] [ebp-18h] int v17; // [esp+44h] [ebp-14h] int v18; // [esp+48h] [ebp-10h] int v19; // [esp+4Ch] [ebp-Ch] v7 = a5; v8 = dword_80565BB; v9 = dword_80565BF; v10 = dword_80565C3; v11 = dword_80565C7; v12 = dword_80565CB; v13 = dword_80565CF; v14 = dword_80565D3; v15 = dword_80565D7; v16 = dword_80565DB; v17 = dword_80565DF; v18 = dword_80565E3; v19 = dword_80565E7; sub_804CA30(a2, a1, (int)(&v6 - 14), a5, 1); return sub_804DD50(0, a3, a4, (int)&v8); } // 80565BB: using guessed type int dword_80565BB; // 80565BF: using guessed type int dword_80565BF; // 80565C3: using guessed type int dword_80565C3; // 80565C7: using guessed type int dword_80565C7; // 80565CB: using guessed type int dword_80565CB; // 80565CF: using guessed type int dword_80565CF; // 80565D3: using guessed type int dword_80565D3; // 80565D7: using guessed type int dword_80565D7; // 80565DB: using guessed type int dword_80565DB; // 80565DF: using guessed type int dword_80565DF; // 80565E3: using guessed type int dword_80565E3; // 80565E7: using guessed type int dword_80565E7; //----- (0804E214) -------------------------------------------------------- void *__usercall sub_804E214@<eax>(int a1@<edx>, int a2@<ecx>, char *a3, char a4) { return sub_804E15A(a1, a2, a3, 0xFFFFFFFF, a4); } //----- (0804E281) -------------------------------------------------------- void *__usercall sub_804E281@<eax>(int a1@<edx>, int a2@<ecx>, char *a3) { return sub_804E214(a1, a2, a3, 58); } //----- (0804E2E6) -------------------------------------------------------- void *__cdecl sub_804E2E6(signed int a1, int a2, char *a3) { int v3; // edx int v4; // ecx int v6; // [esp+0h] [ebp-78h] int v7; // [esp+10h] [ebp-68h] int v8; // [esp+14h] [ebp-64h] int v9; // [esp+18h] [ebp-60h] int v10; // [esp+1Ch] [ebp-5Ch] int v11; // [esp+20h] [ebp-58h] int v12; // [esp+24h] [ebp-54h] int v13; // [esp+28h] [ebp-50h] int v14; // [esp+2Ch] [ebp-4Ch] int v15; // [esp+30h] [ebp-48h] int v16; // [esp+34h] [ebp-44h] int v17; // [esp+38h] [ebp-40h] int v18; // [esp+3Ch] [ebp-3Ch] int v19; // [esp+40h] [ebp-38h] int v20; // [esp+44h] [ebp-34h] int v21; // [esp+48h] [ebp-30h] int v22; // [esp+4Ch] [ebp-2Ch] int v23; // [esp+50h] [ebp-28h] int v24; // [esp+54h] [ebp-24h] int v25; // [esp+58h] [ebp-20h] int v26; // [esp+5Ch] [ebp-1Ch] int v27; // [esp+60h] [ebp-18h] int v28; // [esp+64h] [ebp-14h] int v29; // [esp+68h] [ebp-10h] int v30; // [esp+6Ch] [ebp-Ch] sub_804CBB0(&v7, a2); v19 = v7; v20 = v8; v21 = v9; v22 = v10; v23 = v11; v24 = v12; v25 = v13; v26 = v14; v27 = v15; v28 = v16; v29 = v17; v30 = v18; sub_804CA30(v4, v3, (int)(&v6 - 14), 58, 1); return sub_804DD50(a1, a3, 0xFFFFFFFF, (int)&v19); } //----- (0804E397) -------------------------------------------------------- void *__cdecl sub_804E397(signed int a1, int a2, int a3, char *a4) { return sub_804E3EB(a1, a2, a3, a4, 0xFFFFFFFF); } //----- (0804E3EB) -------------------------------------------------------- void *__cdecl sub_804E3EB(signed int a1, int a2, int a3, char *a4, size_t a5) { int v6; // [esp+0h] [ebp-48h] int v7; // [esp+10h] [ebp-38h] int v8; // [esp+14h] [ebp-34h] int v9; // [esp+18h] [ebp-30h] int v10; // [esp+1Ch] [ebp-2Ch] int v11; // [esp+20h] [ebp-28h] int v12; // [esp+24h] [ebp-24h] int v13; // [esp+28h] [ebp-20h] int v14; // [esp+2Ch] [ebp-1Ch] int v15; // [esp+30h] [ebp-18h] int v16; // [esp+34h] [ebp-14h] int v17; // [esp+38h] [ebp-10h] int v18; // [esp+3Ch] [ebp-Ch] v7 = dword_80565BB; v8 = dword_80565BF; v9 = dword_80565C3; v10 = dword_80565C7; v11 = dword_80565CB; v12 = dword_80565CF; v13 = dword_80565D3; v14 = dword_80565D7; v15 = dword_80565DB; v16 = dword_80565DF; v17 = dword_80565E3; v18 = dword_80565E7; sub_804CB4F(&v6 - 14, a2, a3); return sub_804DD50(a1, a4, a5, (int)&v7); } // 80565BB: using guessed type int dword_80565BB; // 80565BF: using guessed type int dword_80565BF; // 80565C3: using guessed type int dword_80565C3; // 80565C7: using guessed type int dword_80565C7; // 80565CB: using guessed type int dword_80565CB; // 80565CF: using guessed type int dword_80565CF; // 80565D3: using guessed type int dword_80565D3; // 80565D7: using guessed type int dword_80565D7; // 80565DB: using guessed type int dword_80565DB; // 80565DF: using guessed type int dword_80565DF; // 80565E3: using guessed type int dword_80565E3; // 80565E7: using guessed type int dword_80565E7; //----- (0804E515) -------------------------------------------------------- void *__cdecl sub_804E515(signed int a1, char *a2, size_t a3) { return sub_804DD50(a1, a2, a3, (int)&unk_80561D8); } //----- (0804E570) -------------------------------------------------------- void *__cdecl sub_804E570(signed int a1, char *a2) { return sub_804E515(a1, a2, 0xFFFFFFFF); } //----- (0804E5CD) -------------------------------------------------------- int __cdecl sub_804E5CD(int a1) { *(_DWORD *)a1 = 0; *(_DWORD *)(a1 + 4) = 0; *(_DWORD *)(a1 + 8) = 0; sub_804FCE8((char *)(a1 + 12), 0, 0, (int)malloc, (int)free); sub_804FCE8((char *)(a1 + 56), 0, 0, (int)malloc, (int)free); return sub_804FCE8((char *)(a1 + 100), 0, 0, (int)malloc, (int)free); } //----- (0804E6B0) -------------------------------------------------------- int __cdecl sub_804E6B0(_DWORD *a1) { int v3; // eax int v4; // eax a1[4]; sub_804FFCE((int)(a1 + 3), 0); v3 = a1[15]; sub_804FFCE((int)(a1 + 14), 0); v4 = a1[26]; return sub_804FFCE((int)(a1 + 25), 0); } //----- (0804E7E7) -------------------------------------------------------- _DWORD *__cdecl sub_804E7E7(_DWORD *a1) { _DWORD *result; // eax int src; // [esp+10h] [ebp-38h] _DWORD *v3; // [esp+14h] [ebp-34h] _DWORD *v4; // [esp+18h] [ebp-30h] int v5; // [esp+1Ch] [ebp-2Ch] int v6; // [esp+20h] [ebp-28h] _DWORD *v7; // [esp+24h] [ebp-24h] _DWORD *v8; // [esp+28h] [ebp-20h] _DWORD *v9; // [esp+2Ch] [ebp-1Ch] _DWORD *v10; // [esp+30h] [ebp-18h] _DWORD *v11; // [esp+34h] [ebp-14h] size_t n; // [esp+38h] [ebp-10h] _DWORD *v13; // [esp+3Ch] [ebp-Ch] v3 = a1 + 3; src = a1[6] - a1[5] - 1; v4 = a1 + 3; v5 = a1[5]; if ( a1[6] == v5 ) *((_BYTE *)v4 + 40) |= 2u; v4[3] = (v4[6] + v4[3]) & ~v4[6]; if ( v4[3] - v4[1] > (unsigned int)(v4[4] - v4[1]) ) v4[3] = v4[4]; v4[2] = v4[3]; v6 = v5; v7 = a1 + 14; v8 = a1 + 14; if ( (unsigned int)(a1[18] - a1[17]) <= 3 ) sub_804FD91((int)v7, 4); v9 = v7; v10 = (_DWORD *)v7[3]; *v10 = v6; v9[3] += 4; v11 = a1 + 25; n = 4; v13 = a1 + 25; if ( (unsigned int)(a1[29] - a1[28]) < 4 ) sub_804FD91((int)v11, n); memcpy((void *)v11[3], &src, n); v11[3] += n; result = a1; ++*a1; return result; } //----- (0804EA18) -------------------------------------------------------- #error "804EA53: call analysis failed (funcsize=59)" //----- (0804ED4F) -------------------------------------------------------- ssize_t __cdecl sub_804ED4F(int fd, void *buf, size_t nbytes) { ssize_t v4; // [esp+1Ch] [ebp-Ch] while ( 1 ) { do { v4 = read(fd, buf, nbytes); if ( v4 >= 0 ) return v4; } while ( *__errno_location() == 4 ); if ( *__errno_location() != 22 || nbytes <= 0x7FFFE000 ) break; nbytes = 2147475456; } return v4; } //----- (0804EDB1) -------------------------------------------------------- int __cdecl sub_804EDB1(FILE *stream, int a2, int a3, int a4, int a5, int a6) { char *v6; // eax int v7; // esi char *v8; // ebx char *v9; // eax int result; // eax int v11; // edi int v12; // esi char *v13; // ebx char *v14; // eax int v15; // edi int v16; // esi char *v17; // ebx char *v18; // eax int v19; // edi int v20; // esi char *v21; // ebx int v22; // edi int v23; // esi char *v24; // ebx char *v25; // eax int v26; // esi int v27; // edi char *v28; // ebx char *v29; // eax int v30; // edi int v31; // esi char *v32; // ebx char *v33; // eax char *v34; // ebx char *v35; // eax int v36; // edi int v37; // esi char *v38; // ebx char *v39; // eax int v40; // edi int v41; // esi char *v42; // ebx char *v43; // eax char *v44; // [esp+4h] [ebp-64h] char *v45; // [esp+8h] [ebp-60h] int v46; // [esp+Ch] [ebp-5Ch] int v47; // [esp+10h] [ebp-58h] int v48; // [esp+14h] [ebp-54h] int v49; // [esp+18h] [ebp-50h] int v50; // [esp+1Ch] [ebp-4Ch] int v51; // [esp+20h] [ebp-48h] int v52; // [esp+24h] [ebp-44h] int v53; // [esp+28h] [ebp-40h] int v54; // [esp+38h] [ebp-30h] int v55; // [esp+3Ch] [ebp-2Ch] int v56; // [esp+40h] [ebp-28h] int v57; // [esp+44h] [ebp-24h] int v58; // [esp+48h] [ebp-20h] int v59; // [esp+4Ch] [ebp-1Ch] if ( a2 ) { v47 = a4; fprintf(stream, "%s (%s) %s\n", a2, a3, a4); } else { fprintf(stream, "%s %s\n", a3, a4); } v46 = 2017; v45 = gettext("(C)"); fprintf(stream, "Copyright %s %d Free Software Foundation, Inc.", v45, 2017); v6 = gettext( "\n" "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" "\n"); fputs_unlocked(v6, stream); switch ( a6 ) { case 0: abort(); return result; case 1: v34 = *(char **)a5; v35 = gettext("Written by %s.\n"); result = fprintf(stream, v35, v34); break; case 2: v7 = *(_DWORD *)(a5 + 4); v8 = *(char **)a5; v9 = gettext("Written by %s and %s.\n"); result = fprintf(stream, v9, v8, v7); break; case 3: v11 = *(_DWORD *)(a5 + 8); v12 = *(_DWORD *)(a5 + 4); v13 = *(char **)a5; v14 = gettext("Written by %s, %s, and %s.\n"); result = fprintf(stream, v14, v13, v12, v11); break; case 4: v59 = *(_DWORD *)(a5 + 12); v15 = *(_DWORD *)(a5 + 8); v16 = *(_DWORD *)(a5 + 4); v17 = *(char **)a5; v18 = gettext("Written by %s, %s, %s,\nand %s.\n"); v48 = v59; v47 = v15; v46 = v16; v45 = v17; result = fprintf(stream, v18, v17, v16, v15, v59); break; case 5: v59 = *(_DWORD *)(a5 + 16); v58 = *(_DWORD *)(a5 + 12); v19 = *(_DWORD *)(a5 + 8); v20 = *(_DWORD *)(a5 + 4); v21 = *(char **)a5; v49 = v59; v48 = v58; v47 = v19; v46 = v20; v45 = v21; v44 = gettext("Written by %s, %s, %s,\n%s, and %s.\n"); result = fprintf(stream, v44, v21, v20, v19, v58, v59); break; case 6: v59 = *(_DWORD *)(a5 + 20); v58 = *(_DWORD *)(a5 + 16); v57 = *(_DWORD *)(a5 + 12); v22 = *(_DWORD *)(a5 + 8); v23 = *(_DWORD *)(a5 + 4); v24 = *(char **)a5; v25 = gettext("Written by %s, %s, %s,\n%s, %s, and %s.\n"); result = fprintf(stream, v25, v24, v23, v22, v57, v58, v59); break; case 7: v26 = *(_DWORD *)(a5 + 24); v59 = *(_DWORD *)(a5 + 20); v58 = *(_DWORD *)(a5 + 16); v57 = *(_DWORD *)(a5 + 12); v56 = *(_DWORD *)(a5 + 8); v27 = *(_DWORD *)(a5 + 4); v28 = *(char **)a5; v29 = gettext("Written by %s, %s, %s,\n%s, %s, %s, and %s.\n"); v51 = v26; v50 = v59; v49 = v58; v48 = v57; v47 = v56; v46 = v27; v45 = v28; result = fprintf(stream, v29, v28, v27, v56, v57, v58, v59, v26); break; case 8: v30 = *(_DWORD *)(a5 + 28); v59 = *(_DWORD *)(a5 + 24); v58 = *(_DWORD *)(a5 + 20); v57 = *(_DWORD *)(a5 + 16); v56 = *(_DWORD *)(a5 + 12); v55 = *(_DWORD *)(a5 + 8); v31 = *(_DWORD *)(a5 + 4); v32 = *(char **)a5; v33 = gettext("Written by %s, %s, %s,\n%s, %s, %s, %s,\nand %s.\n"); v52 = v30; v51 = v59; v50 = v58; v49 = v57; v48 = v56; v47 = v55; v46 = v31; v45 = v32; result = fprintf(stream, v33, v32, v31, v55, v56, v57, v58, v59, v30); break; case 9: v36 = *(_DWORD *)(a5 + 32); v59 = *(_DWORD *)(a5 + 28); v58 = *(_DWORD *)(a5 + 24); v57 = *(_DWORD *)(a5 + 20); v56 = *(_DWORD *)(a5 + 16); v55 = *(_DWORD *)(a5 + 12); v54 = *(_DWORD *)(a5 + 8); v37 = *(_DWORD *)(a5 + 4); v38 = *(char **)a5; v39 = gettext("Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, and %s.\n"); v53 = v36; v52 = v59; v51 = v58; v50 = v57; v49 = v56; v48 = v55; v47 = v54; v46 = v37; v45 = v38; result = fprintf(stream, v39, v38, v37, v54, v55, v56, v57, v58, v59, v36); break; default: v40 = *(_DWORD *)(a5 + 32); v59 = *(_DWORD *)(a5 + 28); v58 = *(_DWORD *)(a5 + 24); v57 = *(_DWORD *)(a5 + 20); v56 = *(_DWORD *)(a5 + 16); v55 = *(_DWORD *)(a5 + 12); v54 = *(_DWORD *)(a5 + 8); v41 = *(_DWORD *)(a5 + 4); v42 = *(char **)a5; v43 = gettext("Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, %s, and others.\n"); v53 = v40; v52 = v59; v51 = v58; v50 = v57; v49 = v56; v48 = v55; v47 = v54; v46 = v41; v45 = v42; result = fprintf(stream, v43, v42, v41, v54, v55, v56, v57, v58, v59, v40); break; } return result; } // 8049130: using guessed type int __cdecl fputs_unlocked(_DWORD, _DWORD); //----- (0804F40A) -------------------------------------------------------- int __cdecl sub_804F40A(FILE *stream, int a2, int a3, int a4, int a5) { int *v5; // eax unsigned int i; // [esp+24h] [ebp-34h] int v8[12]; // [esp+28h] [ebp-30h] for ( i = 0; i <= 9; ++i ) { v5 = (int *)a5; a5 += 4; v8[i] = *v5; if ( !v8[i] ) break; } return sub_804EDB1(stream, a2, a3, a4, (int)v8, i); } // 804F40A: using guessed type int var_30[12]; //----- (0804F480) -------------------------------------------------------- int sub_804F480(FILE *stream, int a2, int a3, int a4, ...) { va_list va; // [esp+24h] [ebp+18h] va_start(va, a4); return sub_804F40A(stream, a2, a3, a4, (int)va); } //----- (0804F538) -------------------------------------------------------- int __cdecl sub_804F538(unsigned int a1, unsigned int a2) { int v2; // ecx _DWORD *savedregs; // [esp+18h] [ebp+0h] savedregs = &savedregs; dword_8056184 = (int (__fastcall *)(_DWORD, _DWORD))sub_804F577; if ( 0x7FFFFFFF / a2 < a1 ) sub_804F7FD(); return dword_8056184(v2, 0x7FFFFFFF % a2); } // 804F577: using guessed type int sub_804F577(); // 8056184: using guessed type int (__fastcall *dword_8056184)(_DWORD, _DWORD); //----- (0804F577) -------------------------------------------------------- #error "804F587: positive sp value has been found (funcsize=0)" //----- (0804F5DF) -------------------------------------------------------- void *__cdecl sub_804F5DF(void *ptr, int a2, int a3) { unsigned int v4; // [esp+1Ch] [ebp-Ch] v4 = *(_DWORD *)a2; if ( ptr ) { if ( 0x55555554u / a3 <= v4 ) sub_804F7FD(); v4 += (v4 >> 1) + 1; } else { if ( !v4 ) v4 = (0x40u / a3 == 0) + 0x40u / a3; if ( 0x7FFFFFFFu / a3 < v4 ) sub_804F7FD(); } *(_DWORD *)a2 = v4; return sub_804F6D7(ptr, a3 * v4); } //----- (0804F676) -------------------------------------------------------- int __cdecl sub_804F676(size_t size) { return sub_804F689(size); } //----- (0804F689) -------------------------------------------------------- int __cdecl sub_804F689(size_t size) { int v1; // edx int v2; // ecx void *v3; // ST1C_4 _DWORD *savedregs; // [esp+28h] [ebp+0h] savedregs = &savedregs; v3 = malloc(size); dword_8056184 = (int (__fastcall *)(_DWORD, _DWORD))sub_804F6D2; if ( !v3 ) { dword_8056184 = (int (__fastcall *)(_DWORD, _DWORD))sub_804F6D2; if ( size ) sub_804F7FD(); } return dword_8056184(v2, v1); } // 804F6D2: using guessed type int sub_804F6D2(); // 8056184: using guessed type int (__fastcall *dword_8056184)(_DWORD, _DWORD); //----- (0804F6D2) -------------------------------------------------------- #error "804F6D6: positive sp value has been found (funcsize=0)" //----- (0804F6D7) -------------------------------------------------------- void *__cdecl sub_804F6D7(void *ptr, size_t size) { void *result; // eax void *ptra; // [esp+20h] [ebp+8h] if ( size || !ptr ) { ptra = realloc(ptr, size); if ( !ptra ) { if ( size ) sub_804F7FD(); } result = ptra; } else { free(ptr); result = 0; } return result; } //----- (0804F7AF) -------------------------------------------------------- void *__cdecl sub_804F7AF(void *src, size_t n) { void *v2; // eax v2 = (void *)sub_804F689(n); return memcpy(v2, src, n); } //----- (0804F7FD) -------------------------------------------------------- void __noreturn sub_804F7FD() { char *v0; // eax v0 = gettext("memory exhausted"); error(status, 0, "%s", v0); abort(); } //----- (0804F836) -------------------------------------------------------- void sub_804F836() { ; } //----- (0804F83B) -------------------------------------------------------- void sub_804F83B() { if ( sub_80500FD() < 0 ) sub_804F836(); } //----- (0804F85E) -------------------------------------------------------- #error "804F8E4: call analysis failed (funcsize=63)" //----- (0804F93A) -------------------------------------------------------- int __cdecl sub_804F93A(FILE *a1) { int result; // eax result = a1->_flags & 0x100; if ( result ) result = sub_804F9B3(a1, 0, 0, 1); return result; } //----- (0804F973) -------------------------------------------------------- int __cdecl sub_804F973(FILE *fp) { if ( !fp || !__freading(fp) ) return fflush(fp); sub_804F93A(fp); return fflush(fp); } //----- (0804F9B3) -------------------------------------------------------- int __cdecl sub_804F9B3(FILE *stream, int a2, int a3, int a4) { int v4; // eax __off64_t v5; // rax int v7; // [esp+10h] [ebp-2Ch] int v8; // [esp+14h] [ebp-28h] int v9; // [esp+20h] [ebp-1Ch] int v10; // [esp+24h] [ebp-18h] int v11; // [esp+28h] [ebp-14h] __off64_t v12; // [esp+28h] [ebp-14h] int v13; // [esp+2Ch] [ebp-10h] int v14; // [esp+30h] [ebp-Ch] int v15; // [esp+34h] [ebp-8h] if ( stream->_IO_read_end != stream->_IO_read_ptr || stream->_IO_write_ptr != stream->_IO_write_base || stream->_IO_save_base ) { return fseeko64(stream, a2, a3, a4, v7, v8, a2, a3, v9, v10, v11, v13, v14, v15); } v4 = fileno(stream); LODWORD(v5) = lseek64(v4, a2, a3, a4, v7, v8, a2, a3, v9, v10, v11, v13, v14, v15); v12 = v5; if ( v5 == -1 ) { dword_8056154 = (int)&locret_804FAC0; sub_80510DD(); } stream->_flags &= 0xFFFFFFEF; stream->_offset = v12; return 0; } // 8048F80: using guessed type int __stdcall fseeko64(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // 8049260: using guessed type int __stdcall lseek64(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // 80510DD: using guessed type int sub_80510DD(void); // 8056154: using guessed type int dword_8056154; //----- (0804FAC2) -------------------------------------------------------- size_t __cdecl sub_804FAC2(wchar_t *pwc, char *s, size_t n, mbstate_t *p) { char v5; // [esp+18h] [ebp-10h] size_t v6; // [esp+1Ch] [ebp-Ch] if ( !pwc ) pwc = (wchar_t *)&v5; v6 = mbrtowc(pwc, s, n, p); if ( v6 <= 0xFFFFFFFD || !n || !((unsigned __int8)sub_8050222(0) ^ 1) ) return v6; *pwc = (unsigned __int8)*s; return 1; } //----- (0804FB34) -------------------------------------------------------- int __cdecl sub_804FB34(int a1, int a2) { int result; // eax if ( *(_BYTE *)(a1 + 40) & 1 ) result = (*(int (__cdecl **)(_DWORD, int))(a1 + 28))(*(_DWORD *)(a1 + 36), a2); else result = (*(int (__cdecl **)(int))(a1 + 28))(a2); return result; } //----- (0804FB72) -------------------------------------------------------- int __cdecl sub_804FB72(int a1, int a2) { int result; // eax if ( *(_BYTE *)(a1 + 40) & 1 ) result = (*(int (__cdecl **)(_DWORD, int))(a1 + 32))(*(_DWORD *)(a1 + 36), a2); else result = (*(int (__cdecl **)(int))(a1 + 32))(a2); return result; } //----- (0804FBBC) -------------------------------------------------------- #error "804FCDD: call analysis failed (funcsize=71)" //----- (0804FCE8) -------------------------------------------------------- int __cdecl sub_804FCE8(char *format, int a2, int a3, int a4, int a5) { *((_DWORD *)format + 7) = a4; *((_DWORD *)format + 8) = a5; format[40] &= 0xFEu; return sub_804FBBC(format, a2, a3); } //----- (0804FD91) -------------------------------------------------------- int __cdecl sub_804FD91(int a1, int a2) { int result; // eax _DWORD *v3; // [esp+14h] [ebp-24h] unsigned int v4; // [esp+18h] [ebp-20h] int v5; // [esp+1Ch] [ebp-1Ch] size_t n; // [esp+20h] [ebp-18h] size_t v7; // [esp+24h] [ebp-14h] size_t v8; // [esp+28h] [ebp-10h] void *dest; // [esp+2Ch] [ebp-Ch] v5 = *(_DWORD *)(a1 + 4); v3 = 0; n = *(_DWORD *)(a1 + 12) - *(_DWORD *)(a1 + 8); v7 = n + a2; v8 = *(_DWORD *)(a1 + 24) + n + a2; v4 = (n >> 3) + v8 + 100; if ( v4 < v8 ) v4 = v8; if ( *(_DWORD *)a1 > v4 ) v4 = *(_DWORD *)a1; if ( n <= v7 && v7 <= v8 ) v3 = (_DWORD *)sub_804FB34(a1, v4); if ( !v3 ) obstack_alloc_failed_handler(); *(_DWORD *)(a1 + 4) = v3; v3[1] = v5; *(_DWORD *)(a1 + 16) = (char *)v3 + v4; *v3 = *(_DWORD *)(a1 + 16); dest = (void *)(((unsigned int)v3 + *(_DWORD *)(a1 + 24) + 8) & ~*(_DWORD *)(a1 + 24)); memcpy(dest, *(const void **)(a1 + 8), n); if ( !(*(_BYTE *)(a1 + 40) & 2) && *(_DWORD *)(a1 + 8) == ((*(_DWORD *)(a1 + 24) + v5 + 8) & ~*(_DWORD *)(a1 + 24)) ) { v3[1] = *(_DWORD *)(v5 + 4); sub_804FB72(a1, v5); } *(_DWORD *)(a1 + 8) = dest; *(_DWORD *)(a1 + 12) = n + *(_DWORD *)(a1 + 8); result = a1; *(_BYTE *)(a1 + 40) &= 0xFDu; return result; } // 8056280: using guessed type int (*obstack_alloc_failed_handler)(void); //----- (0804FF8A) -------------------------------------------------------- _BOOL4 __cdecl sub_804FF8A(int a1, unsigned int a2) { unsigned int *i; // [esp+8h] [ebp-8h] for ( i = *(unsigned int **)(a1 + 4); i && ((unsigned int)i >= a2 || *i < a2); i = (unsigned int *)i[1] ) ; return i != 0; } //----- (0804FFCE) -------------------------------------------------------- int __cdecl sub_804FFCE(int a1, unsigned int a2) { int result; // eax int *v3; // ST1C_4 int *v4; // [esp+18h] [ebp-10h] result = *(_DWORD *)(a1 + 4); v4 = *(int **)(a1 + 4); while ( v4 ) { if ( (unsigned int)v4 < a2 ) { result = *v4; if ( *v4 >= a2 ) break; } v3 = (int *)v4[1]; sub_804FB72(a1, (int)v4); v4 = v3; result = a1; *(_BYTE *)(a1 + 40) |= 2u; } if ( v4 ) { *(_DWORD *)(a1 + 12) = a2; *(_DWORD *)(a1 + 8) = *(_DWORD *)(a1 + 12); *(_DWORD *)(a1 + 16) = *v4; result = a1; *(_DWORD *)(a1 + 4) = v4; } else if ( a2 ) { abort(); } return result; } //----- (080500B0) -------------------------------------------------------- void __noreturn sub_80500B0() { char *v0; // eax v0 = gettext("memory exhausted"); fprintf(stderr, "%s\n", v0); exit(status); } //----- (080500E9) -------------------------------------------------------- int sub_80500E9() { return 0; } //----- (080500F3) -------------------------------------------------------- int sub_80500F3() { return 0; } //----- (080500FD) -------------------------------------------------------- int sub_80500FD() { int result; // eax int v1; // [esp+14h] [ebp-4h] v1 = sub_80500F3(); if ( v1 ) result = v1; else result = sub_80500E9(); return result; } //----- (08050130) -------------------------------------------------------- int __cdecl sub_8050130(unsigned __int8 *a1, unsigned __int8 *a2) { unsigned __int8 *v2; // esi unsigned __int8 *v3; // ebx unsigned __int8 v5; // al unsigned __int8 v6; // [esp+1Eh] [ebp-Ah] v2 = a1; v3 = a2; if ( a1 == a2 ) return 0; do { v6 = sub_8050A20(*v2); v5 = sub_8050A20(*v3); if ( !v6 ) break; ++v2; ++v3; } while ( v6 == v5 ); return v6 - v5; } //----- (080501A1) -------------------------------------------------------- int __cdecl sub_80501A1(FILE *fp) { bool v1; // ST1E_1 bool v3; // [esp+1Dh] [ebp-Bh] bool v4; // [esp+1Fh] [ebp-9h] v3 = __fpending(fp) != 0; v1 = ferror_unlocked(fp) != 0; v4 = sub_804F85E(fp) != 0; if ( !v1 && (!v4 || !v3 && *__errno_location() == 9) ) return 0; if ( v4 != 1 ) *__errno_location() = 0; return -1; } //----- (08050222) -------------------------------------------------------- int __cdecl sub_8050222(int category) { unsigned __int8 v2; // [esp+1Bh] [ebp-Dh] const char *s1; // [esp+1Ch] [ebp-Ch] v2 = 1; s1 = setlocale(category, 0); if ( s1 && (!strcmp(s1, "C") || !strcmp(s1, "POSIX")) ) v2 = 0; return v2; } //----- (08050280) -------------------------------------------------------- void *sub_8050280() { _BOOL4 v0; // eax size_t v2; // [esp+0h] [ebp-C8h] char *v3; // [esp+8h] [ebp-C0h] char *v4; // [esp+Ch] [ebp-BCh] void *ptr; // [esp+14h] [ebp-B4h] void *v6; // [esp+18h] [ebp-B0h] char *s; // [esp+1Ch] [ebp-ACh] void *v8; // [esp+20h] [ebp-A8h] size_t v9; // [esp+24h] [ebp-A4h] char *v10; // [esp+28h] [ebp-A0h] size_t n; // [esp+2Ch] [ebp-9Ch] size_t v12; // [esp+30h] [ebp-98h] _BOOL4 v13; // [esp+34h] [ebp-94h] void *dest; // [esp+38h] [ebp-90h] int fd; // [esp+3Ch] [ebp-8Ch] FILE *stream; // [esp+40h] [ebp-88h] int c; // [esp+44h] [ebp-84h] size_t v18; // [esp+48h] [ebp-80h] size_t v19; // [esp+4Ch] [ebp-7Ch] void *v20; // [esp+50h] [ebp-78h] char src; // [esp+56h] [ebp-72h] char v22; // [esp+89h] [ebp-3Fh] unsigned int v23; // [esp+BCh] [ebp-Ch] v23 = __readgsdword(0x14u); v6 = (void *)dword_80566FB; if ( !dword_80566FB ) { ptr = 0; v10 = "charset.alias"; s = getenv("CHARSETALIASDIR"); if ( !s || !*s ) { ptr = 0; s = "/home/hwangdz/coreutils/coreutils-8.28/install_m32/lib"; } n = strlen(s); v12 = strlen(v10); v0 = n && s[n - 1] != 47; v13 = v0; v2 = n + v0 + v12 + 1; dest = malloc(v2); if ( dest ) { memcpy(dest, s, n); if ( v13 ) *((_BYTE *)dest + n) = 47; memcpy((char *)dest + n + v13, v10, v12 + 1); } free(ptr); if ( dest ) { fd = open64(dest, 0x20000); if ( fd >= 0 ) { stream = fdopen(fd, "r"); if ( stream ) { v8 = 0; v9 = 0; while ( 1 ) { c = getc_unlocked(stream); if ( c == -1 ) break; if ( c != 10 && c != 32 && c != 9 ) { if ( c == 35 ) { do c = getc_unlocked(stream); while ( c != -1 && c != 10 ); if ( c == -1 ) break; } else { ungetc(c, stream); v4 = &v22; v3 = &src; if ( fscanf(stream, "%50s %50s", &src, &v22) <= 1 ) break; v18 = strlen(&src); v19 = strlen(&v22); v20 = v8; if ( v9 ) { v9 += v19 + v18 + 2; v8 = realloc(v8, v9 + 1); } else { v9 = v18 + v19 + 2; v2 = v18 + v19 + 3; v8 = malloc(v2); } if ( !v8 ) { v9 = 0; free(v20); break; } strcpy((char *)v8 + v9 - v19 - v18 - 2, &src); strcpy((char *)v8 + v9 - v19 - 1, (const char *)&v2 - 63); } } } sub_804F85E(stream); if ( !v9 ) { v6 = &unk_8052457; dword_8056168 = (int)&loc_805074F; sub_805104D(); } *((_BYTE *)v8 + v9) = 0; v6 = v8; } else { close(fd); v6 = &unk_8052457; } } else { v6 = &unk_8052457; } free(dest); } else { v6 = &unk_8052457; } dword_80566FB = (int)v6; } return v6; } // 8048EB0: using guessed type int __cdecl open64(_DWORD, _DWORD); // 805104D: using guessed type int sub_805104D(void); // 8056168: using guessed type int dword_8056168; // 80566FB: using guessed type int dword_80566FB; //----- (08050788) -------------------------------------------------------- const char *sub_8050788() { char *v0; // ST1C_4 const char *s1; // [esp+18h] [ebp-10h] char *s2; // [esp+1Ch] [ebp-Ch] s1 = nl_langinfo(14); if ( !s1 ) s1 = (const char *)&unk_8052457; for ( s2 = (char *)sub_8050280(); *s2; s2 = &v0[strlen(v0) + 1] ) { if ( !strcmp(s1, s2) || *s2 == 42 && !s2[1] ) { s1 = &s2[strlen(s2) + 1]; break; } v0 = &s2[strlen(s2) + 1]; } if ( !*s1 ) s1 = "ASCII"; return s1; } //----- (08050A20) -------------------------------------------------------- int __cdecl sub_8050A20(int a1) { int result; // eax if ( (unsigned int)(a1 - 65) > 0x19 ) result = a1; else result = a1 + 32; return result; } //----- (08050A5C) -------------------------------------------------------- int __usercall sub_8050A5C@<eax>(int a1@<edi>, int a2@<esi>, int a3, int a4, unsigned int a5, int a6) { int result; // eax unsigned int v7; // [esp+0h] [ebp-18h] int v8; // [esp+4h] [ebp-14h] int v9; // [esp+Ch] [ebp-Ch] int v10; // [esp+10h] [ebp-8h] v10 = a1; v9 = a2; v8 = a3; v7 = a5; dword_8056184 = (int (__fastcall *)(_DWORD, _DWORD))&loc_8050AFC; if ( a6 || (dword_8056184 = (int (__fastcall *)(_DWORD, _DWORD))&loc_8050B87, a5 > (unsigned int)&v7) || (dword_8056184 = (int (__fastcall *)(_DWORD, _DWORD))&loc_8050AD5, a5) ) { result = dword_8056184(a5, a4); } else { result = __PAIR__((unsigned int)&v7 % (1 / 0u), a3) / (1 / 0u); } return result; } // 8056184: using guessed type int (__fastcall *dword_8056184)(_DWORD, _DWORD); //----- (08050C8B) -------------------------------------------------------- int __cdecl sub_8050C8B(unsigned __int64 a1, __int64 a2) { int v2; // edx int result; // eax int v4; // ebp int v5; // ebp unsigned int v6; // ebp unsigned __int64 v7; // rtt unsigned __int64 v8; // rax unsigned int v9; // edi unsigned __int64 v10; // rax unsigned int v11; // ecx unsigned int v12; // [esp+0h] [ebp-20h] unsigned int v13; // [esp+4h] [ebp-1Ch] unsigned __int64 v14; // [esp+8h] [ebp-18h] unsigned int v15; // [esp+10h] [ebp-10h] v13 = HIDWORD(a1); v15 = a1; v12 = a2; v14 = a1; if ( HIDWORD(a2) ) { if ( HIDWORD(a2) > HIDWORD(a1) ) { result = a1; } else { _BitScanReverse((unsigned int *)&v4, HIDWORD(a2)); v5 = v4 ^ 0x1F; if ( v5 ) { v13 = (HIDWORD(a2) << v5) | (v12 >> (32 - v5)); LODWORD(v14) = v12 << v5; HIDWORD(v8) = HIDWORD(a1) >> (32 - v5); LODWORD(v8) = (HIDWORD(a1) << v5) | (v15 >> (32 - v5)); HIDWORD(v14) = v15 << v5; v9 = v8 % v13; v10 = (v12 << v5) * (unsigned __int64)(unsigned int)(v8 / v13); v12 = HIDWORD(v10); v11 = v10; if ( v9 < HIDWORD(v10) || HIDWORD(v14) < (unsigned int)v10 && v9 == HIDWORD(v10) ) { HIDWORD(v10) = v12; HIDWORD(v10) = (v10 - __PAIR__(v13, (unsigned int)v14)) >> 32; v11 = v10 - v14; } result = ((__PAIR__(v9, HIDWORD(v14)) - __PAIR__(HIDWORD(v10), v11)) >> 32 << (32 - (unsigned __int8)v5)) | ((HIDWORD(v14) - v11) >> (char)&v12); } else { if ( v12 <= (unsigned int)v14 || HIDWORD(a2) < HIDWORD(v14) ) v14 = __PAIR__(v13, (unsigned int)a1) - a2; result = v14; } } } else { if ( (unsigned int)a2 <= HIDWORD(a1) ) { v6 = a2; if ( !(_DWORD)a2 ) v6 = 1 / 0u; LODWORD(v7) = a1; HIDWORD(v7) = v13 % v6; v2 = v7 % v6; } else { v2 = a1 % (unsigned int)a2; } result = v2; } return result; } //----- (08050E7E) -------------------------------------------------------- int __cdecl sub_8050E7E(int a1) { return __cxa_atexit(a1, 0, dword_805619C); } // 8049070: using guessed type int __cdecl __cxa_atexit(_DWORD, _DWORD, _DWORD); // 805619C: using guessed type int dword_805619C; //----- (08050EAD) -------------------------------------------------------- int __cdecl sub_8050EAD(int a1, int a2) { return __xstat64(3, a1, a2); } // 80492B0: using guessed type int __cdecl __xstat64(_DWORD, _DWORD, _DWORD); //----- (08050EEC) -------------------------------------------------------- int __cdecl sub_8050EEC(int a1, int a2) { return __fxstat64(3, a1, a2); } // 8049020: using guessed type int __cdecl __fxstat64(_DWORD, _DWORD, _DWORD); //----- (0805104D) -------------------------------------------------------- #error "8051053: positive sp value has been found (funcsize=0)" //----- (080510DD) -------------------------------------------------------- #error "80510E3: positive sp value has been found (funcsize=0)" //----- (080511B7) -------------------------------------------------------- #error "80511BD: positive sp value has been found (funcsize=0)" //----- (080511D0) -------------------------------------------------------- int (**sub_80511D0())() { int (**result)(); // eax int v1; // esi int v2; // edi init_proc(); result = off_8055EEC; v1 = &off_8055EF0 - off_8055EEC; if ( v1 ) { v2 = 0; do result = (int (**)())off_8055EEC[v2++](); while ( v1 != v2 ); } return result; } // 8055EEC: using guessed type int (*off_8055EEC[2])(); // 8055EF0: using guessed type int (*off_8055EF0)(); //----- (08051234) -------------------------------------------------------- void term_proc() { ; } #error "There were 15 decompilation failure(s) on 125 function(s)"
26.359923
273
0.493288
7766c4a62f6a054c09897e102214f299372fa9a8
1,565
html
HTML
demo-gui/src/main/webapp/angular-1.3.15/docs/examples/example-radio-input-directive/index-debug.html
dc4cities/demo
1977e78e29bb2b7c4e70a4f86aea4fd38e32e44e
[ "Apache-2.0" ]
1
2018-08-30T20:07:57.000Z
2018-08-30T20:07:57.000Z
demo-gui/src/main/webapp/angular-1.3.15/docs/examples/example-radio-input-directive/index-debug.html
dc4cities/demo
1977e78e29bb2b7c4e70a4f86aea4fd38e32e44e
[ "Apache-2.0" ]
null
null
null
demo-gui/src/main/webapp/angular-1.3.15/docs/examples/example-radio-input-directive/index-debug.html
dc4cities/demo
1977e78e29bb2b7c4e70a4f86aea4fd38e32e44e
[ "Apache-2.0" ]
null
null
null
<!doctype html> <!-- ~ Copyright 2012 The DC4Cities author. ~ ~ 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. --> <html lang="en"> <head> <meta charset="UTF-8"> <title>Example - example-radio-input-directive-debug</title> <script src="../../../angular.js"></script> </head> <body ng-app="radioExample"> <script> angular.module('radioExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.color = { name: 'blue' }; $scope.specialValue = { "id": "12345", "value": "green" }; }]); </script> <form name="myForm" ng-controller="ExampleController"> <input type="radio" ng-model="color.name" value="red"> Red <br/> <input type="radio" ng-model="color.name" ng-value="specialValue"> Green <br/> <input type="radio" ng-model="color.name" value="blue"> Blue <br/> <tt>color = {{color.name | json}}</tt><br/> </form> Note that `ng-value="specialValue"` sets radio item's value to be the value of `$scope.specialValue`. </body> </html>
31.3
102
0.650479
e504a5443dd96fd5d83284249c474ba0bb4dc55e
82
sql
SQL
Impala/Interactive_Query/set-scan.sql
BenchCouncil/BigDataBench_V5.0_BigData_MicroBenchmark
705d5dacb2bdab0dc2653c1e17768deca62ae784
[ "Apache-2.0" ]
2
2022-01-06T12:15:55.000Z
2022-03-29T01:31:05.000Z
Impala/Interactive_Query/set-scan.sql
BenchCouncil/BigDataBench_V5.0_BigData_MicroBenchmark
705d5dacb2bdab0dc2653c1e17768deca62ae784
[ "Apache-2.0" ]
null
null
null
Impala/Interactive_Query/set-scan.sql
BenchCouncil/BigDataBench_V5.0_BigData_MicroBenchmark
705d5dacb2bdab0dc2653c1e17768deca62ae784
[ "Apache-2.0" ]
1
2021-12-20T02:35:08.000Z
2021-12-20T02:35:08.000Z
drop table result; create table result (GOODS_PRICE double,GOODS_AMOUNT double);
20.5
61
0.817073
0a32f084e1c98bf90cc76339b9096c5f2a05025c
2,680
kt
Kotlin
backend/src/main/kotlin/api/ReviewApi.kt
burger-tuesday/burger-tuesday
019830d238f9b1c670fc2e1f31e457bd174898a9
[ "MIT" ]
8
2019-04-16T16:11:51.000Z
2020-01-08T22:10:29.000Z
backend/src/main/kotlin/api/ReviewApi.kt
burger-tuesday/burger-tuesday
019830d238f9b1c670fc2e1f31e457bd174898a9
[ "MIT" ]
74
2019-04-18T17:27:12.000Z
2022-03-03T22:16:43.000Z
backend/src/main/kotlin/api/ReviewApi.kt
burger-tuesday/burger-tuesday
019830d238f9b1c670fc2e1f31e457bd174898a9
[ "MIT" ]
2
2019-04-09T05:30:25.000Z
2019-06-25T06:07:26.000Z
package com.grosslicht.burgertuesday.api import com.grosslicht.burgertuesday.domain.Review import com.grosslicht.burgertuesday.domain.ToplistEntry import org.springframework.data.domain.Pageable import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity import org.springframework.http.codec.ServerSentEvent import org.springframework.validation.annotation.Validated import org.springframework.web.bind.annotation.DeleteMapping import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.PostMapping import org.springframework.web.bind.annotation.PutMapping import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RequestParam import reactor.core.publisher.Flux import javax.validation.Valid import javax.validation.constraints.NotNull @Validated @RequestMapping("/v1") interface ReviewApi { @PostMapping("/reviews", consumes = ["application/json"]) fun createReview(@Valid @RequestBody review: Review): ResponseEntity<Review> { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } @DeleteMapping("/reviews/{id}") fun deleteReview(@PathVariable("id") id: String): ResponseEntity<Unit> { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } @GetMapping("/reviews") fun getAllReviews(pageable: Pageable): ResponseEntity<List<Review>> { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } @GetMapping("/reviews/{id}") fun getReview(@PathVariable("id") id: String): ResponseEntity<Review> { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } @GetMapping("/_search/reviews") fun searchReviews( @NotNull @RequestParam(value = "query", required = true) query: String, pageable: Pageable ): ResponseEntity<List<Review>> { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } @PutMapping("/reviews", consumes = ["application/json"]) fun updateReview(@Valid @RequestBody review: Review): ResponseEntity<Review> { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } @GetMapping(path = ["/reviews/live"], produces = [MediaType.TEXT_EVENT_STREAM_VALUE]) fun liveReviews(): Flux<ServerSentEvent<String>> { return Flux.error<ServerSentEvent<String>>(NotImplementedError()) } @GetMapping("/reviews/top") fun getReviewRanking(): ResponseEntity<List<ToplistEntry>> { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } }
38.84058
89
0.766418
864ef695c933e93d88547b0f6936b065408d7fc7
1,279
sql
SQL
src/main/webapp/resources/sql/check_double_payments.sql
buddhika75/hims
2a7822a9c9d6ff18ea435f13175d934136e6cfda
[ "MIT" ]
71
2019-06-12T11:09:11.000Z
2022-03-26T07:41:48.000Z
src/main/webapp/resources/sql/check_double_payments.sql
lk-gov-health-hiu/pis
9a544d4c1f1cb32238c228bb8ac67c6e9415d8ba
[ "MIT" ]
160
2015-02-05T11:19:52.000Z
2015-11-24T11:43:14.000Z
src/main/webapp/resources/sql/check_double_payments.sql
lk-gov-health-hiu/pis
9a544d4c1f1cb32238c228bb8ac67c6e9415d8ba
[ "MIT" ]
49
2019-10-08T06:07:57.000Z
2022-03-15T12:50:12.000Z
-- select bill.deptId from billitem join bill on billitem.bill_id = bill.`ID` where billitem.`ID` in -- (SELECT bi.`ID` FROM billitem bi join bill b on bi.`BILL_ID`=b.`ID` join billfee bf on bi.`PAIDFORBILLFEE_ID`=bf.`ID` -- WHERE b.`RETIRED`=false and b.`BILLTYPE`='PaymentBill' -- group by bi.`PAIDFORBILLFEE_ID` , bi.`ID` -- having count(bi.`PAIDFORBILLFEE_ID`)>1); -- SELECT pe.`BHTNO` FROM billitem bi join bill b on bi.`BILL_ID`=b.`ID` join billfee bf on bi.`PAIDFORBILLFEE_ID`=bf.`ID` join patientencounter pe on b.`PATIENTENCOUNTER_ID`=pe.`ID` -- WHERE bf.`ID`=1874132; -- 1 SELECT bi.`PAIDFORBILLFEE_ID`,pe.`BHTNO` FROM billitem bi join bill b on bi.`BILL_ID`=b.`ID` join billfee bf on bi.`PAIDFORBILLFEE_ID`=bf.`ID` join patientencounter pe on bf.`PATIENENCOUNTER_ID`=pe.`ID` join bill rb on bi.`REFERENCEBILL_ID`=rb.`ID` WHERE b.`RETIRED`=false and b.`BILLTYPE`='PaymentBill' and (rb.`BILLTYPE`='InwardBill' or rb.`BILLTYPE`='InwardProfessional') and b.`CANCELLED`=false group by bi.`PAIDFORBILLFEE_ID` having count(bi.`PAIDFORBILLFEE_ID`)>1; -- 2 -- SELECT pe.`BHTNO` FROM billitem bi join billfee bf on bi.`PAIDFORBILLFEE_ID`=bf.`ID` join bill b on bf.`BILL_ID`=b.`ID` join patientencounter pe on b.`PATIENTENCOUNTER_ID`=pe.`ID` -- WHERE bf.`ID`=7753253;
53.291667
182
0.724785
0e42bd208eea589803186be20308448fe136c16b
210
asm
Assembly
src/test/resources/data/searchtests/opt-test3.asm
cpcitor/mdlz80optimizer
75070d984e1f08474e6d397c7e0eb66d8be0c432
[ "Apache-2.0" ]
36
2020-06-29T06:52:26.000Z
2022-02-10T19:41:58.000Z
src/test/resources/data/searchtests/opt-test3.asm
cpcitor/mdlz80optimizer
75070d984e1f08474e6d397c7e0eb66d8be0c432
[ "Apache-2.0" ]
39
2020-07-02T18:19:34.000Z
2022-03-27T18:08:54.000Z
src/test/resources/data/searchtests/opt-test3.asm
cpcitor/mdlz80optimizer
75070d984e1f08474e6d397c7e0eb66d8be0c432
[ "Apache-2.0" ]
7
2020-07-02T06:00:05.000Z
2021-11-28T17:31:13.000Z
org #4000 call f1 loop: jr loop f1: ld a, b or d or c jr nz, label1 ld l, 0 jr label2 label1: ld a, b cp c ret label2: ld a, b or d or e ret
8.076923
17
0.438095
90987258fcc44fca1973de2b3f1051cafe232361
159
py
Python
exercicios/PythonExercicios/ex007.py
Roberto-Sartore/Python
98f91f13cf78d761893c4a1f3264ed999244d32b
[ "MIT" ]
null
null
null
exercicios/PythonExercicios/ex007.py
Roberto-Sartore/Python
98f91f13cf78d761893c4a1f3264ed999244d32b
[ "MIT" ]
null
null
null
exercicios/PythonExercicios/ex007.py
Roberto-Sartore/Python
98f91f13cf78d761893c4a1f3264ed999244d32b
[ "MIT" ]
null
null
null
n1 = float(input('Digite a primeira nota ')) n2 = float(input('Digite a segunda nota ')) print('A média entre {} e {} é {:.2f}'.format(n1, n2, ((n1 + n2)/2)))
39.75
69
0.603774
7ff72c9ae422efea9611cb77462096f66d4f021d
1,623
go
Go
address_test.go
engvik/sbanken-go
4d2661ca04c94021554dc1f8ef6970c4189a55a0
[ "MIT" ]
null
null
null
address_test.go
engvik/sbanken-go
4d2661ca04c94021554dc1f8ef6970c4189a55a0
[ "MIT" ]
1
2021-05-07T21:01:03.000Z
2021-05-07T21:01:03.000Z
address_test.go
engvik/sbanken-go
4d2661ca04c94021554dc1f8ef6970c4189a55a0
[ "MIT" ]
null
null
null
package sbanken import "testing" func TestAddressString(t *testing.T) { tests := []struct { name string addr Address exp string }{ { name: "should handle empty address struct", addr: Address{}, exp: "", }, { name: "should handle partly filled address struct", addr: Address{ AddressLine1: "Testerstreet 1", }, exp: "Testerstreet 1", }, { name: "should handle partly filled address struct", addr: Address{ AddressLine2: "Testerstreet 2", }, exp: "Testerstreet 2", }, { name: "should handle partly filled address struct", addr: Address{ AddressLine1: "Testerstreet 1", Country: "Norway", ZipCode: "1337", City: "Sandvika", }, exp: "Testerstreet 1, 1337 Sandvika, Norway", }, { name: "should handle partly filled address struct", addr: Address{ AddressLine1: "Testerstreet 1", Country: "Norway", City: "Sandvika", }, exp: "Testerstreet 1, Sandvika, Norway", }, { name: "should handle completly filled address struct", addr: Address{ AddressLine1: "c/o Test Testesen", AddressLine2: "Testerstreet 1", AddressLine3: "PO 13371337", AddressLine4: "Blabla", Country: "Norway", ZipCode: "1337", City: "Sandvika", }, exp: "c/o Test Testesen, Testerstreet 1, PO 13371337, Blabla, 1337 Sandvika, Norway", }, } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { addr := tc.addr.String() if addr != tc.exp { t.Errorf("unexpected address string: got %s, exp %s", addr, tc.exp) } }) } }
21.932432
88
0.597659
fb451ac2fbade63894a5eee25e6c4d4871eb3827
1,916
h
C
racket/src/racket/gc2/gc2_dump.h
lkh01/racket
6a1328cd775f1e44180ce5c84244483b5df9ca91
[ "Apache-2.0" ]
10
2018-07-29T04:13:52.000Z
2022-02-14T16:11:17.000Z
racket/src/racket/gc2/gc2_dump.h
lkh01/racket
6a1328cd775f1e44180ce5c84244483b5df9ca91
[ "Apache-2.0" ]
15
2017-08-25T20:26:37.000Z
2022-02-26T17:48:40.000Z
racket/src/racket/gc2/gc2_dump.h
lkh01/racket
6a1328cd775f1e44180ce5c84244483b5df9ca91
[ "Apache-2.0" ]
3
2016-04-25T11:47:57.000Z
2017-05-09T14:52:48.000Z
/* Extra headers for the GC2 tracing interface */ #ifndef __mzscheme_gc_2_dump__ #define __mzscheme_gc_2_dump__ typedef char *(*GC_get_type_name_proc)(short t); typedef void (*GC_for_each_found_proc)(void *p); typedef void (*GC_for_each_struct_proc)(void *p, int sz); typedef int (*GC_record_traced_filter_proc)(void *p); typedef void (*GC_print_tagged_value_proc)(const char *prefix, void *v, uintptr_t diff, int max_w, const char *suffix); typedef int (*GC_print_traced_filter_proc)(void *p); GC2_EXTERN void GC_dump_with_traces(int flags, GC_get_type_name_proc get_type_name, GC_for_each_found_proc for_each_found, short min_trace_for_tag, short max_trace_for_tag, GC_record_traced_filter_proc record_traced_filter, GC_print_traced_filter_proc print_traced_filter, GC_print_tagged_value_proc print_tagged_value, int path_length_limit, GC_for_each_struct_proc for_each_struct); GC2_EXTERN void GC_dump_variable_stack(void **var_stack, intptr_t delta, void *limit, void *stack_mem, GC_get_type_name_proc get_type_name, GC_print_tagged_value_proc print_tagged_value); # define GC_DUMP_SHOW_DETAILS 0x1 # define GC_DUMP_SHOW_TRACE 0x2 # define GC_DUMP_SHOW_FINALS 0x4 # define GC_DUMP_SUPPRESS_SUMMARY 0x8 GC2_EXTERN int GC_is_tagged(void *p); GC2_EXTERN int GC_is_tagged_start(void *p); GC2_EXTERN void *GC_next_tagged_start(void *p); typedef void (*GC_allocated_object_callback_proc)(void *, intptr_t size, int tagged, int atomic); GC2_EXTERN void GC_set_allocated_object_callback(GC_allocated_object_callback_proc proc); #endif
39.916667
97
0.674322
f04d3917118eeab7daa5965475644fcb12277751
230
py
Python
code_examples/projections/cyl.py
ezcitron/BasemapTutorial
0db9248b430d39518bdfdb25d713145be4eb966a
[ "CC0-1.0" ]
99
2015-01-14T21:20:48.000Z
2022-01-25T10:38:37.000Z
code_examples/projections/cyl.py
ezcitron/BasemapTutorial
0db9248b430d39518bdfdb25d713145be4eb966a
[ "CC0-1.0" ]
1
2017-08-31T07:02:20.000Z
2017-08-31T07:02:20.000Z
code_examples/projections/cyl.py
ezcitron/BasemapTutorial
0db9248b430d39518bdfdb25d713145be4eb966a
[ "CC0-1.0" ]
68
2015-01-14T21:21:01.000Z
2022-01-29T14:53:38.000Z
from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt map = Basemap(projection='cyl') map.drawmapboundary(fill_color='aqua') map.fillcontinents(color='coral',lake_color='aqua') map.drawcoastlines() plt.show()
23
51
0.795652
1bf9a5c8ffe9987a2e81a7ae90f3d014208ebcd7
2,651
py
Python
tests/integ_tests/test_photofile.py
aaronkollasch/photomanager
fd00ac3edbb440547d2f1af55b0d0f899b9799c5
[ "MIT" ]
null
null
null
tests/integ_tests/test_photofile.py
aaronkollasch/photomanager
fd00ac3edbb440547d2f1af55b0d0f899b9799c5
[ "MIT" ]
16
2021-05-31T09:41:09.000Z
2021-12-07T18:43:50.000Z
tests/integ_tests/test_photofile.py
aaronkollasch/photomanager
fd00ac3edbb440547d2f1af55b0d0f899b9799c5
[ "MIT" ]
null
null
null
from pathlib import Path from datetime import timezone, timedelta import pytest from photomanager.pyexiftool import ExifTool from photomanager.photofile import PhotoFile FIXTURE_DIR = Path(__file__).resolve().parent.parent / "test_files" ALL_IMG_DIRS = pytest.mark.datafiles( FIXTURE_DIR / "A", FIXTURE_DIR / "B", FIXTURE_DIR / "C", keep_top_dir=True, ) photofile_expected_results = [ PhotoFile( chk="d090ce7023b57925e7e94fc80372e3434fb1897e00b4452a25930dd1b83648fb", src="A/img1.jpg", dt="2015:08:01 18:28:36.90", ts=1438468116.9, fsz=771, tzo=-14400.0, ), PhotoFile( chk="3b39f47d51f63e54c76417ee6e04c34bd3ff5ac47696824426dca9e200f03666", src="A/img2.jpg", dt="2015:08:01 18:28:36.99", ts=1438450116.99, fsz=771, tzo=3600.0, ), PhotoFile( chk="1e10df2e3abe4c810551525b6cb2eb805886de240e04cc7c13c58ae208cabfb9", src="A/img1.png", dt="2015:08:01 18:28:36.90", ts=1438453716.9, fsz=382, tzo=0.0, ), PhotoFile( chk="79ac4a89fb3d81ab1245b21b11ff7512495debca60f6abf9afbb1e1fbfe9d98c", src="A/img4.jpg", dt="2018:08:01 20:28:36", ts=1533169716.0, fsz=759, tzo=-14400.0, ), PhotoFile( chk="d090ce7023b57925e7e94fc80372e3434fb1897e00b4452a25930dd1b83648fb", src="B/img1.jpg", dt="2015:08:01 18:28:36.90", ts=1438468116.9, fsz=771, tzo=-14400.0, ), PhotoFile( chk="e9fec87008fd240309b81c997e7ec5491fee8da7eb1a76fc39b8fcafa76bb583", src="B/img2.jpg", dt="2015:08:01 18:28:36.99", ts=1438468116.99, fsz=789, tzo=-14400.0, ), PhotoFile( chk="2b0f304f86655ebd04272cc5e7e886e400b79a53ecfdc789f75dd380cbcc8317", src="B/img4.jpg", dt="2018:08:01 20:28:36", ts=1533169716.0, fsz=777, tzo=-14400.0, ), PhotoFile( chk="2aca4e78afbcebf2526ad8ac544d90b92991faae22499eec45831ef7be392391", src="C/img3.tiff", dt="2018:08:01 19:28:36", ts=1533166116.0, fsz=506, tzo=-14400.0, ), ] @ALL_IMG_DIRS def test_photofile_from_file(datafiles): with ExifTool(): for pf in photofile_expected_results: pf = PhotoFile.from_dict(pf.to_dict()) rel_path = pf.src pf.src = str(datafiles / rel_path) new_pf = PhotoFile.from_file( pf.src, tz_default=timezone(timedelta(seconds=pf.tzo)), ) assert new_pf == pf
28.202128
79
0.606186
bc391d2b35fe6eebb8ff48e65a03d885b28f89ad
485
sql
SQL
src/sql/update_2_to_3.sql
SolraBizna/tsong
01dbf8cff1454766f70fb0042eeecc4efe9b2018
[ "MIT" ]
null
null
null
src/sql/update_2_to_3.sql
SolraBizna/tsong
01dbf8cff1454766f70fb0042eeecc4efe9b2018
[ "MIT" ]
24
2021-02-14T17:14:19.000Z
2021-06-15T20:23:25.000Z
src/sql/update_2_to_3.sql
SolraBizna/tsong
01dbf8cff1454766f70fb0042eeecc4efe9b2018
[ "MIT" ]
null
null
null
BEGIN TRANSACTION; CREATE TABLE NewPhysicalFiles( id BINARY(16) PRIMARY KEY, size INTEGER NOT NULL, duration INTEGER NOT NULL, relative_paths BLOB NOT NULL ); INSERT INTO NewPhysicalFiles(id, size, duration, relative_paths) SELECT id, size, duration, relative_paths FROM PhysicalFiles; DROP TABLE PhysicalFiles; ALTER TABLE NewPhysicalFiles RENAME TO PhysicalFiles; ALTER TABLE LogicalSongs ADD COLUMN similarity_recs BLOB; COMMIT; PRAGMA user_version = 3;
32.333333
64
0.77732
6eed63351dcc5b178b85e6ebf93785cc68058915
598
html
HTML
templates/upgrade_landing.html
fwang18/biz_plan
261609c51118559ee3ce6b45a2bc7b5d9c73b34c
[ "MIT" ]
null
null
null
templates/upgrade_landing.html
fwang18/biz_plan
261609c51118559ee3ce6b45a2bc7b5d9c73b34c
[ "MIT" ]
null
null
null
templates/upgrade_landing.html
fwang18/biz_plan
261609c51118559ee3ce6b45a2bc7b5d9c73b34c
[ "MIT" ]
1
2018-04-23T06:02:38.000Z
2018-04-23T06:02:38.000Z
<head> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-118590596-1"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-118590596-1'); </script> <!-- 以下方式只是刷新不跳转到其他页面 --> <!--<meta http-equiv="refresh" content="10">--> <!-- 以下方式定时转到其他页面 --> Thank you for upgrading! You will be automatically redirected to your profile page in a moment. <meta http-equiv="refresh" content="3; url=profile"> </head>
35.176471
97
0.657191
7d5745c274746b814e94909aeeb9be045f733e79
1,368
html
HTML
Exercicio-09/index.html
FredGuarana/HTML5-CSS
96f1f5736dee8892c2ecef5e6711d20f1fef5bec
[ "MIT" ]
null
null
null
Exercicio-09/index.html
FredGuarana/HTML5-CSS
96f1f5736dee8892c2ecef5e6711d20f1fef5bec
[ "MIT" ]
null
null
null
Exercicio-09/index.html
FredGuarana/HTML5-CSS
96f1f5736dee8892c2ecef5e6711d20f1fef5bec
[ "MIT" ]
null
null
null
<!DOCTYPE html> <html lang="pt-br"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Listas</title> </head> <body> <h1>Trabalhando com listas</h1> <h2>Listas ordenadas</h2> <ol> <li>acordar</li> <li>Tomar café</li> <li>tomar banho</li> </ol> <h2>Listas não ordenadas</h2> <ul type="disc"> <li>Pão</li> <li>Café</li> <li>Leite</li> <li>Ração</li> </ul> <h2>Juntando versão 1.0</h2> <h2><p>Minhas linguagens favoritas</p></h2> <ol> <li>Antigas</li> <ol type="a"> <LI>DBASE</LI> <li>BASIC</li> <li>WFL</li> <li>FORTRAN</li> <li>COBOL</li> </ol> <li>Novas</li> <OL> <li>Visual Basic</li> <li>Python</li> <li>C++</li> </OL> </ol> <h2>Meus jogos favoritos</h2> <li>Futebol</li> <ul type="square"> <li>Campo</li> <li>Salão</li> <li>Mesa</li> </ul> <li>Volei</li> <ul> <li>Quadra</li> <li>Praia</li> </ul> </body> </body> </html>
21.375
74
0.431287
5dbe2a08c32c18ba46b830989030e030970e543f
7,255
kt
Kotlin
feature-account-impl/src/main/java/io/novafoundation/nova/feature_account_impl/data/mappers/Mappers.kt
nova-wallet/nova-android-app
5bf5edaf809a016f0fc1cf24787100ef78b97d28
[ "Apache-2.0" ]
8
2021-11-02T08:58:41.000Z
2022-03-24T17:59:17.000Z
feature-account-impl/src/main/java/io/novafoundation/nova/feature_account_impl/data/mappers/Mappers.kt
nova-wallet/nova-android-app
5bf5edaf809a016f0fc1cf24787100ef78b97d28
[ "Apache-2.0" ]
null
null
null
feature-account-impl/src/main/java/io/novafoundation/nova/feature_account_impl/data/mappers/Mappers.kt
nova-wallet/nova-android-app
5bf5edaf809a016f0fc1cf24787100ef78b97d28
[ "Apache-2.0" ]
1
2022-01-17T03:18:30.000Z
2022-01-17T03:18:30.000Z
package io.novafoundation.nova.feature_account_impl.data.mappers import io.novafoundation.nova.common.resources.ResourceManager import io.novafoundation.nova.common.utils.filterNotNull import io.novafoundation.nova.core.model.CryptoType import io.novafoundation.nova.core.model.Node import io.novafoundation.nova.core.model.Node.NetworkType import io.novafoundation.nova.core_db.model.NodeLocal import io.novafoundation.nova.core_db.model.chain.ChainAccountLocal import io.novafoundation.nova.core_db.model.chain.JoinedMetaAccountInfo import io.novafoundation.nova.core_db.model.chain.MetaAccountLocal import io.novafoundation.nova.feature_account_api.data.mappers.stubNetwork import io.novafoundation.nova.feature_account_api.domain.model.Account import io.novafoundation.nova.feature_account_api.domain.model.AddAccountType import io.novafoundation.nova.feature_account_api.domain.model.LightMetaAccount import io.novafoundation.nova.feature_account_api.domain.model.MetaAccount import io.novafoundation.nova.feature_account_api.domain.model.addressIn import io.novafoundation.nova.feature_account_api.presenatation.account.add.AddAccountPayload import io.novafoundation.nova.feature_account_impl.R import io.novafoundation.nova.feature_account_impl.presentation.common.mixin.api.AccountNameChooserMixin import io.novafoundation.nova.feature_account_impl.presentation.node.model.NodeModel import io.novafoundation.nova.feature_account_impl.presentation.view.advanced.encryption.model.CryptoTypeModel import io.novafoundation.nova.feature_account_impl.presentation.view.advanced.network.model.NetworkModel import io.novafoundation.nova.runtime.ext.addressOf import io.novafoundation.nova.runtime.ext.hexAccountIdOf import io.novafoundation.nova.runtime.multiNetwork.chain.model.Chain import io.novafoundation.nova.runtime.multiNetwork.chain.model.ChainId import jp.co.soramitsu.fearless_utils.extensions.toHexString fun mapNetworkTypeToNetworkModel(networkType: NetworkType): NetworkModel { val type = when (networkType) { NetworkType.KUSAMA -> NetworkModel.NetworkTypeUI.Kusama NetworkType.POLKADOT -> NetworkModel.NetworkTypeUI.Polkadot NetworkType.WESTEND -> NetworkModel.NetworkTypeUI.Westend NetworkType.ROCOCO -> NetworkModel.NetworkTypeUI.Rococo } return NetworkModel(networkType.readableName, type) } fun mapCryptoTypeToCryptoTypeModel( resourceManager: ResourceManager, encryptionType: CryptoType ): CryptoTypeModel { val name = when (encryptionType) { CryptoType.SR25519 -> "${resourceManager.getString(R.string.sr25519_selection_title)} ${resourceManager.getString( R.string.sr25519_selection_subtitle )}" CryptoType.ED25519 -> "${resourceManager.getString(R.string.ed25519_selection_title)} ${resourceManager.getString( R.string.ed25519_selection_subtitle )}" CryptoType.ECDSA -> "${resourceManager.getString(R.string.ecdsa_selection_title)} ${resourceManager.getString( R.string.ecdsa_selection_subtitle )}" } return CryptoTypeModel(name, encryptionType) } fun mapNodeToNodeModel(node: Node): NodeModel { val networkModelType = mapNetworkTypeToNetworkModel(node.networkType) return with(node) { NodeModel( id = id, name = name, link = link, networkModelType = networkModelType.networkTypeUI, isDefault = isDefault, isActive = isActive ) } } fun mapNodeLocalToNode(nodeLocal: NodeLocal): Node { return with(nodeLocal) { Node( id = id, name = name, networkType = NetworkType.values()[nodeLocal.networkType], link = link, isActive = isActive, isDefault = isDefault ) } } fun mapMetaAccountLocalToLightMetaAccount( metaAccountLocal: MetaAccountLocal ): LightMetaAccount = with(metaAccountLocal) { LightMetaAccount( id = id, substratePublicKey = substratePublicKey, substrateCryptoType = substrateCryptoType, substrateAccountId = substrateAccountId, ethereumAddress = ethereumAddress, ethereumPublicKey = ethereumPublicKey, isSelected = isSelected, name = name ) } fun mapMetaAccountLocalToMetaAccount( chainsById: Map<ChainId, Chain>, joinedMetaAccountInfo: JoinedMetaAccountInfo ): MetaAccount { val chainAccounts = joinedMetaAccountInfo.chainAccounts.associateBy( keySelector = ChainAccountLocal::chainId, valueTransform = { // ignore chainAccounts with unknown chainId val chain = chainsById[it.chainId] ?: return@associateBy null MetaAccount.ChainAccount( metaId = joinedMetaAccountInfo.metaAccount.id, chain = chain, publicKey = it.publicKey, accountId = it.accountId, cryptoType = it.cryptoType ) } ).filterNotNull() return with(joinedMetaAccountInfo.metaAccount) { MetaAccount( id = id, chainAccounts = chainAccounts, substratePublicKey = substratePublicKey, substrateCryptoType = substrateCryptoType, substrateAccountId = substrateAccountId, ethereumAddress = ethereumAddress, ethereumPublicKey = ethereumPublicKey, isSelected = isSelected, name = name ) } } fun mapMetaAccountToAccount(chain: Chain, metaAccount: MetaAccount): Account? { return metaAccount.addressIn(chain)?.let { address -> val accountId = chain.hexAccountIdOf(address) Account( address = address, name = metaAccount.name, accountIdHex = accountId, cryptoType = metaAccount.substrateCryptoType, position = 0, network = stubNetwork(chain.id), ) } } fun mapChainAccountToAccount( parent: MetaAccount, chainAccount: MetaAccount.ChainAccount, ): Account { val chain = chainAccount.chain return Account( address = chain.addressOf(chainAccount.accountId), name = parent.name, accountIdHex = chainAccount.accountId.toHexString(), cryptoType = chainAccount.cryptoType, position = 0, network = stubNetwork(chain.id), ) } fun mapAddAccountPayloadToAddAccountType( payload: AddAccountPayload, accountNameState: AccountNameChooserMixin.State, ): AddAccountType { return when (payload) { AddAccountPayload.MetaAccount -> { require(accountNameState is AccountNameChooserMixin.State.Input) { "Name input should be present for meta account" } AddAccountType.MetaAccount(accountNameState.value) } is AddAccountPayload.ChainAccount -> AddAccountType.ChainAccount(payload.chainId, payload.metaId) } } fun mapNameChooserStateToOptionalName(state: AccountNameChooserMixin.State) = (state as? AccountNameChooserMixin.State.Input)?.value fun mapOptionalNameToNameChooserState(name: String?) = when (name) { null -> AccountNameChooserMixin.State.NoInput else -> AccountNameChooserMixin.State.Input(name) }
37.984293
132
0.722812
73b1c091d198a73c9694b3dd7dd89b3ae63741e2
735
sql
SQL
migrations/15_update_items_table.up.sql
psalmeight/products-api
ddb411cd6a4df3cd927655988c4cf6ec14b8fa7e
[ "Apache-2.0" ]
null
null
null
migrations/15_update_items_table.up.sql
psalmeight/products-api
ddb411cd6a4df3cd927655988c4cf6ec14b8fa7e
[ "Apache-2.0" ]
null
null
null
migrations/15_update_items_table.up.sql
psalmeight/products-api
ddb411cd6a4df3cd927655988c4cf6ec14b8fa7e
[ "Apache-2.0" ]
null
null
null
ALTER TABLE items ALTER COLUMN item SET DEFAULT '', ALTER COLUMN description SET DEFAULT '', ALTER COLUMN stock_code SET DEFAULT '', ALTER COLUMN barcode SET DEFAULT '', ALTER COLUMN "uom" SET DEFAULT '', ALTER COLUMN "packaging" SET DEFAULT '', ALTER COLUMN "package_qty" SET DEFAULT 0, ALTER COLUMN "default_unit_cost" SET DEFAULT 0.00, ALTER COLUMN "default_srp" SET DEFAULT 0.00, ALTER COLUMN "markup_percent" SET DEFAULT 0.00, ALTER COLUMN "markup_amount" SET DEFAULT 0.00, ALTER COLUMN "stock_notify_limit" TYPE INT, ALTER COLUMN "stock_limit" TYPE INT; ALTER TABLE items ALTER COLUMN "stock_notify_limit" SET DEFAULT 0, ALTER COLUMN "stock_limit" SET DEFAULT 0;
40.833333
54
0.710204
6ef1dae07e4109082ecd7ca66dfde4a1bd9baedc
1,443
html
HTML
client/src/app/controls/choiceSlider/controlsChoiceSlider.html
bionikspoon/Annotation-Tool
0067d55259c02f0d1f1183c9814414f226c7f71f
[ "BSD-3-Clause" ]
null
null
null
client/src/app/controls/choiceSlider/controlsChoiceSlider.html
bionikspoon/Annotation-Tool
0067d55259c02f0d1f1183c9814414f226c7f71f
[ "BSD-3-Clause" ]
1
2015-10-13T18:32:51.000Z
2015-10-13T19:11:36.000Z
client/src/app/controls/choiceSlider/controlsChoiceSlider.html
bionikspoon/Annotation-Tool
0067d55259c02f0d1f1183c9814414f226c7f71f
[ "BSD-3-Clause" ]
null
null
null
<div class=choiceSlider> <div layout-gt-md=row layout-align-gt-md="start end" layout-sm=column> <md-input-container flex-gt-md=20 flex-sm> <label for={{::vm.meta.name}}_id class=md-body-2>{{::vm.meta.label}} </label> <input id={{::vm.meta.name}}_id name={{::vm.meta.name}} aria-label={{::vm.meta.label}} type=number ng-class={'gt-md':vm.gtMd} flex-gt-md ng-model=vm.model min=0 max={{::vm.meta.choices.length}} ng-disabled=::vm.meta.read_only ng-required={{::vm.meta.required}}> <div ng-messages=vm.form[vm.meta.name].$error ng-show=vm.form[vm.meta.name].$dirty> <div ng-message=required>This is required!</div> <div ng-message=maxlength>Too long! Max length is {{::vm.meta.max_length}}</div> <div ng-message=min>Minimum value is 0</div> <div ng-message=max>Maximum value is {{::vm.meta.choices.length}}</div> </div> </md-input-container> <md-slider aria-label={{::vm.meta.label}} flex md-discrete ng-model=vm.model min=0 max={{::vm.meta.choices.length}} ng-disabled=::vm.meta.read_only ng-required={{::vm.meta.required}}></md-slider> </div> </div>
34.357143
92
0.510049
ddd9d1ae5e56201f6fa7a57194564063ca39b2e9
7,132
php
PHP
maitinh/controllers/ncat.php
frontendvn/luocbao
645d6461a0de698b2696279938072ea848b64a4c
[ "Apache-2.0" ]
null
null
null
maitinh/controllers/ncat.php
frontendvn/luocbao
645d6461a0de698b2696279938072ea848b64a4c
[ "Apache-2.0" ]
null
null
null
maitinh/controllers/ncat.php
frontendvn/luocbao
645d6461a0de698b2696279938072ea848b64a4c
[ "Apache-2.0" ]
null
null
null
<?php class ncat extends Controller { var $mod = "ncat"; function ncat() { parent::Controller(); $this->config->load('config_'.$this->mod); // directory of the view, just to reduce number of typed text $this->view_dir = $this->config->item('view_dir'); // load default page into current view page, for default action $this->view_page = $this->view_dir.'news_home'; // select page layout $this->view_container = 'adm_container'; // init feedback for user's actions $this->pre_message = ""; /*-------------------------------+ | CPANEL LIB | | use for manage | +--------------------------------*/ $this->identity = $this->session->userdata($this->config->item('identity')); $this->accesslvl = $this->cpanel_lib->accesslvl; $this->id = $this->cpanel_lib->get_userid(); $this->profile = $this->cpanel_lib->query_main; // load necessary libraries $this->load->model($this->mod.'_model','mmod'); // left menu $this->menu_title = $this->config->item('menu_title'); $this->menu = $this->config->item('menu'); } // default page function index() { $this->lists(); } function lists() {// get all main categories $data['all_root_cate'] = $this->mmod->get_cat_same_level(0); $data['heading'] = "Quan Ly Danh Muc Tin Tuc"; // get the previous processing result into this front page $data['message'] = $this->pre_message; $this->view_page = $this->view_dir.'list'; $this->load->vars($data); $this->load->view($this->view_container); } // add a category function add() { $this->form_validation->set_rules('title', 'Tiêu đề', 'required|trim|max_length[255]|xss_clean'); $this->form_validation->set_rules('comment', 'Mô tả thêm', 'trim|xss_clean'); $this->form_validation->set_rules('isshown', 'Hiển thị', 'required|trim|numeric|exact_length[1]|xss_clean'); $this->form_validation->set_rules('nwc_pid', 'Thuộc', 'trim|numeric|max_length[10]|xss_clean'); $this->form_validation->set_rules('id_cattext', 'Mã trên link', 'trim|required|max_length[255]|xss_clean'); if ($this->form_validation->run() == FALSE) { #$this->form_validation->set_error_delimiters('<p class="error">', '</p>'); $this->pre_message = validation_errors(); } else { $values['id_nwc'] = ""; $values['id_cattext'] = trim($this->input->post('id_cattext')); $values['nwc_name'] = $this->input->post('title'); $values['nwc_comment'] = $this->input->post('comment'); $values['nwc_shown'] = $this->input->post('isshown'); $values['nwc_weight'] = 0; $values['nwc_pid'] = $this->input->post('nwc_pid'); if($this->mmod->insert_new_cat($values)) $this->pre_message = "Thêm mới thành công!"; else $this->pre_message = "Kiểm tra lại thông tin nhập vào!"; } $post = $this->input->xss_clean($this->input->post('nwc_pid')); $nwc_pid = empty($_POST['nwc_pid']) ? (int)$this->uri->segment(3) : (int)$post; $data['the_select_box'] = $this->mmod->create_select_box_root("nwc_pid", $nwc_pid); $data['heading'] = "Thêm Danh Mục Tin Tức"; $data['message'] = $this->pre_message; $this->view_page = $this->view_dir.'add'; $this->load->vars($data); $this->load->view($this->view_container); } function edit() { $post = $this->input->xss_clean($this->input->post('id_nwc')); $id_nwc = empty($_POST['id_nwc']) ? (int)$this->uri->segment(3) : (int)$post; $cat_info = $this->mmod->get_cat_info($id_nwc); if($cat_info) { $data['nwc_name'] = $cat_info->nwc_name; $data['nwc_comment'] = $cat_info->nwc_comment; $data['id_nwc'] = $id_nwc; $data['isshown'] = $cat_info->nwc_shown; $data['nwc_pid'] = $cat_info->nwc_pid; $data['id_cattext'] = $cat_info->id_cattext; if($cat_info->nwc_shown) { $data['radio_shown_1'] = 'checked = "checked"'; $data['radio_shown_0'] = ''; } else { $data['radio_shown_1'] = ''; $data['radio_shown_0'] = 'checked = "checked"'; } } else { redirect($this->mod); } // if(! empty($_POST)) { $this->form_validation->set_rules('nwc_name', 'Tiêu đề', 'required|trim|max_length[255]|xss_clean'); $this->form_validation->set_rules('nwc_comment', 'Mô tả thêm', 'trim|max_length[255]|xss_clean'); $this->form_validation->set_rules('isshown', 'Hiển thị', 'required|trim|numeric|exact_length[1]|xss_clean'); $this->form_validation->set_rules('id_nwc', 'Mã', 'required|trim|numeric|max_length[10]|xss_clean'); $this->form_validation->set_rules('nwc_pid', 'Thuộc', 'trim|numeric|max_length[10]|xss_clean'); $this->form_validation->set_rules('id_cattext', 'Mã trên link', 'required|trim|max_length[255]|xss_clean'); if ($this->form_validation->run() == FALSE) { #$this->form_validation->set_error_delimiters('<p class="error">', '</p>'); $this->pre_message = validation_errors(); } else { $values['id_nwc'] = $this->input->post('id_nwc'); $values['id_cattext'] = trim($this->input->post('id_cattext')); $values['nwc_comment'] = $this->input->post('nwc_comment'); $values['nwc_name'] = $this->input->post('nwc_name'); $values['nwc_shown'] = $this->input->post('isshown'); $values['nwc_pid'] = $this->input->post('nwc_pid'); if($this->mmod->edit_cat($values)) { $this->pre_message = "Đã sửa thành công!"; // $val['id_nwc'] = $values['id_nwc']; $val['id_cattext'] = $values['id_cattext']; $this->mmod->update('news', $val, 'id_nwc'); $this->mmod->update('crawler', $val, 'id_nwc'); } else $this->pre_message = "Kiểm tra lại thông tin nhập vào!"; } $data['nwc_pid'] = $this->input->post('nwc_pid'); $data['id_cattext'] = $this->input->post('id_cattext'); $data['nwc_name'] = $this->input->post('nwc_name'); $data['nwc_comment'] = $this->input->post('nwc_comment'); $data['isshown'] = $this->input->post('nwc_pid'); } $data['id_nwc'] = $id_nwc; $data['message'] = $this->pre_message; $data['the_select_box'] = $this->mmod->create_select_box_root("nwc_pid", $data['nwc_pid']); $data['heading'] = "Sua Danh Muc Ban Tin"; $this->view_page = $this->view_dir.'edit'; $this->load->vars($data); $this->load->view($this->view_container); } // remove a category function del() { $nwc_id = (int)$this->uri->segment(3); if(!empty($nwc_id)){ if($this->mmod->delete_cat($nwc_id)) $this->pre_message = 'Removed'; } // reload the front page $this->lists(); } // on off the category function cat_switch_state() { $nwc_id = $this->uri->segment(3); if(is_numeric($nwc_id)){ if($this->mmod->switch_state($nwc_id)) $this->pre_message = 'Applied'; } $this->lists(); } // move a category up function cat_up() { $nwc_id = $this->uri->segment(3); if(is_numeric($nwc_id)){ if($this->mmod->move_up($nwc_id)) $this->pre_message = 'Moved up'; } $this->lists(); } // move a category down function cat_down() { $nwc_id = $this->uri->segment(3); if(is_numeric($nwc_id)){ if($this->mmod->move_down($nwc_id)) $this->pre_message = 'Moved down'; } $this->lists(); } } ?>
35.133005
111
0.617358
bc2cc32eb3d4612310a2535836cbcc73e5c6e615
1,989
swift
Swift
Sources/BIKCharts/LineChart/LinePointShape/LinePointShape.swift
ilyadaberdil/BIKCharts
60e26720ac3df25434e68822689e928e0731e5ca
[ "MIT" ]
8
2021-05-16T05:34:34.000Z
2022-03-26T11:28:58.000Z
Sources/BIKCharts/LineChart/LinePointShape/LinePointShape.swift
Mrtckr008/BIKCharts
60e26720ac3df25434e68822689e928e0731e5ca
[ "MIT" ]
null
null
null
Sources/BIKCharts/LineChart/LinePointShape/LinePointShape.swift
Mrtckr008/BIKCharts
60e26720ac3df25434e68822689e928e0731e5ca
[ "MIT" ]
1
2021-05-16T09:39:28.000Z
2021-05-16T09:39:28.000Z
// // PointShape.swift // Charts // // Created by Berdil İlyada Karacam on 15.03.2020. // Copyright © 2020 Berdil İlyada Karacam. All rights reserved. // import SwiftUI struct LinePointShape: Shape { // MARK: - Properties private let viewModel: LinePointShapeModel init(viewModel: LinePointShapeModel) { self.viewModel = viewModel } // MARK: - Path func path(in rect: CGRect) -> Path { Path { path in for (index, data) in viewModel.data.enumerated() { let xDot = CGFloat(index) * (rect.width / CGFloat(viewModel.data.count-1)) let yDot = scalableHeight(for: data, parentHeight: rect.height) let point = CGPoint(x: xDot, y: yDot) path.move(to: point) path.addRoundedRect(in: .init(x: point.x - viewModel.lineWidth/2, y: point.y - viewModel.lineWidth/2, width: viewModel.lineWidth, height: viewModel.lineWidth), cornerSize: .init( width: viewModel.lineWidth, height: viewModel.lineWidth)) } } } } // MARK: - Helper private extension LinePointShape { var maxValue: CGFloat { return viewModel.data.max() ?? .zero } func scalableHeight(for value: CGFloat, parentHeight: CGFloat) -> CGFloat { switch viewModel.calculationStyle { case .maxValue: if value == maxValue { return .zero } else { return parentHeight - ((parentHeight * value) / maxValue) } case .percentage: let sumOfData = viewModel.data.reduce(.zero, +) return parentHeight - ((parentHeight * value) / sumOfData) } } }
30.6
90
0.507793
b67f2a12202ba0156eaaaac897bdbd7224787fd6
264
rb
Ruby
lib/income_tax/countries/netherlands.rb
TrimAgency/income-tax
009357977f62c82ebebe9d7cad4f38abebf0f58c
[ "MIT" ]
360
2015-10-29T23:47:27.000Z
2022-01-19T08:29:40.000Z
lib/income_tax/countries/netherlands.rb
TrimAgency/income-tax
009357977f62c82ebebe9d7cad4f38abebf0f58c
[ "MIT" ]
9
2015-10-31T01:09:00.000Z
2016-12-25T04:30:28.000Z
lib/income_tax/countries/netherlands.rb
TrimAgency/income-tax
009357977f62c82ebebe9d7cad4f38abebf0f58c
[ "MIT" ]
33
2015-10-30T18:16:34.000Z
2022-03-30T13:08:53.000Z
module IncomeTax module Countries class Netherlands < Models::Progressive register "Netherlands", "NL", "NLD" currency "EUR" level 19645, "5.85%" level 33363, "10.85%" level 55991, "42%" remainder "52%" end end end
18.857143
43
0.594697
5c908ba3d23e72308c265e09b92ed06b6f79aa0f
259
c
C
lib/libm_dbl/__fpclassify.c
learnforpractice/micropython-cpp
004bc8382f74899e7b876cc29bfa6a9cc976ba10
[ "MIT" ]
13,648
2015-01-01T01:34:51.000Z
2022-03-31T16:19:53.000Z
lib/libm_dbl/__fpclassify.c
learnforpractice/micropython-cpp
004bc8382f74899e7b876cc29bfa6a9cc976ba10
[ "MIT" ]
7,092
2015-01-01T07:59:11.000Z
2022-03-31T23:52:18.000Z
lib/libm_dbl/__fpclassify.c
learnforpractice/micropython-cpp
004bc8382f74899e7b876cc29bfa6a9cc976ba10
[ "MIT" ]
4,942
2015-01-02T11:48:50.000Z
2022-03-31T19:57:10.000Z
#include <math.h> #include <stdint.h> int __fpclassifyd(double x) { union {double f; uint64_t i;} u = {x}; int e = u.i>>52 & 0x7ff; if (!e) return u.i<<1 ? FP_SUBNORMAL : FP_ZERO; if (e==0x7ff) return u.i<<12 ? FP_NAN : FP_INFINITE; return FP_NORMAL; }
21.583333
53
0.640927
a9c230e841e06ab50c410af321feb063680cb0cc
1,551
html
HTML
popup.html
krish1000/Extension_WebBlocker
c28b9319c42f7a49fee8a4c4280b95cd8ae3b188
[ "MIT" ]
1
2020-07-24T18:04:30.000Z
2020-07-24T18:04:30.000Z
popup.html
krish1000/Extension_WebBlocker
c28b9319c42f7a49fee8a4c4280b95cd8ae3b188
[ "MIT" ]
null
null
null
popup.html
krish1000/Extension_WebBlocker
c28b9319c42f7a49fee8a4c4280b95cd8ae3b188
[ "MIT" ]
null
null
null
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width = device-width, initial-scale=1.0" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" /> <title>Web Blocker Ext.</title> <link href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" rel="stylesheet" /> <!--https://fonts.google.com/specimen/Open+Sans?sidebar.open&selection.family=Open+Sans--> <!-- add bootstrapcdn for css style sheet--> <!--https://developer.chrome.com/extensions/declare_permissions#host-permissions--> </head> <body> <div class="model-header"> <!-- shortcut div.model-header creates it--> <!--<img src="icon200.png" alt="Image Icon" /> --> <img src="images/blocked.png" alt="blocked img" class="src" /> <p id="desc"> Testin123 </p> </div> <div class="wSpecific"> <label for="wSpec">WhiteList Specific Urls:</label> <input type="text" id="wSpec" name="wSpec" /> <button id="wSpecificSubmit"> Specific_Submit </button> <button id="wDomainSubmit"> Domain_Submit </button> <button id="tabSubmit"> Block Current Tab </button> </div> </body> <script src="background.js"></script> <script src="content.js"></script> </html> <!-- Icons made by <a href="https://www.flaticon.com/authors/pixel-perfect" title="Pixel perfect">Pixel perfect</a> from <a href="https://www.flaticon.com/" title="Flaticon"> www.flaticon.com</a> -->
32.3125
199
0.614442
59aff735a1ae861ed0ee2d94dc63641630342577
2,287
swift
Swift
_Finn-No-iOS-UI-Components-FinniversKit/Demo/Sources/Demo/NavigationController.swift
luannguyen252/my-swift-journey
788d66f256358dc5aefa2f3093ef74fd572e83b3
[ "MIT" ]
14
2020-12-09T08:53:39.000Z
2021-12-07T09:15:44.000Z
_Finn-No-iOS-UI-Components-FinniversKit/Demo/Sources/Demo/NavigationController.swift
luannguyen252/my-swift-journey
788d66f256358dc5aefa2f3093ef74fd572e83b3
[ "MIT" ]
15
2021-01-27T12:15:32.000Z
2022-02-23T12:20:21.000Z
_Finn-No-iOS-UI-Components-FinniversKit/Demo/Sources/Demo/NavigationController.swift
luannguyen252/my-swift-journey
788d66f256358dc5aefa2f3093ef74fd572e83b3
[ "MIT" ]
8
2020-12-10T05:59:26.000Z
2022-01-03T07:49:21.000Z
import UIKit class NavigationController: UINavigationController { private var hairlineView: UIView? var hairlineIsHidden: Bool = false { didSet { hairlineView?.isHidden = hairlineIsHidden if hairlineIsHidden { navigationBar.shadowImage = UIImage() } } } override func viewDidLoad() { super.viewDidLoad() navigationBar.isTranslucent = false updateColors(animated: false) NotificationCenter.default.addObserver(self, selector: #selector(userInterfaceStyleDidChange), name: .didChangeUserInterfaceStyle, object: nil) } override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { super.traitCollectionDidChange(previousTraitCollection) if #available(iOS 13.0, *) { #if swift(>=5.1) if traitCollection.hasDifferentColorAppearance(comparedTo: previousTraitCollection) { updateColors(animated: true) } #endif } } @objc private func userInterfaceStyleDidChange() { updateColors(animated: true) } private func updateColors(animated: Bool) { func setupColors() { let separatorColor: UIColor = .textDisabled //DARK let barTintColor: UIColor = .bgPrimary let tintColor: UIColor = .textAction setBottomBorderColor(navigationBar: navigationBar, color: separatorColor, height: 0.5) navigationBar.barTintColor = barTintColor navigationBar.tintColor = tintColor navigationBar.layoutIfNeeded() } if animated { UIView.animate(withDuration: 0.3) { setupColors() } } else { setupColors() } } private func setBottomBorderColor(navigationBar: UINavigationBar, color: UIColor, height: CGFloat) { if hairlineView == nil { let bottomBorderRect = CGRect(x: 0, y: navigationBar.frame.height, width: navigationBar.frame.width, height: height) let view = UIView(frame: bottomBorderRect) navigationBar.addSubview(view) hairlineView = view } hairlineView?.backgroundColor = color } }
32.671429
151
0.626585
b860781caaf18cc7f5f7d4292203ae9be6ae8f48
327
rs
Rust
tools/ssp16asm/src/main.rs
jdesiloniz/svpdev
13438d71c9cd45c8f78f9768732c40ddec2548d9
[ "MIT" ]
42
2021-02-09T18:15:27.000Z
2022-03-21T23:51:05.000Z
tools/ssp16asm/src/main.rs
jdesiloniz/ssp16asm
13438d71c9cd45c8f78f9768732c40ddec2548d9
[ "MIT" ]
2
2021-02-16T21:07:07.000Z
2021-02-16T21:08:31.000Z
tools/ssp16asm/src/main.rs
jdesiloniz/ssp16asm
13438d71c9cd45c8f78f9768732c40ddec2548d9
[ "MIT" ]
3
2021-02-22T08:08:27.000Z
2021-12-22T20:21:07.000Z
use ssp16asm::Config; use std::process; fn main() { if let Ok(config) = Config::new_from_args() { if let Err(e) = ssp16asm::run(config) { eprintln!("Application error(s): \n\n{}", e); process::exit(1); } else { println!("Assembly process complete."); }; } }
23.357143
57
0.513761
343b9cfe0ae3ceed130d90365597e30b26507153
274
sql
SQL
src/main/resources/db/migration/V0001__cria-tabela-cliente.sql
dev-vinicius-prado/mergulho-spring-rest
f27214ad5386f3d1d34c7e42be5861a6a939a76c
[ "MIT" ]
null
null
null
src/main/resources/db/migration/V0001__cria-tabela-cliente.sql
dev-vinicius-prado/mergulho-spring-rest
f27214ad5386f3d1d34c7e42be5861a6a939a76c
[ "MIT" ]
null
null
null
src/main/resources/db/migration/V0001__cria-tabela-cliente.sql
dev-vinicius-prado/mergulho-spring-rest
f27214ad5386f3d1d34c7e42be5861a6a939a76c
[ "MIT" ]
null
null
null
CREATE TABLE cliente ( id bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 9223372036854775807 CACHE 1 ), nome varchar(60) not null, email varchar(255) not null, telefone varchar(20) not null, primary key(id) );
34.25
128
0.718978
41fd518c3e5205f2c02880b9a6a1e4b1fc7a5ba9
1,411
c
C
test/strsep.c
guijan/libobsd
aa1419afe7b4daf80d69cb5547b827f2116da38e
[ "Unlicense" ]
null
null
null
test/strsep.c
guijan/libobsd
aa1419afe7b4daf80d69cb5547b827f2116da38e
[ "Unlicense" ]
null
null
null
test/strsep.c
guijan/libobsd
aa1419afe7b4daf80d69cb5547b827f2116da38e
[ "Unlicense" ]
null
null
null
/* * Copyright (c) 2022 Guilherme Janczak <guilherme.janczak@yandex.com> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <err.h> #include <string.h> int main(void) { char csv[] = "comma,separated,values, ,\n,,"; char *values[] = {"comma", "separated", "values", " ", "\n", "", ""}; char *p, *next; size_t i; /* Test that it actually separates the string. */ next = csv; for (i = 0; i < sizeof(values) / sizeof(*values); i++) { p = strsep(&next, ","); if (strcmp(p, values[i]) != 0) errx(1, "strcmp(\"%s\", \"%s\") != 0", p, values[i]); } /* "If *stringp is initially NULL, strsep() returns NULL." */ p = NULL; if (strsep(&p, ",") != NULL) errx(1, "strsep(NULL, "") != NULL"); return (0); }
32.813953
75
0.666903
34238fb747069daff223cacd69c47953b6b8ff7f
305
kt
Kotlin
native_library/android/InAppPurchaseANE/app/src/main/java/com/tuarua/inapppurchaseane/extensions/FreBillingResult.kt
tuarua/InAppPurchases-ANE
1e4546232601c26d55059d3af32954c86a8c57c9
[ "Apache-2.0" ]
11
2020-01-11T03:52:47.000Z
2021-12-18T04:03:27.000Z
native_library/android/InAppPurchaseANE/app/src/main/java/com/tuarua/inapppurchaseane/extensions/FreBillingResult.kt
tuarua/InAppPurchases-ANE
1e4546232601c26d55059d3af32954c86a8c57c9
[ "Apache-2.0" ]
null
null
null
native_library/android/InAppPurchaseANE/app/src/main/java/com/tuarua/inapppurchaseane/extensions/FreBillingResult.kt
tuarua/InAppPurchases-ANE
1e4546232601c26d55059d3af32954c86a8c57c9
[ "Apache-2.0" ]
1
2021-07-14T08:24:09.000Z
2021-07-14T08:24:09.000Z
package com.tuarua.inapppurchaseane.extensions import com.adobe.fre.FREObject import com.android.billingclient.api.BillingResult import com.tuarua.frekotlin.FREObject fun BillingResult.toFREObject(): FREObject? { return FREObject("com.tuarua.iap.billing.BillingResult", responseCode, debugMessage) }
33.888889
88
0.829508
547569137b7892c67341d8472c079dc735b0ed88
1,006
go
Go
cmd/pinkie/main.go
inabagumi/pinkie
9fdac9d9099209630505a9aa9239a61927fe4af2
[ "MIT" ]
1
2022-01-17T02:43:13.000Z
2022-01-17T02:43:13.000Z
cmd/pinkie/main.go
inabagumi/pinkie
9fdac9d9099209630505a9aa9239a61927fe4af2
[ "MIT" ]
179
2019-10-30T20:46:11.000Z
2022-03-30T18:56:59.000Z
cmd/pinkie/main.go
inabagumi/ytc
fece193b81883e67467938eb40b9e61abf3fc397
[ "MIT" ]
null
null
null
package main import ( "log" "os" "path/filepath" pinkie "github.com/inabagumi/pinkie/v4/pkg/client" "github.com/inabagumi/pinkie/v4/pkg/crawler" "gopkg.in/alecthomas/kingpin.v2" ) var version = "dev" func main() { app := kingpin.New(filepath.Base(os.Args[0]), "The Pinkie is a crawler that uses the YouTube Data API.") app.Version(version) app.VersionFlag.Short('v') app.HelpFlag.Short('h') all := app.Flag("all", "Fetch all videos of channel."). Short('a'). Bool() channels := app.Flag("channel", "A channel ID to scrape."). Short('c'). Required(). PlaceHolder("<id>"). Strings() kingpin.MustParse(app.Parse(os.Args[1:])) opts := &crawler.Options{ AlgoliaAPIKey: os.Getenv("ALGOLIA_API_KEY"), AlgoliaApplicationID: os.Getenv("ALGOLIA_APPLICATION_ID"), AlgoliaIndexName: os.Getenv("ALGOLIA_INDEX_NAME"), GoogleAPIKey: os.Getenv("GOOGLE_API_KEY"), } c, err := pinkie.New(opts) if err != nil { log.Fatal(err) } c.Run(*channels, *all) }
20.530612
105
0.666004
3321631f6d51317e5fd544639735a47e50542ab6
11,369
py
Python
AppDB/appscale/datastore/fdb/transactions.py
obino/appscale
be17e5f658d7b42b5aa7eeb7a5ddd4962f3ea82f
[ "Apache-2.0" ]
1
2017-04-07T15:33:35.000Z
2017-04-07T15:33:35.000Z
AppDB/appscale/datastore/fdb/transactions.py
obino/appscale
be17e5f658d7b42b5aa7eeb7a5ddd4962f3ea82f
[ "Apache-2.0" ]
1
2016-10-27T17:23:54.000Z
2016-10-27T17:23:54.000Z
AppDB/appscale/datastore/fdb/transactions.py
obino/appscale
be17e5f658d7b42b5aa7eeb7a5ddd4962f3ea82f
[ "Apache-2.0" ]
null
null
null
""" This module stores and retrieves datastore transaction metadata. The TransactionManager is the main interface that clients can use to interact with the transaction layer. See its documentation for implementation details. """ from __future__ import division import logging import math import random import sys from collections import defaultdict import six import six.moves as sm from tornado import gen from appscale.common.unpackaged import APPSCALE_PYTHON_APPSERVER from appscale.datastore.dbconstants import BadRequest, InternalError from appscale.datastore.fdb.codecs import ( decode_str, encode_versionstamp_index, Int64, Path, Text, TransactionID) from appscale.datastore.fdb.utils import ( DS_ROOT, fdb, MAX_ENTITY_SIZE, ResultIterator, VERSIONSTAMP_SIZE) sys.path.append(APPSCALE_PYTHON_APPSERVER) from google.appengine.datastore import entity_pb logger = logging.getLogger(__name__) class TransactionMetadata(object): """ A TransactionMetadata directory handles the encoding and decoding details for transaction metadata for a specific project. The directory path looks like (<project-dir>, 'transactions'). Within this directory, keys are encoded as <scatter-byte> + <txid> + <rpc-type (optional)> + <rpc-details (optional)>. The <scatter-byte> is a single byte derived from the txid. Its purpose is to spread writes more evenly across the cluster and minimize hotspots. This is especially important for this index because each write is given a new, larger <txid> value than the last. The <txid> is an 8-byte integer that serves as a handle for the client to identify a transaction. It also serves as a read versionstamp for FDB transactions used within the datastore transaction. The initial creation of the datastore transaction does not specify any RPC details. The purpose of that KV is to verify that the datastore transaction exists (and the garbage collector hasn't cleaned it up) before committing it. The <rpc-type> is a single byte that indicates what kind of RPC is being logged as having occurred inside the transaction. The <rpc-details> encodes the necessary details in order for the datastore to reconstruct the RPCs that occurreed during the transaction when it comes time to commit the mutations. # TODO: Go into more detail about how different RPC types are encoded. """ DIR_NAME = u'transactions' LOOKUPS = b'\x00' QUERIES = b'\x01' PUTS = b'\x02' DELETES = b'\x03' # The max number of bytes for each FDB value. _CHUNK_SIZE = 10000 _ENTITY_LEN_SIZE = 3 def __init__(self, directory): self.directory = directory @property def project_id(self): return self.directory.get_path()[len(DS_ROOT)] @classmethod def directory_path(cls, project_id): return project_id, cls.DIR_NAME def encode_start_key(self, scatter_val, commit_versionstamp=None): key = b''.join([self.directory.rawPrefix, six.int2byte(scatter_val), commit_versionstamp or b'\x00' * VERSIONSTAMP_SIZE]) if not commit_versionstamp: key += encode_versionstamp_index(len(key) - VERSIONSTAMP_SIZE) return key def encode_lookups(self, txid, keys): section_prefix = self._txid_prefix(txid) + self.LOOKUPS return self._encode_chunks(section_prefix, self._encode_keys(keys)) def encode_query_key(self, txid, namespace, ancestor_path): if not isinstance(ancestor_path, tuple): ancestor_path = Path.flatten(ancestor_path) section_prefix = self._txid_prefix(txid) + self.QUERIES encoded_ancestor = Text.encode(namespace) + Path.pack(ancestor_path[:2]) return section_prefix + encoded_ancestor def encode_puts(self, txid, entities): section_prefix = self._txid_prefix(txid) + self.PUTS encoded_entities = [entity.Encode() for entity in entities] value = b''.join([b''.join([self._encode_entity_len(entity), entity]) for entity in encoded_entities]) return self._encode_chunks(section_prefix, value) def encode_deletes(self, txid, keys): section_prefix = self._txid_prefix(txid) + self.DELETES return self._encode_chunks(section_prefix, self._encode_keys(keys)) def decode_metadata(self, txid, kvs): lookup_rpcs = defaultdict(list) queried_groups = set() mutation_rpcs = [] rpc_type_index = len(self._txid_prefix(txid)) current_versionstamp = None for kv in kvs: rpc_type = kv.key[rpc_type_index] pos = rpc_type_index + 1 if rpc_type == self.QUERIES: namespace, pos = Text.decode(kv.key, pos) group_path = Path.unpack(kv.key, pos)[0] queried_groups.add((namespace, group_path)) continue rpc_versionstamp = kv.key[pos:pos + VERSIONSTAMP_SIZE] if rpc_type == self.LOOKUPS: lookup_rpcs[rpc_versionstamp].append(kv.value) elif rpc_type in (self.PUTS, self.DELETES): if current_versionstamp == rpc_versionstamp: mutation_rpcs[-1].append(kv.value) else: current_versionstamp = rpc_versionstamp mutation_rpcs.append([rpc_type, kv.value]) else: raise InternalError(u'Unrecognized RPC type') lookups = set() mutations = [] for chunks in six.itervalues(lookup_rpcs): lookups.update(self._unpack_keys(b''.join(chunks))) for rpc_info in mutation_rpcs: rpc_type = rpc_info[0] blob = b''.join(rpc_info[1:]) if rpc_type == self.PUTS: mutations.extend(self._unpack_entities(blob)) else: mutations.extend(self._unpack_keys(blob)) return lookups, queried_groups, mutations def get_txid_slice(self, txid): prefix = self._txid_prefix(txid) return slice(fdb.KeySelector.first_greater_or_equal(prefix), fdb.KeySelector.first_greater_or_equal(prefix + b'\xFF')) def get_expired_slice(self, scatter_byte, safe_versionstamp): prefix = self.directory.rawPrefix + six.int2byte(scatter_byte) return slice( fdb.KeySelector.first_greater_or_equal(prefix), fdb.KeySelector.first_greater_or_equal(prefix + safe_versionstamp)) def _txid_prefix(self, txid): scatter_val, commit_versionstamp = TransactionID.decode(txid) return (self.directory.rawPrefix + six.int2byte(scatter_val) + commit_versionstamp) def _encode_keys(self, keys): return b''.join( [Text.encode(decode_str(key.name_space())) + Path.pack(key.path()) for key in keys]) def _unpack_keys(self, blob): keys = [] pos = 0 while pos < len(blob): namespace, pos = Text.decode(blob, pos) path, pos = Path.unpack(blob, pos) key = entity_pb.Reference() key.set_app(self.project_id) key.set_name_space(namespace) key.mutable_path().MergeFrom(Path.decode(path)) keys.append(key) return keys def _unpack_entities(self, blob): pos = 0 entities = [] while pos < len(blob): entity_len = Int64.decode_bare(blob[pos:pos + self._ENTITY_LEN_SIZE]) pos += self._ENTITY_LEN_SIZE entities.append(entity_pb.EntityProto(blob[pos:pos + entity_len])) pos += entity_len return entities def _encode_key_len(self, key): return bytes(bytearray([key.path().element_size()])) def _encode_entity_len(self, encoded_entity): if len(encoded_entity) > MAX_ENTITY_SIZE: raise BadRequest(u'Entity exceeds maximum size') return Int64.encode_bare(len(encoded_entity), self._ENTITY_LEN_SIZE) def _encode_chunks(self, section_prefix, value): full_prefix = section_prefix + b'\x00' * VERSIONSTAMP_SIZE versionstamp_index = encode_versionstamp_index(len(section_prefix)) chunk_count = int(math.ceil(len(value) / self._CHUNK_SIZE)) return tuple( (full_prefix + six.int2byte(index) + versionstamp_index, value[index * self._CHUNK_SIZE:(index + 1) * self._CHUNK_SIZE]) for index in sm.range(chunk_count)) class TransactionManager(object): """ The TransactionManager is the main interface that clients can use to interact with the transaction layer. It makes use of TransactionMetadata directories to handle the encoding and decoding details when satisfying requests. """ def __init__(self, db, tornado_fdb, directory_cache): self._db = db self._tornado_fdb = tornado_fdb self._directory_cache = directory_cache @gen.coroutine def create(self, project_id): tr = self._db.create_transaction() tx_dir = yield self._tx_metadata(tr, project_id) scatter_val = random.randint(0, 15) tr.set_versionstamped_key(tx_dir.encode_start_key(scatter_val), b'') versionstamp_future = tr.get_versionstamp() yield self._tornado_fdb.commit(tr) txid = TransactionID.encode(scatter_val, versionstamp_future.wait().value) raise gen.Return(txid) @gen.coroutine def log_lookups(self, tr, project_id, get_request): txid = get_request.transaction().handle() tx_dir = yield self._tx_metadata(tr, project_id) for key, value in tx_dir.encode_lookups(txid, get_request.key_list()): tr.set_versionstamped_key(key, value) @gen.coroutine def log_query(self, tr, project_id, query): txid = query.transaction().handle() namespace = decode_str(query.name_space()) if not query.has_ancestor(): raise BadRequest(u'Queries in a transaction must specify an ancestor') tx_dir = yield self._tx_metadata(tr, project_id) tr[tx_dir.encode_query_key(txid, namespace, query.ancestor().path())] = b'' @gen.coroutine def log_puts(self, tr, project_id, put_request): txid = put_request.transaction().handle() tx_dir = yield self._tx_metadata(tr, project_id) for key, value in tx_dir.encode_puts(txid, put_request.entity_list()): tr.set_versionstamped_key(key, value) @gen.coroutine def log_deletes(self, tr, project_id, delete_request): txid = delete_request.transaction().handle() tx_dir = yield self._tx_metadata(tr, project_id) for key, value in tx_dir.encode_deletes(txid, delete_request.key_list()): tr.set_versionstamped_key(key, value) @gen.coroutine def delete(self, tr, project_id, txid): tx_dir = yield self._tx_metadata(tr, project_id) txid_slice = tx_dir.get_txid_slice(txid) del tr[txid_slice.start.key:txid_slice.stop.key] @gen.coroutine def get_metadata(self, tr, project_id, txid): tx_dir = yield self._tx_metadata(tr, project_id) results = yield ResultIterator(tr, self._tornado_fdb, tx_dir.get_txid_slice(txid)).list() scatter_val, tx_start_versionstamp = TransactionID.decode(txid) if (not results or results[0].key != tx_dir.encode_start_key(scatter_val, tx_start_versionstamp)): raise BadRequest(u'Transaction not found') raise gen.Return(tx_dir.decode_metadata(txid, results[1:])) @gen.coroutine def clear_range(self, tr, project_id, scatter_byte, safe_versionstamp): tx_dir = yield self._tx_metadata(tr, project_id) expired_slice = tx_dir.get_expired_slice(scatter_byte, safe_versionstamp) del tr[expired_slice.start.key:expired_slice.stop.key] @gen.coroutine def _tx_metadata(self, tr, project_id): path = TransactionMetadata.directory_path(project_id) directory = yield self._directory_cache.get(tr, path) raise gen.Return(TransactionMetadata(directory))
36.79288
79
0.723371
8ac1309958fba9bbbc21158e66116d57ddc4d9fe
4,737
sql
SQL
database vuoto.sql
M9k/TecWeb-TouhouProject-website
e561d643f55f3471f6e911bdf9aee36b614a5483
[ "BSD-3-Clause" ]
null
null
null
database vuoto.sql
M9k/TecWeb-TouhouProject-website
e561d643f55f3471f6e911bdf9aee36b614a5483
[ "BSD-3-Clause" ]
null
null
null
database vuoto.sql
M9k/TecWeb-TouhouProject-website
e561d643f55f3471f6e911bdf9aee36b614a5483
[ "BSD-3-Clause" ]
null
null
null
-- phpMyAdmin SQL Dump -- version 4.7.0 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Dec 31, 2017 at 01:51 PM -- Server version: 10.1.26-MariaDB -- PHP Version: 7.1.8 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; -- -- Database: `touhou` -- -- -------------------------------------------------------- -- -- Table structure for table `admins` -- CREATE TABLE `admins` ( `username` varchar(50) NOT NULL, `email` varchar(150) DEFAULT NULL, `password` varchar(256) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `admins` -- INSERT INTO `admins` (`username`, `email`, `password`) VALUES ('admin', 'admin@gmail.com', '$2y$10$F0B3IE4vRA0kXt74LkCcBO4qOOKnjSbQXxWT8LNMdswo6N7W8OGWi'); -- -- Table structure for table `ban` -- CREATE TABLE `ban` ( `id` int(10) UNSIGNED NOT NULL, `ip` varchar(45) COLLATE utf8_unicode_ci NOT NULL COMMENT 'per ipv4, ipv6 e ipv6 compatibili ipv4', `motivo` char(255) COLLATE utf8_unicode_ci NOT NULL, `date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `ban` -- -- -------------------------------------------------------- -- -- Table structure for table `chapters` -- CREATE TABLE `chapters` ( `number` varchar(10) COLLATE utf8_unicode_ci NOT NULL, `year` int(11) NOT NULL, `title` tinytext COLLATE utf8_unicode_ci NOT NULL, `image` tinytext COLLATE utf8_unicode_ci NOT NULL, `imagedescr` tinytext COLLATE utf8_unicode_ci NOT NULL, `titleeng` tinytext COLLATE utf8_unicode_ci NOT NULL, `titleita` tinytext COLLATE utf8_unicode_ci NOT NULL, `plot` text COLLATE utf8_unicode_ci NOT NULL, `id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `chapters` -- -- -------------------------------------------------------- -- -- Table structure for table `comment` -- CREATE TABLE `comment` ( `id` int(10) UNSIGNED NOT NULL, `news_id` int(10) UNSIGNED NOT NULL, `nick` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `email` varchar(200) COLLATE utf8_unicode_ci NOT NULL, `message` text COLLATE utf8_unicode_ci NOT NULL, `data` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `ip` varchar(45) COLLATE utf8_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `comment` -- INSERT INTO `comment` (`id`, `news_id`, `nick`, `email`, `message`, `data`, `ip`) VALUES (8, 0, 'Samuele', 'samu@samu.com', 'Sarebbe bello capire il giapponese...', '2017-12-10 18:05:00', 'unknow'), (9, 0, 'Matteo', 'mtodescato@tiscali.it', 'Sar&agrave; difficile finirlo anche ad easy &gt;_&lt;', '2017-12-10 18:07:57', 'unknow'), (10, 0, 'Mirco', 'mcailotto96@gmail.com', 'Mio al day one!!!', '2017-12-10 18:09:38', 'unknow'); -- -------------------------------------------------------- -- -- Table structure for table `news` -- CREATE TABLE `news` ( `id` int(10) UNSIGNED NOT NULL, `title` varchar(100) CHARACTER SET latin1 NOT NULL, `hidden` tinyint(1) NOT NULL DEFAULT '0', `data` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `text` text CHARACTER SET latin1 NOT NULL, `image` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, `imgdescr` tinytext COLLATE utf8_unicode_ci ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `news` -- -- -- Indexes for dumped tables -- -- -- Indexes for table `admins` -- ALTER TABLE `admins` ADD PRIMARY KEY (`username`); -- -- Indexes for table `ban` -- ALTER TABLE `ban` ADD PRIMARY KEY (`id`); -- -- Indexes for table `chapters` -- ALTER TABLE `chapters` ADD PRIMARY KEY (`id`); -- -- Indexes for table `comment` -- ALTER TABLE `comment` ADD PRIMARY KEY (`id`), ADD KEY `news_id` (`news_id`); -- -- Indexes for table `news` -- ALTER TABLE `news` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `ban` -- ALTER TABLE `ban` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `chapters` -- ALTER TABLE `chapters` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17; -- -- AUTO_INCREMENT for table `comment` -- ALTER TABLE `comment` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT for table `news` -- ALTER TABLE `news` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- Constraints for dumped tables -- -- -- Constraints for table `comment` -- ALTER TABLE `comment` ADD CONSTRAINT `comment_ibfk_1` FOREIGN KEY (`news_id`) REFERENCES `news` (`id`); COMMIT;
25.063492
132
0.666244
86faff8b4211f13c9c1701789f7896cffd968317
1,299
kt
Kotlin
app/src/main/java/com/javiermendonca/atomicdropsnotifier/data/repository/AtomicDropRepository.kt
javierjmc/atomic-drops-notifier
dec1947a9e5825330d5c28ccc5be575c596986cb
[ "Apache-2.0" ]
9
2021-02-21T21:37:53.000Z
2022-03-15T16:28:23.000Z
app/src/main/java/com/javiermendonca/atomicdropsnotifier/data/repository/AtomicDropRepository.kt
javierjmc/atomic-drops-notifier
dec1947a9e5825330d5c28ccc5be575c596986cb
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/javiermendonca/atomicdropsnotifier/data/repository/AtomicDropRepository.kt
javierjmc/atomic-drops-notifier
dec1947a9e5825330d5c28ccc5be575c596986cb
[ "Apache-2.0" ]
1
2022-01-21T06:16:15.000Z
2022-01-21T06:16:15.000Z
package com.javiermendonca.atomicdropsnotifier.data.repository import android.content.SharedPreferences import com.javiermendonca.atomicdropsnotifier.data.api.AtomicAssetsApi import com.javiermendonca.atomicdropsnotifier.data.api.ChainApi import com.javiermendonca.atomicdropsnotifier.data.api.TemplateResult import com.javiermendonca.atomicdropsnotifier.data.dtos.TableRow import com.javiermendonca.atomicdropsnotifier.data.dtos.Template class AtomicDropRepository( private val chainApi: ChainApi, private val atomicAssetsApi: AtomicAssetsApi, private val sharedPreferences: SharedPreferences ) { suspend fun getAtomicDrops(tableRow: TableRow) = chainApi.getAtomicDrops(tableRow) suspend fun fetchTemplate(collectionName: String?, templateId: Int?): TemplateResult { return if (!collectionName.isNullOrBlank() && templateId != null) { atomicAssetsApi.getTemplate(collectionName, templateId) } else { TemplateResult(success = false, template = Template()) } } fun persistAtomicDrop(dropId: Int) = sharedPreferences .edit() .putInt(DROP_ID, dropId) .apply() fun lastPersistedDrop() = sharedPreferences.getInt(DROP_ID, -1) companion object { const val DROP_ID = "dropId" } }
36.083333
90
0.750577
82bf35137ba01e7cce758243dc5f5e6bbfb30287
487
asm
Assembly
oeis/194/A194589.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/194/A194589.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/194/A194589.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A194589: a(n) = A194588(n) - A005043(n); complementary Riordan numbers. ; Submitted by Jon Maiga ; 0,0,1,1,5,11,34,92,265,751,2156,6194,17874,51702,149941,435749,1268761,3700391,10808548,31613474,92577784,271407896,796484503,2339561795,6877992334,20236257626,59581937299,175546527727,517538571125,1526679067331,4505996000730 mov $3,$0 mov $5,$0 lpb $5 mov $0,$3 sub $0,2 sub $5,1 sub $0,$5 mov $1,$3 bin $1,$0 mov $2,$5 bin $2,$0 mul $1,$2 add $4,$1 lpe mov $0,$4
24.35
227
0.694045
c2d1bf63db10687f883274bebb9450997bc5d6c4
3,754
go
Go
pkg/mutate/mutate.go
CaoZhechuan/webhook-demo
71142d267f621c195a4b187c0e2677c5a4895683
[ "Apache-2.0" ]
null
null
null
pkg/mutate/mutate.go
CaoZhechuan/webhook-demo
71142d267f621c195a4b187c0e2677c5a4895683
[ "Apache-2.0" ]
null
null
null
pkg/mutate/mutate.go
CaoZhechuan/webhook-demo
71142d267f621c195a4b187c0e2677c5a4895683
[ "Apache-2.0" ]
null
null
null
// Package mutate deals with AdmissionReview requests and responses, it takes in the request body and returns a readily converted JSON []byte that can be // returned from a http Handler w/o needing to further convert or modify it, it also makes testing Mutate() kind of easy w/o need for a fake http server, etc. package mutate import ( "encoding/json" "fmt" "github.com/alex-leonhardt/k8s-mutate-webhook/pkg/adapter" "k8s.io/api/admission/v1beta1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/serializer" "log" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) type rfc6902PatchOperation struct { Op string `json:"op"` Path string `json:"path"` Value interface{} `json:"value"` } var ( runtimeScheme = runtime.NewScheme() codecs = serializer.NewCodecFactory(runtimeScheme) deserializer = codecs.UniversalDeserializer() ) // Mutate mutates func Mutate(body []byte, verbose bool) ([]byte, error) { if verbose { log.Printf("recv: %s\n", string(body)) // untested section } var ar *adapter.AdmissionReview var obj = v1beta1.AdmissionReview{} var reviewResponse = &adapter.AdmissionResponse{} if out, _, err := deserializer.Decode(body, nil, &obj); err != nil { log.Println("decode err : ", err) reviewResponse = &adapter.AdmissionResponse{ Result: &metav1.Status{ Message: err.Error(), }, } } else { log.Printf("out: %v\n", out) ar, err = adapter.AdmissionReviewKubeToAdapter(out) if err != nil { log.Println(fmt.Sprintf("Could not decode object: %v", err)) } } var err error var pod *corev1.Pod fmt.Println("ar: ", ar) response := adapter.AdmissionReview{} var responseBody []byte var apiVersion string if ar != nil { // get the Pod object and unmarshal it into its struct, if we cannot, we might as well stop here if err := json.Unmarshal(ar.Request.Object.Raw, &pod); err != nil { return nil, fmt.Errorf("unable unmarshal pod json object %v", err) } // set response options reviewResponse.Allowed = true reviewResponse.PatchType = func() *string { pt := "JSONPatch" return &pt }() // it's annoying that this needs to be a pointer as you cannot give a pointer to a constant? // add some audit annotations, helpful to know why a object was modified, maybe (?) reviewResponse.AuditAnnotations = map[string]string{ "mutateme": "yup it did it", } // the actual mutation is done by a string in JSONPatch style, i.e. we don't _actually_ modify the object, but // tell K8S how it should modifiy it var c corev1.Container c.Name = "test" c.Command = []string{"/usr/sbin/init"} c.Image = "harbor.ziroom.com/public/centos:7" var d interface{} d = c p := []rfc6902PatchOperation{} patch := rfc6902PatchOperation{ Op: "add", Path: "/spec/containers/-", Value: d, } p = append(p, patch) // parse the []map into JSON reviewResponse.Patch, err = json.Marshal(p) // Success, of course ;) reviewResponse.Result = &metav1.Status{ Status: "Success", } response.Response = reviewResponse apiVersion = ar.APIVersion response.TypeMeta = ar.TypeMeta if response.Response != nil { if ar.Request != nil { response.Response.UID = ar.Request.UID } } var responseKube runtime.Object responseKube = adapter.AdmissionReviewAdapterToKube(&response, apiVersion) // back into JSON so we can return the finished AdmissionReview w/ Response directly // w/o needing to convert things in the http handler responseBody, err = json.Marshal(responseKube) if err != nil { return nil, err // untested section } } if verbose { log.Printf("resp: %s\n", string(responseBody)) // untested section } return responseBody, nil }
28.439394
158
0.694459
b23448128f916eac53613cdf5b9342ffb9aace93
844
lua
Lua
Localization.lua
yannlugrin/WhatsTraining
7883356f2affbfe3ec66b7e5a1f216e203d53730
[ "MIT" ]
null
null
null
Localization.lua
yannlugrin/WhatsTraining
7883356f2affbfe3ec66b7e5a1f216e203d53730
[ "MIT" ]
null
null
null
Localization.lua
yannlugrin/WhatsTraining
7883356f2affbfe3ec66b7e5a1f216e203d53730
[ "MIT" ]
null
null
null
local _, wt = ... local localeText = { enUS = { AVAILABLE_HEADER = "Available Now", MISSINGREQS_HEADER = "Available but Missing Requirements", NEXTLEVEL_HEADER = "Coming Soon", NOTLEVEL_HEADER = "Not Yet Available", MISSINGTALENT_HEADER = "Missing Required Talents", IGNORED_HEADER = "Ignored", KNOWN_HEADER = "Already Known", PET_HEADER = "Pet Abilities", COST_FORMAT = "Cost: %s", TOTALCOST_FORMAT = "Total Cost: %s", TOTALSAVINGS_FORMAT = "Total Savings: %s", LEVEL_FORMAT = "Level %s", TAB_TEXT = "What can I train?" } } wt.L = localeText["enUS"] local locale = GetLocale() if (locale == "enUS" or locale == "enGB" or localeText[locale] == nil) then return end for k, v in pairs(localeText[locale]) do wt.L[k] = v end
29.103448
75
0.61019
20faf22ed980cda6424aa22e669b1edfd3eaed4e
139
css
CSS
css/app.css
electron-game-console/electron-game-console
d9955ef9d13f82bb843b73c64f9e1cabd1056257
[ "CC0-1.0" ]
null
null
null
css/app.css
electron-game-console/electron-game-console
d9955ef9d13f82bb843b73c64f9e1cabd1056257
[ "CC0-1.0" ]
null
null
null
css/app.css
electron-game-console/electron-game-console
d9955ef9d13f82bb843b73c64f9e1cabd1056257
[ "CC0-1.0" ]
null
null
null
@import url('nabro/_reset.css'); @import url('nabro/_variables.css'); @import url('nabro/_main.css'); @import url('nabro/_game-menu.css');
27.8
36
0.705036
f77fba8b097c2708d527f93cd691b66ada2a7fcc
1,010
c
C
core/lb_tcp_secret_seq.c
muziding/jupiter
1fd7df081f7b459ee5e951ff16ca1741f6c8e021
[ "MIT" ]
287
2017-12-17T14:48:00.000Z
2022-03-28T06:12:07.000Z
core/lb_tcp_secret_seq.c
tydhome/jupiter
6b1206af3303ebd934df969e8894cdd93acfd09f
[ "MIT" ]
18
2017-12-18T15:50:59.000Z
2020-05-14T09:19:38.000Z
core/lb_tcp_secret_seq.c
tydhome/jupiter
6b1206af3303ebd934df969e8894cdd93acfd09f
[ "MIT" ]
109
2017-12-19T03:42:09.000Z
2022-03-25T11:25:39.000Z
/* Copyright (c) 2018. TIG developer. */ #include <rte_cycles.h> #include <rte_random.h> #include "lb_md5.h" #include "lb_tcp_secret_seq.h" #ifndef __rte_cache_aligned #define __rte_cache_aligned __rte_aligned(RTE_CACHE_LINE_SIZE) #endif static uint32_t seq_secret[MD5_MESSAGE_BYTES / 4] __rte_cache_aligned; static void seq_secret_init(void) { int i; static uint8_t inited = 0; if (likely(inited)) return; for (i = 0; i < MD5_MESSAGE_BYTES / 4; i++) { seq_secret[i] = rte_rand(); } inited = 1; } uint32_t tcp_secret_new_seq(uint32_t saddr, uint32_t daddr, uint16_t sport, uint16_t dport) { uint32_t hash[MD5_DIGEST_WORDS]; uint64_t ns; seq_secret_init(); hash[0] = saddr; hash[1] = daddr; hash[2] = (sport << 16) + dport; hash[3] = seq_secret[15]; md5_transform(hash, seq_secret); ns = rte_get_tsc_cycles() / ((rte_get_tsc_hz() + NS_PER_S - 1) / NS_PER_S); return hash[0] + (uint32_t)(ns >> 6); }
21.041667
79
0.651485
775a6720577b417b8daaa8c07c5fc70715e38f5a
1,040
html
HTML
index.html
AntonioMadureira22/CodeQuiz
1ff7292a088fc5d1dac707d76e15236dc94fa359
[ "MIT" ]
null
null
null
index.html
AntonioMadureira22/CodeQuiz
1ff7292a088fc5d1dac707d76e15236dc94fa359
[ "MIT" ]
null
null
null
index.html
AntonioMadureira22/CodeQuiz
1ff7292a088fc5d1dac707d76e15236dc94fa359
[ "MIT" ]
null
null
null
<!DOCTYPE html> <html lang="en"> <header> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" /> <title>Code Quiz</title> <link rel="stylesheet" href="./code-quiz/asset/style.css" /> </header> </html> <body> <div class="scores" id="scores"> <a href="highScore.html">View Highscores</a> </div> <div class="timer" id="timer"> Time: <span class="countdown" id="countdown">0</span> </div> <div class="page-content"> <div class="question" id="question"> <h1>Coding Quiz Challenge</h1> <p> Welcome to the code quiz! This is where you test your knowledge and to be the code quiz champion! Be aware of the timer! As this is timed if you get a incorrect score it deducts time. </p> <ul class="choices" id="choices"></ul> <button class="start-time" id="start-time">START</button> </div> </div> <script src="./code-quiz/asset/script.js"></script> </body>
30.588235
192
0.627885
3e1e0a89b295d87aa00816367a3a51aa67bafee1
264
sql
SQL
Bundle/CoreBundle/Resources/databases/core/sql/pre_sync/100_auto_auditable_behavior.sql
eulogix/cool-bundle
5a78c1135226f2367f47a736fa89f23e3c19006f
[ "MIT" ]
2
2017-05-15T16:10:48.000Z
2018-02-22T07:31:18.000Z
Bundle/CoreBundle/Resources/databases/core/sql/pre_sync/100_auto_auditable_behavior.sql
eulogix/cool-bundle
5a78c1135226f2367f47a736fa89f23e3c19006f
[ "MIT" ]
null
null
null
Bundle/CoreBundle/Resources/databases/core/sql/pre_sync/100_auto_auditable_behavior.sql
eulogix/cool-bundle
5a78c1135226f2367f47a736fa89f23e3c19006f
[ "MIT" ]
null
null
null
/* file generation UUID: 5cc2f85170daf */ -- -- Remove Auditing triggers for async_job -- DROP FUNCTION if EXISTS async_job_audf() CASCADE; -- -- Remove Auditing triggers for user_notification -- DROP FUNCTION if EXISTS user_notification_audf() CASCADE;
13.2
57
0.746212
dd55f78c4005f894a6ff5ae6272617d974432efe
497
go
Go
pkg/database/operations.go
progoci/progo-build
4f682fbf81b17e477262c65fc9e4edc66276175a
[ "MIT" ]
null
null
null
pkg/database/operations.go
progoci/progo-build
4f682fbf81b17e477262c65fc9e4edc66276175a
[ "MIT" ]
null
null
null
pkg/database/operations.go
progoci/progo-build
4f682fbf81b17e477262c65fc9e4edc66276175a
[ "MIT" ]
null
null
null
package database import ( "context" "time" "github.com/pkg/errors" "github.com/progoci/progo-build/pkg/build" ) // Create inserts a new build. func (d *Database) Create(build *build.Build) (string, error) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() result, err := d.MongoClient.Collection("builds").InsertOne(ctx, build) if err != nil { return "", errors.Wrap(err, "could not insert build") } return result.InsertedID.(string), nil }
21.608696
73
0.702213
9c4df254ce00c2bd6b8e5e8d22358b1c3232e72e
703
js
JavaScript
src/form/form.index.js
YonatanKra/YOPF
b8df850036d0d08a749f207bc272b290b259f1db
[ "MIT" ]
2
2019-07-27T09:17:24.000Z
2019-09-17T11:12:19.000Z
src/form/form.index.js
YonatanKra/YOPF
b8df850036d0d08a749f207bc272b290b259f1db
[ "MIT" ]
null
null
null
src/form/form.index.js
YonatanKra/YOPF
b8df850036d0d08a749f207bc272b290b259f1db
[ "MIT" ]
1
2019-01-03T09:17:40.000Z
2019-01-03T09:17:40.000Z
// get the template import template from './form.index.html'; // get the styles import {} from './form.index.css'; class YOPFForm{ constructor(element) { this._element = element; this.setTemplate(); } setTemplate() { this._element.innerHTML = template; this._form = this._element.getElementsByTagName('form')[0]; this._form.addEventListener("submit", (event)=> { event.preventDefault(); this.onSubmit(event.target); }, false ); } onSubmit(form) { this._callback(form.phrase.value); } listen(callback) { this._callback = callback; } } export default YOPFForm;
21.96875
67
0.581792
d1de3528a1560b440bab4f9a0fb99c3d751d455e
2,312
sql
SQL
airflow/migrations/0001-add-execution-report-tables-202002041716.sql
rafaelpezzuto/opac-airflow
7e73eaacdace5ca9d3dbcf2c5f84019568282485
[ "BSD-2-Clause" ]
4
2019-03-16T04:05:22.000Z
2021-09-09T14:27:52.000Z
airflow/migrations/0001-add-execution-report-tables-202002041716.sql
rafaelpezzuto/opac-airflow
7e73eaacdace5ca9d3dbcf2c5f84019568282485
[ "BSD-2-Clause" ]
199
2019-03-15T18:18:25.000Z
2022-03-21T10:38:30.000Z
airflow/migrations/0001-add-execution-report-tables-202002041716.sql
rafaelpezzuto/opac-airflow
7e73eaacdace5ca9d3dbcf2c5f84019568282485
[ "BSD-2-Clause" ]
11
2019-03-15T14:49:03.000Z
2021-07-21T12:29:10.000Z
/* * A tabela xml_documents guarda o registro de iterações dos xmls que estão dentro * de um pacote SPS. * * Para cada artigo registrado ou deletado durante a sincronização, nós adicionamos * uma entrada nesta tabela. */ CREATE TABLE IF NOT EXISTS xml_documents ( id SERIAL PRIMARY KEY, pid varchar(23) NULL, -- scielo-pid-v3 presente no xml package_name varchar(255) null, -- Nome do pacote processado ex: `rsp_v53.zip` dag_run varchar(255), -- Identificador de execução da dag `sync_documents_to_kernel` pre_sync_dag_run varchar(255) NULL, -- Identificador de execução da dag `pre_sync_documents_to_kernel` deletion bool DEFAULT false, file_name varchar(255), -- Nome do arquivo xml failed bool DEFAULT false, error text null, -- Erro lançado durante processamento payload json, -- Dado enviado para o Kernel created_at timestamptz DEFAULT now() ); CREATE INDEX IF NOT EXISTS xml_documents_pid ON xml_documents (pid); CREATE INDEX IF NOT EXISTS xml_documents_dag_run ON xml_documents (dag_run); CREATE INDEX IF NOT EXISTS xml_documents_package_name ON xml_documents (package_name); CREATE INDEX IF NOT EXISTS xml_documents_pre_sync_dag_run ON xml_documents (pre_sync_dag_run); /* * A tabela xml_documentsbundle guarda o registro de relacionamento entre * os artigos e seus respectivos `documentsbundle`. */ CREATE TABLE IF NOT EXISTS xml_documentsbundle ( id SERIAL PRIMARY KEY, pid varchar(23) NULL, bundle_id varchar(100), package_name varchar(255) null, dag_run varchar(255), pre_sync_dag_run varchar(255) NULL, ex_ahead bool default false, removed bool default false, failed bool DEFAULT false, error text null, payload json null, created_at timestamptz default now() ); CREATE INDEX IF NOT EXISTS xml_documentsbundle_pid ON xml_documentsbundle (pid); CREATE INDEX IF NOT EXISTS xml_documentsbundle_dag_run ON xml_documentsbundle (dag_run); CREATE INDEX IF NOT EXISTS xml_documentsbundle_package_name ON xml_documentsbundle (package_name); CREATE INDEX IF NOT EXISTS xml_documentsbundle_pre_sync_dag_run ON xml_documentsbundle (pre_sync_dag_run);
47.183673
119
0.723183
56d08d71ec65813c8852640ec8fd0c2f600ee493
250
kt
Kotlin
app/src/main/kotlin/com/werb/glideman/demo/MyAppGlideModule.kt
werbhelius/GlideMan
002eb2b3a7650f4a9ac47abd798a1afda67dc7d1
[ "Apache-2.0" ]
4
2019-02-18T03:42:51.000Z
2020-03-31T17:41:22.000Z
app/src/main/kotlin/com/werb/glideman/demo/MyAppGlideModule.kt
o0o0oo00/GlideMan
17560982f0fc4d3637107c6bdb940dcce278ecc4
[ "Apache-2.0" ]
null
null
null
app/src/main/kotlin/com/werb/glideman/demo/MyAppGlideModule.kt
o0o0oo00/GlideMan
17560982f0fc4d3637107c6bdb940dcce278ecc4
[ "Apache-2.0" ]
3
2019-05-22T02:22:42.000Z
2021-06-28T06:18:00.000Z
package com.werb.glideman.demo import com.bumptech.glide.annotation.GlideModule import com.bumptech.glide.module.AppGlideModule /** * 修改 Glide 的配置作用 * Created by wanbo on 2018/4/3. */ @GlideModule class MyAppGlideModule : AppGlideModule() { }
16.666667
48
0.764
81ba8f041f0bf0f715e539c7408bc63a3787508a
1,127
go
Go
test/e2e/runtime_test.go
metacosm/runtime-component-operator
e9635ed54bf7391e6ff5362a22f04c89d8af5960
[ "Apache-2.0" ]
null
null
null
test/e2e/runtime_test.go
metacosm/runtime-component-operator
e9635ed54bf7391e6ff5362a22f04c89d8af5960
[ "Apache-2.0" ]
null
null
null
test/e2e/runtime_test.go
metacosm/runtime-component-operator
e9635ed54bf7391e6ff5362a22f04c89d8af5960
[ "Apache-2.0" ]
null
null
null
package e2e import ( "testing" "github.com/application-stacks/runtime-component-operator/pkg/apis" appstacksv1beta1 "github.com/application-stacks/runtime-component-operator/pkg/apis/appstacks/v1beta1" framework "github.com/operator-framework/operator-sdk/pkg/test" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // TestRuntimeComponent ... end to end tests func TestRuntimeComponent(t *testing.T) { runtimeComponentList := &appstacksv1beta1.RuntimeComponentList{ TypeMeta: metav1.TypeMeta{ Kind: "RuntimeComponent", }, } err := framework.AddToFrameworkScheme(apis.AddToScheme, runtimeComponentList) if err != nil { t.Fatalf("Failed to add CR scheme to framework: %v", err) } t.Run("RuntimePullPolicyTest", RuntimePullPolicyTest) t.Run("RuntimeBasicTest", RuntimeBasicTest) t.Run("RuntimeStorageTest", RuntimeBasicStorageTest) t.Run("RuntimePersistenceTest", RuntimePersistenceTest) t.Run("RuntimeProbeTest", RuntimeProbeTest) t.Run("RuntimeAutoScalingTest", RuntimeAutoScalingTest) t.Run("RuntimeServiceMonitorTest", RuntimeServiceMonitorTest) t.Run("RuntimeKnativeTest", RuntimeKnativeTest) }
34.151515
103
0.790594
f0543cb40c039abb32fd9a9b28e4199de1619178
1,272
js
JavaScript
src/component/Contact.js
Danomiterock/Lucas-React-Portfolio
5c7da472a67368d1423bb06f67b9407d31fc35a0
[ "MIT" ]
null
null
null
src/component/Contact.js
Danomiterock/Lucas-React-Portfolio
5c7da472a67368d1423bb06f67b9407d31fc35a0
[ "MIT" ]
null
null
null
src/component/Contact.js
Danomiterock/Lucas-React-Portfolio
5c7da472a67368d1423bb06f67b9407d31fc35a0
[ "MIT" ]
null
null
null
import React from "react"; import { Card, Col, Container, Row } from "react-bootstrap"; import data from "../contacts.json"; const styles = { card: { width: "100%", height: "100%", borderRadius: "5%", borderShadow: "5px", textAlign: "center", }, wrapper: { background: "#333333", color: "#CCCCCC", height: "100%", width: "100%", }, cardDeck: { display: "flex", flexDirection: "row", justifyContent: "center", }, }; const Contact = (props) => { return ( <div style={styles.wrapper}> <Container fluid> <Row style={styles.cardDeck}> {data.map((contacts) => ( <Col xs={1} md={2} lg={3}> <Card style={styles.card} key={contacts.id} className="block-example border border-dark" > <Card.Img variant="top" src={`assets/image/${contacts.image}`} alt={contacts.alt} /> <Card.Body> <a href={contacts.link}>Click Here!</a> </Card.Body> </Card> </Col> ))} </Row> </Container> </div> ); }; export default Contact;
23.127273
60
0.46305
39116ae8a089bcc4f40e78838c546f5488588cf0
7,171
sql
SQL
plantstore_db.sql
naufalmukhbit/plantstore
877c73e439e7e9945c026b01aa710bbb25df1b67
[ "MIT" ]
null
null
null
plantstore_db.sql
naufalmukhbit/plantstore
877c73e439e7e9945c026b01aa710bbb25df1b67
[ "MIT" ]
null
null
null
plantstore_db.sql
naufalmukhbit/plantstore
877c73e439e7e9945c026b01aa710bbb25df1b67
[ "MIT" ]
null
null
null
-- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Aug 04, 2019 at 04:12 AM -- Server version: 10.1.39-MariaDB -- PHP Version: 7.3.5 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: `plantstore_db` -- -- -------------------------------------------------------- -- -- Table structure for table `address_data` -- CREATE TABLE `address_data` ( `address_id` int(7) NOT NULL, `userid` int(5) NOT NULL, `address` varchar(100) NOT NULL, `city` varchar(20) NOT NULL, `province` varchar(20) NOT NULL, `postal_code` int(5) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `address_data` -- INSERT INTO `address_data` (`address_id`, `userid`, `address`, `city`, `province`, `postal_code`) VALUES (1, 19, 'Smart City', 'Bandung', 'Jawa Barat', 40288), (2, 21, 'telkom university', 'bandung', 'Jawa Barat', 40288), (3, 21, 'gba 1', 'bandung', 'Jawa Barat', 40288), (4, 22, 'bsd', 'tangsel', 'Banten', 15318); -- -------------------------------------------------------- -- -- Table structure for table `article_data` -- CREATE TABLE `article_data` ( `article_id` int(7) NOT NULL, `title` varchar(100) NOT NULL, `text_src` varchar(15) NOT NULL, `img_src` varchar(15) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `article_data` -- INSERT INTO `article_data` (`article_id`, `title`, `text_src`, `img_src`) VALUES (1, 'Menanam Tomat secara Hidroponik dalam Botol Bekas', 'art1.txt', 'art_bg1.jpg'), (2, 'Cara Menanam Tomat Hidroponik dalam Polybag', 'art2.txt', 'art_bg2.jpg'), (3, 'Cara Menanam Cabe Hidroponik Dalam Botol', 'art3.txt', 'art_bg3.jpg'), (4, 'Cara Menanam Cabe Hidroponik Menggunakan Polybag', 'art4.txt', 'art_bg4.jpg'), (5, 'Cara Menanam Sawi Hidroponik dengan Botol Bekas', 'art5.txt', 'art_bg5.jpg'), (6, 'Cara Menanam Sawi di Polybag', 'art6.txt', 'art_bg6.jpg'), (7, 'Cara Budidaya Kangkung Hidroponik Menggunakan Botol Bekas', 'art7.txt', 'art_bg7.jpg'), (8, 'Cara Menanam Kangkung Cabut Dalam Pot atau Polybag', 'art8.txt', 'art_bg8.jpg'); -- -------------------------------------------------------- -- -- Table structure for table `cart` -- CREATE TABLE `cart` ( `userid` int(5) NOT NULL, `prod_id` int(10) NOT NULL, `amount` int(3) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `cart` -- INSERT INTO `cart` (`userid`, `prod_id`, `amount`) VALUES (3, 2, 1), (3, 4, 1); -- -------------------------------------------------------- -- -- Table structure for table `id_data` -- CREATE TABLE `id_data` ( `userid` int(5) NOT NULL, `username` varchar(20) NOT NULL, `email` varchar(30) NOT NULL, `password` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `id_data` -- INSERT INTO `id_data` (`userid`, `username`, `email`, `password`) VALUES (1, 'admin', 'admin@playsthetic.com', 'iniadmin'), (2, 'playsthetic', 'play@playsthetic.com', 'bukanadmin'), (3, 'naufalmukhbit', 'nmukhbit@gmail.com', '120jets'), (18, 'flipflop', 'flip@flop.com', 'flip123'), (33, 'bjsck', 'knsck@cn.com', 'bbb'), (34, 'paymukh', 'nopayers@gmail.com', 'replokmania'), (35, 'ulalala', 'ulala@ulala.com', 'ulaula'); -- -------------------------------------------------------- -- -- Table structure for table `product` -- CREATE TABLE `product` ( `prod_id` int(10) NOT NULL, `prod_name` varchar(50) NOT NULL, `price` int(10) NOT NULL, `prod_desc` varchar(1000) NOT NULL, `userid` int(5) NOT NULL, `img_src` varchar(30) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `product` -- INSERT INTO `product` (`prod_id`, `prod_name`, `price`, `prod_desc`, `userid`, `img_src`) VALUES (1, 'Patriot Seeds Organic Beefsteak Tomato', 59000, '', 2, 'tomato2.jpg'), (2, 'Patriot Seeds Organic Marion Tomato', 69000, '', 2, 'tomato1.jpg'), (3, 'Polo Ralph Lauren Shirt', 149000, '', 3, 'polo.jpg'), (4, 'Aarbee Men\'s Cotton T-Shirt', 80000, '', 18, '1..jpg'), (5, 'BAPE X DRAGONBALLZ FRIENDS WHITE Sweater', 120000, '', 18, '2..jpg'), (6, 'Nongxindazao Mini Cherry Tomato', 70000, '', 3, 'tomato3.png'); -- -------------------------------------------------------- -- -- Table structure for table `profile_data` -- CREATE TABLE `profile_data` ( `userid` int(5) NOT NULL, `name` varchar(65) NOT NULL, `bdate` date NOT NULL, `gender` varchar(9) NOT NULL, `phone` varchar(13) NOT NULL, `disp_pic` varchar(30) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `profile_data` -- INSERT INTO `profile_data` (`userid`, `name`, `bdate`, `gender`, `phone`, `disp_pic`) VALUES (1, 'Administrator', '1998-08-27', 'Laki-laki', '082114435057', ''), (2, 'Plantstore Jakarta', '2018-04-30', 'Laki-laki', '-', ''), (3, 'Naufal Mukhbit A', '2018-05-16', 'Laki-laki', '0821-1443-505', '632912.jpg'), (18, 'James Gullivan', '1995-03-23', 'Laki-laki', '080866662222', ''), (33, 'efafw', '2018-05-01', 'Laki-laki', '2424-2142-422', '2015-03-28_02_37_01_2.jpg'), (34, 'Naufal Mukhbit', '1998-08-27', 'Laki-laki', '0882-1858-490', ''), (35, 'ulala', '2019-08-13', 'Laki-laki', '0824-4143-253', ''); -- -------------------------------------------------------- -- -- Table structure for table `wishlist` -- CREATE TABLE `wishlist` ( `userid` int(5) NOT NULL, `prod_id` int(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `wishlist` -- INSERT INTO `wishlist` (`userid`, `prod_id`) VALUES (3, 2), (3, 1); -- -- Indexes for dumped tables -- -- -- Indexes for table `address_data` -- ALTER TABLE `address_data` ADD PRIMARY KEY (`address_id`); -- -- Indexes for table `article_data` -- ALTER TABLE `article_data` ADD PRIMARY KEY (`article_id`); -- -- Indexes for table `id_data` -- ALTER TABLE `id_data` ADD PRIMARY KEY (`userid`); -- -- Indexes for table `product` -- ALTER TABLE `product` ADD PRIMARY KEY (`prod_id`); -- -- Indexes for table `profile_data` -- ALTER TABLE `profile_data` ADD PRIMARY KEY (`userid`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `address_data` -- ALTER TABLE `address_data` MODIFY `address_id` int(7) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `article_data` -- ALTER TABLE `article_data` MODIFY `article_id` int(7) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; -- -- AUTO_INCREMENT for table `id_data` -- ALTER TABLE `id_data` MODIFY `userid` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=36; -- -- AUTO_INCREMENT for table `product` -- ALTER TABLE `product` MODIFY `prod_id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; 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 */;
27.26616
104
0.634918
9d468fb03eeae94ca58deac2d5b6269a3992743d
6,957
html
HTML
signup.html
wellrafi/vaya
3676eea5a3aeb0c276fdd95a3d06b60e2a1b403b
[ "MIT" ]
null
null
null
signup.html
wellrafi/vaya
3676eea5a3aeb0c276fdd95a3d06b60e2a1b403b
[ "MIT" ]
null
null
null
signup.html
wellrafi/vaya
3676eea5a3aeb0c276fdd95a3d06b60e2a1b403b
[ "MIT" ]
null
null
null
<!DOCTYPE html> <html lang="en"> <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>Vaya Message</title> </head> <link rel="shortcut icon" href="./images/logo.png" type="image/x-icon"> <link rel="preconnect" href="https://fonts.gstatic.com"> <link href="https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,300;0,400;0,700;1,300;1,400;1,700&family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous"> <link rel="stylesheet" href="./fonts/style.css"> <link rel="stylesheet" href="./css/home.css"> <link rel="stylesheet" href="./css/util.css"> <link rel="stylesheet" href="./css/login.css"> <body style="background-color: #f4f4f4;"> <div class="header__section border-0 bg-soft"> <div class="container"> <div class="row"> <div class="col-lg-6 col-md-6 col-sm-3 col-3"> <img src="./images/logo.png" alt="" class="logo"> </div> <div class="col-lg-6 col-md-6 col-sm-9 col-9 text-end" id="right__side"> <div class="btn__header btn__login font-weight-normal fw-normal">Heeft u al een account?</div> <a class="btn__header btn__signup pointer text-uppercase">registreer</a> </div> </div> </div> </div> <main> <div class="d-flex h-100"> <div class="image_login h-100"> <img src="./images/login-min.jpg" alt=""> </div> <div class="right_side flex d-flex justify-content-center"> <div class="d-table h-100"> <div class="vertical-middle"> <div class="auth-form p-3"> <div class="form-header"> <h5 class="mb-4">Regristreren Vaya Massage</h5> <div class="sosmed row g-2"> <div class="col-6 pointer"> <div class="button d-flex g-2 justify-content-center"> <img src="./images/google.svg" class="mr-2" alt=""> <div class="sosmed-text">GOOGLE</div> </div> </div> <div class="col-6 pointer"> <div class="button d-flex g-2 justify-content-center"> <img src="./images/fb.svg" class="mr-2" alt=""> <div class="ml-2 sosmed-text">FACEBOOK</div> </div> </div> </div> </div> <div class="text-center my-4"> <p>of</p> </div> <form action=""> <div class="row my-4"> <div class="col-6"> <div class="form-group"> <label for="voornaam">Voornaam</label> <input type="text" class="form-control" name="voornaam" id="voornaam"> </div> </div> <div class="col-6"> <div class="form-group"> <label for="achternaam">Achternaam</label> <input type="text" class="form-control" name="achternaam" id="achternaam"> </div> </div> </div> <div class="form-group my-4"> <label for="email">E-mailadres</label> <input type="text" class="form-control" name="email" id="email"> </div> <div class="form-group my-4"> <label for="wachtwoord">Wachtwoord</label> <input type="password" class="form-control" name="wachtwoord" id="wachtwoord"> </div> <div class="form-group my-4"> <div class="form-check"> <input class="form-check-input" type="checkbox" value="" id="flexCheckChecked" checked> <label class="form-check-label" for="flexCheckChecked"> Door lid te worden van Vaya Massage ga ik akkoord met de algemene voorwaarden en het privacybeleid </label> </div> <div class="form-check"> <input class="form-check-input" type="checkbox" value="" id="flexCheckDefault"> <label class="form-check-label" for="flexCheckDefault"> Schrijf mij in voor de nieuwsbrief. </label> </div> </div> <div class="form-group mt-4"> <div class="d-flex justify-content-between align-items-center"> <button class="btn btn-primary pointer text-uppercase">Nieuw account </button> <a href="#" class="text-uppercase btn btn-link text-gray fw-bold">Annuleren</a> </div> </div> </form> </div> </div> </div> </div> </div> </main> </body> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="./js/home.js"></script> </html>
61.026316
271
0.428921
512cc5078bdbea045b369aa2cfc919e39a6e8d6c
2,552
kt
Kotlin
POEHelper/app/src/main/java/com/resdev/poehelper/view/datawrappers/ItemEntityUiWrapper.kt
AlexejSrc/POEHelper
36f552425743db80cb005b0cc0e46380955b3ac2
[ "MIT" ]
null
null
null
POEHelper/app/src/main/java/com/resdev/poehelper/view/datawrappers/ItemEntityUiWrapper.kt
AlexejSrc/POEHelper
36f552425743db80cb005b0cc0e46380955b3ac2
[ "MIT" ]
null
null
null
POEHelper/app/src/main/java/com/resdev/poehelper/view/datawrappers/ItemEntityUiWrapper.kt
AlexejSrc/POEHelper
36f552425743db80cb005b0cc0e46380955b3ac2
[ "MIT" ]
null
null
null
package com.resdev.poehelper.view.datawrappers import android.content.Context import android.widget.ImageView import androidx.databinding.BindingAdapter import com.resdev.poehelper.MyApplication import com.resdev.poehelper.R import com.resdev.poehelper.model.room.ItemEntity import com.resdev.poehelper.utils.roundPercentages import com.squareup.picasso.Picasso class ItemEntityUiWrapper(val item: ItemEntity, val context: Context) : ItemUiInterface { override fun getName(): String { return item.translatedName ?: item.name } override fun getChaosValue(): String { if (item.chaosValue == null) { return context.resources.getString(R.string.no_data) } return "1.0 " + context.resources.getString(R.string.string_for) + " %.2f".format(item.chaosValue!! / (currentValue.getLine().chaosEquivalent ?: 1.0)) } override fun getPercentage(): String { return roundPercentages(item.sparkline.totalChange) } override fun getQuality(): String { return "+" + item.gemQuality.toString() + "%" } override fun getTier(): String { return "tier " + item.mapTier } override fun getGemLvl(): String { return "lvl " + item.gemLevel } override fun hasGemLvl(): Boolean { return item.gemLevel != 0 } override fun hasTier(): Boolean { return item.mapTier != 0 } override fun hasQuality(): Boolean { return item.gemQuality != 0 } override fun anyApply(): Boolean { return hasGemLvl() || hasQuality() || hasTier() } override fun getCorrupted(): Boolean { return item.corrupted } override fun getPercentageColor(): Int { return if ((item.sparkline.totalChange) >= 0.0) context.getColor(R.color.green) else context.getColor( R.color.red ) } override fun getUrl(): String { return when { item.icon == null -> "" item.icon!!.endsWith(".png") -> { item.icon!! } item.variant != null -> { (item.icon + ("&${item.variant?.toLowerCase()}=1")) } else -> item.icon!! } } companion object { val currentValue = MyApplication.getCurrentValue() @JvmStatic @BindingAdapter("url") fun loadImage(imageView: ImageView, url: String) { if (url.isNotEmpty()) { Picasso.get().load(url).into(imageView) } } } }
27.44086
110
0.601097
564fe16ce650bec82effdccd7cc85c7cfbcd92f5
258
go
Go
example/example.go
vonEdfa/go-pretty-strings
3ef18bc4b7bff7f4802bcde03d6522b866021730
[ "MIT" ]
null
null
null
example/example.go
vonEdfa/go-pretty-strings
3ef18bc4b7bff7f4802bcde03d6522b866021730
[ "MIT" ]
null
null
null
example/example.go
vonEdfa/go-pretty-strings
3ef18bc4b7bff7f4802bcde03d6522b866021730
[ "MIT" ]
null
null
null
package main import ( "fmt" pretty "github.com/vonEdfa/go-pretty-strings" ) func main() { fmt.Println(pretty.BorderSquare("My example bordered box", "Free Willy!", "Super Silly!\nAlmost like Billy!")) fmt.Println(pretty.New().Title("Free Willy!")) }
18.428571
111
0.70155
f071622f9590b0b9c9b792c99316fdf9e6d16efe
3,261
js
JavaScript
src/Core/CoreGameManager.js
201flaviosilva/Impacto
e575ac973452af4468a56279ee3d0a797d96e9fa
[ "MIT" ]
1
2022-03-30T09:32:15.000Z
2022-03-30T09:32:15.000Z
src/Core/CoreGameManager.js
201flaviosilva/Impacto
e575ac973452af4468a56279ee3d0a797d96e9fa
[ "MIT" ]
24
2021-12-20T16:35:18.000Z
2022-03-31T17:59:53.000Z
src/Core/CoreGameManager.js
201flaviosilva/Impacto
e575ac973452af4468a56279ee3d0a797d96e9fa
[ "MIT" ]
1
2022-01-17T15:51:08.000Z
2022-01-17T15:51:08.000Z
import { GlobalStateManagerInstance } from "../State/GlobalStateManager.js"; import { CanvasStateInstance } from "../State/CanvasState.js"; /** * @class CoreGameManager * @description A core class to manage the game cycle. * @private */ export default class CoreGameManager { constructor() { if (CoreGameManager.instance instanceof CoreGameManager) return CoreGameManager.instance; CoreGameManager.instance = this; this.currentScene = null; this.scenes = []; // Time this._lastTimeUpdate = Date.now(); this.delta = 0; this.deltaTime = 0; this.gameTime = 0; this._fps = 0; // Temp variable just for calculating FPS this.fps = 0; window.requestAnimationFrame(this.step.bind(this)); document.addEventListener("visibilitychange", (event) => { this.tabActive = document.hidden; this._lastTimeUpdate = Date.now(); }); setInterval(this.updateFPS.bind(this), 1000); } /** * Add a new scene to the game * @param {Object} scene - The scene to add * @private */ addScene(scene) { const newScene = new scene(); this.scenes.push(newScene); } /** * Initialize a scene and set it as the current scene * * @param {number} index - The index of the scene to initialize * @private */ startScene(index) { this.currentScene = this.scenes[index]; this.currentScene.start(); } /** * Reset the calc of the FPS * * @private */ updateFPS() { this.fps = this._fps; this._fps = 0; } /** * Calculate the time since the game start, the delta time and the FPS * * @private */ calcTime() { if (this.tabActive) return; const now = Date.now(); const delta = now - this._lastTimeUpdate; const deltaTime = delta * 0.01; this._lastTimeUpdate = now; this.delta = delta; this.deltaTime = deltaTime; return { delta, deltaTime, }; } /** * Update the game * * @param {number} gameTime - The time since the game start * @private */ step(gameTime) { window.requestAnimationFrame(this.step.bind(this)); if (GlobalStateManagerInstance.isPaused) return; this.gameTime = gameTime; const time = this.calcTime(); this._fps++; if (this.currentScene) { this.currentScene.time = { delta: this.delta, deltaTime: this.deltaTime, fps: this.fps, gameTime, }; // Objects Steep this.currentScene.children.forEach(child => { if (child._step) child._step(); }); this.update(); this.render(); } } /** * Run User Code * * @private */ update() { this.currentScene.update(this.deltaTime, this.fps); } /** * Render the game in the canvas * * @private */ render() { const ctx = CanvasStateInstance.context; if (!ctx) return; if (CanvasStateInstance.backgroundColor) { ctx.fillStyle = CanvasStateInstance.backgroundColor; ctx.fillRect(0, 0, CanvasStateInstance.width, CanvasStateInstance.height); } else { ctx.clearRect(0, 0, CanvasStateInstance.width, CanvasStateInstance.height); } const zSortedChildren = this.currentScene.children.sort((a, b) => a.z - b.z); zSortedChildren.forEach(child => { if (child._render) child._render(this.deltaTime); }); this.currentScene.posRender(ctx); } } export const CoreGameManagerInstance = new CoreGameManager();
20.770701
91
0.665747
b6be55fce85ffa3f2dba4146d03e3de3905cf6db
2,268
rb
Ruby
features/step_definitions/html_steps.rb
thanhlongkt2005/rspec_api_documentation
a8bc884fa985d3efb2758e1a97f2210ddfc2c815
[ "MIT" ]
1,038
2015-01-04T20:43:10.000Z
2022-03-24T20:06:15.000Z
features/step_definitions/html_steps.rb
thanhlongkt2005/rspec_api_documentation
a8bc884fa985d3efb2758e1a97f2210ddfc2c815
[ "MIT" ]
306
2015-01-05T21:59:59.000Z
2022-03-02T22:59:40.000Z
features/step_definitions/html_steps.rb
thanhlongkt2005/rspec_api_documentation
a8bc884fa985d3efb2758e1a97f2210ddfc2c815
[ "MIT" ]
294
2015-01-05T21:56:51.000Z
2022-03-26T19:24:00.000Z
When /^I open the index$/ do visit "/index.html" end When /^I navigate to "([^"]*)"$/ do |example| click_link example end Then /^I should see the following resources:$/ do |table| expect(all("h2").map(&:text)).to eq(table.raw.flatten) end Then /^I should see the following parameters:$/ do |table| names = all(".parameters .name").map(&:text) descriptions = all(".parameters .description").map(&:text) expect(names.zip(descriptions)).to eq(table.rows) end Then(/^I should see the following response fields:$/) do |table| names = all(".response-fields .name").map(&:text) descriptions = all(".response-fields .description").map(&:text) expect(names.zip(descriptions)).to eq(table.rows) end Then /^I should see the following (request|response) headers:$/ do |part, table| actual_headers = page.find("pre.#{part}.headers").text expected_headers = table.raw.map { |row| row.join(": ") } expected_headers.each do |row| expect(actual_headers).to include(row.strip) end end Then /^I should not see the following (request|response) headers:$/ do |part, table| actual_headers = page.find("pre.#{part}.headers").text expected_headers = table.raw.map { |row| row.join(": ") } expected_headers.each do |row| expect(actual_headers).to_not include(row.strip) end end Then /^I should see the route is "([^"]*)"$/ do |route| expect(page).to have_css(".request.route", :text => route) end Then /^I should see the following query parameters:$/ do |table| text = page.find("pre.request.query_parameters").text actual = text.split("\n") expected = table.raw.map { |row| row.join(": ") } expect(actual).to match(expected) end Then /^I should see the response status is "([^"]*)"$/ do |status| expect(page).to have_css(".response.status", :text => status) end Then /^I should see the following request body:$/ do |request_body| expect(page).to have_css("pre.request.body", :text => request_body) end Then /^I should see the following response body:$/ do |response_body| expect(page).to have_css("pre.response.body", :text => response_body) end Then /^I should see the api name "(.*?)"$/ do |name| title = find("title").text header = find("h1").text expect(title).to eq(name) expect(header).to eq(name) end
29.842105
84
0.682981
e5e8cee5f29ccaa553693d81183b95b8c69e7d33
78
kt
Kotlin
idea/testData/shortenRefs/this/shortenExtensionThis.kt
qussarah/declare
c83b764c7394efa3364915d973ae79c4ebed2437
[ "Apache-2.0" ]
337
2020-05-14T00:40:10.000Z
2022-02-16T23:39:07.000Z
idea/testData/shortenRefs/this/shortenExtensionThis.kt
qussarah/declare
c83b764c7394efa3364915d973ae79c4ebed2437
[ "Apache-2.0" ]
92
2020-06-10T23:17:42.000Z
2020-09-25T10:50:13.000Z
idea/testData/shortenRefs/this/shortenExtensionThis.kt
qussarah/declare
c83b764c7394efa3364915d973ae79c4ebed2437
[ "Apache-2.0" ]
54
2016-02-29T16:27:38.000Z
2020-12-26T15:02:23.000Z
class A(val n: Int) { } fun A.foo(): Int = <selection>this.n + 1</selection>
15.6
52
0.602564
7537ca563e6f1aa87f9099029f6adddd23418314
733
lua
Lua
spec/02-DOM/13-CDATASection_spec.lua
alerque/expadom
d44fc52c6c1a9e265a3f012dce0fc35ab7da878f
[ "MIT" ]
1
2022-03-17T16:46:29.000Z
2022-03-17T16:46:29.000Z
spec/02-DOM/13-CDATASection_spec.lua
alerque/expadom
d44fc52c6c1a9e265a3f012dce0fc35ab7da878f
[ "MIT" ]
null
null
null
spec/02-DOM/13-CDATASection_spec.lua
alerque/expadom
d44fc52c6c1a9e265a3f012dce0fc35ab7da878f
[ "MIT" ]
1
2022-03-22T10:49:02.000Z
2022-03-22T10:49:02.000Z
describe("CDATASection:", function() local CDATASection = require "expadom.CDATASection" describe("properties:", function() it("reports proper nodeName", function() local cd = CDATASection { data = "hello world" } assert.equal("#cdata-section", cd.nodeName) end) it("reports proper nodeValue", function() local cd = CDATASection { data = "hello world" } assert.equal("hello world", cd.nodeValue) end) end) describe("methods:", function() local c before_each(function() c = CDATASection { data = "anything" } end) describe("write()", function() it("exports data and returns buffer", function() assert.same({ "<![CDATA[anything]]>" }, c:write({})) end) end) end) end)
16.659091
56
0.648022
396896a1e17e315c15cbca0adec0f3272bb22e48
17,484
html
HTML
application/platform/view/index/mansonglist.html
tzwjt/xcshop
780d7dbc0893c9db02deb0156281d1bb2c329ab7
[ "Apache-2.0" ]
null
null
null
application/platform/view/index/mansonglist.html
tzwjt/xcshop
780d7dbc0893c9db02deb0156281d1bb2c329ab7
[ "Apache-2.0" ]
null
null
null
application/platform/view/index/mansonglist.html
tzwjt/xcshop
780d7dbc0893c9db02deb0156281d1bb2c329ab7
[ "Apache-2.0" ]
null
null
null
<!DOCTYPE html> <html> <head> <meta name="renderer" content="webkit"/> <meta http-equiv="X-UA-COMPATIBLE" content="IE=edge,chrome=1"/> <title>{$platformName}</title> <link rel="stylesheet" type="text/css" href="__STATIC__/blue/bootstrap/css/bootstrap.css"/> <link rel="stylesheet" type="text/css" href="__STATIC__/blue/css/ns_blue_common.css"/> <link rel="stylesheet" type="text/css" href="__STATIC__/font-awesome/css/font-awesome.min.css"/> <link rel="stylesheet" type="text/css" href="__STATIC__/simple-switch/css/simple.switch.three.css"/> <link rel="stylesheet" type="text/css" href="__STATIC__/layui/css/layui.css"> <style> .Switch_FlatRadius.On span.switch-open { background-color: #0072D2; border-color: #0072D2; } </style> <script src="__STATIC__/js/jquery-1.8.1.min.js"></script> <script src="__STATIC__/blue/bootstrap/js/bootstrap.js"></script> <script src="__STATIC__/bootstrap/js/bootstrapSwitch.js"></script> <script src="__STATIC__/simple-switch/js/simple.switch.js"></script> <script src="__STATIC__/js/jquery.unobtrusive-ajax.min.js"></script> <script src="__STATIC__/js/common.js"></script> <script src="__STATIC__/js/seller.js"></script> <script src="__STATIC__/admin/js/jquery-ui.min.js"></script> <script src="__STATIC__/admin/js/ns_tool.js"></script> <link rel="stylesheet" type="text/css" href="__STATIC__/blue/css/ns_table_style.css"> <style> .modal-infp-style { width: 90%; margin: 10px auto; } .modal-infp-style table { width: 100%; } .modal-infp-style table tr td { border: 1px solid #e5e5e5; padding: 10px; } </style> </head> <body> {include file='index/head'/} <div id="vue-main" v-cloak> <article class="ns-base-article"> <aside class="ns-base-aside"> {include file="index/nav_left"/} <nav> <ul> <li onclick="location.href='{:url('coupontypelist')}';" title="优惠券">优惠券</li> <li onclick="location.href='{:url('pointconfig')}';" title="积分管理">积分管理</li> <li class="selected" onclick="location.href='{:url('mansonglist')}';" title="满减送">满减送</li> <li onclick="location.href='{:url('getdiscountlist')}';" title="限时折扣">限时折扣</li> <li onclick="location.href='{:url('fullshipping')}';" title="满额包邮">满额包邮</li> </ul> </nav> <div style="height:50px;"></div> <div id="bottom_copyright"> <footer> <img id="copyright_logo"/> <p> <span id="copyright_desc"></span> <br/> <span id="copyright_companyname"></span> <br/> <span id="copyright_meta"></span> </p> </footer> </div> </aside> <section class="ns-base-section"> <!-- 操作提示 --> <div class="ns-warm-prompt" > <div class="alert alert-info"> <button type="button" class="close" onclick="$('.ns-warm-prompt').hide();">&times;</button> <h4> <i class="fa fa-bell"></i> <span>操作提示</span> </h4> <div style="font-size:12px;text-indent:18px;"> 满减送 </div> </div> </div> <div style="position:relative;margin:10px 0;"> <!-- 三级导航菜单 --> <nav class="ns-third-menu"> <ul> <li :class="{selected:status==-1}" @click="searchByStatus(-1)">全部 </li> <li :class="{selected:status==0}" @click="searchByStatus(0)">未发布 </li> <li :class="{selected:status==1}" @click="searchByStatus(1)">进行中 </li> <li :class="{selected:status==3}" @click="searchByStatus(3)">已关闭 </li> <li :class="{selected:status==4}" @click="searchByStatus(4)">已结束 </li> </ul> </nav> <div class="right-side-operation"> <ul> <li><a href="{:url('mansong')}" style="color:#0072D2;"><i class="fa fa-plus-circle"></i>&nbsp;添加满减送活动</a></li> </ul> </div> </div> <div class="ns-main"> <table class="mytable"> <tr> <th width="10%" style="text-align: left;"> <button class="btn btn-small" @click="delData()">批量删除</button> </th> <th width="10%"> <input type="text" id='search_text' placeholder="请输入活动名称" class="input-common"/> <input type="button" @click="searchData()" value="搜索" class="btn-common"/> </th> </tr> </table> <table class="table-class"> <thead> <tr align="center"> <th><input type="checkbox" @click="checkAll()" v-model="allCheck"></th> <th>活动名称</th> <th>有效时间</th> <th>活动状态</th> <th>操作</th> </tr> </thead> <tbody> <tr align="center" v-for="(item,index) in mansongList"> <td> <div class="cell"><label><input name="sub_use" type="checkbox" v-model="item.check" @click="isAllCheck()"></label> </div> </td> <td>{{item.mansong_name}}</td> <td>{{item.start_time}} 至{{item.end_time}}</td> <td>{{item.status_name}}</td> <td> <a style="color:#0072D2" :href="'{:url('mansong')}'+'&mansong_id='+item.id" v-if="showBtn(item.status,'edit')">编辑</a>&nbsp; <a style="color:#0072D2" href="javascript:void(0);" @click="closeMansong(item.id)" v-if="showBtn(item.status,'close')">关闭</a>&nbsp; <a style="color:#0072D2" href="javascript:void(0);" @click="mansongInfo(index)">详情</a>&nbsp; </td> </tr> <tr align="center" v-if="mansongList.length==0"> <td colspan="9">暂无符合条件的数据记录</td> </tr> <tr style="background-color: #fff;"> <td id="pagelist" style="text-align: center" colspan="7"></td> </tr> </tbody> </table> </div> </section> </article> <!-- 模态框(Modal) --> <div class="modal fade hide" id="mansongInfo" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h3>满减送详情</h3> </div> <div class="modal-body"> <div class="modal-infp-style"> <table> <tr> <td style="width:60px;">活动名称</td> <td colspan='5' id="gift_name">{{nowMansong.mansong_name}}</td> </tr> <tr> <td>有效期</td> <td colspan='5' id="time">{{nowMansong.start_time}}到{{nowMansong.end_time}}</td> </tr> <tr> <td>活动状态</td> <td colspan='5' id="status">{{nowMansong.status_name}}</td> </tr> <tr> <td colspan='6'>优惠规则</td> </tr> <tr id="rule"> <td>满足金额</td> <td>减现金</td> <td>免邮费</td> <td>送积分</td> <td>送优惠券</td> <td>送赠品</td> </tr> <tr class="rule" v-for="item in nowMansong.rule"> <td>{{item.price}}</td> <td>{{item.discount}}</td> <td>{{item.free_shipping?'是':'否'}}</td> <td>{{item.give_point}}</td> <td>{{item.coupon_name}}</td> <td>{{item.gift_id}}</td> </tr> <tr> <td colspan='6'>商品列表</td> </tr> <tr v-if="nowMansong.range_type==1"> <td colspan="6" style="text-align: center">全部商品</td> </tr> <tr v-for="(item,index) in nowMansong.goods_list"> <td colspan="6">{{index+1}}.{{item.goods_name}}</td> </tr> </table> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button> </div> </div> </div> </div> </div> <link rel="stylesheet" type="text/css" href="__STATIC__/admin/css/jquery-ui-private.css"> <script> var platform_shopname = '{$platformInfo.platform_site_name}'; </script> <script type="text/javascript" src="__STATIC__/admin/js/jquery-ui-private.js" charset="utf-8"></script> <script type="text/javascript" src="__STATIC__/admin/js/jquery.timers.js"></script> <script type="text/javascript" src="__STATIC__/vue/vue.js"></script> <script type="text/javascript" src="__STATIC__/vue/vue-resource.js"></script> <script type="text/javascript" src="__STATIC__/layer/layer.js"></script> <script type="text/javascript" src="__STATIC__/layui/layui.js"></script> <script> var vueMain; $(function () { vueMain = new Vue({ el: "#vue-main", data: { mansongList: [], page_index: 1, page_size: 10, search_text: '', nowMansong: {}, status: -1, allCheck: false }, mounted: function () { this.getInfo(); }, methods: { getInfo: function () { this.$http.post("{:url('platform/Promotion/mansongList')}", { page_index: this.page_index, page_size: this.page_size, search_text: this.search_text, status: this.status }, {emulateJSON: true}).then(function (res) { if (res.data.code == 0) { this.mansongList = res.data.data.mansong_list.data; for (i = 0; i < this.mansongList.length; i++) { this.mansongList[i].check = false; } layui.use(['laypage', 'layer'], function () { var laypage = layui.laypage, layer = layui.layer; laypage.render({ elem: 'pagelist', count: res.data.data.mansong_list.total_count, limit: vueMain.page_size, layout: ['count', 'prev', 'page', 'next', 'skip'], curr: vueMain.page_index, jump: function (obj, first) { if (!first) { vueMain.page_index = obj.curr; vueMain.getInfo(); } } }); }); } }); }, searchData:function () { var search_text=$("#search_text").val(); this.search_text=search_text; this.page_index=1; this.status=-1; this.getInfo(); }, closeMansong: function (id) { layer.confirm('你确定要关闭这个满减送活动吗?', { btn: ['确定', '取消'] //按钮 }, function () { vueMain.$http.post("{:url('platform/Promotion/closeMansong')}", {mansong_id: id}, {emulateJSON: true}).then(function (res) { if (res.data.code == 0) { layer.alert(res.data.msg, {title: "提示", icon: 6}); vueMain.getInfo(); } else { layer.alert(res.data.msg, {title: "提示", icon: 5}); } }); }); }, mansongInfo: function (index) { this.$http.post("{:url('platform/Promotion/getMansongById')}", {mansong_id: this.mansongList[index].id}, {emulateJSON: true}).then(function (res) { if (res.data.code == 0) { this.nowMansong = res.data.data.mansong_info; $("#mansongInfo").modal("show"); } }); }, showBtn: function (status, btnInfo) { if (btnInfo == "edit") { if (status < 2) { return true; } else { return false; } } if (btnInfo == "close") { if (status < 3) { return true; } else { return false; } } }, checkAll: function () { for (i = 0; i < this.mansongList.length; i++) { this.mansongList[i].check = this.allCheck; } }, isAllCheck:function () { for (i = 0; i < this.mansongList.length; i++) { if(!this.mansongList[i].check){ this.allCheck=false; } } }, delData:function () { var mansong_id='' for (i = 0; i < this.mansongList.length; i++) { if(this.mansongList[i].check){ if(mansong_id==''){ mansong_id=this.mansongList[i].id; }else{ mansong_id+=","+this.mansongList[i].id; } } } if(mansong_id==''){ layer.alert("请先选择所需删除的数据",{icon:5}); }else{ layer.confirm('你确定要删除所需的数据吗?', { btn: ['确定', '取消'] //按钮 }, function () { vueMain.$http.post("{:url('platform/Promotion/delMansong')}", {mansong_id: mansong_id}, {emulateJSON: true}).then(function (res) { if (res.data.code == 0) { layer.alert(res.data.msg,{icon:6}); vueMain.getInfo(); }else{ layer.alert(res.data.msg,{icon:5}); } }); }); } }, searchByStatus:function (status) { this.page_index=1; this.search_text=''; this.status=status; this.getInfo(); } } }); }); </script> </body> </html>
44.151515
142
0.387097
16c111bc064b6755faf99a842a66efad336faff7
226
ts
TypeScript
projects/web/src/utils/components.ts
raulfdm/medium-blog
d615febfd1792ccd3ba2d9f3ef18d7f1c41d0213
[ "MIT" ]
10
2020-03-31T23:30:34.000Z
2022-02-19T05:36:27.000Z
projects/web/src/utils/components.ts
raulfdm/raulmelo.dev
d615febfd1792ccd3ba2d9f3ef18d7f1c41d0213
[ "MIT" ]
374
2020-03-08T20:47:19.000Z
2020-11-28T11:47:35.000Z
projects/web/src/utils/components.ts
raulfdm/medium-blog
d615febfd1792ccd3ba2d9f3ef18d7f1c41d0213
[ "MIT" ]
3
2020-04-03T01:35:20.000Z
2021-08-13T07:19:50.000Z
import React from 'react'; import { equals } from 'ramda'; // eslint-disable-next-line @typescript-eslint/explicit-function-return-type export const deepMemo = <T>(component: React.SFC<T>) => React.memo(component, equals);
32.285714
76
0.734513
2a6e50bdd9d44841a471e131b909e1129fdddc51
3,373
java
Java
src/kripto/algs/MyCamellia.java
BNikola/Crypto
1c15dd9354d1aeb6f1bbe1387c1a78556e51348c
[ "MIT" ]
null
null
null
src/kripto/algs/MyCamellia.java
BNikola/Crypto
1c15dd9354d1aeb6f1bbe1387c1a78556e51348c
[ "MIT" ]
null
null
null
src/kripto/algs/MyCamellia.java
BNikola/Crypto
1c15dd9354d1aeb6f1bbe1387c1a78556e51348c
[ "MIT" ]
null
null
null
package kripto.algs; import org.bouncycastle.crypto.DataLengthException; import org.bouncycastle.crypto.InvalidCipherTextException; import org.bouncycastle.crypto.engines.CamelliaEngine; import org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher; import org.bouncycastle.crypto.params.KeyParameter; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; import javax.crypto.ShortBufferException; import java.io.*; import java.security.SecureRandom; public class MyCamellia { private PaddedBufferedBlockCipher encryptCipher; private PaddedBufferedBlockCipher decryptCipher; private static final int KEY_LENGTH = 32; // buffers to transfer bytes from one stream to another private byte[] buf = new byte[16]; private byte[] obuf = new byte[512]; private byte[] key = new byte[KEY_LENGTH]; // region Constructors public MyCamellia() { SecureRandom secureRandom = new SecureRandom(); secureRandom.nextBytes(key); InitCiphers(); } public MyCamellia(byte[] keyBytes) { key = new byte[keyBytes.length]; System.arraycopy(keyBytes, 0 , key, 0, keyBytes.length); InitCiphers(); } // endregion // region Getters and setters public byte[] getKey() { return key; } public void setKey(byte[] key) { this.key = key; } public static int getKeyLength() { return KEY_LENGTH; } // endregion private void InitCiphers() { encryptCipher = new PaddedBufferedBlockCipher(new CamelliaEngine()); encryptCipher.init(true, new KeyParameter(key)); decryptCipher = new PaddedBufferedBlockCipher(new CamelliaEngine()); decryptCipher.init(false, new KeyParameter(key)); } public void encrypt(InputStream in, OutputStream out) throws ShortBufferException, IllegalBlockSizeException, BadPaddingException, DataLengthException, IllegalStateException, InvalidCipherTextException { try { int noBytesRead = 0; //number of bytes read from input int noBytesProcessed = 0; //number of bytes processed while ((noBytesRead = in.read(buf)) >= 0) { noBytesProcessed = encryptCipher.processBytes(buf, 0, noBytesRead, obuf, 0); out.write(obuf, 0, noBytesProcessed); } noBytesProcessed = encryptCipher.doFinal(obuf, 0); out.write(obuf, 0, noBytesProcessed); out.flush(); } catch (java.io.IOException e) { System.out.println(e.getMessage()); } } public void decrypt(InputStream in, OutputStream out) throws InvalidCipherTextException { try { int noBytesRead = 0; int noBytesProcessed = 0; while ((noBytesRead = in.read(buf)) >= 0) { noBytesProcessed = decryptCipher.processBytes(buf, 0, noBytesRead, obuf, 0); out.write(obuf, 0, noBytesProcessed); } noBytesProcessed = decryptCipher.doFinal(obuf, 0); out.write(obuf, 0, noBytesProcessed); out.flush(); } catch (IOException e) { e.printStackTrace(); } } }
29.077586
93
0.627928
3ddd68d1f39f783c630afdcf674b0ee4672352be
509
swift
Swift
VideoClipAnnotationEditor/VideoClipDelegate.swift
fleurdeswift/video-clip-annotation-editor
e3a4df29748202d9ce146190bb6387b82d0e7fbc
[ "MIT" ]
2
2016-06-22T04:57:55.000Z
2017-12-02T19:07:56.000Z
VideoClipAnnotationEditor/VideoClipDelegate.swift
fleurdeswift/video-clip-annotation-editor
e3a4df29748202d9ce146190bb6387b82d0e7fbc
[ "MIT" ]
null
null
null
VideoClipAnnotationEditor/VideoClipDelegate.swift
fleurdeswift/video-clip-annotation-editor
e3a4df29748202d9ce146190bb6387b82d0e7fbc
[ "MIT" ]
null
null
null
// // VideoClipDelegate.swift // VideoClipAnnotationEditor // // Copyright © 2015 Fleur de Swift. All rights reserved. // import Foundation public protocol VideoClipDelegate : class { func currentTimeChanged(videoClipView: VideoClipView, point: VideoClipPoint?, event: NSEvent?); func selectionChanged(videoClipView: VideoClipView, range: VideoClipRange?) func selectionChanged(videoClipView: VideoClipView, annotations: Set<HashAnnotation>?) } @objc public protocol VideoClipDelegateIB { }
26.789474
99
0.777996
5de784ef6dee804ec76e8ceaa9cfc728f505db63
294
go
Go
client/endpoint/input.go
rafaeljesus/go-graylog
0a0d82ce54044f8f174da034b969744f3180ebf1
[ "MIT" ]
1
2021-08-03T19:25:45.000Z
2021-08-03T19:25:45.000Z
client/endpoint/input.go
rafaeljesus/go-graylog
0a0d82ce54044f8f174da034b969744f3180ebf1
[ "MIT" ]
null
null
null
client/endpoint/input.go
rafaeljesus/go-graylog
0a0d82ce54044f8f174da034b969744f3180ebf1
[ "MIT" ]
null
null
null
package endpoint import ( "net/url" ) // Inputs returns an Input API's endpoint url. func (ep *Endpoints) Inputs() string { return ep.inputs.String() } // Input returns an Input API's endpoint url. func (ep *Endpoints) Input(id string) (*url.URL, error) { return urlJoin(ep.inputs, id) }
18.375
57
0.697279
84d8fff1c46e3ff8d9f5c65aaa0723de44012020
7,228
h
C
modules/charge_only_mode/venus2_assets/battery_charge_background.h
namagi/android_device_motorola_qcom-common
2114ad2edd693c4873e8a2897ea84864395a4c43
[ "FTL" ]
2
2015-02-16T19:40:17.000Z
2015-02-17T15:42:35.000Z
modules/charge_only_mode/venus2_assets/battery_charge_background.h
namagi/android_device_motorola_qcom-common
2114ad2edd693c4873e8a2897ea84864395a4c43
[ "FTL" ]
null
null
null
modules/charge_only_mode/venus2_assets/battery_charge_background.h
namagi/android_device_motorola_qcom-common
2114ad2edd693c4873e8a2897ea84864395a4c43
[ "FTL" ]
11
2017-01-14T22:29:16.000Z
2019-02-12T22:17:20.000Z
static const unsigned char battery_charge_background_bits[] = { 0x1f,0x8b,0x08,0x00,0xa1,0x23,0x0e,0x4e,0x02,0x03,0xed,0xda,0x31,0x68,0x1a,0x6d, 0x1c,0xc7,0xf1,0x1b,0x3a,0x38,0x38,0x38,0x64,0x70,0xe8,0xa0,0x70,0x01,0x0f,0x32, 0xe4,0xa0,0x43,0x0e,0xb2,0x28,0x38,0x34,0x90,0xa1,0x07,0x19,0x7a,0xd0,0x45,0xf1, 0x85,0x44,0x1c,0x8a,0x50,0x08,0xd2,0xa9,0x21,0x83,0x48,0x86,0x52,0x3a,0x94,0x4c, 0x05,0x0d,0x28,0x71,0x28,0xa4,0x43,0xc1,0xa9,0x90,0x1b,0x84,0x64,0x28,0x98,0x21, 0x90,0xa5,0x81,0x2b,0x58,0x70,0xe8,0xd0,0xa1,0xcb,0xfb,0x7f,0xee,0xb9,0x23,0xb4, 0xef,0x94,0x36,0xef,0xab,0xc7,0xfb,0xfd,0xfd,0x26,0x87,0xcb,0xc9,0xf3,0xf1,0xff, 0x78,0x8f,0xc4,0x77,0x6a,0x16,0x4d,0x5a,0x7d,0xe7,0x6d,0xc6,0x20,0x89,0xcb,0xdb, 0x0c,0x6e,0xb8,0x11,0xdc,0x08,0x6e,0xb8,0x11,0xdc,0x08,0x6e,0xb8,0x11,0xdc,0x08, 0x6e,0x04,0x37,0xdc,0x08,0x6e,0x04,0x37,0xdc,0x08,0x6e,0x04,0x37,0xdc,0x58,0x05, 0xdc,0x08,0x6e,0x04,0x37,0xdc,0x08,0x6e,0x77,0x91,0x9a,0x95,0xae,0x0e,0x9b,0x8d, 0xfa,0x4a,0x75,0x5a,0x19,0x78,0x6d,0xf7,0xe1,0x46,0x61,0x23,0x55,0x0a,0x8a,0xbe, 0xd3,0x73,0xf6,0xed,0xb8,0x3d,0x79,0x75,0xe4,0xf8,0xd2,0xc0,0x49,0x95,0x7c,0xe7, 0x63,0x16,0xb7,0xf9,0x66,0xb3,0x7e,0xde,0x6a,0xd4,0xd3,0xd5,0x71,0x68,0xa6,0xc4, 0x94,0x57,0xcd,0x2e,0x5b,0xa6,0x75,0x2f,0x7f,0x9d,0xbb,0xce,0xdd,0xcb,0xab,0x9a, 0x79,0xd3,0x5a,0xb6,0xca,0xd2,0xbf,0x6c,0x25,0x88,0xdb,0x7c,0xb3,0xda,0x19,0xb6, 0x36,0x6f,0xe5,0x56,0x93,0xf9,0x2b,0x6c,0xe0,0x36,0x67,0xb7,0xbd,0x61,0xf3,0xf6, 0x6e,0xa9,0x12,0x6e,0xb8,0xe1,0x86,0xdb,0xff,0xc5,0xed,0x97,0x6f,0xb7,0xf0,0x29, 0xb2,0x26,0x3a,0xa6,0x58,0x7d,0xce,0x7d,0xce,0x4a,0x73,0xaa,0x91,0x5e,0x64,0x17, 0xf0,0x5c,0x72,0x27,0xe9,0xd9,0xc3,0xe6,0xd6,0xf1,0xda,0xd9,0xda,0x59,0xf6,0xf4, 0x62,0xf4,0xfe,0xe4,0xf5,0xc9,0xd6,0xf1,0x83,0xee,0x52,0xf7,0xd3,0xe1,0xbb,0xc3, 0x97,0xaf,0x9e,0x76,0xec,0x4e,0x66,0x6f,0xf6,0xe2,0xbc,0x35,0x6c,0x1e,0xc8,0x33, 0xff,0xa6,0x3c,0xf5,0xa7,0xab,0x53,0x6f,0xec,0xf5,0xc5,0x6b,0xc7,0xdd,0xde,0x50, 0x4f,0xff,0x85,0x92,0x9a,0xb6,0x20,0x7c,0xda,0x3f,0x72,0x7a,0x3f,0x9d,0x03,0x6e, 0x4e,0x03,0x37,0x27,0x02,0x3f,0x3a,0x17,0xc8,0x35,0xc5,0x54,0x49,0xb5,0xa0,0x2a, 0x7f,0x4b,0x75,0x5b,0xba,0xe3,0xb6,0xa5,0x7d,0xe9,0xd8,0x53,0x6d,0xbb,0x8b,0x72, 0x82,0x58,0x0c,0xb7,0xb6,0x7b,0x31,0xba,0xbc,0xfa,0x30,0xd9,0x9d,0x3c,0x8e,0xdc, 0x9e,0x89,0xdb,0x52,0xf7,0x5b,0xa8,0xf6,0xa8,0xb3,0x2a,0x6a,0x62,0xd6,0x3a,0x90, 0x1d,0x71,0x45,0xa6,0x6b,0x5a,0xd1,0x62,0xda,0x2b,0x3e,0xad,0xf5,0x6c,0xbd,0x3f, 0x96,0x65,0xa6,0xd4,0x1e,0xa9,0xab,0x76,0xca,0x78,0xaf,0x8c,0x67,0x4e,0x55,0xcf, 0x9d,0xde,0x37,0x6b,0xb1,0xab,0x7d,0x73,0xca,0x0b,0x8a,0x5f,0x8a,0xda,0xd2,0x8a, 0x1c,0x95,0xa1,0xdc,0xd7,0x35,0xf3,0xb8,0xe9,0x59,0xcb,0x9e,0xde,0x0f,0x7e,0x2c, 0xbc,0x9b,0x9e,0xbe,0xb1,0x37,0x70,0xe7,0x3f,0x73,0x8b,0xe0,0x96,0xd9,0x7b,0x32, 0x5b,0x4f,0x8c,0x5b,0xdf,0x9d,0x7a,0xf3,0xff,0x76,0x5c,0x04,0xb7,0xef,0xa3,0x64, 0xb9,0xa9,0xbd,0x12,0x37,0xc3,0x58,0x0f,0x92,0xe6,0xb6,0x52,0xc5,0xcd,0x30,0x9e, 0xcf,0x92,0xe5,0x36,0xc0,0x0d,0x37,0xdc,0x70,0xc3,0x0d,0x37,0xdc,0x70,0xc3,0x0d, 0x37,0xdc,0xfe,0x38,0x5a,0xed,0xf2,0xea,0xcd,0x64,0x77,0xa1,0x7f,0x57,0x9e,0x4a, 0xbf,0x56,0xd2,0x72,0xe7,0x46,0x1d,0x37,0xc3,0x08,0x64,0x52,0xfa,0xe1,0xea,0xb4, 0xc3,0x86,0x0a,0xe1,0x1a,0xaa,0xb5,0x0c,0x9c,0x5f,0xeb,0xff,0x66,0xc5,0xd2,0xbe, 0x6d,0x23,0x59,0x47,0xab,0x6a,0xcf,0x7d,0x99,0xe9,0x62,0x0a,0xb7,0x9a,0xec,0x69, 0xfa,0xf3,0xfd,0x30,0x12,0x8b,0xb5,0xfc,0xdf,0x58,0xe9,0xbb,0x6d,0xfc,0x1f,0x60, 0x85,0xd0,0x6d,0x3b,0x7c,0x97,0x35,0xcb,0xcc,0xe3,0x86,0x1b,0x6e,0xb8,0xe1,0x86, 0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b, 0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e, 0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8, 0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1, 0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86, 0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b, 0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e, 0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8, 0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1, 0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86, 0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b, 0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e, 0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8, 0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1, 0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86, 0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b, 0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e, 0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8, 0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1, 0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86,0x1b,0x6e,0xb8,0xe1,0x86, 0x1b,0x6e,0xc9,0x71,0x2b,0x94,0x62,0x33,0xad,0xe6,0x87,0xbd,0x59,0xbf,0xfd,0xff, 0xd8,0x6b,0xff,0x1f,0x72,0xca,0x4d,0xbd,0x47,0xed,0x96,0x33,0x70,0x7b,0x32,0x5b, 0x0f,0x7e,0x5c,0x5d,0x5e,0xbd,0x99,0xec,0x9e,0xad,0x9d,0x65,0x4f,0x2f,0x46,0xef, 0x4f,0x5e,0x9f,0x6c,0x1d,0x3f,0xe8,0x2e,0x75,0x3f,0x1d,0xbe,0x3b,0x7c,0xf9,0xea, 0x69,0xc7,0xee,0x64,0xf6,0x66,0x2f,0xce,0x5b,0xc3,0xe6,0x41,0xb3,0x51,0xdf,0xac, 0xaf,0x54,0xd3,0xd5,0xa9,0x37,0xf6,0xfa,0x5e,0xdb,0xdd,0x71,0xd5,0xa4,0x16,0x36, 0x42,0xf1,0xa2,0x36,0x3f,0x72,0x7a,0xd2,0x7d,0xfb,0xe7,0xf6,0x1c,0xdd,0xa3,0xe8, 0x73,0xa1,0x4d,0xe4,0x9a,0xa2,0x72,0x49,0x85,0x9f,0x9a,0x42,0x38,0xf5,0x7a,0xfe, 0x77,0xdc,0xb6,0xb4,0x2f,0x1d,0xcb,0xbd,0xa6,0xd2,0xaf,0x95,0xb4,0xdc,0xb9,0x51, 0x37,0x70,0x33,0x9e,0xcf,0xb4,0xdc,0x87,0xc9,0xee,0xe4,0x71,0xe4,0xf6,0x4c,0xdc, 0x96,0xba,0xdf,0x42,0xb5,0x47,0x9d,0x55,0x51,0x13,0xb3,0xd6,0x41,0x53,0xc4,0xea, 0x22,0x56,0xd1,0x62,0xda,0x4b,0x69,0xf9,0xca,0x43,0x64,0x6a,0x76,0xd9,0x2a,0x5b, 0xcb,0x96,0x29,0x33,0xac,0x7b,0x9d,0x53,0x8d,0x5f,0xa9,0x9a,0x96,0xea,0xb2,0x55, 0x8e,0x5a,0x93,0xab,0x22,0x57,0x3b,0x36,0x55,0x9a,0x5f,0x8a,0xda,0xd2,0x8a,0x1c, 0x63,0xc5,0x81,0xb7,0x52,0xc5,0x0d,0x37,0xdc,0x70,0xc3,0x0d,0x37,0xdc,0x70,0xc3, 0x0d,0x37,0xdc,0xfe,0x2c,0xeb,0x41,0xb2,0xdc,0xc6,0xb8,0x85,0xf9,0x3e,0x4a,0x9a, 0x5b,0xdf,0xc5,0xcd,0x30,0x32,0x7b,0xc9,0x72,0x9b,0x7a,0x81,0x83,0x9b,0x61,0xf4, 0xec,0xec,0xe9,0xfd,0xc4,0xb8,0x8d,0xbd,0x81,0xfb,0x31,0x8b,0x9b,0x4a,0xdb,0xbd, 0x18,0x5d,0x2e,0xbc,0x9b,0x56,0xeb,0xbb,0x66,0x7e,0xfe,0x2b,0xb6,0x18,0x6e,0x6a, 0xe6,0x86,0xcd,0xad,0xe3,0xb5,0x85,0xfe,0x5d,0x79,0x2c,0xf7,0xf2,0x9d,0xf9,0xcf, 0xda,0x22,0xb9,0x11,0xdc,0x70,0x23,0xb8,0x11,0xdc,0x08,0x6e,0xb8,0x11,0xdc,0x08, 0x6e,0xb8,0x11,0xdc,0x08,0x6e,0xb8,0x11,0xdc,0x08,0x6e,0x04,0x37,0xdc,0x08,0x6e, 0x04,0x37,0xdc,0x08,0x6e,0x04,0x37,0xdc,0x70,0xc3,0x8d,0xe0,0x46,0x70,0xc3,0x8d, 0xe0,0x46,0x70,0xc3,0x8d,0xe0,0x46,0xfe,0x3d,0x37,0x33,0xaf,0xec,0x68,0xb2,0x6a, 0xe6,0xff,0x06,0x2d,0x8c,0x1f,0x5f,0x40,0xaa,0x01,0x00, }; struct asset battery_charge_background = { 220, 248, battery_charge_background_bits, sizeof(battery_charge_background_bits) - 1, NULL };
77.72043
94
0.790537
5231a1445df344c9e3db3827455d49e6cabc1900
634
asm
Assembly
programs/oeis/085/A085250.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/085/A085250.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/085/A085250.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A085250: 4 times hexagonal numbers: a(n) = 4*n*(2*n-1). ; 0,4,24,60,112,180,264,364,480,612,760,924,1104,1300,1512,1740,1984,2244,2520,2812,3120,3444,3784,4140,4512,4900,5304,5724,6160,6612,7080,7564,8064,8580,9112,9660,10224,10804,11400,12012,12640,13284,13944,14620,15312,16020,16744,17484,18240,19012,19800,20604,21424,22260,23112,23980,24864,25764,26680,27612,28560,29524,30504,31500,32512,33540,34584,35644,36720,37812,38920,40044,41184,42340,43512,44700,45904,47124,48360,49612,50880,52164,53464,54780,56112,57460,58824,60204,61600,63012,64440,65884,67344,68820,70312,71820,73344,74884,76440,78012 mul $0,2 bin $0,2 mul $0,4
90.571429
547
0.783912
5f268aa61efa807f94615dd4f3c7143ef44b56d0
903
ts
TypeScript
14/lib.test.ts
rh569/advent-of-code-2021
391f81f323d97cd9d7a96e20daa7832cdb87b514
[ "MIT" ]
null
null
null
14/lib.test.ts
rh569/advent-of-code-2021
391f81f323d97cd9d7a96e20daa7832cdb87b514
[ "MIT" ]
null
null
null
14/lib.test.ts
rh569/advent-of-code-2021
391f81f323d97cd9d7a96e20daa7832cdb87b514
[ "MIT" ]
1
2021-12-01T11:31:02.000Z
2021-12-01T11:31:02.000Z
import { assertEquals } from "https://deno.land/std@0.107.0/testing/asserts.ts"; import { part1, part2 } from "./lib.ts"; const testInput = `NNCB CH -> B HH -> N CB -> H NH -> C HB -> C HC -> B HN -> C NN -> C BH -> H NC -> B NB -> B BN -> B BB -> N BC -> B CC -> N CN -> C`; Deno.test("part1", () => { const want = 1588; const result = part1(testInput); assertEquals(result, want); }); Deno.test("part1 proper", async () => { const want = 3213; const input = await Deno.readTextFile("./input.txt"); const result = part1(input); assertEquals(result, want); }); Deno.test("part2", () => { const want = 2188189693529; const result = part2(testInput); assertEquals(result, want); }); Deno.test("part2 proper", async () => { const want = 3711743744429; const input = await Deno.readTextFile("./input.txt"); const result = part2(input); assertEquals(result, want); });
17.037736
80
0.611296
9fd6b786167b00271df74cc3f1ff8c7f3238aa4f
2,481
lua
Lua
Demos/UIFrameworkDemo/sb-sprites.lua
jessefreeman/GameCreator
c8277de37c8e552c14466e5197e38fc119250192
[ "MS-PL" ]
1
2020-12-10T21:09:52.000Z
2020-12-10T21:09:52.000Z
Demos/UIFrameworkDemo/sb-sprites.lua
jessefreeman/GameCreator
c8277de37c8e552c14466e5197e38fc119250192
[ "MS-PL" ]
null
null
null
Demos/UIFrameworkDemo/sb-sprites.lua
jessefreeman/GameCreator
c8277de37c8e552c14466e5197e38fc119250192
[ "MS-PL" ]
2
2020-01-18T16:39:37.000Z
2022-02-16T22:36:41.000Z
-- spritelib-start checkboxdisabled={width=1,unique=1,total=1,spriteIDs={5}} checkboxover={width=1,unique=1,total=1,spriteIDs={2}} checkboxselectedover={width=1,unique=1,total=1,spriteIDs={4}} checkboxselectedup={width=1,unique=1,total=1,spriteIDs={3}} checkboxup={width=1,unique=1,total=1,spriteIDs={1}} hsliderhandleover={width=3,unique=6,total=6,spriteIDs={38,39,40,53,54,55}} hsliderhandleup={width=3,unique=6,total=6,spriteIDs={8,9,10,23,24,25}} muteover={width=4,unique=12,total=12,spriteIDs={100,101,101,102,116,117,118,119,132,133,133,134}} muteselectedover={width=4,unique=12,total=12,spriteIDs={143,144,144,145,158,155,156,159,168,130,130,169}} muteselectedup={width=4,unique=12,total=12,spriteIDs={143,144,144,145,154,155,156,157,168,130,130,169}} muteup={width=4,unique=12,total=12,spriteIDs={97,98,98,99,112,113,114,115,129,130,130,131}} pagebutton1over={width=1,unique=2,total=2,spriteIDs={135,146}} pagebutton1selectedup={width=1,unique=2,total=2,spriteIDs={160,146}} pagebutton1up={width=1,unique=2,total=2,spriteIDs={104,121}} pagebutton2over={width=1,unique=2,total=2,spriteIDs={136,147}} pagebutton2selectedup={width=1,unique=2,total=2,spriteIDs={161,147}} pagebutton2up={width=1,unique=2,total=2,spriteIDs={105,122}} pagebutton3over={width=1,unique=2,total=2,spriteIDs={137,148}} pagebutton3selectedup={width=1,unique=2,total=2,spriteIDs={162,148}} pagebutton3up={width=1,unique=2,total=2,spriteIDs={106,123}} pagebutton4over={width=1,unique=2,total=2,spriteIDs={138,149}} pagebutton4selectedup={width=1,unique=2,total=2,spriteIDs={163,149}} pagebutton4up={width=1,unique=2,total=2,spriteIDs={107,124}} stepperbackdisabled={width=2,unique=6,total=6,spriteIDs={65,66,76,77,93,94}} stepperbackover={width=2,unique=6,total=6,spriteIDs={63,64,74,75,91,92}} stepperbackup={width=2,unique=6,total=6,spriteIDs={61,62,72,73,89,90}} steppernextdisabled={width=2,unique=6,total=6,spriteIDs={65,66,82,83,93,94}} steppernextover={width=2,unique=6,total=6,spriteIDs={63,64,80,81,91,92}} steppernextup={width=2,unique=6,total=6,spriteIDs={61,62,78,79,89,90}} vsliderhandleover={width=2,unique=6,total=6,spriteIDs={11,12,26,27,41,42}} vsliderhandleup={width=2,unique=6,total=6,spriteIDs={13,14,28,29,43,44}} cursorhand={width=2,unique=4,total=4,spriteIDs={36,37,51,52}} cursorhelp={width=2,unique=4,total=4,spriteIDs={87,88,95,96}} cursorpointer={width=2,unique=4,total=4,spriteIDs={6,7,21,22}} cursortext={width=2,unique=4,total=4,spriteIDs={59,60,70,71}} -- spritelib-end
62.025
105
0.764208
2f6c70631b8342caa06a447e1f31211a3fba81ab
1,286
php
PHP
app/Imports/UserImport.php
saigowtham48/curdtransformer
d2db16f88180ace828957ccc493a045b115d88d3
[ "MIT" ]
null
null
null
app/Imports/UserImport.php
saigowtham48/curdtransformer
d2db16f88180ace828957ccc493a045b115d88d3
[ "MIT" ]
null
null
null
app/Imports/UserImport.php
saigowtham48/curdtransformer
d2db16f88180ace828957ccc493a045b115d88d3
[ "MIT" ]
null
null
null
<?php namespace App\Imports; use App\User; use Maatwebsite\Excel\Concerns\ToModel; // use Maatwebsite\Excel\Concerns\withHeadingrow; use Illuminate\Support\Facades\Hash; class UserImport implements ToModel { /** * @param array $row * * @return \Illuminate\Database\Eloquent\Model|null */ public function model(array $row) { if ($row[0] == 'delete') { $user = User::where('email',$row[2])->where('name',$row[1])->first(); if ($user && Hash::check($row[3], $user->password)) { $user->delete(); } } if ($row[0] == 'insert') { $user = User::where('email',$row[2])->first(); if (!$user ) { $newuser = new User; $newuser->name = $row[1]; $newuser->email = $row[2]; $newuser->password = Hash::make($row[3]); $newuser->save(); } } if ($row[0] == 'update') { $user = User::where('email',$row[2])->first(); if ($user) { $user->name = $row[1]; $user->email = $row[2]; $user->password = Hash::make($row[3]); $user->save(); } } } }
25.215686
81
0.446345
38a72dc6c2a353a152140bbe4eb1336995809402
349
h
C
DailyKit/DKTypedef.h
grasource-wangpeng/DailyKit
adef5a47179a72e99af704571c2b2bbdf4012815
[ "MIT" ]
null
null
null
DailyKit/DKTypedef.h
grasource-wangpeng/DailyKit
adef5a47179a72e99af704571c2b2bbdf4012815
[ "MIT" ]
null
null
null
DailyKit/DKTypedef.h
grasource-wangpeng/DailyKit
adef5a47179a72e99af704571c2b2bbdf4012815
[ "MIT" ]
null
null
null
// // DKTypedef.h // DailyKit // // Created by 王鹏 on 2018/1/21. // Copyright © 2018年 WANGPENG. All rights reserved. // #ifndef DKTypedef_h #define DKTypedef_h /** 用于传参 @param parameters 参数字典 */ typedef void(^DKParameterSenderBlock)(NSDictionary *parameters); /** PopBlock */ typedef void(^DKPopBlock)(void); #endif /* DKTypedef_h */
13.423077
64
0.681948
43c184eb8321d1b153c5b594c3d304b644cf76bb
634
go
Go
align/pals/dp/sort.go
csw/biogo
d9fc0704034f216d05d6b2e752cd620a8ddc0041
[ "BSD-3-Clause" ]
341
2015-01-20T10:28:33.000Z
2022-03-25T08:43:03.000Z
align/pals/dp/sort.go
csw/biogo
d9fc0704034f216d05d6b2e752cd620a8ddc0041
[ "BSD-3-Clause" ]
47
2015-01-20T00:38:58.000Z
2022-01-12T03:29:20.000Z
align/pals/dp/sort.go
csw/biogo
d9fc0704034f216d05d6b2e752cd620a8ddc0041
[ "BSD-3-Clause" ]
67
2015-01-19T23:01:20.000Z
2022-02-03T12:38:47.000Z
// Copyright ©2011-2012 The bíogo Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package dp // Sort DPHits on start position. type starts Hits func (s starts) Len() int { return len(s) } func (s starts) Less(i, j int) bool { return s[i].Abpos < s[j].Abpos } func (s starts) Swap(i, j int) { s[i], s[j] = s[j], s[i] } // Sort DPHits on end position. type ends Hits func (e ends) Len() int { return len(e) } func (e ends) Less(i, j int) bool { return e[i].Aepos < e[j].Aepos } func (e ends) Swap(i, j int) { e[i], e[j] = e[j], e[i] }
17.611111
63
0.632492