This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| """ | |
| Batch rename helper for VP 5.0 alpha changes. | |
| Defaults: | |
| - Scans every mod folder under the default Civ5 MODS directory. | |
| - Skips VP核心模組(但保留 Community Events),除非使用 --include-vp。 | |
| - Applies a set of string replacements to text files (xml, sql, lua, modinfo, civ5proj, txt). | |
| This only rewrites file contents; it does not rename files. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def remove_duplicates_ignore_timestamp(filename): | |
| seen = set() | |
| temp_filename = filename + '.temp' | |
| with open(filename, 'r') as f, open(temp_filename, 'w') as temp_file: | |
| for line in f: | |
| # Strip the timestamp | |
| stripped_line = line[12:] | |
| if stripped_line not in seen: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import subprocess | |
| import sys | |
| # Directory paths | |
| plugins_dir = "./plugins/" | |
| dialogue_dir = "yamls/dialogue/" | |
| script_dir = "yamls/script/" | |
| # Ensure the output directories exist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @propertyWrapper | |
| struct SmallNumber { | |
| private var maximum: Int | |
| private var number: Int | |
| var wrappedValue: Int { | |
| get { return number } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class TaggedWeak<T: AnyObject, Hash: Hashable>: Hashable { | |
| public static func == (lhs: TaggedWeak<T, Hash>, rhs: TaggedWeak<T, Hash>) -> Bool { | |
| lhs.hash == rhs.hash | |
| } | |
| public func hash(into hasher: inout Hasher) { | |
| hasher.combine(hash) | |
| } | |
| public weak var value: T? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public struct TaggedWeak<T: AnyObject, Hash: Hashable>: Hashable { | |
| public static func == (lhs: TaggedWeak<T, Hash>, rhs: TaggedWeak<T, Hash>) -> Bool { | |
| lhs.hash == rhs.hash | |
| } | |
| public func hash(into hasher: inout Hasher) { | |
| hasher.combine(hash) | |
| } | |
| public weak var value: T? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import tensorflow as tf | |
| import random | |
| def genSequence(): | |
| len = 101 | |
| X = [] | |
| for i in range(1, len): | |
| X.append([[random.random()]]*i) | |
| y = [] | |
| for i in range(1, len): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import tensorflow as tf | |
| import random | |
| def genSequence(): | |
| len = 101 | |
| X = [] | |
| for i in range(1, len): | |
| X.append([[random.random()]]*i) | |
| y = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| infix operator <<<: CompositionPrecedence | |
| precedencegroup CompositionPrecedence { | |
| associativity: left | |
| } | |
| public func <<<<A, B, C>( | |
| _ g: @escaping (B) -> C, | |
| _ f: @escaping (A) -> B |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Cocoa | |
| import Combine | |
| var subscriptions = Set<AnyCancellable>() | |
| func futureIncrement( | |
| integer: Int, | |
| afterDelay delay: TimeInterval) -> AnyPublisher<Int, Never> { | |
| Deferred { |
NewerOlder