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
| use anyhow::Result; | |
| use chrono::{DateTime, Local}; | |
| use std::collections::VecDeque; | |
| use std::fs::{metadata, read_dir}; | |
| use std::iter::once; | |
| use std::path::{Path, PathBuf}; | |
| use std::time::SystemTime; | |
| fn main() -> Result<()> { | |
| let mut queue = |
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
| use std::collections::HashMap; | |
| macro_rules! from_map { | |
| ($map: ident, $obj: ident, $field: ident) => { | |
| $obj.$field = $map.get(stringify!($field)).unwrap().to_string(); | |
| }; | |
| ($map: ident, $obj: ident, $head: ident, $($tail: ident), +) => { | |
| from_map!($map, $obj, $head); | |
| from_map!($map, $obj, $($tail), +); |
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
| #![warn(clippy::all)] | |
| #![warn(clippy::cargo)] | |
| //#![warn(clippy::expect_used)] | |
| #![warn(clippy::nursery)] | |
| //#![warn(clippy::panic_in_result_fn)] | |
| #![warn(clippy::pedantic)] | |
| #![allow(clippy::derive_partial_eq_without_eq)] | |
| #![allow(clippy::enum_glob_use)] | |
| #![allow(clippy::match_wildcard_for_single_variants)] | |
| #![allow(clippy::missing_errors_doc)] |
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
| fn var_opt<K>(key: K) -> Result<Option<String>> | |
| where | |
| K: AsRef<OsStr>, | |
| { | |
| use std::env::{var, VarError}; | |
| match var(key) { | |
| Ok(value) => Ok(Some(value)), | |
| Err(VarError::NotPresent) => Ok(None), | |
| _ => bail!("environment variable not found"), |
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
| param( | |
| [Parameter(Mandatory = $false, Position = 0, ValueFromRemainingArguments = $true)] | |
| [object[]] $Arguments | |
| ) | |
| Set-StrictMode -Version Latest | |
| $ErrorActionPreference = 'Stop' | |
| function Show-Usage { | |
| Write-Host -Object @" |
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 dump_diffs(x, y, parts): | |
| path = "/".join(parts) | |
| if x is None: | |
| if y is None: | |
| pass | |
| else: | |
| print(f"{path}: x value {x} does not match y value {y}") | |
| elif isinstance(x, int): | |
| if isinstance(y, int): | |
| if x == 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
| var x = new MyClass(100, 200); | |
| Console.WriteLine(x.Property0); | |
| Console.WriteLine(x.Property1); | |
| Console.WriteLine(x.Property2); | |
| Console.WriteLine(x.Property3); | |
| Console.WriteLine(x.Property4); | |
| class MyClass | |
| { | |
| public MyClass(int property0, int property1) |
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 prune_empty_dirs(dir, dry_run=True): | |
| for current_dir, ds, _ in os.walk(dir, topdown=False): | |
| for d in ds: | |
| p = os.path.join(current_dir, d) | |
| if os.path.isdir(p): | |
| try: | |
| if not dry_run: | |
| os.removedirs(p) | |
| except FileNotFoundError: | |
| pass |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <plan> | |
| <workbooks/> | |
| <users> | |
| <mappings> | |
| <userMappingx> | |
| <source mapping="user-mapping-source"/> | |
| <destination mapping="user-mapping-destination"/> | |
| </userMappingx> | |
| <groupMapping> |
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
| { | |
| "editor.formatOnSave": true, | |
| "editor.renderControlCharacters": true, | |
| "editor.renderWhitespace": "all", | |
| "editor.rulers": [ | |
| 72 | |
| ], | |
| "editor.tabSize": 4, | |
| "editor.wordWrap": "off", | |
| "editor.wordWrapColumn": 72, |
NewerOlder